/// <summary> /// 更新T_SYS_ROLES /// </summary> public virtual bool Update(RolesOR roles) { string sql = "update T_SYS_ROLE set ROLE_NAME = @ROLE_NAME, ROLE_DESC = @ROLE_DESC where ROLE_ID= @ROLE_ID"; return(db.ExecuteNoQuery(sql, db.GetDataParameter("@ROLE_ID", roles.Guid), db.GetDataParameter("@ROLE_NAME", roles.RoleName), db.GetDataParameter("@ROLE_DESC", roles.RoleDesc)) > 0); }
/// <summary> /// 插入T_SYS_ROLES /// </summary> public virtual bool Insert(RolesOR roles) { string sql = "insert into T_SYS_ROLE (ROLE_ID, ROLE_NAME, ROLE_DESC) values (@ROLE_ID, @ROLE_NAME, @ROLE_DESC)"; return(db.ExecuteNoQuery(sql, db.GetDataParameter("@ROLE_ID", Guid.NewGuid().ToString()), db.GetDataParameter("@ROLE_NAME", roles.RoleName), db.GetDataParameter("@ROLE_DESC", roles.RoleDesc)) > 0); }
private RolesOR setValue() { RolesOR T_SY = new RolesOR(); if (Request.QueryString["id"] != null) { T_SY.Guid = Request.QueryString["id"].ToString(); } T_SY.RoleName = txtName.Text; //角色名称 T_SY.RoleDesc = txtROLE_DESC.Text; //角色说明 return(T_SY); }
protected void lbtSave_Click(object sender, EventArgs e) { RolesOR cg = setValue(); RolesDA carClassAdin = new RolesDA(); try { if (Request.QueryString["opType"] == null) { ObservableCollection <RolesOR> dt = carClassAdin.SelectAllRoles(); for (int i = 0; i < dt.Count; i++) { if (dt[i].RoleName.ToLower() == txtName.Text.Trim().ToLower()) { Alert("该角色已存在!"); return; } } carClassAdin.Insert(cg); } else if (Request.QueryString["opType"].ToString() == "alert") { RolesOR or = new RolesDA().selectARowDate(Request["id"].ToString()); ObservableCollection <RolesOR> dt = carClassAdin.SelectRolesWithoutSelf(or.RoleName); for (int i = 0; i < dt.Count; i++) { if (dt[i].RoleName.ToLower() == txtName.Text.Trim().ToLower()) { Alert("该角色已存在!"); return; } } carClassAdin.Update(cg); } base.Close("OK"); } catch (Exception ex) { base.Alert(ex.Message); } }