Ejemplo n.º 1
0
        /// <summary>
        /// 获取部门信息
        /// </summary>
        /// <returns>DataTable 部门信息</returns>
        public static DataTable GetDeptInfo(string TypeID)
        {
            string companyCD = string.Empty;

            //获取公司代码
            try
            {
                companyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
            }
            catch
            {
                companyCD = "AAAAAA";
            }
            //查询部门信息
            DataTable dtDept = UserDeptSelectDBHelper.GetDeptInfo(companyCD);

            //部门信息不存在时,返回
            if (dtDept == null || dtDept.Rows.Count < 1)
            {
                return(dtDept);
            }

            //定义返回的部门信息变量
            DataTable dtReturn = new DataTable();

            //复制部门信息表结构
            dtReturn = dtDept.Clone();
            #region 部门信息排序处理
            //获取第一级部门信息
            DataRow[] drSuperDept = dtDept.Select("SuperDeptID IS NULL");
            //遍历第一级部门
            for (int i = 0; i < drSuperDept.Length; i++)
            {
                DataRow drFirstDept = (DataRow)drSuperDept[i];
                //获取部门ID
                int deptID = (int)drFirstDept["ID"];
                //替换部门名称内容
                if (TypeID == ConstUtil.TYPE_DANX_CODE)
                {
                    drFirstDept["DeptName"] = "<input type='radio' name='select'  id='chk_" + deptID.ToString() + "' value='" + ConstUtil.DEPT_EMPLOY_SELECT_DEPT
                                              + deptID.ToString() + "|" + drFirstDept["DeptName"].ToString() + "'>" + drFirstDept["DeptName"].ToString();
                }
                else if (TypeID == ConstUtil.TYPE_DUOX_CODE)
                {
                    drFirstDept["DeptName"] = "<input type='checkbox' name='select'  id='chk_" + deptID.ToString() + "' value='" + ConstUtil.DEPT_EMPLOY_SELECT_DEPT
                                              + deptID.ToString() + "|" + drFirstDept["DeptName"].ToString() + "'>" + drFirstDept["DeptName"].ToString();
                }
                //导入第一级部门
                dtReturn.ImportRow(drFirstDept);
                //设定子部门
                dtReturn = ReorderDeptRow(dtReturn, deptID, dtDept, 1, TypeID);
            }
            #endregion
            return(dtReturn);
        }
