private void Delete() { string EnumID = Request["EnumID"]; Ent = SysEnumeration.Find(EnumID); SysEnumeration ent_parent = SysEnumeration.Find(Ent.ParentID); Ent.DoDelete(); IList <SysEnumeration> ents_sysenumeration = SysEnumeration.FindAllByProperty(SysEnumeration.Prop_ParentID, ent_parent.EnumerationID); if (ents_sysenumeration.Count == 0) { ent_parent.IsLeaf = true; ent_parent.DoUpdate(); } }
protected void Page_Load(object sender, EventArgs e) { try { Aim.Portal.Web.WebPortalService.CheckLogon(); } catch { Response.Redirect("/Login.aspx"); } string action = Request["action"]; SysEnumeration seEnt = null; string json = ""; switch (action) { case "create": json = Request["json"]; seEnt = JsonHelper.GetObject <SysEnumeration>(json); seEnt.Value = seEnt.Name; seEnt.IsLeaf = true; seEnt.DoCreate(); SysEnumeration seEnt_parent = SysEnumeration.Find(seEnt.ParentID); seEnt_parent.IsLeaf = false; seEnt_parent.DoUpdate(); break; case "update": json = Request["json"]; seEnt = JsonHelper.GetObject <SysEnumeration>(json); SysEnumeration originalEnt = SysEnumeration.Find(seEnt.EnumerationID); EasyDictionary dic = JsonHelper.GetObject <EasyDictionary>(json); originalEnt = DataHelper.MergeData <SysEnumeration>(originalEnt, seEnt, dic.Keys); originalEnt.Value = originalEnt.Name; originalEnt.DoUpdate(); break; case "loadformdata": string id = Request["id"]; json = JsonHelper.GetJsonString(SysEnumeration.Find(id)); Response.Write("{success:true,data:" + json + "}"); Response.End(); break; } }
private void DoPaste() { IList <string> idList = RequestData.GetList <string>("IdList"); string type = RequestData.Get <string>("type", String.Empty); string tid = RequestData.Get <string>("tid", String.Empty); // 目标节点id string pdstype = RequestData.Get <string>("pdstype", String.Empty); // 粘贴数据来源类型 if (!String.IsNullOrEmpty(tid)) { SysEnumeration target = SysEnumeration.Find(tid); PasteDataSourceEnum pdsenum = PasteDataSourceEnum.Unknown; PasteAsEnum paenum = PasteAsEnum.Other; if (pdstype == "cut") { pdsenum = PasteDataSourceEnum.Cut; } else if (pdstype == "copy") { pdsenum = PasteDataSourceEnum.Copy; } if (type == "sib") { paenum = PasteAsEnum.Sibling; } else if (type == "sub") { paenum = PasteAsEnum.Child; } if (pdsenum != PasteDataSourceEnum.Unknown && paenum != PasteAsEnum.Other) { // 粘贴操作 SysEnumeration.DoPaste(pdsenum, paenum, tid, idList.ToArray()); } } }
protected void Page_Load(object sender, EventArgs e) { try { Aim.Portal.Web.WebPortalService.CheckLogon(); } catch { Response.Redirect("/Login.aspx"); } action = Request["action"]; EnumID = Request["id"]; ParentID = Request["ParentID"]; switch (action) { case "select": if (!string.IsNullOrEmpty(EnumID)) { IList <SysEnumeration> seEnts = SysEnumeration.FindAllByProperty(SysEnumeration.Prop_SortIndex, SysEnumeration.Prop_ParentID, EnumID); string result = "["; int i = 0; foreach (SysEnumeration seEnt in seEnts) { if (i != seEnts.Count - 1) { result += "{id:'" + seEnt.EnumerationID + "',Name:'" + seEnt.Name + "',Code:'" + seEnt.Code + "',Value:'" + seEnt.Value + "',ParentID:'" + seEnt.ParentID + "',leaf:" + (seEnt.IsLeaf.Value ? "true" : "false") + "},"; } else { result += "{id:'" + seEnt.EnumerationID + "',Name:'" + seEnt.Name + "',Code:'" + seEnt.Code + "',Value:'" + seEnt.Value + "',ParentID:'" + seEnt.ParentID + "',leaf:" + (seEnt.IsLeaf.Value ? "true" : "false") + "}"; } i++; } result += "]"; Response.Write(result); Response.End(); } break; case "delete": SysEnumeration ent_sysenumeration = SysEnumeration.Find(EnumID); SysEnumeration ent_parent = SysEnumeration.Find(ent_sysenumeration.ParentID); ent_sysenumeration.DoDelete(); IList <SysEnumeration> ents_sysenumeration = SysEnumeration.FindAllByProperty(SysEnumeration.Prop_ParentID, ent_parent.EnumerationID); if (ents_sysenumeration.Count == 0) { ent_parent.IsLeaf = true; ent_parent.DoUpdate(); } //sql = @"delete sysenumeration where enumerationid='" + EnumID + "'"; //DataHelper.ExecSql(sql); //string sql1 = "select * from sysenumeration where ParentID ='" + ParentID + "'"; //IList<EasyDictionary> dics = DataHelper.QueryDictList(sql1); //if (dics.Count() == 0) //{ // sql = "update sysenumeration set ISLEAF =1 where enumerationid='" + ParentID + "'"; // DataHelper.ExecSql(sql); //} //Response.Write(""); //Response.End(); 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); } }
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(); } action = Request["action"]; EnumID = Request["id"]; ParentID = Request["ParentID"]; switch (action) { case "select": if (!string.IsNullOrEmpty(EnumID)) { IList <SysEnumeration> seEnts = SysEnumeration.FindAllByProperty(SysEnumeration.Prop_SortIndex, SysEnumeration.Prop_ParentID, EnumID); string result = "["; int i = 0; string checkstr = ""; foreach (SysEnumeration seEnt in seEnts) { checkstr = seEnt.IsLeaf.Value == true ? "checked:false," : ""; if (i != seEnts.Count - 1) { result += "{id:'" + seEnt.EnumerationID + "',Name:'" + seEnt.Name + "'," + checkstr + "Value:'" + seEnt.Value + "',ParentID:'" + seEnt.ParentID + "',leaf:" + (seEnt.IsLeaf.Value ? "true" : "false") + "},"; } else { result += "{id:'" + seEnt.EnumerationID + "',Name:'" + seEnt.Name + "'," + checkstr + "Value:'" + seEnt.Value + "',ParentID:'" + seEnt.ParentID + "',leaf:" + (seEnt.IsLeaf.Value ? "true" : "false") + "}"; } i++; checkstr = ""; } result += "]"; Response.Write(result); Response.End(); } break; case "delete": SysEnumeration ent_sysenumeration = SysEnumeration.Find(EnumID); SysEnumeration ent_parent = SysEnumeration.Find(ent_sysenumeration.ParentID); ent_sysenumeration.DoDelete(); IList <SysEnumeration> ents_sysenumeration = SysEnumeration.FindAllByProperty(SysEnumeration.Prop_ParentID, ent_parent.EnumerationID); if (ents_sysenumeration.Count == 0) { ent_parent.IsLeaf = true; ent_parent.DoUpdate(); } break; case "inigrid": string typeids = Request["typeids"]; DataTable dt = new DataTable(); DataColumn dc = new DataColumn("Id"); dt.Columns.Add(dc); dc = new DataColumn("ProjectName"); dt.Columns.Add(dc); sql = "select EnumerationID Id,Name,PatIndex('%'+EnumerationID+'%','" + typeids + "') as SortIndex from SysEnumeration where '" + typeids + "' like '%'+EnumerationID+'%' order by SortIndex asc"; DataTable dt_enum = DataHelper.QueryDataTable(sql); foreach (DataRow dr_enum in dt_enum.Rows) { dc = new DataColumn(dr_enum["Id"].ToString() + dr_enum["Name"]); dt.Columns.Add(dc); } string where = ""; if (!string.IsNullOrEmpty(Request["belongdept"])) { where += " and BelongDeptId='" + Request["belongdept"] + "'"; } sql = "select Id,ProjectName from NCRL_SP..Project where BelongCmp='JL' " + where + " order by CreateTime desc"; IList <EasyDictionary> dics = DataHelper.QueryDictList(sql); foreach (EasyDictionary dic in dics) { DataRow dr = dt.NewRow(); dr["Id"] = dic.Get <string>("Id"); dr["ProjectName"] = dic.Get <string>("ProjectName"); foreach (DataRow dr_enum in dt_enum.Rows) { IList <FileItem> fiEnts = FileItem.FindAllByProperties(FileItem.Prop_ProjectId, dic.Get <string>("Id"), FileItem.Prop_SecondTypeId, dr_enum["Id"]); if (fiEnts.Count > 0) { dr[dr_enum["Id"].ToString() + dr_enum["Name"]] = "√"; } } dt.Rows.Add(dr); } Response.Write("{success:true,rows:" + JsonHelper.GetJsonStringFromDataTable(dt) + "}"); Response.End(); break; case "loadgroup": sql = "select GroupId id,replace(Name,'江西瑞林建设监理有限公司','') as name from SysGroup where ParentId='228' order by id asc"; dt = DataHelper.QueryDataTable(sql); Response.Write("{rows:" + JsonHelper.GetJsonStringFromDataTable(dt) + "}"); Response.End(); break; } }