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

📄 product.aspx.cs

📁 易想商城系统
💻 CS
📖 第 1 页 / 共 5 页
字号:
                        #endregion

                        this.txtPro_VirtualCurrencies.Text = Convert.ToString(model.Pro_VirtualCurrencies);//商品的虚拟币售价,为0表示不支持虚拟币购买
                        this.txtPro_Integral.Text = Convert.ToString(model.Pro_Integral);//赠送积分
                        ViewState["proSmallImg"] = model.Pro_SmallImages;//商品缩略图
                        ViewState["ProDetailImg"] = model.Pro_MarkPic;//商品详细图                        
                        this.txtPro_Content.Value = model.Pro_Content;//商品详细介绍
                        this.txtPro_MetaKeywords.Text = model.Pro_MetaKeywords;//商品SEO关键字
                        this.txtPro_MetaDescription.Text = model.Pro_MetaDescription;//商品SEO描述信息
                        this.txtPro_MetaTitle.Text = model.Pro_MetaTitle;//商品SEO标题
                        this.txtPro_Weight.Text = Convert.ToString(model.Pro_Weight);//商品重量
                        this.ddlPro_WeightUnit.SelectedValue = Convert.ToString(model.Pro_WeightUnit);//商品重量单位:0:克;1:千克。

                        this.txtPro_Stock.Text = Convert.ToString(model.Pro_Stock);//商品库存
                        this.ddlProU_ID.SelectedValue = Convert.ToString(model.ProU_ID);//商品单位
                        this.txtPro_Alarm.Text = Convert.ToString(model.Pro_Alarm);//报警数量
                        this.txtPro_AuditCount.Text = Convert.ToString(model.Pro_AuditCount);//上架数量
                        this.ddlPro_Audit.SelectedValue = Convert.ToString(model.Pro_Audit);//商品上下架状态:1:上架;2:下架;3:回收站                                               
                        #region 商品状态:推荐商品|热卖商品|特价商品|活动专区|最新商品|首页显示
                        string[] state = model.Pro_State.Split('|');
                        for (int i = 0; i < state.Length; i++)
                        {
                            if (state[i] == "1")
                            {
                                this.cblPro_State.Items[i].Selected = true;
                            }
                        }
                        #endregion

                        #region 商品标识:团购|拍卖|批发
                        string[] Designation = model.Pro_Designation.Split('|');
                        for (int j = 0; j < Designation.Length; j++)
                        {
                            if (Designation[j] == "1")
                            {
                                this.cblPro_Designation.Items[j].Selected = true;
                            }
                        }
                        #endregion

                        #region 相关商品
                        if (!string.IsNullOrEmpty(model.Pro_RelatingProID))
                        {
                            bindPro_RelatingProID(model.Pro_RelatingProID);
                        }
                        #endregion

                        #region 相关文章

                        bindPro_RelatingArtID(model.Pro_RelatingArtID);

                        #endregion

                        this.txtPro_onClicks.Text = Convert.ToString(model.Pro_onClicks);//商品查看次数
                        this.rblPro_IsAllowComment.SelectedValue = Convert.ToString(model.Pro_IsAllowComment);//是否允许评论                        
                        this.txtPro_CostPrice.Text = Convert.ToString(model.Pro_CostPrice);//商品成本价
                        this.txtPro_AutoUp.Date = (DateTime)model.Pro_AutoUp;//商品自动上架时间
                        this.txtPro_AutoDown.Date = (DateTime)model.Pro_AutoDown;//商品自动下架时间
                        this.rblPro_IsAuto.SelectedValue = Convert.ToString(model.Pro_IsAuto);//商品是否自动上下架
                    }
                    else
                    {
                        Response.Redirect("../Succeed/Error.aspx?Key=对不起,该商品不存在", true);
                    }
                //}
                //catch(Exception ex)
                //{
                //    Response.Redirect("../Succeed/Error.aspx?Key="+ex.Message+"", true);
                //}
            }
        }
        #endregion

        #region 绑定商品相关的相关商品
        /// <summary>
        /// 绑定商品相关的相关商品
        /// </summary>
        /// <returns></returns>
        public void bindPro_RelatingProID(string ProID)
        {
            StringBuilder proList = new StringBuilder();
            proList.Append("<select name=\"selPro_RelatingProIDSelect\" size=\"14\" multiple=\"multiple\" style=\"width: 98%\">");
            try
            {
                YXShop.BLL.Product BLL = new YXShop.BLL.Product();
                DataSet ds = BLL.GetSearchKey(0, "Pro_ID,Pro_Name", "YXShop_Product", "Pro_ID in (" + ProID + ")", "Pro_ID desc");
                DataTable dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        proList.Append("<option value=\"" + ds.Tables[0].Rows[i]["Pro_ID"].ToString() + "\">" + ds.Tables[0].Rows[i]["Pro_Name"].ToString() + "</option>");
                    }
                    proList.Append("</select>");
                    Pro_RelatingProID = proList.ToString();
                }
                else
                {
                    Pro_RelatingProID = proList.ToString();
                }
            }
            catch (Exception ex)
            {
                proList.Append("<option value=\"0\">程序出错,详细信息:" + ex.ToString() + "</option>");
                proList.Append("</select>");
                Pro_RelatingProID = proList.ToString();
            }
        }
        #endregion

        #region 绑定商品的相关文章
        /// <summary>
        /// 绑定商品的相关文章
        /// </summary>
        /// <returns></returns>
        public void bindPro_RelatingArtID(string ArtID)
        {
            StringBuilder articleList = new StringBuilder();
            articleList.Append("<select name=\"selPro_RelatingArtIDSelect\" size=\"14\" multiple=\"multiple\" style=\"width: 98%\">");
            try
            {
                string keyWord = Request.QueryString["keyWord"];
                YXShop.BLL.YixiangArticle BLL = new YXShop.BLL.YixiangArticle();
                DataSet ds = BLL.searchArticle("", ArtID, 0);
                DataTable dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        articleList.Append("<option value=\"" + ds.Tables[0].Rows[i][0].ToString() + "\">" + ds.Tables[0].Rows[i][1].ToString() + "</option>");
                    }
                    articleList.Append("</select>");
                    Pro_RelatingArtID = articleList.ToString();
                }
                else
                {
                    articleList.Append("</select>");
                    Pro_RelatingArtID = articleList.ToString();
                }
            }
            catch
            {
                articleList.Append("</select>");
                Pro_RelatingArtID = articleList.ToString();
            }
        }
        #endregion

        #region 绑定商品品牌
        /// <summary>
        /// 绑定商品品牌
        /// </summary>
        /// <param name="cID">商品分类ID</param>
        /// <param name="bID">商品品牌ID</param>
        public void bindBrand_ID(string cID, string bID)
        {
            if (bID == "0")
            {
                pro_Brand_ID = "该商品无品牌";
            }
            else
            {
                StringBuilder retrunSb = new StringBuilder();
                try
                {
                    YXShop.BLL.Pro_Brand pb = new YXShop.BLL.Pro_Brand();
                    List<YXShop.Model.Pro_Brand> PBList = pb.GetModelByClssID(cID);
                    if (PBList.Count > 0)
                    {
                        retrunSb.Append("<select name=\"ddlBrand_ID\" id=\"ddlBrand_ID\">");
                        foreach (YXShop.Model.Pro_Brand mPb in PBList)
                        {
                            retrunSb.Append("<option value=\"" + mPb.Brand_ID + "\"");
                            if (Convert.ToString(mPb.Brand_ID) == bID)
                            {
                                retrunSb.Append(" selected=\"selected\" ");
                            }
                            retrunSb.Append(">" + mPb.Brand_Name + "</option>");
                        }
                        retrunSb.Append("</select>");
                        pro_Brand_ID = retrunSb.ToString();
                    }
                    else
                    {
                        //YXShop.BLL.Pro_Brand pb = new YXShop.BLL.Pro_Brand();
                        //List<YXShop.Model.Pro_Brand> PBList = pb.GetModelByClssID(cID);
                        List<YXShop.Model.Pro_Brand> data = pb.GetAll();
                        if (data.Count > 0)
                        {
                            retrunSb.Append("<select name=\"ddlBrand_ID\" id=\"ddlBrand_ID\">");
                            foreach (YXShop.Model.Pro_Brand mPb in data)
                            {
                                if (mPb.Brand_ProCategoriesID == string.Empty || mPb.Brand_ProCategoriesID == null)
                                {
                                    retrunSb.Append("<option value=\"" + mPb.Brand_ID + "\"");
                                    if (Convert.ToString(mPb.Brand_ID) == bID)
                                    {
                                        retrunSb.Append(" selected=\"selected\" ");
                                    }
                                    retrunSb.Append(">" + mPb.Brand_Name + "</option>");
                                }
                            }
                            retrunSb.Append("</select>");
                            pro_Brand_ID = retrunSb.ToString();
                        }
                        else
                        {
                            retrunSb.Append("该商品无品牌");
                            pro_Brand_ID = retrunSb.ToString();
                        }
                    }
                }
                catch (Exception ex)
                {
                    retrunSb.Append("程序错误,详细信息:" + ex.ToString());
                    pro_Brand_ID = retrunSb.ToString();
                }
            }
        }
        #endregion

        #region 绑定商品的扩展属性字符串
        /// <summary>
        /// 绑定商品的扩展属性字符串
        /// </summary>
        /// <param name="cID">商品分类ID</param>
        /// <param name="pID">扩展属性值数组</param>
        public void bindPro_PValues(string cID, string pID)
        {
            StringBuilder retrunPropertySb = new StringBuilder();
            StringBuilder parmSb = new StringBuilder();
            try
            {
                YXShop.BLL.YXShop_ProProperty pp = new YXShop.BLL.YXShop_ProProperty();
                List<YXShop.Model.YXShop_ProProperty> PPList = pp.GetModelByClssID(cID);
                if (PPList.Count > 0)
                {
                    try
                    {
                        retrunPropertySb.Append("<table>");

                        string[] value = pID.Split('|');

                        int i = 0;

                        #region 循环扩展属性的类型(单选,下拉列表,多选,单行文本和多行文本)和可选值

                        foreach (YXShop.Model.YXShop_ProProperty mPp in PPList)
                        {
                            string[] temp = null;
                            try
                            {
                                temp = value[i].Split(',');
                            }
                            catch
                            {
                                temp = "0,0".Split(',');
                            }
                            switch (mPp.ProP_Type)
                            {
                                case 1:
                                    #region 从下拉列表中选择

⌨️ 快捷键说明

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