⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 productuser.aspx.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 5 页
字号:
namespace PowerEasy.WebSite.User.Shop
{
    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.CommonModel;
    using PowerEasy.Model.Shop;
    using PowerEasy.Model.UserManage;
    using PowerEasy.ModelControls;
    using PowerEasy.Shop;
    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 ProductUser : DynamicPage
    {
        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 DropDownList DropServiceTermUnit;
        protected DropDownList DropStars;
        protected ExtendedGridView EgvChildProducts;
        protected HtmlForm form1;
        protected HiddenField HdnDependent;
        protected HiddenField HdnPresentID;
        protected HiddenField HdnPresentID2;
        protected PowerEasy.WebSite.Controls.FieldControl.KeywordType KeywordType;
        protected Label LblChildProductsMsg;
        protected AlternateLiteral LblTitle;
        protected ListBox LstDependentProduct;
        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 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 RadioButton RadSalePromotionType1;
        protected RadioButton RadSalePromotionType2;
        protected RadioButton RadSalePromotionType3;
        protected RadioButton RadSalePromotionType4;
        protected RadioButton RadSalePromotionType5;
        protected Repeater RepModel;
        protected PowerEasy.Controls.RequiredFieldValidator RequiredFieldValidator1;
        protected Repeater RptAgentGroupPrice;
        protected Repeater RptGroupPrice;
        protected ShowPointName ShowPointName1;
        protected ShowPointName ShowPointName2;
        protected ShowPointName ShowPointName3;
        protected ScriptManager SmgeProperties;
        protected SpecialType SpecialType1;
        protected TaxRateSetting TaxRateTypeSetting;
        protected HtmlTable tbWholesale;
        protected PowerEasy.WebSite.Controls.FieldControl.Trademark Trademark;
        protected TextBox TxtAlarmNum;
        protected TextBox TxtBarCode;
        protected TextBox TxtDownloadUrl;
        protected TextBox TxtDownloadUrlRemark;
        protected TextBox TxtLimitNum;
        protected TextBox TxtMinNumber1;
        protected TextBox TxtMinNumber2;
        protected TextBox TxtNumber_Wholesale1;
        protected TextBox TxtNumber_Wholesale2;
        protected TextBox TxtNumber_Wholesale3;
        protected TextBox TxtPresentExp;
        protected TextBox TxtPresentMoney;
        protected TextBox TxtPresentName;
        protected TextBox TxtPresentName2;
        protected TextBox TxtPresentNumber1;
        protected TextBox TxtPresentNumber2;
        protected TextBox TxtPresentNumber3;
        protected TextBox TxtPresentNumber4;
        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 TxtProductIntro;
        protected TextBox TxtProductName;
        protected TextBox TxtServiceTerm;
        protected TextBox TxtStocks;
        protected TextBox TxtTaxRate;
        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 ValrProductName;
        protected PositiveNumValidator VpnumPrice;
        protected PositiveNumValidator VpnumPrice_Agent;
        protected PositiveNumValidator VpnumPrice_Market;
        protected PositiveNumValidator VpnumPrice_Member;

        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> dataInfoList = 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);
                    dataInfoList.Add(item);
                }
                else
                {
                    dataInfoList = this.GetProductDataInfoList();
                }
                if (this.m_Action == "modify")
                {
                    if (Product.Update(this.m_GeneralId, productInfo, dataInfoList, this.m_ProductPriceInfoList))
                    {
                        DynamicPage.WriteUserSuccessMsg("修改成功!", "../Shop/ProductManage.aspx?GeneralID=" + this.m_GeneralId.ToString());
                    }
                    else
                    {
                        DynamicPage.WriteUserErrMsg("修改失败!");
                    }
                }
                else if (Product.Add(this.m_ModelId, productInfo, dataInfoList, this.m_ProductPriceInfoList))
                {
                    DynamicPage.WriteUserSuccessMsg("添加成功!", "../Shop/ProductManage.aspx?NodeID=" + this.m_NodeId.ToString());
                }
                else
                {
                    DynamicPage.WriteUserErrMsg("添加失败!");
                }
            }
        }

        private IList<string> ChildProductList()
        {
            IList<string> attrList = new List<string>();
            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))
                    {
                        attrList.Add(properties);
                    }
                }
            }
            if (attrList.Count > 0)
            {
                return Product.GetProductPropertiesList(attrList);
            }
            return null;
        }

        protected void ChkEnableWholesale_CheckedChanged(object sender, EventArgs e)
        {
            bool visible = false;
            if (this.ChkEnableWholesale.Checked)
            {
                visible = true;
            }
            this.tbWholesale.Visible = visible;
            this.DisplayColumns("批发数量一", visible);
            this.DisplayColumns("批发价格一", visible);
            this.DisplayColumns("批发数量二", visible);
            this.DisplayColumns("批发价格二", visible);
            this.DisplayColumns("批发数量三", visible);
            this.DisplayColumns("批发价格三", visible);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -