Пример #1
0
        public ActionResult SummaryDeliveryReport(int channel, int postman, int postcode, int deliveryroute, int status, string fromdate, string todate)
        {
            ReturnSummaryDelivery returndelivery = new ReturnSummaryDelivery();

            returndelivery              = apiRepository.SummaryDelivery(channel, postman, postcode, deliveryroute, status, common.DateToInt(fromdate), common.DateToInt(todate));
            ViewBag.ComeDeliveryTotal   = returndelivery.ComeDeliverySummary;
            ViewBag.RemainDeliveryTotal = returndelivery.RemainDeliverySummary;

            ViewBag.SuccessDeliveryTotal   = returndelivery.SuccessDeliverySummary;
            ViewBag.UnsuccessDeliveryTotal = returndelivery.UnSuccessDeliverySummary;
            ViewBag.ReturnDeliveryTotal    = returndelivery.ReturnDeliverySummary;

            ViewBag.TotalDelivery  = returndelivery.ComeDeliverySummary.COUNT + returndelivery.RemainDeliverySummary.COUNT;
            ViewBag.TotalWeight    = returndelivery.ComeDeliverySummary.TOTAL_WEIGHT + returndelivery.RemainDeliverySummary.TOTAL_WEIGHT;
            ViewBag.TotalCollect   = returndelivery.ComeDeliverySummary.TOTAL_AMOUNT + returndelivery.RemainDeliverySummary.TOTAL_AMOUNT;
            ViewBag.TotalCollected = returndelivery.SuccessDeliverySummary.TOTAL_AMOUNT;
            return(View());
        }
Пример #2
0
        public ReturnSummaryDelivery SummaryDelivery(int channel, int postman, int postcode, int deliveryroute, int status, int fromdate, int todate)
        {
            ReturnSummaryDelivery summarydelivery = new ReturnSummaryDelivery();

            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(ConfigurationManager.AppSettings["URI"]);
                    client.DefaultRequestHeaders.Accept.Clear();
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    //var param = "api/Delivery?channel = " + channel + "&&postman = " + postman + "&&status = " + status + "&&from_date = " + fromdate + "&&to_date = " + todate + "&&delivery_post_code = " + postcode + "&&delivery_route_code = " + deliveryroute;
                    //var byteArray = Encoding.ASCII.GetBytes(ConfigurationManager.AppSettings["Username"] + ":" + ConfigurationManager.AppSettings["Password"]);
                    //client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
                    var _response = client.GetAsync("api/Delivery?channel=" + channel + "&&postman=" + postman + "&&status=" + status + "&&from_date=" + fromdate + "&&to_date=" + todate + "&&delivery_post_code=" + postcode + "&&delivery_route_code=" + deliveryroute).Result;
                    summarydelivery = _response.Content.ReadAsAsync <ReturnSummaryDelivery>().Result;
                }
            }
            catch (Exception ex)
            {
                // LogAPI.LogToFile(LogFileType.EXCEPTION, "ApiRepository.Post_E1E2_DS: " + ex.Message);
            }
            return(summarydelivery);
        }
Пример #3
0
        public ReturnSummaryDelivery COME_DELIVERY_SUMMARY(int channel, int post_man, int status, int from_date, int to_date, int delivery_post_code, int delivery_route_code)
        {
            MetaData              _metadata = new MetaData();
            Convertion            common    = new Convertion();
            ReturnSummaryDelivery _returnSummaryDelivery = new ReturnSummaryDelivery();

            switch (channel)
            {
            case 0:
                _metadata.channel = "Tất cả"; break;

            case 1:
                _metadata.channel = "EmsEnterprise"; break;

            case 2:
                _metadata.channel = "SmartPhone"; break;
            }
            if (post_man == 0)
            {
                _metadata.postman = "Tất cả";
            }
            else
            {
                _metadata.postman = "Bưu tá: " + post_man.ToString();
            }

            switch (status)
            {
            case 0:
                _metadata.status = "Tất cả"; break;

            case 1:
                _metadata.status = "Thành công"; break;

            case 2:
                _metadata.status = "Không thành công"; break;
            }
            _metadata.from_to_date = "Từ ngày " + common.Convert_Date(from_date) + " đến ngày " + common.Convert_Date(to_date);
            if (delivery_post_code == 0)
            {
                _metadata.delivery_post_code = "Tất cả";
            }
            else
            {
                _metadata.delivery_post_code = "Bưu cục phát: " + delivery_post_code;
            }

            if (delivery_route_code == 0)
            {
                _metadata.delivery_route_code = "Tất cả";
            }
            else
            {
                _metadata.delivery_route_code = "Tuyến phát: " + delivery_route_code;
            }
            _returnSummaryDelivery.MetaData = _metadata;
            try
            {
                _returnSummaryDelivery.ComeDeliverySummary      = ComeDeliveryTotal(channel, post_man, status, from_date, to_date, delivery_post_code, delivery_route_code);
                _returnSummaryDelivery.RemainDeliverySummary    = RemainDeliveryTotal(channel, post_man, status, from_date, to_date, delivery_post_code, delivery_route_code);
                _returnSummaryDelivery.SuccessDeliverySummary   = SuccessDeliveryTotal(channel, post_man, status, from_date, to_date, delivery_post_code, delivery_route_code);;
                _returnSummaryDelivery.UnSuccessDeliverySummary = UnSuccessDeliveryTotal(channel, post_man, status, from_date, to_date, delivery_post_code, delivery_route_code);;
                _returnSummaryDelivery.ReturnDeliverySummary    = ReturnDeliveryTotal(channel, post_man, status, from_date, to_date, delivery_post_code, delivery_route_code);;
            }
            catch
            {
                _returnSummaryDelivery.Code    = "99";
                _returnSummaryDelivery.Message = "Lỗi xử lý dữ liệu";
            }
            return(_returnSummaryDelivery);
        }