예제 #1
0
        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);
        }
예제 #2
0
        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 text3 = context.Request.QueryString["action"].ToString();
            string sign  = context.Request.Form["sign"];

            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            string skucontentformat = "<Item><lid>{0}</lid><OuterId>{1}</OuterId><SKUContent>{2}</SKUContent><Nums>{3}</Nums><Price>{4}</Price></Item>";
            string strformat        = "<product><Iid>{0}</Iid><OuterId>{1}</OuterId><Title>{2}</Title><PicUrl>{3}</PicUrl><Url>{4}</Url><MarketPrice>{5}</MarketPrice><Price>{6}</Price><Weight>{7}</Weight><Status>{8}</Status><SkuItems list=\"{9}\">{10}</SkuItems></product>";

            System.Collections.Generic.SortedDictionary <string, string> sortedDictionary = new System.Collections.Generic.SortedDictionary <string, string>();
            string checkCode = masterSettings.CheckCode;
            string value     = context.Request.Form["format"];

            try
            {
                if (!string.IsNullOrEmpty(text3))
                {
                    string hostPath = Hidistro.Membership.Context.HiContext.Current.HostPath;
                    string a;
                    if ((a = text3) != null)
                    {
                        if (!(a == "productview"))
                        {
                            if (a == "productsimpleview")
                            {
                                goto IL_7BC;
                            }
                            if (!(a == "stockview"))
                            {
                                if (!(a == "quantity"))
                                {
                                    if (a == "statue")
                                    {
                                        string value2 = context.Request.Form["state"].Trim();
                                        string text4  = context.Request.Form["productId"].Trim();
                                        if (string.IsNullOrEmpty(value2) || string.IsNullOrEmpty(text4))
                                        {
                                            text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "state or productId");
                                            goto IL_7BC;
                                        }
                                        ProductSaleStatus productSaleStatus = (ProductSaleStatus)System.Enum.Parse(typeof(ProductSaleStatus), value2, true);
                                        int num = System.Convert.ToInt32(text4);
                                        if (num <= 0)
                                        {
                                            text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Format_Eroor, "productId");
                                            goto IL_7BC;
                                        }
                                        sortedDictionary.Add("productid", text4);
                                        sortedDictionary.Add("state", value2);
                                        sortedDictionary.Add("format", value);
                                        if (APIHelper.CheckSign(sortedDictionary, checkCode, sign))
                                        {
                                            bool flag = false;
                                            stringBuilder.Append("<item_update_statue_response>");
                                            if (productSaleStatus == ProductSaleStatus.OnSale)
                                            {
                                                if (ProductHelper.UpShelf(num) > 0)
                                                {
                                                    flag = true;
                                                }
                                                else
                                                {
                                                    text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Format_Eroor, "productId");
                                                }
                                            }
                                            else
                                            {
                                                if (productSaleStatus == ProductSaleStatus.UnSale)
                                                {
                                                    if (ProductHelper.OffShelf(num) > 0)
                                                    {
                                                        flag = true;
                                                    }
                                                    else
                                                    {
                                                        text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Format_Eroor, "productId");
                                                    }
                                                }
                                            }
                                            if (flag)
                                            {
                                                stringBuilder.Append(string.Concat(new string[]
                                                {
                                                    "<item><num_iid>",
                                                    text4,
                                                    "</num_iid><modified>",
                                                    System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"),
                                                    "</modified></item>"
                                                }));
                                            }
                                            else
                                            {
                                                text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Unknown_Error, "update");
                                            }
                                            stringBuilder.Append("</item_update_statue_response>");
                                            goto IL_7BC;
                                        }
                                        text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign");
                                        goto IL_7BC;
                                    }
                                }
                                else
                                {
                                    if (string.IsNullOrEmpty(context.Request.Form["productId"].Trim()) || string.IsNullOrEmpty(context.Request.Form["quantity"].Trim()))
                                    {
                                        text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "paramters");
                                        goto IL_7BC;
                                    }
                                    string text5 = context.Request.Form["productId"];
                                    string text6 = "";
                                    string text7 = "";
                                    int    type  = 1;
                                    int    stock = System.Convert.ToInt32(context.Request.Form["quantity"].Trim());
                                    if (!string.IsNullOrEmpty(context.Request.Form["sku_id"].Trim()))
                                    {
                                        text6 = context.Request.Form["sku_id"];
                                    }
                                    if (!string.IsNullOrEmpty(context.Request.Form["outer_id"].Trim()))
                                    {
                                        text7 = context.Request.Form["outer_id"];
                                    }
                                    if (!string.IsNullOrEmpty(context.Request.Form["type"]))
                                    {
                                        type = System.Convert.ToInt32(context.Request.Form["type"]);
                                    }
                                    sortedDictionary.Add("productId", text5.ToString());
                                    sortedDictionary.Add("quantity", stock.ToString());
                                    sortedDictionary.Add("sku_id", text6);
                                    sortedDictionary.Add("outer_id", text7);
                                    sortedDictionary.Add("type", type.ToString());
                                    sortedDictionary.Add("format", value);
                                    if (!APIHelper.CheckSign(sortedDictionary, checkCode, sign))
                                    {
                                        text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign");
                                        goto IL_7BC;
                                    }
                                    ApiErrorCode apiErrorCode = ProductHelper.UpdateProductStock(System.Convert.ToInt32(text5), text6, text7, type, stock);
                                    if (ApiErrorCode.Success == apiErrorCode)
                                    {
                                        stringBuilder.Append("<trade_get_response>");
                                        stringBuilder.Append(this.GetProductDetailsView(System.Convert.ToInt32(text5), hostPath, strformat, skucontentformat).ToString());
                                        stringBuilder.Append("</trade_get_response>");
                                        goto IL_7BC;
                                    }
                                    text2 = MessageInfo.ShowMessageInfo(apiErrorCode, "paramters");
                                    goto IL_7BC;
                                }
                            }
                            else
                            {
                                if (string.IsNullOrEmpty(context.Request.Form["productId"].Trim()) || System.Convert.ToInt32(context.Request.Form["ProductId"].Trim()) <= 0)
                                {
                                    text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "productId");
                                    goto IL_7BC;
                                }
                                int num = System.Convert.ToInt32(context.Request.Form["productId"].Trim());
                                sortedDictionary.Add("productid", num.ToString());
                                sortedDictionary.Add("format", value);
                                if (APIHelper.CheckSign(sortedDictionary, checkCode, sign))
                                {
                                    stringBuilder.Append("<trade_get_response>");
                                    stringBuilder.Append(this.GetProductDetailsView(num, hostPath, strformat, skucontentformat).ToString());
                                    stringBuilder.Append("</trade_get_response>");
                                    goto IL_7BC;
                                }
                                text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign");
                                goto IL_7BC;
                            }
                        }
                        else
                        {
                            ProductQuery productQuery = new ProductQuery
                            {
                                SaleStatus = ProductSaleStatus.OnSale,
                                PageSize   = 10,
                                PageIndex  = 1
                            };
                            string value2 = context.Request.Form["state"].Trim();
                            string value3 = context.Request.Form["pageindex"].Trim();
                            string value4 = context.Request.Form["pagesize"].Trim();
                            if (string.IsNullOrEmpty(value2) || string.IsNullOrEmpty(value3))
                            {
                                text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "state or pageindex");
                                goto IL_7BC;
                            }
                            sortedDictionary.Add("state", value2);
                            sortedDictionary.Add("pageindex", value3);
                            sortedDictionary.Add("pagesize", value4);
                            sortedDictionary.Add("format", value);
                            if (!APIHelper.CheckSign(sortedDictionary, checkCode, sign))
                            {
                                text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign");
                                goto IL_7BC;
                            }
                            if (!string.IsNullOrEmpty(value4) && System.Convert.ToInt32(value4) > 0)
                            {
                                productQuery.PageSize = System.Convert.ToInt32(value4);
                            }
                            if (System.Convert.ToInt32(value3) > 0)
                            {
                                productQuery.PageIndex  = System.Convert.ToInt32(value3);
                                productQuery.SaleStatus = (ProductSaleStatus)System.Enum.Parse(typeof(ProductSaleStatus), value2, true);
                                Globals.EntityCoding(productQuery, true);
                                int num2 = 0;
                                stringBuilder.Append("<trade_get_response>");
                                stringBuilder.Append(this.GetProductView(productQuery, hostPath, strformat, skucontentformat, out num2).ToString());
                                stringBuilder.Append("<totalrecord>" + num2 + "</totalrecord>");
                                stringBuilder.Append("</trade_get_response>");
                                goto IL_7BC;
                            }
                            text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Format_Eroor, "pageindex");
                            goto IL_7BC;
                        }
                    }
                    text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Paramter_Error, "paramters");
