Пример #1
0
        /// <summary>
        /// GameSheets
        /// 将事件实体查询出来并填充到数据中
        /// </summary>
        /// <param name="DictDataItem"></param>
        /// <param name="ItemId"></param>
        /// <returns></returns>
        public Dictionary <String, Object> GetDictDataItemsByGameSheets(Dictionary <String, Object> DictDataItem, Int32 ItemId, BasePage Context)
        {
            var DataItem = Playngo_ClientZone_GameSheet.FindByKeyForEdit(ItemId);

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

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

                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);
        }
Пример #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);
        }
Пример #3
0
        public void Execute(BasePage Context)
        {
            Dictionary <String, Object> jsonDicts    = new Dictionary <String, Object>();
            JavaScriptSerializer        jsSerializer = new JavaScriptSerializer();

            Common.UpdateDictionary(jsonDicts, "Message", "");
            Common.UpdateDictionary(jsonDicts, "Result", "false");

            Int32 DownloadID = WebHelper.GetIntParam(Context.Request, "DownloadID", 0);
            Int32 ItemID     = WebHelper.GetIntParam(Context.Request, "ItemID", 0);

            if (DownloadID > 0 && ItemID > 0)
            {
                var DownloadRelation = new Playngo_ClientZone_DownloadRelation();


                Int32 PageType = WebHelper.GetIntParam(Context.Request, "PageType", 0);

                Int32      RecordCount = 0;
                QueryParam qp          = new QueryParam();
                qp.Where.Add(new SearchParam(Playngo_ClientZone_DownloadRelation._.DownloadID, DownloadID, SearchType.Equal));
                qp.Where.Add(new SearchParam(Playngo_ClientZone_DownloadRelation._.PageType, PageType, SearchType.Equal));
                qp.Where.Add(new SearchParam(Playngo_ClientZone_DownloadRelation._.ItemID, ItemID, SearchType.Equal));

                if (Playngo_ClientZone_DownloadRelation.FindCount(qp) == 0)
                {
                    DownloadRelation.PageType   = PageType;
                    DownloadRelation.DownloadID = DownloadID;
                    DownloadRelation.ItemID     = ItemID;

                    DownloadRelation.Sort = Playngo_ClientZone_DownloadRelation.FindMaxSrot(DownloadID, PageType) + 1;

                    DownloadRelation.ModuleId   = Context.ModuleId;
                    DownloadRelation.PortalId   = Context.PortalId;
                    DownloadRelation.CreateTime = xUserTime.LocalTime();
                    DownloadRelation.CreateUser = Context.UserId;
                    DownloadRelation.ID         = DownloadRelation.Insert();

                    if (DownloadRelation.ID > 0)
                    {
                        foreach (var Field in Playngo_ClientZone_DownloadRelation.Meta.Fields)
                        {
                            jsonDicts.Add(Field.ColumnName, DownloadRelation[Field.ColumnName]);
                        }

                        Common.UpdateDictionary(jsonDicts, "PageTypeText", EnumHelper.GetEnumTextVal(DownloadRelation.PageType, typeof(EnumDisplayModuleType)));
                        Common.UpdateDictionary(jsonDicts, "Title", WebHelper.GetStringParam(Context.Request, "Title", ""));

                        Common.UpdateDictionary(jsonDicts, "Result", "true");
                    }
                    else
                    {
                        Common.UpdateDictionary(jsonDicts, "Message", "添加数据不成功");
                    }
                }
                else
                {
                    //DownloadRelation = Playngo_ClientZone_DownloadRelation.FindItem(qp, out RecordCount);

                    Common.UpdateDictionary(jsonDicts, "Message", "数据已经存在忽略");
                }
            }
            else
            {
                //出入的ID数据不对
                Common.UpdateDictionary(jsonDicts, "Message", "出入的ID数据不对");
            }
            //转换数据为json
            ResponseString = jsSerializer.Serialize(jsonDicts);
        }
