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

📄 softpreview.aspx.cs

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

    public class SoftPreview : AdminPage
    {
        protected StringBuilder arrTrs0 = new StringBuilder();
        protected StringBuilder arrTrs1 = new StringBuilder();
        protected StringBuilder arrTrs2 = new StringBuilder();
        protected PowerEasy.WebSite.Controls.CommentManage CommentManage;
        protected PowerEasy.WebSite.Controls.ContentCharge ContentCharge;
        protected DataTable contentDataTable;
        protected PowerEasy.WebSite.Controls.ContentSigin ContentSigin;
        protected ExtendedNodeButton EBtnDelete;
        protected ExtendedNodeButton EBtnModify;
        protected Label LblGetNextInfo;
        protected Label LblGetPrevInfo;
        protected Literal LitSoftIntro;
        protected Literal LitSoftSize;
        protected Literal LitTitle;
        private int m_GeneralId;
        protected Repeater RptContent;
        protected ExtendedSiteMapPath SmpNavigator;

        protected void EBtnDelete_Click(object sender, EventArgs e)
        {
            RolePermissions.BusinessAccessCheck(OperateCode.NodeContentManage, DataConverter.CLng(this.contentDataTable.Rows[0]["NodeId"]));
            if (ContentManage.UpdateStatus(this.m_GeneralId, -3))
            {
                AdminPage.WriteSuccessMsg("<li>删除成功!</li>", "ContentManage.aspx?NodeID=" + this.contentDataTable.Rows[0]["NodeId"].ToString());
            }
            else
            {
                AdminPage.WriteErrMsg("<li>删除失败!</li>");
            }
        }

        protected void EBtnModify_Click(object sender, EventArgs e)
        {
            RolePermissions.BusinessAccessCheck(OperateCode.NodeContentManage, DataConverter.CLng(this.contentDataTable.Rows[0]["NodeId"]));
            StringBuilder builder = new StringBuilder();
            if (ModelManager.GetModelInfoById(DataConverter.CLng(this.contentDataTable.Rows[0]["ModelID"].ToString())).IsEshop)
            {
                builder.Append("../shop/Product.aspx");
            }
            else
            {
                builder.Append("Content.aspx");
            }
            builder.Append("?Action=Modify&NodeID=");
            builder.Append(this.contentDataTable.Rows[0]["NodeId"].ToString());
            builder.Append("&GeneralID=");
            builder.Append(this.m_GeneralId.ToString());
            builder.Append("&ModelID=");
            builder.Append(this.contentDataTable.Rows[0]["ModelID"].ToString());
            builder.Append("&LinkType=");
            builder.Append(this.contentDataTable.Rows[0]["LinkType"].ToString());
            BasePage.ResponseRedirect(builder.ToString());
        }

        protected string GetDownloadurl(string col)
        {
            StringBuilder builder = new StringBuilder();
            foreach (string str in this.contentDataTable.Rows[0][col.Trim()].ToString().Split(new string[] { "$$$" }, StringSplitOptions.RemoveEmptyEntries))
            {
                string[] strArray2 = str.Split(new char[] { '|' });
                builder.Append(strArray2[0] + ":");
                if ((strArray2[1].Substring(0, 1) == "/") || (strArray2[1].IndexOf("://") <= 0))
                {
                    builder.Append("<a href='" + base.BasePath + strArray2[1] + "' target='_blank'>" + strArray2[1] + "</a>");
                }
                else
                {
                    builder.Append("<a href='" + strArray2[1] + "' target='_blank'>" + strArray2[1] + "</a>");
                }
                builder.Append("<br/>");
            }
            return builder.ToString();
        }

        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 string GeturlValue(string col)
        {
            string str = this.contentDataTable.Rows[0][col].ToString();
            if (string.IsNullOrEmpty(str))
            {
                return (base.Request.PhysicalApplicationPath + "//UploadFiles//nopic.gif");
            }
            return Utility.ConvertAbsolutePath(SiteConfig.SiteInfo.VirtualPath + VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.UploadDir), str);
        }

        protected string GetValue(string col)
        {
            return this.contentDataTable.Rows[0][col].ToString().Trim();
        }

        protected void InitContent()
        {
            IList<FieldInfo> fieldList = Field.GetFieldList(DataConverter.CLng(this.contentDataTable.Rows[0]["ModelID"].ToString()), false);
            this.RptContent.DataSource = fieldList;
            this.RptContent.DataBind();
        }

        private void InitPage()
        {
            if (base.Request.UrlReferrer != null)
            {
                this.ViewState["UrlReferrer"] = base.Request.UrlReferrer.ToString();
            }
            this.contentDataTable = ContentManage.GetContentDataById(this.m_GeneralId);
            if ((this.contentDataTable == null) || (this.contentDataTable.Rows.Count == 0))
            {
                AdminPage.WriteErrMsg("<li>指定项目不存在!</li>");
            }
            this.InitContent();
            this.LitTitle.Text = this.contentDataTable.Rows[0]["Title"].ToString().Trim();
            this.LitSoftSize.Text = this.contentDataTable.Rows[0]["SoftSize"].ToString().Trim();
            this.LitSoftIntro.Text = this.contentDataTable.Rows[0]["SoftIntro"].ToString().Trim();
            CommonModelInfo prevInfo = ContentManage.GetPrevInfo(DataConverter.CLng(this.contentDataTable.Rows[0]["NodeId"]), this.m_GeneralId);
            if (!prevInfo.IsNull)
            {
                this.LblGetPrevInfo.Text = "<a href='" + ModelManager.GetModelInfoById(prevInfo.ModelId).PreviewInfoFilePath + "?GeneralID=" + prevInfo.GeneralId.ToString() + "'>" + prevInfo.Title + "</a>";
            }
            else
            {
                this.LblGetPrevInfo.Text = "没有了";
            }
            CommonModelInfo nextInfo = ContentManage.GetNextInfo(DataConverter.CLng(this.contentDataTable.Rows[0]["NodeId"]), this.m_GeneralId);
            if (!nextInfo.IsNull)
            {
                this.LblGetNextInfo.Text = "<a href='" + ModelManager.GetModelInfoById(prevInfo.ModelId).PreviewInfoFilePath + "?GeneralID=" + nextInfo.GeneralId.ToString() + "'>" + nextInfo.Title + "</a>";
            }
            else
            {
                this.LblGetNextInfo.Text = "没有了";
            }
            this.SmpNavigator.AdditionalNode = PowerEasy.Contents.Nodes.ShowNodeNavigation(DataConverter.CLng(this.contentDataTable.Rows[0]["NodeId"]));
            if (!string.IsNullOrEmpty(this.SmpNavigator.AdditionalNode))
            {
                this.SmpNavigator.AdditionalNode = this.SmpNavigator.AdditionalNode.Replace("根节点 >>", "");
            }
        }

        private void InitTabByFieldType(RepeaterItemEventArgs e, FieldInfo fieldInfo)
        {
            HtmlTableRow row = (HtmlTableRow) e.Item.FindControl("Tab");
            if (fieldInfo.FieldType == FieldType.InfoType)
            {
                row.Style.Add("display", "none");
                if (this.arrTrs1.Length == 0)
                {
                    this.arrTrs1.Append("\"" + row.ClientID + "\"");
                }
                else
                {
                    this.arrTrs1.Append(",\"" + row.ClientID + "\"");
                }
            }
            else if (fieldInfo.FieldType == FieldType.SpecialType)
            {
                row.Style.Add("display", "none");
                if (this.arrTrs2.Length == 0)
                {
                    this.arrTrs2.Append("\"" + row.ClientID + "\"");
                }
                else
                {
                    this.arrTrs2.Append(",\"" + row.ClientID + "\"");
                }
            }
            else
            {
                row.Style.Add("display", "none");
                if (this.arrTrs0.Length == 0)
                {
                    this.arrTrs0.Append("\"" + row.ClientID + "\"");
                }
                else
                {
                    this.arrTrs0.Append(",\"" + row.ClientID + "\"");
                }
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.m_GeneralId = BasePage.RequestInt32("GeneralID");
            this.InitPage();
        }

        protected void RptContent_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.AlternatingItem) || (e.Item.ItemType == ListItemType.Item))
            {
                Literal literal2;
                StringBuilder builder;
                FieldInfo dataItem = e.Item.DataItem as FieldInfo;
                this.InitTabByFieldType(e, dataItem);
                Literal literal = e.Item.FindControl("LitContentText") as Literal;
                Panel panel = e.Item.FindControl("PnlContent") as Panel;
                string status = this.contentDataTable.Rows[0][dataItem.FieldName].ToString();
                switch (dataItem.FieldType)
                {
                    case FieldType.SpecialType:
                        literal2 = new Literal();
                        builder = new StringBuilder();
                        if (this.m_GeneralId > 0)
                        {
                            string[] strArray = Special.GetSpecialInfoIds(this.m_GeneralId).Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                            for (int i = 0; i < strArray.Length; i++)
                            {
                                SpecialInfo specialInfoById = Special.GetSpecialInfoById(DataConverter.CLng(strArray[i]));
                                SpecialCategoryInfo specialCategoryInfoById = Special.GetSpecialCategoryInfoById(specialInfoById.SpecialCategoryId);
                                builder.Append("\n<span>");
                                builder.Append(specialCategoryInfoById.SpecialCategoryName + ">>" + specialInfoById.SpecialName);
                                builder.Append("<br /></span>");
                            }
                        }
                        break;

                    case FieldType.StatusType:
                        literal.Text = this.GetStatusShow(status);
                        return;

                    case FieldType.ContentType:
                        literal.Text = "<iframe marginwidth='0' marginheight='0' frameborder='0' name='ContentPreview' width='650px' height='500px' src='ContentPreview.aspx?GeneralID=" + this.m_GeneralId.ToString() + "&fieldName=" + base.Server.UrlEncode(dataItem.FieldName) + "'></iframe>";
                        return;

                    case FieldType.NodeType:
                        literal.Text = PowerEasy.Contents.Nodes.ShowNodeNavigation(DataConverter.CLng(status));
                        return;

                    case FieldType.InfoType:
                    {
                        Literal child = new Literal();
                        StringBuilder builder2 = new StringBuilder();
                        if (this.m_GeneralId > 0)
                        {
                            foreach (CommonModelInfo info4 in ContentManage.GetInfoList(this.m_GeneralId))
                            {
                                builder2.Append("<span>");
                                builder2.Append(PowerEasy.Contents.Nodes.ShowNodesAndRootNavigation(info4.NodeId));
                                builder2.Append("<br /></span>");
                            }
                        }
                        if (builder2.Length <= 0)
                        {
                            builder2.Append("<span>无其它节点<br /></span>");
                        }
                        child.Text = "<div style=\"margin: 0; padding: 0; float: left;\">" + builder2.ToString() + "</div>";
                        panel.Controls.Add(child);
                        return;
                    }
                    case FieldType.MultipleHtmlTextType:
                        literal.Text = status;
                        return;

                    default:
                        literal.Text = status;
                        return;
                }
                if (builder.Length <= 0)
                {
                    builder.Append("<span id='SpecialSpanId0'>无专题<br /></span>");
                }
                literal2.Text = "<div style=\"margin: 0; padding: 0; float: left;\">" + builder.ToString() + "</div>";
                panel.Controls.Add(literal2);
            }
        }
    }
}

⌨️ 快捷键说明

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