📄 productui.cs
字号:
namespace PowerEasy.WebSite.Admin.Shop
{
using PowerEasy.AccessManage;
using PowerEasy.Accessories;
using PowerEasy.Common;
using PowerEasy.CommonModel;
using PowerEasy.Components;
using PowerEasy.Contents;
using PowerEasy.Controls;
using PowerEasy.Controls.Editor;
using PowerEasy.Enumerations;
using PowerEasy.ExtendedControls;
using PowerEasy.Model.Accessories;
using PowerEasy.Model.CommonModel;
using PowerEasy.Model.Contents;
using PowerEasy.Model.Shop;
using PowerEasy.Model.UserManage;
using PowerEasy.ModelControls;
using PowerEasy.Shop;
using PowerEasy.StaticHtml;
using PowerEasy.UserManage;
using PowerEasy.Web.UI;
using PowerEasy.WebSite.Controls;
using PowerEasy.WebSite.Controls.FieldControl;
using PowerEasy.WebSite.Controls.Shop;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public class ProductUI : AdminPage
{
protected ExtendedButton BtnSave;
protected CheckBox ChkEnableBuyWhenOutofstock;
protected CheckBox ChkEnableSale;
protected CheckBox ChkEnableWholesale;
protected CheckBox ChkIsBest;
protected CheckBox ChkIsHot;
protected CheckBox ChkIsNew;
protected DataTable contentDataTable;
protected PowerEasy.WebSite.Controls.Shop.DependentProduct DependentProduct;
protected DropDownList DropServiceTermUnit;
protected DropDownList DropStars;
protected ExtendedGridView EgvChildProducts;
protected TemplateSelectControl FscTemplate;
protected HiddenField HdnProductCharacter;
protected PowerEasy.WebSite.Controls.FieldControl.KeywordType KeywordType;
protected Label LblChildProductsMsg;
protected AlternateLiteral LblTitle;
private string m_Action;
private bool m_DependentProductsDisplay;
private bool m_DownloadDisplay;
private int m_GeneralId;
protected int m_ModelId;
private int m_NodeId;
private IList<ProductDataInfo> m_ProductDataInfoList;
private ProductInfo m_ProductInfo;
private IList<ProductPriceInfo> m_ProductPriceInfoList;
private bool m_VirtualInfo;
protected PowerEasy.WebSite.Controls.FieldControl.NodeType NodeType1;
protected DatePicker PickDate;
protected PowerEasy.WebSite.Controls.FieldControl.Producer Producer;
protected PEeditor ProductExplain;
protected ProductNumBuilder ProductNumber1;
protected ProductPic ProductPic1;
protected ProductUnitPicker ProductUnitPick;
protected RadioButton RadAgentDiscount;
protected RadioButton RadAgentGroupPrice;
protected RadioButton RadAgentPrice;
protected RadioButton RadDisabledSingleSell;
protected RadioButton RadEnableSingleSell;
protected RadioButton RadGroupPrice;
protected RadioButtonList RadlProductType;
protected RadioButtonList RadlStocksProject;
protected RadioButton RadMemberDiscount;
protected RadioButton RadMemberPrice;
protected Repeater RepModel;
protected PowerEasy.Controls.RequiredFieldValidator ReqPickDate;
protected PowerEasy.Controls.RequiredFieldValidator RequiredFieldValidator1;
protected Repeater RptAgentGroupPrice;
protected Repeater RptGroupPrice;
protected PowerEasy.WebSite.Controls.Shop.SalePromotion SalePromotion;
protected ShowPointName ShowPointName1;
protected ShowPointName ShowPointName2;
protected ShowPointName ShowPointName3;
protected ScriptManager SmgeProperties;
protected ExtendedSiteMapPath SmpNavigator;
protected SpecialType SpecialType1;
protected TaxRateSetting TaxRateTypeSetting;
protected HtmlTable tbWholesale;
protected PowerEasy.WebSite.Controls.FieldControl.Trademark Trademark;
protected HtmlTableRow TRChildProducts;
protected TextBox TxtAlarmNum;
protected TextBox TxtBarCode;
protected TextBox TxtDayHits;
protected TextBox TxtDownloadUrl;
protected TextBox TxtDownloadUrlRemark;
protected TextBox TxtEliteLevel;
protected TextBox TxtHits;
protected TextBox TxtLimitNum;
protected TextBox TxtMonthHits;
protected TextBox TxtNumber_Wholesale1;
protected TextBox TxtNumber_Wholesale2;
protected TextBox TxtNumber_Wholesale3;
protected TextBox TxtPresentExp;
protected TextBox TxtPresentMoney;
protected TextBox TxtPresentPoint;
protected TextBox TxtPrice;
protected TextBox TxtPrice_Agent;
protected TextBox TxtPrice_Market;
protected TextBox TxtPrice_Member;
protected TextBox TxtPrice_Wholesale1;
protected TextBox TxtPrice_Wholesale2;
protected TextBox TxtPrice_Wholesale3;
protected TextBox TxtPriority;
protected TextBox TxtProductIntro;
protected TextBox TxtProductName;
protected TextBox TxtServiceTerm;
protected TextBox TxtStocks;
protected TextBox TxtTaxRate;
protected TextBox TxtWeekHits;
protected TextBox TxtWeight;
protected System.Web.UI.UpdatePanel UpnlAgentGroupPrice;
protected System.Web.UI.UpdatePanel UpnlChildProducts;
protected System.Web.UI.UpdatePanel UpnlGroupPrice;
protected System.Web.UI.UpdatePanel UpnlLimitNum;
protected System.Web.UI.UpdatePanel UpnlWholesale;
protected PowerEasy.Controls.RequiredFieldValidator ValrDayHits;
protected PowerEasy.Controls.RequiredFieldValidator ValrEliteLevel;
protected PowerEasy.Controls.RequiredFieldValidator ValrHits;
protected PowerEasy.Controls.RequiredFieldValidator ValrMonthHits;
protected PowerEasy.Controls.RequiredFieldValidator ValrPriority;
protected PowerEasy.Controls.RequiredFieldValidator ValrProductName;
protected PowerEasy.Controls.RequiredFieldValidator ValrWeekHits;
protected CustomValidator ValxProductIntro;
protected NumberValidator VnumDayHits;
protected NumberValidator VnumEliteLevel;
protected NumberValidator VnumHits;
protected NumberValidator VnumMonthHits;
protected NumberValidator VnumPriority;
protected NumberValidator VnumWeekHits;
protected PositiveNumValidator VpnumPrice;
protected PositiveNumValidator VpnumPrice_Agent;
protected PositiveNumValidator VpnumPrice_Market;
protected PositiveNumValidator VpnumPrice_Member;
protected UrlValidator VurlDownloadUrl;
private void AddKeywordsToTable(DataTable dataTable)
{
int generalId = GetGeneralId(dataTable);
string fieldValue = this.KeywordType.FieldValue;
if (!string.IsNullOrEmpty(fieldValue))
{
this.SaveKeywordToTable(fieldValue, generalId);
}
}
private void AddNewRows(DataTable dataTable, string fieldName, string fieldValue, FieldType fieldType, int fieldLevel)
{
DataRow row = dataTable.NewRow();
row["FieldName"] = fieldName;
row["FieldValue"] = fieldValue;
row["FieldType"] = fieldType;
row["FieldLevel"] = fieldLevel;
dataTable.Rows.Add(row);
}
private void AddTemplateField(string controlId, string controlType, string headerText, bool visible)
{
GridViewTemplateField field = new GridViewTemplateField();
field.HeaderText = headerText;
field.Visible = visible;
string str = controlType;
if (str != null)
{
if (!(str == "TextBox"))
{
if (str == "Label")
{
field.HeaderStyle.Width = Unit.Pixel(150);
field.ItemStyle.Width = Unit.Pixel(150);
}
else if (str == "CheckBox")
{
field.HeaderStyle.Width = Unit.Pixel(30);
field.ItemStyle.Width = Unit.Pixel(30);
}
}
else
{
field.HeaderStyle.Width = Unit.Pixel(80);
field.ItemStyle.Width = Unit.Pixel(80);
}
}
field.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
field.ItemTemplate = new GridViewTemplate(controlId, controlType);
this.EgvChildProducts.Columns.Add(field);
}
protected void BtnSave_Click(object sender, EventArgs e)
{
if (this.Page.IsValid)
{
this.m_ProductPriceInfoList = new List<ProductPriceInfo>();
ProductInfo productInfo = new ProductInfo();
this.GetProductInfo(productInfo);
DataTable dataTableFromRepeater = this.GetDataTableFromRepeater();
productInfo.Fields = ContentManage.GetNewContentData(dataTableFromRepeater);
if (this.RadGroupPrice.Checked || this.RadAgentGroupPrice.Checked)
{
this.GetPriceInfoList();
}
IList<ProductDataInfo> productDataInfoList = new List<ProductDataInfo>();
if (string.IsNullOrEmpty(productInfo.Properties))
{
ProductDataInfo item = new ProductDataInfo();
item.Stocks = DataConverter.CLng(this.TxtStocks.Text);
item.AlarmNum = DataConverter.CLng(this.TxtAlarmNum.Text);
productDataInfoList.Add(item);
}
else
{
productDataInfoList = this.GetProductDataInfoList(productDataInfoList);
}
if (this.m_Action == "modify")
{
if (Product.Update(this.m_GeneralId, productInfo, productDataInfoList, this.m_ProductPriceInfoList))
{
HtmlContent.CreateHtml(dataTableFromRepeater);
SiteCache.Remove("CK_Page_Category_" + this.m_NodeId.ToString());
AdminPage.WriteSuccessMsg("修改成功!", "../Shop/ProductManage.aspx?GeneralID=" + this.m_GeneralId.ToString());
}
else
{
AdminPage.WriteErrMsg("修改失败!");
}
}
else if (Product.Add(this.m_ModelId, productInfo, productDataInfoList, this.m_ProductPriceInfoList))
{
HtmlContent.CreateHtml(dataTableFromRepeater);
this.AddKeywordsToTable(dataTableFromRepeater);
SiteCache.Remove("CK_Page_Category_" + this.m_NodeId.ToString());
AdminPage.WriteSuccessMsg("添加成功!", "../Shop/ProductManage.aspx?NodeID=" + this.m_NodeId.ToString());
}
else
{
AdminPage.WriteErrMsg("添加失败!");
}
}
}
private static bool CheckPermissions(int nodeId, OperateCode code)
{
if (PEContext.Current.Admin.IsSuperAdmin)
{
return true;
}
if (nodeId <= 0)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -