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

📄 productuser.aspx.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 5 页
字号:
            string str = "UserGroupInfoList";
            if (groupType == GroupType.Agent)
            {
                str = "AgentGroupInfoList";
            }
            if (this.ViewState[str] != null)
            {
                return (this.ViewState[str] as List<UserGroupsInfo>);
            }
            groupTable = UserGroups.GetGroupTable(groupType);
            this.ViewState[str] = groupTable;
            return groupTable;
        }

        private void GetWholesale(int i, ProductDataInfo productDataInfo)
        {
            decimal num = DataConverter.CDecimal(((TextBox) this.EgvChildProducts.Rows[i].FindControl("TxtPrice_Wholesale1")).Text, -1M);
            if (num >= 0M)
            {
                productDataInfo.PriceInfo.PriceWholesale1 = num;
            }
            else
            {
                productDataInfo.PriceInfo.PriceWholesale1 = DataConverter.CDecimal(this.TxtPrice_Wholesale1.Text);
            }
            decimal num2 = DataConverter.CDecimal(((TextBox) this.EgvChildProducts.Rows[i].FindControl("TxtPrice_Wholesale2")).Text, -1M);
            if (num2 >= 0M)
            {
                productDataInfo.PriceInfo.PriceWholesale2 = num2;
            }
            else
            {
                productDataInfo.PriceInfo.PriceWholesale2 = DataConverter.CDecimal(this.TxtPrice_Wholesale2.Text);
            }
            decimal num3 = DataConverter.CDecimal(((TextBox) this.EgvChildProducts.Rows[i].FindControl("TxtPrice_Wholesale3")).Text, -1M);
            if (num3 >= 0M)
            {
                productDataInfo.PriceInfo.PriceWholesale3 = num3;
            }
            else
            {
                productDataInfo.PriceInfo.PriceWholesale3 = DataConverter.CDecimal(this.TxtPrice_Wholesale3.Text);
            }
            int num4 = DataConverter.CLng(((TextBox) this.EgvChildProducts.Rows[i].FindControl("TxtNumber_Wholesale1")).Text, -1);
            if (num4 >= 0)
            {
                productDataInfo.PriceInfo.NumberWholesale1 = num4;
            }
            else
            {
                productDataInfo.PriceInfo.NumberWholesale1 = DataConverter.CLng(this.TxtNumber_Wholesale1.Text);
            }
            int num5 = DataConverter.CLng(((TextBox) this.EgvChildProducts.Rows[i].FindControl("TxtNumber_Wholesale2")).Text, -1);
            if (num5 >= 0)
            {
                productDataInfo.PriceInfo.NumberWholesale2 = num5;
            }
            else
            {
                productDataInfo.PriceInfo.NumberWholesale2 = DataConverter.CLng(this.TxtNumber_Wholesale2.Text);
            }
            int num6 = DataConverter.CLng(((TextBox) this.EgvChildProducts.Rows[i].FindControl("TxtNumber_Wholesale3")).Text, -1);
            if (num6 >= 0)
            {
                productDataInfo.PriceInfo.NumberWholesale3 = num6;
            }
            else
            {
                productDataInfo.PriceInfo.NumberWholesale3 = DataConverter.CLng(this.TxtNumber_Wholesale3.Text);
            }
        }

        private void InitializeChildProducts()
        {
            this.AddTemplateField("ChkIsValid", "CheckBox", "有效", true);
            this.AddTemplateField("LblProperty", "Label", "商品属性", true);
            this.AddTemplateField("TxtChildStocks", "TextBox", "库存数量", true);
            this.AddTemplateField("TxtChildAlarmNum", "TextBox", "库存报警下限", true);
            this.AddTemplateField("TxtPrice", "TextBox", "零售价格", true);
            this.AddTemplateField("TxtUserPrice", "TextBox", "会员价格", false);
            foreach (UserGroupsInfo info in UserGroups.GetGroupTable(GroupType.Register))
            {
                this.AddTemplateField("TxtGroupPrice" + info.GroupId, "TextBox", info.GroupName, false);
            }
            this.AddTemplateField("TxtAgentPrice", "TextBox", "代理商价格", false);
            foreach (UserGroupsInfo info2 in UserGroups.GetGroupTable(GroupType.Agent))
            {
                this.AddTemplateField("TxtAgentGroupPrice" + info2.GroupId, "TextBox", info2.GroupName, false);
            }
            this.AddTemplateField("TxtNumber_Wholesale1", "TextBox", "批发数量一", false);
            this.AddTemplateField("TxtPrice_Wholesale1", "TextBox", "批发价格一", false);
            this.AddTemplateField("TxtNumber_Wholesale2", "TextBox", "批发数量二", false);
            this.AddTemplateField("TxtPrice_Wholesale2", "TextBox", "批发价格二", false);
            this.AddTemplateField("TxtNumber_Wholesale3", "TextBox", "批发数量三", false);
            this.AddTemplateField("TxtPrice_Wholesale3", "TextBox", "批发价格三", false);
            this.EgdvChildProductsDataBind();
        }

        protected string IsShow(string condition)
        {
            string str2;
            string str = "";
            if (condition == "DisplaySetEnableSale")
            {
                if (!PEContext.Current.User.UserInfo.UserPurview.SetEnableSale)
                {
                    str = "display:none";
                }
                return str;
            }
            if (!this.m_VirtualInfo && ((str2 = condition) != null))
            {
                if (!(str2 == "DependentProducts"))
                {
                    if ((str2 == "DisplayDownloadUrl") && !this.m_DownloadDisplay)
                    {
                        str = "display:none";
                    }
                    return str;
                }
                if (!this.m_DependentProductsDisplay)
                {
                    str = "display:none";
                }
            }
            return str;
        }

        private void ModifyInitialize()
        {
            Product product = new Product();
            product.GetProductAllDataById(this.m_GeneralId);
            ProductInfo productInfo = product.GetProductInfo(true);
            this.m_ProductDataInfoList = product.ProductDataInfoList;
            this.m_ProductInfo = productInfo;
            this.contentDataTable = productInfo.Fields;
            this.RepModel.DataSource = Field.GetFieldList(DataConverter.CLng(this.contentDataTable.Rows[0]["ModelID"].ToString()), false);
            this.RepModel.DataBind();
            this.SetProductPrice(product, productInfo);
            this.SetPresent(productInfo);
            this.TxtProductName.Text = productInfo.ProductName;
            this.ProductNumber1.ProductNum = productInfo.ProductNum;
            this.TxtServiceTerm.Text = productInfo.ServiceTerm.ToString();
            this.DropServiceTermUnit.SelectedValue = ((int) productInfo.ServiceTermUnit).ToString();
            this.TxtWeight.Text = productInfo.Weight.ToString();
            this.ProductUnitPick.ProductUnit = productInfo.Unit;
            this.TxtTaxRate.Text = productInfo.TaxRate.ToString();
            this.TaxRateTypeSetting.TaxRate = productInfo.IncludeTax;
            this.ChkEnableSale.Checked = productInfo.EnableSale;
            this.ChkEnableBuyWhenOutofstock.Checked = productInfo.EnableBuyWhenOutofstock;
            this.RadlStocksProject.SelectedValue = ((int) productInfo.StocksProject).ToString();
            this.RadlProductType.SelectedValue = ((int) productInfo.ProductType).ToString();
            this.TxtLimitNum.Text = productInfo.LimitNum.ToString();
            this.TxtStocks.Text = productInfo.Stocks.ToString();
            this.ProductPic1.SetProductPic(productInfo);
            this.KeywordType.FieldValue = productInfo.Keyword;
            this.Producer.FieldValue = productInfo.ProducerName;
            this.ProductExplain.Value = productInfo.ProductExplain;
            this.TxtProductIntro.Text = productInfo.ProductIntro;
            this.TxtBarCode.Text = productInfo.BarCode;
            this.Trademark.FieldValue = productInfo.TrademarkName;
            this.ChkIsBest.Checked = productInfo.IsBest;
            this.ChkIsHot.Checked = productInfo.IsHot;
            this.ChkIsNew.Checked = productInfo.IsNew;
            this.DropStars.SelectedValue = productInfo.Stars.ToString();
            if (!string.IsNullOrEmpty(productInfo.Properties))
            {
                this.SetChildProductVisible(productInfo);
            }
            else
            {
                foreach (ProductDataInfo info2 in product.ProductDataInfoList)
                {
                    this.TxtAlarmNum.Text = info2.AlarmNum.ToString();
                    this.TxtStocks.Text = info2.Stocks.ToString();
                }
            }
        }

        protected override void OnPreRender(EventArgs e)
        {
            this.EgdvChildProductsDataBind();
            base.OnPreRender(e);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.m_ModelId = BasePage.RequestInt32("ModelID");
            this.m_NodeId = BasePage.RequestInt32("NodeID");
            this.m_Action = BasePage.RequestStringToLower("Action");
            this.m_GeneralId = BasePage.RequestInt32("GeneralID");
            this.m_VirtualInfo = false;
            if ((this.m_Action == "modify") && (BasePage.RequestInt32("LinkType") == 1))
            {
                this.m_VirtualInfo = true;
            }
            if (!this.Page.IsPostBack)
            {
                if (this.m_ModelId == 0)
                {
                    DynamicPage.WriteErrMsg("<li>请指定模型ID</li>");
                }
                else
                {
                    Collection<string> collection = new Collection<string>();
                    collection.Add("300");
                    collection.Add("200");
                    this.SpecialType1.Settings = collection;
                    Collection<string> collection2 = new Collection<string>();
                    collection2.Add("50");
                    this.KeywordType.Settings = collection2;
                    this.Producer.Settings = collection2;
                    this.Trademark.Settings = collection2;
                    this.ProductExplain.IsWatermark = SiteConfig.ShopConfig.IsWatermark.ToString();
                    this.RadEnableSingleSell.Attributes.Add("onclick", "if (document.getElementById('" + this.RadDisabledSingleSell.ClientID + "').checked == true) {document.getElementById('trDependentProducts').style.display='';} else {document.getElementById('trDependentProducts').style.display='none';}");
                    this.RadDisabledSingleSell.Attributes.Add("onclick", "if (document.getElementById('" + this.RadDisabledSingleSell.ClientID + "').checked == true) {document.getElementById('trDependentProducts').style.display='';} else {document.getElementById('trDependentProducts').style.display='none';}");
                    this.BtnSave.Attributes.Add("onclick", "SetHdnDependentValue();");
                    if (this.m_Action == "modify")
                    {
                        if (this.m_GeneralId == 0)
                        {
                            DynamicPage.WriteErrMsg("<li>商品ID不正确!</li>");
                        }
                        else
                        {
                            this.ModifyInitialize();
                        }
                    }
                    else
                    {
                        this.TaxRateTypeSetting.TaxRate = (TaxRateType) SiteConfig.ShopConfig.TaxRateType;
                        this.TxtTaxRate.Text = SiteConfig.ShopConfig.TaxRate.ToString();
                        this.RepModel.DataSource = Field.GetFieldList(this.m_ModelId, false);
                        this.RepModel.DataBind();
                        this.InitializeChildProducts();
                    }
                    if (Product.CharacterIsExists(ModelManager.GetModelInfoById(this.m_ModelId).Character, ProductCharacter.Download))
                    {
                        this.m_DownloadDisplay = true;
                    }
                }
            }
        }

        protected void RadAgentDiscount_CheckChanged(object sender, EventArgs e)
        {
            this.RptAgentGroupPrice.Visible = false;
            this.DisplayColumns("代理商价格", false);
            foreach (UserGroupsInfo info in this.GetUserGroupInfoList(GroupType.Agent))
            {
                this.DisplayColumns(info.GroupName, false);
            }
            this.EgdvChildProductsDataBind();
        }

        protected void RadAgentGroupPrice_CheckedChanged(object sender, EventArgs e)
        {
            IList<UserGroupsInfo> userGroupInfoList = this.GetUserGroupInfoList(GroupType.Agent);
            this.RptAgentGroupPrice.Visible = true;
            this.RptAgentGroupPrice.DataSource = userGroupInfoList;
            this.RptAgentGroupPrice.DataBind();
            this.DisplayColumns("代理商价格", false);
            foreach (UserGroupsInfo info in userGroupInfoList)
            {
                this.DisplayColumns(info.GroupName, true);

⌨️ 快捷键说明

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