📄 productuser.aspx.cs
字号:
this.EgdvChildProductsDataBind();
}
private void DisplayColumns(string headerText, bool visible)
{
foreach (GridViewTemplateField field in this.EgvChildProducts.Columns)
{
if (field.HeaderText == headerText)
{
field.Visible = visible;
break;
}
}
}
protected void EgdvChildProducts_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string dataItem = e.Row.DataItem as string;
CheckBox box = (CheckBox) e.Row.FindControl("ChkIsValid");
Label label = (Label) e.Row.FindControl("LblProperty");
label.Text = dataItem;
if (((this.m_Action == "modify") && (this.m_ProductInfo != null)) && !this.Page.IsPostBack)
{
int dataItemIndex = e.Row.DataItemIndex;
if (this.m_ProductDataInfoList.Count > dataItemIndex)
{
box.Checked = this.m_ProductDataInfoList[dataItemIndex].IsValid;
TextBox box2 = (TextBox) e.Row.FindControl("TxtChildStocks");
box2.Text = this.m_ProductDataInfoList[dataItemIndex].Stocks.ToString();
TextBox box3 = (TextBox) e.Row.FindControl("TxtChildAlarmNum");
box3.Text = this.m_ProductDataInfoList[dataItemIndex].AlarmNum.ToString();
TextBox box4 = (TextBox) e.Row.FindControl("TxtPrice");
box4.Text = this.m_ProductDataInfoList[dataItemIndex].PriceInfo.Price.ToString("0.00");
TextBox box5 = (TextBox) e.Row.FindControl("TxtUserPrice");
box5.Text = this.m_ProductDataInfoList[dataItemIndex].PriceInfo.PriceMember.ToString("0.00");
TextBox box6 = (TextBox) e.Row.FindControl("TxtAgentPrice");
box6.Text = this.m_ProductDataInfoList[dataItemIndex].PriceInfo.PriceAgent.ToString("0.00");
TextBox box7 = (TextBox) e.Row.FindControl("TxtNumber_Wholesale1");
box7.Text = this.m_ProductDataInfoList[dataItemIndex].PriceInfo.NumberWholesale1.ToString();
TextBox box8 = (TextBox) e.Row.FindControl("TxtNumber_Wholesale2");
box8.Text = this.m_ProductDataInfoList[dataItemIndex].PriceInfo.NumberWholesale2.ToString();
TextBox box9 = (TextBox) e.Row.FindControl("TxtNumber_Wholesale3");
box9.Text = this.m_ProductDataInfoList[dataItemIndex].PriceInfo.NumberWholesale3.ToString();
TextBox box10 = (TextBox) e.Row.FindControl("TxtPrice_Wholesale1");
box10.Text = this.m_ProductDataInfoList[dataItemIndex].PriceInfo.PriceWholesale1.ToString("0.00");
TextBox box11 = (TextBox) e.Row.FindControl("TxtPrice_Wholesale2");
box11.Text = this.m_ProductDataInfoList[dataItemIndex].PriceInfo.PriceWholesale2.ToString("0.00");
TextBox box12 = (TextBox) e.Row.FindControl("TxtPrice_Wholesale3");
box12.Text = this.m_ProductDataInfoList[dataItemIndex].PriceInfo.PriceWholesale3.ToString("0.00");
IList<ProductPriceInfo> productPriceInfoList = new List<ProductPriceInfo>();
if ((this.m_ProductInfo.PriceInfo.PriceMember == -1M) || (this.m_ProductInfo.PriceInfo.PriceAgent == -1M))
{
productPriceInfoList = ProductPrice.GetProductPrice(this.m_ProductInfo.ProductId, this.m_ProductInfo.TableName, dataItem);
}
if (this.m_ProductInfo.PriceInfo.PriceMember == -1M)
{
foreach (UserGroupsInfo info in UserGroups.GetGroupTable(GroupType.Register))
{
TextBox box13 = (TextBox) e.Row.FindControl("TxtGroupPrice" + info.GroupId);
if (box13 != null)
{
box13.Text = this.GetChildGroupPrice(info.GroupId, productPriceInfoList).ToString("0.00");
}
}
}
if (this.m_ProductInfo.PriceInfo.PriceAgent == -1M)
{
foreach (UserGroupsInfo info2 in UserGroups.GetGroupTable(GroupType.Agent))
{
TextBox box14 = (TextBox) e.Row.FindControl("TxtAgentGroupPrice" + info2.GroupId);
if (box14 != null)
{
box14.Text = this.GetChildGroupPrice(info2.GroupId, productPriceInfoList).ToString("0.00");
}
}
}
}
}
}
}
private void EgdvChildProductsDataBind()
{
IList<string> list = this.ChildProductList();
if ((list != null) && (list.Count > 0))
{
this.EgvChildProducts.DataSource = list;
this.EgvChildProducts.DataBind();
this.EgvChildProducts.Visible = true;
this.LblChildProductsMsg.Visible = true;
}
else
{
this.EgvChildProducts.Visible = false;
this.LblChildProductsMsg.Visible = false;
}
}
private decimal GetChildGroupPrice(int groupId, IList<ProductPriceInfo> productPriceInfoList)
{
foreach (ProductPriceInfo info in productPriceInfoList)
{
if (info.GroupId == groupId)
{
return info.Price;
}
}
return 0M;
}
private DataTable GetDataTableFromRepeater()
{
DataTable dataTable = new DataTable();
dataTable.Columns.Add("FieldName");
dataTable.Columns.Add("FieldValue");
dataTable.Columns.Add("FieldType");
dataTable.Columns.Add("FieldLevel");
foreach (RepeaterItem item in this.RepModel.Items)
{
FieldControl control = (FieldControl) item.FindControl("Field");
switch (control.ControlType)
{
case FieldType.TextType:
case FieldType.MultipleTextType:
case FieldType.KeywordType:
case FieldType.OperatingType:
case FieldType.Producer:
case FieldType.Trademark:
{
this.AddNewRows(dataTable, control.FieldName, DataSecurity.HtmlEncode(control.Value), control.ControlType, control.FieldLevel);
continue;
}
case FieldType.PictureType:
{
PictureType type2 = (PictureType) control.FindControl("PowerEasy2007");
this.AddNewRows(dataTable, control.FieldName, DataSecurity.HtmlEncode(type2.FieldValue), control.ControlType, control.FieldLevel);
if ((control.Settings.Count > 7) && DataConverter.CBool(control.Settings[7]))
{
this.AddNewRows(dataTable, "UploadFiles", DataSecurity.HtmlEncode(type2.UploadFiles), FieldType.TextType, 0);
}
continue;
}
case FieldType.FileType:
{
FileType type3 = (FileType) control.FindControl("PowerEasy2007");
this.AddNewRows(dataTable, control.FieldName, type3.FieldValue, control.ControlType, control.FieldLevel);
if (DataConverter.CBool(control.Settings[3]))
{
this.AddNewRows(dataTable, control.Settings[4], type3.FileSize, control.ControlType, control.FieldLevel);
}
continue;
}
case FieldType.ContentType:
{
ContentType type = (ContentType) control.FindControl("PowerEasy2007");
this.AddNewRows(dataTable, control.FieldName, StringHelper.RemoveXss(type.Content), control.ControlType, control.FieldLevel);
continue;
}
case FieldType.MultiplePhotoType:
{
MultiplePhotoType type4 = (MultiplePhotoType) control.FindControl("PowerEasy2007");
this.AddNewRows(dataTable, control.FieldName, DataSecurity.HtmlEncode(type4.FieldValue), control.ControlType, control.FieldLevel);
if (DataConverter.CBool(control.Settings[2]))
{
this.AddNewRows(dataTable, control.Settings[3], DataSecurity.HtmlEncode(type4.ThumbFieldValue), control.ControlType, control.FieldLevel);
}
continue;
}
case FieldType.Property:
{
continue;
}
}
this.AddNewRows(dataTable, control.FieldName, control.Value, control.ControlType, control.FieldLevel);
}
this.AddNewRows(dataTable, "DayHits", "0", FieldType.NumberType, 0);
this.AddNewRows(dataTable, "EliteLevel", "0", FieldType.NumberType, 0);
this.AddNewRows(dataTable, "Hits", "0", FieldType.NumberType, 0);
this.AddNewRows(dataTable, "Priority", "0", FieldType.NumberType, 0);
this.AddNewRows(dataTable, "WeekHits", "0", FieldType.NumberType, 0);
this.AddNewRows(dataTable, "MonthHits", "0", FieldType.NumberType, 0);
this.AddNewRows(dataTable, "UpdateTime", DateTime.Now.ToString(), FieldType.DateTimeType, 0);
this.AddNewRows(dataTable, "SpecialId", this.SpecialType1.FieldValue, FieldType.SpecialType, 0);
this.AddNewRows(dataTable, "InfoId", this.NodeType1.InfoNodeId, FieldType.InfoType, 0);
this.AddNewRows(dataTable, "NodeId", this.NodeType1.FieldValue, FieldType.NodeType, 0);
this.AddNewRows(dataTable, "Inputer", PEContext.Current.User.UserName, FieldType.TextType, 0);
this.AddNewRows(dataTable, "Title", DataSecurity.HtmlEncode(this.TxtProductName.Text), FieldType.TitleType, 0);
this.AddNewRows(dataTable, "Status", "99", FieldType.StatusType, 0);
return dataTable;
}
private void GetPresentInfo(ProductInfo productInfo)
{
if (this.RadSalePromotionType1.Checked)
{
productInfo.SalePromotionType = 0;
}
if (this.RadSalePromotionType2.Checked)
{
productInfo.SalePromotionType = 1;
productInfo.MinNumber = DataConverter.CLng(this.TxtMinNumber1.Text);
productInfo.PresentNumber = DataConverter.CLng(this.TxtPresentNumber1.Text);
}
if (this.RadSalePromotionType3.Checked)
{
if (string.IsNullOrEmpty(this.HdnPresentID.Value))
{
DynamicPage.WriteErrMsg("<li>请指定赠品ID</li>");
}
productInfo.SalePromotionType = 2;
productInfo.MinNumber = DataConverter.CLng(this.TxtMinNumber2.Text);
productInfo.PresentNumber = DataConverter.CLng(this.TxtPresentNumber2.Text);
productInfo.PresentId = DataConverter.CLng(this.HdnPresentID.Value);
}
if (this.RadSalePromotionType4.Checked)
{
productInfo.SalePromotionType = 3;
productInfo.MinNumber = 1;
productInfo.PresentNumber = DataConverter.CLng(this.TxtPresentNumber3.Text);
}
if (this.RadSalePromotionType5.Checked)
{
if (string.IsNullOrEmpty(this.HdnPresentID2.Value))
{
DynamicPage.WriteErrMsg("<li>请指定赠品ID</li>");
}
productInfo.SalePromotionType = 4;
productInfo.MinNumber = 1;
productInfo.PresentNumber = DataConverter.CLng(this.TxtPresentNumber4.Text);
productInfo.PresentId = DataConverter.CLng(this.HdnPresentID2.Value);
}
if (productInfo.MinNumber < 1)
{
productInfo.MinNumber = 1;
}
if (productInfo.PresentNumber < 1)
{
productInfo.PresentNumber = 1;
}
productInfo.PresentExp = DataConverter.CLng(this.TxtPresentExp.Text);
productInfo.PresentMoney = DataConverter.CLng(this.TxtPresentMoney.Text);
productInfo.PresentPoint = DataConverter.CLng(this.TxtPresentPoint.Text);
}
private void GetPriceInfoList()
{
if (this.RadGroupPrice.Checked)
{
foreach (RepeaterItem item in this.RptGroupPrice.Items)
{
ProductPriceInfo info = new ProductPriceInfo();
TextBox box = (TextBox) item.FindControl("TxtGroupPrice");
HiddenField field = (HiddenField) item.FindControl("HdnGroupID");
if (!string.IsNullOrEmpty(box.Text))
{
info.Price = DataConverter.CDecimal(box.Text);
info.GroupId = DataConverter.CLng(field.Value);
this.m_ProductPriceInfoList.Add(info);
this.ViewState["GroupPrice" + info.GroupId.ToString()] = info.Price;
}
}
}
if (this.RadAgentGroupPrice.Checked)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -