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

📄 comment_list.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.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;
using YXShop.Common;
using YXShop.Web.Admin.Control;
using Shop.Web.UI;
using YXShop.BLL;
using YXShop.Model;
namespace YXShop.Web.Admin.Product
{
    public partial class Comment_List : System.Web.UI.Page
    {
        BasePage bp = null;
        YXShop.BLL.YXShop_Comment BLL = new YXShop.BLL.YXShop_Comment();
        public PageSet ps;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!PowerTree.PowerPass.isPass("013005001",PowerTree.PowerPanel.PowerType.look))
            {
                bp = new BasePage();
                bp.PageError("对不起,你没有查看此页面的权限!", "../index.aspx");
            }
            this.PageNavigator1.OnPageChange += new PageChangeHandler(PageNavigator1_PageChange);
            if (Request["act"] == "del" && !string.IsNullOrEmpty(Request["ID"]))
            {
                del(Request["ID"]);
            }
            if (!IsPostBack)
            {
                StartLoad(1);
            }
        }

        #region 列表信息
        //获得列表
        protected void PageNavigator1_PageChange(object sender, int PageIndex)
        {
            StartLoad(PageIndex);
        }

        protected void StartLoad(int PageIndex)
        {
            int i = 0;
            int j = 0;
            List<YXShop.Model.YXShop_Comment> data = BLL.GetAll(" ", PageIndex, 20, out i, out j);
            this.PageNavigator1.PageCount = j;
            this.PageNavigator1.PageIndex = PageIndex;
            this.PageNavigator1.RecordCount = i;
            Questionlists.DataSource = data;                              //设置datalist数据源
            Questionlists.DataBind();                                   //绑定数据源
        }
        #endregion

        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (!(e.Row.DataItem is YXShop.Model.YXShop_CommentBook))
            {
                return;
            }
            YXShop.Model.YXShop_CommentBook data = (e.Row.DataItem as YXShop.Model.YXShop_CommentBook);
            if (data != null)
            {

            }
        }

        [AjaxPro.AjaxMethod]
        public string PropertyDel(int Prop_ID)
        {
            YXShop.BLL.YXShop_CommentBook data = new YXShop.BLL.YXShop_CommentBook();
            YXShop.Model.YXShop_CommentBook datam = new YXShop.Model.YXShop_CommentBook();
            datam.CF_ID = Prop_ID;
            data.Delete(datam);
            return string.Empty;
        }

        #region 返回属性值的类型

        public string ProP_Type(string pID)
        {
            string str = "";
            switch (pID)
            {
                case "1":
                    str = "从下拉列表中选择";
                    break;
                case "2":
                    str = "单选";
                    break;
                case "3":
                    str = "多选";
                    break;
                case "4":
                    str = "单行文本";
                    break;
                default:
                    str = "多行文本";
                    break;
            }
            return str;
        }
        #endregion

        #region 格式化现实属性的可选值
        public string ProP_Value(string pValue)
        {
            if (!string.IsNullOrEmpty(pValue))
            {
                return pValue.Replace("\n", ",");
            }
            else
            {
                return "<font color=\"Red\">无可选值</font>";
            }
        }
        #endregion

        #region 根据商品ID返回商品的名称
        /// <summary>
        /// 根据商品ID返回商品的名称
        /// </summary>
        /// <param name="pro_ID"></param>
        /// <returns></returns>
        public string pro_Name(int pro_ID)
        {
            try
            {
                YXShop.BLL.Product BP = new YXShop.BLL.Product();
                YXShop.Model.Product MP = BP.GetIdModel(pro_ID);
                return "<a href=\"../../ProductContent.aspx?ID=" + pro_ID + "\" title=\"查看该商品\" target=\"_blank\">" + MP.Pro_Name + "</a>";
            }
            catch
            {
                return "查询相关商品出错!";
            }
        }
        #endregion

        #region 返回评论的审核状态
        /// <summary>
        /// 返回评论的审核状态
        /// </summary>
        /// <param name="Cmt_AuditingState"></param>
        /// <param name="cmtID"></param>
        /// <returns></returns>
        public string AuditingState(int Cmt_AuditingState, int cmtID)
        {
            //return Cmt_AuditingState == 1 ? "<a href='?act=no&cmtID=" + cmtID + "' onclick='return confirm(\"确认要将此条点评信息取消审核吗?\")'>已审核</a>" : "<a href='?act=yes&cmtID=" + cmtID + "'  onclick='return confirm(\"确认要将此条点评信息通过审核吗?\")'><font color='red'>未审核<font></a>";
            return Cmt_AuditingState == 1 ? "已审核" : "<font color='red'>未审核<font>";
        } 
        #endregion

        protected void btnOpreate_Click(object sender, EventArgs e)
        {
            string cmtIDList = Request["cbID"];
            if (cmtIDList.Trim().Length == 0)
            {
                YXShop.Common.alert.ResponseScript(this, "请选择数据项!");
            }
            else
            {
                YXShop.BLL.YXShop_Comment BLL = new YXShop.BLL.YXShop_Comment();
                try
                {
                    if (BLL.operateCom(Request["op"], cmtIDList)==1)
                    {
                        YXShop.Common.alert.showAndGo("操作成功!", "?"); 
                    }
                    else
                    {
                        YXShop.Common.alert.showAndGo("对不起,操作失败,请重试!", "?"); 
                    }
                }
                catch
                {
                    YXShop.Common.alert.showAndGo("请选择数据项!","?"); 
                }
            }
        }

        /// <summary>
        /// 返回指向点评修改页面的链接字符串
        /// </summary>
        /// <param name="title"></param>
        /// <param name="ID"></param>
        /// <returns></returns>
        public string updateStr(string title,int ID)
        {
            return "<a href='comment.aspx?ID="+ID+"&title="+Server.UrlEncode(title)+"'>回复</a>";
        }

        #region 删除评论
        /// <summary>
        /// 商品ID
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public string del(string Cmt_ID)
        {
            try
            {
                int ID = Int32.Parse(Cmt_ID);
                YXShop.BLL.YXShop_Comment BC = new YXShop.BLL.YXShop_Comment();
                StartLoad(1);
                return Convert.ToString(BC.Delete(ID));
            }
            catch
            {
                return "0";
            }
        }
        #endregion
    }
}

⌨️ 快捷键说明

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