/// <summary> /// 更新库存 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Upadata_kucun(XCWeiXin.Model.Card_wx.Card_BaseInfo model) { StringBuilder strsql = new StringBuilder(); strsql.Append("update Card_BaseInfo set "); strsql.Append("quantity=@quantity"); strsql.Append(" where Wx_Card_id=@Wx_Card_id"); SqlParameter[] parameters = { new SqlParameter("@quantity", SqlDbType.VarChar, 100), new SqlParameter("@Wx_Card_id", SqlDbType.VarChar, 100) }; parameters[0].Value = model.quantity; parameters[1].Value = model.Wx_Card_id; int rows = DbHelperSQL.ExecuteSql(strsql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新库存 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Exit_card(XCWeiXin.Model.Card_wx.Card_BaseInfo model) { StringBuilder strsql = new StringBuilder(); strsql.Append("update Card_BaseInfo set "); strsql.Append("logo_url=@logo_url, "); strsql.Append("color=@color, "); strsql.Append("notice=@notice, "); strsql.Append("service_phone=@service_phone, "); strsql.Append("description=@description, "); strsql.Append("use_limit=@use_limit, "); strsql.Append("get_limit=@get_limit, "); strsql.Append("can_share=@can_share, "); strsql.Append("can_give_friend=@can_give_friend, "); strsql.Append("custom_url_name=@custom_url_name, "); strsql.Append("custom_url_sub_title=@custom_url_sub_title, "); strsql.Append("custom_url=@custom_url, "); strsql.Append("promotion_url_name=@promotion_url_name, "); strsql.Append("promotion_url=@promotion_url, "); strsql.Append("Paycell=@Paycell, "); strsql.Append("hexiao=@hexiao "); strsql.Append(" where Wx_Card_id=@Wx_Card_id and wid=@wid"); SqlParameter[] parameters = { new SqlParameter("@logo_url", SqlDbType.VarChar, 100), new SqlParameter("@color", SqlDbType.VarChar, 100), new SqlParameter("@notice", SqlDbType.VarChar, 100), new SqlParameter("@service_phone", SqlDbType.VarChar, 100), new SqlParameter("@description", SqlDbType.VarChar, 100), new SqlParameter("@use_limit", SqlDbType.VarChar, 100), new SqlParameter("@get_limit", SqlDbType.VarChar, 100), new SqlParameter("@can_share", SqlDbType.Bit), new SqlParameter("@can_give_friend", SqlDbType.Bit), new SqlParameter("@custom_url_name", SqlDbType.VarChar, 100), new SqlParameter("@custom_url_sub_title", SqlDbType.VarChar, 100), new SqlParameter("@custom_url", SqlDbType.VarChar, 100), new SqlParameter("@promotion_url_name", SqlDbType.VarChar, 100), new SqlParameter("@promotion_url", SqlDbType.VarChar, 100), new SqlParameter("@Paycell", SqlDbType.Bit), new SqlParameter("@hexiao", SqlDbType.Bit), new SqlParameter("@Wx_Card_id", SqlDbType.VarChar, 100), new SqlParameter("@wid", SqlDbType.Int, 5) }; parameters[0].Value = model.logo_url; parameters[1].Value = model.color; parameters[2].Value = model.notice; parameters[3].Value = model.service_phone; parameters[4].Value = model.description; parameters[5].Value = model.use_limit; parameters[6].Value = model.get_limit; parameters[7].Value = model.can_share; parameters[8].Value = model.can_give_friend; parameters[9].Value = model.custom_url_name; parameters[10].Value = model.custom_url_sub_title; parameters[11].Value = model.custom_url; parameters[12].Value = model.promotion_url_name; parameters[13].Value = model.promotion_url; parameters[14].Value = model.Paycell; parameters[15].Value = model.hexiao; parameters[16].Value = model.Wx_Card_id; parameters[17].Value = model.wid; int rows = DbHelperSQL.ExecuteSql(strsql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 插入卡券信息 /// </summary> /// <param name="card"></param> /// <returns></returns> public int Add(XCWeiXin.Model.Card_wx.Card_BaseInfo card) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Card_BaseInfo( "); strSql.Append("wid,Card_type,logo_url,brand_name,title,sub_title,color,notice,service_phone,source,description,use_limit,get_limit,use_custom_code,bind_openid,can_share,type,begin_timestamp,end_timestamp_day,quantity,can_give_friend,url_name_type,custom_url,custom_url_name,custom_url_sub_title,promotion_url,promotion_url_name,least_cost,reduce_cost,default_detail,Deal_detail,discount,Wx_Card_id,Paycell,hexiao)"); strSql.Append(" values ( "); strSql.Append("@wid,@Card_type,@logo_url,@brand_name,@title,@sub_title,@color,@notice,@service_phone,@source,@description,@use_limit,@get_limit,@use_custom_code,@bind_openid,@can_share,@type,@begin_timestamp,@end_timestamp_day,@quantity,@can_give_friend,@url_name_type,@custom_url,@custom_url_name,@custom_url_sub_title,@promotion_url,@promotion_url_name,@least_cost,@reduce_cost,@default_detail,@Deal_detail,@discount,@Wx_Card_id,@Paycell,@hexiao) "); SqlParameter [] parameters = { new SqlParameter("@wid", SqlDbType.Int, 4), new SqlParameter("@Card_type", SqlDbType.VarChar, 200), new SqlParameter("@logo_url", SqlDbType.VarChar, 400), new SqlParameter("@brand_name", SqlDbType.VarChar, 100), new SqlParameter("@title", SqlDbType.VarChar, 100), new SqlParameter("@sub_title", SqlDbType.VarChar, 100), new SqlParameter("@color", SqlDbType.VarChar, 100), new SqlParameter("@notice", SqlDbType.VarChar, 100), new SqlParameter("@service_phone", SqlDbType.VarChar, 100), new SqlParameter("@source", SqlDbType.VarChar, 100), new SqlParameter("@description", SqlDbType.VarChar, 500), new SqlParameter("@use_limit", SqlDbType.VarChar, 100), new SqlParameter("@get_limit", SqlDbType.VarChar, 100), new SqlParameter("@use_custom_code", SqlDbType.Bit), new SqlParameter("@bind_openid", SqlDbType.Bit), new SqlParameter("@can_share", SqlDbType.Bit), new SqlParameter("@type", SqlDbType.VarChar, 100), new SqlParameter("@begin_timestamp", SqlDbType.VarChar, 100), new SqlParameter("@end_timestamp_day", SqlDbType.VarChar, 100), new SqlParameter("@quantity", SqlDbType.VarChar, 100), new SqlParameter("@can_give_friend", SqlDbType.Bit), new SqlParameter("@url_name_type", SqlDbType.VarChar, 100), new SqlParameter("@custom_url", SqlDbType.VarChar, 100), new SqlParameter("@custom_url_name", SqlDbType.VarChar, 100), new SqlParameter("@custom_url_sub_title", SqlDbType.VarChar, 100), new SqlParameter("@promotion_url", SqlDbType.VarChar, 100), new SqlParameter("@promotion_url_name", SqlDbType.VarChar, 100), new SqlParameter("@least_cost", SqlDbType.VarChar, 200), new SqlParameter("@reduce_cost", SqlDbType.VarChar, 200), new SqlParameter("@default_detail", SqlDbType.VarChar, 100), new SqlParameter("@Deal_detail", SqlDbType.VarChar, 100), new SqlParameter("@discount", SqlDbType.Money), new SqlParameter("@Wx_Card_id", SqlDbType.VarChar, 100), new SqlParameter("@Paycell", SqlDbType.Bit), new SqlParameter("@hexiao", SqlDbType.Bit) }; parameters[0].Value = card.wid; parameters[1].Value = card.Card_type; parameters[2].Value = card.logo_url; parameters[3].Value = card.brand_name; parameters[4].Value = card.title; parameters[5].Value = card.sub_title; parameters[6].Value = card.color; parameters[7].Value = card.notice; parameters[8].Value = card.service_phone; parameters[9].Value = card.source; parameters[10].Value = card.description; parameters[11].Value = card.use_limit; parameters[12].Value = card.get_limit; parameters[13].Value = card.use_custom_code; parameters[14].Value = card.bind_openid; parameters[15].Value = card.can_share; parameters[16].Value = card.type; parameters[17].Value = card.begin_timestamp; parameters[18].Value = card.end_timestamp; parameters[19].Value = card.quantity; parameters[20].Value = card.can_give_friend; parameters[21].Value = card.url_name_type; parameters[22].Value = card.custom_url; parameters[23].Value = card.custom_url_name; parameters[24].Value = card.custom_url_sub_title; parameters[25].Value = card.promotion_url; parameters[26].Value = card.promotion_url_name; parameters[27].Value = card.least_cost; parameters[28].Value = card.reduce_cost; parameters[29].Value = card.default_detail; parameters[30].Value = card.deal_detail; parameters[31].Value = card.discount; parameters[32].Value = card.Wx_Card_id; parameters[33].Value = card.Paycell; parameters[34].Value = card.hexiao; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }