📄 productbatchmodify.aspx.cs
字号:
productInfo.ServiceTermUnit = (ServiceTermUnit) DataConverter.CLng(this.DropServiceTermUnit.SelectedValue);
continue;
}
case "DownloadUrl":
{
productInfo.DownloadUrl = this.TxtDownloadUrl.Text;
continue;
}
case "DownloadUrlRemark":
{
productInfo.Remark = this.TxtDownloadUrlRemark.Text;
continue;
}
case "EnableSale":
{
productInfo.EnableSale = this.ChkEnableSale.Checked;
continue;
}
case "ProductIntro":
{
if (this.TxtProductIntro.Text.Length > 0xff)
{
AdminPage.WriteErrMsg("<li>商品简介不能超过255字符!</li>");
}
productInfo.ProductIntro = this.TxtProductIntro.Text;
continue;
}
case "ProductExplain":
{
productInfo.ProductExplain = this.ProductExplain.Value;
continue;
}
case "ProductPic":
{
this.trProductPic.GetProductPic(productInfo);
continue;
}
case "Producer":
{
productInfo.ProducerName = this.trProducer.FieldValue;
continue;
}
case "Trademark":
{
productInfo.TrademarkName = this.trTrademark.FieldValue;
continue;
}
case "EnableBuyWhenOutofstock":
{
productInfo.EnableBuyWhenOutofstock = this.ChkEnableBuyWhenOutofstock.Checked;
continue;
}
case "LimitNum":
{
productInfo.LimitNum = DataConverter.CLng(this.TxtLimitNum.Text);
continue;
}
case "Stars":
{
productInfo.Stars = DataConverter.CLng(this.DropStars.SelectedValue);
continue;
}
case "Price_Market":
{
productInfo.PriceMarket = DataConverter.CDecimal(this.TxtPrice_Market.Text);
continue;
}
case "Price":
{
productInfo.PriceInfo.Price = DataConverter.CDecimal(this.TxtPrice.Text);
continue;
}
case "Wholesale":
{
this.SetWholesale(productInfo);
continue;
}
case "SingleSell":
{
productInfo.EnableSingleSell = this.RadEnableSingleSell.Checked;
productInfo.DependentProducts = this.DependentProduct.DependentProducts;
continue;
}
case "SalePromotion":
{
productInfo.SalePromotionType = this.SalePromotion.SalePromotionType;
productInfo.MinNumber = this.SalePromotion.MinNumber;
productInfo.PresentNumber = this.SalePromotion.PresentNumber;
productInfo.PresentId = DataConverter.CLng(this.SalePromotion.PresentId);
continue;
}
case "PresentPoint":
{
productInfo.PresentPoint = DataConverter.CLng(this.TxtPresentPoint.Text);
continue;
}
case "PresentExp":
{
productInfo.PresentExp = DataConverter.CLng(this.TxtPresentExp.Text);
continue;
}
case "PresentMoney":
{
productInfo.PresentMoney = DataConverter.CDecimal(this.TxtPresentMoney.Text);
continue;
}
}
}
}
private void SetWholesale(ProductInfo productInfo)
{
if (this.ChkEnableWholesale.Checked && (DataConverter.CLng(this.TxtLimitNum.Text) == 0))
{
productInfo.EnableWholesale = true;
productInfo.PriceInfo.NumberWholesale1 = DataConverter.CLng(this.TxtNumber_Wholesale1.Text);
productInfo.PriceInfo.NumberWholesale2 = DataConverter.CLng(this.TxtNumber_Wholesale2.Text);
productInfo.PriceInfo.NumberWholesale3 = DataConverter.CLng(this.TxtNumber_Wholesale3.Text);
productInfo.PriceInfo.PriceWholesale1 = DataConverter.CDecimal(this.TxtPrice_Wholesale1.Text);
productInfo.PriceInfo.PriceWholesale2 = DataConverter.CDecimal(this.TxtPrice_Wholesale2.Text);
productInfo.PriceInfo.PriceWholesale3 = DataConverter.CDecimal(this.TxtPrice_Wholesale3.Text);
}
else
{
productInfo.EnableWholesale = false;
}
}
protected void TxtLimitNum_TextChanged(object sender, EventArgs e)
{
if (DataConverter.CLng(this.TxtLimitNum.Text) > 0)
{
this.ChkEnableWholesale.Enabled = false;
}
else
{
this.ChkEnableWholesale.Enabled = true;
}
}
protected void WzdProductBachModify_FinishButtonClick(object sender, WizardNavigationEventArgs e)
{
if (this.Page.IsValid)
{
IList<string> chooseSystemField = this.ViewState["ChooseSystemField"] as List<string>;
Product product = new Product();
foreach (ListItem item in this.LstTargetProduct.Items)
{
product.GetProductAllDataById(DataConverter.CLng(item.Value));
ProductInfo productInfoData = product.ProductInfoData;
DataTable fields = productInfoData.Fields;
IList<FieldInfo> fieldList = Field.GetFieldList(DataConverter.CLng(fields.Rows[0]["ModelID"].ToString()), false);
productInfoData.Fields = this.GetDataTable(fieldList, fields, chooseSystemField);
IList<ProductDataInfo> productDataInfoList = product.ProductDataInfoList;
IList<ProductPriceInfo> productPriceInfoList = product.ProductPriceInfoList;
this.SetProductInfo(productInfoData, productDataInfoList, chooseSystemField);
Product.Update(DataConverter.CLng(item.Value), productInfoData, productDataInfoList, productPriceInfoList);
}
AdminPage.WriteSuccessMsg("批量编辑成功!", "ProductBatchModify.aspx");
}
}
protected void WzdProductBachModify_NextButtonClick(object sender, WizardNavigationEventArgs e)
{
if (this.LstTargetProduct.Items.Count == 0)
{
AdminPage.WriteErrMsg("<li>请选择要编辑的商品!</li>");
}
IDictionary<int, string> dictionary = new Dictionary<int, string>();
foreach (ListItem item in this.LstTargetProduct.Items)
{
dictionary.Add(DataConverter.CLng(item.Value), item.Text);
}
this.DlstProductList.DataSource = dictionary;
this.DlstProductList.DataBind();
IList<FieldInfo> fieldList = Field.GetFieldList(DataConverter.CLng(this.DropProductModel.SelectedValue), false);
IList<FieldInfo> list2 = new List<FieldInfo>();
IList<string> list3 = new List<string>();
IList<string> list4 = new List<string>();
foreach (ListItem item2 in this.LstField.Items)
{
if (item2.Selected)
{
bool flag = false;
foreach (string str in this.m_SystemFields)
{
string[] strArray = str.Split(new char[] { '|' });
if (item2.Value == strArray[0])
{
flag = true;
this.WzdProductBachModify.FindControl("tr" + strArray[0]).Visible = true;
list3.Add(item2.Value);
if (strArray[0] == "SingleSell")
{
this.trDependentProducts.Visible = true;
this.trDependentProducts.Style.Value = "display:none";
}
}
}
if (!flag)
{
foreach (FieldInfo info in fieldList)
{
if (info.FieldName == item2.Value)
{
list2.Add(info);
list4.Add(item2.Value);
break;
}
}
}
}
}
this.ViewState["ChooseSystemField"] = list3;
this.ViewState["ChooseCustomField"] = list4;
this.RepModel.DataSource = list2;
this.RepModel.DataBind();
}
protected void WzdProductBachModify_PreviousButtonClick(object sender, WizardNavigationEventArgs e)
{
IList<string> list = this.ViewState["ChooseSystemField"] as List<string>;
foreach (string str in list)
{
this.WzdProductBachModify.FindControl("tr" + str).Visible = false;
if (str == "SingleSell")
{
this.trDependentProducts.Visible = false;
this.RadDisabledSingleSell.Checked = false;
this.RadEnableSingleSell.Checked = true;
}
}
this.ViewState["ChooseSystemField"] = "";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -