Пример #1
0
        public int CreateRole(RoleBLL role)
        {
            int proposedReturnValue = 0;

            proposedReturnValue = _context.CreateRole(role.RoleName);
            return(proposedReturnValue);
        }
Пример #2
0
    protected void btn_Delete_Click(object sender, ImageClickEventArgs e)
    {
        string idList = string.Empty;
        foreach (GridViewRow dr in GridView1.Rows)
        {
            CheckBox chk = (CheckBox)dr.FindControl("chk");
            if (chk != null && chk.Checked)
            {
                string _id = "'" + dr.Cells[1].Text.Trim() + "'";
                string _name = dr.Cells[2].Text.Trim();
                if (_name == "系统管理员" || _name == "超级管理员" || _id.Substring(3, 4) == "0000")
                {
                    UtilityService.Alert(this.Page, "禁止删除管理员及默认人员类别");
                    return;
                }

                idList += _id + ",";
            }

        }
        if (idList.Length > 0)
        {
            idList = idList.TrimEnd(',');
            bool re = new RoleBLL().DeleteList(idList);
            if (re)
            {
                UtilityService.AlertAndRedirect(this.Page, "删除成功!", "RoleMgr.aspx");
            }
            else
            {
                UtilityService.Alert(this.Page, "删除失败!");
            }
        }
    }
Пример #3
0
        public ActionResult Save()
        {
            Role role = new Role();
            try
            {
                string stated = Request.Form["stated"];
                role.Id = Convert.ToInt32(Request.Form["Id"]);
                role.roleName = Request.Form["roleName"];
                role.roleRemark = Request.Form["roleRemark"];

                RoleBLL rbll = new RoleBLL();
                if (stated == "add")
                {
                    if (rbll.AddEntity(role))
                    {
                        return Content("{'success':'ok'}");
                    }
                }
                else if (stated == "update")
                {
                    if (rbll.ModifyEntity(role))
                    {
                        return Content("{'success':'ok'}");
                    }
                }
            }
            catch { }
            return Content("{}");
        }
Пример #4
0
        public ActionResult GetEmployee()
        {
            try
            {
                int pageIndex = Convert.ToInt32(Request.QueryString["page"]);
                int pageSize = Convert.ToInt32(Request.QueryString["limit"]);
                string branchIds = Request.QueryString["id"];
                string[] _ids = branchIds.Split(',');
                int[] ids = Array.ConvertAll<string, int>(_ids, id =>
                {
                    return int.Parse(id);
                });
                EmployeeBLL eBll = new EmployeeBLL();
                int rows = 0;
                int totalPages = 0;
                List<Employee> list = eBll.LoadPagedEntitys(pageIndex, pageSize, out rows, out totalPages, t => ids.Contains(t.branchId), true, t => t.Id);
                if (list != null && list.Count > 0)
                {
                    List<Branch> branchList = new BranchBLL().GetEntitys();
                    list.ForEach(t =>
                    {
                        branchList.ForEach(y =>
                        {
                            if (t.branchId == y.Id)
                            {
                                t.branchName = y.branchName;
                            }
                        });
                    });
                    List<Role> roleList = new RoleBLL().GetEntitys();
                    list.ForEach(t =>
                    {
                        roleList.ForEach(y =>
                        {
                            if (t.roleId == y.Id)
                            {
                                t.roleName = y.roleName;
                            }
                        });
                    });
                    List<Position> positionList = new PositionBLL().GetEntitys();
                    list.ForEach(t =>
                    {
                        positionList.ForEach(y =>
                        {
                            if (t.positionId == y.Id)
                            {
                                t.positionName = y.positionName;
                            }
                        });
                    });
                }
                string resJson = Common.Common.JsonSerialize(list);
                resJson = "{total:" + rows + ",root:" + resJson + "}";
                return Content(resJson);
            }
            catch { }

            return Content("{}");
        }
Пример #5
0
 public static RoleBLL getInstance()
 {
     if (instace == null)
     {
         instace = new RoleBLL();
     }
     return(instace);
 }//End getInstance()
Пример #6
0
 public void LoadService()
 {
     string code = Request.QueryString["Code"].ToString();
     Model.Role _p = new RoleBLL().GetModel(code);
     if (_p != null)
     {
         lab_Code.Text = _p.RoleCode;
         txt_Name.Text = _p.RoleName;
         hind_OrganID.Value = _p.OrganID.ToString();
     }
 }
Пример #7
0
        public RoleBLL FindRoleByID(int RoleID)
        {
            RoleBLL ProposedReturnValue = null;
            RoleDAL DataLayerObject     = _context.FindRoleByID(RoleID);

            if (null != DataLayerObject)
            {
                ProposedReturnValue = new RoleBLL(DataLayerObject);
            }
            return(ProposedReturnValue);
        }
Пример #8
0
        public List <RoleBLL> GetRoles(int skip, int take)
        {
            List <RoleBLL> ProposedReturnValue    = new List <RoleBLL>();
            List <RoleDAL> ListOfDataLayerObjects = _context.GetRoles(skip, take);

            foreach (RoleDAL role in ListOfDataLayerObjects)
            {
                RoleBLL BusinessObject = new RoleBLL(role);
                ProposedReturnValue.Add(BusinessObject);
            }
            return(ProposedReturnValue);
        }
Пример #9
0
 public ActionResult DeleteRole()
 {
     string ids = Request.Form["ids"];
     RoleBLL rbll = new RoleBLL();
     if (rbll.DeletePhysicsById(ids))
     {
         return Content("{'success':'ok'}");
     }
     else
     {
         return Content("{}");
     }
 }
Пример #10
0
        public ActionResult GetAllRole()
        {
            int pageIndex = Convert.ToInt32(Request.QueryString["page"]);
            int pageSize = Convert.ToInt32(Request.QueryString["limit"]);
            RoleBLL rbll = new RoleBLL();
            int rows = 0;
            int totalPages = 0;
            List<Role> roleList = rbll.LoadPagedEntitys(pageIndex, pageSize, out rows, out totalPages, t => t.Id > 0, true, t => t.Id);
            //roleList.ForEach(t => {
            //    t.Employee = null;
            //});
            string resJson = Common.Common.JsonSerialize(roleList);
            resJson = "{total:" + rows + ",root:" + resJson + "}";

            return Content(resJson);
        }
Пример #11
0
    protected void btn_Modity_Click(object sender, EventArgs e)
    {
        if (txt_Name.Text.Trim() == "系统管理员" || txt_Name.Text.Trim() == "超级管理员")
        {
            UtilityService.Alert(this.Page, "该名称是非法名,请换一个角色名称!");
            return;
        }

        Model.Role r = new Model.Role();
        r.RoleCode = lab_Code.Text;
        r.RoleName = txt_Name.Text.Trim();

        bool re = new RoleBLL().Update(r);
        if (re)
        {
            UtilityService.AlertAndRedirect(this, "修改成功!", "RoleMgr.aspx");
        }
        else
        {
            UtilityService.Alert(this, "修改失败!");
        }
    }
Пример #12
0
    protected void btn_Add_Click(object sender, EventArgs e)
    {
        if (txt_Name.Text.Trim() == "系统管理员" || txt_Name.Text.Trim() == "超级管理员")
        {
            UtilityService.Alert(this.Page, "该名称是非法名,请换一个角色名称!");
            return;
        }

        Model.Role r = new Model.Role();
        r.RoleName = txt_Name.Text.Trim();
        r.OrganID = (int)Session["OrganID"];
        r.InputBy = Session["UserID"].ToString();

        int re = new RoleBLL().Add(r);
        if (re > 0)
        {
            UtilityService.AlertAndRedirect(this, "添加成功!", "RoleMgr.aspx");
        }
        else
        {
            UtilityService.Alert(this, "添加失败!");
        }
    }
Пример #13
0
    private string AddRole(string name, int organID)
    {
        if (name == string.Empty || name == "无")
        {
            return "";
        }
        RoleBLL pBLL = new RoleBLL();
        bool _re = pBLL.Exists(name, organID);
        if (!_re)
        {
            Role p = new Role();
            p.RoleName = name;

            p.OrganID = organID;
            p.InputBy = Session["UserID"].ToString();

            int re = pBLL.Add(p);
        }

        string _Code = pBLL.GetRoleCode(name, organID);
        return _Code;
    }
Пример #14
0
 public void DeleteRole(RoleBLL Role)
 {
     _context.DeleteRole(Role.RoleID);
 }