Exemplo n.º 1
0
 /// <summary>
 /// 用户所在部门的处室或科室
 /// </summary>
 /// <param name="iFloorCode"> >0:自己  >0:子部门层数, -1:所有</param>
 /// <returns></returns>
 public ViewBase GetChildOrParentDepts(int iFloorCode)
 {
     Department dpt = new Department();
     string strDepts = string.Empty;
     foreach (Department dept in this.Depts.Ens)
     {
         if (strDepts.Length > 0 && !strDepts.EndsWith(","))
         {
             strDepts += ",";
         }
         strDepts += dpt.GetParentDeptID(dept);
     }
     strDepts = strDepts.Length > 0 && strDepts.EndsWith(",") ? strDepts.Substring(0, strDepts.Length - 1) : strDepts;
     ViewBase vwDept = new ViewDepartment();
     string strCondition = strDepts.Length > 0 ? "(a.ID IN (" + strDepts + ") OR a.ID IN(" + this.Depts.IDs + "))" : " a.ID IN(" + this.Depts.IDs + ")";
     if (iFloorCode == 0)
     {
         strCondition = " a.ID IN(" + this.Depts.IDs + ")";
     }
     else if (iFloorCode > 0)
     {
         strCondition += " AND a.FloorCode =" + iFloorCode.ToString();
     }
     vwDept.BaseCondition = strCondition;
     return vwDept;
 }
Exemplo n.º 2
0
        /// <summary>
        /// 绑定子部门
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="strCount"></param>
        /// <param name="seleceid"></param>
        private void BindChildDept1(string pid, string strCount, int seleceid)
        {
            strCount = "";
            ViewDepartment vbDepts = new ViewDepartment(true);
            vbDepts.BaseCondition = "a.ParentID=" + pid;
            foreach (Department dept in vbDepts.Ens)
            {
                int level = int.Parse(dept.FloorCode.ToString());
                while (level != 0)
                {
                    strCount += " ";
                    level--;

                }
                if (dept.ID == seleceid)
                {
                    this.m_strDeptHtml += "<option selected value='" + dept.ID.ToString() + "'>" + strCount + "├" + dept.Name + "</option>";
                }
                else
                {
                    this.m_strDeptHtml += "<option value='" + dept.ID.ToString() + "'>" + strCount + "├" + dept.Name + "</option>";
                }
                this.BindChildDept1(dept.ID.ToString(), strCount, seleceid);
                if (level == 0)
                {
                    strCount = "";
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 当前用户所在部门的所有字部门
 /// </summary>
 /// <returns></returns>
 public ViewBase GetChildDeptConSelf()
 {
     Department dpt = new Department();
     string strDepts = string.Empty;
     foreach (Department dept in this.Depts.Ens)
     {
         if (strDepts.Length > 0 && !strDepts.EndsWith(","))
         {
             strDepts += ",";
         }
         strDepts += dpt.GetChildDeptID(dept.ID,-1);
     }
     strDepts = strDepts.Length > 0 && strDepts.EndsWith(",") ? strDepts.Substring(0, strDepts.Length - 1) : strDepts;
     ViewBase vwDept = new ViewDepartment();
     vwDept.BaseCondition = strDepts.Length > 0 ? "(a.ID IN (" + strDepts + ") OR a.ID IN(" + this.Depts.IDs + "))" : " a.ID IN(" + this.Depts.IDs + ")";
     return vwDept;
 }
Exemplo n.º 4
0
        /// <summary>
        /// 绑定部门,选中给定的部门ID的部门
        /// </summary>
        public string BindDept1(int iDeptID)
        {
            string strCount = "";
            ViewDepartment vbDepts = new ViewDepartment(true);
            vbDepts.BaseCondition = "a.ParentID=0";
            this.m_strDeptHtml = "<option value='-1'>├选择部门</option>";
            foreach (Department dept in vbDepts.Ens)
            {
                strCount = "";
                if (dept.ID == iDeptID)
                {
                    this.m_strDeptHtml += "<option selected value='" + dept.ID.ToString() + "'>" + "├" + dept.Name + "</option>";
                }
                else
                {
                    this.m_strDeptHtml += "<option value='" + dept.ID.ToString() + "'>" + "├" + dept.Name + "</option>";
                }

                this.BindChildDept1(dept.ID.ToString(), strCount, iDeptID);
            }
            return m_strDeptHtml;
        }