protected void DeleteExtPermissionID(int extPermissionID) { sys_ModuleExtPermissionTable se = new sys_ModuleExtPermissionTable(); se.DB_Option_Action_ = "Delete"; se.ExtPermissionID = extPermissionID; BusinessFacade.sys_ModuleExtPermissionInsertUpdate(se); EventMessage.MessageBox(1, "操作成功", "删除扩展权限成功!",Icon_Type.OK, Common.GetHomeBaseUrl(string.Format("ModuleManager.aspx?S_ID={0}&ModuleID={1}", S_ID, ModuleID))); }
/// <summary> /// 新增/删除/修改 sys_ModuleExtPermission /// </summary> /// <param name="fam">sys_ModuleExtPermissionTable实体类</param> /// <returns>返回0操正常</returns> public override int sys_ModuleExtPermissionInsertUpdate(sys_ModuleExtPermissionTable fam) { int rInt = 0; using (SqlConnection Conn = GetSqlConnection()) { SqlCommand cmd = new SqlCommand("sys_ModuleExtPermissionInsertUpdateDelete", Conn); cmd.CommandType = CommandType.StoredProcedure; //设置参数 cmd.Parameters.Add("@DB_Option_Action_", SqlDbType.NVarChar).Value = fam.DB_Option_Action_; //操作方法 Insert:增加 Update:修改 Delete:删除 Disp:显示单笔记录 cmd.Parameters.Add("@ExtPermissionID", SqlDbType.Int).Value = fam.ExtPermissionID; //扩展权限ID cmd.Parameters.Add("@ModuleID", SqlDbType.Int).Value = fam.ModuleID; //模块ID cmd.Parameters.Add("@PermissionName", SqlDbType.NVarChar).Value = fam.PermissionName; //权限名称 cmd.Parameters.Add("@PermissionValue", SqlDbType.Int).Value = fam.PermissionValue; //权限值 Conn.Open(); rInt = Convert.ToInt32(cmd.ExecuteScalar()); cmd.Dispose(); Conn.Dispose(); Conn.Close(); } return rInt; }
protected void Button3_Click(object sender, EventArgs e) { string PermissionName_Value = (string)Common.sink(PermissionName.UniqueID,MethodType.Post,100,1,DataType.Str); sys_ModuleExtPermissionTable st = new sys_ModuleExtPermissionTable(); st.DB_Option_Action_ = "Insert"; st.ModuleID = ModuleID; st.PermissionName = PermissionName_Value; st.PermissionValue = BusinessFacade.sys_ModuleExtPermissionGetLastPermissionValue(ModuleID); if (st.PermissionValue==0) EventMessage.MessageBox(1, "操作失败", string.Format("增加自定义权限失败,权限值已经达到最大值,无法再增加!"), Icon_Type.Alert, Common.GetHomeBaseUrl(string.Format("ModuleManager.aspx?S_ID={0}&ModuleID={1}", S_ID, ModuleID))); int returnint = BusinessFacade.sys_ModuleExtPermissionInsertUpdate(st); if (returnint < 0) { EventMessage.MessageBox(1, "操作失败", string.Format("增加自定义权限失败!"), Icon_Type.Error, Common.GetHomeBaseUrl(string.Format("ModuleManager.aspx?S_ID={0}&ModuleID={1}", S_ID, ModuleID))); } TabOptionWebControls1.SelectIndex = 3; BindPermissionList(); }
/// <summary> /// 将记录集转为sys_ModuleExtPermissionTable实体类 /// </summary> /// <param name="dr">记录集</param> /// <returns>sys_ModuleExtPermissionTable</returns> protected object Populatesys_ModuleExtPermission(IDataReader dr) { sys_ModuleExtPermissionTable nc = new sys_ModuleExtPermissionTable(); if (!Convert.IsDBNull(dr["ExtPermissionID"])) nc.ExtPermissionID = Convert.ToInt32(dr["ExtPermissionID"]); // 扩展权限ID if (!Convert.IsDBNull(dr["ModuleID"])) nc.ModuleID = Convert.ToInt32(dr["ModuleID"]); // 模块ID if (!Convert.IsDBNull(dr["PermissionName"])) nc.PermissionName = Convert.ToString(dr["PermissionName"]).Trim(); // 权限名称 if (!Convert.IsDBNull(dr["PermissionValue"])) nc.PermissionValue = Convert.ToInt32(dr["PermissionValue"]); // 权限值 return nc; }
/// <summary> /// 新增/删除/修改 sys_ModuleExtPermission /// </summary> /// <param name="fam">sys_ModuleExtPermissionTable实体类</param> /// <returns>返回0操正常</returns> public abstract int sys_ModuleExtPermissionInsertUpdate(sys_ModuleExtPermissionTable fam);
/// <summary> /// 根据ID返回 sys_ModuleExtPermissionTable实体类 单笔资料 /// </summary> /// <param name="ExtPermissionID">扩展权限ID</param> /// <returns>返回sys_ModuleExtPermissionTable实体类 ExtPermissionID为0则无记录</returns> public static sys_ModuleExtPermissionTable sys_ModuleExtPermissionDisp(int ExtPermissionID) { sys_ModuleExtPermissionTable fam = new sys_ModuleExtPermissionTable(); QueryParam qp = new QueryParam(); qp.PageIndex = 1; qp.PageSize = 1; qp.Where = " Where sys_ModuleExtPermission.ExtPermissionID = " + ExtPermissionID; int RecordCount = 0; ArrayList lst = sys_ModuleExtPermissionList(qp, out RecordCount); if (RecordCount > 0) { fam = (sys_ModuleExtPermissionTable)lst[0]; } return fam; }
/// <summary> /// 新增/删除/修改 sys_ModuleExtPermission /// </summary> /// <param name="fam">sys_ModuleExtPermissionTable实体类</param> /// <returns>返回0操正常</returns> public static int sys_ModuleExtPermissionInsertUpdate(sys_ModuleExtPermissionTable fam) { return DataProvider.Instance().sys_ModuleExtPermissionInsertUpdate(fam); }