private void BindPurchaseOrders() { PurchaseOrderQuery purchaseOrderQuery = GetPurchaseOrderQuery(); purchaseOrderQuery.SortBy = "PurchaseDate"; purchaseOrderQuery.SortOrder = SortAction.Desc; DbQueryResult purchaseOrders = SalesHelper.GetPurchaseOrders(purchaseOrderQuery); dlstPurchaseOrders.DataSource = purchaseOrders.Data; dlstPurchaseOrders.DataBind(); pager.TotalRecords = purchaseOrders.TotalRecords; pager1.TotalRecords = purchaseOrders.TotalRecords; txtOrderId.Text = purchaseOrderQuery.OrderId; txtProductName.Text = purchaseOrderQuery.ProductName; txtDistributorName.Text = purchaseOrderQuery.DistributorName; txtPurchaseOrderId.Text = purchaseOrderQuery.PurchaseOrderId; txtShopTo.Text = purchaseOrderQuery.ShipTo; calendarStartDate.SelectedDate = purchaseOrderQuery.StartDate; calendarEndDate.SelectedDate = purchaseOrderQuery.EndDate; lblStatus.Text = ((int)purchaseOrderQuery.PurchaseStatus).ToString(); shippingModeDropDownList.SelectedValue = purchaseOrderQuery.ShippingModeId; if (purchaseOrderQuery.IsPrinted.HasValue) { ddlIsPrinted.SelectedValue = purchaseOrderQuery.IsPrinted.Value.ToString(); } }
private PurchaseOrderQuery GetPurchaseOrderQuery() { PurchaseOrderQuery purchaseOrderQuery = new PurchaseOrderQuery(); if (!string.IsNullOrEmpty(this.Page.Request.QueryString["ShipTo"])) { purchaseOrderQuery.ShipTo = Globals.UrlDecode(this.Page.Request.QueryString["ShipTo"]); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["PurchaseOrderId"])) { purchaseOrderQuery.PurchaseOrderId = Globals.UrlDecode(this.Page.Request.QueryString["PurchaseOrderId"]); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["startDate"])) { purchaseOrderQuery.StartDate = new System.DateTime?(System.DateTime.Parse(this.Page.Request.QueryString["startDate"])); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["endDate"])) { purchaseOrderQuery.EndDate = new System.DateTime?(System.DateTime.Parse(this.Page.Request.QueryString["endDate"])); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["PurchaseStatus"])) { int purchaseStatus = 0; if (int.TryParse(this.Page.Request.QueryString["PurchaseStatus"], out purchaseStatus)) { purchaseOrderQuery.PurchaseStatus = (OrderStatus)purchaseStatus; } } purchaseOrderQuery.PageIndex = this.pager.PageIndex; purchaseOrderQuery.PageSize = this.pager.PageSize; purchaseOrderQuery.SortOrder = SortAction.Desc; purchaseOrderQuery.SortBy = "PurchaseDate"; return(purchaseOrderQuery); }
public StringBuilder GetOrderList(PurchaseOrderQuery query, string format, string orderitemfomat, out int totalrecords) { int totalrecord = 0; Globals.EntityCoding(query, true); DataSet aPIPurchaseOrders = SalesHelper.GetAPIPurchaseOrders(query, out totalrecord); StringBuilder builder = new StringBuilder(); foreach (DataRow row in aPIPurchaseOrders.Tables[0].Rows) { string str = "false"; StringBuilder builder2 = new StringBuilder(); foreach (DataRow row2 in row.GetChildRows("PurchaseOrderRelation")) { string str2 = row2["SKUContent"].ToString(); str = "true"; builder2.AppendFormat(orderitemfomat, new object[] { row2["Tid"].ToString(), row2["PurchaseOrderId"].ToString(), row2["ProductId"].ToString(), row2["ItemDescription"].ToString(), row2["SKU"].ToString(), str2, row2["Quantity"].ToString(), decimal.Parse(row2["ItemListPrice"].ToString()).ToString("F2"), decimal.Parse(row2["ItemPurchasePrice"].ToString()).ToString("F2"), decimal.Parse(row2["CostPrice"].ToString()).ToString("F2") }); } Dictionary <string, string> shippingRegion = MessageInfo.GetShippingRegion(row["ShippingRegion"].ToString()); builder.AppendFormat(format, new object[] { row["PurchaseOrderId"].ToString(), row["SellerUid"].ToString(), row["Username"].ToString(), row["EmailAddress"].ToString(), row["ShipTo"].ToString(), shippingRegion["Province"], shippingRegion["City"].ToString(), shippingRegion["District"], row["Address"].ToString(), row["ZipCode"].ToString(), row["CellPhone"].ToString(), row["TelPhone"].ToString(), row["Remark"].ToString(), row["ManagerMark"].ToString(), row["ManagerRemark"].ToString(), row["Nums"].ToString(), decimal.Parse(row["OrderTotal"].ToString()).ToString("F2"), decimal.Parse(row["OrderTotal"].ToString()).ToString("F2"), decimal.Parse(row["AdjustedFreight"].ToString()).ToString("F2"), decimal.Parse(row["Profit"].ToString()).ToString("F2"), decimal.Parse(row["PurchaseTotal"].ToString()).ToString("F2"), row["PayDate"].ToString(), row["ShippingDate"].ToString(), row["ReFundStatus"].ToString(), decimal.Parse(row["RefundAmount"].ToString()).ToString("F2"), row["RefundRemark"].ToString(), row["OrderStatus"].ToString(), str, builder2 }); } totalrecords = totalrecord; return(builder); }
private PurchaseOrderQuery GetPurchaseOrderQuery() { PurchaseOrderQuery query = new PurchaseOrderQuery(); if (!string.IsNullOrEmpty(Page.Request.QueryString["ShipTo"])) { query.ShipTo = Globals.UrlDecode(Page.Request.QueryString["ShipTo"]); } if (!string.IsNullOrEmpty(Page.Request.QueryString["PurchaseOrderId"])) { query.PurchaseOrderId = Globals.UrlDecode(Page.Request.QueryString["PurchaseOrderId"]); } if (!string.IsNullOrEmpty(Page.Request.QueryString["startDate"])) { query.StartDate = new DateTime?(DateTime.Parse(Page.Request.QueryString["startDate"])); } if (!string.IsNullOrEmpty(Page.Request.QueryString["endDate"])) { query.EndDate = new DateTime?(DateTime.Parse(Page.Request.QueryString["endDate"])); } if (!string.IsNullOrEmpty(Page.Request.QueryString["PurchaseStatus"])) { int result = 0; if (int.TryParse(Page.Request.QueryString["PurchaseStatus"], out result)) { query.PurchaseStatus = (OrderStatus)result; } } query.PageIndex = pager.PageIndex; query.PageSize = pager.PageSize; query.SortOrder = SortAction.Desc; query.SortBy = "PurchaseDate"; return(query); }
// GET: PurchaseOrders/Details/5 public async Task <IActionResult> Details( PurchaseOrderQuery query, [FromServices] IQueryHandlerAsync <PurchaseOrderQuery, PurchaseOrder> queryHandler) { var purchaseOrder = await queryHandler.HandleAsync(query); if (purchaseOrder == null) { return(NotFound()); } return(View(purchaseOrder)); }
private void BindPurchaseOrders() { PurchaseOrderQuery purchaseOrderQuery = this.GetPurchaseOrderQuery(); purchaseOrderQuery.IsManualPurchaseOrder = true; DbQueryResult purchaseOrders = SubsiteSalesHelper.GetPurchaseOrders(purchaseOrderQuery); this.dlstPurchaseOrders.DataSource = purchaseOrders.Data; this.dlstPurchaseOrders.DataBind(); this.pager.TotalRecords = purchaseOrders.TotalRecords; this.pager1.TotalRecords = purchaseOrders.TotalRecords; this.txtShipTo.Text = purchaseOrderQuery.ShipTo; this.txtPurchaseOrderId.Text = purchaseOrderQuery.PurchaseOrderId; this.calendarStartDate.SelectedDate = purchaseOrderQuery.StartDate; this.calendarEndDate.SelectedDate = purchaseOrderQuery.EndDate; this.lblStatus.Text = ((int)purchaseOrderQuery.PurchaseStatus).ToString(); }
private void BindPurchaseOrders() { PurchaseOrderQuery purchaseOrderQuery = this.GetPurchaseOrderQuery(); purchaseOrderQuery.SortOrder = SortAction.Desc; purchaseOrderQuery.SortBy = "PurchaseDate"; purchaseOrderQuery.IsManualPurchaseOrder = false; DbQueryResult purchaseOrders = SubsiteSalesHelper.GetPurchaseOrders(purchaseOrderQuery); this.dlstPurchaseOrders.DataSource = purchaseOrders.Data; this.dlstPurchaseOrders.DataBind(); this.pager.TotalRecords = purchaseOrders.TotalRecords; this.pager1.TotalRecords = purchaseOrders.TotalRecords; this.txtOrderId.Text = purchaseOrderQuery.OrderId; this.txtProductName.Text = purchaseOrderQuery.ProductName; this.txtPurchaseOrderId.Text = purchaseOrderQuery.PurchaseOrderId; this.calendarStartDate.SelectedDate = purchaseOrderQuery.StartDate; this.calendarEndDate.SelectedDate = purchaseOrderQuery.EndDate; this.lblStatus.Text = ((int)purchaseOrderQuery.PurchaseStatus).ToString(); }
private DbQueryResult GetData(string sortBy, SortAction sortOrder) { this.LoadParameters(); PurchaseOrderQuery purchaseOrderQuery = new PurchaseOrderQuery { PageSize = this.pager.PageSize, PageIndex = this.pager.PageIndex, SortOrder = sortOrder, SortBy = sortBy, StartDate = this.startDate, EndDate = this.endDate, PONumber = this.poNumber, SupplierId = this.supplierId, POStatus = this.Status, HSInOut = this.hsInOut, QPStatus = this.QPStatus, CIStatus = this.CIStatus }; Globals.EntityCoding(purchaseOrderQuery, true); return(PurchaseOrderHelper.GetPurchaseOrderList(purchaseOrderQuery)); }
private PurchaseOrderQuery GetPurchaseOrderQuery() { PurchaseOrderQuery query = new PurchaseOrderQuery(); if (!string.IsNullOrEmpty(this.Page.Request.QueryString["OrderId"])) { query.OrderId = Globals.UrlDecode(this.Page.Request.QueryString["OrderId"]); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["PurchaseOrderId"])) { query.PurchaseOrderId = Globals.UrlDecode(this.Page.Request.QueryString["PurchaseOrderId"]); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["ProductName"])) { query.ProductName = Globals.UrlDecode(this.Page.Request.QueryString["ProductName"]); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["startDate"])) { query.StartDate = new DateTime?(DateTime.Parse(this.Page.Request.QueryString["startDate"])); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["endDate"])) { query.EndDate = new DateTime?(DateTime.Parse(this.Page.Request.QueryString["endDate"])); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["PurchaseStatus"])) { int result = 0; if (int.TryParse(this.Page.Request.QueryString["PurchaseStatus"], out result)) { query.PurchaseStatus = (OrderStatus)result; } } query.PageIndex = this.pager.PageIndex; query.PageSize = this.pager.PageSize; return(query); }
public static DbQueryResult GetPurchaseOrders(PurchaseOrderQuery query) { return(SalesProvider.Instance().GetPurchaseOrders(query)); }
public System.Text.StringBuilder GetOrderList(PurchaseOrderQuery query, string format, string orderitemfomat, out int totalrecords) { int num = 0; Globals.EntityCoding(query, true); System.Data.DataSet aPIPurchaseOrders = SalesHelper.GetAPIPurchaseOrders(query, out num); System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); foreach (System.Data.DataRow dataRow in aPIPurchaseOrders.Tables[0].Rows) { string text = "false"; System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder(); System.Data.DataRow[] childRows = dataRow.GetChildRows("PurchaseOrderRelation"); for (int i = 0; i < childRows.Length; i++) { System.Data.DataRow dataRow2 = childRows[i]; string text2 = dataRow2["SKUContent"].ToString(); text = "true"; stringBuilder2.AppendFormat(orderitemfomat, new object[] { dataRow2["Tid"].ToString(), dataRow2["PurchaseOrderId"].ToString(), dataRow2["ProductId"].ToString(), dataRow2["ItemDescription"].ToString(), dataRow2["SKU"].ToString(), text2, dataRow2["Quantity"].ToString(), decimal.Parse(dataRow2["ItemListPrice"].ToString()).ToString("F2"), decimal.Parse(dataRow2["ItemPurchasePrice"].ToString()).ToString("F2"), decimal.Parse(dataRow2["CostPrice"].ToString()).ToString("F2") }); } System.Collections.Generic.Dictionary <string, string> shippingRegion = MessageInfo.GetShippingRegion(dataRow["ShippingRegion"].ToString()); stringBuilder.AppendFormat(format, new object[] { dataRow["PurchaseOrderId"].ToString(), dataRow["SellerUid"].ToString(), dataRow["Username"].ToString(), dataRow["EmailAddress"].ToString(), dataRow["ShipTo"].ToString(), shippingRegion["Province"], shippingRegion["City"].ToString(), shippingRegion["District"], dataRow["Address"].ToString(), dataRow["ZipCode"].ToString(), dataRow["CellPhone"].ToString(), dataRow["TelPhone"].ToString(), dataRow["Remark"].ToString(), dataRow["ManagerMark"].ToString(), dataRow["ManagerRemark"].ToString(), dataRow["Nums"].ToString(), decimal.Parse(dataRow["OrderTotal"].ToString()).ToString("F2"), decimal.Parse(dataRow["OrderTotal"].ToString()).ToString("F2"), decimal.Parse(dataRow["AdjustedFreight"].ToString()).ToString("F2"), decimal.Parse(dataRow["Profit"].ToString()).ToString("F2"), decimal.Parse(dataRow["PurchaseTotal"].ToString()).ToString("F2"), dataRow["PayDate"].ToString(), dataRow["ShippingDate"].ToString(), dataRow["ReFundStatus"].ToString(), decimal.Parse(dataRow["RefundAmount"].ToString()).ToString("F2"), dataRow["RefundRemark"].ToString(), dataRow["OrderStatus"].ToString(), text, stringBuilder2 }); } totalrecords = num; return(stringBuilder); }
public void ProcessRequest(HttpContext context) { string oldValue = "<?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><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>"; 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"]; XmlDocument node = new XmlDocument(); SortedDictionary <string, string> tmpParas = new SortedDictionary <string, string>(); string str22 = str2; if (str22 != null) { if (!(str22 == "tradelist")) { string str15; if (str22 == "tradedetails") { 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; PurchaseOrderInfo purchaseOrder = SalesHelper.GetPurchaseOrder(str15); builder.Append("<trade_get_response>"); builder.Append(this.GetOrderDetails(format, orderitemfomat, purchaseOrder).ToString()); builder.Append("</trade_get_response>"); this.message = oldValue + builder.ToString(); } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Format_Eroor, "tid"); } } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "signature"); } } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "tid"); } } else if (str22 == "send") { string 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); PurchaseOrderInfo purchaseorder = SalesHelper.GetPurchaseOrder(str17); if (purchaseorder != null) { ApiErrorCode messageenum = this.SendOrders(purchaseorder, shippingModeByCompany, str18, express); if (messageenum == ApiErrorCode.Success) { builder.Append("<trade_get_response>"); purchaseorder = SalesHelper.GetPurchaseOrder(str17); builder.Append(this.GetOrderDetails(format, orderitemfomat, purchaseorder).ToString()); builder.Append("</trade_get_response>"); this.message = oldValue + builder.ToString(); } 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"); } } else if (str22 == "mark") { string 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)) { PurchaseOrderInfo info5 = SalesHelper.GetPurchaseOrder(str15); info5.ManagerMark = new OrderMark?((OrderMark)Enum.Parse(typeof(OrderMark), str20, true)); info5.ManagerRemark = Globals.HtmlEncode(str21); if (SalesHelper.SaveAPIPurchaseOrderRemark(info5)) { builder.Append("<trade_get_response>"); builder.Append(this.GetOrderDetails(format, orderitemfomat, info5).ToString()); builder.Append("</trade_get_response>"); this.message = oldValue + builder.ToString(); } 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"); } } } else { PurchaseOrderQuery query2 = new PurchaseOrderQuery(); query2.PageSize = 100; PurchaseOrderQuery query = query2; int totalrecords = 0; string str10 = context.Request.Form["status"].Trim(); string str11 = context.Request.Form["buynick"].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.PurchaseStatus = (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("buynick", 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.DistributorName = str11; } if (!string.IsNullOrEmpty(str13)) { query.StartDate = new DateTime?(Convert.ToDateTime(str13)); } if (!string.IsNullOrEmpty(str14)) { query.EndDate = new DateTime?(Convert.ToDateTime(str14)); } query.SortOrder = SortAction.Desc; query.SortBy = "PurchaseDate"; builder.Append("<trade_get_response>"); builder.Append(this.GetOrderList(query, format, orderitemfomat, out totalrecords)); builder.Append("<totalrecord>" + totalrecords + "</totalrecord>"); builder.Append("</trade_get_response>"); this.message = oldValue + builder.ToString(); } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign"); } } else { str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "paramter"); } } } if (this.message == "") { this.message = this.message + str3 + str4; } context.Response.ContentType = "text/xml"; if (str9 == "json") { this.message = this.message.Replace(oldValue, ""); node.Load(new MemoryStream(Encoding.GetEncoding("UTF-8").GetBytes(this.message))); this.message = JavaScriptConvert.SerializeXmlNode(node); context.Response.ContentType = "text/json"; } context.Response.Write(this.message); }
public abstract DbQueryResult GetPurchaseOrders(PurchaseOrderQuery query);
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); }
private PurchaseOrderQuery GetPurchaseOrderQuery() { PurchaseOrderQuery query = new PurchaseOrderQuery(); if (!string.IsNullOrEmpty(Page.Request.QueryString["OrderId"])) { query.OrderId = Globals.UrlDecode(Page.Request.QueryString["OrderId"]); } if (!string.IsNullOrEmpty(Page.Request.QueryString["PurchaseOrderId"])) { query.PurchaseOrderId = Globals.UrlDecode(Page.Request.QueryString["PurchaseOrderId"]); } if (!string.IsNullOrEmpty(Page.Request.QueryString["ShopTo"])) { query.ShipTo = Globals.UrlDecode(Page.Request.QueryString["ShopTo"]); } if (!string.IsNullOrEmpty(Page.Request.QueryString["ProductName"])) { query.ProductName = Globals.UrlDecode(Page.Request.QueryString["ProductName"]); } if (!string.IsNullOrEmpty(Page.Request.QueryString["DistributorName"])) { query.DistributorName = Globals.UrlDecode(Page.Request.QueryString["DistributorName"]); } if (!string.IsNullOrEmpty(Page.Request.QueryString["startDate"])) { query.StartDate = new DateTime?(DateTime.Parse(Page.Request.QueryString["startDate"])); } if (!string.IsNullOrEmpty(Page.Request.QueryString["endDate"])) { query.EndDate = new DateTime?(DateTime.Parse(Page.Request.QueryString["endDate"])); } if (!string.IsNullOrEmpty(Page.Request.QueryString["PurchaseStatus"])) { int result = 0; if (int.TryParse(Page.Request.QueryString["PurchaseStatus"], out result)) { query.PurchaseStatus = (OrderStatus)result; } } if (!string.IsNullOrEmpty(Page.Request.QueryString["IsPrinted"])) { int num2 = 0; if (int.TryParse(Page.Request.QueryString["IsPrinted"], out num2)) { query.IsPrinted = new int?(num2); } } if (!string.IsNullOrEmpty(Page.Request.QueryString["ModeId"])) { int num3 = 0; if (int.TryParse(Page.Request.QueryString["ModeId"], out num3)) { query.ShippingModeId = new int?(num3); } } query.PageIndex = pager.PageIndex; query.PageSize = pager.PageSize; query.SortOrder = SortAction.Desc; query.SortBy = "PurchaseDate"; return(query); }
public abstract DataSet GetAPIPurchaseOrders(PurchaseOrderQuery query, out int totalrecord);
public PurchaseOrderController(PurchaseOrderService service, PurchaseOrderQuery poQuery, IMapper mapper) { this.service = service; this.poQuery = poQuery; this.mapper = mapper; }
private PurchaseOrderQuery GetPurchaseOrderQuery() { PurchaseOrderQuery purchaseOrderQuery = new PurchaseOrderQuery(); if (!string.IsNullOrEmpty(this.Page.Request.QueryString["OrderId"])) { purchaseOrderQuery.OrderId = Globals.UrlDecode(this.Page.Request.QueryString["OrderId"]); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["PurchaseOrderId"])) { purchaseOrderQuery.PurchaseOrderId = Globals.UrlDecode(this.Page.Request.QueryString["PurchaseOrderId"]); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["ShopTo"])) { purchaseOrderQuery.ShipTo = Globals.UrlDecode(this.Page.Request.QueryString["ShopTo"]); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["ProductName"])) { purchaseOrderQuery.ProductName = Globals.UrlDecode(this.Page.Request.QueryString["ProductName"]); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["DistributorName"])) { purchaseOrderQuery.DistributorName = Globals.UrlDecode(this.Page.Request.QueryString["DistributorName"]); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["startDate"])) { purchaseOrderQuery.StartDate = new System.DateTime?(System.DateTime.Parse(this.Page.Request.QueryString["startDate"])); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["endDate"])) { purchaseOrderQuery.EndDate = new System.DateTime?(System.DateTime.Parse(this.Page.Request.QueryString["endDate"])); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["PurchaseStatus"])) { int purchaseStatus = 0; if (int.TryParse(this.Page.Request.QueryString["PurchaseStatus"], out purchaseStatus)) { purchaseOrderQuery.PurchaseStatus = (OrderStatus)purchaseStatus; } } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["IsPrinted"])) { int value = 0; if (int.TryParse(this.Page.Request.QueryString["IsPrinted"], out value)) { purchaseOrderQuery.IsPrinted = new int?(value); } } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["ModeId"])) { int value2 = 0; if (int.TryParse(this.Page.Request.QueryString["ModeId"], out value2)) { purchaseOrderQuery.ShippingModeId = new int?(value2); } } purchaseOrderQuery.PageIndex = this.pager.PageIndex; purchaseOrderQuery.PageSize = this.pager.PageSize; purchaseOrderQuery.SortOrder = SortAction.Desc; purchaseOrderQuery.SortBy = "PurchaseDate"; return(purchaseOrderQuery); }
public static System.Data.DataSet GetAPIPurchaseOrders(PurchaseOrderQuery query, out int totalrecord) { return(SalesProvider.Instance().GetAPIPurchaseOrders(query, out totalrecord)); }
/// <summary> /// 获取采购订单 /// </summary> /// <param name="query"></param> /// <returns></returns> public static DbQueryResult GetPurchaseOrderList(PurchaseOrderQuery purchaseOrderQuery) { return(new PurchaseOrderDao().GetPurchaseOrderList(purchaseOrderQuery)); }