Example #1
0
        /// <summary>
        /// 更新文章
        /// </summary>
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                // 设置方案项
                Playngo_ClientZone_DownloadFile Event = new Playngo_ClientZone_DownloadFile();
                Boolean SaveResult = SaveDataItem(-1, out Event);

                if (SaveResult)
                {
                    mTips.LoadMessage("SaveSuccess", EnumTips.Success, this, new String[] { Event.Title });
                    //Response.Redirect(xUrl("EventID", Event.ID.ToString(), "EditLoading", String.Format("ReturnUrl={0}", HttpUtility.UrlEncode( xUrl("Downloads")))) ,false);
                    Response.Redirect(xUrl("ID", Event.ID.ToString(), "Downloads-Edit"), false);
                }
                else
                {
                    mTips.IsPostBack = false;
                    mTips.LoadMessage("SaveError", EnumTips.Warning, this, new String[] { Event.Title });
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
Example #2
0
        /// <summary>
        /// DownloadFiles
        /// 将事件实体查询出来并填充到数据中
        /// </summary>
        /// <param name="DictDataItem"></param>
        /// <param name="ItemId"></param>
        /// <returns></returns>
        public Dictionary <String, Object> GetDictDataItemsByDownloadFiles(Dictionary <String, Object> DictDataItem, Int32 ItemId, BasePage Context)
        {
            var DataItem = Playngo_ClientZone_DownloadFile.FindByKeyForEdit(ItemId);

            if (DataItem != null && DataItem.ID > 0)
            {
                //循环输出所有的固定项
                foreach (var Field in Playngo_ClientZone_DownloadFile.Meta.Fields)
                {
                    DictDataItem.Add(Field.ColumnName, DataItem[Field.ColumnName]);
                }

                //移除累赘的字典项
                DictDataItem = Common.RemoveDictionary(DictDataItem, "Options");

                TemplateFormat xf = new TemplateFormat(Context);


                String DownloadUrl = String.Format("{0}Resource_Service.aspx?ModuleId={1}&Token={2}&TabId={3}&PortalId={4}&language={5}&FileId={6}",
                                                   Context.ModulePath,
                                                   Context.Settings_ModuleID,
                                                   "DownloadFile",
                                                   Context.Settings_TabID,
                                                   Context.PortalId,
                                                   Context.language,
                                                   DataItem.ID);

                DictDataItem = Common.UpdateDictionary(DictDataItem, "Image", xf.ViewLinkUrl(xf.ViewItemSettingT <string>(DataItem, "Image", ""), "", Context));
                DictDataItem = Common.UpdateDictionary(DictDataItem, "Summary", xf.ViewItemSettingT <string>(DataItem, "Summary", ""));
                DictDataItem = Common.UpdateDictionary(DictDataItem, "Url", Context.FullPortalUrl(DownloadUrl));
                DictDataItem = Common.UpdateDictionary(DictDataItem, "ReleaseDateStr", String.Format("{0} {1}{2},{3}", DataItem.ReleaseDate.ToString("MMM"), DataItem.ReleaseDate.Day, xf.GetDaySuffix(DataItem.ReleaseDate.Day), DataItem.ReleaseDate.ToString("yyyy")));
            }
            return(DictDataItem);
        }
Example #3
0
        /// <summary>
        /// 保存草稿
        /// </summary>
        protected void cmdSaveDraft_Click(object sender, EventArgs e)
        {
            try
            {
                Int32 EventStatus = (Int32)EnumStatus.Draft;
                Playngo_ClientZone_DownloadFile Event = new Playngo_ClientZone_DownloadFile();
                Boolean SaveResult = SaveDataItem(EventStatus, out Event);



                if (SaveResult)
                {
                    mTips.LoadMessage("SaveSuccess", EnumTips.Success, this, new String[] { Event.Title });
                    Response.Redirect(xUrl("EventID", Event.ID.ToString(), "Event"), false);
                }
                else
                {
                    mTips.IsPostBack = false;
                    mTips.LoadMessage("SaveError", EnumTips.Success, this, new String[] { Event.Title });
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
Example #4
0
        /// <summary>
        /// 文章软删除(删除到回收站)
        /// </summary>
        protected void cmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                Playngo_ClientZone_DownloadFile Event = Playngo_ClientZone_DownloadFile.FindByKeyForEdit(DownloadID);
                Event.Status = (Int32)EnumStatus.Recycle;

                if (Event != null && Event.ID > 0 && Event.Update() > 0)
                {
                    //操作成功
                    mTips.LoadMessage("DeleteEventSuccess", EnumTips.Success, this, new String[] { Event.Title });
                    Response.Redirect(xUrl("Downloads"), false);
                }
                else
                {
                    mTips.IsPostBack = false;
                    //操作失败
                    mTips.LoadMessage("DeleteEventError", EnumTips.Success, this, new String[] { Event.Title });
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
Example #5
0
        /// <summary>
        /// 发送邮件(多篇文章)-订阅列表中的角色+邮箱
        /// </summary>
        /// <param name="Articles"></param>
        /// <returns></returns>
        public Int32 SendMail(Playngo_ClientZone_DownloadFile DataItem)
        {
            Int32 RecordCount = 0;

            Int32 UserRecordCount = 0;
            var   UserList        = Common.Split <UserInfo>(UserController.GetUsersByProfileProperty(DataItem.PortalId, "Newsletter_Downloads", "True", 0, Int32.MaxValue, ref UserRecordCount), 1, Int32.MaxValue);

            if (UserList != null && UserList.Count > 0)
            {
                foreach (var UserItem in UserList)
                {
                    //验证邮件地址符合规则
                    if (Mail.IsValidEmailAddress(UserItem.Email, Null.NullInteger))
                    {
                        //验证用户是否有权限接受邮件
                        if (ValidUserRole(DataItem.Per_AllUsers, DataItem.Per_Roles, UserItem))
                        {
                            //验证用户区域
                            if (ValidUserJurisdictions(DataItem.Per_AllJurisdictions, DataItem.Per_Jurisdictions, UserItem))
                            {
                                //创建邮件
                                EmailInfo email = CreateMailHtml(DataItem, UserItem);
                                //推送邮件
                                MailScheduler.AssignMessage(email);

                                RecordCount++;
                            }
                        }
                    }
                }
            }


            return(RecordCount);
        }
        /// <summary>
        /// 获取文档关联下载文件
        /// </summary>
        /// <param name="DataItem"></param>
        /// <returns></returns>
        public List <Playngo_ClientZone_DownloadFile> GetDownloadFiles(Playngo_ClientZone_GameSheet DataItem)
        {
            var DownLoadFiles = new List <Playngo_ClientZone_DownloadFile>();

            if (DataItem != null && DataItem.ID > 0)
            {
                var Relations = Playngo_ClientZone_DownloadRelation.FindListByItem(DataItem.ID, (Int32)EnumDisplayModuleType.GameSheets);


                if (Relations != null && Relations.Count > 0)
                {
                    foreach (var Relation in Relations)
                    {
                        Playngo_ClientZone_DownloadFile DownloadFile = Playngo_ClientZone_DownloadFile.FindByKeyForEdit(Relation.DownloadID);
                        if (DownloadFile != null && DownloadFile.ID > 0)
                        {
                            //判断当前角色和区域是否可以看到这些文件
                            if (IsPreRoleView(DownloadFile.Per_AllUsers, DownloadFile.Per_Roles) && IsPreJurisdictionView(DownloadFile.Per_AllJurisdictions, DownloadFile.Per_Jurisdictions))
                            {
                                DownLoadFiles.Add(DownloadFile);
                            }
                        }
                    }
                }
            }

            return(DownLoadFiles);
        }
Example #7
0
        public void Execute(BasePage Context)
        {
            TemplateFormat xf = new TemplateFormat(Context);

            QueryParam qp = new QueryParam();

            qp.ReturnFields = "ID,Title";


            qp.PageIndex = WebHelper.GetIntParam(Context.Request, "PageIndex", 1);
            qp.PageSize  = WebHelper.GetIntParam(Context.Request, "PageSize", xf.ViewSettingT <Int32>("General.Search.Size", 10));

            //排序的规则
            qp.OrderType = WebHelper.GetIntParam(Context.Request, "OrderType", 1);
            qp.Orderfld  = "ID"; //WebHelper.GetStringParam(Context.Request, "Orderfld", "ID");


            //查询语句
            qp = CreateQueryParam(qp, Context);

            //权限筛选
            qp = CreateQueryByRoles(qp, Context);

            //区域筛选
            qp = CreateQueryByJurisdictions(qp, Context);



            int RecordCount = 0;
            List <Playngo_ClientZone_DownloadFile> EventList = Playngo_ClientZone_DownloadFile.FindAll(qp, out RecordCount);

            Dictionary <String, Object> jsonPictures = new Dictionary <string, Object>();


            JavaScriptSerializer jsSerializer = new JavaScriptSerializer();

            List <Dictionary <String, Object> > DictFiles = new List <Dictionary <string, object> >();

            foreach (var EventItem in EventList)
            {
                int index = EventList.IndexOf(EventItem); //index 为索引值

                Dictionary <String, Object> jsonDict = new Dictionary <String, Object>();

                jsonDict.Add("ID", EventItem.ID);
                jsonDict.Add("Title", EventItem.Title);

                DictFiles.Add(jsonDict);
            }

            jsonPictures.Add("data", DictFiles);
            jsonPictures.Add("Pages", qp.Pages);
            jsonPictures.Add("RecordCount", RecordCount);

            //转换数据为json
            ResponseString = jsSerializer.Serialize(jsonPictures);
        }
Example #8
0
        public void Execute(BasePage Context)
        {
            Int32 FileId = WebHelper.GetIntParam(Context.Request, "FileId", 0);

            if (FileId > 0)
            {
                var FileItem = Playngo_ClientZone_DownloadFile.FindByKeyForEdit(FileId);
                if (FileItem != null && FileItem.ID > 0 && !String.IsNullOrEmpty(FileItem.Options))
                {
                    if (Context.IsPreRoleView(FileItem.Per_AllUsers, FileItem.Per_Roles) && Context.IsPreJurisdictionView(FileItem.Per_AllJurisdictions, FileItem.Per_Jurisdictions))
                    {
                        var FileItemOptions = ConvertTo.Deserialize <List <KeyValueEntity> >(FileItem.Options);
                        if (FileItemOptions != null)
                        {
                            TemplateFormat           xf         = new TemplateFormat(Context);
                            Playngo_ClientZone_Files Multimedia = new Playngo_ClientZone_Files();
                            String UploadFile = xf.GetFilePath(xf.ViewItemSettingT <String>(FileItem.Options, "UploadFile", ""), Context, out Multimedia);
                            if (!String.IsNullOrEmpty(UploadFile))
                            {
                                UploadFile = Context.Server.MapPath(UploadFile);
                                if (File.Exists(UploadFile))
                                {
                                    String FileName = String.Format("{0}.{1}", Multimedia.Name, Multimedia.FileExtension);
                                    //FileSystemUtils.DownloadFile(UploadFile,String.Format("{0}_{1}{2}", FileItem.Title, FileItem.Version,  Path.GetExtension(UploadFile)));
                                    //FileSystemUtils.DownloadFile(UploadFile);

                                    FileManager file = new FileManager();

                                    file.WriteFileToResponse(new System.IO.FileInfo(UploadFile), ContentDisposition.Attachment);
                                    IsResponseWrite = false;
                                }
                            }
                            else
                            {
                                //当前文件找不到
                            }
                        }
                        else
                        {
                            //没有添加文件
                        }
                    }
                    else
                    {
                        //没有权限下载
                    }
                }
                else
                {
                    ResponseString = "没找到数据怎么搞";
                }
            }
            else
            {
                ResponseString = "传过来的文件编号都不对";
            }
        }
        /// <summary>
        /// 列表行绑定
        /// </summary>
        protected void gvEventList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //还原出数据
                Playngo_ClientZone_DownloadFile Event = e.Row.DataItem as Playngo_ClientZone_DownloadFile;

                if (Event != null && Event.ID > 0)
                {
                    HyperLink  hlEdit               = e.Row.FindControl("hlEdit") as HyperLink;
                    HyperLink  hlMobileEdit         = e.Row.FindControl("hlMobileEdit") as HyperLink;
                    LinkButton btnRemove            = e.Row.FindControl("btnRemove") as LinkButton;
                    LinkButton btnMobileRemove      = e.Row.FindControl("btnMobileRemove") as LinkButton;
                    HyperLink  hlNewsletter         = e.Row.FindControl("hlNewsletter") as HyperLink;
                    Literal    liNewsletterClientID = e.Row.FindControl("liNewsletterClientID") as Literal;
                    HyperLink  hlRegisters          = e.Row.FindControl("hlRegisters") as HyperLink;


                    HyperLink hlRepeats         = e.Row.FindControl("hlRepeats") as HyperLink;
                    Literal   liRepeatsClientID = e.Row.FindControl("liRepeatsClientID") as Literal;


                    HyperLink HLEventTitle = e.Row.FindControl("HLEventTitle") as HyperLink;
                    //设置按钮的CommandArgument
                    btnRemove.CommandArgument = btnMobileRemove.CommandArgument = Event.ID.ToString();
                    //设置删除按钮的提示
                    if (Event.Status == (Int32)EnumStatus.Recycle)
                    {
                        btnRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");
                        btnMobileRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");
                    }
                    else
                    {
                        btnRemove.Attributes.Add("onClick", "javascript:return confirm('" + ViewResourceText("DeleteRecycleItem", "Are you sure to move it to recycle bin?") + "');");
                        btnMobileRemove.Attributes.Add("onClick", "javascript:return confirm('" + ViewResourceText("DeleteRecycleItem", "Are you sure to move it to recycle bin?") + "');");
                    }

                    hlEdit.NavigateUrl = hlMobileEdit.NavigateUrl = xUrl("ID", Event.ID.ToString(), "Downloads-Edit");



                    HLEventTitle.Text = Event.Title;
                    //HLEventTitle.NavigateUrl = CommonFriendlyUrls.EventFriendlyUrl(Event, this);  //Globals.NavigateURL("", "Token=Info", "EventID=" + Convert.ToString( Event.ID));

                    //获取用户名称
                    DotNetNuke.Entities.Users.UserInfo createUser = new DotNetNuke.Entities.Users.UserController().GetUser(PortalId, Event.CreateUser);
                    e.Row.Cells[3].Text = createUser != null && createUser.UserID > 0 ? createUser.Username : "";
                    //文章状态
                    e.Row.Cells[6].Text = EnumHelper.GetEnumTextVal(Event.Status, typeof(EnumStatus));

                    //格式化3种时间为短日期格式
                    e.Row.Cells[4].Text = Event.ReleaseDate.ToShortDateString();
                    e.Row.Cells[5].Text = Event.StartTime.ToShortDateString();
                    //e.Row.Cells[6].Text = Event.CreateTime.ToShortDateString();
                }
            }
        }
Example #10
0
        /// <summary>
        /// 列表行绑定
        /// </summary>
        protected void gvEventList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //还原出数据
                Playngo_ClientZone_DownloadFile Media = e.Row.DataItem as Playngo_ClientZone_DownloadFile;

                if (Media != null && Media.ID > 0)
                {
                    TemplateFormat xf = new TemplateFormat(this);


                    HyperLink hlFileName = e.Row.FindControl("hlFileName") as HyperLink;
                    hlFileName.Text = Media.Title;



                    Image imgFileName = e.Row.FindControl("imgFileName") as Image;

                    //imgFileName.ImageUrl = xf.ViewLinkUrl(Media.)



                    //Label lblFileExtension = e.Row.FindControl("lblFileExtension") as Label;
                    //lblFileExtension.Text = Media.FileExtension;

                    //Image imgFileName = e.Row.FindControl("imgFileName") as Image;

                    //HyperLink hlFileName = e.Row.FindControl("hlFileName") as HyperLink;
                    //hlFileName.Text = Media.FileName.Replace("." + Media.FileExtension, "");
                    //imgFileName.ImageUrl = GetPhotoExtension(Media.FileExtension, Media.FilePath);
                    //hlFileName.NavigateUrl = GetPhotoPath(Media.FilePath);



                    //发布者信息
                    e.Row.Cells[2].Text = "--";
                    if (Media.LastUser > 0)
                    {
                        UserInfo uInfo = UserController.GetUserById(PortalId, Media.LastUser);
                        if (uInfo != null && uInfo.UserID > 0)
                        {
                            e.Row.Cells[2].Text = String.Format("{0}<br />{1}", uInfo.Username, uInfo.DisplayName);
                        }
                    }


                    //发布时间
                    e.Row.Cells[3].Text = Media.LastTime.ToShortDateString();

                    //状态
                    e.Row.Cells[4].Text = EnumHelper.GetEnumTextVal(Media.Status, typeof(EnumStatus));
                }
            }
        }
        /// <summary>
        /// 列表上的项删除事件
        /// </summary>
        protected void btnRemove_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton btnRemove = (LinkButton)sender;

                if (btnRemove != null && !String.IsNullOrEmpty(btnRemove.CommandArgument))
                {
                    mTips.IsPostBack = true;

                    Playngo_ClientZone_DownloadFile Event = Playngo_ClientZone_DownloadFile.FindByKeyForEdit(btnRemove.CommandArgument);

                    if (Event != null && Event.ID > 0)
                    {
                        if (Event.Status == (Int32)EnumStatus.Recycle)
                        {
                            if (Event.Delete() > 0)
                            {
                                //操作成功
                                mTips.LoadMessage("DeleteEventSuccess", EnumTips.Success, this, new String[] { Event.Title });
                            }
                            else
                            {
                                //操作失败
                                mTips.LoadMessage("DeleteEventError", EnumTips.Success, this, new String[] { Event.Title });
                            }
                        }
                        else
                        {
                            Event.Status = (Int32)EnumStatus.Recycle;
                            if (Event.Update() > 0)
                            {
                                //移动到回收站操作成功
                                mTips.LoadMessage("DeleteEventSuccess", EnumTips.Success, this, new String[] { Event.Title });
                            }
                            else
                            {
                                //移动到回收站操作失败
                                mTips.LoadMessage("DeleteEventError", EnumTips.Success, this, new String[] { Event.Title });
                            }
                        }
                        BindDataList();
                    }
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
Example #12
0
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void BindDataList()
        {
            QueryParam qp = new QueryParam();

            qp.OrderType = OrderType;
            if (!String.IsNullOrEmpty(Orderfld))
            {
                qp.Orderfld = Orderfld;
            }
            else
            {
                qp.Orderfld = Playngo_ClientZone_DownloadFile._.ID;
            }

            #region "分页的一系列代码"


            int RecordCount = 0;
            int pagesize    = qp.PageSize = 10;
            qp.PageIndex = PageIndex;


            #endregion

            //查询的方法
            qp.Where = BindSearch();

            List <Playngo_ClientZone_DownloadFile> Events = Playngo_ClientZone_DownloadFile.FindAll(qp, out RecordCount);
            qp.RecordCount      = RecordCount;
            RecordPages         = qp.Pages;
            lblRecordCount.Text = String.Format("{0} {2} / {1} {3}", RecordCount, RecordPages, ViewResourceText("Title_Items", "Items"), ViewResourceText("Title_Pages", "Pages"));


            //Boolean is_admin = !IsAdministrator && !IsAdmin;



            //ctlPagingControl.TotalRecords = RecordCount;

            //if (RecordCount <= pagesize)
            //{
            //    ctlPagingControl.Visible = false;

            //}

            gvEventList.DataSource = Events;
            gvEventList.DataBind();
            BindGridViewEmpty <Playngo_ClientZone_DownloadFile>(gvEventList, new Playngo_ClientZone_DownloadFile());
        }
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void BindDataList()
        {
            QueryParam qp = new QueryParam();

            qp.OrderType = OrderType;
            if (!String.IsNullOrEmpty(Orderfld))
            {
                qp.Orderfld = Orderfld;
            }
            else
            {
                qp.Orderfld = Playngo_ClientZone_DownloadFile._.ID;
            }

            #region "分页的一系列代码"


            int RecordCount = 0;
            qp.PageSize  = Settings_General_ManagerPerPage;
            qp.PageIndex = PageIndex;


            #endregion

            //查询的方法
            qp.Where = BindSearch();

            List <Playngo_ClientZone_DownloadFile> Events = Playngo_ClientZone_DownloadFile.FindAll(qp, out RecordCount);
            qp.RecordCount      = RecordCount;
            RecordPages         = qp.Pages;
            lblRecordCount.Text = String.Format("{0} {2} / {1} {3}", RecordCount, RecordPages, ViewResourceText("Title_Items", "Items"), ViewResourceText("Title_Pages", "Pages"));


            Boolean is_admin = !IsAdministrator && !IsAdmin;


            hlAllEvent.Text        = String.Format("{1} ({0})", Playngo_ClientZone_DownloadFile.FindCountByStatus(ModuleId, -1, is_admin, UserId), ViewResourceText("hlAllEvent", "All"));
            hlPublishedEvent.Text  = String.Format("{1} ({0})", Playngo_ClientZone_DownloadFile.FindCountByStatus(ModuleId, (Int32)EnumStatus.Published, is_admin, UserId), ViewResourceText("hlPublishedEvent", "Published"));
            hlPendingEvent.Text    = String.Format("{1} ({0})", Playngo_ClientZone_DownloadFile.FindCountByStatus(ModuleId, (Int32)EnumStatus.Pending, is_admin, UserId), ViewResourceText("hlPendingEvent", "Pending"));
            hlDraftsEvent.Text     = String.Format("{1} ({0})", Playngo_ClientZone_DownloadFile.FindCountByStatus(ModuleId, (Int32)EnumStatus.Draft, is_admin, UserId), ViewResourceText("hlDraftsEvent", "Drafts"));
            hlRecycleBinEvent.Text = String.Format("{1} ({0})", Playngo_ClientZone_DownloadFile.FindCountByStatus(ModuleId, (Int32)EnumStatus.Recycle, is_admin, UserId), ViewResourceText("hlRecycleBinEvent", "Recycle Bin"));



            gvEventList.DataSource = Events;
            gvEventList.DataBind();
            BindGridViewEmpty <Playngo_ClientZone_DownloadFile>(gvEventList, new Playngo_ClientZone_DownloadFile());
        }
        /// <summary>
        /// 状态应用按钮事件
        /// </summary>
        protected void btnApply_Click(object sender, EventArgs e)
        {
            try
            {
                Int32 Status = WebHelper.GetIntParam(Request, ddlStatus.UniqueID, -1);

                if (Status >= 0)
                {
                    string   Checkbox_Value       = WebHelper.GetStringParam(Request, "Checkbox", "");
                    string[] Checkbox_Value_Array = Checkbox_Value.Split(',');
                    Int32    IDX = 0;
                    for (int i = 0; i < Checkbox_Value_Array.Length; i++)
                    {
                        if (Int32.TryParse(Checkbox_Value_Array[i], out IDX))
                        {
                            Playngo_ClientZone_DownloadFile Event = Playngo_ClientZone_DownloadFile.FindByKeyForEdit(IDX);
                            if (Event != null && Event.ID > 0)
                            {
                                if (Event.Status == (Int32)EnumStatus.Recycle && Status == (Int32)EnumStatus.Recycle)
                                {
                                    if (Event.Delete() > 0)
                                    {
                                    }
                                }
                                else
                                {
                                    Event.Status = Status;
                                    if (Event.Update() > 0)
                                    {
                                    }
                                }
                            }
                        }
                    }
                    BindDataList();

                    mTips.IsPostBack = true;
                    mTips.LoadMessage("ApplyStatusSuccess", EnumTips.Success, this, new String[] { EnumHelper.GetEnumTextVal(Status, typeof(EnumStatus)) });
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
Example #15
0
        /// <summary>
        /// 利用线程发送订阅邮件
        /// </summary>
        /// <param name="ObjectItem"></param>8
        public void ThreadCreateSendMail(Object ObjectItem)
        {
            var objs = (Dictionary <object, object>)ObjectItem;

            Playngo_ClientZone_DownloadFile DataItem = (Playngo_ClientZone_DownloadFile)objs["DataItem"];

            if (DataItem != null && DataItem.ID > 0)
            {
                //这里需要调用所有邮件的信息
                NotificationEmail NotEmail = new NotificationEmail();
                //所有区域
                NotEmail.AllJurisdictions = Playngo_ClientZone_Jurisdiction.FindAllByModuleID(DataItem.ModuleId);
                //邮件设置
                NotEmail.MailSetting = Playngo_ClientZone_MailSetting.FindByModuleId(ModuleId, "Notification.Downloads");
                if (NotEmail.MailSetting != null && NotEmail.MailSetting.Status == 1)
                {
                    NotEmail.Settings = Settings;
                    NotEmail.Settings.Add("PortalUrl", objs["PortalUrl"]);
                    NotEmail.SendMail(DataItem);
                }
            }
        }
        /// <summary>
        /// 绑定动态模块到页面
        /// </summary>
        private void BindDownFilesToPage()
        {
            if (CampaignID > 0)
            {
                //绑定动态模块的模态窗口 Resource_Attachments|Manager_Modal_SelectDownloadFiles
                hlSelectFiles.Attributes.Add("data-href", String.Format("{0}Resource_Masters.aspx?PortalId={1}&TabId={2}&ModuleId={3}&language={4}&Master=Manager_Modal_Downloads", ModulePath, PortalId, TabId, ModuleId, language));
            }
            else
            {
                hlSelectFiles.Enabled = false;
                hlSelectFiles.Attributes.Add("disabled", "disabled");
            }


            List <Object> Items = new List <Object>();

            if (CampaignItem != null && CampaignItem.ID > 0)
            {
                var Relations = Playngo_ClientZone_DownloadRelation.FindListByItem(CampaignItem.ID, (Int32)EnumDisplayModuleType.Campaigns);


                if (Relations != null && Relations.Count > 0)
                {
                    foreach (var Relation in Relations)
                    {
                        var Item = Playngo_ClientZone_DownloadFile.FindByKeyForEdit(Relation.DownloadID);
                        Items.Add(new { ID = Relation.ID, ItemID = Item.ID, DownloadID = Relation.DownloadID, Title = Item.Title, PageType = (Int32)EnumDisplayModuleType.Campaigns, PageTypeText = "Campaigns" });
                    }
                }
            }



            //绑定参数项
            RepeaterFiles.DataSource = Items;
            RepeaterFiles.DataBind();
        }
Example #17
0
        public void Execute(BasePage Context)
        {
            TemplateFormat xf = new TemplateFormat(Context);

            JavaScriptSerializer jsSerializer = new JavaScriptSerializer();

            Dictionary <String, Object> DictFiles = new Dictionary <string, object>();



            //创建 DownloadFile 查询的浅度拷贝
            var DownloadFileQP = SqlQueryTable(xf, Context);
            //Cookie中保存的最后点击事件
            var ClickTime = GetCookieClickTime(EnumDisplayModuleType.Downloads.ToString());

            if (ClickTime != DateTime.MinValue)
            {
                DownloadFileQP.Where.Add(new SearchParam("StartTime", ClickTime, SearchType.GtEqual));
            }

            DictFiles.Add("DownloadFileCount", Playngo_ClientZone_DownloadFile.FindCount(DownloadFileQP));


            //创建 Campaign 查询的浅度拷贝
            var CampaignQP = SqlQueryTable(xf, Context);

            //Cookie中保存的最后点击事件
            ClickTime = GetCookieClickTime(EnumDisplayModuleType.Campaigns.ToString());
            if (ClickTime != DateTime.MinValue)
            {
                CampaignQP.Where.Add(new SearchParam("StartTime", ClickTime, SearchType.GtEqual));
            }
            DictFiles.Add("CampaignCount", Playngo_ClientZone_Campaign.FindCount(CampaignQP));



            //创建 Event 查询的浅度拷贝
            var EventQP = SqlQueryTable(xf, Context);

            //Cookie中保存的最后点击事件
            ClickTime = GetCookieClickTime(EnumDisplayModuleType.Events.ToString());
            if (ClickTime != DateTime.MinValue)
            {
                EventQP.Where.Add(new SearchParam("StartTime", ClickTime, SearchType.GtEqual));
            }
            DictFiles.Add("EventCount", Playngo_ClientZone_Event.FindCount(EventQP));



            //创建 GameSheet 查询的浅度拷贝
            var GameSheetQP = SqlQueryTable(xf, Context);

            //Cookie中保存的最后点击事件
            ClickTime = GetCookieClickTime(EnumDisplayModuleType.GameSheets.ToString());
            if (ClickTime != DateTime.MinValue)
            {
                GameSheetQP.Where.Add(new SearchParam("StartTime", ClickTime, SearchType.GtEqual));
            }
            DictFiles.Add("GameSheetCount", Playngo_ClientZone_GameSheet.FindCount(GameSheetQP));



            ResponseString = jsSerializer.Serialize(DictFiles);
        }
Example #18
0
        /// <summary>
        /// 保存文章
        /// </summary>
        /// <param name="EventStatus">文章状态(为-1的时候取选项的值)</param>
        private Boolean SaveDataItem(Int32 EventStatus, out Playngo_ClientZone_DownloadFile Event)
        {
            Boolean SaveResult = false;

            Event = EventItem;

            Event.Title   = Common.ReplaceEscape(txtTitle.Text);
            Event.Version = Common.ReplaceEscape(txtVersion.Text);
            //Event.GameID = Common.ReplaceEscape(txtGameID.Text);


            Event.NotifyInclude = cbIncludeNotification.Checked ? 1:0;
            Event.NotifyStatus  = WebHelper.GetIntParam(Request, ddlNotificationStatus.UniqueID, 0);
            //Event.NotifySubscribers = cbNotifySubscribers.Checked ? 1 : 0;



            //权限
            Event.Per_AllUsers = cbPermissionsAllUsers.Checked ? 0 : 1;
            String textStr, idStr = String.Empty;

            WebHelper.GetSelected(cblPermissionsRoles, out textStr, out idStr);
            Event.Per_Roles = idStr;


            //区域
            Event.Per_AllJurisdictions = cbAllJurisdictions.Checked ? 0 : 1;
            String JurisdictionTexts, JurisdictionIDs = String.Empty;

            WebHelper.GetSelected(cblJurisdictions, out JurisdictionTexts, out JurisdictionIDs);
            Event.Per_Jurisdictions = JurisdictionIDs;


            //Game Category
            String GameCategoryTexts, GameCategoryIDs = String.Empty;

            WebHelper.GetSelected(cblGameCategory, out GameCategoryTexts, out GameCategoryIDs);
            Event.GameCategories = GameCategoryIDs;

            //File Type
            String FileTypeTexts, FileTypeIDs = String.Empty;

            WebHelper.GetSelected(cblFileType, out FileTypeTexts, out FileTypeIDs);
            Event.FileTypes = FileTypeIDs;



            //文章的发布状态
            if (EventStatus == -1)//如果没有指定状态就取控件的
            {
                Event.Status = WebHelper.GetIntParam(Request, ddlEventStatus.UniqueID, (Int32)EnumStatus.Published);
            }
            else
            {
                Event.Status = EventStatus;
            }

            List <KeyValueEntity> list = new List <KeyValueEntity>();

            if (divOptions.Visible)
            {
                Event.Options = SetItemSettings(ref list);
            }

            //从动态选项中获取Roadmap启用状态
            if (list.Exists(r => r.Key == "IncludeRoadmap"))
            {
                KeyValueEntity Entity = list.Find(r => r.Key == "IncludeRoadmap");
                Event.IncludeRoadmap = Convert.ToBoolean(Entity.Value) ? 0 : 1;
            }



            //更新项
            Event.LastIP   = WebHelper.UserHost;
            Event.LastTime = xUserTime.LocalTime();
            Event.LastUser = UserId;

            //开始状态和时间
            DateTime oTime = xUserTime.LocalTime();

            string[] expectedFormats = { "G", "g", "f", "F" };
            string   StartDate       = WebHelper.GetStringParam(Request, txtStartDate.UniqueID, oTime.ToString("MM/dd/yyyy"));
            string   StartTime       = WebHelper.GetStringParam(Request, txtStartTime.UniqueID, oTime.ToString("HH:mm:ss"));

            if (DateTime.TryParseExact(String.Format("{0} {1}", StartDate, StartTime), "MM/dd/yyyy HH:mm:ss", new CultureInfo("en-US", false), DateTimeStyles.AllowWhiteSpaces, out oTime))
            {
                Event.StartTime = oTime;
            }


            //发布状态和时间
            DateTime oReleaseTime = xUserTime.LocalTime();
            string   ReleaseDate  = WebHelper.GetStringParam(Request, txtReleaseDate.UniqueID, oTime.ToString("MM/dd/yyyy"));
            string   ReleaseTime  = WebHelper.GetStringParam(Request, txtReleaseTime.UniqueID, oTime.ToString("HH:mm:ss"));

            if (DateTime.TryParseExact(String.Format("{0} {1}", ReleaseDate, ReleaseTime), "MM/dd/yyyy HH:mm:ss", new CultureInfo("en-US", false), DateTimeStyles.AllowWhiteSpaces, out oReleaseTime))
            {
                Event.ReleaseDate = oReleaseTime;
            }


            //结束状态和时间
            DateTime EndTime     = xUserTime.LocalTime().AddDays(1);
            string   DisableDate = WebHelper.GetStringParam(Request, txtDisableDate.UniqueID, EndTime.ToString("MM/dd/yyyy"));
            string   DisableTime = WebHelper.GetStringParam(Request, txtDisableTime.UniqueID, EndTime.ToString("HH:mm:ss"));

            if (DateTime.TryParseExact(String.Format("{0} {1}", DisableDate, DisableTime), "MM/dd/yyyy HH:mm:ss", new CultureInfo("en-US", false), DateTimeStyles.AllowWhiteSpaces, out EndTime))
            {
                Event.EndTime = EndTime;
            }

            //创建用户改为可以选择
            Event.CreateUser = WebHelper.GetIntParam(Request, hfEventAuthor.UniqueID, UserId);


            if (Event.ID > 0)
            {
                //更新
            }
            else
            {
                //新增
                Event.ModuleId   = ModuleId;
                Event.PortalId   = PortalId;
                Event.CreateTime = xUserTime.LocalTime();
            }


            int ResultEvent = 0;

            if (Event.ID > 0)
            {
                ResultEvent = Event.Update();
            }
            else
            {
                ResultEvent = Event.ID = Event.Insert();
            }

            if (ResultEvent > 0)
            {
                SaveResult = true;


                //邮件发送
                //if (Event.SendMail == 0 && cbNotifySubscribers.Checked)
                if (cbNotifySubscribers.Checked)
                {
                    //利用现成发送邮件
                    var objs = new Dictionary <object, object>();
                    objs.Add("DataItem", Event);
                    objs.Add("PortalUrl", PortalUrl);
                    ManagedThreadPool.QueueUserWorkItem(new WaitCallback(ThreadCreateSendMail), objs);


                    //更新发送状态
                    //Playngo_ClientZone_DownloadFile.Update(String.Format("SendMail={0}", 1), String.Format("ID={0}", Event.ID));
                }
            }
            else
            {
                SaveResult = false;
            }
            return(SaveResult);
        }
Example #19
0
        /// <summary>
        /// 绑定数据项
        /// </summary>
        private void BindDataItem()
        {
            Playngo_ClientZone_DownloadFile Event = EventItem;

            //验证文章是否存在
            if (DownloadID > 0 && (Event == null || DownloadID != Event.ID))
            {
                //需要给出提示,载入文章错误
                mTips.LoadMessage("LoadingEventError", EnumTips.Error, this, new String[] { "" });
                Response.Redirect(xUrl("Downloads"), false);
            }

            if (Event == null)
            {
                Event = new Playngo_ClientZone_DownloadFile();
            }



            //这里需要验证一下权限,当作者进入到别人的文章时,需要跳到列表页面
            if (Event != null && Event.ID > 0 && (!IsAdministrator && !IsAdmin) && Event.CreateUser != UserId)
            {
                //需要给出提示,你无权编辑其他作者的文章
                mTips.LoadMessage("NoPermissionEventAlert", EnumTips.Warning, this, new String[] { Event.Title });
                Response.Redirect(xUrl("Downloads"), false);
            }

            if (Event != null && Event.ID > 0)
            {
                liLastUpdated.Text = Event.LastTime.ToString("MM/dd/yyyy hh:mm tt", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            }



            txtTitle.Text = Common.RestoreEscape(Event.Title);
            //txtGameID.Text = Event.GameID;
            txtVersion.Text = Event.Version;


            cbIncludeNotification.Checked = Event.NotifyInclude == 1;
            WebHelper.SelectedListByValue(ddlNotificationStatus, Event.NotifyStatus);
            cbNotifySubscribers.Checked = Event.NotifySubscribers == 1;


            txtStartDate.Text = Event.StartTime.ToString("MM/dd/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            txtStartTime.Text = Event.StartTime.ToString("HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo);

            txtReleaseDate.Text = Event.ReleaseDate.ToString("MM/dd/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            txtReleaseTime.Text = Event.ReleaseDate.ToString("HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo);

            txtDisableDate.Text = Event.EndTime.ToString("MM/dd/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            txtDisableTime.Text = Event.EndTime.ToString("HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo);


            //角色
            DotNetNuke.Security.Roles.RoleController rc = new DotNetNuke.Security.Roles.RoleController();
            WebHelper.BindList(cblPermissionsRoles, rc.GetPortalRoles(PortalId), "RoleName", "RoleName");
            WebHelper.SelectedListMultiByValue(cblPermissionsRoles, Event.Per_Roles);
            cbPermissionsAllUsers.Checked = Event.Per_AllUsers == 0;



            //区域
            cbAllJurisdictions.Checked = Event.Per_AllJurisdictions == 0;
            WebHelper.BindList(cblJurisdictions, Playngo_ClientZone_Jurisdiction.GetAllCheckList(ModuleId), "Name", "ID");
            WebHelper.SelectedListMultiByValue(cblJurisdictions, Event.Per_Jurisdictions);

            //Game Categorys
            WebHelper.BindList(cblGameCategory, Playngo_ClientZone_GameCategory.GetAllCheckList(ModuleId), "Name", "ID");
            WebHelper.SelectedListMultiByValue(cblGameCategory, Event.GameCategories);

            //File Types
            WebHelper.BindList(cblFileType, Playngo_ClientZone_FileType.GetAllCheckList(ModuleId), "Name", "ID");
            WebHelper.SelectedListMultiByValue(cblFileType, Event.FileTypes);



            Event.CreateUser = Event.CreateUser == 0 ? UserId : Event.CreateUser;
            UserInfo CreateUserInfo = UserController.GetUserById(PortalId, Event.CreateUser);

            hfEventAuthor.Value     = Event.CreateUser.ToString();
            lbEventAuthor.Text      = CreateUserInfo != null && CreateUserInfo.UserID > 0 ? CreateUserInfo.DisplayName : "None";
            imgEventAuthor.ImageUrl = ViewUserPic(CreateUserInfo);

            WebHelper.SelectedListByValue(ddlEventStatus, Event.Status);//管理员看到的文章状态
        }
Example #20
0
        public void Execute(BasePage Context)
        {
            Dictionary <String, Object> jsonDatas = new Dictionary <string, Object>();

            JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
            TemplateFormat       xf           = new TemplateFormat(Context);


            QueryParam qp = new QueryParam();


            qp.Orderfld  = WebHelper.GetStringParam(Context.Request, "Orderfld", "ID");
            qp.OrderType = WebHelper.GetIntParam(Context.Request, "OrderType", 1);


            qp.PageIndex = WebHelper.GetIntParam(Context.Request, "PageIndex", 1);
            qp.PageSize  = WebHelper.GetIntParam(Context.Request, "PageSize", xf.ViewSettingT <Int32>("General.Downloads.Pagings", 10));


            //查询语句
            qp = CreateQueryParam(qp, Context);

            //权限筛选
            qp = CreateQueryByRoles(qp, Context);

            //区域筛选
            qp = CreateQueryByJurisdictions(qp, Context);

            //文件类型筛选
            qp = CreateQueryByFileTypes(qp, Context);

            //游戏分类筛选
            qp = CreateQueryByGameGategorys(qp, Context);



            int RecordCount = 0;
            List <Playngo_ClientZone_DownloadFile> fileList = Playngo_ClientZone_DownloadFile.FindAll(qp, out RecordCount);


            //配置值
            XmlFormat xmlFormat      = new XmlFormat(Context.Server.MapPath(String.Format("{0}Resource/xml/Config.Setting.Downloads.xml", Context.ModulePath)));
            var       XmlItemSetting = xmlFormat.ToList <SettingEntity>();


            List <Dictionary <String, Object> > DictFiles = new List <Dictionary <string, object> >();

            foreach (var fileItem in fileList)
            {
                int index = fileList.IndexOf(fileItem); //index 为索引值

                Dictionary <String, Object> jsonDict = new Dictionary <String, Object>();



                //循环输出所有的固定项
                foreach (var Field in Playngo_ClientZone_DownloadFile.Meta.Fields)
                {
                    jsonDict.Add(Field.ColumnName, fileItem[Field.ColumnName]);
                }


                if (XmlItemSetting != null && XmlItemSetting.Count > 0)
                {
                    var ItemSettings = ConvertTo.Deserialize <List <KeyValueEntity> >(fileItem.Options);
                    foreach (var ItemSetting in XmlItemSetting)
                    {
                        jsonDict = Common.UpdateDictionary(jsonDict, ItemSetting.Name, xf.ViewItemSetting(fileItem, ItemSetting.Name, ItemSetting.DefaultValue));
                    }
                }


                //下载地址
                String DownloadUrl = String.Format("{0}Resource_Service.aspx?ModuleId={1}&Token={2}&TabId={3}&PortalId={4}&language={5}&FileId={6}",
                                                   Context.ModulePath,
                                                   Context.Settings_ModuleID,
                                                   "DownloadFile",
                                                   Context.Settings_TabID,
                                                   Context.PortalId,
                                                   Context.language,
                                                   fileItem.ID);
                jsonDict = Common.UpdateDictionary(jsonDict, "DownloadUrl", DownloadUrl);

                jsonDict = Common.UpdateDictionary(jsonDict, "ReleaseDateString", fileItem.ReleaseDate.ToShortDateString());

                //文件类型转换
                jsonDict = Common.UpdateDictionary(jsonDict, "FileTypesString", Playngo_ClientZone_FileType.ConvertFileTypes(fileItem.FileTypes));

                //订阅状态等
                Int32 NotifyStatus = (Int32)EnumNotificationStatus.None;
                if (fileItem.NotifyInclude == 1) //&& fileItem.StartTime >= xUserTime.LocalTime().AddDays(-xf.ViewSettingT<Int32>("General.ExpiryTimeNotification", 7)))
                {
                    NotifyStatus = fileItem.NotifyStatus;
                }


                jsonDict = Common.UpdateDictionary(jsonDict, "NotificationStatus", EnumHelper.GetEnumTextVal(NotifyStatus, typeof(EnumNotificationStatus)));
                jsonDict = Common.UpdateDictionary(jsonDict, "NotificationStatusClass", EnumHelper.GetEnumTextVal(NotifyStatus, typeof(EnumNotificationStatus)).ToLower());
                //未来日期出现Coming Soon
                jsonDict = Common.UpdateDictionary(jsonDict, "ComingSoonDisplay", fileItem.ReleaseDate > xUserTime.LocalTime());

                DictFiles.Add(jsonDict);
            }

            jsonDatas.Add("data", DictFiles);
            jsonDatas.Add("Pages", qp.Pages);
            jsonDatas.Add("RecordCount", RecordCount);

            //转换数据为json

            ResponseString = jsSerializer.Serialize(jsonDatas);
        }
        public void Execute(BasePage Context)
        {
            var FileList = new List <Playngo_ClientZone_DownloadFile>();


            //将文件列表取出
            String FileIds = WebHelper.GetStringParam(Context.Request, "FileIds", "");

            if (!String.IsNullOrEmpty(FileIds))
            {
                FileIds = FileIds.Trim(',');
                if (!String.IsNullOrEmpty(FileIds))
                {
                    FileList = Playngo_ClientZone_DownloadFile.FindAllByIds(FileIds);
                }
            }

            //待打包的文件路径
            var FilePathList = new List <String>();

            if (FileList != null && FileList.Count > 0)
            {
                //将文件的路径收集着
                foreach (var FileItem in FileList)
                {
                    if (FileItem != null && FileItem.ID > 0 && !String.IsNullOrEmpty(FileItem.Options))
                    {
                        if (Context.IsPreRoleView(FileItem.Per_AllUsers, FileItem.Per_Roles) && Context.IsPreJurisdictionView(FileItem.Per_AllJurisdictions, FileItem.Per_Jurisdictions))
                        {
                            var FileItemOptions = ConvertTo.Deserialize <List <KeyValueEntity> >(FileItem.Options);
                            if (FileItemOptions != null)
                            {
                                TemplateFormat xf         = new TemplateFormat(Context);
                                String         UploadFile = xf.GetFilePath(xf.ViewItemSettingT <String>(FileItem.Options, "UploadFile", ""), Context);
                                if (!String.IsNullOrEmpty(UploadFile))
                                {
                                    UploadFile = Context.Server.MapPath(UploadFile);
                                    if (File.Exists(UploadFile) && !FilePathList.Exists(r => r.ToLower() == UploadFile.ToLower()))
                                    {
                                        FilePathList.Add(UploadFile);
                                    }
                                }
                            }
                        }
                        else
                        {
                            //没有权限下载
                        }
                    }
                }


                if (FilePathList != null && FilePathList.Count > 0)
                {
                    //整理压缩包文件路径等信息
                    String   ZipPath = Context.Server.MapPath(String.Format("{0}ClientZone/temporary/download-{1}files-{2}.zip", Context.PortalSettings.HomeDirectory, FilePathList.Count, DateTime.Now.ToString("yyyyMMdd-Hms")));
                    FileInfo ZipFile = new FileInfo(ZipPath);
                    if (!ZipFile.Directory.Exists)
                    {
                        ZipFile.Directory.Create();
                    }
                    else
                    {
                        //清楚很多天前的文件
                        FileSystemUtils.ClearFiles(ZipFile.Directory, 1);
                    }

                    //创建压缩包
                    FileSystemUtils.CreateZipFiles(FilePathList, ZipPath);


                    //将压缩好的文件列表下载
                    FileSystemUtils.DownloadFile(ZipPath, Path.GetFileName(ZipPath));
                }
                else
                {
                    IsResponseWrite = true;
                    ResponseString  = "No files found.";
                }
            }
        }
Example #22
0
 public String FormatItemUrl(Playngo_ClientZone_DownloadFile DataItem)
 {
     return(String.Format("{0}{1}Resource_Service.aspx?Token=GoItemLinkUrl&PortalId={2}&TabId={3}&ModuleId={4}&ID={5}&Type={6}", PortalUrl, MailSetting.ModulePath, DataItem.PortalId, MailSetting.TabID, DataItem.ModuleId, DataItem.ID, (Int32)EnumDisplayModuleType.Downloads));
 }
Example #23
0
 public String FormatThumbnailUrl(Playngo_ClientZone_DownloadFile DataItem)
 {
     return(String.Format("{0}{1}Resource_Service.aspx?Token=Thumbnail&PortalId={2}&TabId={3}&ID={4}&width={5}&height={6}&mode={7}&language={8}", PortalUrl, MailSetting.ModulePath, DataItem.PortalId, MailSetting.TabID, DataItem.ID, 500, 500, "W", "en-US"));
 }
Example #24
0
        /// <summary>
        /// 创建邮件内容
        /// </summary>
        /// <param name="EmailTo"></param>
        /// <returns></returns>
        public EmailInfo CreateMailHtml(Playngo_ClientZone_DownloadFile DataItem, UserInfo UserItem)
        {
            //构造邮件信息
            EmailInfo emailItem = new EmailInfo();

            emailItem.Settings = Settings;
            emailItem.PushSettings();


            //事件作者
            UserInfo EventUser = UserController.GetUserById(DataItem.PortalId, DataItem.CreateUser);

            string Template_Subject = NetHelper.ReplaceNoCase(MailSetting.MailSubject, "[TITLE]", DataItem.Title);

            Template_Subject = NetHelper.ReplaceNoCase(Template_Subject, "[MAILSETTING_TIME]", MailSetting.MailTime.ToString());



            Template_Subject = NetHelper.ReplaceNoCase(Template_Subject, "[AUTHOR_MAIL]", EventUser.Email);
            Template_Subject = NetHelper.ReplaceNoCase(Template_Subject, "[AUTHOR_USERNAME]", EventUser.Username);
            Template_Subject = NetHelper.ReplaceNoCase(Template_Subject, "[AUTHOR_DISPLAYNAME]", EventUser.DisplayName);



            emailItem.Subject = Template_Subject;

            #region "构造邮件信息"

            String Template_Content = NetHelper.ReplaceNoCase(MailSetting.MailBody, "[TITLE]", DataItem.Title);
            //Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[CONTENTTEXT]", HttpUtility.HtmlDecode(DataItem.ContentText));
            Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[CREATETIME]", DataItem.CreateTime.ToString());
            Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[CREATEDATE]", DataItem.CreateTime.ToShortDateString());
            Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[MAILSETTING_TIME]", MailSetting.MailTime.ToString());
            Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[DATETIME_NOW]", xUserTime.LocalTime().ToString());


            //注册的信息丢进来
            Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[AUTHOR_MAIL]", EventUser.Email);
            Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[AUTHOR_USERNAME]", EventUser.Username);
            Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[AUTHOR_DISPLAYNAME]", EventUser.DisplayName);

            //订阅用户的信息丢进来
            Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[USER_MAIL]", UserItem.Email);
            Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[USER_USERNAME]", UserItem.Username);
            Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[USER_DISPLAYNAME]", UserItem.DisplayName);


            //图片替换
            if (Common.Contains(Template_Content, "[PICTURE]"))
            {
                Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[PICTURE]", FormatThumbnailUrl(DataItem));
            }


            //文章链接
            if (Common.Contains(Template_Content, "[LINK]"))
            {
                Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[LINK]", FormatItemUrl(DataItem));
            }

            if (Common.Contains(Template_Content, "[FILETYPES]"))
            {
                Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[FILETYPES]", Playngo_ClientZone_FileType.ConvertFileTypes(DataItem.FileTypes));
            }



            emailItem.Content = Template_Content;
            #endregion



            emailItem.MailTo = MailSetting.MailTo;
            if (MailSetting.MailTo.ToUpper() == "[AUTHOR_MAIL]")//用户邮件需要发送给用户
            {
                emailItem.MailTo = EventUser.Email;
            }
            else if (MailSetting.MailTo.ToUpper() == "[USER_MAIL]")//用户邮件需要发送给用户
            {
                emailItem.MailTo = UserItem.Email;
            }
            emailItem.MailCC = MailSetting.MailCC;

            return(emailItem);
        }