protected void Button1_Click(object sender, EventArgs e) { M_CardType carotype = new M_CardType(); carotype.typename = tx_typename.Text; carotype.iscount = DataConverter.CDecimal(tx_count.Text); carotype.c_id = DataConverter.CLng(this.ID_H.Value); if (this.HiddenField1.Value == "updata") { if (bcard.UpCardType(carotype)) { function.WriteSuccessMsg("更新成功", "cardtypeManage.aspx"); } else { function.WriteErrMsg("更新失败", "cardtypeManage.aspx"); } } else { if (bcard.Add(carotype)) { function.WriteSuccessMsg("添加成功", "cardtypeManage.aspx"); } else { function.WriteErrMsg("添加失败", "cardtypeManage.aspx"); } } }
public bool Add(M_CardType card) { string strSql = "insert into ZL_CardType (typename,iscount) values (@typename,@iscount)"; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("@typename", SqlDbType.NVarChar, 100), new SqlParameter("@iscount", SqlDbType.Decimal) }; sp[0].Value = card.typename; sp[1].Value = card.iscount; return(SqlHelper.ExecuteSql(strSql, sp)); }
public bool UpCardType(M_CardType c) { string strSql = "Update zl_cardtype set typename=@typename,iscount=@iscount Where c_id=@c_id"; SqlParameter[] cmdParams = new SqlParameter[] { new SqlParameter("@typename", SqlDbType.NVarChar), new SqlParameter("@iscount", SqlDbType.Decimal), new SqlParameter("@c_id", SqlDbType.Int) }; cmdParams[0].Value = c.typename; cmdParams[1].Value = c.iscount; cmdParams[2].Value = c.c_id; return(SqlHelper.ExecuteSql(strSql, cmdParams)); }
protected void Page_Load(object sender, EventArgs e) { function.AccessRulo(); B_Admin badmin = new B_Admin(); string menu = Request.QueryString["menu"]; int id = DataConverter.CLng(Request.QueryString["id"]); if (!IsPostBack) { if (menu == "edit") { M_CardType c = bcard.SelectType(id); this.tx_typename.Text = c.typename; this.tx_count.Text = c.iscount.ToString(); this.ID_H.Value = c.c_id.ToString(); this.HiddenField1.Value = "updata"; } Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li><li><a href='ProductManage.aspx'>商城管理</a></li> <li><a href='DeliverType.aspx'>商城设置</a></li><li><a href='CardManage.aspx'>VIP卡管理</a></li><li>卡类型</li>"); } }
public int insert(M_CardType model) { return(Sql.insert(strTableName, model.GetParameters(model), BLLCommon.GetParas(model), BLLCommon.GetFields(model))); }
public bool UpdateByID(M_CardType model) { return(Sql.UpdateByIDs(strTableName, PK, model.c_id.ToString(), BLLCommon.GetFieldAndPara(model), model.GetParameters(model))); }