/// <summary> /// 库管员 /// </summary> /// <returns></returns> public bool GetKG() { SYS_RoleInfo sysRoleDal = new SYS_RoleInfo(); //用户角色关系表 bool resVisit = false; VerifyPage("", false); var user = Session["CurrentUser"] as OrgUsers; if (user != null) { List <SqlParameter> parameters = new List <SqlParameter>(); string sqlWhe = " Role_Id in (select Role_Id from dbo.SYS_RoleInfo where Role_Name like '%库管%' or Role_Name like '%物流经理%') and UID=@UID"; var parameter = new SqlParameter("@UID", DbType.AnsiString); parameter.Value = user.UId; parameters.Add(parameter); DataSet dts = sysRoleDal.GetListAdmin(sqlWhe, parameters); if (dts != null) { if (dts.Tables[0].Rows.Count > 0) { resVisit = true; } } } return(resVisit); }
protected void Page_Load(object sender, EventArgs e) { string action = Web9long.Web.Util.Query("action"); int roleid = 0; if (action == "edit"||action=="view") { if (!int.TryParse(Web9long.Web.Util.Query("id"), out roleid)) Web9long.Web.Clew.AlertBack("参数错误"); } if (!IsPostBack) { //绑定频道信息 rpt_List_Channel.DataSource = bll.GetDataTable("select CL_ID,CL_Title,CL_Name from SYS_Channel order by CL_Sort desc,CL_ID desc"); rpt_List_Channel.DataBind(); //系统设置 this.rptList1.DataSource = GetPowersByType(1); this.rptList1.DataBind(); //会员管理 this.rptList2.DataSource = GetPowersByType(2); this.rptList2.DataBind(); //插件管理 this.rptList3.DataSource = GetPowersByType(3); this.rptList3.DataBind(); //报表中心 this.rptList4.DataSource = GetPowersByType(4); this.rptList4.DataBind(); if (action == "edit"||action=="view") { RoleInfo etyRole = Loneu.BLL.Manage.RoleDAL.GetRoleInfo(roleid); if (etyRole == null) Web9long.Web.Clew.AlertBack("角色不存在或已被删除!"); etyRoleInfo = etyRole.RoleBaseInfo; txtRoleName.Text = etyRoleInfo.RD_RoleName; ddlRoleType.SelectedValue = etyRoleInfo.RD_RoleType.Trim(); if (etyRole.RolePower != null) ShowPower(etyRole.RolePower); if (action == "view") btnSubmit.Visible = false; btnSubmit.Text = "提交修改"; txtRoleID.Value = etyRoleInfo.RD_RoleID.ToString(); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { bool rs = false; string url = "Role_List.aspx"; string rolename = Web9long.DB.SQLUtility.Replace(this.txtRoleName.Text); rs = Loneu.BLL.Manage.RoleDAL.CheckName(txtRoleID.Value.Trim(), rolename); if (!rs) Web9long.Web.Clew.AlertBack("角色名称不能重复"); RoleInfo ety = new RoleInfo(); //初始基本信息 etyRoleInfo = new SYS_RoleInfo(); etyRoleInfo.RD_RoleName = txtRoleName.Text; etyRoleInfo.RD_RoleType = ddlRoleType.SelectedValue; int roleID = 0; if (!int.TryParse(txtRoleID.Value.Trim(), out roleID)) roleID = 0; etyRoleInfo.RD_RoleID = roleID; ety.RoleBaseInfo = etyRoleInfo; //角色权限信息 ety.RolePower = GetRolePowerList(); if (roleID > 0) { base.ChkAdminLevel("sys_role", "view"); } else { base.ChkAdminLevel("sys_role", "add"); } rs = Loneu.BLL.Manage.RoleDAL.EditRole(ety); Web9long.Web.Clew.Alert("操作" + (rs ? "成功" : "失败") + "!", url); }