Пример #4
0
        public void Execute(BasePage Context)
        {
            JavaScriptSerializer        jsSerializer = new JavaScriptSerializer();
            Dictionary <String, Object> jsonPictures = new Dictionary <string, Object>();


            TemplateFormat xf = new TemplateFormat();
            QueryParam     qp = new QueryParam();


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

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

            if (Sort == (Int32)EnumSortQueryByGame.GameName_DESC)
            {
                qp.Orderfld  = Playngo_ClientZone_GameSheet._.Title;
                qp.OrderType = 1;
            }
            else if (Sort == (Int32)EnumSortQueryByGame.GameName_ASC)
            {
                qp.Orderfld  = Playngo_ClientZone_GameSheet._.Title;
                qp.OrderType = 0;
            }
            else if (Sort == (Int32)EnumSortQueryByGame.GameID_DESC)
            {
                qp.Orderfld  = Playngo_ClientZone_GameSheet._.GameID;
                qp.OrderType = 1;
            }
            else if (Sort == (Int32)EnumSortQueryByGame.GameID_ASC)
            {
                qp.Orderfld  = Playngo_ClientZone_GameSheet._.GameID;
                qp.OrderType = 0;
            }
            else if (Sort == (Int32)EnumSortQueryByGame.ReleaseDate_DESC)
            {
                qp.Orderfld  = Playngo_ClientZone_GameSheet._.ReleaseDate;
                qp.OrderType = 1;
            }
            else if (Sort == (Int32)EnumSortQueryByGame.ReleaseDate_ASC)
            {
                qp.Orderfld  = Playngo_ClientZone_GameSheet._.ReleaseDate;
                qp.OrderType = 0;
            }
            else
            {
                qp.Orderfld  = Playngo_ClientZone_GameSheet._.ID;
                qp.OrderType = 1;
            }


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

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

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

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



            int RecordCount = 0;
            List <Playngo_ClientZone_GameSheet> GameSheetList = Playngo_ClientZone_GameSheet.FindAll(qp, out RecordCount);


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


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

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

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



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


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


                jsonDict = Common.UpdateDictionary(jsonDict, "ReleaseDateString", GameSheetItem.ReleaseDate.ToShortDateString());
                jsonDict = Common.UpdateDictionary(jsonDict, "Image", xf.ViewLinkUrl(xf.ViewItemSettingT <string>(GameSheetItem, "Image", ""), "", Context));

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


                Int32 NotifyStatus = (Int32)EnumNotificationStatus.None;
                if (GameSheetItem.NotifyInclude == 1) //&& GameSheetItem.StartTime >= xUserTime.LocalTime().AddDays(-xf.ViewSettingT<Int32>("General.ExpiryTimeNotification", 7)))
                {
                    NotifyStatus = GameSheetItem.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);
        }
Пример #5
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);
        }
