string code = String.Empty; // 对象编码 #endregion #region 构造函数 #endregion #region ASP.NET 事件 protected void Page_Load(object sender, EventArgs e) { id = RequestData.Get <string>("id", String.Empty); ids = RequestData.GetList <string>("ids"); pids = RequestData.GetList <string>("pids"); code = RequestData.Get <string>("code", String.Empty); SysEnumeration ent = null; switch (this.RequestAction) { case RequestActionEnum.Update: ent = this.GetMergedData <SysEnumeration>(); ent.ParentID = String.IsNullOrEmpty(ent.ParentID) ? null : ent.ParentID; ent.Update(); this.SetMessage("更新成功!"); break; default: if (RequestActionString == "batchdelete") { IList <object> idList = RequestData.GetList <object>("IdList"); if (idList != null && idList.Count > 0) { SysEnumeration.DoBatchDelete(idList.ToArray()); } } if (RequestActionString == "paste") { DoPaste(); } else { DoSelect(); } break; } }
SearchModeEnum tagschmode = SearchModeEnum.Like; // 扩展信息查询方式 #endregion #region 构造函数 #endregion #region ASP.NET 事件 protected void Page_Load(object sender, EventArgs e) { id = RequestData.Get <string>("id", String.Empty); ids = RequestData.GetList <string>("ids"); pids = RequestData.GetList <string>("pids"); code = RequestData.Get <string>("code", String.Empty); showroot = RequestData.Get <string>("showroot", String.Empty); tag = RequestData.Get <string>("tag", String.Empty); string tagschmodestr = RequestData.Get <string>("tagschmode", String.Empty); tagschmode = ObjectHelper.GetEnum <SearchModeEnum>(tagschmodestr, SearchModeEnum.Like); SysEnumeration ent = null; switch (this.RequestAction) { case RequestActionEnum.Update: ent = this.GetMergedData <SysEnumeration>(); ent.ParentID = String.IsNullOrEmpty(ent.ParentID) ? null : ent.ParentID; ent.Update(); this.SetMessage("更新成功!"); break; default: if (RequestActionString == "batchdelete") { IList <object> idList = RequestData.GetList <object>("IdList"); if (idList != null && idList.Count > 0) { SysEnumeration.DoBatchDelete(idList.ToArray()); } } else { // 构建查询表达式 SearchCriterion sc = new HqlSearchCriterion(); // sc.SetOrder("SortIndex"); sc.SetOrder("CreatedDate"); ICriterion crit = null; if (RequestActionString == "querychildren") { if (ids != null && ids.Count > 0 || pids != null && pids.Count > 0) { if (ids != null && ids.Count > 0) { IEnumerable <string> distids = ids.Distinct().Where(tent => !String.IsNullOrEmpty(tent)); crit = Expression.In(SysEnumeration.Prop_EnumerationID, distids.ToArray()); } if (pids != null && pids.Count > 0) { IEnumerable <string> dispids = pids.Distinct().Where(tent => !String.IsNullOrEmpty(tent)); if (crit != null) { crit = SearchHelper.UnionCriterions(crit, Expression.In(SysEnumeration.Prop_ParentID, dispids.ToArray())); } else { crit = Expression.In(SysEnumeration.Prop_ParentID, dispids.ToArray()); } } } } else { ICriterion tagCirt = null; if (!String.IsNullOrEmpty(tag)) { HqlCommonSearchCriterionItem tagCritItem = new HqlCommonSearchCriterionItem(SysEnumeration.Prop_Tag, tag, tagschmode); tagCirt = tagCritItem.GetCriterion(); } if (!String.IsNullOrEmpty(code)) { SysEnumeration tent = SysEnumeration.FindFirstByProperties(SysEnumeration.Prop_Code, code); crit = SearchHelper.IntersectCriterions( Expression.Eq(SysEnumeration.Prop_ParentID, tent.EnumerationID), tagCirt); if (!String.IsNullOrEmpty(showroot) && showroot != "0" && showroot.ToLower() != "false") { crit = SearchHelper.UnionCriterions( crit, Expression.Eq(SysEnumeration.Prop_EnumerationID, tent.EnumerationID)); } this.PageState.Add("Root", tent); } else { crit = SearchHelper.UnionCriterions(Expression.IsNull(SysEnumeration.Prop_ParentID), Expression.Eq(SysEnumeration.Prop_ParentID, String.Empty)); crit = SearchHelper.IntersectCriterions(crit, tagCirt); } } ents = SysEnumerationRule.FindAll(sc, crit); this.PageState.Add("DtList", ents); } break; } }
protected void Page_Load(object sender, EventArgs e) { try { Aim.Portal.Web.WebPortalService.CheckLogon(); } catch { Response.Write("<script> window.parent.location.href = '/Login.aspx';</script>"); Response.End(); } string action = Request["action"]; json = Request["json"]; switch (action) { case "select": Select(); break; case "delete": Delete(); break; case "update": Ent = JsonHelper.GetObject <SysEnumeration>(json); SysEnumeration originalEnt = SysEnumeration.Find(Ent.EnumerationID); EasyDictionary dic = JsonHelper.GetObject <EasyDictionary>(json); originalEnt = DataHelper.MergeData <SysEnumeration>(originalEnt, Ent, dic.Keys); originalEnt.Value = originalEnt.Name; originalEnt.DoUpdate(); break; case "create": Ent = JsonHelper.GetObject <SysEnumeration>(json); SysEnumeration EntParent = SysEnumeration.Find(Ent.ParentID); Ent.Value = Ent.Name; Ent.IsLeaf = true; if (string.IsNullOrEmpty(EntParent.Path)) { Ent.Path = EntParent.EnumerationID; } else { Ent.Path = EntParent.Path + "." + EntParent.EnumerationID; } Ent.PathLevel = EntParent.PathLevel + 1; Ent.CreaterID = WebPortalService.CurrentUserInfo.UserID; Ent.CreaterName = WebPortalService.CurrentUserInfo.Name; Ent.DoCreate(); //------------------------ if (Convert.ToInt32(EntParent.IsLeaf) == 1) { EntParent.IsLeaf = false; EntParent.Update(); } break; case "loadform": string EnumerationID = Request["EnumerationID"]; json = JsonHelper.GetJsonString(SysEnumeration.Find(EnumerationID)); Response.Write("{success:true,data:" + json + "}"); Response.End(); break; } }
string type = String.Empty; // 对象类型 #endregion #region ASP.NET 事件 protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); id = RequestData.Get <string>("id"); type = RequestData.Get <string>("type"); SysEnumeration ent = null; switch (this.RequestAction) { case RequestActionEnum.Update: ent = this.GetMergedData <SysEnumeration>(); ent.Update(); this.SetMessage("修改成功!"); break; case RequestActionEnum.Create: ent = this.GetPostedData <SysEnumeration>(); ent.CreaterID = UserInfo.UserID; ent.CreaterName = UserInfo.Name; if (String.IsNullOrEmpty(id)) { ent.CreateAsRoot(); } else { ent.CreateAsSibling(id); } this.SetMessage("新建成功!"); break; default: if (RequestActionString == "createsub") { ent = this.GetPostedData <SysEnumeration>(); ent.CreaterID = UserInfo.UserID; ent.CreaterName = UserInfo.Name; ent.CreateAsChild(id); this.SetMessage("新建成功!"); } break; } if (op != "c" && op != "cs") { if (!String.IsNullOrEmpty(id)) { ent = SysEnumeration.Find(id); } this.SetFormData(ent); } else { PageState.Add("CreaterName", UserInfo.Name); PageState.Add("CreatedDate", DateTime.Now); } }