public PageList <Sys_RoleRightResult> GetRoleRightList(Sys_RoleRightParam param) { ExeResult rst = Execute("ZNLCRM.BLL.Sys.Sys_RoleRightBLL", "GetRoleRightList", param); PageList <Sys_RoleRightResult> pageList = (rst == null ? new PageList <Sys_RoleRightResult>() : ((PageList <Sys_RoleRightResult>)rst.Result)); return(pageList); }
private WhereClip GetWhereClip(Sys_RoleRightParam param) { CheckSession(); WhereClip where = Sys_RoleRight._.IsDeleted == 0; if (param.RoleRightID > 0) { where = where && Sys_RoleRight._.RoleRightID == param.RoleRightID; } if (param.GCompanyID != Guid.Empty) { where = where && Sys_RoleRight._.GCompanyID == param.GCompanyID; } if (param.RoleID > 0) { where = where && Sys_RoleRight._.RoleID == param.RoleID; } if (param.ModuleID > 0) { where = where && Sys_RoleRight._.RoleID == param.ModuleID; } if (param.ActionCode != null) { where = where && Sys_RoleRight._.ActionCode.Like("%" + param.ActionCode + "%"); } return(where); }
/// <summary> /// 加载角色权限 /// </summary> /// private void BindDataGridView(int pageIndex) { if (_roleID <= 0) { return; } Sys_RoleRightParam param = new Sys_RoleRightParam(); param.RoleID = _roleID; param.PageIndex = pageIndex; param.PageSize = 100; param.MenuCode = this.txfMenuCode.Text; param.ModuleName = txfModuleName.Text; PageList <Sys_RoleRightResult> pgList = roleRightLogic.GetRoleRightList(param); if (pgList.ResultJoinList != null && pgList.ResultJoinList.Rows.Count > 0) { foreach (DataRow row in pgList.ResultJoinList.Rows) { string actionCode = row["ActionCode"].ToStringHasNull(); if (string.IsNullOrEmpty(actionCode)) { continue; } row["RightName"] = GetRightName(actionCode); } } dgvModule.DataSource = pgList.ResultJoinList; pgModule.RecordCount = pgList.TotalCount; }
public WCFAddUpdateResult DelInfo(Sys_RoleRightParam param) { var ret = new WCFAddUpdateResult(); if (param.RoleRightID <= 0) { ShowMessage("请指定要删除的记录!"); return(ret); } ExeResult rst = Execute("ZNLCRM.BLL.Sys.Sys_RoleRightBLL", "DelInfo", param); ret = (rst == null ? new WCFAddUpdateResult() : rst.Result as WCFAddUpdateResult); return(ret); }
public Sys_RoleRightResult GetInfo(Sys_RoleRightParam param) { var ret = new Sys_RoleRightResult(); if (param.RoleRightID.ToInt32() <= 0) { ShowMessage("请指定要修改的记录!"); return(ret); } ExeResult rst = Execute("ZNLCRM.BLL.Sys.Sys_RoleRightBLL", "GetInfo", param); ret = rst == null ? new Sys_RoleRightResult() : rst.Result as Sys_RoleRightResult; return(ret); }
public PageList <Sys_RoleRightResult> GetRoleRightList(Sys_RoleRightParam param) { this.CheckSession(); PageList <Sys_RoleRightResult> pagelist = new PageList <Sys_RoleRightResult>(); WhereClip whereClip = Sys_RoleRight._.IsDeleted == 0 && Sys_Module._.IsDeleted.At("b") == 0; WhereClip onWhereClip = Sys_RoleRight._.ModuleID == Sys_Module._.ModuleID.At("b"); if (!string.IsNullOrEmpty(param.ModuleName)) { whereClip = whereClip && Sys_Module._.ModuleName.At("b").Like("%" + param.ModuleName + "%"); } if (!string.IsNullOrEmpty(param.MenuCode)) { WhereClip whereClipOr = WhereClip.All; string[] arrMenuCode = param.MenuCode.Split(','); foreach (string s in arrMenuCode) { whereClipOr = whereClipOr && Sys_Module._.ModuleCode.At("b").Like(param.MenuCode + "%"); } if (arrMenuCode.Length > 0) { whereClip = whereClip && (whereClipOr); } } List <Field> fields = new List <Field> { Sys_RoleRight._.RoleRightID, Sys_RoleRight._.RoleID, Sys_RoleRight._.ModuleID, Sys_RoleRight._.GCompanyID, Sys_RoleRight._.ActionCode, Sys_Module._.ModuleName.At("b"), Sys_Module._.ActionCode.At("b").As("BaseActionCode") }; if (param.RoleID > 0) { whereClip = whereClip && Sys_RoleRight._.RoleID == param.RoleID; } pagelist = this.SelectList <Sys_RoleRightResult, Sys_Module>(JoinType.InnerJoin, onWhereClip, param.PageIndex.GetValueOrDefault(1).ToInt32(), param.PageSize.GetValueOrDefault(50).ToInt32(), fields, whereClip, null, null, null); pagelist.ResultJoinList.Columns.Add("RightName"); return(pagelist); }
private void tlbDelModule_Click(object sender, EventArgs e) { DataGridViewRow dr = dgvModule.CurrentRow; if (dr == null) { return; } string moduleName = dr.Cells["colModuleName"].Value.ToStringHasNull(); int roleRightID = dr.Cells["colRoleRightID"].Value.ToInt32(); if (MessageBox.Show(@"是否真的删除当前角色下的'" + moduleName + @"'模块?", @"删除提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } Sys_RoleRightParam info = new Sys_RoleRightParam { RoleRightID = roleRightID }; this.AsyncExecute(info, roleRightLogic.DelInfo, a => BindDataGridView(1)); }
/// <summary> /// 删除角色 /// </summary> /// <param name="param"></param> /// <returns></returns> public WCFAddUpdateResult DelInfo(Sys_RoleRightParam param) { CheckSession(); var ret = new WCFAddUpdateResult(); try { #region 判断 if (param.RoleRightID.ToInt32() <= 0) { throw new WarnException("请指定要删除的权限ID!"); } #endregion WhereClip where = GetWhereClip(param); var info = new Sys_RoleRightResult { IsDeleted = true }; var affect = Update(info, @where); #region 设置返回值 ret.Key = affect; #endregion } catch (WarnException) { throw; } catch (Exception exp) { LogInfoBLL.WriteLog(SessionInfo, exp); } return(ret); }
/// <summary> /// 获取一条角色信息记录 /// </summary> /// <param name="param"></param> /// <returns></returns> public Sys_RoleRightResult GetInfo(Sys_RoleRightParam param) { CheckSession(); #region 判断 if (param.RoleRightID.ToInt32() <= 0) { throw new WarnException("请指定ID!"); } #endregion #region 保存实体 WhereClip where = Sys_RoleRight._.RoleRightID == param.RoleRightID; // if (param.ActionCode != null) where = where && Sys_RoleRight._.ActionCode.Like("%" + param.ActionCode + "%"); var rst = Select <Sys_RoleRightResult>(@where); #endregion return(rst); }