예제 #1
0
        /// <summary>
        /// Events
        /// 将事件实体查询出来并填充到数据中
        /// </summary>
        /// <param name="DictDataItem"></param>
        /// <param name="ItemId"></param>
        /// <returns></returns>
        public Dictionary <String, Object> GetDictDataItemsByEvents(Dictionary <String, Object> DictDataItem, Int32 ItemId, BasePage Context)
        {
            var DataItem = Playngo_ClientZone_Event.FindByKeyForEdit(ItemId);

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

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


                TemplateFormat xf = new TemplateFormat(Context);

                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", xf.GoUrl(DataItem));
                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);
        }
        /// <summary>
        /// 保存草稿
        /// </summary>
        protected void cmdSaveDraft_Click(object sender, EventArgs e)
        {
            try
            {
                Int32 EventStatus = (Int32)EnumStatus.Draft;
                Playngo_ClientZone_Event Event = new Playngo_ClientZone_Event();
                Boolean SaveResult             = SaveDataItem(EventStatus, out Event);



                if (SaveResult)
                {
                    mTips.LoadMessage("SaveSuccess", EnumTips.Success, this, new String[] { Event.Title });
                    Response.Redirect(xUrl("ID", Event.ID.ToString(), "Events-Edit"), false);
                }
                else
                {
                    mTips.IsPostBack = false;
                    mTips.LoadMessage("SaveError", EnumTips.Success, this, new String[] { Event.Title });
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
        public void RowDataBoundByEvents(GridViewRowEventArgs e)
        {
            //还原出数据
            Playngo_ClientZone_Event DataItem = e.Row.DataItem as Playngo_ClientZone_Event;

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


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

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

                //发布者信息
                e.Row.Cells[2].Text = "--";
                if (DataItem.LastUser > 0)
                {
                    UserInfo uInfo = UserController.GetUserById(PortalId, DataItem.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 = DataItem.CreateTime.ToShortDateString();

                //状态
                e.Row.Cells[4].Text = EnumHelper.GetEnumTextVal(DataItem.Status, typeof(EnumStatus));
            }
        }
        /// <summary>
        /// 获取文档关联下载文件
        /// </summary>
        /// <param name="DataItem"></param>
        /// <returns></returns>
        public List <Playngo_ClientZone_DownloadFile> GetDownloadFiles(Playngo_ClientZone_Event DataItem)
        {
            var DownLoadFiles = new List <Playngo_ClientZone_DownloadFile>();

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


                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);
        }
예제 #5
0
        /// <summary>
        /// 发送邮件(多篇文章)-订阅列表中的角色+邮箱
        /// </summary>
        /// <param name="Articles"></param>
        /// <returns></returns>
        public Int32 SendMail(Playngo_ClientZone_Event DataEvent)
        {
            Int32 RecordCount = 0;

            Int32 UserRecordCount = 0;
            var   UserList        = Common.Split <UserInfo>(UserController.GetUsersByProfileProperty(DataEvent.PortalId, "Newsletter_Events", "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(DataEvent.Per_AllUsers, DataEvent.Per_Roles, UserItem))
                        {
                            //验证用户区域
                            if (ValidUserJurisdictions(DataEvent.Per_AllJurisdictions, DataEvent.Per_Jurisdictions, UserItem))
                            {
                                //创建邮件
                                EmailInfo email = CreateMailHtml(DataEvent, UserItem);
                                //推送邮件
                                MailScheduler.AssignMessage(email);

                                RecordCount++;
                            }
                        }
                    }
                }
            }


            return(RecordCount);
        }
        /// <summary>
        /// 文章软删除(删除到回收站)
        /// </summary>
        protected void cmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                Playngo_ClientZone_Event Event = Playngo_ClientZone_Event.FindByKeyForEdit(EventID);
                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("Events"), false);
                }
                else
                {
                    mTips.IsPostBack = false;
                    //操作失败
                    mTips.LoadMessage("DeleteEventError", EnumTips.Success, this, new String[] { Event.Title });
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
예제 #7
0
        /// <summary>
        /// 获取表格
        /// </summary>
        /// <param name="EventItem"></param>
        /// <param name="dt"></param>
        /// <param name="Context"></param>
        /// <returns></returns>
        public DataTable GetDataTable(Playngo_ClientZone_Event EventItem, DataTable dt, BasePage Context)
        {
            //添加表字段
            dt.Columns.Add("UserID");
            dt.Columns.Add("Username");
            dt.Columns.Add("FirstName");
            dt.Columns.Add("LastName");

            var UserList = ConvertUserList(EventItem);

            if (UserList != null && UserList.Count > 0)
            {
                foreach (var UserItem in UserList)
                {
                    DataRow dr = dt.NewRow();

                    dr["UserID"]    = UserItem.UserID;
                    dr["Username"]  = UserItem.Username;
                    dr["FirstName"] = UserItem.FirstName;
                    dr["LastName"]  = UserItem.LastName;

                    dt.Rows.Add(dr);
                }
            }

            return(dt);
        }
        /// <summary>
        /// 更新文章
        /// </summary>
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                // 设置方案项
                Playngo_ClientZone_Event Event = new Playngo_ClientZone_Event();
                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("Events")))) ,false);
                    Response.Redirect(xUrl("ID", Event.ID.ToString(), "Events-Edit"), false);
                }
                else
                {
                    mTips.IsPostBack = false;
                    mTips.LoadMessage("SaveError", EnumTips.Warning, this, new String[] { Event.Title });
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
        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_Event> EventList = Playngo_ClientZone_Event.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);
        }
        /// <summary>
        /// 列表行绑定
        /// </summary>
        protected void gvEventList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //还原出数据
                Playngo_ClientZone_Event Event = e.Row.DataItem as Playngo_ClientZone_Event;

                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(), "Events-Edit");



                    HLEventTitle.Text        = Event.Title;
                    HLEventTitle.NavigateUrl = CommonFriendlyUrls.FriendlyUrl(Event, ViewSettingT <Int32>("ClientZone_DisplayTab_Events", TabId), true, this);

                    //获取用户名称
                    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.DisplayName : "";
                    //文章状态
                    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();
                }
            }
        }
예제 #11
0
        public void Execute(BasePage Context)
        {
            Int32 EventId = WebHelper.GetIntParam(Context.Request, "EventId", 0);

            if (EventId > 0)
            {
                var EventItem = Playngo_ClientZone_Event.FindByKeyForEdit(EventId);
                if (EventItem != null && EventItem.ID > 0)
                {
                    //拼凑文件名
                    String FileName = String.Format("Users_{0}_{1}.{2}", Context.ModuleId, DateTime.Now.ToString("yyyyMMddHHmmssffff"), "csv");
                    //文件路径
                    String FilePath = Context.Server.MapPath(String.Format("{0}ClientZone/Export/{1}", Context.PortalSettings.HomeDirectory, FileName));
                    //文件实体
                    var fileInfo = new FileInfo(FilePath);

                    //文件路径是否需要创建
                    if (!fileInfo.Directory.Exists)
                    {
                        fileInfo.Directory.Create();
                    }


                    //创建导出类实体
                    ExportDotNet excel = new ExportDotNet();
                    //导出标题(Excel之类的才有)
                    excel.Title          = String.Format("User list of events {0}", EventItem.Title);
                    excel.ExportFileName = FilePath;


                    DataTable dt = new DataTable(excel.Title);
                    //获取表格数据
                    dt = GetDataTable(EventItem, dt, Context);
                    //导出表格数据到CSV
                    Boolean flag = excel.ExportToCSV(dt);

                    if (flag)
                    {
                        //下载文件
                        FileSystemUtils.DownloadFile(excel.ExportFileName, FileName);
                    }
                }
                else
                {
                    ResponseString = "没找到数据怎么搞";
                }
            }
            else
            {
                ResponseString = "传过来的文件编号都不对";
            }
        }
예제 #12
0
        /// <summary>
        /// 绑定动态模块到页面
        /// </summary>
        private void BindRelationPages()
        {
            if (DownloadID > 0)
            {
                divRelationPages.Visible = true;
                hlSelectRelationPages.Attributes.Add("data-href", String.Format("{0}Resource_Masters.aspx?PortalId={1}&TabId={2}&ModuleId={3}&language={4}&Master=Manager_Modal_RelationPages", ModulePath, PortalId, TabId, ModuleId, language));
            }



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


            QueryParam qp = new QueryParam();

            qp.OrderType = 0;
            qp.Orderfld  = " PageType ASC,Sort ";
            Int32 RecordCount = 0;

            qp.Where.Add(new SearchParam(Playngo_ClientZone_DownloadRelation._.DownloadID, DownloadID, SearchType.Equal));

            var Relations = Playngo_ClientZone_DownloadRelation.FindAll(qp, out RecordCount);


            if (Relations != null && Relations.Count > 0)
            {
                foreach (var Relation in Relations)
                {
                    if (Relation.PageType == (Int32)EnumDisplayModuleType.Campaigns)
                    {
                        var Item = Playngo_ClientZone_Campaign.FindByKeyForEdit(Relation.ItemID);
                        Items.Add(new { ID = Relation.ID, Sort = Relation.ID, ItemID = Item.ID, Title = Item.Title, PageType = (Int32)EnumDisplayModuleType.Campaigns, PageTypeText = "Campaigns" });
                    }
                    else if (Relation.PageType == (Int32)EnumDisplayModuleType.Events)
                    {
                        var Item = Playngo_ClientZone_Event.FindByKeyForEdit(Relation.ItemID);
                        Items.Add(new { ID = Relation.ID, ItemID = Item.ID, Title = Item.Title, PageType = (Int32)EnumDisplayModuleType.Events, PageTypeText = "Events" });
                    }
                    else
                    {
                        var Item = Playngo_ClientZone_GameSheet.FindByKeyForEdit(Relation.ItemID);
                        Items.Add(new { ID = Relation.ID, ItemID = Item.ID, Title = Item.Title, PageType = (Int32)EnumDisplayModuleType.GameSheets, PageTypeText = "Game Sheets" });
                    }
                }
            }


            //绑定参数项
            RepeaterRelationPages.DataSource = Items;
            RepeaterRelationPages.DataBind();
        }
        /// <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_Event Event = Playngo_ClientZone_Event.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);
            }
        }
예제 #14
0
        /// <summary>
        /// 初始化的方法
        /// </summary>
        public void Init()
        {
            if (!ClientZone_Init)
            {
                QueryParam qp = new QueryParam();
                qp.Where.Add(new SearchParam(Playngo_ClientZone_Event._.ModuleId, Bpm.ModuleId, SearchType.Equal));
                if (Playngo_ClientZone_Event.FindCount(qp) == 0)//文章数为0的情况下,才增加默认的文章和分类
                {
                    //初始化分类和文章
                    //Int32 EventID = Playngo_ClientZone_Event.Initialization(Bpm);
                }

                Bpm.UpdateModuleSetting("ClientZone_Init", "true");
            }
        }
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void BindDataList()
        {
            QueryParam qp = new QueryParam();

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

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


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


            #endregion

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

            List <Playngo_ClientZone_Event> Events = Playngo_ClientZone_Event.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_Event.FindCountByStatus(ModuleId, -1, is_admin, UserId), ViewResourceText("hlAllEvent", "All"));
            hlPublishedEvent.Text  = String.Format("{1} ({0})", Playngo_ClientZone_Event.FindCountByStatus(ModuleId, (Int32)EnumStatus.Published, is_admin, UserId), ViewResourceText("hlPublishedEvent", "Published"));
            hlPendingEvent.Text    = String.Format("{1} ({0})", Playngo_ClientZone_Event.FindCountByStatus(ModuleId, (Int32)EnumStatus.Pending, is_admin, UserId), ViewResourceText("hlPendingEvent", "Pending"));
            hlDraftsEvent.Text     = String.Format("{1} ({0})", Playngo_ClientZone_Event.FindCountByStatus(ModuleId, (Int32)EnumStatus.Draft, is_admin, UserId), ViewResourceText("hlDraftsEvent", "Drafts"));
            hlRecycleBinEvent.Text = String.Format("{1} ({0})", Playngo_ClientZone_Event.FindCountByStatus(ModuleId, (Int32)EnumStatus.Recycle, is_admin, UserId), ViewResourceText("hlRecycleBinEvent", "Recycle Bin"));



            gvEventList.DataSource = Events;
            gvEventList.DataBind();
            BindGridViewEmpty <Playngo_ClientZone_Event>(gvEventList, new Playngo_ClientZone_Event());
        }
        /// <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_Event Event = Playngo_ClientZone_Event.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);
            }
        }
