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

📄 pro_gift_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.BLL;
using YXShop.Model;
using YXShop;
using YXShop.Common;
using Shop.Web.UI;

namespace YXShop.Web.Admin.Product
{
    
    public partial class Pro_Gift_list : System.Web.UI.Page
    {
        public PageSet ps;
        YXShop.BLL.Pro_Gift dataCA = new YXShop.BLL.Pro_Gift();
        BasePage bp = null;
        string type;
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(YXShop.Web.Admin.Product.Pro_Gift_list));
            this.Button2.Attributes.Add("onclick", "javascript:return cfonirm(\"删除后将不可再恢复,您确认要删除吗?\")");       
            type = Convert.ToString(Page.Request.QueryString["type"]);
            if (!PowerTree.PowerPass.isPass("002005000", PowerTree.PowerPanel.PowerType.look))
            {
                bp = new BasePage();
                bp.PageError("对不起,你没有查看此页面的权限!", "../index.aspx");
            }
            if (!IsPostBack)
            {
                string ID = Convert.ToString(Page.Request.QueryString["YX_MID"]);
                YXShop.Model.Pro_Gift data = new YXShop.Model.Pro_Gift();
                grid();
            }
        }
        #region 列表
        private void grid()
        {
            int pageIndex = Request["pageIndex"] == null ? 0 : int.Parse(Request["pageIndex"]);
            if (pageIndex < 0)
            {
                pageIndex = 0;
            }
            if ((Request["Event"] == null) || (Request["Event"] == ""))
            {
                pageIndex = 0;
            }

            List<YXShop.Model.Pro_Gift> datas = dataCA.GetAll();
            dg1.DataSource = datas;
            ps = new PageSet(datas.Count, PageSet.PageSize, pageIndex);
            if (ps.PageCount <= pageIndex + 1)
            {
                pageIndex = ps.PageCount - 1;
            }

            dg1.PageSize = PageSet.PageSize;

            dg1.VirtualItemCount = pageIndex;

            if (datas.Count < 1)
            {
                dg1.BackColor = System.Drawing.Color.White;
            }
            
            dg1.DataBind();
        }
        #endregion
       
        [AjaxPro.AjaxMethod]
        public string GiftDel(int id)
        {
            if (PowerTree.PowerPass.isPass("002005003", PowerTree.PowerPanel.PowerType.del))
            {
                YXShop.Model.Pro_Gift datam = new YXShop.Model.Pro_Gift();
                datam.ProG_ID = id;
                dataCA.Delect(datam);
            }
            
            return string.Empty;
        }
        #region 批量删除
        protected void Button2_Click(object sender, EventArgs e)
        {
            System.Web.UI.WebControls.CheckBox chkExport;
            string sID;
            int all = dg1.Items.Count;
            int i;
            try
            {
                for (i = 0; i < all; i++)
                {
                    chkExport = (CheckBox)dg1.Items[i].FindControl("chkItem");
                    if (chkExport.Checked == true)
                    {
                        sID = dg1.Items[i].Cells[1].Text.Trim();
                        YXShop.Model.Pro_Gift data = new YXShop.Model.Pro_Gift();
                        data.ProG_ID = Convert.ToInt32(sID);
                        dataCA.Delect(data);
                    }
                }
                grid();
            }
            catch (Exception eFS)
            {
                Response.Write(eFS.ToString());
                Response.End();
            }
        }
        #endregion
        public string GetPowerStr(string powertype)
        {
            string reStr = "";
            switch (powertype)
            {
                case "del":
                    reStr = PowerTree.PowerPass.isPass("002005003", PowerTree.PowerPanel.PowerType.del) ? "t" : "f";
                    break;
            }
            return reStr;
        }
    }
}

⌨️ 快捷键说明

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