/// <summary> /// 更新一条数据 /// </summary> public bool Update(Maticsoft.Model.sys_RolePermission model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update sys_RolePermission set "); strSql.Append("P_Value=@P_Value"); strSql.Append(" where PermissionID=@PermissionID"); SqlParameter[] parameters = { new SqlParameter("@P_Value", SqlDbType.Int, 4), new SqlParameter("@PermissionID", SqlDbType.Int, 4), new SqlParameter("@P_RoleID", SqlDbType.Int, 4), new SqlParameter("@P_ApplicationID", SqlDbType.Int, 4), new SqlParameter("@P_PageCode", SqlDbType.VarChar, 20) }; parameters[0].Value = model.P_Value; parameters[1].Value = model.PermissionID; parameters[2].Value = model.P_RoleID; parameters[3].Value = model.P_ApplicationID; parameters[4].Value = model.P_PageCode; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.sys_RolePermission DataRowToModel(DataRow row) { Maticsoft.Model.sys_RolePermission model=new Maticsoft.Model.sys_RolePermission(); if (row != null) { if(row["PermissionID"]!=null && row["PermissionID"].ToString()!="") { model.PermissionID=int.Parse(row["PermissionID"].ToString()); } if(row["P_RoleID"]!=null && row["P_RoleID"].ToString()!="") { model.P_RoleID=int.Parse(row["P_RoleID"].ToString()); } if(row["P_ApplicationID"]!=null && row["P_ApplicationID"].ToString()!="") { model.P_ApplicationID=int.Parse(row["P_ApplicationID"].ToString()); } if(row["P_PageCode"]!=null) { model.P_PageCode=row["P_PageCode"].ToString(); } if(row["P_Value"]!=null && row["P_Value"].ToString()!="") { model.P_Value=int.Parse(row["P_Value"].ToString()); } } return model; }
public void btnSave_Click(object sender, EventArgs e) { string strErr=""; if(!PageValidate.IsNumber(txtP_Value.Text)) { strErr+="权限值格式错误!\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int PermissionID=int.Parse(this.lblPermissionID.Text); int P_RoleID=int.Parse(this.lblP_RoleID.Text); int P_ApplicationID=int.Parse(this.lblP_ApplicationID.Text); string P_PageCode=this.lblP_PageCode.Text; int P_Value=int.Parse(this.txtP_Value.Text); Maticsoft.Model.sys_RolePermission model=new Maticsoft.Model.sys_RolePermission(); model.PermissionID=PermissionID; model.P_RoleID=P_RoleID; model.P_ApplicationID=P_ApplicationID; model.P_PageCode=P_PageCode; model.P_Value=P_Value; Maticsoft.BLL.sys_RolePermission bll=new Maticsoft.BLL.sys_RolePermission(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx"); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Maticsoft.Model.sys_RolePermission model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into sys_RolePermission("); strSql.Append("P_RoleID,P_ApplicationID,P_PageCode,P_Value)"); strSql.Append(" values ("); strSql.Append("@P_RoleID,@P_ApplicationID,@P_PageCode,@P_Value)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@P_RoleID", SqlDbType.Int, 4), new SqlParameter("@P_ApplicationID", SqlDbType.Int, 4), new SqlParameter("@P_PageCode", SqlDbType.VarChar, 20), new SqlParameter("@P_Value", SqlDbType.Int, 4) }; parameters[0].Value = model.P_RoleID; parameters[1].Value = model.P_ApplicationID; parameters[2].Value = model.P_PageCode; parameters[3].Value = model.P_Value; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.sys_RolePermission DataRowToModel(DataRow row) { Maticsoft.Model.sys_RolePermission model = new Maticsoft.Model.sys_RolePermission(); if (row != null) { if (row["PermissionID"] != null && row["PermissionID"].ToString() != "") { model.PermissionID = int.Parse(row["PermissionID"].ToString()); } if (row["P_RoleID"] != null && row["P_RoleID"].ToString() != "") { model.P_RoleID = int.Parse(row["P_RoleID"].ToString()); } if (row["P_ApplicationID"] != null && row["P_ApplicationID"].ToString() != "") { model.P_ApplicationID = int.Parse(row["P_ApplicationID"].ToString()); } if (row["P_PageCode"] != null) { model.P_PageCode = row["P_PageCode"].ToString(); } if (row["P_Value"] != null && row["P_Value"].ToString() != "") { model.P_Value = int.Parse(row["P_Value"].ToString()); } } return(model); }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtP_Value.Text)) { strErr += "权限值格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int PermissionID = int.Parse(this.lblPermissionID.Text); int P_RoleID = int.Parse(this.lblP_RoleID.Text); int P_ApplicationID = int.Parse(this.lblP_ApplicationID.Text); string P_PageCode = this.lblP_PageCode.Text; int P_Value = int.Parse(this.txtP_Value.Text); Maticsoft.Model.sys_RolePermission model = new Maticsoft.Model.sys_RolePermission(); model.PermissionID = PermissionID; model.P_RoleID = P_RoleID; model.P_ApplicationID = P_ApplicationID; model.P_PageCode = P_PageCode; model.P_Value = P_Value; Maticsoft.BLL.sys_RolePermission bll = new Maticsoft.BLL.sys_RolePermission(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
private void ShowInfo(int PermissionID) { Maticsoft.BLL.sys_RolePermission bll = new Maticsoft.BLL.sys_RolePermission(); Maticsoft.Model.sys_RolePermission model = bll.GetModel(PermissionID); this.lblPermissionID.Text = model.PermissionID.ToString(); this.lblP_RoleID.Text = model.P_RoleID.ToString(); this.lblP_ApplicationID.Text = model.P_ApplicationID.ToString(); this.lblP_PageCode.Text = model.P_PageCode; this.lblP_Value.Text = model.P_Value.ToString(); }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtP_RoleID.Text)) { strErr += "角色ID与sys_Roles表格式错误!\\n"; } if (!PageValidate.IsNumber(txtP_ApplicationID.Text)) { strErr += "角色所属应用ID与sys_Ap格式错误!\\n"; } if (this.txtP_PageCode.Text.Trim().Length == 0) { strErr += "角色应用中页面权限代码不能为空!\\n"; } if (!PageValidate.IsNumber(txtP_Value.Text)) { strErr += "权限值格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int P_RoleID = int.Parse(this.txtP_RoleID.Text); int P_ApplicationID = int.Parse(this.txtP_ApplicationID.Text); string P_PageCode = this.txtP_PageCode.Text; int P_Value = int.Parse(this.txtP_Value.Text); Maticsoft.Model.sys_RolePermission model = new Maticsoft.Model.sys_RolePermission(); model.P_RoleID = P_RoleID; model.P_ApplicationID = P_ApplicationID; model.P_PageCode = P_PageCode; model.P_Value = P_Value; Maticsoft.BLL.sys_RolePermission bll = new Maticsoft.BLL.sys_RolePermission(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
protected void btnSave_Click(object sender, EventArgs e) { string strErr=""; if(!PageValidate.IsNumber(txtP_RoleID.Text)) { strErr+="角色ID与sys_Roles表格式错误!\\n"; } if(!PageValidate.IsNumber(txtP_ApplicationID.Text)) { strErr+="角色所属应用ID与sys_Ap格式错误!\\n"; } if(this.txtP_PageCode.Text.Trim().Length==0) { strErr+="角色应用中页面权限代码不能为空!\\n"; } if(!PageValidate.IsNumber(txtP_Value.Text)) { strErr+="权限值格式错误!\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int P_RoleID=int.Parse(this.txtP_RoleID.Text); int P_ApplicationID=int.Parse(this.txtP_ApplicationID.Text); string P_PageCode=this.txtP_PageCode.Text; int P_Value=int.Parse(this.txtP_Value.Text); Maticsoft.Model.sys_RolePermission model=new Maticsoft.Model.sys_RolePermission(); model.P_RoleID=P_RoleID; model.P_ApplicationID=P_ApplicationID; model.P_PageCode=P_PageCode; model.P_Value=P_Value; Maticsoft.BLL.sys_RolePermission bll=new Maticsoft.BLL.sys_RolePermission(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx"); }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.sys_RolePermission GetModel(int PermissionID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 PermissionID,P_RoleID,P_ApplicationID,P_PageCode,P_Value from sys_RolePermission "); strSql.Append(" where PermissionID=@PermissionID"); SqlParameter[] parameters = { new SqlParameter("@PermissionID", SqlDbType.Int, 4) }; parameters[0].Value = PermissionID; Maticsoft.Model.sys_RolePermission model = new Maticsoft.Model.sys_RolePermission(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.sys_RolePermission GetModel(int PermissionID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 PermissionID,P_RoleID,P_ApplicationID,P_PageCode,P_Value from sys_RolePermission "); strSql.Append(" where PermissionID=@PermissionID"); SqlParameter[] parameters = { new SqlParameter("@PermissionID", SqlDbType.Int,4) }; parameters[0].Value = PermissionID; Maticsoft.Model.sys_RolePermission model=new Maticsoft.Model.sys_RolePermission(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }