Beispiel #1
0
        public ActionResult UserRole(UserRoleModel model)
        {
            var result = new Result();

            try
            {
                if (string.IsNullOrEmpty(model.UserIds))
                {
                    result.Msg = "UserId不能为空";
                    return(Json(result));
                }
                if (string.IsNullOrEmpty(model.RoleIds))
                {
                    result.Msg = "RoleId不能为空";
                    return(Json(result));
                }
                var isScussce = new UserRoleBLL().Create(model);
                if (isScussce)
                {
                    result.Msg     = "设置成功!";
                    result.Success = true;
                }
                else
                {
                    result.Msg = "设置失败!";
                }
                return(Json(result));
            }
            catch (Exception ex)
            {
                result.Msg = string.Format("设置失败!{0}", ex.Message);
                return(Json(result));
            }
        }
Beispiel #2
0
        protected void storeDepGrid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName.Equals("Add"))
                {
                    UserRoleBLL sRoleManager = new UserRoleBLL();
                    TextBox     txtname      = (TextBox)storeDepGrid.FooterRow.FindControl("txtAddname");
                    TextBox     txtDesc      = (TextBox)storeDepGrid.FooterRow.FindControl("txtAddRDesc");
                    string      roleName     = (storeDepGrid.FooterRow.FindControl("ddlAddRoleName") as DropDownList).SelectedItem.Value;

                    UserRoles roleToAdd = new UserRoles();
                    roleToAdd.UserRoleName = txtname.Text;
                    roleToAdd.Description  = txtDesc.Text;
                    int res;
                    if (int.TryParse(roleName, out res))
                    {
                        roleToAdd.SystemRoleId = res;
                        sRoleManager.Add(roleToAdd);
                    }
                }
            }
            catch (Exception exp) { }
            finally
            {
                storeDepGrid.EditIndex = -1;
                BindGrid();
            }
        }
Beispiel #3
0
 public frmReports(int report)
 {
     InitializeComponent();
     _userBLL       = new UserBLL();
     _roleBLL       = new UserRoleBLL();
     _dictionaryBLL = new DictionaryBLL();
     _paymentBLL    = new PaymentBLL();
     _poolBLL       = new PoolBLL();
     if (report == 1)
     {
         lastDate  = DateTime.Now.ToString("yyyy-MM-dd");
         firstDate = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd");
     }
     else if (report == 2)
     {
         lastDate  = DateTime.Now.ToString("yyyy-MM-dd");
         firstDate = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd");
     }
     else
     {
         firstDate         = dtpStartDate.Value.ToShortDateString();
         lastDate          = dtpEndDate.Value.ToShortDateString();
         groupDate.Visible = true;
     }
 }
        /// <summary>
        /// 设置角色的权限
        /// </summary>
        /// <returns></returns>
        public JsonResult SaveRoleAction()
        {
            string roleid    = Request["roleid"];
            string actionids = Request["actionids"];

            if (string.IsNullOrEmpty(roleid) || string.IsNullOrEmpty(actionids))
            {
                return(Json(new { result = "error", message = "参数错误" }));
            }

            string errMsg = string.Empty;

            roleActionBLL.SaveRoleAction(Convert.ToInt32(roleid), actionids.Split(','), ref errMsg);
            // 刷新当前用户的权限列表
            UserRoleBLL userRole = new UserRoleBLL();

            //AdminSystemInfo.UpdateActionList(userRole.GetAppUserActionList(AdminSystemInfo.CurrentUser.ID, SP.Models.HIS.AppActionType.AllAction));

            if (!string.IsNullOrEmpty(errMsg))
            {
                return(Json(new { result = "error", message = "参数错误" }));
            }

            //Common.LogHelper.InsertLog("设置权限", 52, "角色权限");

            return(Json(new { result = "ok", message = "权限设置成功" }));
        }
        public void BindDrpORderTo()
        {
            if (drpOrderType.SelectedValue != null && drpOrderType.SelectedValue != "5")
            {
                string    abc     = drpOrderType.SelectedValue;
                DataSet   getUser = new DataSet();
                UserRoles ur      = new UserRoles();
                ur.UserRoleId             = Convert.ToInt32(drpOrderType.SelectedValue);
                getUser                   = UserRoleBLL.GetUserRoleById(ur);
                drpOrderTo.DataSource     = getUser;
                drpOrderTo.DataTextField  = "userRoleName";
                drpOrderTo.DataValueField = "userRoleID";
                drpOrderTo.DataBind();
            }

            if (drpOrderType.SelectedValue == "5")
            {
                DataSet dsVendor = VendorBll.GetAllVendor();
                drpOrderTo.DataSource = dsVendor;
                drpOrderTo.DataSource = dsVendor;

                drpOrderTo.DataTextField  = "SupName";
                drpOrderTo.DataValueField = "Supp_ID";

                drpOrderTo.DataBind();
            }

            //GetUserRoleById
        }
