public string GetCurrUserArea(string planId, string userAccount = "") { if (string.IsNullOrEmpty(userAccount)) { userAccount = OperatorProvider.Provider.Current().Account; } string data = riskplanbll.GetCurrUserAreaId(planId, userAccount); return(data); }
public ActionResult GetAreasJson(string orgID, string areaIds, string planId) { List <DistrictEntity> list = bis_districtbll.GetList().ToList(); List <DistrictEntity> districtdata = new List <DistrictEntity>(); districtdata = list.OrderBy(a => a.SortCode).ToList(); if (orgID != "0") { districtdata = districtdata.Where(a => a.OrganizeId == orgID).ToList(); } if (!string.IsNullOrEmpty(planId)) { RiskPlanBLL riskplanbll = new RiskPlanBLL(); string data = riskplanbll.GetCurrUserAreaId(planId, OperatorProvider.Provider.Current().Account); districtdata = districtdata.Where(t => data.Contains(t.DistrictID)).ToList(); } districtdata = districtdata.OrderBy(t => t.DistrictCode).ThenBy(t => t.SortCode).ToList(); List <TreeEntity> treeList = new List <TreeEntity>(); foreach (DistrictEntity item in districtdata) { TreeEntity tree = new TreeEntity(); bool hasChildren = districtdata.Count(t => t.ParentID == item.DistrictID) == 0 ? false : true; tree.id = item.DistrictID; tree.text = item.DistrictName.Replace("\\", "╲"); tree.value = item.DistrictCode; tree.Attribute = "Code"; tree.AttributeValue = item.DistrictCode; tree.AttributeA = "Dept"; tree.AttributeValueA = item.ChargeDept + "," + item.ChargeDeptCode + "," + item.ChargeDeptID; tree.parentId = "0"; tree.isexpand = false; tree.complete = true; tree.hasChildren = hasChildren; tree.showcheck = true; treeList.Add(tree); } return(Content(treeList.TreeToJson("0"))); }