/// <summary> /// 角色与用户关联信息修改 /// </summary> /// <param name="model">角色与用户关联信息</param> /// <returns>更新成功与否</returns> public static bool UpdateUserRole(UserRoleModel model) { //获取登陆用户ID string loginUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID; return(UserRoleDBHelper.UpdateUserRole(model, loginUserID)); }
/// <summary> /// 根据用户ID获取用户信息 /// </summary> /// <param name="UserID"></param> /// <returns></returns> public static DataTable GetUserRoleInfo(string UserID) { DataTable dt_UserInfo = null; if (!string.IsNullOrEmpty(UserID)) { dt_UserInfo = UserRoleDBHelper.GetUserRoleInfo(UserID); return(dt_UserInfo); } return(dt_UserInfo); }
/// <summary> /// 获取用户的角色 /// </summary> /// <param name="UserID">用户ID</param> /// <returns>DataTable</returns> //public static DataTable GetUserRoleWithUserID(string UserID) //{ // try // { // return UserRoleDBHelper.GetUserRoleWithUserID(UserID); // } // catch (System.Exception ex) // { // throw ex; // } //} /// <summary> /// 删除角色与用户关联信息 /// </summary> /// <returns>DataTable</returns> public static bool DeleteUserRole(string UserID, string RoleID) { try { return(UserRoleDBHelper.DeleteUserRole(UserID, RoleID)); } catch (System.Exception ex) { throw ex; } }
/// <summary> /// 登陆用户的角色 /// </summary> /// <param name="userID">用户ID</param> /// <param name="companyCD">公司代码</param> /// <param name="roleList">角色集</param> /// <returns>插入成功与否</returns> public static bool InsertUserRoleWithList(string userID, string companyCD, string[] roleList) { //获取登陆用户ID UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //登陆日志 try { bool succ = false; LogInfoModel logModel = InitLogInfo(roleList); logModel.Element = ConstUtil.LOG_PROCESS_INSERT; string loginUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID; // 待修改userrole ArrayList arr = new ArrayList(); for (int i = 0; i < roleList.Length; i++) { if (roleList[i] != "0") { arr.Add(roleList[i]); } } string[] roleidlist = (string[])arr.ToArray(typeof(string));//讲array转换为string[] succ = UserRoleDBHelper.InsertUserRoleWithList(userID, companyCD, roleidlist, loginUserID); if (!succ) { logModel.Remark = ConstUtil.LOG_PROCESS_FAILED; } else { logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS; } for (int i = 0; i < roleList.Length; i++) { if (roleList[i] != "0") { logModel.ObjectID = roleList[i]; LogDBHelper.InsertLog(logModel); } } return(succ); } catch (Exception ex) { WriteSystemLog(userInfo, ex); return(false); } }
/// <summary> /// 根据查询条件返回结果集 /// </summary> /// <param name="RoleID"></param> /// <param name="UserID"></param> /// <param name="UserName"></param> /// <returns></returns> public static DataTable GetUserRoleByConditions(string RoleID, string UserID, string UserName, int pageIndex, int pageCount, string OrderBy, ref int totalCount) { string companyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; return(UserRoleDBHelper.GetUserRoleByConditions(companyCD, RoleID, UserID, UserName, pageIndex, pageCount, OrderBy, ref totalCount)); }