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

📄 productrecycle.aspx.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
字号:
namespace PowerEasy.WebSite.Admin.Shop
{
    using PowerEasy.Common;
    using PowerEasy.CommonModel;
    using PowerEasy.Contents;
    using PowerEasy.Controls;
    using PowerEasy.Model.Contents;
    using PowerEasy.Shop;
    using PowerEasy.Web.UI;
    using PowerEasy.WebSite.Controls;
    using System;
    using System.Collections.Generic;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public class ProductRecycle : AdminPage
    {
        protected DropDownList DropRescentQuery;
        protected Button EBtnDelete;
        protected Button EBtnRestore;
        protected ExtendedGridView EgvContentRecycle;
        protected HiddenField HdnListType;
        protected HiddenField HdnStatus;
        protected Dictionary<int, string> m_NodeNameDictionary = new Dictionary<int, string>();
        protected ObjectDataSource OdsContents;
        protected ProductManageNavigation Pmn;
        protected ScriptManager ScriptManager1;
        protected ExtendedSiteMapPath SmpNavigator;

        protected void DropRescentQuerySelectedIndex_Changed(object sender, EventArgs e)
        {
            this.HdnListType.Value = this.DropRescentQuery.SelectedValue;
            this.EgvContentRecycle.PageIndex = 0;
        }

        protected void EBtnDelete_Click(object sender, EventArgs e)
        {
            foreach (string str in this.EgvContentRecycle.SelectList.ToString().Split(new char[] { ',' }))
            {
                StockItem.Delete(DataConverter.CLng(str));
            }
            if (ContentManage.Delete(this.EgvContentRecycle.SelectList.ToString()))
            {
                AdminPage.WriteSuccessMsg("<li>彻底删除成功</li>", "ProductRecycle.aspx?NodeID=" + BasePage.RequestInt32("NodeID"));
            }
            else
            {
                AdminPage.WriteErrMsg("<li>彻底删除失败</li>");
            }
        }

        protected void EBtnRestore_Click(object sender, EventArgs e)
        {
            string[] strArray = this.EgvContentRecycle.SelectList.ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < strArray.Length; i++)
            {
                ContentManage.UpdateStatus(DataConverter.CLng(strArray[i]), 0x63);
            }
            AdminPage.WriteSuccessMsg("<li>还原成功</li>", "ProductRecycle.aspx?NodeID=" + BasePage.RequestInt32("NodeID"));
        }

        protected void EgvContentRecycle_RowCommand(object sender, CommandEventArgs e)
        {
            int generalId = DataConverter.CLng(e.CommandArgument.ToString());
            if (e.CommandName == "RestoreContent")
            {
                if (ContentManage.UpdateStatus(generalId, 0x63))
                {
                    AdminPage.WriteSuccessMsg("<li>还原成功!</li>", "ProductRecycle.aspx?NodeID=" + BasePage.RequestInt32("NodeID"));
                }
                else
                {
                    AdminPage.WriteErrMsg("<li>还原失败!</li>");
                }
            }
            if (e.CommandName == "DeleteContent")
            {
                StockItem.Delete(generalId);
                if (ContentManage.Delete(generalId.ToString()))
                {
                    SigninContent.Delete(generalId);
                    SigninLog.Delete(generalId);
                    AdminPage.WriteSuccessMsg("<li>删除成功!</li>", "ProductRecycle.aspx?NodeID=" + BasePage.RequestInt32("NodeID"));
                }
                else
                {
                    AdminPage.WriteErrMsg("<li>删除失败!</li>");
                }
            }
        }

        protected void EgvContentRecycle_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                CommonModelInfo dataItem = (CommonModelInfo) e.Row.DataItem;
                int nodeId = BasePage.RequestInt32("NodeID");
                string nodeName = "";
                if (dataItem.NodeId != nodeId)
                {
                    nodeId = dataItem.NodeId;
                    if (this.m_NodeNameDictionary.ContainsKey(dataItem.NodeId))
                    {
                        nodeName = this.m_NodeNameDictionary[dataItem.NodeId];
                    }
                    else
                    {
                        NodeInfo cacheNodeById = Nodes.GetCacheNodeById(dataItem.NodeId);
                        if (cacheNodeById != null)
                        {
                            nodeName = cacheNodeById.NodeName;
                            this.m_NodeNameDictionary.Add(dataItem.NodeId, nodeName);
                        }
                    }
                    Label label = e.Row.FindControl("LblNodeLink") as Label;
                    label.Text = "<strong>[<a href=\"ProductRecycle.aspx?NodeID=" + dataItem.NodeId.ToString() + "&NodeName=" + base.Server.UrlEncode(nodeName) + "\">" + nodeName + "</a>]</strong>";
                }
                Label label2 = e.Row.FindControl("LblIsCreateHtml") as Label;
                label2.Text = "<span style=\"color:Red\"><b>\x00d7</b></span>";
                Image image = e.Row.FindControl("ImgItemIcon") as Image;
                string itemIcon = ModelManager.GetCacheModelById(dataItem.ModelId).ItemIcon;
                if (string.IsNullOrEmpty(itemIcon))
                {
                    itemIcon = "Product.gif";
                }
                image.ImageUrl = "~/Images/ModelIcon/" + itemIcon;
                if (dataItem.LinkType == 0)
                {
                    e.Row.FindControl("PlhLink").Visible = false;
                }
            }
        }

        protected string GetStatusShow(string status)
        {
            int num = DataConverter.CLng(status);
            switch (num)
            {
                case -3:
                    return "回收站中";

                case -2:
                    return "退稿";

                case -1:
                    return "草稿";

                case 0:
                    return "待审核";

                case 0x63:
                    return "终审通过";
            }
            return "审核中";
        }

        protected void Page_Load(object sender, EventArgs e)
        {
        }
    }
}

⌨️ 快捷键说明

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