internal int InsertOrUpdate(B2b_eticket model) { var cmd = sqlHelper.PrepareStoredSqlCommand(SQLInsertOrUpdate); cmd.AddParam("@Id", model.Id); cmd.AddParam("@Com_id", model.Com_id); cmd.AddParam("@Pro_id", model.Pro_id); cmd.AddParam("@Agent_id", model.Agent_id); cmd.AddParam("@Pno", model.Pno); cmd.AddParam("@E_type", model.E_type); cmd.AddParam("@Pnum", model.Pnum); cmd.AddParam("@Use_pnum", model.Use_pnum); cmd.AddParam("@E_proname", model.E_proname); cmd.AddParam("@E_face_price", model.E_face_price); cmd.AddParam("@Subdate", model.Subdate); cmd.AddParam("@E_sale_price", model.E_sale_price); cmd.AddParam("@E_cost_price", model.E_cost_price); cmd.AddParam("@V_state", model.V_state); cmd.AddParam("@Send_state", model.Send_state); cmd.AddParam("@Oid", model.Oid); cmd.AddParam("@ishasdeposit", model.ishasdeposit); cmd.AddParam("@sendcard", model.sendcard); var parm = cmd.AddReturnValueParameter("ReturnValue"); cmd.ExecuteNonQuery(); return((int)parm.Value); }
internal int bindingpnoUpdatepeople(B2b_eticket model) { string sql = "update b2b_eticket set bindingname='" + model.bindingname + "',bindingphone='" + model.bindingphone + "',bindingcard='" + model.bindingcard + "' where id=" + model.Id; var cmd = sqlHelper.PrepareTextSqlCommand(sql); return(cmd.ExecuteNonQuery()); }
public int bindingpnoUpdatepeople(B2b_eticket eticket) { using (var helper = new SqlHelper()) { return(new InternalB2bEticket(helper).bindingpnoUpdatepeople(eticket)); } }
public int InsertOrUpdate(B2b_eticket eticket) { using (var helper = new SqlHelper()) { return(new InternalB2bEticket(helper).InsertOrUpdate(eticket)); } }
internal B2b_eticket GetEticketByOrderid(int orderid) { string sql = @"SELECT top 1 * FROM b2b_eticket where oid=@orderid order by id desc"; var cmd = sqlHelper.PrepareTextSqlCommand(sql); cmd.AddParam("@orderid", orderid); using (var reader = cmd.ExecuteReader()) { B2b_eticket r = null; if (reader.Read()) { r = new B2b_eticket { Id = reader.GetValue <int>("id"), Com_id = reader.GetValue <int>("com_id"), Pro_id = reader.GetValue <int>("pro_id"), Agent_id = reader.GetValue <int>("agent_id"), Pno = reader.GetValue <string>("pno"), Oid = reader.GetValue <int>("oid"), E_type = reader.GetValue <int>("e_type"), Pnum = reader.GetValue <int>("pnum"), Use_pnum = reader.GetValue <int>("use_pnum"), E_proname = reader.GetValue <string>("e_proname"), E_face_price = reader.GetValue <decimal>("e_face_price"), E_sale_price = reader.GetValue <decimal>("e_sale_price"), E_cost_price = reader.GetValue <decimal>("e_cost_price"), V_state = reader.GetValue <int>("v_state"), Send_state = reader.GetValue <int>("send_state"), Subdate = reader.GetValue <DateTime>("subdate"), Pagecode = reader.GetValue <decimal>("Pagecode"), Printstate = reader.GetValue <int>("Printstate"), }; } return(r); } }
protected void Page_Load(object sender, EventArgs e) { int order_no = Int32.Parse(Request.QueryString["out_trade_no"]); //获取订单号 //返回订单号 int orderid = order_no; if (orderid != 0) { //根据订单id得到订单信息 B2bOrderData dataorder = new B2bOrderData(); B2b_order modelb2border = dataorder.GetOrderById(orderid); //根据产品id得到产品信息 B2bComProData datapro = new B2bComProData(); B2b_com_pro modelcompro = datapro.GetProById(modelb2border.Pro_id.ToString()); //生成电子码 int u_num = modelb2border.U_num; int comid = modelcompro.Com_id; RandomCodeData datarandomcode = new RandomCodeData(); RandomCode modelrandomcode = datarandomcode.GetRandomCode();//得到未用随机码对象 //设置取出的电子码状态为1(已使用) modelrandomcode.State = 1; int randomcodeid = datarandomcode.InsertOrUpdate(modelrandomcode); string eticketcode = "9" + comid.ToString() + modelrandomcode.Code.ToString(); string sendstr = ""; //录入电子票列表 B2bEticketData eticketdata = new B2bEticketData(); B2b_eticket eticket = new B2b_eticket() { Id = 0, Com_id = comid, Pro_id = modelcompro.Id, Agent_id = 0,//直销 Pno = eticketcode, E_type = (int)EticketCodeType.ShuZiMa, Pnum = modelb2border.U_num, Use_pnum = modelb2border.U_num, E_proname = modelcompro.Pro_name, E_face_price = modelcompro.Face_price, E_sale_price = modelcompro.Advise_price, E_cost_price = modelcompro.Agentsettle_price, V_state = (int)EticketCodeStatus.NotValidate, Send_state = (int)EticketCodeSendStatus.NotSend, Subdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")) }; int eticketid = eticketdata.InsertOrUpdate(eticket); if (eticketid > 0) { //生成电子码短信,稍后可单独写类或写到数据库中 diveticketcode.InnerText = "电子码生成成功:" + eticketcode; sendstr = "感谢您订购" + modelcompro.Pro_name + modelb2border.U_num + "张" + ",电子码:" + eticketcode + " 有效期至:" + modelcompro.Pro_end.ToString("yyyy-MM-dd"); } else { diveticketcode.InnerText = "电子码生成ERROR"; } } }