示例#1
0
        public List <ERPOrderInfo> CheckStatusForSubmittedOrdersAsync()
        {
            var orderResponseList = new List <ERPOrderInfo>();

            var httpClient = SetUpHeadersAndAuthentication();

            using (httpClient)
            {
                try
                {
                    var url             = Utilities.Config("CheckSubmittedOrdersStatus");
                    var httpResponseMsg = httpClient.GetAsync(url).Result;

                    using (var responseHelper = new HttpResponseHelper(httpResponseMsg))
                    {
                        orderResponseList = httpResponseMsg.IsSuccessStatusCode
                                            ? responseHelper.GetSubmittedOrdersStatus().ToList()
                                            : null;
                    }
                }
                catch (Exception ex)
                {
                    orderResponseList.Count.Equals(0);
                }
            }

            return(orderResponseList);
        }
示例#2
0
        public List <OrderResponse> GetOrdersToUpdateInDCAsync(string datetime)
        {
            var orderResponseList = new List <OrderResponse>();

            if (string.IsNullOrEmpty(datetime))
            {
                datetime = DateTime.Now.AddDays(-1).ToString("yyyyMMddHHmmss");
            }

            var httpClient = SetUpHeadersAndAuthentication();

            using (httpClient)
            {
                try
                {
                    var url             = Utilities.Config("GetOrdersToUpdateInDC");
                    var httpResponseMsg = httpClient.GetAsync(url + datetime).Result;

                    using (var responseHelper = new HttpResponseHelper(httpResponseMsg))
                    {
                        orderResponseList = httpResponseMsg.IsSuccessStatusCode ? responseHelper.GetOrdersToUpdateApiResponse().ToList()
                                                        : null;
                    }
                }
                catch (Exception ex)
                {
                    orderResponseList.Count.Equals(0);
                }
            }

            return(orderResponseList);
        }
示例#3
0
        public ERPInvoiceInfo CheckStatusForPickedOrdersAsync(string orderNumber)
        {
            var invoice = new ERPInvoiceInfo();

            var httpClient = SetUpHeadersAndAuthentication();

            using (httpClient)
            {
                try
                {
                    var url             = Utilities.Config("CheckPickedOrdersStatus");
                    var httpResponseMsg = httpClient.GetAsync(url).Result;

                    using (var responseHelper = new HttpResponseHelper(httpResponseMsg))
                    {
                        invoice = httpResponseMsg.IsSuccessStatusCode
                                    ? responseHelper.GetPickedOrderStatus()
                                    : null;
                    }
                }
                catch (Exception ex)
                {
                    invoice = null;
                }
            }

            return(invoice);
        }
示例#4
0
        public ServiceResponse PostOrderToMapicsAsync(ERPOrderInfo orderArray)
        {
            if (orderArray == null)
            {
                return(Response);
            }

            var httpClient = SetUpHeadersAndAuthentication();

            using (httpClient)
            {
                try
                {
                    var url             = Utilities.Config("PostOrdersUrl");
                    var httpResponseMsg = httpClient.PostAsJsonAsync(url, orderArray).Result;

                    using (var responseHelper = new HttpResponseHelper(httpResponseMsg))
                    {
                        Response = httpResponseMsg.IsSuccessStatusCode ? responseHelper.GetPostOrdersApiResponse()
                                            : responseHelper.GetAppropriateResponseMessage(http_failure_post_order);
                    }
                }
                catch (Exception ex)
                {
                    Response.Messages.AddError(ex.Message);
                    return(Response);
                }
            }

            return(Response);
        }
示例#5
0
        public ServiceResponse GetOrderInfoFromMapicsAsync(string customerNum, string poNum)
        {
            if (string.IsNullOrWhiteSpace(customerNum) || string.IsNullOrWhiteSpace(poNum))
            {
                return(Response);
            }

            var httpClient = SetUpHeadersAndAuthentication();

            using (httpClient)
            {
                try
                {
                    var url             = Utilities.Config("GetByPOandCustomerUrl");
                    var httpResponseMsg = httpClient.GetAsync(url + customerNum + "/pono/" + poNum).Result;

                    using (var responseHelper = new HttpResponseHelper(httpResponseMsg))
                    {
                        Response = httpResponseMsg.IsSuccessStatusCode ? responseHelper.GetOrderInfoApiResponse()
                                        : responseHelper.GetAppropriateResponseMessage(http_failure_get_order);
                    }
                }
                catch (Exception ex)
                {
                    Response.Messages.AddError(ex.Message);
                    return(Response);
                }
            }

            return(Response);
        }