IL_7BC:
                    text += stringBuilder.ToString();
                }
                else
                {
                    text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "modeId");
                }
            }
            catch (System.Exception ex)
            {
                text2 = MessageInfo.ShowMessageInfo(ApiErrorCode.Unknown_Error, ex.Message);
            }
            if (text2 != "")
            {
                text = str + text2;
            }
            context.Response.ContentType = "text/xml";
            context.Response.Write(text);
        }
        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);
        }
예제 #4
0
        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);

            str2 = context.Request.QueryString["action"].ToString();
            string        sign                         = context.Request.Form["sign"];
            StringBuilder builder                      = new StringBuilder();
            string        skucontentformat             = "<Item><lid>{0}</lid><OuterId>{1}</OuterId><SKUContent>{2}</SKUContent><Nums>{3}</Nums><Price>{4}</Price></Item>";
            string        strformat                    = "<product><Iid>{0}</Iid><OuterId>{1}</OuterId><Title>{2}</Title><PicUrl>{3}</PicUrl><Url>{4}</Url><MarketPrice>{5}</MarketPrice><Price>{6}</Price><Weight>{7}</Weight><Status>{8}</Status><SkuItems list=\"{9}\">{10}</SkuItems></product>";
            SortedDictionary <string, string> tmpParas = new SortedDictionary <string, string>();
            string checkCode = masterSettings.CheckCode;
            string str9      = context.Request.Form["format"];

            try
            {
                int num2;
                if (string.IsNullOrEmpty(str2))
                {
                    goto Label_07CE;
                }
                string hostPath = HiContext.Current.HostPath;
                string str18    = str2;
                if (str18 == null)
                {
                    goto Label_07B1;
                }
                if (!(str18 == "productview"))
                {
                    if (str18 == "productsimpleview")
                    {
                        goto Label_07BE;
                    }
                    if (str18 == "stockview")
                    {
                        goto Label_02D2;
                    }
                    if (str18 == "quantity")
                    {
                        goto Label_03CB;
                    }
                    if (str18 == "statue")
                    {
                        goto Label_0608;
                    }
                    goto Label_07B1;
                }
                ProductQuery query2 = new ProductQuery();
                query2.SaleStatus = ProductSaleStatus.OnSale;
                query2.PageSize   = 10;
                query2.PageIndex  = 1;
                ProductQuery entity = query2;
                string       str11  = context.Request.Form["state"].Trim();
                string       str12  = context.Request.Form["pageindex"].Trim();
                string       str13  = context.Request.Form["pagesize"].Trim();
                if (!string.IsNullOrEmpty(str11) && !string.IsNullOrEmpty(str12))
                {
                    tmpParas.Add("state", str11);
                    tmpParas.Add("pageindex", str12);
                    tmpParas.Add("pagesize", str13);
                    tmpParas.Add("format", str9);
                    if (APIHelper.CheckSign(tmpParas, checkCode, sign))
                    {
                        if (!string.IsNullOrEmpty(str13) && (Convert.ToInt32(str13) > 0))
                        {
                            entity.PageSize = Convert.ToInt32(str13);
                        }
                        if (Convert.ToInt32(str12) > 0)
                        {
                            entity.PageIndex  = Convert.ToInt32(str12);
                            entity.SaleStatus = (ProductSaleStatus)Enum.Parse(typeof(ProductSaleStatus), str11, true);
                            Globals.EntityCoding(entity, true);
                            int recordes = 0;
                            builder.Append("<trade_get_response>");
                            builder.Append(this.GetProductView(entity, hostPath, strformat, skucontentformat, out recordes).ToString());
                            builder.Append("<totalrecord>" + recordes + "</totalrecord>");
                            builder.Append("</trade_get_response>");
                        }
                        else
                        {
                            str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Format_Eroor, "pageindex");
                        }
                    }
                    else
                    {
                        str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign");
                    }
                }
                else
                {
                    str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "state or pageindex");
                }
                goto Label_07BE;
Label_02D2:
                num2 = 0;
                if (!string.IsNullOrEmpty(context.Request.Form["productId"].Trim()) && (Convert.ToInt32(context.Request.Form["ProductId"].Trim()) > 0))
                {
                    num2 = Convert.ToInt32(context.Request.Form["productId"].Trim());
                    tmpParas.Add("productid", num2.ToString());
                    tmpParas.Add("format", str9);
                    if (APIHelper.CheckSign(tmpParas, checkCode, sign))
                    {
                        builder.Append("<trade_get_response>");
                        builder.Append(this.GetProductDetailsView(num2, hostPath, strformat, skucontentformat).ToString());
                        builder.Append("</trade_get_response>");
                    }
                    else
                    {
                        str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign");
                    }
                }
                else
                {
                    str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "productId");
                }
                goto Label_07BE;
Label_03CB:
                if (!string.IsNullOrEmpty(context.Request.Form["productId"].Trim()) && !string.IsNullOrEmpty(context.Request.Form["quantity"].Trim()))
                {
                    string str14 = context.Request.Form["productId"];
                    string str15 = "";
                    string str16 = "";
                    int    type  = 1;
                    int    stock = 0;
                    stock = Convert.ToInt32(context.Request.Form["quantity"].Trim());
                    if (!string.IsNullOrEmpty(context.Request.Form["sku_id"].Trim()))
                    {
                        str15 = context.Request.Form["sku_id"];
                    }
                    if (!string.IsNullOrEmpty(context.Request.Form["outer_id"].Trim()))
                    {
                        str16 = context.Request.Form["outer_id"];
                    }
                    if (!string.IsNullOrEmpty(context.Request.Form["type"]))
                    {
                        type = Convert.ToInt32(context.Request.Form["type"]);
                    }
                    tmpParas.Add("productId", str14.ToString());
                    tmpParas.Add("quantity", stock.ToString());
                    tmpParas.Add("sku_id", str15);
                    tmpParas.Add("outer_id", str16);
                    tmpParas.Add("type", type.ToString());
                    tmpParas.Add("format", str9);
                    if (APIHelper.CheckSign(tmpParas, checkCode, sign))
                    {
                        ApiErrorCode messageenum = ProductHelper.UpdateProductStock(Convert.ToInt32(str14), str15, str16, type, stock);
                        if (ApiErrorCode.Success == messageenum)
                        {
                            builder.Append("<trade_get_response>");
                            builder.Append(this.GetProductDetailsView(Convert.ToInt32(str14), hostPath, strformat, skucontentformat).ToString());
                            builder.Append("</trade_get_response>");
                        }
                        else
                        {
                            str4 = MessageInfo.ShowMessageInfo(messageenum, "paramters");
                        }
                    }
                    else
                    {
                        str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign");
                    }
                }
                else
                {
                    str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "paramters");
                }
                goto Label_07BE;