Ejemplo n.º 2
0
 public static DataTable GetDeptInfoByCompanyCD()
 {
     try
     {
         string companyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
         return(UserDeptSelectDBHelper.GetDeptInfo(companyCD));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        /// <summary>
        /// 获取部门信息
        /// </summary>
        /// <returns>DataTable 部门信息</returns>
        public static DataTable GetDeptInfo()
        {
            string companyCD = string.Empty;

            //获取公司代码
            try
            {
                companyCD = "AAAAAA";
                //companyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
            }
            catch
            {
                companyCD = "AAAAAA";
            }
            //查询部门信息
            DataTable dtDept = UserDeptSelectDBHelper.GetDeptInfo(companyCD);

            //部门信息不存在时,返回
            if (dtDept == null || dtDept.Rows.Count < 1)
            {
                return(dtDept);
            }

            //定义返回的部门信息变量
            DataTable dtReturn = new DataTable();

            //复制部门信息表结构
            dtReturn = dtDept.Clone();

            #region 部门信息排序处理

            //获取第一级部门信息
            DataRow[] drSuperDept = dtDept.Select("SuperDeptID IS NULL");
            //遍历第一级部门
            for (int i = 0; i < drSuperDept.Length; i++)
            {
                DataRow drFirstDept = (DataRow)drSuperDept[i];
                //获取部门ID
                int deptID = (int)drFirstDept["ID"];
                //替换部门名称内容
                drFirstDept["DeptName"] = drFirstDept["DeptName"].ToString();
                //导入第一级部门
                dtReturn.ImportRow(drFirstDept);
                //设定子部门
                dtReturn = ReorderDeptRow(dtReturn, deptID, dtDept, 1);
            }

            #endregion

            return(dtReturn);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取部门信息
        /// </summary>
        /// <returns>DataTable 部门信息</returns>
        public static DataTable GetDepartmentInfo()
        {
            string companyCD = string.Empty;

            //获取公司代码
            try
            {
                companyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
            }
            catch
            {
                companyCD = "AAAAAA";
            }
            //string companyCD = "AAAAAA";
            //查询部门信息
            DataTable dtDept = UserDeptSelectDBHelper.GetDeptInfo(companyCD);

            //部门信息不存在时,返回
            if (dtDept == null || dtDept.Rows.Count < 1)
            {
                return(dtDept);
            }

            //定义返回的部门信息变量
            DataTable dtReturn = new DataTable();

            //复制部门信息表结构
            dtReturn = dtDept.Clone();

            #region 部门信息排序处理

            //获取第一级部门信息
            DataRow[] drSuperDept = dtDept.Select("SuperDeptID IS NULL");
            //遍历第一级部门
            for (int i = 0; i < drSuperDept.Length; i++)
            {
                DataRow drFirstDept = (DataRow)drSuperDept[i];
                //获取部门ID
                int deptID = (int)drFirstDept["ID"];
                //替换部门名称内容
                drFirstDept["DeptName"] = "<input type='radio' name=\"radipDept\"  id='chk_" + deptID.ToString() + "' value='" + drFirstDept["ID"].ToString() + "' onclick=\"popDeptObj.FillDeptValue(this,'" + drFirstDept["DeptName"].ToString() + "');\">" + drFirstDept["DeptName"].ToString();
                //导入第一级部门
                dtReturn.ImportRow(drFirstDept);
                //设定子部门
                dtReturn = ReorderDepartmentRow(dtReturn, deptID, dtDept, 1);
            }

            #endregion

            return(dtReturn);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取机构信息
        /// </summary>
        /// <returns></returns>
        private static DataTable GetDeptInfo()
        {
            //获取公司代码
            string companyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
            //查询机构信息
            DataTable dtDept = UserDeptSelectDBHelper.GetDeptInfo(companyCD);

            //机构信息不存在时,返回
            if (dtDept == null || dtDept.Rows.Count < 1)
            {
                return(dtDept);
            }

            //定义返回的机构信息变量
            DataTable dtReturn = new DataTable();

            //复制机构信息表结构
            dtReturn = dtDept.Clone();

            #region 机构信息排序处理
            //获取第一级机构信息
            DataRow[] drSuperDept = dtDept.Select("SuperDeptID IS NULL");
            //遍历第一级机构
            for (int i = 0; i < drSuperDept.Length; i++)
            {
                DataRow drFirstDept = (DataRow)drSuperDept[i];
                //获取机构ID
                int deptID = (int)drFirstDept["ID"];
                //导入第一级机构


                DataRow[] drSubDept = dtDept.Select("SuperDeptID = " + deptID);
                if (drSubDept.Length == 0)
                {
                    drFirstDept["DeptName"] = "<img  src =\"../../../Images/BaseDataTree/file.gif\" style=\" padding-left:15px\"/>" + drFirstDept["DeptName"];


                    dtReturn.ImportRow(drFirstDept);
                }
                else
                {
                    drFirstDept["DeptName"] = "<img  src =\"../../../Images/BaseDataTree/folderopen.gif\" style=\" padding-left:15px\"/>" + drFirstDept["DeptName"];
                    dtReturn.ImportRow(drFirstDept);
                    dtReturn = ReorderDeptRow(dtReturn, deptID, dtDept, 1);
                }
                //设定子机构
            }
            #endregion

            return(dtReturn);
        }
Ejemplo n.º 6
0
 public static DataTable GetDeptInfoByCompanyCD(string ShowType, string OprtType)
 {
     try
     {
         string companyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
         // string CompanyCD = "1001";
         DataTable dt = UserDeptSelectDBHelper.GetDeptInfo(companyCD);
         if (Convert.ToInt32(ShowType) > 1)
         {
             ShowType = string.Empty;
             OprtType = string.Empty;
         }
         if (!string.IsNullOrEmpty(ShowType) &&
             !string.IsNullOrEmpty(OprtType))
         {
             if (dt != null && dt.Rows.Count > 0)
             {
                 //单选部门
                 if (ShowType == SHOWTYEP_CODE_SELECT_DEPT && OprtType == OPRT_CODE_SELECT)
                 {
                     foreach (DataRow rows in dt.Rows)
                     {
                         rows["DeptName"] = "<input type='radio' name='select'  id='chk_" + rows["ID"] + "' value='" + rows["ID"] + "|" + rows["DeptName"].ToString() + "'   >" + rows["DeptName"].ToString();
                     }
                 }//多选部门
                  //else if (ShowType == SHOWTYEP_CODE_SELECT_DEPT && OprtType == OPRT_CODE_SELECTS)
                  //{
                  //    foreach (DataRow rows in dt.Rows)
                  //    {
                  //        rows["DeptName"] = "<input type='checkbox' name='select'  id='chk_" + rows["ID"] + "' value='" + rows["ID"] + "|" + rows["DeptName"].ToString() + "'   >" + rows["DeptName"].ToString();
                  //    }
                  //}
             }
         }
         return(dt);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }