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_Campaign> EventList = Playngo_ClientZone_Campaign.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> private void BindDataList() { QueryParam qp = new QueryParam(); qp.OrderType = OrderType; if (!String.IsNullOrEmpty(Orderfld)) { qp.Orderfld = Orderfld; } else { qp.Orderfld = Playngo_ClientZone_Campaign._.ID; } #region "分页的一系列代码" int RecordCount = 0; qp.PageSize = Settings_General_ManagerPerPage; qp.PageIndex = PageIndex; #endregion //查询的方法 qp.Where = BindSearch(); List <Playngo_ClientZone_Campaign> Events = Playngo_ClientZone_Campaign.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_Campaign.FindCountByStatus(ModuleId, -1, is_admin, UserId), ViewResourceText("hlAllEvent", "All")); hlPublishedEvent.Text = String.Format("{1} ({0})", Playngo_ClientZone_Campaign.FindCountByStatus(ModuleId, (Int32)EnumStatus.Published, is_admin, UserId), ViewResourceText("hlPublishedEvent", "Published")); hlPendingEvent.Text = String.Format("{1} ({0})", Playngo_ClientZone_Campaign.FindCountByStatus(ModuleId, (Int32)EnumStatus.Pending, is_admin, UserId), ViewResourceText("hlPendingEvent", "Pending")); hlDraftsEvent.Text = String.Format("{1} ({0})", Playngo_ClientZone_Campaign.FindCountByStatus(ModuleId, (Int32)EnumStatus.Draft, is_admin, UserId), ViewResourceText("hlDraftsEvent", "Drafts")); hlRecycleBinEvent.Text = String.Format("{1} ({0})", Playngo_ClientZone_Campaign.FindCountByStatus(ModuleId, (Int32)EnumStatus.Recycle, is_admin, UserId), ViewResourceText("hlRecycleBinEvent", "Recycle Bin")); gvEventList.DataSource = Events; gvEventList.DataBind(); BindGridViewEmpty <Playngo_ClientZone_Campaign>(gvEventList, new Playngo_ClientZone_Campaign()); }
private void BindDataListByCampaigns() { QueryParam qp = new QueryParam(); qp.OrderType = OrderType; if (!String.IsNullOrEmpty(Orderfld)) { qp.Orderfld = Orderfld; } else { qp.Orderfld = Playngo_ClientZone_Campaign._.ID; } #region "分页的一系列代码" int RecordCount = 0; int pagesize = qp.PageSize = 10; qp.PageIndex = PageIndex; #endregion //查询的方法 qp.Where = BindSearch(); List <Playngo_ClientZone_Campaign> Events = Playngo_ClientZone_Campaign.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_Campaign>(gvList, new Playngo_ClientZone_Campaign()); }
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.Campaigns.Pagings", 12)); //排序的规则 Int32 Sort = WebHelper.GetIntParam(Context.Request, "Sort", 0); if (Sort == (Int32)EnumSortQueryByGame.GameName_DESC) { qp.Orderfld = Playngo_ClientZone_Campaign._.Title; qp.OrderType = 1; } else if (Sort == (Int32)EnumSortQueryByGame.GameName_ASC) { qp.Orderfld = Playngo_ClientZone_Campaign._.Title; qp.OrderType = 0; } else if (Sort == (Int32)EnumSortQueryByGame.GameID_DESC) { qp.Orderfld = Playngo_ClientZone_Campaign._.GameID; qp.OrderType = 1; } else if (Sort == (Int32)EnumSortQueryByGame.GameID_ASC) { qp.Orderfld = Playngo_ClientZone_Campaign._.GameID; qp.OrderType = 0; } else if (Sort == (Int32)EnumSortQueryByGame.ReleaseDate_DESC) { qp.Orderfld = Playngo_ClientZone_Campaign._.ReleaseDate; qp.OrderType = 1; } else if (Sort == (Int32)EnumSortQueryByGame.ReleaseDate_ASC) { qp.Orderfld = Playngo_ClientZone_Campaign._.ReleaseDate; qp.OrderType = 0; } else { qp.Orderfld = Playngo_ClientZone_Campaign._.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_Campaign> CampaignList = Playngo_ClientZone_Campaign.FindAll(qp, out RecordCount); //配置值 XmlFormat xmlFormat = new XmlFormat(Context.Server.MapPath(String.Format("{0}Resource/xml/Config.Setting.Campaigns.xml", Context.ModulePath))); var XmlItemSetting = xmlFormat.ToList <SettingEntity>(); List <Dictionary <String, Object> > DictFiles = new List <Dictionary <string, object> >(); foreach (var CampaignItem in CampaignList) { int index = CampaignList.IndexOf(CampaignItem); //index 为索引值 Dictionary <String, Object> jsonDict = new Dictionary <String, Object>(); //循环输出所有的固定项 foreach (var Field in Playngo_ClientZone_Campaign.Meta.Fields) { jsonDict.Add(Field.ColumnName, CampaignItem[Field.ColumnName]); } if (XmlItemSetting != null && XmlItemSetting.Count > 0) { var ItemSettings = ConvertTo.Deserialize <List <KeyValueEntity> >(CampaignItem.Options); foreach (var ItemSetting in XmlItemSetting) { jsonDict = Common.UpdateDictionary(jsonDict, ItemSetting.Name, xf.ViewItemSetting(CampaignItem, ItemSetting.Name, ItemSetting.DefaultValue)); } } jsonDict = Common.UpdateDictionary(jsonDict, "ReleaseDateString", CampaignItem.ReleaseDate.ToShortDateString()); jsonDict = Common.UpdateDictionary(jsonDict, "Image", xf.ViewLinkUrl(xf.ViewItemSettingT <string>(CampaignItem, "Image", ""), "", Context)); jsonDict = Common.UpdateDictionary(jsonDict, "Url", xf.GoUrl(CampaignItem)); Int32 NotifyStatus = (Int32)EnumNotificationStatus.None; if (CampaignItem.NotifyInclude == 1) //&& CampaignItem.StartTime >= xUserTime.LocalTime().AddDays(-xf.ViewSettingT<Int32>("General.ExpiryTimeNotification", 7))) { NotifyStatus = CampaignItem.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", CampaignItem.ReleaseDate > xUserTime.LocalTime()); DictFiles.Add(jsonDict); } jsonPictures.Add("data", DictFiles); jsonPictures.Add("Pages", qp.Pages); jsonPictures.Add("RecordCount", RecordCount); //转换数据为json ResponseString = jsSerializer.Serialize(jsonPictures); }