Exemplo n.º 1
0
        /// <summary>
        /// 订单详情
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public GetOrderDetails GetOrderDetails(string ordercode)
        {
            GetOrderDetails getOrderDetails = new GetOrderDetails();
            StringBuilder   builder         = new StringBuilder();

            builder.AppendFormat(GetOrderDetailsSql.SELECT_ORDER_BY_ORDERCODE, ordercode);
            string    sql = builder.ToString();
            DataTable dt  = DatabaseOperationWeb.ExecuteSelectDS(sql, "T").Tables[0];

            if (dt.Rows.Count > 0)
            {
                getOrderDetails.name       = dt.Rows[0]["CONSIGNEE_NAME"].ToString();
                getOrderDetails.mobille    = dt.Rows[0]["CONSIGNEE_MOBILE"].ToString();
                getOrderDetails.addr       = dt.Rows[0]["CONSIGNEE_ADDR"].ToString();
                getOrderDetails.idnumber   = dt.Rows[0]["ID_NUMBER"].ToString();
                getOrderDetails.express    = dt.Rows[0]["EXPRESS"].ToString();
                getOrderDetails.waybillno  = dt.Rows[0]["WAYBILLNO"].ToString();
                getOrderDetails.ordercode  = dt.Rows[0]["ORDER_CODE"].ToString();
                getOrderDetails.ordertime  = dt.Rows[0]["ORDER_TIME"].ToString();
                getOrderDetails.paytime    = dt.Rows[0]["PAY_TIME"].ToString();
                getOrderDetails.ordertype  = dt.Rows[0]["ORDER_TYPE"].ToString();
                getOrderDetails.ordertotal = dt.Rows[0]["ORDER_TOTAL"].ToString();

                foreach (DataRow dr in dt.Rows)
                {
                    GetOrderDetailsList getOrderDetailsList = new GetOrderDetailsList();
                    getOrderDetailsList.name  = dr["GOODSNAME"].ToString();
                    getOrderDetailsList.img   = dr["SLT"].ToString();
                    getOrderDetailsList.num   = dr["QUANTITY"].ToString();
                    getOrderDetailsList.price = dr["SKUUNITPRICE"].ToString();
                    getOrderDetails.list.Add(getOrderDetailsList);
                }
            }
            return(getOrderDetails);
        }
Exemplo n.º 2
0
 public static string GetOrderDetails()
 {
     try
     {
         string          url          = "https://partner.shopeemobile.com/api/v1/orders/detail";
         string          SecretKey    = "fd1a3697b76d97c49cd0354767cd541f0242e9d7da6208eb5cf9597d09531e6b";
         GetOrderDetails orderDetails = new GetOrderDetails();
         orderDetails.ordersn_list = new List <string>()
         {
             "18042512105VPR5"
         };
         orderDetails.partner_id = 10011;
         orderDetails.shopid     = 27641585;
         orderDetails.timestamp  = Common.GetTimeStamp(DateTime.UtcNow);
         string postData = JsonConvert.SerializeObject(orderDetails);
         string singure  = url + "|" + postData;
         string authSign = Common.HMACSHA256Encrypt(SecretKey, singure);
         jsonResult = ShopeeRequest.PostRequest(url, postData, authSign);
     }
     catch (Exception ex)
     {
         string msg = ex.Message;
     }
     return(jsonResult);
 }
        public async Task BeNullIfORderNotFound()
        {
            var request = new GetOrderDetails("SomeName", 100);
            var handler = new GetOrderDetailsHandler(_mockOrderRepository.Object);
            var result  = await handler.Handle(request, CancellationToken.None);

            Assert.Null(result);
        }
        public async Task NotBeNullIfOrderExists()
        {
            var request = new GetOrderDetails("Some Name:", 0);
            var handler = new GetOrderDetailsHandler(_mockOrderRepository.Object);
            var result  = await handler.Handle(request, CancellationToken.None);

            Assert.NotNull(result);
        }
Exemplo n.º 5
0
    private void BuildOrderDetails()
    {
        try
        {
            if (CookieProxy.Instance().HasKey("t"))
            {
                IUserProfile UserProfileObj = new UserProfile();
                UserProfileObj.SetToken(CookieProxy.Instance().GetValue("t").ToString());
                int    OrderID  = int.Parse(Page.RouteData.Values["orderID"].ToString());
                IOrder OrderObj = new Order();
                OrderObj.SetOrderID(OrderID);
                IOrderDetailsResponse OrderDetails = new GetOrderDetails().FetchOrderDetailsByOrderID(OrderObj, UserProfileObj);
                txt_ordernumber.Text = OrderID.ToString();

                if (OrderDetails.GetHasOrder())
                {
                    txt_status.Text       = OrderDetails.GetOrderDateAndStatusObj().GetStatus();
                    order_invalid.Visible = false;
                    order_valid.Visible   = true;
                    string HTMLContent = "";
                    foreach (ITaxOrderDetailsByProduct Product in OrderDetails.GetProductList())
                    {
                        HTMLContent += " <div class='row no-margin p10px pb20px cart-menu-item'><div class='col-lg-2 text-center no-margin'><img class='cart_page_img' src='/assets/" + Product.GetProductObj().GetProductImage() + "'></div><div class='col-lg-5'><div class='row no-margin cart_page_product_name'><span>" + Product.GetProductObj().GetProductName() + "</span><span class='cart_page_product_store_image_span'><img class='cart_page_product_store_image' src='/assets/" + Product.GetStoreObj().GetStoreLogo() + "'></span></div><div class='row no-margin cart_page_product_quantity'><span>Quantity : </span><span><b>" + Product.GetProductObj().GetProductQuantity() + "</b></span></div></div><div class='col-lg-5'><div class='row no-margin cart_page_product_price primary-color'>$ " + Product.GetPostTaxProductPrice() + "</div></div></div>";
                    }
                    if (OrderDetails.GetOrderDateAndStatusObj().GetStatus() == "Order_Created")
                    {
                        cancelOrderButton.Visible   = true;
                        cancelOrderButton.InnerHtml = "<div onclick=CancelOrder(\'" + OrderID.ToString() + "\');>CANCEL ORDER</div>";
                    }
                    else
                    {
                        cancelOrderButton.Visible = false;
                    }


                    cart_page_products_list.InnerHtml = HTMLContent;
                    txt_totalItems.Text       = OrderDetails.GetComputedObj().GetTotalQuantity().ToString();
                    txt_totalUniqueItems.Text = OrderDetails.GetComputedObj().GetTotalUniqueQuantity().ToString();
                    txt_totalCost.Text        = OrderDetails.GetComputedObj().GetTotalPreTaxProductPrice().ToString();
                    txt_totalTaxes.Text       = OrderDetails.GetComputedObj().GetTotalTaxAmount().ToString();
                    txt_totalAmount.Text      = OrderDetails.GetComputedObj().GetTotalPostTaxProductPrice().ToString();

                    txt_address_name.Text       = OrderDetails.GetAddressObj().GetAddresstName();
                    txt_address_street.Text     = OrderDetails.GetAddressObj().GetStreetName();
                    txt_address_appt.Text       = OrderDetails.GetAddressObj().GetAptNum();
                    txt_address_province.Text   = OrderDetails.GetAddressObj().GetCity() + " - " + OrderDetails.GetAddressObj().GetProvince();
                    txt_address_postalCode.Text = OrderDetails.GetAddressObj().GetPostalCode();

                    txt_card_name.Text          = OrderDetails.GetCardDetails().GetName();
                    txt_card_last_4_digits.Text = OrderDetails.GetCardDetails().GetCardNumber().ToString().Substring(11, 5);

                    txt_order_time.Text = OrderDetails.GetOrderDateAndStatusObj().GetDate().ToString();
                }
                else
                {
                    order_invalid.Visible = true;
                    order_valid.Visible   = false;
                    productsErrorPageheaderText.InnerText = "No order found.";
                }
            }
            else
            {
                Response.Redirect("/signout");
            }
        }
        catch (Exception)
        {
            order_invalid.Visible = true;
            order_valid.Visible   = false;
            productsErrorPageheaderText.InnerText = "An error occured while processing the request, please try again later";
        }
    }