public static string EditCardInfo(Member_Card cardinfo) { try { var pro = MemberCardData.EditCardInfo(cardinfo); return(JsonConvert.SerializeObject(new { type = 100, msg = pro })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); throw; } }
public int EditMemberCard(Member_Card membercard) { using (var sql = new SqlHelper()) { try { int result = new InternalMemberCard(sql).EditMemberCard(membercard); return result; } catch (Exception ex) { throw; } } }
public static Member_Card GetCardId(int cardid) { using (var sql = new SqlHelper()) { try { var internalData = new InternalMemberCard(sql); Member_Card result = internalData.GetCardId(cardid); return result; } catch { throw; } } }
public static int EditCardInfo(Member_Card info) { using (var sql = new SqlHelper()) { try { var internalData = new InternalMemberCard(sql); int result = internalData.InsertOrUpdate(info); return result; } catch { throw; } } }
internal int EditMemberCard(Member_Card model) { var cmd = sqlHelper.PrepareStoredSqlCommand(SQLInsertOrUpdate2); cmd.AddParam("@Id", model.Id); cmd.AddParam("@Comid", model.Com_id); cmd.AddParam("@Crid", model.Crid); cmd.AddParam("@Cardcode", model.Cardcode); cmd.AddParam("@OPENstate", model.Openstate); cmd.AddParam("@OPENsubdate", model.Opensubdate); cmd.AddParam("@IssueCard", model.IssueCard); var parm = cmd.AddReturnValueParameter("ReturnValue"); cmd.ExecuteNonQuery(); return((int)parm.Value); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string oper = context.Request["oper"].ConvertTo <string>(""); if (oper != "") { if (oper == "getCardById") { int id = context.Request["cardid"].ConvertTo <int>(0); var data = CardJsonDate.GetCardById(id); context.Response.Write(data); } if (oper == "getCardByIdNew")//新添加了公司限制 { int id = context.Request["cardid"].ConvertTo <int>(0); int comid = context.Request["comid"].ConvertTo <int>(0); var data = CardJsonDate.GetCardById(comid, id); context.Response.Write(data); } if (oper == "getCardByIssueId") { int issueid = context.Request["issueid"].ConvertTo <int>(0); var data = CardJsonDate.GetCardByIssueId(issueid); context.Response.Write(data); } if (oper == "getCardFirst") { int id = context.Request["comid"].ConvertTo <int>(0); var data = CardJsonDate.GetCardFirst(id); context.Response.Write(data); } if (oper == "editCardinfo") { var cname = context.Request["cname"].ConvertTo <string>(""); var comid = context.Request["comid"].ConvertTo <int>(0); var ctype = context.Request["ctype"].ConvertTo <int>(0); var printnum = context.Request["printnum"].ConvertTo <int>(0); var zhuanzeng = context.Request["zhuanzeng"].ConvertTo <int>(0); var qrcode = context.Request["qrcode"].ConvertTo <int>(0); var exchange = context.Request["exchange"].ConvertTo <string>(""); var remark = context.Request["remark"].ConvertTo <string>(""); var cardRule = context.Request["cardRule"].ConvertTo <int>(1); var cardRule_starnum = context.Request["cardRule_starnum"].ConvertTo <int>(0); var cardRule_First = context.Request["cardRule_First"].ConvertTo <int>(0); var CardRule_Second = context.Request["CardRule_Second"].ConvertTo <int>(0); var Id = context.Request["cardid"].ConvertTo <int>(0); Member_Card manageuser = new Member_Card() { Id = Id, Com_id = comid, Cname = cname, Ctype = ctype, Printnum = printnum, Zhuanzeng = zhuanzeng, Qrcode = qrcode, Exchange = exchange, Remark = remark, CardRule = cardRule, CardRule_starnum = cardRule_starnum, CardRule_First = cardRule_First, CardRule_Second = CardRule_Second }; var data = CardJsonDate.EditCardInfo(manageuser); context.Response.Write(data); } if (oper == "pagelist") { var comid = context.Request["comid"]; var pageindex = context.Request["pageindex"].ConvertTo <int>(0); var pagesize = context.Request["pagesize"].ConvertTo <int>(10); string data = CardJsonDate.CardPageList(comid, pageindex, pagesize); context.Response.Write(data); } //查询卡号或手机是有账户 if (oper == "SearchCard") { string pno = context.Request["pno"].ConvertTo <string>(""); int comid = context.Request["comid"].ConvertTo <int>(0); int userinfo = 0; var data = CardJsonDate.SearchCard(pno, comid, out userinfo); context.Response.Write(data); } //确认使用 if (oper == "econfirmCard") { int aid = context.Request["aid"].ConvertTo <int>(0); int actid = context.Request["actid"].ConvertTo <int>(0); int cardid = context.Request["cardid"].ConvertTo <int>(0); int comid = context.Request["comid"].ConvertTo <int>(0); Member_Activity actinfo; string phone = ""; string name = ""; decimal idcard = 0; decimal agcardcode = 0; var data = CardJsonDate.EconfirmCard(aid, actid, cardid, comid, out actinfo, out phone, out name, out idcard, out agcardcode); context.Response.Write(data); } //根据使用日志查询记录 if (oper == "getCardinfo") { int actid = context.Request["actid"].ConvertTo <int>(0); int pno = context.Request["pno"].ConvertTo <int>(0); int comid = context.Request["comid"].ConvertTo <int>(0); var data = CardJsonDate.GetCardInfo(actid, pno, comid); context.Response.Write(data); } //得到不同渠道,活动,发行 下的卡号列表 if (oper == "MemberCardPageList") { var comid = context.Request["comid"].ConvertTo <int>(0); var cardcode = context.Request["cardcode"].ConvertTo <decimal>(0); var pageindex = context.Request["pageindex"].ConvertTo <int>(0); var pagesize = context.Request["pagesize"].ConvertTo <int>(0); var issueid = context.Request["issueid"].ConvertTo <int>(0); var channelid = context.Request["channelid"].ConvertTo <int>(0); var actid = context.Request["actid"].ConvertTo <int>(0); var isopencard = context.Request["isopencard"].ConvertTo <int>(1); var datastr = CardJsonDate.GetMemberCardList(comid, cardcode, pageindex, pagesize, issueid, channelid, actid, isopencard); context.Response.Write(datastr); } //电脑验卡 if (oper == "readuser") { var MALogactid = context.Request["Actid"].ConvertTo <int>(0); var MALogcardid = context.Request["Cardid"].ConvertTo <int>(0); var MALogOrderId = context.Request["OrderId"].ConvertTo <int>(0); var MALogServerName = context.Request["ServerName"].ConvertTo <string>(""); var MALogNum_people = context.Request["Num_people"].ConvertTo <int>(0); var MALogPer_capita_money = context.Request["Per_capita_money"].ConvertTo <int>(0); var MALogMember_return_money = context.Request["Member_return_money"].ConvertTo <int>(0); var MALogsales_admin = context.Request["sales_admin"].ConvertTo <string>(""); var MALogcomid = context.Request["comid"].ConvertTo <int>(0); var AccountName = context.Request["AccountName"].ConvertTo <string>(""); var data = CardJsonDate.GetCarValidate(MALogactid, MALogcardid, MALogOrderId, MALogServerName, MALogNum_people, MALogPer_capita_money, MALogMember_return_money, MALogsales_admin, MALogcomid, AccountName); context.Response.Write(data); } //使用预付款、积分 if (oper == "CashCoupon") { var comid = context.Request["comid"].ConvertTo <int>(0); var KrderId = context.Request["KrderId"].ConvertTo <decimal>(); var KrderM = context.Request["KrderM"].ConvertTo <string>(); var Kales_admin = context.Request["Kales_admin"].ConvertTo <string>(""); var money = context.Request["money"].ConvertTo <int>(); var Imprest = context.Request["Imprest"].ConvertTo <int>(); var Integral = context.Request["Integral"].ConvertTo <int>(); var card = context.Request["card"].ConvertTo <decimal>(); var mid = new B2bCrmData().GetB2bCrmByCardcode(card).Id; string acttype = ""; string data = ""; if (money == 0) { acttype = "reduce_imprest"; if (int.Parse(KrderM) > Imprest) { data = JsonConvert.SerializeObject(new { type = 1, msg = "预付款" }); } else { data = BusinessCustomersJsonData.WriteMoney(mid, comid, acttype, KrderM, KrderId, Kales_admin); } } if (money == 1) { acttype = "reduce_integral"; if (int.Parse(KrderM) > Integral) { data = JsonConvert.SerializeObject(new { type = 1, msg = "积分" }); } else { data = BusinessCustomersJsonData.WriteMoney(mid, comid, acttype, KrderM, KrderId, Kales_admin); } } context.Response.Write(data); } } }
public int InsertOrUpdate(Member_Card model) { string insertsqltxt = ""; //卡号插入SQL int cardid = 0; //卡管理ID string cardcode = ""; //卡号 int RandomCode = 0; var cmd = sqlHelper.PrepareStoredSqlCommand(SQLInsertOrUpdate); cmd.AddParam("@Id", model.Id); cmd.AddParam("@Com_id", model.Com_id); cmd.AddParam("@cname", model.Cname); cmd.AddParam("@ctype", model.Ctype); cmd.AddParam("@printnum", model.Printnum); cmd.AddParam("@zhuanzeng", model.Zhuanzeng); cmd.AddParam("@qrcode", model.Qrcode); cmd.AddParam("@Exchange", model.Exchange); cmd.AddParam("@remark", model.Remark); cmd.AddParam("@cardRule", model.CardRule); cmd.AddParam("@cardRule_starnum", model.CardRule_starnum); cmd.AddParam("@cardRule_First", model.CardRule_First); var parm = cmd.AddReturnValueParameter("ReturnValue"); cmd.ExecuteNonQuery(); cardid = (int)parm.Value; //是修改操作将不产生卡号 if (model.Id == 0) { //后8位如果是顺序编码2 则执行 if (model.CardRule == 2) { for (int i = model.CardRule_starnum; i < model.CardRule_starnum + model.Printnum; i++) { cardcode = model.CardRule_First + model.CardRule_Second.ToString() + i; insertsqltxt = "insert Member_Card (com_id,crid,cardcode)values(" + model.Com_id + "," + cardid + "," + cardcode + ")"; cmd = this.sqlHelper.PrepareTextSqlCommand(insertsqltxt); cmd.ExecuteNonQuery(); } } //后8位采用随机编码1 else { for (int i = 1; i < model.Printnum; i++) { //获得随机码 RandomCode = MemberCardData.GetRandomCode(); //使用随机码时,标记为已使用防止重复码 insertsqltxt = "update RandomCode set state = 1 where code = " + RandomCode; cmd = this.sqlHelper.PrepareTextSqlCommand(insertsqltxt); cmd.ExecuteNonQuery(); //插入卡库Member_Card cardcode = model.CardRule_First + model.CardRule_Second.ToString() + RandomCode; insertsqltxt = "insert Member_Card (com_id,crid,cardcode)values(" + model.Com_id + "," + cardid + "," + cardcode + ")"; cmd = this.sqlHelper.PrepareTextSqlCommand(insertsqltxt); cmd.ExecuteNonQuery(); } } } return((int)parm.Value); }