예제 #17
0
        /// <summary>
        /// 获取转换事件相关的用户列表
        /// </summary>
        /// <param name="EventItem"></param>
        /// <returns></returns>
        public List <UserInfo> ConvertUserList(Playngo_ClientZone_Event EventItem)
        {
            var UserDataList = new List <UserInfo>();
            var UserList     = new List <UserInfo>();


            if (EventItem.Per_AllUsers == 0)
            {
                UserDataList = Common.Split <UserInfo>(UserController.GetUsers(EventItem.PortalId), 1, Int32.MaxValue);
            }
            else if (!String.IsNullOrEmpty(EventItem.Per_Roles))
            {
                var RoleNames = Common.GetList(EventItem.Per_Roles);
                if (RoleNames != null && RoleNames.Count > 0)
                {
                    foreach (var RoleName in RoleNames)
                    {
                        if (!String.IsNullOrEmpty(RoleName))
                        {
                            UserDataList = DotNetNuke.Security.Roles.RoleController.Instance.GetUsersByRole(EventItem.PortalId, RoleName).ToList();
                        }
                    }
                }
            }



            if (UserDataList != null && UserDataList.Count > 0)
            {
                foreach (var tempUser in UserDataList)
                {
                    if (!UserList.Exists(r => r.UserID == tempUser.UserID))
                    {
                        if (IsPreJurisdictionView(tempUser, EventItem.Per_AllJurisdictions, EventItem.Per_Jurisdictions))
                        {
                            UserList.Add(tempUser);
                        }
                    }
                }
            }


            return(UserList);
        }
        /// <summary>
        /// 利用线程发送订阅邮件
        /// </summary>
        /// <param name="ObjectItem"></param>8
        public void ThreadCreateSendMail(Object ObjectItem)
        {
            var objs = (Dictionary <object, object>)ObjectItem;

            Playngo_ClientZone_Event DataItem = (Playngo_ClientZone_Event)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.Events");
                if (NotEmail.MailSetting != null && NotEmail.MailSetting.Status == 1)
                {
                    NotEmail.Settings = Settings;
                    NotEmail.Settings.Add("PortalUrl", objs["PortalUrl"]);
                    NotEmail.SendMail(DataItem);
                }
            }
        }
        public void Execute(BasePage Context)
        {
            Int32 ItemId = WebHelper.GetIntParam(Context.Request, "ID", 0);

            if (ItemId > 0)
            {
                Int32 ItemType = WebHelper.GetIntParam(Context.Request, "Type", (Int32)EnumDisplayModuleType.GameSheets);

                TemplateFormat xf = new TemplateFormat(Context);

                if (ItemType == (Int32)EnumDisplayModuleType.Events)
                {
                    var Item = Playngo_ClientZone_Event.FindByKeyForEdit(ItemId);
                    Context.Response.Redirect(xf.GoUrl(Item));
                }
                else if (ItemType == (Int32)EnumDisplayModuleType.Campaigns)
                {
                    var Item = Playngo_ClientZone_Campaign.FindByKeyForEdit(ItemId);
                    Context.Response.Redirect(xf.GoUrl(Item));
                }
                else if (ItemType == (Int32)EnumDisplayModuleType.Downloads)
                {
                    Context.Response.Redirect(xf.GoUiUrl("Downloads"));
                }
                else
                {
                    var Item = Playngo_ClientZone_GameSheet.FindByKeyForEdit(ItemId);
                    Context.Response.Redirect(xf.GoUrl(Item));
                }
            }
            else
            {
                IsResponseWrite = true;
                ResponseString  = "传过来的文件编号都不对";
            }
        }
        private void BindDataListByEvents()
        {
            QueryParam qp = new QueryParam();

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

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


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


            #endregion

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

            List <Playngo_ClientZone_Event> Events = Playngo_ClientZone_Event.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"));

            gvList.DataSource = Events;
            gvList.DataBind();
            BindGridViewEmpty <Playngo_ClientZone_Event>(gvList, new Playngo_ClientZone_Event());
        }
