コード例 #1
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);
        }
コード例 #2
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));


            var RoleGroupList = RoleController.GetRoleGroups(Context.PortalId);
            var RoleGroups    = Common.Split <RoleGroupInfo>(RoleGroupList, 1, 999);

            String SearchText = WebHelper.GetStringParam(Context.Request, "search", "");

            if (!String.IsNullOrEmpty(SearchText))
            {
                RoleGroups = RoleGroups.FindAll(r => r.RoleGroupName.IndexOf(SearchText, StringComparison.CurrentCultureIgnoreCase) >= 0);
            }

            RoleGroups = Common.Split <RoleGroupInfo>(RoleGroups, qp.PageIndex, qp.PageSize);



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


            JavaScriptSerializer jsSerializer = new JavaScriptSerializer();

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

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

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

                jsonDict.Add("id", RoleGroupItem.RoleGroupID);
                jsonDict.Add("text", RoleGroupItem.RoleGroupName);

                jsonDict.Add("roles", Playngo_ClientZone_RoleGroup.FindRolesByGroup(Context.PortalId, RoleGroupItem.RoleGroupID));
                DictItems.Add(jsonDict);
            }

            jsonPictures.Add("Items", DictItems);
            jsonPictures.Add("Pages", qp.Pages);
            jsonPictures.Add("RecordCount", RoleGroupList.Count);

            //转换数据为json
            ResponseString = jsSerializer.Serialize(jsonPictures);
        }
コード例 #3
0
        public void Execute(BasePage Context)
        {
            Int32 RecordCount = 0;
            Dictionary <String, Object>         jsonData     = new Dictionary <string, Object>();
            List <Dictionary <String, Object> > DictDataList = new List <Dictionary <string, object> >();
            JavaScriptSerializer jsSerializer = new JavaScriptSerializer();

            TemplateFormat xf = new TemplateFormat(Context);


            //创建数据查询类
            var dal = DAL.Create(Playngo_ClientZone_Event.Meta.ConnName);

            System.Text.StringBuilder SQLQuery = new System.Text.StringBuilder();


            var StrIncludedSections = xf.ViewSettingT <String>("Roadmap_IncludedSections", "0,2,3");

            if (!String.IsNullOrEmpty(StrIncludedSections))
            {
                var IncludedSections = Common.GetList(StrIncludedSections);

                if (IncludedSections != null && IncludedSections.Count > 0)
                {
                    //开始拼接联合查询的SQL

                    if (IncludedSections.Exists(r => r == ((Int32)EnumIncludedSections.Events).ToString()))
                    {
                        SQLQuery.Append(SqlQueryTable("Events", Playngo_ClientZone_Event.Meta.TableName, false, Context));
                    }


                    if (IncludedSections.Exists(r => r == ((Int32)EnumIncludedSections.Downloads).ToString()))
                    {
                        if (SQLQuery.Length > 0)
                        {
                            SQLQuery.Append(" UNION ");
                        }

                        SQLQuery.Append(SqlQueryTable("Downloads", Playngo_ClientZone_DownloadFile.Meta.TableName, true, Context));
                    }


                    if (IncludedSections.Exists(r => r == ((Int32)EnumIncludedSections.Campaigns).ToString()))
                    {
                        if (SQLQuery.Length > 0)
                        {
                            SQLQuery.Append(" UNION ");
                        }

                        SQLQuery.Append(SqlQueryTable("Campaigns", Playngo_ClientZone_Campaign.Meta.TableName, true, Context));
                    }


                    if (IncludedSections.Exists(r => r == ((Int32)EnumIncludedSections.GameSheets).ToString()))
                    {
                        if (SQLQuery.Length > 0)
                        {
                            SQLQuery.Append(" UNION ");
                        }

                        SQLQuery.Append(SqlQueryTable("GameSheets", Playngo_ClientZone_GameSheet.Meta.TableName, true, Context));
                    }

                    SQLQuery.Append(" ORDER BY ReleaseDate ASC ");


                    //将拼接的SQL获取数据集
                    String SQLString = SQLQuery.ToString();
                    var    DataSets  = dal.Select(dal.PageSplit(SQLString, 0, xf.ViewSettingT <Int32>("General.ProductRoadmap.Pagings", 10), "ID"), "ProductRoadmap");
                    RecordCount = dal.SelectCount(SQLString, "ProductRoadmap");
                    //开始解析数据集
                    if (DataSets != null && DataSets.Tables != null && DataSets.Tables.Count > 0 && DataSets.Tables[0].Rows != null)
                    {
                        var Rows    = DataSets.Tables[0].Rows;
                        var Columns = DataSets.Tables[0].Columns;
                        if (Rows.Count > 0)
                        {
                            foreach (DataRow Row in Rows)
                            {
                                Dictionary <String, Object> DictDataItem = new Dictionary <string, object>();


                                Int32 ItemId = 0;
                                if (Int32.TryParse(Row["ID"].ToString(), out ItemId))
                                {
                                    var TableName = Convert.ToString(Row["TableName"]);
                                    DictDataItem.Add("TableName", TableName);
                                    //调用不同的数据读取程序
                                    if (TableName == "Events")
                                    {
                                        DictDataItem = GetDictDataItemsByEvents(DictDataItem, ItemId, Context);
                                    }
                                    else if (TableName == "Downloads")
                                    {
                                        DictDataItem = GetDictDataItemsByDownloadFiles(DictDataItem, ItemId, Context);
                                    }
                                    else if (TableName == "Campaigns")
                                    {
                                        DictDataItem = GetDictDataItemsByCampaigns(DictDataItem, ItemId, Context);
                                    }
                                    else if (TableName == "GameSheets")
                                    {
                                        DictDataItem = GetDictDataItemsByGameSheets(DictDataItem, ItemId, Context);
                                    }
                                }

                                DictDataList.Add(DictDataItem);
                            }
                        }
                    }
                }
            }



            jsonData.Add("RecordCount", RecordCount);
            jsonData.Add("DataCount", DictDataList.Count);
            jsonData.Add("data", DictDataList);



            //转换数据为json
            ResponseString = jsSerializer.Serialize(jsonData);
        }
コード例 #4
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;

            var    UserList   = new List <UserInfo>();
            String SearchText = WebHelper.GetStringParam(Context.Request, "search", "");

            if (!String.IsNullOrEmpty(SearchText))
            {
                //UserList = UserController.Instance.GetUsersAdvancedSearch(Context.PortalId, 0, -1, -1, -1, false, 0, 10, "USERID", false, "Username,DisplayName", "%" + SearchText  ).ToList<UserInfo>();
                UserList = Common.Split <UserInfo>(UserController.GetUsersByUserName(Context.PortalId, "%" + SearchText + "%", 0, 10, ref RecordCount, false, false), 1, 100); //  "USERID", false, "Username", ).ToList<UserInfo>();
            }
            else
            {
                UserList = Common.Split <UserInfo>(UserController.GetUsers(Context.PortalId, 0, 10, ref RecordCount), 1, 100);   //.GetUsersBasicSearch(Context.PortalId, 1, 10, "USERID", false, "", "").ToList<UserInfo>();
            }



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


            JavaScriptSerializer jsSerializer = new JavaScriptSerializer();

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

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

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

                jsonDict.Add("id", UserItem.UserID);
                jsonDict.Add("text", String.Format("{0} - {1}", UserItem.Username, UserItem.DisplayName));
                jsonDict.Add("roles", Common.GetStringByList(UserItem.Roles));
                DictItems.Add(jsonDict);
            }

            jsonPictures.Add("Items", DictItems);
            jsonPictures.Add("Pages", qp.Pages);
            jsonPictures.Add("RecordCount", RecordCount);

            //转换数据为json
            ResponseString = jsSerializer.Serialize(jsonPictures);
        }
コード例 #5
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);
        }
コード例 #6
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);
        }