public int EditApi_yg_cancelorder(Api_yg_cancelorder m) { using (var helper = new SqlHelper()) { int r = new Internalapi_yg_cancelorder(helper).EditApi_yg_cancelorder(m); return(r); } }
public string cancel_order(ApiService mapiservice, Api_yg_cancelorder m_ygcancelorder) { StringBuilder buildOrder = new StringBuilder(); buildOrder.Append(@"<?xml version=""1.0"" encoding=""utf-8""?>"); buildOrder.Append(@"<business_trans version=""1.0"">"); buildOrder.Append("<request_type>cancel_order</request_type>"); //<!--撤销--> buildOrder.AppendFormat("<organization>{0}</organization>", mapiservice.Organization); //<!--机构号--> buildOrder.AppendFormat("<password>{0}</password>", mapiservice.Password); //<!-- 接口使用密码 --> buildOrder.AppendFormat("<req_seq>{0}</req_seq>", m_ygcancelorder.req_seq); //<!--请求流水号--> buildOrder.Append("<order>"); buildOrder.AppendFormat("<order_num>{0}</order_num>", m_ygcancelorder.ygorder_num); //<!-- 订单号 y--> buildOrder.AppendFormat("<num>{0}</num>", m_ygcancelorder.num); //<!-- 张数 y--> buildOrder.Append("</order>"); buildOrder.Append("</business_trans>"); string bstr = ""; try { ITicketService its12 = new ITicketService(); string en = EncryptionHelper.DESEnCode(buildOrder.ToString(), mapiservice.Deskey); string retxmls = its12.getEleInterface(mapiservice.Organization, en); bstr = EncryptionHelper.DESDeCode(retxmls, mapiservice.Deskey); } catch (Exception e) { bstr = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<business_trans>" + "<response_type>cancel_order</response_type>" + "<req_seq>" + m_ygcancelorder.req_seq + "</req_seq>" + "<result>" + "<id></id>" + "<comment>" + e.Message + "</comment>" + " </result>" + "</business_trans>"; } //录入交互日志 ApiLog mapilog = new ApiLog { Id = 0, request_type = "cancel_order", Serviceid = 1, Str = buildOrder.ToString().Trim(), Subdate = DateTime.Now, ReturnStr = bstr, ReturnSubdate = DateTime.Now, Errmsg = "", }; int ins = new ApiLogData().EditLog(mapilog); return(bstr); }
internal int EditApi_yg_cancelorder(Api_yg_cancelorder m) { if (m.id > 0) { string sql = @"UPDATE [api_yg_cancelorder] SET [organization] = @organization ,[password] = @password ,[req_seq] = @req_seq ,[ygorder_num] = @ygorder_num ,[num] = @num ,[rResultid] = @rResultid ,[rResultComment] = @rResultComment ,[rygorder_num] = @rygorder_num ,[rnum] = @rnum ,[orderId] = @orderId ,[opertime] = @opertime WHERE id=@id"; var cmd = sqlHelper.PrepareTextSqlCommand(sql); cmd.AddParam("@id", m.id); cmd.AddParam("@organization", m.organization); cmd.AddParam("@password", m.password); cmd.AddParam("@req_seq", m.req_seq); cmd.AddParam("@ygorder_num", m.ygorder_num); cmd.AddParam("@num", m.num); cmd.AddParam("@rResultid", m.rResultid); cmd.AddParam("@rResultComment", m.rResultComment); cmd.AddParam("@rygorder_num", m.rygorder_num); cmd.AddParam("@rnum", m.rnum); cmd.AddParam("@orderId", m.orderId); cmd.AddParam("@opertime", m.opertime); cmd.ExecuteNonQuery(); return(m.id); } else { string sql = @"INSERT [api_yg_cancelorder] ([organization] ,[password] ,[req_seq] ,[ygorder_num] ,[num] ,[rResultid] ,[rResultComment] ,[rygorder_num] ,[rnum] ,[orderId] ,[opertime]) VALUES (@organization ,@password ,@req_seq ,@ygorder_num ,@num ,@rResultid ,@rResultComment ,@rygorder_num ,@rnum ,@orderId ,@opertime);select @@identity;"; var cmd = sqlHelper.PrepareTextSqlCommand(sql); cmd.AddParam("@organization", m.organization); cmd.AddParam("@password", m.password); cmd.AddParam("@req_seq", m.req_seq); cmd.AddParam("@ygorder_num", m.ygorder_num); cmd.AddParam("@num", m.num); cmd.AddParam("@rResultid", m.rResultid); cmd.AddParam("@rResultComment", m.rResultComment); cmd.AddParam("@rygorder_num", m.rygorder_num); cmd.AddParam("@rnum", m.rnum); cmd.AddParam("@orderId", m.orderId); cmd.AddParam("@opertime", m.opertime); object o = cmd.ExecuteScalar(); return(int.Parse(o.ToString())); } }