예제 #21
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);
        }
        /// <summary>
        /// 绑定数据项
        /// </summary>
        private void BindDataItem()
        {
            Playngo_ClientZone_Event Event = EventItem;
            TemplateFormat           xf    = new TemplateFormat(this);

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

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



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


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

            //导出CSV链接
            hlExportCSV.NavigateUrl = xf.GoDownloadCSVToEventUrl(Event);


            txtTitle.Text       = Common.RestoreEscape(Event.Title);
            txtContentText.Text = HttpUtility.HtmlDecode(Event.ContentText);


            txtAddress.Text   = Event.Address;
            txtLocationX.Text = Event.LocationX;
            txtLocationY.Text = Event.LocationY;



            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);



            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); //管理员看到的文章状态
        }
예제 #23
0
 public String FormatItemUrl(Playngo_ClientZone_Event 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.Events));
 }
예제 #24
0
 public String FormatThumbnailUrl(Playngo_ClientZone_Event 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"));
 }
예제 #25
0
        /// <summary>
        /// 创建邮件内容
        /// </summary>
        /// <param name="EmailTo"></param>
        /// <returns></returns>
        public EmailInfo CreateMailHtml(Playngo_ClientZone_Event 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));
            }

            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);
        }
        /// <summary>
        /// 保存文章
        /// </summary>
        /// <param name="EventStatus">文章状态(为-1的时候取选项的值)</param>
        private Boolean SaveDataItem(Int32 EventStatus, out Playngo_ClientZone_Event Event)
        {
            Boolean SaveResult = false;

            Event = EventItem;

            Event.Title       = Common.ReplaceEscape(txtTitle.Text);
            Event.ContentText = HttpUtility.HtmlEncode(txtContentText.Text);

            Event.Address   = txtAddress.Text;
            Event.LocationX = txtLocationX.Text;
            Event.LocationY = txtLocationY.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;

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

            #region "关于动态选项的代码"

            List <KeyValueEntity> list          = new List <KeyValueEntity>();
            List <SettingEntity>  ItemSettingDB = Event_ItemSettingDB;
            if (ItemSettingDB != null && ItemSettingDB.Count > 0)
            {
                ControlHelper ControlItem = new ControlHelper(ModuleId);

                foreach (SettingEntity ri in ItemSettingDB)
                {
                    KeyValueEntity item = new KeyValueEntity();
                    item.Key   = ri.Name;
                    item.Value = ControlHelper.GetWebFormValue(ri, this);
                    list.Add(item);
                }
            }


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

            //伪静态URL
            String FriendlyUrl = String.Empty;
            if (list.Exists(r => r.Key == "FriendlyUrl"))
            {
                KeyValueEntity TitleEntity = list.Find(r => r.Key == "FriendlyUrl");
                FriendlyUrl = TitleEntity.Value.ToString();

                if (String.IsNullOrEmpty(FriendlyUrl) && !String.IsNullOrEmpty(Event.Title))
                {
                    FriendlyUrl = Common.FriendlySlug(Event.Title);
                }

                Event.UrlSlug     = FriendlyUrl;
                TitleEntity.Value = FriendlyUrl;
                list[list.FindIndex(r => r.Key == "FriendlyUrl")] = TitleEntity;
            }
            Event.Options = ConvertTo.Serialize <List <KeyValueEntity> >(list);
            #endregion


            //更新项
            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_Event.Update(String.Format("SendMail={0}", 1), String.Format("ID={0}", Event.ID));
                }
            }
            else
            {
                SaveResult = false;
            }
            return(SaveResult);
        }
