public WorkOrderTypeTreeDomainModel GetWorkOrderTypeTreeFromDatabase() { WorkOrderTypeTreeDomainModel tree = new WorkOrderTypeTreeDomainModel(); tree.BasicInfo = new WorkorderTypeInfoModel(); tree.BasicInfo.TypeName = "根节点"; tree.BasicInfo.WorkorderTypeId = null; tree.BasicInfo.ParentId = null; GetWorkOrderTypeByParentIdFromDatabase(tree, null); return(tree); }
public WorkOrderTypeTreeDomainModel GetWorkOrderTypeTree(bool clearCache) { string cacheKey = CacheKey.WORKORDER_TYPE_TREE; WorkOrderTypeTreeDomainModel tree = CacheUtil.Get <WorkOrderTypeTreeDomainModel>(cacheKey); if (tree == null || clearCache) { tree = GetWorkOrderTypeTreeFromDatabase(); if (tree != null) { CacheUtil.Set(cacheKey, tree); } } return(tree); }
public void GetWorkOrderTypeByParentIdFromDatabase(WorkOrderTypeTreeDomainModel tree, string parentId) { List <WorkorderTypeInfoModel> childList = GetWorkOrderTypeListByParentIdFromDatabase(parentId); if (childList != null && childList.Count > 0) { tree.ChildTypeList = new Dictionary <string, WorkOrderTypeTreeDomainModel>(); WorkOrderTypeTreeDomainModel childInfo = null; foreach (WorkorderTypeInfoModel item in childList) { childInfo = new WorkOrderTypeTreeDomainModel(); childInfo.BasicInfo = item; GetWorkOrderTypeByParentIdFromDatabase(childInfo, item.WorkorderTypeId); tree.ChildTypeList[childInfo.BasicInfo.WorkorderTypeId] = childInfo; } } else { tree.ChildTypeList = null; } }