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

📄 promotionlist.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 YXShop.Common;
using System.Collections.Generic;
using Shop.Web.UI;

namespace YXShop.Web.Admin.Product
{
    public partial class PromotionManager : System.Web.UI.Page
    {
        YXShop.BLL.Promotion bll = new YXShop.BLL.Promotion();
        public PageSet ps;
        BasePage bp = new BasePage();
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(YXShop.Web.Admin.Product.PromotionManager));
            if (!PowerTree.PowerPass.isPass("002003000", PowerTree.PowerPanel.PowerType.look))
            {
                bp.PageError("对不起,你没有查看此页面的权限!", "../index.aspx");
            }
            if ((!IsPostBack) || ((Request["Event"] != null) && (Request["Event"] != "")))
            {
                Bind();
            }
        }
        private void Bind()
        {
            int pageIndex = Request["pageIndex"] == null ? 0 : int.Parse(Request["pageIndex"]);
            if (pageIndex < 0)
            {
                pageIndex = 0;
            }
            if ((Request["Event"] == null) || (Request["Event"] == ""))
            {
                pageIndex = 0;
            }
            YXShop.BLL.Promotion data = new YXShop.BLL.Promotion();
            List<YXShop.Model.Promotion> datas = data.GetAll();
            Promotion_GV.DataSource = datas;

            ps = new PageSet(datas.Count, PageSet.PageSize, pageIndex);
            if (ps.PageCount <= pageIndex + 1)
            {
                pageIndex = ps.PageCount - 1;
            }

            Promotion_GV.PageSize = PageSet.PageSize;
            Promotion_GV.PageIndex = pageIndex;
            if (datas.Count < 1)
            {
                Promotion_GV.BackColor = System.Drawing.Color.White;
            }

            Promotion_GV.DataBind();
        }
        protected void Promotion_GV_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (!(e.Row.DataItem is YXShop.Model.Promotion))
            {
                return;
            }
            YXShop.Model.Promotion data = (e.Row.DataItem as YXShop.Model.Promotion);
            if (data != null)
            {
                e.Row.Cells[2].Text = Convert.ToDateTime(data.SP_StartTime).ToString("yyyy-MM-dd");
                e.Row.Cells[3].Text = Convert.ToDateTime(data.SP_EndTime).ToString("yyyy-MM-dd");
                e.Row.Cells[4].Text = this.ProString(Convert.ToInt32(data.SP_ProList));
            }
        }

        #region 查询产品数据
        protected string ProString(int id)
        {
            YXShop.BLL.Product datab = new YXShop.BLL.Product();
            List<YXShop.Model.Product> data = datab.GetId(id);
            if (data.Count > 0)
            {
                return data[0].Pro_Name;
            }
            return string.Empty;
        }
        #endregion
        [AjaxPro.AjaxMethod]
        public string ItemDel(int id)
        {
            if (PowerTree.PowerPass.isPass("002003003", PowerTree.PowerPanel.PowerType.del))
            {
                bll.Delete(id);
            }

            return string.Empty;
        }
        [AjaxPro.AjaxMethod]
        public string ItemListDel(string str)
        {
            string[] idList = str.Split(',');
            for (int i = 0; i < idList.Length; i++)
            {
                if (isNumeric(idList[i]))
                    ItemDel(Convert.ToInt32(idList[i]));
            }
            return string.Empty;
        }
        [AjaxPro.AjaxMethod]
        public bool isNumeric(string num)
        {
            if (string.IsNullOrEmpty(num))
                return false;
            System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex("^[0-9]+$");
            return r.IsMatch(num);
        }

        public string GetPowerStr(string powertype)
        {
            string reStr = "";
            switch (powertype)
            {
                case "del":
                    reStr = PowerTree.PowerPass.isPass("002003003", PowerTree.PowerPanel.PowerType.del) ? "t" : "f";
                    break;
            }
            return reStr;
        }
    }
}

⌨️ 快捷键说明

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