public GetAllDepReturn GetAllDep(int CurUserId, string CurUserIden)
        {
            base.SetHeader();
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);
            GetAllDepReturn re = new GetAllDepReturn();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                re.Result   = false;
                re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                return(re);
            }
            try
            {
                List <CODep> allDep = COOrgans.Instance().GetAllDep();
                re.DepCol = new List <CODepOrganSel>();
                allDep.Where(t => t.ParentId.Value.Equals(-1)).ToList().ForEach(t =>
                {
                    CODepOrganSel item = new CODepOrganSel();
                    item.Id            = t.Id;
                    item.DepName       = t.DepName;
                    item.ChildDep      = this.GetChildDep(allDep, t.Id);
                    if (item.ChildDep.Count > 0)
                    {
                        item.HasChildDep = true;
                    }
                    else
                    {
                        item.HasChildDep = false;
                    }
                    re.DepCol.Add(item);
                });
                re.Result = true;
                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }
        public List <CODepOrganSel> GetChildDep(List <CODep> allDep, int parentDepId)
        {
            List <CODepOrganSel> col = new List <CODepOrganSel>();

            allDep.Where(t => t.ParentId.Equals(parentDepId)).ToList().ForEach(t => {
                CODepOrganSel item = new CODepOrganSel();
                item.Id            = t.Id;
                item.DepName       = t.DepName;
                item.ChildDep      = this.GetChildDep(allDep, t.Id);
                if (item.ChildDep.Count > 0)
                {
                    item.HasChildDep = true;
                }
                else
                {
                    item.HasChildDep = false;
                }
                col.Add(item);
            });
            return(col);
        }