public int EditApi_mjld_SubmitOrder_input(Api_Mjld_SubmitOrder_input minput) { using (var helper = new SqlHelper()) { int id = new Internalapi_mjld_SubmitOrder_input(helper).EditApi_mjld_SubmitOrder_input(minput); return(id); } }
private string interurl = "http://outer.mjld.com.cn/Outer/Interface/";//正式接口url #region 2.5、 提交订单(SubmitOrder) public string SubmitOrder(ApiService mapiservice, Api_Mjld_SubmitOrder_input minput) { string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<Body>" + "<timeStamp>" + minput.timeStamp + "</timeStamp>" + "<user>" + minput.user + "</user>" + "<password>" + minput.password + "</password>" + "<goodsId>" + minput.goodsId + "</goodsId>" + "<num>" + minput.num + "</num>" + //<!—可以填多个,默认为1 --> "<phone>" + minput.phone + "</phone>" + "<batch>" + minput.batch + "</batch>" + //<!-值填1时一码一票,值填0或不填该字段是一码多票> "<guest_name>" + minput.guest_name + "</guest_name>" + "<identityno>" + minput.identityno + "</identityno>" + "<order_note>" + minput.order_note + "</order_note>" + "<forecasttime>" + minput.forecasttime + "</forecasttime>" + //【产品详情里IsReserve=True时,需传递该时间;IsReserve=False时,必须保留该值为空】 "<outOrderId>" + minput.orderId + "</outOrderId>" + "<orderpost>" + //快递信息 "<consignee>" + minput.consignee + "</consignee>" + "<address>" + minput.address + "</address>" + "<zipcode>" + minput.zipcode + "</zipcode>" + "</orderpost>" + "</Body>"; string data = HttpUtility.UrlEncode(Mjld_TCodeServiceCrypt.Encrypt3DESToBase64(xml, mapiservice.Deskey)); string postData = string.Format("businessid={1}&content={0}", data, mapiservice.Organization); string str = POST(interurl + "SubmitOrder", postData); string bstr = "fail"; try { bstr = Mjld_TCodeServiceCrypt.Decrypt3DESFromBase64(str, mapiservice.Deskey); } catch { bstr += " " + str; } //录入交互日志 ApiLog mapilog = new ApiLog { Id = 0, request_type = "SubmitOrder", Serviceid = 3, Str = xml.Trim(), Subdate = DateTime.Now, ReturnStr = bstr, ReturnSubdate = DateTime.Now, Errmsg = "", }; int ins = new ApiLogData().EditLog(mapilog); return(bstr); }
internal Api_Mjld_SubmitOrder_input GetApi_Mjld_SubmitOrder_input(int orderid) { string sql = @"SELECT [id] ,[timeStamp] ,[user] ,[password] ,[goodsId] ,[num] ,[phone] ,[batch] ,[guest_name] ,[identityno] ,[order_note] ,[forecasttime] ,[consignee] ,[address] ,[zipcode] ,[orderId] FROM [api_mjld_SubmitOrder_input] where orderid=" + orderid; var cmd = sqlHelper.PrepareTextSqlCommand(sql); using (var reader = cmd.ExecuteReader()) { Api_Mjld_SubmitOrder_input m = null; if (reader.Read()) { m = new Api_Mjld_SubmitOrder_input { id = reader.GetValue <int>("id"), timeStamp = reader.GetValue <string>("timeStamp"), user = reader.GetValue <string>("user"), password = reader.GetValue <string>("password"), goodsId = reader.GetValue <string>("goodsId"), num = reader.GetValue <string>("num"), phone = reader.GetValue <string>("phone"), batch = reader.GetValue <string>("batch"), guest_name = reader.GetValue <string>("guest_name"), identityno = reader.GetValue <string>("identityno"), order_note = reader.GetValue <string>("order_note"), forecasttime = reader.GetValue <string>("forecasttime"), consignee = reader.GetValue <string>("consignee"), address = reader.GetValue <string>("address"), zipcode = reader.GetValue <string>("zipcode"), orderId = reader.GetValue <int>("orderId"), }; } return(m); } }
internal int EditApi_mjld_SubmitOrder_input(Api_Mjld_SubmitOrder_input m) { //暂时只有录入操作,没有编辑操作 if (m.id > 0) { return(0); } else { string sql = @"INSERT [api_mjld_SubmitOrder_input] ([timeStamp] ,[user] ,[password] ,[goodsId] ,[num] ,[phone] ,[batch] ,[guest_name] ,[identityno] ,[order_note] ,[forecasttime] ,[consignee] ,[address] ,[zipcode] ,[orderId]) VALUES (@timeStamp ,@user ,@password ,@goodsId ,@num ,@phone ,@batch ,@guest_name ,@identityno ,@order_note ,@forecasttime ,@consignee ,@address ,@zipcode ,@orderId);select @@identity;"; var cmd = sqlHelper.PrepareTextSqlCommand(sql); cmd.AddParam("@timeStamp", m.timeStamp); cmd.AddParam("@user", m.user); cmd.AddParam("@password", m.password); cmd.AddParam("@goodsId", m.goodsId); cmd.AddParam("@num", m.num); cmd.AddParam("@phone", m.phone); cmd.AddParam("@batch", m.batch); cmd.AddParam("@guest_name", m.guest_name); cmd.AddParam("@identityno", m.identityno); cmd.AddParam("@order_note", m.order_note); cmd.AddParam("@forecasttime", m.forecasttime); cmd.AddParam("@consignee", m.consignee); cmd.AddParam("@address", m.address); cmd.AddParam("@zipcode", m.zipcode); cmd.AddParam("@orderId", m.orderId); object o = cmd.ExecuteScalar(); return(int.Parse(o.ToString())); } }