Пример #6
0
        public void Execute(BasePage Context)
        {
            Dictionary <String, Object> jsonDicts    = new Dictionary <String, Object>();
            JavaScriptSerializer        jsSerializer = new JavaScriptSerializer();

            Common.UpdateDictionary(jsonDicts, "Message", "");

            Boolean Result       = false;
            int     UpdateResult = 0;
            var     json         = WebHelper.GetStringParam(Context.Request, "json", "");
            var     UserItem     = Context.UserInfo;

            if (UserItem != null && UserItem.UserID > 0)
            {
                ProfilePropertyDefinitionCollection profileProperties = new ProfilePropertyDefinitionCollection();

                var FirstName = WebHelper.GetStringParam(Context.Request, "FirstName", "");
                if (!String.IsNullOrEmpty(FirstName) && FirstName != UserItem.Profile.FirstName)
                {
                    UserItem.FirstName = FirstName;
                    UpdateResult++;
                }


                var LastName = WebHelper.GetStringParam(Context.Request, "LastName", "");
                if (!String.IsNullOrEmpty(LastName) && LastName != UserItem.Profile.LastName)
                {
                    UserItem.LastName = LastName;
                    UpdateResult++;
                }

                var Company = WebHelper.GetStringParam(Context.Request, "Company", "");
                if (!String.IsNullOrEmpty(Company) && Company != UserItem.Profile.GetPropertyValue("Company"))
                {
                    //DotNetNuke.Entities.Profile.ProfileController.UpdateUserProfile()
                    //UserItem.Profile["Company"] = Company;
                    UserItem.Profile.SetProfileProperty("Company", Company);
                    UpdateResult++;
                }


                var Newsletter_GameSheets = WebHelper.GetStringParam(Context.Request, "Newsletter_GameSheets", "");
                if (Newsletter_GameSheets != UserItem.Profile.GetPropertyValue("Newsletter_GameSheets").ToLower())
                {
                    UserItem.Profile.SetProfileProperty("Newsletter_GameSheets", ConvertBool(Newsletter_GameSheets));
                    UpdateResult++;
                }


                var Newsletter_Downloads = WebHelper.GetStringParam(Context.Request, "Newsletter_Downloads", "");
                if (Newsletter_Downloads != UserItem.Profile.GetPropertyValue("Newsletter_Downloads").ToLower())
                {
                    UserItem.Profile.SetProfileProperty("Newsletter_Downloads", ConvertBool(Newsletter_Downloads));
                    UpdateResult++;
                }



                var Newsletter_Campaigns = WebHelper.GetStringParam(Context.Request, "Newsletter_Campaigns", "");
                if (Newsletter_Campaigns != UserItem.Profile.GetPropertyValue("Newsletter_Campaigns").ToLower())
                {
                    UserItem.Profile.SetProfileProperty("Newsletter_Campaigns", ConvertBool(Newsletter_Campaigns));
                    UpdateResult++;
                }



                var Newsletter_Events = WebHelper.GetStringParam(Context.Request, "Newsletter_Events", "");
                if (Newsletter_Events != UserItem.Profile.GetPropertyValue("Newsletter_Events").ToLower())
                {
                    UserItem.Profile.SetProfileProperty("Newsletter_Events", ConvertBool(Newsletter_Events));
                    UpdateResult++;
                }


                if (UpdateResult > 0)
                {
                    DataCache.ClearPortalCache(Context.PortalId, true);
                    DataCache.ClearCache();


                    UserController.UpdateUser(Context.PortalId, UserItem);

                    ProfileController.UpdateUserProfile(UserItem);

                    Common.UpdateDictionary(jsonDicts, "Message", "Update user account success!");
                    Result = true;
                }
                else
                {
                    Result = false;
                    Common.UpdateDictionary(jsonDicts, "Message", "User Profile no change.");
                }


                var Password = WebHelper.GetStringParam(Context.Request, "Password", "");
                if (!String.IsNullOrEmpty(Password))
                {
                    if (UserController.ValidatePassword(Password))
                    {
                        string resetPassword = UserController.ResetPassword(UserItem, String.Empty);

                        if (UserController.ChangePassword(UserItem, resetPassword, Password))
                        {
                            //DataCache.ClearPortalCache(UserItem.PortalID, false);
                            //DataCache.ClearUserCache(UserItem.PortalID, UserItem.Username);
                            Common.UpdateDictionary(jsonDicts, "Message", "Update user account success!");
                            Result = true;
                        }
                        else
                        {
                            Common.UpdateDictionary(jsonDicts, "Message", Localization.GetString("PasswordResetFailed"));
                            Result = false;
                        }
                    }
                    else
                    {
                        Common.UpdateDictionary(jsonDicts, "Message", Localization.GetString("PasswordInvalid"));
                        Result = false;
                    }
                }
            }



            jsonDicts.Add("UserItem", UserItem);
            jsonDicts.Add("UpdateResult", UpdateResult);
            jsonDicts.Add("Result", Result);


            //转换数据为json
            ResponseString = jsSerializer.Serialize(jsonDicts);
        }