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

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

namespace YXShop.Web.Admin.ShopThemes
{
    public partial class Templates : System.Web.UI.Page
    {
        YXShop_ShopTemplates B_Templates = new YXShop_ShopTemplates();
        protected PageSet ps;
        BasePage bp = null;
        Model.YXShop_ShopTemplates M_ShopTemplates = new YXShop.Model.YXShop_ShopTemplates();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!PowerTree.PowerPass.isPass("015002000", PowerTree.PowerPanel.PowerType.look))
            {
                bp = new BasePage();
                bp.PageError("对不起,你没有查看此页面的权限!", "../index.aspx");
            }
            if (!IsPostBack)
            {
                BindData();
            }
        }

        void BindData()
        {
            int pageIndex = Request["pageIndex"] == null ? 0 : int.Parse(Request["pageIndex"]);
            if (pageIndex < 0)
            {
                pageIndex = 0;
            }
            if ((Request["Event"] == null) || (Request["Event"] == ""))
            {
                pageIndex = 0;
            }
            string condition = null;
            if (!string.IsNullOrEmpty(Request.QueryString["TID"]))
            {
                condition += " TID=" + Request.QueryString["TID"];
            }
            DataSet ds = DBUtility.Pagination.Pages("YXShop_ShopTemplates", "STID", "*", PageSet.PageSize, pageIndex, "STID", condition);
            ps = new YXShop.Common.PageSet(DBUtility.Pagination.GetPageCount("STID", "YXShop_ShopTemplates", condition), PageSet.PageSize, pageIndex);
            rptTemplates.DataSource = ds;
            rptTemplates.DataBind();
        }

        protected void lbtOperation(object s, EventArgs e)
        {
            string dataType = ((LinkButton)s).CommandName;
            string ID = ((LinkButton)s).CommandArgument;

            switch (dataType)
            {
                case "Use":
                    if (!PowerTree.PowerPass.isPass("015002007", PowerTree.PowerPanel.PowerType.other))
                    {
                        bp = new BasePage();
                        bp.PageError("对不起,你没有修改店铺模板使用状态的权限!", "../index.aspx");
                    }
                    else
                    {
                        if (ID.Split(',')[1] == "0")
                        {
                            List<Model.YXShop_ShopTemplates> listTemplates = B_Templates.GetListByColumn("STID", ID.Split(',')[0]);
                            if (listTemplates.Count > 0)
                            {
                                B_Templates.Amend(string.Format(" TID={0} and STPageID={1} ", listTemplates[0].TID, listTemplates[0].StPageID), "STState", 0);
                            }
                        }
                        if (B_Templates.Amend(Convert.ToInt32(ID.Split(',')[0]), "STState", ID.Split(',')[1] == "1" ? 0 : 1) > 0)
                        {
                            alert.showOnly("修改使用状态成功");
                        }
                        else
                        { alert.showOnly("修改使用状态失败"); }
                    }
                    break;
                case "Del":
                    if (!PowerTree.PowerPass.isPass("015002003", PowerTree.PowerPanel.PowerType.del))
                    {
                        bp = new BasePage();
                        bp.PageError("对不起,你没有删除店铺模板的权限!", "../index.aspx");
                    }
                    else
                    {
                        M_ShopTemplates.STID = Convert.ToInt32(ID);
                        if (B_Templates.Delect(M_ShopTemplates) > 0)
                        {
                            alert.showOnly("删除成功");
                        }
                        else { alert.showOnly("删除失败"); }
                    }
                    break;
            }
            BindData();
        }

        protected string GetTName(int TID)
        {
            if (Cache["Themes"] == null)
            {
                List<Model.YXShop_ShopThemes> cacheThemes = new BLL.YXShop_ShopThemes().GetListByColumn();
                Cache["Themes"] = cacheThemes;
            }
            List<Model.YXShop_ShopThemes> listThemes= (List<Model.YXShop_ShopThemes>)Cache["Themes"];
            if (listThemes.Count > 0)
            {
                for (int i = 0; i < listThemes.Count; i++)
                {
                    if (TID == listThemes[i].TID)
                    {
                        return listThemes[i].TName;
                    }
                }
            }
            return "";
        }
    }
}

⌨️ 快捷键说明

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