Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
                {
                    int userId = (Convert.ToInt32(Request.Params["id"]));

                    BLL.dept placeBll = new BLL.dept();
                    ddrPlace.DataTextField  = "deptName";
                    ddrPlace.DataValueField = "deptId";
                    ddrPlace.DataSource     = placeBll.GetList("");
                    ddrPlace.DataBind();
                    ddrPlace.Items.Insert(0, new ListItem("请选择", "0"));

                    BLL.role roleBll = new BLL.role();
                    ddrRole.DataTextField  = "roleName";
                    ddrRole.DataValueField = "roleId";
                    ddrRole.DataSource     = roleBll.GetList("roleId<>1");
                    ddrRole.DataBind();

                    try
                    {
                        ShowInfo(userId);
                    }
                    catch (Exception ex)
                    { }
                }
            }
        }
Example #2
0
 /// <summary>
 /// 绑定上级部门列表
 /// </summary>
 /// <param name="ddl"></param>
 /// <returns></returns>
 public static bool AddDeptPaeent(DropDownList ddl)
 {
     try
     {
         ddl.Items.Clear();
         BLL.dept  deptBll = new BLL.dept();
         DataTable dt      = deptBll.GetList("parentId=0").Tables[0];
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             ddl.Items.Add(new ListItem(dt.Rows[i]["deptName"].ToString(), dt.Rows[i]["deptId"].ToString()));
             DataTable dt2 = deptBll.GetList("parentId=" + dt.Rows[i]["deptId"].ToString()).Tables[0];
             for (int j = 0; j < dt2.Rows.Count; j++)
             {
                 ddl.Items.Add(new ListItem("┣" + dt2.Rows[j]["deptName"].ToString(), dt2.Rows[j]["deptId"].ToString()));
                 DataTable dt3 = deptBll.GetList("parentId=" + dt2.Rows[j]["deptId"].ToString()).Tables[0];
                 for (int k = 0; k < dt3.Rows.Count; k++)
                 {
                     ddl.Items.Add(new ListItem("┣╍" + dt3.Rows[k]["deptName"].ToString(), dt3.Rows[k]["deptId"].ToString()));
                 }
             }
         }
         ddl.Items.Insert(0, new ListItem("无上级", "0"));
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                StringBuilder strWhere = new StringBuilder();
                strWhere.Append("roleId=2 ");
                if (Common.Cookie.GetValue(StatusHelpercs.Cookie_Admin_IsAdmin) != "1")
                {
                    BLL.dept pBll = new BLL.dept();
                    strWhere.Append(" and deptId in (" + pBll.GetAllChild(int.Parse(Request.Cookies["deptId"].Value)) + ") ");
                }
                rptList.DataSource = bll.GetList(strWhere.ToString() + " order by addTime desc");
                rptList.DataBind();
            }

            if (RequsetAjax("del"))
            {
                //删除
                try
                {
                    string userId = Request.Form["userId"].ToString();
                    bll.Delete(int.Parse(userId));

                    Response.Write("{\"status\":1,\"msg\":\"成功!\"}");
                }
                catch { Response.Write("{\"status\":0,\"msg\":\"失败!\"}"); }
                Response.End();
            }
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BLL.dept pBll     = new BLL.dept();
                string   placeSql = "";
                string   roleSql  = "roleId<>1";
                if (Request.Cookies["isAdmin"].Value != "1")
                {
                    placeSql = " deptId in (" + pBll.GetAllChild(int.Parse(Request.Cookies["deptId"].Value)) + ") ";
                    roleSql  = "roleId>2";
                }

                ClassHelper.AddDeptList(ddrPlace);

                BLL.role roleBll = new BLL.role();
                ddrRole.DataTextField  = "roleName";
                ddrRole.DataValueField = "roleId";
                ddrRole.DataSource     = roleBll.GetList(roleSql);
                ddrRole.DataBind();
                ddrRole.Items.Insert(0, new ListItem("请选择", "0"));
                ddrRole.SelectedValue = "2";
                ddrRole.Enabled       = false;
            }
        }
Example #5
0
        /// <summary>
        /// 绑定上级部门列表
        /// </summary>
        /// <param name="ddl"></param>
        /// <returns></returns>
        public static bool AddDeptPaeent(DropDownList ddl)
        {
            try
            {
                ddl.Items.Clear();
                BLL.dept deptBll = new BLL.dept();
                DataTable dt = deptBll.GetList("parentId=0").Tables[0];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ddl.Items.Add(new ListItem(dt.Rows[i]["deptName"].ToString(), dt.Rows[i]["deptId"].ToString()));
                    DataTable dt2 = deptBll.GetList("parentId=" + dt.Rows[i]["deptId"].ToString()).Tables[0];
                    for (int j = 0; j < dt2.Rows.Count; j++)
                    {
                        ddl.Items.Add(new ListItem("┣" + dt2.Rows[j]["deptName"].ToString(), dt2.Rows[j]["deptId"].ToString()));
                        DataTable dt3 = deptBll.GetList("parentId=" + dt2.Rows[j]["deptId"].ToString()).Tables[0];
                        for (int k = 0; k < dt3.Rows.Count; k++)
                        {
                            ddl.Items.Add(new ListItem("┣╍" + dt3.Rows[k]["deptName"].ToString(), dt3.Rows[k]["deptId"].ToString()));

                        }
                    }
                }
                ddl.Items.Insert(0, new ListItem("无上级", "0"));
                return true;
            }
            catch
            {
                return false;
            }
        }
Example #6
0
        private void TreeBind(DropDownList ddl)
        {
            BLL.dept  bll = new BLL.dept();
            DataTable dt  = bll.GetList("").Tables[0];

            ddl.Items.Clear();
            ddl.Items.Add(new ListItem("请选择部门...", ""));
            foreach (DataRow dr in dt.Rows)
            {
                ddl.Items.Add(new ListItem(dr["dept_name"].ToString(), dr["id"].ToString()));
            }
        }
Example #7
0
        private void TreeBind(string strWhere)
        {
            BLL.dept  bll = new BLL.dept();
            DataTable dt  = bll.GetList(0, strWhere, "id desc").Tables[0];

            this.ddlDeptId.Items.Clear();
            this.ddlDeptId.Items.Add(new ListItem("所有部门", ""));
            foreach (DataRow dr in dt.Rows)
            {
                this.ddlDeptId.Items.Add(new ListItem(dr["dept_name"].ToString(), dr["id"].ToString()));
            }
        }
Example #8
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page             = DTRequest.GetQueryInt("page", 1);
            this.txtKeywords.Text = this.keywords;
            BLL.dept bll = new BLL.dept();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("dept_list.aspx", "keywords={0}&page={1}", this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Example #9
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("sys_dept", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     BLL.dept bll = new BLL.dept();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked && GetAdminInfo().id != id)
         {
             bll.Delete(id);
         }
     }
     JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("dept_list.aspx", "keywords={0}", this.keywords), "Success");
 }
Example #10
0
        private bool DoEdit(int _id)
        {
            bool result = true;

            BLL.dept   bll   = new BLL.dept();
            Model.dept model = bll.GetModel(_id);

            model.dept_name = txtDeptName.Text.Trim();

            if (!bll.Update(model))
            {
                result = false;
            }

            return(result);
        }
Example #11
0
        private bool DoAdd()
        {
            bool result = true;

            Model.dept model = new Model.dept();
            BLL.dept   bll   = new BLL.dept();

            model.dept_name = txtDeptName.Text.Trim();
            model.add_time  = DateTime.Now;

            if (bll.Add(model) < 1)
            {
                result = false;
            }
            return(result);
        }
Example #12
0
        public void BindData()
        {
            #region
            //if (!Context.User.Identity.IsAuthenticated)
            //{
            //    return;
            //}
            //AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name);
            //if (user.HasPermissionID(PermId_Modify))
            //{
            //    gridView.Columns[6].Visible = true;
            //}
            //if (user.HasPermissionID(PermId_Delete))
            //{
            //    gridView.Columns[7].Visible = true;
            //}
            #endregion

            DataSet       ds       = new DataSet();
            StringBuilder strWhere = new StringBuilder();
            strWhere.Append("roleId=2 ");
            if (txtKeyword.Text.Trim() != "")
            {
                strWhere.AppendFormat(" and userName like '%{0}%'", txtKeyword.Text.Trim());
            }
            if (Request.Cookies["isAdmin"].Value != "1")
            {
                BLL.dept pBll = new BLL.dept();
                strWhere.Append(" and deptId in (" + pBll.GetAllChild(int.Parse(Request.Cookies["deptId"].Value)) + ") ");
            }
            ds = bll.GetList(strWhere.ToString());
            string[] arr = { "冻结", "正常" };
            Common.CommonHelper.AddDtColumns(ds.Tables[0], "status", arr);
            gridView.DataSource = ds;
            gridView.DataBind();
        }
Example #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BLL.dept pBll = new BLL.dept();
                string placeSql = "";
                string roleSql = "roleId<>1";
                if (Request.Cookies["isAdmin"].Value != "1")
                {
                    placeSql = " deptId in (" + pBll.GetAllChild(int.Parse(Request.Cookies["deptId"].Value)) + ") ";
                    roleSql = "roleId>2";
                }

                ClassHelper.AddDeptList(ddrPlace);

                BLL.role roleBll = new BLL.role();
                ddrRole.DataTextField = "roleName";
                ddrRole.DataValueField = "roleId";
                ddrRole.DataSource = roleBll.GetList(roleSql);
                ddrRole.DataBind();
                ddrRole.Items.Insert(0, new ListItem("请选择", "0"));

            }
        }
Example #14
0
 private void ShowInfo(int _id)
 {
     BLL.dept   bll   = new BLL.dept();
     Model.dept model = bll.GetModel(_id);
     txtDeptName.Text = model.dept_name;
 }
Example #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
                {
                    int userId=(Convert.ToInt32(Request.Params["id"]));

                    BLL.dept placeBll = new BLL.dept();
                    ddrPlace.DataTextField = "deptName";
                    ddrPlace.DataValueField = "deptId";
                    ddrPlace.DataSource = placeBll.GetList("");
                    ddrPlace.DataBind();
                    ddrPlace.Items.Insert(0,new ListItem("请选择","0"));

                    BLL.role roleBll = new BLL.role();
                    ddrRole.DataTextField = "roleName";
                    ddrRole.DataValueField = "roleId";
                    ddrRole.DataSource = roleBll.GetList("roleId<>1");
                    ddrRole.DataBind();

                    try
                    {
                        ShowInfo(userId);
                    }
                    catch (Exception ex)
                    { }

                }
            }
        }