Label_0608:
                str11 = context.Request.Form["state"].Trim();
                string str17 = context.Request.Form["productId"].Trim();
                if (!string.IsNullOrEmpty(str11) && !string.IsNullOrEmpty(str17))
                {
                    ProductSaleStatus status = (ProductSaleStatus)Enum.Parse(typeof(ProductSaleStatus), str11, true);
                    num2 = Convert.ToInt32(str17);
                    if (num2 > 0)
                    {
                        tmpParas.Add("productid", str17);
                        tmpParas.Add("state", str11);
                        tmpParas.Add("format", str9);
                        if (APIHelper.CheckSign(tmpParas, checkCode, sign))
                        {
                            bool flag = false;
                            builder.Append("<item_update_statue_response>");
                            switch (status)
                            {
                            case ProductSaleStatus.OnSale:
                                if (ProductHelper.UpShelf(num2) > 0)
                                {
                                    flag = true;
                                }
                                else
                                {
                                    str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Format_Eroor, "productId");
                                }
                                break;

                            case ProductSaleStatus.UnSale:
                                if (ProductHelper.OffShelf(num2) > 0)
                                {
                                    flag = true;
                                }
                                else
                                {
                                    str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Format_Eroor, "productId");
                                }
                                break;
                            }
                            if (flag)
                            {
                                builder.Append("<item><num_iid>" + str17 + "</num_iid><modified>" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "</modified></item>");
                            }
                            else
                            {
                                str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Unknown_Error, "update");
                            }
                            builder.Append("</item_update_statue_response>");
                        }
                        else
                        {
                            str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign");
                        }
                    }
                    else
                    {
                        str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Format_Eroor, "productId");
                    }
                }
                else
                {
                    str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "state or productId");
                }
                goto Label_07BE;
Label_07B1:
                str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Paramter_Error, "paramters");
Label_07BE:
                s = s + builder.ToString();
                goto Label_07F3;
Label_07CE:
                str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "modeId");
            }
            catch (Exception exception)
            {
                str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Unknown_Error, exception.Message);
            }
Label_07F3:
            if (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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }
예제 #8
0
        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);
        }