protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { lblMsg.Text = ""; string roleName = txtRoleName.Text; if (String.IsNullOrEmpty(txtRoleName.Text)) { return; } LoginRoleVO loginRole = new LoginRoleVO(); loginRole.RoleName = roleName; m_AuthService.CreateLoginRole(loginRole); m_WebLogService.AddSystemLog(MsgVO.Action.新增, loginRole); lblMsg.Text = MsgVO.INSERT_OK; LoadDataToUI(); }
/// <summary> /// 刪除後台角色 /// </summary> /// <param name="loginRoleVO">被刪除的後台角色</param> public void DeleteLoginRole(LoginRoleVO loginRoleVO) { NHibernateDao.Delete(loginRoleVO); }
/// <summary> /// 更新後台角色 /// </summary> /// <param name="loginRoleVO">被更新的後台角色</param> /// <returns>更新後的後台角色</returns> public LoginRoleVO UpdateLoginRole(LoginRoleVO loginRoleVO) { NHibernateDao.Update(loginRoleVO); return loginRoleVO; }
/// <summary> /// 刪除後台角色 /// </summary> /// <param name="loginRoleVO">被刪除的後台角色</param> public void DeleteLoginRole(LoginRoleVO loginRoleVO) { LoginRoleDao.DeleteLoginRole(loginRoleVO); }
/// <summary> /// 新增後台角色 /// </summary> /// <param name="loginRoleVO">被新增的後台角色</param> /// <returns>新增後的後台角色</returns> public LoginRoleVO CreateLoginRole(LoginRoleVO loginRoleVO) { NHibernateDao.Insert(loginRoleVO); return loginRoleVO; }
/// <summary> /// 新增後台角色 /// </summary> /// <param name="loginRoleVO">被新增的後台角色</param> /// <returns>新增後的後台角色</returns> public LoginRoleVO CreateLoginRole(LoginRoleVO loginRoleVO) { return LoginRoleDao.CreateLoginRole(loginRoleVO); }
/// <summary> /// 群組是否有此功能清單的權限 /// </summary> /// <param name="role"></param> /// <param name="subFunc"></param> /// <returns></returns> private bool RoleHasMenuRight(LoginRoleVO role, MenuFuncVO subFunc) { foreach (MenuFuncVO roleHasFunc in role.MenuFuncList) { if (roleHasFunc.MenuFuncId.Equals(subFunc.MenuFuncId)) { return true; } } return false; }
/// <summary> /// 更新後台角色 /// </summary> /// <param name="loginRoleVO">被更新的後台角色</param> /// <returns>更新後的後台角色</returns> public LoginRoleVO UpdateLoginRole(LoginRoleVO loginRoleVO) { return LoginRoleDao.UpdateLoginRole(loginRoleVO); }
/// <summary> /// 判斷後台角色是否有此功能的權限 /// </summary> /// <param name="loginRoleVO">後台角色</param> /// <param name="subMenuFuncVO">後台功能</param> /// <returns>群組是否有此功能清單的權限</returns> bool IAuthService.RoleHasMenuRight(LoginRoleVO loginRoleVO, MenuFuncVO subMenuFuncVO) { foreach (MenuFuncVO roleHasFunc in loginRoleVO.MenuFuncList) { if (roleHasFunc.MenuFuncId.Equals(subMenuFuncVO.MenuFuncId)) { return true; } } return false; }
private void InitLoginRoleAndUser() { //建立後台角色 LoginRoleVO loginRoleVO = new LoginRoleVO("系統管理員"); loginRoleVO.MenuFuncList = m_AuthService.GetNotTopMenuFunc(); //角色功能權限 m_AuthService.CreateLoginRole(loginRoleVO); LoginRoleVO loginRoleVO2 = new LoginRoleVO("行銷人員"); loginRoleVO2.MenuFuncList = m_AuthService.GetNotTopMenuFunc().Where(m => !8.Equals(m.ParentMenu.MenuFuncId)).ToList(); //角色功能權限 m_AuthService.CreateLoginRole(loginRoleVO2); LoginUserVO loginUserVO = new LoginUserVO(); loginUserVO.UserId = "admin"; loginUserVO.Password = "******"; loginUserVO.FullNameInChinese = "系統管理者"; loginUserVO.FullNameInEnglish = "Administrator"; loginUserVO.LoginRoleList = new List<LoginRoleVO>(); loginUserVO.LoginRoleList.Add(loginRoleVO); loginUserVO.CreateDate = DateTime.Now; m_AuthService.CreateLoginUser(loginUserVO); LoginUserVO loginUserVO2 = new LoginUserVO(); loginUserVO2.UserId = "test"; loginUserVO2.Password = "******"; loginUserVO2.FullNameInChinese = "行銷人員"; loginUserVO2.FullNameInEnglish = "Administrator"; loginUserVO2.LoginRoleList = new List<LoginRoleVO>(); loginUserVO2.LoginRoleList.Add(loginRoleVO2); loginUserVO2.CreateDate = DateTime.Now; m_AuthService.CreateLoginUser(loginUserVO2); }