private void RecursivelyCompanyClass(Guid companyClassId, RadTreeNode node) { IList <CostCompanyClassInfo> childcompanyClassList = _cost.GetChildCompanyClassList(companyClassId); foreach (CostCompanyClassInfo childCompanyClass in childcompanyClassList) { RadTreeNode childNode = CreateNode(childCompanyClass.CompanyClassName + "(" + childCompanyClass.CompanyClassCode + ")", false, childCompanyClass.CompanyClassId.ToString()); node.Nodes.Add(childNode); RecursivelyCompanyClass(childCompanyClass.CompanyClassId, childNode); } }
/// <summary>遍历费用单位分类 /// </summary> /// <param name="companyClassId">费用单位ID</param> /// <param name="node">节点</param> private void RecursivelyCompanyClass(Guid companyClassId, RadTreeNode node) { //var companyClass = new Cost(); IList <CostCompanyClassInfo> childCompanyClassList = _costDao.GetChildCompanyClassList(companyClassId); foreach (CostCompanyClassInfo companyClassInfo in childCompanyClassList) { RadTreeNode childNode = CreateNode(companyClassInfo.CompanyClassName + "[" + GetNonceCost(companyClassInfo.CompanyClassId, Guid.Empty) + "]", true, companyClassInfo.CompanyClassId.ToString()); childNode.PostBack = false; node.Nodes.Add(childNode); RepetitionCompanyCussent(companyClassInfo.CompanyClassId, childNode); } }
//遍历子公司 private void RecursivelyCompanyClass(Guid companyClassId, RadTreeNode node, Guid assumeFilialeId) { IList <CostCompanyClassInfo> childCompanyClassList = _costDao.GetChildCompanyClassList(companyClassId); foreach (CostCompanyClassInfo companyClassInfo in childCompanyClassList) { RadTreeNode childNode = CreateNode(companyClassInfo.CompanyClassName + "[" + CountCussent(companyClassInfo.CompanyClassId, Guid.Empty, Guid.Empty, assumeFilialeId) + "]", false, companyClassInfo.CompanyClassId.ToString()); childNode.PostBack = false; IList <CostCussentInfo> companyCussentList = _costCussentDao.GetCompanyCussentList(companyClassInfo.CompanyClassId); if (companyCussentList.Count != 0) { node.Nodes.Add(childNode); RecursivelyCompanyClass(companyClassInfo.CompanyClassId, childNode, assumeFilialeId); RepetitionCompanyCussent(childNode, companyCussentList, assumeFilialeId); } } }
/// <summary>获取费用单位分类 /// </summary> /// <param name="companyClassId"></param> /// <param name="depth"></param> /// <returns></returns> public static IList <CostCompanyClassInfo> RecursionCostClass(Guid companyClassId, int depth) { depth++; IList <CostCompanyClassInfo> companyClassTree = new List <CostCompanyClassInfo>(); IList <CostCompanyClassInfo> companyClassList = _costDao.GetChildCompanyClassList(companyClassId); string tag = depth == 1 ? "+" : "|" + new String('-', depth * 2); foreach (CostCompanyClassInfo companyClassInfo in companyClassList) { companyClassInfo.CompanyClassName = tag + companyClassInfo.CompanyClassName; companyClassTree.Add(companyClassInfo); foreach ( CostCompanyClassInfo childCompanyClassInfo in RecursionCostClass(companyClassInfo.CompanyClassId, depth)) { companyClassTree.Add(childCompanyClassInfo); } } return(companyClassTree); }