public JsonResult AddVersionCBS(string NodeID, string AddMode, string VersionID) { var result = new Dictionary <string, object>(); Action action = () => { var nodeDic = this.GetDataDicByID("S_EP_BudgetVersion_Detail", NodeID); if (nodeDic == null) { throw new Formula.Exceptions.BusinessValidationException("未能找到选中的费用科目节点,无法新增"); } var node = new S_EP_BudgetVersion_Detail(nodeDic); if (AddMode == "After") { var child = node.AddBrotherNode(); result = child.ModelDic; } else if (AddMode == "AddChild") { var child = node.AddChildNode(); result = child.ModelDic; } }; this.ExecuteAction(action); return(Json(result)); }
public JsonResult ImportResource(string VersionID, string ParentID, string ListData) { var result = new List <Dictionary <string, object> >(); Action action = () => { var parentNodeDic = this.GetDataDicByID("S_EP_BudgetVersion_Detail", ParentID); if (parentNodeDic == null) { throw new Formula.Exceptions.BusinessValidationException("没有找到父节点,无法导入资源"); } var parentBudgetDetail = new S_EP_BudgetVersion_Detail(parentNodeDic); var list = JsonHelper.ToList(ListData); foreach (var item in list) { if (String.IsNullOrEmpty(item.GetValue("Name"))) { throw new Formula.Exceptions.BusinessValidationException("导入的数据员必须指定Name列的值"); } item.SetValue("ID", ""); item.SetValue("CBSID", ""); var detail = parentBudgetDetail.AddChildNode(item, true); result.Add(detail.ModelDic); } }; this.ExecuteAction(action); return(Json(result)); }
public JsonResult DeleteNodes(string ListData) { Action action = () => { var list = JsonHelper.ToList(ListData); foreach (var item in list) { var budgetDetail = new S_EP_BudgetVersion_Detail(item); budgetDetail.Delete(); var parentDetail = budgetDetail.ParentNode; if (parentDetail != null) { parentDetail.SumTotalValue(); } } }; this.ExecuteAction(action); return(Json("")); }