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

📄 commentform.aspx.cs

📁 易想商城系统
💻 CS
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;
using Shop.Web.UI;
using YXShop.BLL;
using YXShop.Model;
namespace YXShop.Web.Admin.Product
{
    public partial class CommentForm : System.Web.UI.Page
    {
        BasePage bp = null;
        YXShop.Model.YXShop_CommentBook model = new YXShop.Model.YXShop_CommentBook();
        YXShop.BLL.YXShop_CommentBook BLL = new YXShop.BLL.YXShop_CommentBook();
        public string ProP_Type = "1";//扩展属性类型
        public string Pro_ID = "0";//扩展属性所属的商品类别ID列表
        protected void Page_Load(object sender, EventArgs e)
        {
            if (YXShop.Common.WebUtility.isNumeric(Request.Params["CF_ID"]))
            {
                if (!PowerTree.PowerPass.isPass("013003004", PowerTree.PowerPanel.PowerType.update))
                {
                    bp = new BasePage();
                    bp.PageError("对不起,你没有编辑评论表单的权限!", "../index.aspx");
                }
            }
            else 
            {
                if (!PowerTree.PowerPass.isPass("013003002", PowerTree.PowerPanel.PowerType.add))
                {
                    bp = new BasePage();
                    bp.PageError("对不起,你没有添加评论表单的权限!", "../index.aspx");
                }
            }

            if (!this.IsPostBack)
            {
                updateBind();
            }
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            //所属商品分类ID
            if (Convert.ToString(Request.Params["cbProClass"]) != "1")
            {
                model.CF_ProClassList = (string.IsNullOrEmpty(Request.Params["ProductCategories"]))?"0":Request.Params["ProductCategories"];
            }
            else
            {
                model.CF_ProClassList = "0";
            }
            //属性名称
            model.CF_Name = this.txtProP_Filed.Text;
            
            //属性类别
            model.CF_Type = Convert.ToInt32(Request.Params["ddlProType"].ToString());
            //属性值
            if (model.CF_Type != 4 && model.CF_Type != 5)
            {
                model.CF_Value =this.txtProP_Value.Text;
            }
            else
            {
                model.CF_Value = "0";
            }
            model.CF_Text = model.CF_Value;
            //属性是否必填
            model.CF_Required = Convert.ToInt32(this.rblProP_Term.SelectedValue);
            //属性显示顺序
            model.CF_Order = Convert.ToInt32(this.txtProP_Order.Text);

            if (!string.IsNullOrEmpty(Request.QueryString["CF_ID"]))
            {
                model.CF_ID = Int32.Parse(Request.QueryString["CF_ID"]);
                if (BLL.Amend(model) > 0)
                {
                    bp = new BasePage();
                    bp.PageRight("=商品评论表单修改成功。", "CommentForm_List.aspx");
                }
            }
            else
            {
                if (BLL.Create(model) == 0)
                {
                    bp = new BasePage();
                    bp.PageRight("=商品评论表单定制成功。", "CommentForm_List.aspx");
                }
                else
                {
                    bp = new BasePage();
                    bp.PageError("对不起,添加失败,请重试!", "CommentForm_List.aspx");
                }
            }
        }
        protected void updateBind()
        {
            if (!string.IsNullOrEmpty(Request.QueryString["CF_ID"]))
            {
                try
                {
                    List<YXShop.Model.YXShop_CommentBook> data = BLL.GetModel(Int32.Parse(Request.QueryString["CF_ID"]));
                    if (model.CF_ProClassList == "")
                    {
                        Pro_ID = "0";
                    }
                    else
                    {
                        this.ProductCategoriesList1.StrProID = data[0].CF_ProClassList;
                    }
                    ProP_Type = Convert.ToString(data[0].CF_Type);
                    this.txtProP_Filed.Text = data[0].CF_Name;//点评项名称
                    this.txtProP_Order.Text = Convert.ToString(data[0].CF_Order);
                    this.txtProP_Value.Text = data[0].CF_Value;
                    this.rblProP_Term.SelectedValue = Convert.ToString(data[0].CF_Required);
                    this.lblTitle.Text = "修改商品评论表单";
                    this.Label1.Text = "修改商品评论表单";
                    this.btnAdd.Text = "修 改";
                }
                catch (Exception ex)
                {
                    bp = new BasePage();
                    bp.PageError(ex.Message, "CommentForm_List.aspx");
                }
            }
        }
    }
}

⌨️ 快捷键说明

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