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

📄 content.aspx.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 3 页
字号:
namespace PowerEasy.WebSite.Admin.Contents
{
    using PowerEasy.Accessories;
    using PowerEasy.Common;
    using PowerEasy.CommonModel;
    using PowerEasy.Components;
    using PowerEasy.Contents;
    using PowerEasy.Controls;
    using PowerEasy.Enumerations;
    using PowerEasy.ExtendedControls;
    using PowerEasy.Model.Accessories;
    using PowerEasy.Model.CommonModel;
    using PowerEasy.Model.Contents;
    using PowerEasy.Model.UserManage;
    using PowerEasy.ModelControls;
    using PowerEasy.StaticHtml;
    using PowerEasy.UserManage;
    using PowerEasy.Web.UI;
    using PowerEasy.WebSite.Controls;
    using PowerEasy.WebSite.Controls.FieldControl;
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Text;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class Content : AdminPage
    {
        public StringBuilder arrTrs0 = new StringBuilder();
        public StringBuilder arrTrs1 = new StringBuilder();
        protected Button BtnBack;
        protected DatePicker DpkEndTime;
        protected DropDownList DrpSigninType;
        protected ExtendedButton EBtnNewAddItem;
        protected ExtendedButton EBtnSubmit;
        protected ExtendedCheckBoxList EChklUserGroupList;
        protected Label LblNodeName;
        protected AlternateLiteral LblTitle;
        private string m_Action;
        protected DataTable m_ContentDataTable;
        private string m_ContentFieldName = "";
        private int m_ModelId;
        private int m_NodeId;
        protected string m_TbodyChargeId = "";
        protected RadioButtonList RadlInfoPurview;
        protected RangeValidator RangeValTxtPriority;
        protected Repeater RepModel;
        protected ChargeTypeSetting ShowChargeType;
        protected PowerEasy.ModelControls.ShowPointName ShowPointName;
        protected PowerEasy.ModelControls.ShowPointName ShowPointName1;
        protected PowerEasy.ModelControls.ShowPointName ShowPointName2;
        protected PowerEasy.ModelControls.ShowPointName ShowPointName3;
        protected ScriptManager SmContent;
        protected ExtendedSiteMapPath SmpNavigator;
        protected HtmlTableCell TabTitle2;
        protected HtmlTableCell TabTitle3;
        protected HtmlTableCell TabTitle4;
        protected HtmlGenericControl TbodyCharge;
        protected TextBox TxtDividePercent;
        protected TextBox TxtInfoPoint;
        protected TextBox TxtPriority;
        protected TextBox TxtSigninUser;
        protected ValidationSummary ValidationSummary1;
        protected NumberValidator Valnum;
        protected VoteControl Vote;

        private void Add()
        {
            DataTable dataTableFromRepeater = this.GetDataTableFromRepeater();
            dataTableFromRepeater.Select("FieldName = 'updatetime'")[0]["FieldValue"] = DateTime.Now;
            dataTableFromRepeater = ContentManage.GetNewContentData(dataTableFromRepeater);
            if (ContentManage.Add(this.m_ModelId, dataTableFromRepeater))
            {
                ModelInfo modelInfoById = ModelManager.GetModelInfoById(this.m_ModelId);
                if (modelInfoById.EnableSignin)
                {
                    this.AddSignin(dataTableFromRepeater);
                }
                int num = this.AddPermissionAndCharge(dataTableFromRepeater, modelInfoById.EnableCharge);
                this.SavePresentExp(dataTableFromRepeater, true);
                if (!modelInfoById.EnableSignin || (num <= 0))
                {
                    HtmlContent.CreateHtml(dataTableFromRepeater);
                }
                this.AddKeywordsToTable(dataTableFromRepeater);
                int generalId = GetGeneralId(dataTableFromRepeater);
                if (modelInfoById.EnbaleVote)
                {
                    this.Vote.Add(generalId);
                }
                SiteCache.Remove("CK_Page_Category_" + this.m_NodeId.ToString());
                BasePage.ResponseRedirect(AdminPage.AppendSecurityCode("ContentShowSuccess.aspx?Action=Add&GeneralID=" + generalId.ToString() + "&NodeID=" + this.m_NodeId.ToString() + "&ModelID=" + this.m_ModelId.ToString() + "&ContentFieldName=" + this.m_ContentFieldName));
            }
        }

        private void AddKeywordsToTable(DataTable dataTable)
        {
            int generalId = GetGeneralId(dataTable);
            DataRow[] rowArray = dataTable.Select("FieldName = 'keyword'");
            if (rowArray.Length > 0)
            {
                string str = rowArray[0]["FieldValue"].ToString();
                if (!string.IsNullOrEmpty(str))
                {
                    this.SaveKeywordToTable(str, generalId);
                }
            }
        }

        private int AddPermissionAndCharge(DataTable dataTable, bool enableCharge)
        {
            int generalId = GetGeneralId(dataTable);
            ContentPermissionInfo contentPermissionInfo = new ContentPermissionInfo();
            contentPermissionInfo.GeneralId = generalId;
            contentPermissionInfo.PermissionType = DataConverter.CLng(this.RadlInfoPurview.SelectedValue);
            contentPermissionInfo.ArrGroupId = this.EChklUserGroupList.SelectList();
            int num2 = DataConverter.CLng(this.TxtInfoPoint.Text);
            PermissionContent.Delete(generalId);
            if (PermissionContent.Add(contentPermissionInfo))
            {
                PowerEasy.Contents.ContentCharge.Delete(generalId);
                if (enableCharge && (num2 > 0))
                {
                    ContentChargeInfo contentChargeInfo = new ContentChargeInfo();
                    contentChargeInfo.GeneralId = generalId;
                    contentChargeInfo.InfoPoint = num2;
                    contentChargeInfo.ChargeType = this.ShowChargeType.ChargeType;
                    contentChargeInfo.PitchTime = this.ShowChargeType.PitchTime;
                    contentChargeInfo.ReadTimes = this.ShowChargeType.ReadTimes;
                    contentChargeInfo.DividePercent = DataConverter.CLng(this.TxtDividePercent.Text);
                    PowerEasy.Contents.ContentCharge.Add(contentChargeInfo);
                }
            }
            return num2;
        }

        private void AddSignin(DataTable dataTable)
        {
            if (!string.IsNullOrEmpty(this.TxtSigninUser.Text))
            {
                int generalId = GetGeneralId(dataTable);
                string str = dataTable.Select("FieldName = 'title'")[0]["FieldValue"].ToString();
                SigninContentInfo signinContentInfo = new SigninContentInfo();
                signinContentInfo.GeneralId = generalId;
                signinContentInfo.EndTime = this.DpkEndTime.Date;
                signinContentInfo.Priority = DataConverter.CLng(this.TxtPriority.Text);
                signinContentInfo.SigninType = (SigninType) Enum.Parse(typeof(SigninType), this.DrpSigninType.SelectedValue);
                signinContentInfo.Status = SigninStatus.NotSignin;
                signinContentInfo.Title = str;
                SigninContent.AddSigninContent(signinContentInfo);
                SigninLog.Add(generalId, this.TxtSigninUser.Text);
            }
        }

        protected void BtnBack_Click(object sender, EventArgs e)
        {
            BasePage.ResponseRedirect("ContentManage.aspx?NodeID=" + this.m_NodeId.ToString() + "&ModelID=" + this.m_ModelId.ToString());
        }

        protected void EBtnNewAddItem_Click(object sender, EventArgs e)
        {
            this.m_Action = "add";
            this.Add();
        }

        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            if (this.Page.IsValid)
            {
                if (this.m_Action == "add")
                {
                    this.Add();
                }
                if (this.m_Action == "modify")
                {
                    this.Update();
                }
            }
        }

        private DataTable GetDataTableFromRepeater()
        {
            DataRow row;
            DataTable dataTable = new DataTable();
            dataTable.Columns.Add("FieldName");
            dataTable.Columns.Add("FieldValue");
            dataTable.Columns.Add("FieldType");
            dataTable.Columns.Add("FieldLevel");
            foreach (RepeaterItem item in this.RepModel.Items)
            {
                FieldControl control = (FieldControl) item.FindControl("Field");
                switch (control.ControlType)
                {
                    case FieldType.PictureType:
                    {
                        PictureType type2 = (PictureType) control.FindControl("PowerEasy2007");
                        row = dataTable.NewRow();
                        row["FieldName"] = control.FieldName;
                        row["FieldValue"] = type2.FieldValue;
                        row["FieldType"] = control.ControlType;
                        row["FieldLevel"] = control.FieldLevel;
                        dataTable.Rows.Add(row);
                        if ((control.Settings.Count > 7) && DataConverter.CBool(control.Settings[7]))
                        {
                            DataRow row2 = dataTable.NewRow();
                            row2["FieldName"] = "UploadFiles";
                            row2["FieldValue"] = type2.UploadFiles;
                            row2["FieldType"] = FieldType.TextType;
                            row2["FieldLevel"] = 0;
                            dataTable.Rows.Add(row2);
                        }
                        continue;
                    }
                    case FieldType.FileType:
                    {
                        FileType type3 = (FileType) control.FindControl("PowerEasy2007");
                        row = dataTable.NewRow();
                        row["FieldName"] = control.FieldName;
                        row["FieldValue"] = type3.FieldValue;
                        row["FieldType"] = control.ControlType;
                        row["FieldLevel"] = control.FieldLevel;
                        dataTable.Rows.Add(row);
                        if (DataConverter.CBool(control.Settings[3]))
                        {
                            DataRow row3 = dataTable.NewRow();
                            row3["FieldName"] = control.Settings[4];
                            row3["FieldValue"] = type3.FileSize;
                            row3["FieldType"] = FieldType.TextType;
                            row3["FieldLevel"] = control.FieldLevel;
                            dataTable.Rows.Add(row3);
                        }
                        continue;
                    }
                    case FieldType.NodeType:
                    {
                        PowerEasy.WebSite.Controls.FieldControl.NodeType type5 = (PowerEasy.WebSite.Controls.FieldControl.NodeType) control.FindControl("PowerEasy2007");
                        row = dataTable.NewRow();
                        row["FieldName"] = control.FieldName;
                        row["FieldValue"] = type5.FieldValue;
                        row["FieldType"] = control.ControlType;
                        row["FieldLevel"] = control.FieldLevel;
                        dataTable.Rows.Add(row);
                        row = dataTable.NewRow();
                        row["FieldName"] = "infoid";

⌨️ 快捷键说明

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