예제 #27
0
 public static String FriendlyUrl(Playngo_ClientZone_Event DataItem, Int32 TabId, Boolean Preview, BasePage page)
 {
     return(FriendlyUrl(DataItem.ID, DataItem.Title, DataItem.UrlSlug, TabId, Preview, page));
 }
 /// <summary>
 /// 是否到了发布日期
 /// </summary>
 /// <param name="DataItem"></param>
 /// <returns></returns>
 public Boolean IsPublishTime(Playngo_ClientZone_Event DataItem)
 {
     return(DataItem.StartTime <= xUserTime.LocalTime());
 }
        public void Execute(BasePage Context)
        {
            TemplateFormat xf = new TemplateFormat(Context);

            QueryParam qp = new QueryParam();

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

            //排序的规则
            Int32 Sort = WebHelper.GetIntParam(Context.Request, "Sort", 0);

            if (Sort == (Int32)EnumSortQueryByEvent.EventName_DESC)
            {
                qp.Orderfld  = Playngo_ClientZone_Event._.Title;
                qp.OrderType = 1;
            }
            else if (Sort == (Int32)EnumSortQueryByEvent.EventName_ASC)
            {
                qp.Orderfld  = Playngo_ClientZone_Event._.Title;
                qp.OrderType = 0;
            }
            else if (Sort == (Int32)EnumSortQueryByEvent.EventDate_DESC)
            {
                qp.Orderfld  = Playngo_ClientZone_Event._.ReleaseDate;
                qp.OrderType = 1;
            }
            else if (Sort == (Int32)EnumSortQueryByEvent.EventDate_ASC)
            {
                qp.Orderfld  = Playngo_ClientZone_Event._.ReleaseDate;
                qp.OrderType = 0;
            }
            else
            {
                qp.Orderfld  = Playngo_ClientZone_Event._.ID;
                qp.OrderType = 1;
            }

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

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

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



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

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


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

            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>();



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



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


                jsonDict = Common.UpdateDictionary(jsonDict, "ContentTextDecode", HttpUtility.HtmlDecode(EventItem.ContentText));
                jsonDict = Common.UpdateDictionary(jsonDict, "ReleaseDateString", EventItem.ReleaseDate.ToShortDateString());
                jsonDict = Common.UpdateDictionary(jsonDict, "Image", xf.ViewLinkUrl(xf.ViewItemSettingT <string>(EventItem, "Image", ""), "", Context));

                //未来日期出现Coming Soon
                jsonDict = Common.UpdateDictionary(jsonDict, "ComingSoonDisplay", EventItem.ReleaseDate > xUserTime.LocalTime());


                jsonDict = Common.UpdateDictionary(jsonDict, "Url", xf.GoUrl(EventItem));


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


                jsonDict = Common.UpdateDictionary(jsonDict, "NotificationStatus", EnumHelper.GetEnumTextVal(NotifyStatus, typeof(EnumNotificationStatus)));
                jsonDict = Common.UpdateDictionary(jsonDict, "NotificationStatusClass", EnumHelper.GetEnumTextVal(NotifyStatus, typeof(EnumNotificationStatus)).ToLower());


                DictFiles.Add(jsonDict);
            }

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

            //转换数据为json

            ResponseString = jsSerializer.Serialize(jsonPictures);
        }