public int InsertOrUpdate(B2b_smsmobilesend eticket) { using (var helper = new SqlHelper()) { return(new InternalSmsMobileSend(helper).InsertOrUpdate(eticket)); } }
private static readonly string SQLInsertOrUpdate = "usp_Insertsmsmoblesend";//调用存储过程, internal int InsertOrUpdate(B2b_smsmobilesend model) { var cmd = sqlHelper.PrepareStoredSqlCommand(SQLInsertOrUpdate); cmd.AddParam("@mobile", model.Mobile); cmd.AddParam("@content", model.Content); cmd.AddParam("@flag", model.Flag); cmd.AddParam("@text", model.Text); cmd.AddParam("@delaysendtime", model.Delaysendtime); cmd.AddParam("@oid", model.Oid); cmd.AddParam("@realsendtime", model.Realsendtime); cmd.AddParam("@smsid", model.Smsid); cmd.AddParam("@sendeticketid", model.Sendeticketid); cmd.AddParam("@pno", model.Pno); var parm = cmd.AddReturnValueParameter("ReturnValue"); cmd.ExecuteNonQuery(); return((int)parm.Value); }
public static void AsyncSendSms(B2b_smsmobilesend msmslog) { //根据订单号得到产品信息 B2b_com_pro mpro = new B2bComProData().GetProByOrderID(msmslog.Oid); if (mpro == null) { return; } string phone = msmslog.Mobile; string smscontent = msmslog.Content; int comid = mpro.Com_id; int orderid = msmslog.Oid; string pno = msmslog.Pno; int insertsendEticketid = msmslog.Sendeticketid; int pro_sourcetype = mpro.Source_type; string msg = ""; int sendback = SendSmsHelper.SendSms(phone, smscontent, comid, out msg); int sendstate = 1; //1未发码;2已发码;3发送中 if (pro_sourcetype == 1) //系统自动生成 { if (sendback > 0) { //修改电子票发送日志表的发码状态为"发送成功" B2b_eticket_send_log eticketlogup = new B2b_eticket_send_log() { Id = insertsendEticketid, Sendstate = (int)SendCodeStatus.HasSend, Senddate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")) }; int upsendEticket = new B2bEticketSendLogData().InsertOrUpdate(eticketlogup); //修改订单中发码状态为“已发码” int upsendstate = new B2bOrderData().Upsendstate(orderid, (int)SendCodeStatus.HasSend); } else { //修改电子票发送日志表的发码状态为"未发码" B2b_eticket_send_log eticketlogup = new B2b_eticket_send_log() { Id = insertsendEticketid, Sendstate = (int)SendCodeStatus.NotSend, Senddate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")) }; int upsendEticket = new B2bEticketSendLogData().InsertOrUpdate(eticketlogup); //修改订单中发码状态为“未发码” int upsendstate = new B2bOrderData().Upsendstate(orderid, (int)SendCodeStatus.NotSend); } } if (pro_sourcetype == 2)//倒码产品 { if (sendback > 0) { //修改订单中发码状态为“已发码” int upsendstate = new B2bOrderData().Upsendstate(orderid, (int)SendCodeStatus.HasSend); } else { //修改订单中发码状态为“未发码” int upsendstate = new B2bOrderData().Upsendstate(orderid, (int)SendCodeStatus.NotSend); } } //记录短信日志表 B2bSmsMobileSendDate smsmobilelog = new B2bSmsMobileSendDate(); B2b_smsmobilesend smslog = new B2b_smsmobilesend() { Mobile = phone, Content = smscontent, Flag = sendstate, Text = msg, Delaysendtime = "", Oid = orderid, Pno = pno, Realsendtime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")), Smsid = sendback, Sendeticketid = insertsendEticketid }; int insertsendmobileid = smsmobilelog.InsertOrUpdate(smslog); }