Beispiel #6
0
        public JsonResult GetUserByRole(int id)
        {
            IEnumerable <UserRoleModel> ls = new List <UserRoleModel>();

            ls = new UserRoleBLL().ListUserRole(id);
            var JsonResult = Json(new { Data = ls }, JsonRequestBehavior.AllowGet);

            JsonResult.MaxJsonLength = Int32.MaxValue;
            return(JsonResult);
        }
Beispiel #7
0
        private void BindGrid()
        {
            ds = UserRoleBLL.GetAllUserRoles();
            storeDepGrid.DataSource = ds;
            storeDepGrid.DataBind();

            DropDownList depList = (DropDownList)storeDepGrid.FooterRow.FindControl("ddlAddRoleName");

            depList.DataSource = SystemRoleBLL.GetAllSystemRoles();
            depList.DataBind();
            depList.DataTextField  = "RoleName";
            depList.DataValueField = "RoleId";
            depList.DataBind();
        }
Beispiel #8
0
        public JsonResult AddNewUserRole()
        {
            string        _status    = MyEnums.enumStatus.SUCCESS.ToString();
            int           result     = 0;
            UserRoleModel usrRoleMdl = new UserRoleModel();

            usrRoleMdl.RoleID     = Convert.ToInt32(Request.Form["RoleID"].ToString());
            usrRoleMdl.EmployeeId = Convert.ToInt32(Request.Form["EmployeeID"].ToString());

            usrRoleMdl.CreatedBy   = "SYSTEM";
            usrRoleMdl.CreatedDate = DateTime.Now;
            result = new UserRoleBLL().Insert(usrRoleMdl, out _status);

            return(Json(new { Status = _status, Result = result }, JsonRequestBehavior.AllowGet));
        }
Beispiel #9
0
        public void VerifyRelationRole(HttpContext context)
        {
            var         RoleId = context.Request.QueryString["RoleId"];
            UserRoleBLL bll    = new UserRoleBLL();
            DataSet     ds     = new DataSet();
            int         b      = 0;

            if (!string.IsNullOrEmpty(RoleId))
            {
                ds = bll.GetList(" RoleId=" + RoleId + " and IsDeleted=0");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    b = ds.Tables[0].Rows[0]["RoleId"].ToInt();
                }
            }
            context.Response.Write(b);
        }
 public IHttpActionResult Get(string uid)
 {
     try
     {
         List <UserRole>             list     = new UserRoleBLL().GetListByUserID(uid);
         Response <List <UserRole> > response = new Response <List <UserRole> >
         {
             Data = list,
         };
         return(Ok(response));
     }
     catch (Exception ex)
     {
         LogHelper.WriteInfo(ex.ToString());
         return(BadRequest("异常"));
     }
 }
Beispiel #11
0
 protected void storeDepGrid_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         UserRoleBLL sRoleManager = new UserRoleBLL();
         Label       ID           = (Label)storeDepGrid.Rows[e.RowIndex].FindControl("lblUserRole_ID");
         int         selectedId   = int.Parse(ID.Text);
         UserRoles   roleToDelete = new UserRoles();//= empid.Text;
         roleToDelete.UserRoleId = selectedId;
         sRoleManager.Delete(roleToDelete);
     }
     catch (Exception exp) { }
     finally
     {
         storeDepGrid.EditIndex = -1;
         BindGrid();
     }
 }
Beispiel #12
0
        public JsonResult RemoveUserInRole(string id)
        {
            string _status         = MyEnums.enumStatus.SUCCESS.ToString();
            int    result_affected = 0;

            try
            {
                if (id != "")
                {
                    result_affected = new UserRoleBLL().Delete(Convert.ToInt32(id), out _status);
                    if (result_affected <= 0)
                    {
                        _status = "An Error occured when delete user application";
                    }
                }
            }
            catch (Exception ex)
            {
                _status = ex.Message;
            }
            return(Json(new { Status = _status, Result = result_affected }, JsonRequestBehavior.AllowGet));
        }
Beispiel #13
0
        public User createUserAndUpdateRole(User User)
        {
            using (var UserService = new UserBLL())
            {
                var RoleService = new UserRoleBLL();
                int roleId = 0;
                try
                {
                    roleId = RoleService.GetList().Where(x => x.RoleStringId == "C").FirstOrDefault().RoleId;
                    User.RoleId = roleId;
                }
                catch (Exception)
                {
                    Role newRole = RoleService.Insert(new Role { RoleStringId = "C", RoleName = "Customer" });
                    User.RoleId = newRole.RoleId;
                }

                User.RoleStringId = "C";
                User.Password = PasswordUtility.HashMyPassword(User.Password);
                return UserService.Insert(User);
            }
        }
Beispiel #14
0
        /// <summary>
        ///  根据权限获取MenuTree
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List <Hashtable> GetUserTreeList(string id)
        {
            //var menus = xDoc.GetTreeData();
            UserRoleBLL userRoleBLL = new UserRoleBLL();

            //登录失效
            if (AdminSystemInfo.CurrentUser == null)
            {
                return(new List <Hashtable>());
            }

            id = string.IsNullOrEmpty(id) ? "01" : id;

            int userId = AdminSystemInfo.CurrentUser.ID;
            //根据权限获取xml所有数据
            var menus = userRoleBLL.GetAppUserMenuList(userId);
            //获取顶级菜单
            var parentMenus = menus.Where(o => o.ParentID == Convert.ToInt32(id)).OrderBy(o => o.ORDERINDEX);

            List <Hashtable> treeList = new List <Hashtable>();

            foreach (SYS_ITEMMENU item in parentMenus)
            {
                Hashtable ht = new Hashtable();
                ht.Add("id", item.ID);
                ht.Add("text", item.TEXT);
                ht.Add("checked", item.CHECKED);

                Dictionary <string, string> attributes = new Dictionary <string, string>();
                attributes.Add("url", item.URL);
                ht.Add("attributes", attributes);
                ht.Add("state", item.STATE);
                InitMenuTreeChildren(menus, ht, item.ID);
                treeList.Add(ht);
            }
            return(treeList);
        }
Beispiel #15
0
 public frmPassiveMember()
 {
     InitializeComponent();
     _userBLL = new UserBLL();
     _roleBLL = new UserRoleBLL();
 }
        private ExtUserEvent GetExtData(UserEvent userEvent)
        {
            ExtUserEvent extUserEvent = new ExtUserEvent();

            extUserEvent.EventID      = userEvent.EventID;
            extUserEvent.ActionStatus = userEvent.ActionStatus;
            extUserEvent.Remarks      = userEvent.Remarks;
            List <UserEvent> tracks      = bll.GetList(p => p.USERAPPLYID.Equals(userEvent.UserApplyId)).OrderBy(p => p.CreateTime).ToList();
            UserInfoService  userService = new UserInfoService();
            UserRoleBLL      userRoleBLL = new UserRoleBLL();
            RoleBLL          roleBLL     = new RoleBLL();

            for (int i = 0; i < tracks.Count; i++)
            {
                string   _userID  = tracks[i].ToUser;
                UserInfo userInfo = userService.GetUserInfoByID(_userID);
                if (userInfo == null)
                {
                    tracks[i].ToUser = "";
                }
                else
                {
                    tracks[i].ToUser = userInfo.LoginName;
                }

                UserRole userrole = userRoleBLL.GetOne(p => p.USERID.Equals(_userID));
                if (userrole == null)
                {
                    tracks[i].Remarks = "";
                }
                else
                {
                    Role role = roleBLL.Get(userrole.RoleID);
                    tracks[i].Remarks = role == null ? "" : role.RoleName;
                }
            }


            //todo:20160119演示用,临时去了客服的代办信息
            extUserEvent.Tracks = tracks.Where(p => !p.Remarks.Contains("客服")).ToList();
            //extUserEvent.Tracks = tracks;

            DoctorControlBll dcBLL     = new DoctorControlBll();
            UserApply        userApply = dcBLL.GetModelUserApply(userEvent.UserApplyId);

            if (userApply != null)
            {
                extUserEvent.DoctorSuggest = userApply.DOCTORSUGGEST;

                GuideLineBLL gdBLL    = new GuideLineBLL();
                GuideLine    guidline = gdBLL.GetSimpleModel(userApply.CURRENTNODE);
                if (guidline != null)
                {
                    extUserEvent.CurrentNodeName  = guidline.Name;
                    extUserEvent.RecommendProcess = guidline.RecommendProcess;
                }
            }

            EventProductBLL epdBLL = new EventProductBLL();

            extUserEvent.Products = epdBLL.GetList(p => p.EVENTID.Equals(userEvent.EventID)).ToList();

            return(extUserEvent);
        }