public void Execute(BasePage Context) { Dictionary <String, Object> jsonDicts = new Dictionary <String, Object>(); JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); String StrIDs = WebHelper.GetStringParam(Context.Request, "IDs", ""); Int32 UpdateResult = 0; if (!String.IsNullOrEmpty(StrIDs)) { var Ids = Common.GetList(StrIDs); if (Ids != null && Ids.Count > 0) { foreach (var Id in Ids) { var index = Ids.IndexOf(Id); UpdateResult += Playngo_ClientZone_DownloadRelation.Update(String.Format("Sort={0}", 1 + index), String.Format("ID={0}", Id)); } } } jsonDicts.Add("UpdateCount", UpdateResult); //转换数据为json ResponseString = jsSerializer.Serialize(jsonDicts); }
/// <summary> /// 获取文档关联下载文件 /// </summary> /// <param name="DataItem"></param> /// <returns></returns> public List <Playngo_ClientZone_DownloadFile> GetDownloadFiles(Playngo_ClientZone_GameSheet DataItem) { var DownLoadFiles = new List <Playngo_ClientZone_DownloadFile>(); if (DataItem != null && DataItem.ID > 0) { var Relations = Playngo_ClientZone_DownloadRelation.FindListByItem(DataItem.ID, (Int32)EnumDisplayModuleType.GameSheets); if (Relations != null && Relations.Count > 0) { foreach (var Relation in Relations) { Playngo_ClientZone_DownloadFile DownloadFile = Playngo_ClientZone_DownloadFile.FindByKeyForEdit(Relation.DownloadID); if (DownloadFile != null && DownloadFile.ID > 0) { //判断当前角色和区域是否可以看到这些文件 if (IsPreRoleView(DownloadFile.Per_AllUsers, DownloadFile.Per_Roles) && IsPreJurisdictionView(DownloadFile.Per_AllJurisdictions, DownloadFile.Per_Jurisdictions)) { DownLoadFiles.Add(DownloadFile); } } } } } return(DownLoadFiles); }
/// <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> /// <param name="NewID">新的编号</param> /// <param name="OldID">老的编号</param> public void CopyDownFileRelations(Int32 NewID, Int32 OldID) { var DownloadRelations = Playngo_ClientZone_DownloadRelation.FindListByItem(OldID, (Int32)EnumDisplayModuleType.GameSheets); if (DownloadRelations != null && DownloadRelations.Count > 0) { foreach (var DownloadRelation in DownloadRelations) { var DownloadRelationNew = DownloadRelation.Clone() as Playngo_ClientZone_DownloadRelation; DownloadRelationNew.ItemID = NewID; DownloadRelationNew.ID = 0; DownloadRelationNew.CreateUser = UserId; DownloadRelationNew.CreateTime = xUserTime.UtcTime(); DownloadRelationNew.Insert(); } } }
public void Execute(BasePage Context) { Dictionary <String, Object> jsonDicts = new Dictionary <String, Object>(); Int32 RelationId = WebHelper.GetIntParam(Context.Request, "ID", 0); QueryParam qp = new QueryParam(); qp.Where.Add(new SearchParam(Playngo_ClientZone_DownloadRelation._.ID, RelationId, SearchType.Equal)); Int32 DeleteCount = Playngo_ClientZone_DownloadRelation.Delete(qp); jsonDicts.Add("DeleteCount", DeleteCount); //转换数据为json JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); ResponseString = jsSerializer.Serialize(jsonDicts); }
/// <summary> /// 绑定动态模块到页面 /// </summary> private void BindDownFilesToPage() { if (CampaignID > 0) { //绑定动态模块的模态窗口 Resource_Attachments|Manager_Modal_SelectDownloadFiles hlSelectFiles.Attributes.Add("data-href", String.Format("{0}Resource_Masters.aspx?PortalId={1}&TabId={2}&ModuleId={3}&language={4}&Master=Manager_Modal_Downloads", ModulePath, PortalId, TabId, ModuleId, language)); } else { hlSelectFiles.Enabled = false; hlSelectFiles.Attributes.Add("disabled", "disabled"); } List <Object> Items = new List <Object>(); if (CampaignItem != null && CampaignItem.ID > 0) { var Relations = Playngo_ClientZone_DownloadRelation.FindListByItem(CampaignItem.ID, (Int32)EnumDisplayModuleType.Campaigns); if (Relations != null && Relations.Count > 0) { foreach (var Relation in Relations) { var Item = Playngo_ClientZone_DownloadFile.FindByKeyForEdit(Relation.DownloadID); Items.Add(new { ID = Relation.ID, ItemID = Item.ID, DownloadID = Relation.DownloadID, Title = Item.Title, PageType = (Int32)EnumDisplayModuleType.Campaigns, PageTypeText = "Campaigns" }); } } } //绑定参数项 RepeaterFiles.DataSource = Items; RepeaterFiles.DataBind(); }
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); }