📄 productuser.aspx.cs
字号:
{
foreach (RepeaterItem item2 in this.RptAgentGroupPrice.Items)
{
ProductPriceInfo info2 = new ProductPriceInfo();
TextBox box2 = (TextBox) item2.FindControl("TxtAgentGroupPrice");
HiddenField field2 = (HiddenField) item2.FindControl("HdnGroupID");
if (!string.IsNullOrEmpty(box2.Text))
{
info2.Price = DataConverter.CDecimal(box2.Text);
info2.GroupId = DataConverter.CLng(field2.Value);
this.m_ProductPriceInfoList.Add(info2);
this.ViewState["AgentGroupPrice" + info2.GroupId] = info2.Price;
}
}
}
}
private IList<ProductDataInfo> GetProductDataInfoList()
{
IList<ProductDataInfo> list = new List<ProductDataInfo>();
for (int i = 0; i < this.EgvChildProducts.Rows.Count; i++)
{
if (this.EgvChildProducts.Rows[i].RowType != DataControlRowType.DataRow)
{
continue;
}
ProductDataInfo productDataInfo = new ProductDataInfo();
productDataInfo.PropertyValue = ((Label) this.EgvChildProducts.Rows[i].FindControl("LblProperty")).Text;
productDataInfo.IsValid = ((CheckBox) this.EgvChildProducts.Rows[i].FindControl("ChkIsValid")).Checked;
int num2 = DataConverter.CLng(((TextBox) this.EgvChildProducts.Rows[i].FindControl("TxtChildStocks")).Text, -1);
if (num2 >= 0)
{
productDataInfo.Stocks = num2;
}
else
{
productDataInfo.Stocks = DataConverter.CLng(this.TxtStocks.Text);
}
int num3 = DataConverter.CLng(((TextBox) this.EgvChildProducts.Rows[i].FindControl("TxtChildAlarmNum")).Text, -1);
if (num3 >= 0)
{
productDataInfo.AlarmNum = num3;
}
else
{
productDataInfo.AlarmNum = DataConverter.CLng(this.TxtAlarmNum.Text);
}
decimal num4 = DataConverter.CDecimal(((TextBox) this.EgvChildProducts.Rows[i].FindControl("TxtPrice")).Text, -1M);
if (num4 >= 0M)
{
productDataInfo.PriceInfo.Price = num4;
}
else
{
productDataInfo.PriceInfo.Price = DataConverter.CDecimal(this.TxtPrice.Text);
}
if (this.RadMemberDiscount.Checked)
{
productDataInfo.PriceInfo.PriceMember = 0M;
}
if (this.RadMemberPrice.Checked)
{
decimal num5 = DataConverter.CDecimal(((TextBox) this.EgvChildProducts.Rows[i].FindControl("TxtUserPrice")).Text, -1M);
if (num5 >= 0M)
{
productDataInfo.PriceInfo.PriceMember = num5;
}
else
{
productDataInfo.PriceInfo.PriceMember = DataConverter.CDecimal(this.TxtPrice_Member.Text);
}
}
if (this.RadGroupPrice.Checked)
{
productDataInfo.PriceInfo.PriceMember = -1M;
}
if (this.RadAgentDiscount.Checked)
{
productDataInfo.PriceInfo.PriceAgent = 0M;
}
if (this.RadAgentPrice.Checked)
{
decimal num6 = DataConverter.CDecimal(((TextBox) this.EgvChildProducts.Rows[i].FindControl("TxtAgentPrice")).Text, -1M);
if (num6 >= 0M)
{
productDataInfo.PriceInfo.PriceAgent = num6;
}
else
{
productDataInfo.PriceInfo.PriceAgent = DataConverter.CDecimal(this.TxtPrice_Agent.Text);
}
}
if (this.RadAgentGroupPrice.Checked)
{
productDataInfo.PriceInfo.PriceAgent = -1M;
}
if (this.ChkEnableWholesale.Checked)
{
this.GetWholesale(i, productDataInfo);
}
list.Add(productDataInfo);
if (this.RadGroupPrice.Checked)
{
foreach (UserGroupsInfo info2 in UserGroups.GetGroupTable(GroupType.Register))
{
ProductPriceInfo item = new ProductPriceInfo();
TextBox box = (TextBox) this.EgvChildProducts.Rows[i].FindControl("TxtGroupPrice" + info2.GroupId.ToString());
if (box != null)
{
decimal num7 = DataConverter.CDecimal(box.Text, -1M);
if (num7 >= 0M)
{
item.Price = num7;
}
else
{
item.Price = DataConverter.CDecimal(this.ViewState["GroupPrice" + info2.GroupId]);
}
item.GroupId = info2.GroupId;
item.PropertyValue = productDataInfo.PropertyValue;
this.m_ProductPriceInfoList.Add(item);
}
}
}
if (this.RadAgentGroupPrice.Checked)
{
foreach (UserGroupsInfo info4 in UserGroups.GetGroupTable(GroupType.Agent))
{
ProductPriceInfo info5 = new ProductPriceInfo();
TextBox box2 = (TextBox) this.EgvChildProducts.Rows[i].FindControl("TxtAgentGroupPrice" + info4.GroupId.ToString());
if (box2 != null)
{
decimal num8 = DataConverter.CDecimal(box2.Text, -1M);
if (num8 >= 0M)
{
info5.Price = num8;
}
else
{
info5.Price = DataConverter.CDecimal(this.ViewState["AgentGroupPrice" + info4.GroupId]);
}
info5.GroupId = info4.GroupId;
info5.PropertyValue = productDataInfo.PropertyValue;
this.m_ProductPriceInfoList.Add(info5);
}
}
}
}
return list;
}
private void GetProductInfo(ProductInfo productInfo)
{
this.GetProductPriceInfo(productInfo);
this.GetPresentInfo(productInfo);
productInfo.Properties = "";
foreach (RepeaterItem item in this.RepModel.Items)
{
if ((item.ItemType != ListItemType.Item) && (item.ItemType != ListItemType.AlternatingItem))
{
continue;
}
FieldControl control = (FieldControl) item.FindControl("Field");
if (control.ControlType == FieldType.Property)
{
Property property = (Property) control.FindControl("PowerEasy2007");
string properties = property.Properties;
if (!string.IsNullOrEmpty(properties))
{
if (string.IsNullOrEmpty(productInfo.Properties))
{
productInfo.Properties = property.FieldAlias + "$$$" + properties;
continue;
}
productInfo.Properties = productInfo.Properties + "\n" + property.FieldAlias + "$$$" + properties;
}
}
}
productInfo.ProductName = this.TxtProductName.Text;
productInfo.ServiceTerm = DataConverter.CLng(this.TxtServiceTerm.Text);
productInfo.ServiceTermUnit = (ServiceTermUnit) DataConverter.CLng(this.DropServiceTermUnit.SelectedValue);
productInfo.StocksProject = (StocksProject) DataConverter.CLng(this.RadlStocksProject.SelectedValue);
productInfo.EnableBuyWhenOutofstock = this.ChkEnableBuyWhenOutofstock.Checked;
productInfo.ProductType = (ProductType) DataConverter.CLng(this.RadlProductType.SelectedValue);
productInfo.LimitNum = DataConverter.CLng(this.TxtLimitNum.Text);
productInfo.Weight = DataConverter.CDouble(this.TxtWeight.Text);
productInfo.Unit = this.ProductUnitPick.ProductUnit;
if (Product.IsExistSameProductNum(this.ProductNumber1.ProductNum))
{
DynamicPage.WriteErrMsg("<li>商品编号已存在!</li>");
}
else
{
productInfo.ProductNum = this.ProductNumber1.ProductNum;
}
productInfo.IncludeTax = this.TaxRateTypeSetting.TaxRate;
productInfo.TaxRate = DataConverter.CDouble(this.TxtTaxRate.Text);
productInfo.DownloadUrl = this.TxtDownloadUrl.Text;
productInfo.Remark = this.TxtDownloadUrlRemark.Text;
this.ProductPic1.GetProductPic(productInfo);
productInfo.Keyword = this.KeywordType.FieldValue;
productInfo.ProducerName = this.Producer.FieldValue;
productInfo.ProductExplain = StringHelper.RemoveXss(this.ProductExplain.Value);
productInfo.ProductIntro = this.TxtProductIntro.Text;
productInfo.BarCode = this.TxtBarCode.Text;
productInfo.TrademarkName = this.Trademark.FieldValue;
productInfo.IsBest = this.ChkIsBest.Checked;
productInfo.IsHot = this.ChkIsHot.Checked;
productInfo.IsNew = this.ChkIsNew.Checked;
productInfo.Stars = DataConverter.CLng(this.DropStars.SelectedValue);
productInfo.EnableSale = this.ChkEnableSale.Checked;
}
private void GetProductPriceInfo(ProductInfo productInfo)
{
productInfo.PriceInfo.Price = DataConverter.CDecimal(this.TxtPrice.Text);
productInfo.PriceMarket = DataConverter.CDecimal(this.TxtPrice_Market.Text);
if (this.RadMemberDiscount.Checked)
{
productInfo.PriceInfo.PriceMember = 0M;
}
if (this.RadMemberPrice.Checked)
{
productInfo.PriceInfo.PriceMember = DataConverter.CDecimal(this.TxtPrice_Member.Text);
}
if (this.RadGroupPrice.Checked)
{
productInfo.PriceInfo.PriceMember = -1M;
}
if (this.RadAgentDiscount.Checked)
{
productInfo.PriceInfo.PriceAgent = 0M;
}
if (this.RadAgentPrice.Checked)
{
productInfo.PriceInfo.PriceAgent = DataConverter.CDecimal(this.TxtPrice_Agent.Text);
}
if (this.RadAgentGroupPrice.Checked)
{
productInfo.PriceInfo.PriceAgent = -1M;
}
if (this.ChkEnableWholesale.Checked)
{
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);
}
if (this.RadDisabledSingleSell.Checked)
{
productInfo.EnableSingleSell = false;
productInfo.DependentProducts = this.HdnDependent.Value;
}
else
{
productInfo.EnableSingleSell = true;
}
}
private IList<UserGroupsInfo> GetUserGroupInfoList(GroupType groupType)
{
IList<UserGroupsInfo> groupTable = null;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -