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

📄 productbatchset.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 2 页
字号:
namespace PowerEasy.WebSite.Admin.Shop
{
    using PowerEasy.Accessories;
    using PowerEasy.Common;
    using PowerEasy.CommonModel;
    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.Shop;
    using PowerEasy.ModelControls;
    using PowerEasy.Shop;
    using PowerEasy.Web.UI;
    using PowerEasy.WebSite.Controls;
    using PowerEasy.WebSite.Controls.Shop;
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Text;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class ProductBatchSet : AdminPage
    {
        protected ExtendedButton BtnBacthSet;
        protected Button BtnCancel;
        protected ExtendedCheckBoxList ChblModelNameList;
        protected CheckBox ChkAlarmNum;
        protected CheckBox ChkBarCode;
        protected CheckBox ChkDayHits;
        protected CheckBox ChkDownloadUrl;
        protected CheckBox ChkDownloadUrlRemark;
        protected CheckBox ChkEliteLevel;
        protected CheckBox ChkEnableBuyWhenOutofstock;
        protected CheckBox ChkEnableSale;
        protected CheckBox ChkEnableSingleSell;
        protected CheckBox ChkEnableWholesale;
        protected CheckBox ChkHits;
        protected CheckBox ChkIsBest;
        protected CheckBox ChkIsHot;
        protected CheckBox ChkIsNew;
        protected CheckBox ChkKeyword;
        protected CheckBox ChkLimitNum;
        protected CheckBox ChkMonthHits;
        protected CheckBox ChkPresentExp;
        protected CheckBox ChkPresentMoney;
        protected CheckBox ChkPresentPoint;
        protected CheckBox ChkPrice;
        protected CheckBox ChkPrice_Market;
        protected CheckBox ChkPriority;
        protected CheckBox ChkProducer;
        protected CheckBox ChkProductExplain;
        protected CheckBox ChkProductIntro;
        protected CheckBox ChkProductPic;
        protected CheckBox ChkProductType;
        protected CheckBox ChkSalePromotion;
        protected CheckBox ChkServiceTerm;
        protected CheckBox ChkSetEnableBuyWhenOutofstock;
        protected CheckBox ChkSetEnableSale;
        protected CheckBox ChkSetIsBest;
        protected CheckBox ChkSetIsHot;
        protected CheckBox ChkSetIsNew;
        protected CheckBox ChkStars;
        protected CheckBox ChkStocksProject;
        protected CheckBox ChkTaxRate;
        protected CheckBox ChkTaxRateTypeSetting;
        protected CheckBox ChkTemplateFile;
        protected CheckBox ChkTrademark;
        protected CheckBox ChkUnit;
        protected CheckBox ChkUpdateTime;
        protected CheckBox ChkWeekHits;
        protected CheckBox ChkWeight;
        protected CheckBox ChkWholesale;
        protected PowerEasy.WebSite.Controls.Shop.DependentProduct DependentProduct;
        protected DropDownList DropServiceTermUnit;
        protected DropDownList DropStars;
        protected TemplateSelectControl FscTemplate;
        protected ListBox LstNodes;
        protected int m_ModelId;
        protected DatePicker PickDate;
        protected PEeditor ProductExplain;
        protected ProductPic ProductPic1;
        protected ProductUnitPicker ProductUnitPick;
        protected RadioButton RadDisabledSingleSell;
        protected RadioButton RadEnableSingleSell;
        protected RadioButton RadGeneralIdList;
        protected RadioButtonList RadlProductType;
        protected RadioButtonList RadlStocksProject;
        protected RadioButton RadNode;
        protected PowerEasy.WebSite.Controls.Shop.SalePromotion SalePromotion;
        protected ScriptManager ScriptManager1;
        protected ShowPointName ShowPointName1;
        protected ShowPointName ShowPointName2;
        protected ShowPointName ShowPointName3;
        protected ExtendedSiteMapPath SmpNavigator;
        protected TaxRateSetting TaxRateTypeSetting;
        protected HtmlTable tbWholesale;
        protected TextBox TxtAlarmNum;
        protected TextBox TxtBarCode;
        protected TextBox TxtDayHits;
        protected TextBox TxtDownloadUrl;
        protected TextBox TxtDownloadUrlRemark;
        protected TextBox TxtEliteLevel;
        protected TextBox TxtGeneralIdList;
        protected TextBox TxtHits;
        protected KeyWordControl TxtKeyword;
        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_Market;
        protected TextBox TxtPrice_Wholesale1;
        protected TextBox TxtPrice_Wholesale2;
        protected TextBox TxtPrice_Wholesale3;
        protected TextBox TxtPriority;
        protected ProducerControl TxtProducer;
        protected TextBox TxtProductIntro;
        protected TextBox TxtServiceTerm;
        protected TextBox TxtTaxRate;
        protected TrademarkControl TxtTrademark;
        protected TextBox TxtWeekHits;
        protected TextBox TxtWeight;
        protected System.Web.UI.UpdatePanel UpnlLimitNum;
        protected System.Web.UI.UpdatePanel UpnlWholesale;
        protected PositiveNumValidator VpnumPrice;
        protected PositiveNumValidator VpnumPrice_Market;
        protected UrlValidator VurlDownloadUrl;

        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);
        }

        protected void BtnBacthSet_Click(object sender, EventArgs e)
        {
            string text = string.Empty;
            if (this.RadGeneralIdList.Checked)
            {
                if (string.IsNullOrEmpty(this.TxtGeneralIdList.Text))
                {
                    AdminPage.WriteErrMsg("对不起,您还没指定要批量设置属性的商品的ID!", "");
                }
                else
                {
                    text = this.TxtGeneralIdList.Text;
                }
            }
            if (this.RadNode.Checked)
            {
                StringBuilder sb = new StringBuilder();
                foreach (ListItem item in this.LstNodes.Items)
                {
                    if (item.Selected)
                    {
                        StringHelper.AppendString(sb, item.Value);
                    }
                }
                string str2 = this.ChblModelNameList.SelectList();
                if (string.IsNullOrEmpty(sb.ToString()))
                {
                    AdminPage.WriteErrMsg("对不起,您还没指定要批量设置属性的商品的栏目!", "");
                }
                else
                {
                    text = ProductCommon.GetGeneralIdList(sb.ToString(), str2.ToString());
                }
            }
            Product product = new Product();
            foreach (string str3 in text.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries))
            {
                int generalId = DataConverter.CLng(str3);
                product.GetProductAllDataById(generalId);
                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);
                IList<ProductDataInfo> productDataInfoList = product.ProductDataInfoList;
                IList<ProductPriceInfo> productPriceInfoList = product.ProductPriceInfoList;
                this.SetProductInfo(productInfoData, productDataInfoList);
                Product.Update(generalId, productInfoData, productDataInfoList, productPriceInfoList);
                if (this.ChkKeyword.Checked)
                {
                    this.SaveKeywordToTable(this.TxtKeyword.Text, DataConverter.CLng(str3));
                }
            }
            AdminPage.WriteSuccessMsg("批量编辑成功!", "ProductManage.aspx");
        }

        protected void BtnCancel_Click(object sender, EventArgs e)
        {
            BasePage.ResponseRedirect("ProductManage.aspx");
        }

        protected void ChkEnableWholesale_CheckedChanged(object sender, EventArgs e)
        {
            if (this.ChkEnableWholesale.Checked)
            {
                this.tbWholesale.Visible = true;
            }
            else
            {
                this.tbWholesale.Visible = false;
            }
        }

        private DataTable GetDataTable(IList<FieldInfo> fieldInfoList, DataTable contentDataTable)
        {
            DataTable dataTable = new DataTable();
            dataTable.Columns.Add("FieldName");
            dataTable.Columns.Add("FieldValue");
            dataTable.Columns.Add("FieldType");
            dataTable.Columns.Add("FieldLevel");
            foreach (FieldInfo info in fieldInfoList)
            {
                if (info.FieldType != FieldType.Property)
                {
                    DataRow row = dataTable.NewRow();
                    row["FieldName"] = info.FieldName;
                    row["FieldValue"] = ContentManage.ToFieldType(contentDataTable.Rows[0][info.FieldName].ToString(), info.FieldType, 1);
                    row["FieldType"] = info.FieldType;
                    row["FieldLevel"] = info.FieldLevel;
                    dataTable.Rows.Add(row);
                }
            }
            if (this.ChkEliteLevel.Checked)
            {
                this.AddNewRows(dataTable, "EliteLevel", this.TxtEliteLevel.Text, FieldType.NumberType, 0);
            }
            if (this.ChkPriority.Checked)
            {
                this.AddNewRows(dataTable, "Priority", this.TxtPriority.Text, FieldType.NumberType, 0);
            }
            if (this.ChkHits.Checked)
            {
                this.AddNewRows(dataTable, "Hits", this.TxtHits.Text, FieldType.NumberType, 0);
            }
            if (this.ChkDayHits.Checked)
            {
                this.AddNewRows(dataTable, "DayHits", this.TxtDayHits.Text, FieldType.NumberType, 0);
            }
            if (this.ChkWeekHits.Checked)
            {
                this.AddNewRows(dataTable, "WeekHits", this.TxtWeekHits.Text, FieldType.NumberType, 0);
            }
            if (this.ChkMonthHits.Checked)
            {
                this.AddNewRows(dataTable, "MonthHits", this.TxtMonthHits.Text, FieldType.NumberType, 0);
            }
            if (this.ChkUpdateTime.Checked)

⌨️ 快捷键说明

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