Ejemplo n.º 1
0
 public static void cancel(int postOfficeID)
 {
     DeliveryProshipController.cancel(postOfficeID);
 }
Ejemplo n.º 2
0
        private void importExcel(string pathFile)
        {
            // Lấy stream file
            var fs = new FileStream(pathFile, FileMode.Open);

            // Khởi tạo workbook để đọc
            var wb = new XSSFWorkbook(fs);

            // Lấy sheet đầu tiên
            var sheet = wb.GetSheetAt(0);

            var proships = new List <DeliveryProship>();

            // Lấy data từ dòng thứ 3 cho đến hết file
            for (int index = 11; index < sheet.LastRowNum; index++)
            {
                var row  = sheet.GetRow(index);
                var item = new DeliveryProship();
                // OrderID
                if (!String.IsNullOrEmpty(row.GetCell(29).ToString()))
                {
                    var strOrderID = Regex.Match(row.GetCell(29).ToString(), @"[0-9]+").Value;
                    if (!String.IsNullOrEmpty(strOrderID))
                    {
                        item.OrderID = Convert.ToInt32(strOrderID);
                    }
                }
                // NumberID
                item.NumberID = row.GetCell(30).ToString();
                // Customer
                item.Customer = row.GetCell(5).ToString();
                // Phone
                item.Phone = row.GetCell(6).ToString().Replace(",", " |");
                // Address
                item.Address = row.GetCell(7).StringCellValue;
                // Delivery Status
                item.DeliveryStatus = row.GetCell(26).StringCellValue;
                // Start Date
                item.StartDate = DateTime.ParseExact(row.GetCell(3).ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                // Done Date
                if (!String.IsNullOrEmpty(row.GetCell(4).ToString()))
                {
                    item.DoneDate = DateTime.ParseExact(row.GetCell(4).ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                }
                // Tiền thu hộ
                item.COD = Convert.ToDecimal(row.GetCell(22).ToString());
                // Tiền phí
                item.Fee = Convert.ToDecimal(row.GetCell(20).ToString());
                // Staff
                item.Staff = String.Empty;

                // Setting trạng thái review với order
                item.Review      = (int)DeliveryProshipReview.NoApprove;
                item.OrderStatus = (int)OrderStatus.Exist;
                proships.Add(item);

                // Thưc thi review các order sau khi đoc 100 dòng execl
                if (proships.Count == 100)
                {
                    DeliveryProshipController.reviewOrder(proships);
                    proships.Clear();
                }
            }

            // Thưc thi review các order sau khi đoc dòng excel còn lại
            if (proships.Count > 0)
            {
                DeliveryProshipController.reviewOrder(proships);
                proships.Clear();
            }

            wb.Close();
            fs.Close();
        }
Ejemplo n.º 3
0
 public static void approve(int postOfficeID, int orderID)
 {
     DeliveryProshipController.approve(postOfficeID, orderID);
 }
Ejemplo n.º 4
0
        public void LoadData()
        {
            string username = Request.Cookies["usernameLoginSystem"].Value;
            var    acc      = AccountController.GetByUsername(username);

            if (acc != null)
            {
                DateTime DateConfig = new DateTime(2019, 12, 15);

                var config = ConfigController.GetByTop1();
                if (config.ViewAllOrders == 1)
                {
                    DateConfig = new DateTime(2018, 6, 22);
                }

                DateTime OrderFromDate = DateConfig;
                DateTime OrderToDate   = DateTime.Now;

                if (!String.IsNullOrEmpty(Request.QueryString["orderfromdate"]))
                {
                    OrderFromDate = Convert.ToDateTime(Request.QueryString["orderfromdate"]);
                }

                if (!String.IsNullOrEmpty(Request.QueryString["ordertodate"]))
                {
                    OrderToDate = Convert.ToDateTime(Request.QueryString["ordertodate"]).AddDays(1).AddMinutes(-1);
                }

                rOrderFromDate.SelectedDate = OrderFromDate;
                rOrderFromDate.MinDate      = DateConfig;
                rOrderFromDate.MaxDate      = DateTime.Now;

                rOrderToDate.SelectedDate = OrderToDate;
                rOrderToDate.MinDate      = DateConfig;
                rOrderToDate.MaxDate      = DateTime.Now;

                string TextSearch     = String.Empty;
                int    orderStatus    = 0;
                string deliveryStatus = String.Empty;
                int    review         = 0;
                int    feeStatus      = 0;
                int    Page           = 1;

                if (Request.QueryString["textsearch"] != null)
                {
                    TextSearch = Request.QueryString["textsearch"].Trim();
                }
                if (Request.QueryString["orderstatus"] != null)
                {
                    orderStatus = Request.QueryString["orderstatus"].ToInt(0);
                }
                if (Request.QueryString["deliverystatus"] != null)
                {
                    deliveryStatus = Request.QueryString["deliverystatus"];
                }
                if (Request.QueryString["review"] != null)
                {
                    review = Request.QueryString["review"].ToInt(0);
                }
                if (Request.QueryString["feestatus"] != null)
                {
                    feeStatus = Request.QueryString["feestatus"].ToInt(0);
                }
                if (Request.QueryString["Page"] != null)
                {
                    Page = Request.QueryString["Page"].ToInt();
                }

                txtSearchOrder.Text             = TextSearch;
                ddlOrderStatus.SelectedValue    = orderStatus.ToString();
                ddlDeliveryStatus.SelectedValue = deliveryStatus.ToString();
                ddlReview.SelectedValue         = review.ToString();
                ddlFeeStatus.SelectedValue      = feeStatus.ToString();

                // Create delivery post office fileter
                var filter = new DeliveryProshipFilterModel()
                {
                    search         = TextSearch,
                    orderStatus    = orderStatus,
                    deliveryStatus = deliveryStatus,
                    review         = review,
                    feeStatus      = feeStatus,
                    orderFromDate  = OrderFromDate,
                    orderToDate    = OrderToDate
                };
                // Create pagination
                var page = new PaginationMetadataModel()
                {
                    currentPage = Page
                };
                decimal lossMoney = 0;

                List <DeliveryProship> rs = new List <DeliveryProship>();
                rs = DeliveryProshipController.Filter(filter, ref page, ref lossMoney);

                pagingall(rs, page);

                ltrNumberOfOrder.Text = String.Format("{0} số đơn Proship - Số tiền phí lệch: {1:#,###} VND", page.totalCount.ToString(), lossMoney);
            }
        }