public void ProcessRequest(HttpContext context) { string s = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"; string str2 = ""; string str3 = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"; string str4 = ""; SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); string format = "<trade><Oid>{0}</Oid><SellerUid>{1}</SellerUid><BuyerNick>{2}</BuyerNick><BuyerEmail>{3}</BuyerEmail><ReceiverName>{4}</ReceiverName><ReceiverState>{5}</ReceiverState><ReceiverCity>{6}</ReceiverCity><ReceiverDistrict>{7}</ReceiverDistrict><ReceiverAddress>{8}</ReceiverAddress><ReceiverZip>{9}</ReceiverZip><ReceiverMobile>{10}</ReceiverMobile><ReceiverPhone>{11}</ReceiverPhone><BuyerMemo>{12}</BuyerMemo><OrderMark>{13}</OrderMark><SellerMemo>{14}</SellerMemo><Nums>{15}</Nums><Price>{16}</Price><Payment>{17}</Payment><PostFee>{18}</PostFee><DiscountFee>{19}</DiscountFee><AdjustFee>{20}</AdjustFee><PaymentTs>{21}</PaymentTs><SentTs>{22}</SentTs><RefundStatus>{23}</RefundStatus><RefundAmount>{24}</RefundAmount><RefundRemark>{25}</RefundRemark><Status>{26}</Status><orders list=\"{27}\">{28}</orders></trade>"; string orderitemfomat = "<order><Tid>{0}</Tid><Oid>{1}</Oid><GoodsIid>{2}</GoodsIid><Title>{3}</Title><OuterId>{4}</OuterId><SKUContent>{5}</SKUContent><Nums>{6}</Nums><Price>{7}</Price><Payment>{8}</Payment></order>"; StringBuilder builder = new StringBuilder(); str2 = context.Request.QueryString["action"].ToString(); string sign = context.Request.Form["sign"]; string checkCode = masterSettings.CheckCode; string str9 = context.Request.Form["format"]; new Dictionary <string, string>(); SortedDictionary <string, string> tmpParas = new SortedDictionary <string, string>(); try { string str15; string str17; string str20; if (string.IsNullOrEmpty(str2)) { goto Label_07D6; } string str22 = str2; if (str22 == null) { goto Label_07B9; } if (!(str22 == "tradelist")) { if (str22 == "tradedetails") { goto Label_0336; } if (str22 == "send") { goto Label_046D; } if (str22 == "mark") { goto Label_0613; } goto Label_07B9; } OrderQuery query2 = new OrderQuery(); query2.PageSize = 100; OrderQuery query = query2; int totalrecords = 0; string str10 = context.Request.Form["status"].Trim(); string str11 = context.Request.Form["buyernick"].Trim(); string str12 = context.Request.Form["pageindex"].Trim(); string str13 = context.Request.Form["starttime"].Trim(); string str14 = context.Request.Form["endtime"].Trim(); if (!string.IsNullOrEmpty(str10) && (Convert.ToInt32(str10) >= 0)) { query.Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), str10, true); } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "status"); } if (!string.IsNullOrEmpty(str12) && (Convert.ToInt32(str12) > 0)) { query.PageIndex = Convert.ToInt32(str12); } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "pageindex"); } if (string.IsNullOrEmpty(str4)) { tmpParas.Add("status", str10); tmpParas.Add("buyernick", str11); tmpParas.Add("pageindex", str12); tmpParas.Add("starttime", str13); tmpParas.Add("endtime", str14); tmpParas.Add("format", str9); if (APIHelper.CheckSign(tmpParas, checkCode, sign)) { if (!string.IsNullOrEmpty(str11)) { query.UserName = str11; } if (!string.IsNullOrEmpty(str13)) { query.StartDate = new DateTime?(Convert.ToDateTime(str13)); } if (!string.IsNullOrEmpty(str14)) { query.EndDate = new DateTime?(Convert.ToDateTime(str14)); } builder.Append("<trade_get_response>"); builder.Append(this.GetOrderList(query, format, orderitemfomat, out totalrecords).ToString()); builder.Append("<totalrecord>" + totalrecords + "</totalrecord>"); builder.Append("</trade_get_response>"); } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign"); } } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "paramter"); } goto Label_07C6; Label_0336: str15 = ""; if (!string.IsNullOrEmpty(context.Request.Form["tid"].Trim())) { str15 = context.Request.Form["tid"].Trim(); tmpParas = new SortedDictionary <string, string>(); tmpParas.Add("tid", context.Request.Form["tid"]); tmpParas.Add("format", str9); if (APIHelper.CheckSign(tmpParas, checkCode, sign)) { string str16 = context.Request.Form["tid"].Replace("\r\n", "\n"); if (!string.IsNullOrEmpty(str16)) { str15 = str16; OrderInfo orderInfo = OrderHelper.GetOrderInfo(str15); builder.Append("<trade_get_response>"); builder.Append(this.GetOrderDetails(format, orderitemfomat, orderInfo).ToString()); builder.Append("</trade_get_response>"); } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Format_Eroor, "tid"); } } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "signature"); } } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "tid"); } goto Label_07C6; Label_046D: str17 = context.Request.Form["tid"].Trim(); string str18 = context.Request.Form["out_sid"].Trim(); string str19 = context.Request.Form["company_code"].Trim(); if ((!string.IsNullOrEmpty(str17) && !string.IsNullOrEmpty(str19)) && !string.IsNullOrEmpty(str18)) { tmpParas.Add("tid", str17); tmpParas.Add("out_sid", str18); tmpParas.Add("company_code", str19); tmpParas.Add("format", str9); if (APIHelper.CheckSign(tmpParas, checkCode, sign)) { ExpressCompanyInfo express = ExpressHelper.FindNodeByCode(str19); if (!string.IsNullOrEmpty(express.Name)) { ShippingModeInfo shippingModeByCompany = SalesHelper.GetShippingModeByCompany(express.Name); OrderInfo order = OrderHelper.GetOrderInfo(str17); if (order != null) { ApiErrorCode messageenum = this.SendOrders(order, shippingModeByCompany, str18, express); if (messageenum == ApiErrorCode.Success) { builder.Append("<trade_get_response>"); order = OrderHelper.GetOrderInfo(str17); builder.Append(this.GetOrderDetails(format, orderitemfomat, order).ToString()); builder.Append("</trade_get_response>"); } else { str4 = MessageInfo.ShowMessageInfo(messageenum, "It"); } } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.NoExists_Error, "tid"); } } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.NoExists_Error, "company_code"); } } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign"); } } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "paramters"); } goto Label_07C6; Label_0613: str20 = context.Request.Form["order_mark"].Trim(); string str21 = context.Request.Form["seller_memo"].Trim(); if ((!string.IsNullOrEmpty(context.Request.Form["tid"].Trim()) && !string.IsNullOrEmpty(str20)) && !string.IsNullOrEmpty(str21)) { if ((Convert.ToInt32(str20) > 0) && (Convert.ToInt32(str20) < 7)) { str15 = context.Request.Form["tid"].Trim(); tmpParas.Add("tid", str15); tmpParas.Add("order_mark", str20); tmpParas.Add("seller_memo", str21); tmpParas.Add("format", str9); if (APIHelper.CheckSign(tmpParas, checkCode, sign)) { OrderInfo info5 = OrderHelper.GetOrderInfo(str15); info5.ManagerMark = new OrderMark?((OrderMark)Enum.Parse(typeof(OrderMark), str20, true)); info5.ManagerRemark = Globals.HtmlEncode(str21); if (OrderHelper.SaveRemarkAPI(info5)) { builder.Append("<trade_get_response>"); builder.Append(this.GetOrderDetails(format, orderitemfomat, info5).ToString()); builder.Append("</trade_get_response>"); } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Paramter_Error, "save is failure "); } } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign"); } } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Format_Eroor, "order_mark"); } } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "tid or order_mark or seller_memo"); } goto Label_07C6; Label_07B9: str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Paramter_Error, "paramters"); Label_07C6: s = s + builder.ToString(); goto Label_07FB; Label_07D6: str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Paramter_Error, "sign"); } catch (Exception exception) { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Unknown_Error, exception.Message); } Label_07FB: if (!string.IsNullOrEmpty(str4)) { s = str3 + str4; } context.Response.ContentType = "text/xml"; context.Response.Write(s); }
public void ProcessRequest(HttpContext context) { string str = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"; string str2 = ""; string str3 = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"; string str4 = ""; string s = ""; SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); new StringBuilder(); str2 = context.Request.QueryString["action"].ToString(); string sign = context.Request.Form["sign"]; string str7 = context.Request.Form["format"]; string checkCode = masterSettings.CheckCode; XmlDocument node = new XmlDocument(); new Dictionary <string, string>(); SortedDictionary <string, string> tmpParas = new SortedDictionary <string, string>(); try { string str11; if (((str11 = str2) != null) && (str11 == "distribution_list")) { string str9 = context.Request.Form["parma"].Trim(); str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "parma"); if (!string.IsNullOrEmpty(str9)) { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign"); DistributorQuery query = new DistributorQuery(); query = (DistributorQuery)JavaScriptConvert.DeserializeObject(str9, typeof(DistributorQuery)); tmpParas = this.GetDistriubots(query); tmpParas.Add("action", "distribution_list"); tmpParas.Add("format", str7); if (APIHelper.CheckSign(tmpParas, checkCode, sign)) { DbQueryResult distributors = DistributorHelper.GetDistributors(query); string format = str + "<response_distributors>{0}<totalcount>{1}</totalcount></response_distributors>"; if (distributors.Data != null) { s = string.Format(format, this.ConvertTableToXml((DataTable)distributors.Data), distributors.TotalRecords.ToString()); } else { s = string.Format(format, "", "0"); } } } } } catch (Exception exception) { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Unknown_Error, exception.Message); } if (s == "") { s = s + str3 + str4; } context.Response.ContentType = "text/xml"; if (str7 == "json") { s = s.Replace("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>", ""); node.Load(new MemoryStream(Encoding.GetEncoding("UTF-8").GetBytes(s))); s = JavaScriptConvert.SerializeXmlNode(node); context.Response.ContentType = "text/json"; } context.Response.Write(s); }
public void ProcessRequest(System.Web.HttpContext context) { string str = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"; string str2 = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"; string str3 = ""; string text = ""; Hidistro.Membership.Context.SiteSettings masterSettings = Hidistro.Membership.Context.SettingsManager.GetMasterSettings(false); new System.Text.StringBuilder(); string text2 = context.Request.QueryString["action"].ToString(); string sign = context.Request.Form["sign"]; string text3 = context.Request.Form["format"]; string checkCode = masterSettings.CheckCode; System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument(); new System.Collections.Generic.Dictionary <string, string>(); System.Collections.Generic.SortedDictionary <string, string> sortedDictionary = new System.Collections.Generic.SortedDictionary <string, string>(); try { string a; if ((a = text2) != null && a == "distribution_list") { string text4 = context.Request.Form["parma"].Trim(); str3 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "parma"); if (!string.IsNullOrEmpty(text4)) { str3 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign"); DistributorQuery query = new DistributorQuery(); query = (DistributorQuery)JavaScriptConvert.DeserializeObject(text4, typeof(DistributorQuery)); sortedDictionary = this.GetDistriubots(query); sortedDictionary.Add("action", "distribution_list"); sortedDictionary.Add("format", text3); if (APIHelper.CheckSign(sortedDictionary, checkCode, sign)) { DbQueryResult distributors = DistributorHelper.GetDistributors(query); string format = str + "<response_distributors>{0}<totalcount>{1}</totalcount></response_distributors>"; if (distributors.Data != null) { text = string.Format(format, this.ConvertTableToXml((System.Data.DataTable)distributors.Data), distributors.TotalRecords.ToString()); } else { text = string.Format(format, "", "0"); } } } } } catch (System.Exception ex) { str3 = MessageInfo.ShowMessageInfo(ApiErrorCode.Unknown_Error, ex.Message); } if (text == "") { text = text + str2 + str3; } context.Response.ContentType = "text/xml"; if (text3 == "json") { text = text.Replace("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>", ""); xmlDocument.Load(new System.IO.MemoryStream(System.Text.Encoding.GetEncoding("UTF-8").GetBytes(text))); text = JavaScriptConvert.SerializeXmlNode(xmlDocument); context.Response.ContentType = "text/json"; } context.Response.Write(text); }
public void ProcessRequest(System.Web.HttpContext context) { string text = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"; string str = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"; string text2 = ""; Hidistro.Membership.Context.SiteSettings masterSettings = Hidistro.Membership.Context.SettingsManager.GetMasterSettings(false); string format = "<trade><Oid>{0}</Oid><SellerUid>{1}</SellerUid><BuyerNick>{2}</BuyerNick><BuyerEmail>{3}</BuyerEmail><ReceiverName>{4}</ReceiverName><ReceiverState>{5}</ReceiverState><ReceiverCity>{6}</ReceiverCity><ReceiverDistrict>{7}</ReceiverDistrict><ReceiverAddress>{8}</ReceiverAddress><ReceiverZip>{9}</ReceiverZip><ReceiverMobile>{10}</ReceiverMobile><ReceiverPhone>{11}</ReceiverPhone><BuyerMemo>{12}</BuyerMemo><OrderMark>{13}</OrderMark><SellerMemo>{14}</SellerMemo><Nums>{15}</Nums><Price>{16}</Price><Payment>{17}</Payment><PostFee>{18}</PostFee><Profit>{19}</Profit><PurchaseTotal>{20}</PurchaseTotal><PaymentTs>{21}</PaymentTs><SentTs>{22}</SentTs><RefundStatus>{23}</RefundStatus><RefundAmount>{24}</RefundAmount><RefundRemark>{25}</RefundRemark><Status>{26}</Status><orders list=\"{27}\">{28}</orders></trade>"; string orderitemfomat = "<order><Tid>{0}</Tid><Oid>{1}</Oid><GoodsIid>{2}</GoodsIid><Title>{3}</Title><OuterId>{4}</OuterId><SKUContent>{5}</SKUContent><Nums>{6}</Nums><Price>{7}</Price><Payment>{8}</Payment><CostPrice>{9}</CostPrice></order>"; System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); string text3 = context.Request.QueryString["action"].ToString(); string sign = context.Request.Form["sign"]; string checkCode = masterSettings.CheckCode; string text4 = context.Request.Form["format"]; System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument(); System.Collections.Generic.SortedDictionary <string, string> sortedDictionary = new System.Collections.Generic.SortedDictionary <string, string>(); string a; if ((a = text3) != null) { if (!(a == "tradelist")) { if (!(a == "tradedetails")) { if (!(a == "send")) { if (a == "mark") { string value = context.Request.Form["order_mark"].Trim(); string text5 = context.Request.Form["seller_memo"].Trim(); if (!string.IsNullOrEmpty(context.Request.Form["tid"].Trim()) && !string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(text5)) { if (System.Convert.ToInt32(value) > 0 && System.Convert.ToInt32(value) < 7) { string text6 = context.Request.Form["tid"].Trim(); sortedDictionary.Add("tid", text6); sortedDictionary.Add("order_mark", value); sortedDictionary.Add("seller_memo", text5); sortedDictionary.Add("format", text4); if (APIHelper.CheckSign(sortedDictionary, checkCode, sign)) { PurchaseOrderInfo purchaseOrder = SalesHelper.GetPurchaseOrder(text6); purchaseOrder.ManagerMark = new OrderMark?((OrderMark)System.Enum.Parse(typeof(OrderMark), value, true)); purchaseOrder.ManagerRemark = Globals.HtmlEncode(text5); if (SalesHelper.SaveAPIPurchaseOrderRemark(purchaseOrder)) { stringBuilder.Append("<trade_get_response>"); stringBuilder.Append(this.GetOrderDetails(format, orderitemfomat, purchaseOrder).ToString()); stringBuilder.Append("</trade_get_response>"); this.message = text + stringBuilder.ToString(); } else { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Paramter_Error, "save is failure "); } } else { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign"); } } else { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Format_Eroor, "order_mark"); } } else { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "tid or order_mark or seller_memo"); } } } else { string text7 = context.Request.Form["tid"].Trim(); string text8 = context.Request.Form["out_sid"].Trim(); string text9 = context.Request.Form["company_code"].Trim(); if (!string.IsNullOrEmpty(text7) && !string.IsNullOrEmpty(text9) && !string.IsNullOrEmpty(text8)) { sortedDictionary.Add("tid", text7); sortedDictionary.Add("out_sid", text8); sortedDictionary.Add("company_code", text9); sortedDictionary.Add("format", text4); if (APIHelper.CheckSign(sortedDictionary, checkCode, sign)) { ExpressCompanyInfo expressCompanyInfo = ExpressHelper.FindNodeByCode(text9); if (!string.IsNullOrEmpty(expressCompanyInfo.Name)) { ShippingModeInfo shippingModeByCompany = SalesHelper.GetShippingModeByCompany(expressCompanyInfo.Name); PurchaseOrderInfo purchaseOrder2 = SalesHelper.GetPurchaseOrder(text7); if (purchaseOrder2 != null) { ApiErrorCode apiErrorCode = this.SendOrders(purchaseOrder2, shippingModeByCompany, text8, expressCompanyInfo); if (apiErrorCode == ApiErrorCode.Success) { stringBuilder.Append("<trade_get_response>"); purchaseOrder2 = SalesHelper.GetPurchaseOrder(text7); stringBuilder.Append(this.GetOrderDetails(format, orderitemfomat, purchaseOrder2).ToString()); stringBuilder.Append("</trade_get_response>"); this.message = text + stringBuilder.ToString(); } else { text2 = MessageInfo.ShowMessageInfo(apiErrorCode, "It"); } } else { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.NoExists_Error, "tid"); } } else { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.NoExists_Error, "company_code"); } } else { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign"); } } else { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "paramters"); } } } else { if (!string.IsNullOrEmpty(context.Request.Form["tid"].Trim())) { string text6 = context.Request.Form["tid"].Trim(); if (APIHelper.CheckSign(new System.Collections.Generic.SortedDictionary <string, string> { { "tid", context.Request.Form["tid"] }, { "format", text4 } }, checkCode, sign)) { string text10 = context.Request.Form["tid"].Replace("\r\n", "\n"); if (!string.IsNullOrEmpty(text10)) { text6 = text10; PurchaseOrderInfo purchaseOrder3 = SalesHelper.GetPurchaseOrder(text6); stringBuilder.Append("<trade_get_response>"); stringBuilder.Append(this.GetOrderDetails(format, orderitemfomat, purchaseOrder3).ToString()); stringBuilder.Append("</trade_get_response>"); this.message = text + stringBuilder.ToString(); } else { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Format_Eroor, "tid"); } } else { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "signature"); } } else { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "tid"); } } } else { PurchaseOrderQuery purchaseOrderQuery = new PurchaseOrderQuery { PageSize = 100 }; int num = 0; string value2 = context.Request.Form["status"].Trim(); string text11 = context.Request.Form["buynick"].Trim(); string value3 = context.Request.Form["pageindex"].Trim(); string value4 = context.Request.Form["starttime"].Trim(); string value5 = context.Request.Form["endtime"].Trim(); if (!string.IsNullOrEmpty(value2) && System.Convert.ToInt32(value2) >= 0) { purchaseOrderQuery.PurchaseStatus = (OrderStatus)System.Enum.Parse(typeof(OrderStatus), value2, true); } else { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "status"); } if (!string.IsNullOrEmpty(value3) && System.Convert.ToInt32(value3) > 0) { purchaseOrderQuery.PageIndex = System.Convert.ToInt32(value3); } else { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "pageindex"); } if (string.IsNullOrEmpty(text2)) { sortedDictionary.Add("status", value2); sortedDictionary.Add("buynick", text11); sortedDictionary.Add("pageindex", value3); sortedDictionary.Add("starttime", value4); sortedDictionary.Add("endtime", value5); sortedDictionary.Add("format", text4); if (APIHelper.CheckSign(sortedDictionary, checkCode, sign)) { if (!string.IsNullOrEmpty(text11)) { purchaseOrderQuery.DistributorName = text11; } if (!string.IsNullOrEmpty(value4)) { purchaseOrderQuery.StartDate = new System.DateTime?(System.Convert.ToDateTime(value4)); } if (!string.IsNullOrEmpty(value5)) { purchaseOrderQuery.EndDate = new System.DateTime?(System.Convert.ToDateTime(value5)); } purchaseOrderQuery.SortOrder = SortAction.Desc; purchaseOrderQuery.SortBy = "PurchaseDate"; stringBuilder.Append("<trade_get_response>"); stringBuilder.Append(this.GetOrderList(purchaseOrderQuery, format, orderitemfomat, out num)); stringBuilder.Append("<totalrecord>" + num + "</totalrecord>"); stringBuilder.Append("</trade_get_response>"); this.message = text + stringBuilder.ToString(); } else { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign"); } } else { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "paramter"); } } } if (this.message == "") { this.message = this.message + str + text2; } context.Response.ContentType = "text/xml"; if (text4 == "json") { this.message = this.message.Replace(text, ""); xmlDocument.Load(new System.IO.MemoryStream(System.Text.Encoding.GetEncoding("UTF-8").GetBytes(this.message))); this.message = JavaScriptConvert.SerializeXmlNode(xmlDocument); context.Response.ContentType = "text/json"; } context.Response.Write(this.message); }
public void ProcessRequest(System.Web.HttpContext context) { string text = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"; string str = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"; string text2 = ""; Hidistro.Membership.Context.SiteSettings masterSettings = Hidistro.Membership.Context.SettingsManager.GetMasterSettings(false); string format = "<trade><Oid>{0}</Oid><SellerUid>{1}</SellerUid><BuyerNick>{2}</BuyerNick><BuyerEmail>{3}</BuyerEmail><ReceiverName>{4}</ReceiverName><ReceiverState>{5}</ReceiverState><ReceiverCity>{6}</ReceiverCity><ReceiverDistrict>{7}</ReceiverDistrict><ReceiverAddress>{8}</ReceiverAddress><ReceiverZip>{9}</ReceiverZip><ReceiverMobile>{10}</ReceiverMobile><ReceiverPhone>{11}</ReceiverPhone><BuyerMemo>{12}</BuyerMemo><OrderMark>{13}</OrderMark><SellerMemo>{14}</SellerMemo><Nums>{15}</Nums><Price>{16}</Price><Payment>{17}</Payment><PostFee>{18}</PostFee><DiscountFee>{19}</DiscountFee><AdjustFee>{20}</AdjustFee><PaymentTs>{21}</PaymentTs><SentTs>{22}</SentTs><RefundStatus>{23}</RefundStatus><RefundAmount>{24}</RefundAmount><RefundRemark>{25}</RefundRemark><Status>{26}</Status><orders list=\"{27}\">{28}</orders></trade>"; string orderitemfomat = "<order><Tid>{0}</Tid><Oid>{1}</Oid><GoodsIid>{2}</GoodsIid><Title>{3}</Title><OuterId>{4}</OuterId><SKUContent>{5}</SKUContent><Nums>{6}</Nums><Price>{7}</Price><Payment>{8}</Payment></order>"; System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); string text3 = context.Request.QueryString["action"].ToString(); string sign = context.Request.Form["sign"]; string checkCode = masterSettings.CheckCode; string value = context.Request.Form["format"]; new System.Collections.Generic.Dictionary <string, string>(); System.Collections.Generic.SortedDictionary <string, string> sortedDictionary = new System.Collections.Generic.SortedDictionary <string, string>(); try { if (!string.IsNullOrEmpty(text3)) { string a; if ((a = text3) != null) { if (!(a == "tradelist")) { if (!(a == "tradedetails")) { if (!(a == "send")) { if (a == "mark") { string value2 = context.Request.Form["order_mark"].Trim(); string text4 = context.Request.Form["seller_memo"].Trim(); if (string.IsNullOrEmpty(context.Request.Form["tid"].Trim()) || string.IsNullOrEmpty(value2) || string.IsNullOrEmpty(text4)) { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "tid or order_mark or seller_memo"); goto IL_7CA; } if (System.Convert.ToInt32(value2) <= 0 || System.Convert.ToInt32(value2) >= 7) { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Format_Eroor, "order_mark"); goto IL_7CA; } string text5 = context.Request.Form["tid"].Trim(); sortedDictionary.Add("tid", text5); sortedDictionary.Add("order_mark", value2); sortedDictionary.Add("seller_memo", text4); sortedDictionary.Add("format", value); if (!APIHelper.CheckSign(sortedDictionary, checkCode, sign)) { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign"); goto IL_7CA; } OrderInfo orderInfo = OrderHelper.GetOrderInfo(text5); orderInfo.ManagerMark = new OrderMark?((OrderMark)System.Enum.Parse(typeof(OrderMark), value2, true)); orderInfo.ManagerRemark = Globals.HtmlEncode(text4); if (OrderHelper.SaveRemarkAPI(orderInfo)) { stringBuilder.Append("<trade_get_response>"); stringBuilder.Append(this.GetOrderDetails(format, orderitemfomat, orderInfo).ToString()); stringBuilder.Append("</trade_get_response>"); goto IL_7CA; } text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Paramter_Error, "save is failure "); goto IL_7CA; } } else { string text6 = context.Request.Form["tid"].Trim(); string text7 = context.Request.Form["out_sid"].Trim(); string text8 = context.Request.Form["company_code"].Trim(); if (string.IsNullOrEmpty(text6) || string.IsNullOrEmpty(text8) || string.IsNullOrEmpty(text7)) { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "paramters"); goto IL_7CA; } sortedDictionary.Add("tid", text6); sortedDictionary.Add("out_sid", text7); sortedDictionary.Add("company_code", text8); sortedDictionary.Add("format", value); if (!APIHelper.CheckSign(sortedDictionary, checkCode, sign)) { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign"); goto IL_7CA; } ExpressCompanyInfo expressCompanyInfo = ExpressHelper.FindNodeByCode(text8); if (string.IsNullOrEmpty(expressCompanyInfo.Name)) { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.NoExists_Error, "company_code"); goto IL_7CA; } ShippingModeInfo shippingModeByCompany = SalesHelper.GetShippingModeByCompany(expressCompanyInfo.Name); OrderInfo orderInfo2 = OrderHelper.GetOrderInfo(text6); if (orderInfo2 == null) { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.NoExists_Error, "tid"); goto IL_7CA; } ApiErrorCode apiErrorCode = this.SendOrders(orderInfo2, shippingModeByCompany, text7, expressCompanyInfo); if (apiErrorCode == ApiErrorCode.Success) { stringBuilder.Append("<trade_get_response>"); orderInfo2 = OrderHelper.GetOrderInfo(text6); stringBuilder.Append(this.GetOrderDetails(format, orderitemfomat, orderInfo2).ToString()); stringBuilder.Append("</trade_get_response>"); goto IL_7CA; } text2 = MessageInfo.ShowMessageInfo(apiErrorCode, "It"); goto IL_7CA; } } else { if (string.IsNullOrEmpty(context.Request.Form["tid"].Trim())) { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "tid"); goto IL_7CA; } string text5 = context.Request.Form["tid"].Trim(); if (!APIHelper.CheckSign(new System.Collections.Generic.SortedDictionary <string, string> { { "tid", context.Request.Form["tid"] }, { "format", value } }, checkCode, sign)) { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "signature"); goto IL_7CA; } string text9 = context.Request.Form["tid"].Replace("\r\n", "\n"); if (!string.IsNullOrEmpty(text9)) { text5 = text9; OrderInfo orderInfo3 = OrderHelper.GetOrderInfo(text5); stringBuilder.Append("<trade_get_response>"); stringBuilder.Append(this.GetOrderDetails(format, orderitemfomat, orderInfo3).ToString()); stringBuilder.Append("</trade_get_response>"); goto IL_7CA; } text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Format_Eroor, "tid"); goto IL_7CA; } } else { OrderQuery orderQuery = new OrderQuery { PageSize = 100 }; int num = 0; string value3 = context.Request.Form["status"].Trim(); string text10 = context.Request.Form["buyernick"].Trim(); string value4 = context.Request.Form["pageindex"].Trim(); string value5 = context.Request.Form["starttime"].Trim(); string value6 = context.Request.Form["endtime"].Trim(); if (!string.IsNullOrEmpty(value3) && System.Convert.ToInt32(value3) >= 0) { orderQuery.Status = (OrderStatus)System.Enum.Parse(typeof(OrderStatus), value3, true); } else { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "status"); } if (!string.IsNullOrEmpty(value4) && System.Convert.ToInt32(value4) > 0) { orderQuery.PageIndex = System.Convert.ToInt32(value4); } else { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "pageindex"); } if (!string.IsNullOrEmpty(text2)) { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "paramter"); goto IL_7CA; } sortedDictionary.Add("status", value3); sortedDictionary.Add("buyernick", text10); sortedDictionary.Add("pageindex", value4); sortedDictionary.Add("starttime", value5); sortedDictionary.Add("endtime", value6); sortedDictionary.Add("format", value); if (APIHelper.CheckSign(sortedDictionary, checkCode, sign)) { if (!string.IsNullOrEmpty(text10)) { orderQuery.UserName = text10; } if (!string.IsNullOrEmpty(value5)) { orderQuery.StartDate = new System.DateTime?(System.Convert.ToDateTime(value5)); } if (!string.IsNullOrEmpty(value6)) { orderQuery.EndDate = new System.DateTime?(System.Convert.ToDateTime(value6)); } stringBuilder.Append("<trade_get_response>"); stringBuilder.Append(this.GetOrderList(orderQuery, format, orderitemfomat, out num).ToString()); stringBuilder.Append("<totalrecord>" + num + "</totalrecord>"); stringBuilder.Append("</trade_get_response>"); goto IL_7CA; } text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign"); goto IL_7CA; } } text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Paramter_Error, "paramters"); IL_7CA: text += stringBuilder.ToString(); } else { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Paramter_Error, "sign"); } } catch (System.Exception ex) { text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Unknown_Error, ex.Message); } if (!string.IsNullOrEmpty(text2)) { text = str + text2; } context.Response.ContentType = "text/xml"; context.Response.Write(text); }