Beispiel #1
0
        public ActionResult ShippingPackage(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Shipping model = db.Shippings.Find(id);

            //lay trang thai cua booking
            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(5), "Value", "Text", model.StatusId);
            //lay danh sach kien hang VN
            var listVN = db.ExportGoods.Where(n => n.AgencyId == user.Agency.Id && n.StatusId == 10);

            //check list VN exist in Chuyen bay Hay khong?
            listVN         = listVN.Where(n => db.ShippingHAWBDetails.Where(m => m.AgencyId == user.Agency.Id).Where(m => m.ExportGoodId == n.Id).Count() == 0);
            ViewBag.ListVN = Pager <ExportGood> .CreatePagging(listVN.OrderByDescending(n => n.CreatedAt), 1, 10);

            //lay danh sach kiện Shipping
            var itemListShipping = db.ShippingHAWBDetails.Where(n => n.AgencyId == user.Agency.Id && n.ShippingHAWB.ShippingId == model.Id).OrderByDescending(n => n.CreatedAt);

            ViewBag.Weigh        = itemListShipping.Sum(n => n.ExportGood.Weigh);
            ViewBag.ListShipping = Pager <ShippingHAWBDetail> .CreatePagging(itemListShipping, 1, 10);

            //lay danh sach HAWB
            var listHAWB = db.HAWBs.Where(n => n.AgencyId == user.Agency.Id && n.IsActive == true).OrderBy(n => n.CreatedAt);

            ViewBag.HAWB = new SelectList(listHAWB, "Id", "Name");
            return(View(model));
        }
Beispiel #2
0
        public ActionResult Add()
        {
            ViewBag.FromAirId = new SelectList(db.FromAirs.OrderBy(n => n.CreatedAt), "Id", "Name");
            ViewBag.ToAirId   = new SelectList(db.ToAirs.OrderBy(n => n.CreatedAt), "Id", "Name");
            //var WareHouseInfoId = db.WareHouseInfoes.Where(n => n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem() { Value = n.Id+"", Text = n.Name + " / " + n.Address });
            //ViewBag.WareHouseInfoId = new SelectList(WareHouseInfoId, "Value", "Text");
            //var mawb = db.MAWBs.Where(n => n.AgencyId == user.Agency.Id).Where(n => n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem() { Value = n.Id, Text = n.Name + " / " + n.Address });
            //ViewBag.MaWBId = new SelectList(mawb, "Value", "Text");

            var WareHouseInfoId = db.WareHouseInfoes.Where(n => n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem()
            {
                Value = n.Id + "", Text = n.Name + " / " + n.Address
            });

            ViewBag.WareHouseInfoId = new SelectList(WareHouseInfoId, "Value", "Text");
            var mawb = db.MAWBs.Where(n => n.AgencyId == user.Agency.Id).Where(n => n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem()
            {
                Value = n.Id, Text = n.Name + " / " + n.Address
            });

            ViewBag.MaWBId = new SelectList(mawb, "Value", "Text");


            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(5), "Value", "Text");

            return(View(new Shipping()
            {
                DateAir = DateTime.Now, HourAir = DateTime.Now.ToString("HH:mm")
            }));
        }
        // GET: ExportGoods/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ExportGood exportGood = db.ExportGoods.Find(id);

            if (exportGood == null)
            {
                return(HttpNotFound());
            }
            var size = db.SizeTables.OrderBy(n => n.NoOrder).Select(n => new SelectListItem()
            {
                Text = n.Name, Value = n.Id + ""
            }).ToList();

            size.Insert(0, new SelectListItem()
            {
                Value = " ", Text = " "
            });
            ViewBag.SizeTableId = new SelectList(size, "Value", "Text", exportGood.SizeTableId);
            ViewBag.StatusId    = new SelectList(StatusUtils.GetStatus(3), "Value", "Text", exportGood.StatusId);
            //ViewBag.ExportHour = new SelectList(TimeUtils.TimeHours(), "Value", "Text", exportGood.ExportHour);

            return(View(exportGood));
        }
        // GET: ExportGoods
        public ActionResult Index(int page = 1, string key = "", int sort = 0)
        {
            ViewBag.Title = "Danh sách kiện hàng Việt Nam";
            ViewBag.key   = key;
            ViewBag.Page  = page;
            ViewBag.sort  = sort;
            var status = StatusUtils.GetStatus(3);

            status.Insert(0, new SelectListItem()
            {
                Value = "0", Text = "Tất cả"
            });
            ViewBag.ExportGoodStatus = new SelectList(status, "Value", "Text", sort);

            var item           = db.ExportGoods.Where(n => n.AgencyId == user.Agency.Id).OrderByDescending(n => n.CreatedAt);
            var exportShipping = db.ShippingHAWBDetails.Where(n => n.AgencyId == user.Agency.Id);

            item = item.Where(m => exportShipping.Where(n => n.ExportGoodId == m.Id).Count() == 0)
                   .OrderByDescending(n => n.CreatedAt);


            if (sort != 0)
            {
                item = item.Where(n => n.StatusId == sort).OrderByDescending(n => n.CreatedAt);
            }
            if (key != "")
            {
                item = item.Where(n => n.ShippingMarkVN.Contains(key)).OrderByDescending(n => n.CreatedAt);
            }
            return(View(Pager <ExportGood> .CreatePagging(item, page, 10)));
        }
        public ActionResult _Clearance(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FlightBooking FlightBooking = db.FlightBookings.Find(id);

            if (FlightBooking == null)
            {
                return(HttpNotFound());
            }
            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(4), "Value", "Text", FlightBooking.StatusId);

            ViewBag.MAWB          = new SelectList(db.MAWBs.Where(n => n.AgencyId == user.Agency.Id), "Id", "Id");
            ViewBag.HAWB          = new SelectList(db.HAWBs.Where(n => n.AgencyId == user.Agency.Id), "Id", "Id");
            ViewBag.FlightBooking = FlightBooking;
            Tuple <Invoice, CustomsClearance> model = new Tuple <Invoice, CustomsClearance>(new Invoice(), new CustomsClearance());

            try
            {
                model = new Tuple <Invoice, CustomsClearance>(FlightBooking.Invoices != null && FlightBooking.Invoices.Count > 0 ? FlightBooking.Invoices.First() : new Invoice(), FlightBooking.CustomsClearances != null && FlightBooking.CustomsClearances.Count > 0 ? FlightBooking.CustomsClearances.First() : new CustomsClearance());
                if (model.Item2.ClearanceAirs == null || model.Item2.ClearanceAirs.Count <= 0)
                {
                    model.Item2.ClearanceAirs.Add(new ClearanceAir()
                    {
                    });
                }
                ViewBag.Size = new SelectList(db.SizeTables.OrderBy(n => n.NoOrder), "Id", "Name", model.Item2.Size);
            }
            catch { ViewBag.Size = new SelectList(db.SizeTables.OrderBy(n => n.NoOrder), "Id", "Name"); }
            return(PartialView(model));
        }
 public ActionResult Edit(AgencyPackage agencyPackage, string actionlink = "")
 {
     agencyPackage.UpdatedBy = user.Staff.UserName;
     agencyPackage.UpdatedAt = DateTime.Now;
     if (ModelState.IsValid)
     {
         agencyPackage.AgencyId        = user.Agency.Id;
         db.Entry(agencyPackage).State = EntityState.Modified;
         db.SaveChanges();
         ViewBag.ShipmentId = agencyPackage.ShipmentId;
         if (actionlink != "")
         {
             return(Content(javasctipt_add("/AgencyPackageItem/Index/" + agencyPackage.Id, "Cập nhật dữ liệu thành công")));
         }
         else
         {
             return(Content(javasctipt_add("/Shipment/Package/" + agencyPackage.ShipmentId, "Cập nhật dữ liệu thành công")));
         }
     }
     ViewBag.SendHour     = new SelectList(TimeUtils.TimeHours(), "Value", "Text", agencyPackage.SendHour);
     ViewBag.ReceivedHour = new SelectList(TimeUtils.TimeHours(), "Value", "Text", agencyPackage.ReceivedHour);
     ViewBag.AgencyId     = new SelectList(db.Agencies.Where(n => n.Id == user.Agency.Id), "Id", "Name", agencyPackage.AgencyId);
     ViewBag.DeliveryId   = new SelectList(db.DeliveryComs.Where(n => n.IsActive == true), "Id", "Name", agencyPackage.DeliveryId);
     ViewBag.StatusId     = new SelectList(StatusUtils.GetStatus(1), "Value", "Text", agencyPackage.TrackingStatusId);
     if (actionlink != "")
     {
         return(Content(javasctipt_add("/AgencyPackageItem/Index/" + agencyPackage.Id, "Cập nhật dữ liệu thất bại")));
     }
     else
     {
         return(Content(javasctipt_add("/Shipment/Package/" + agencyPackage.ShipmentId, "Cập nhật dữ liệu thất bại")));
     }
 }
Beispiel #7
0
 public ActionResult Edit(Shipment model, string actionlink = "")
 {
     model.UpdatedBy = user.Staff.UserName;
     model.UpdatedAt = DateTime.Now;
     if (ModelState.IsValid)
     {
         model.AgencyId        = user.Agency.Id;
         db.Entry(model).State = EntityState.Modified;
         db.SaveChanges();
         if (actionlink != "")
         {
             return(Content(javasctipt_add("/Shipment/Package/" + model.Id, "Cập nhật dữ liệu thành công")));
         }
         else
         {
             return(Content(javasctipt_add("/Shipment", "Cập nhật dữ liệu thành công")));
         }
     }
     ViewBag.StatusId     = new SelectList(StatusUtils.GetStatus(0), "Value", "Text", model.StatusId);
     ViewBag.ReceivedHour = new SelectList(TimeUtils.TimeHours(), "Value", "Text", model.ReceivedHour);
     if (actionlink != "")
     {
         return(Content(javasctipt_add("/Shipment/Package/" + model.Id, "Cập nhật dữ liệu thất bại")));
     }
     else
     {
         return(Content(javasctipt_add("/Shipment", "Cập nhật dữ liệu thất bại")));
     }
 }
        public ActionResult Detail(Guid id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PackageReturn model = db.PackageReturns.Find(id);

            if (model == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Id       = id;
            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(6), "Value", "Text", model.StatusId);
            var ListJP = db.TrackingDetails.Where(n => n.StorageJP.AgencyId == user.Agency.Id && n.TrackingSubCode == "21").OrderByDescending(n => n.CreatedAt);

            ListJP         = ListJP.Where(n => db.ReturnDetails.Where(m => m.PackageReturn.AgencyId == user.Agency.Id).Where(m => m.TrackingDetailId == n.Id).Count() == 0).OrderByDescending(n => n.CreatedAt);
            ViewBag.ListJP = Pager <TrackingDetail> .CreatePagging(ListJP.OrderByDescending(n => n.CreatedAt), 1, 10);

            var ReturnDetail = db.ReturnDetails.Where(n => n.PackageReturnId == id).Where(n => n.PackageReturn.AgencyId == user.Agency.Id).OrderByDescending(n => n.CreatedAt);

            ViewBag.ReturnDetail = Pager <ReturnDetail> .CreatePagging(ReturnDetail.OrderByDescending(n => n.CreatedAt), 1, 10);

            ViewBag.Model = model;
            return(View(model));
        }
Beispiel #9
0
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Shipping model = db.Shippings.Find(id);

            if (model == null)
            {
                return(HttpNotFound());
            }
            ViewBag.FromAirId = new SelectList(db.FromAirs.OrderBy(n => n.CreatedAt), "Id", "Name", model.FromAirId);
            ViewBag.ToAirId   = new SelectList(db.ToAirs.OrderBy(n => n.CreatedAt), "Id", "Name", model.ToAirId);
            var WareHouseInfoId = db.WareHouseInfoes.Where(n => n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem()
            {
                Value = n.Id + "", Text = n.Name + " / " + n.Address
            });

            ViewBag.WareHouseInfoId = new SelectList(WareHouseInfoId, "Value", "Text", model.WareHouseInfoId);
            var mawb = db.MAWBs.Where(n => n.AgencyId == user.Agency.Id).Where(n => n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem()
            {
                Value = n.Id, Text = n.Name + " / " + n.Address
            });

            ViewBag.MaWBId   = new SelectList(mawb, "Value", "Text", model.MaWBId);
            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(5), "Value", "Text", model.StatusId);
            return(View(model));
        }
        //detail
        public ActionResult Detail(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ExportGood exportGood = db.ExportGoods.Find(id);
            //LIST KIEN JP
            var listjp = db.StorageJPs.Where(n => n.AgencyId == user.Agency.Id).Where(n => n.StatusId == 8).OrderByDescending(n => n.CreatedAt);
            List <TrackingDetail> lstDetail = new List <TrackingDetail>();

            foreach (var item in listjp)
            {
                lstDetail.AddRange(item.TrackingDetails.Where(n => n.TrackingSubCode != "21"));
            }
            lstDetail = lstDetail.Where(n => PageUtils.IsExistExport(n.Id, user.Agency.Id) == false).OrderByDescending(n => n.CreatedAt).ToList();
            var lstReturn = Pager <TrackingDetail> .CreatePagging(lstDetail.AsQueryable(), 1, 10);

            ViewBag.ListJP = lstReturn;
            ViewBag.ListVN = Pager <ExportGoodDetail> .CreatePagging(exportGood.ExportGoodDetails.OrderByDescending(n => n.CreatedAt).AsQueryable(), 1, 10);

            ViewBag.StatusId         = new SelectList(StatusUtils.GetStatus(3), "Value", "Text", exportGood.StatusId);
            ViewBag.ExportGoodStatus = exportGood.StatusId;
            return(View(exportGood));
        }
        // GET: FlightGoods
        public ActionResult Index(Guid id)
        {
            var FlightBooking = db.FlightBookings.Find(id);

            ViewBag.FlightBooking = FlightBooking;
            var model = db.FlightGoods.Where(n => n.FlightBookingId == id);

            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(4), "Value", "Text", FlightBooking.StatusId);
            return(View(model));
        }
Beispiel #12
0
        public ActionResult Clearance(Guid?ShippingId, string PreAD_Note = "", string PreADFile = "", string PreADBase64 = "")
        {
            if (ShippingId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //xu ly update
            Shipping model = db.Shippings.Find(ShippingId);
            //add shipping clearnace
            var shippingClearnace = new ShippingHistory()
            {
                Id              = Guid.NewGuid(),
                ShippingId      = model.Id,
                AgencyId        = user.Agency.Id,
                ShippingCode    = model.ShippingCode,
                DateAir         = model.DateAir,
                HourAir         = model.HourAir,
                FromAirId       = model.FromAirId,
                ToAirId         = model.ToAirId,
                WareHouseInfoId = model.WareHouseInfoId,
                Notes           = model.Notes,
                MaWBId          = model.MaWBId,
                CreatedAt       = DateTime.Now,
                CreatedBy       = user.Staff.UserName,
                StatusId        = model.StatusId,
                UpdatedAt       = DateTime.Now,
                UpdatedBy       = user.Staff.UserName
            };

            if (PreAD_Note != "")
            {
                shippingClearnace.PreAD_Note = PreAD_Note;
            }
            //xu ly upload file
            var upImage = Request.Files["upImage"];

            if (upImage.ContentLength > 0 && upImage != null)
            {
                string fileName = upImage.FileName;
                upImage.SaveAs(Server.MapPath("~/Uploads/PreAD/" + fileName));
                shippingClearnace.PreADFile = fileName;
                try
                {
                    shippingClearnace.PreADBase64 = Web.Helpers.Images.ImageUtils.Images(Server.MapPath("~/Uploads/PreAD/" + fileName));
                }
                catch { }
            }
            db.ShippingHistories.Add(shippingClearnace);
            db.SaveChanges();
            TempData["Message"] = "Cập nhật pre-ad thành công";
            //lay trang thai cua booking
            ViewBag.StatusId          = new SelectList(StatusUtils.GetStatus(5), "Value", "Text", model.StatusId);
            ViewBag.ShippingClearance = db.ShippingHistories.Where(n => n.AgencyId == user.Agency.Id && n.ShippingId == model.Id).OrderByDescending(n => n.CreatedAt);
            return(Redirect("/shipping/clearance/" + model.Id));
        }
        public string getStatus(string name)
        {
            string status = "2";

            try
            {
                status = StatusUtils.GetStatus(1).Where(n => n.Text.Trim().ToLower() == name.Trim().ToLower()).ToList()[0].Value;
            }
            catch { }
            return(status);
        }
 // GET: AgencyPackage/Create
 public ActionResult Add(Guid id)
 {
     ViewBag.AgencyId     = new SelectList(db.Agencies.Where(n => n.Id == user.Agency.Id), "Id", "Name");
     ViewBag.SendHour     = new SelectList(TimeUtils.TimeHours(), "Value", "Text", "");
     ViewBag.ReceivedHour = new SelectList(TimeUtils.TimeHours(), "Value", "Text", "");
     ViewBag.AgencyId     = new SelectList(TimeUtils.TimeHours(), "Value", "Text", "");
     ViewBag.DeliveryId   = new SelectList(db.DeliveryComs.Where(n => n.IsActive == true), "Id", "Name", "");
     ViewBag.StatusId     = new SelectList(StatusUtils.GetStatus(1), "Value", "Text", "");
     return(View(new AgencyPackage()
     {
         ShipmentId = id, SentDate = DateTime.Now, SendHour = DateTime.Now.ToString("HH:mm"), ReceivedDate = DateTime.Now, ReceivedHour = DateTime.Now.ToString("HH:mm")
     }));
 }
        public ActionResult Add()
        {
            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(6), "Value", "Text", "");
            var hawb = db.HAWBs.Where(n => n.AgencyId == user.Agency.Id && n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem()
            {
                Value = n.Id, Text = n.Name + " / " + n.Address
            });

            ViewBag.HAWB = new SelectList(hawb, "Value", "Text");
            //ViewBag.ExportHour = new SelectList(TimeUtils.TimeHours(), "Value", "Text", "");
            return(View(new PackageReturn()
            {
                ReturnDate = DateTime.Now, ReturnHour = DateTime.Now.ToString("HH:mm")
            }));
        }
Beispiel #16
0
        public ActionResult Clearance(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Shipping model = db.Shippings.Find(id);

            //lay trang thai cua booking
            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(5), "Value", "Text", model.StatusId);
            var items = db.ShippingHistories.Where(n => n.AgencyId == user.Agency.Id && n.ShippingId == model.Id).OrderByDescending(n => n.CreatedAt);

            ViewBag.ShippingClearance = items;
            ViewBag.CountItem         = items.Count();
            return(View(model));
        }
Beispiel #17
0
        // GET: Shipment/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var model = db.Shipments.Find(id);

            if (model == null)
            {
                return(HttpNotFound());
            }
            ViewBag.StatusId     = new SelectList(StatusUtils.GetStatus(0), "Value", "Text", model.StatusId);
            ViewBag.ReceivedHour = new SelectList(TimeUtils.TimeHours(), "Value", "Text", model.ReceivedHour);
            return(View(model));
        }
Beispiel #18
0
        public ActionResult Package(Guid id, string key = "", int page = 1, int sort = 0)
        {
            var shipment = db.Shipments.Find(id);

            ViewBag.Shipment = shipment;
            ViewBag.Title    = shipment.ShipmentName;

            ViewBag.KeyPackage  = key;
            ViewBag.SortPackage = sort;
            ViewBag.ShipmentId  = id;
            ViewBag.PagePackage = page;
            var status = StatusUtils.GetStatus(1);

            status.Insert(0, new SelectListItem()
            {
                Value = "0", Text = "Tất cả"
            });
            ViewBag.PackageStatusId = new SelectList(status, "Value", "Text", sort);
            var item = db.AgencyPackages.Where(n => n.AgencyId == user.Agency.Id).Where(n => n.ShipmentId == id).OrderByDescending(n => n.CreatedAt);

            if (sort != 0)
            {
                item = item.Where(n => n.StatusId == sort).OrderByDescending(n => n.CreatedAt);
            }
            if (key != "")
            {
                item = item.Where(n => n.TrackingCode.Contains(key)).OrderByDescending(n => n.CreatedAt);
            }

            ViewBag.DeliveryId   = new SelectList(db.DeliveryComs.Where(n => n.IsActive == true), "Id", "Name", "");
            ViewBag.SendHour     = new SelectList(TimeUtils.TimeHours(), "Value", "Text", "");
            ViewBag.ReceivedHour = new SelectList(TimeUtils.TimeHours(), "Value", "Text", "");
            ViewBag.CurrentDate  = DateTime.Now.ToString("yyyy-MM-dd");

            ViewBag.TotalCount = item.Count();
            ViewBag.TotalWeigh = item.Where(n => n.Weigh != null).Sum(n => n.Weigh);
            try
            {
                ViewBag.TotalItems = item.Sum(m => m.AgencyPackageItems.Count());
            }catch { ViewBag.TotalItems = 0; }
            try
            {
                ViewBag.TotalItemQuantitys = item.Sum(m => m.AgencyPackageItems.Sum(n => n.ItemQuantity));
            }
            catch { ViewBag.TotalItemQuantitys = 0; }
            return(View(Pager <AgencyPackage> .CreatePagging(item, page, 10)));
        }
        public ActionResult Add(ExportGood exportGood)
        {
            exportGood.CreatedAt = exportGood.UpdatedAt = DateTime.Now;
            exportGood.CreatedBy = exportGood.UpdatedBy = user.Staff.UserName;
            exportGood.AgencyId  = user.Agency.Id; exportGood.StaffId = user.Staff.UserName;

            if (ModelState.IsValid)
            {
                try
                {
                    //var upImage = Request.Files["upImage"];
                    //if (upImage.ContentLength > 0 && upImage != null)
                    //{
                    //    string fileName = upImage.FileName.DoiTenHinh();
                    //    upImage.SaveAs(Server.MapPath("~/images/ExportGoods/" + fileName));
                    //    exportGood.Image = fileName;
                    //}
                    exportGood.Id = Guid.NewGuid();
                    db.ExportGoods.Add(exportGood);
                    db.SaveChanges();
                    TempData["Message"] = "Thêm dữ liệu thành công";
                    return(Content(javasctipt_add("/ExportGoods", "Thêm dữ liệu thành công")));
                }
                catch (Exception)
                {
                    TempData["Message"] = "Có lỗi xảy ra, vui lòng kiểm tra lại dữ liệu";
                    ModelState.AddModelError("error", "Có lỗi xảy ra, vui lòng kiểm tra lại dữ liệu");
                }
            }
            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(3), "Value", "Text", exportGood.StatusId);
            var size = db.SizeTables.OrderBy(n => n.NoOrder).Select(n => new SelectListItem()
            {
                Text = n.Name, Value = n.Id + ""
            }).ToList();

            size.Insert(0, new SelectListItem()
            {
                Value = " ", Text = " "
            });
            ViewBag.SizeTableId = new SelectList(size, "Value", "Text", exportGood.SizeTableId);
            //ViewBag.ExportHour = new SelectList(TimeUtils.TimeHours(), "Value", "Text", exportGood.ExportHour);
            TempData["Message"] = "Thêm dữ liệu thất bại";
            return(Content(javasctipt_add("/ExportGoods", "Thêm dữ liệu thất bại")));
        }
        // GET: ExportGoods/Create
        public ActionResult Add()
        {
            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(3), "Value", "Text", "");
            var size = db.SizeTables.OrderBy(n => n.NoOrder).Select(n => new SelectListItem()
            {
                Text = n.Name, Value = n.Id + ""
            }).ToList();

            size.Insert(0, new SelectListItem()
            {
                Value = " ", Text = " "
            });
            ViewBag.SizeTableId = new SelectList(size, "Value", "Text");
            //ViewBag.ExportHour = new SelectList(TimeUtils.TimeHours(), "Value", "Text", "");
            return(View(new ExportGood()
            {
                ExportDate = DateTime.Now, ExportHour = DateTime.Now.ToString("HH:mm")
            }));
        }
 public ActionResult Edit(FlightBooking model, string[] MAWB, string[] HAWB)
 {
     model.UpdatedAt = DateTime.Now;
     model.UpdatedBy = user.Staff.UserName;
     model.StaffId   = user.Staff.UserName;
     model.AgencyId  = user.Agency.Id;
     if (MAWB == null)
     {
         MAWB = new string[] { };
     }
     if (HAWB == null)
     {
         HAWB = new string[] { };
     }
     if (ModelState.IsValid)
     {
         try
         {
             var upImage = Request.Files["upImage"];
             if (upImage.ContentLength > 0 && upImage != null)
             {
                 string fileName = upImage.FileName.DoiTenHinh();
                 upImage.SaveAs(Server.MapPath("~/images/FlightBooking/" + fileName));
                 model.Image = fileName;
             }
             model.StaffIdUpdate   = user.Staff.UserName;
             db.Entry(model).State = EntityState.Modified;
             db.SaveChanges();
             return(PartialView("~/views/Message/Add.cshtml"));
         }
         catch (Exception)
         {
             ModelState.AddModelError("error", "Có lỗi xảy ra, vui lòng kiểm tra lại dữ liệu");
         }
     }
     ViewBag.MAWB          = new SelectList(db.MAWBs.Where(n => n.AgencyId == user.Agency.Id), "Id", "Id");
     ViewBag.HAWB          = new SelectList(db.HAWBs.Where(n => n.AgencyId == user.Agency.Id), "Id", "Id");
     ViewBag.AirId         = new SelectList(db.AirInfoes.Select(n => new { Id = n.Id, Name = n.Id + " - " + n.Name }), "Id", "Name", model.AirId);
     ViewBag.StatusId      = new SelectList(StatusUtils.GetStatus(4), "Value", "Text", model.StatusId);
     ViewBag.FlightRouteId = new SelectList(db.FlightRoutes.OrderBy(n => n.CreatedAt), "Id", "Name", model.FlightRouteId);
     ViewBag.Size          = new SelectList(db.SizeTables.OrderBy(n => n.NoOrder), "Id", "Name", model.Size);
     return(View(model));
 }
        // GET: AgencyPackage/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AgencyPackage agencyPackage = db.AgencyPackages.Find(id);

            if (agencyPackage == null)
            {
                return(HttpNotFound());
            }
            ViewBag.SendHour     = new SelectList(TimeUtils.TimeHours(), "Value", "Text", agencyPackage.SendHour);
            ViewBag.ReceivedHour = new SelectList(TimeUtils.TimeHours(), "Value", "Text", agencyPackage.ReceivedHour);
            ViewBag.AgencyId     = new SelectList(db.Agencies.Where(n => n.Id == user.Agency.Id), "Id", "Name", agencyPackage.AgencyId);
            ViewBag.StatusId     = new SelectList(StatusUtils.GetStatus(1), "Value", "Text", agencyPackage.TrackingStatusId);
            ViewBag.DeliveryId   = new SelectList(db.DeliveryComs, "Id", "Name", agencyPackage.DeliveryId);
            return(View(agencyPackage));
        }
Beispiel #23
0
        // GET: Shipping
        public ActionResult Index(int page = 1, string key = "", int sort = 13)
        {
            ViewBag.Title = "Danh sách chuyến bay";
            ViewBag.key   = key;
            ViewBag.Page  = page;
            ViewBag.sort  = sort;
            var status = StatusUtils.GetStatus(5);

            status.Insert(0, new SelectListItem()
            {
                Value = "0", Text = "Tất cả"
            });
            ViewBag.ShippingStatus = new SelectList(status, "Value", "Text", sort);

            var item = db.Shippings.Where(n => n.AgencyId == user.Agency.Id).Where(n => n.ShippingCode.Contains(key)).OrderByDescending(n => n.CreatedAt);

            if (sort != 0)
            {
                item = item.Where(n => n.StatusId == sort).OrderByDescending(n => n.CreatedAt);
            }

            //search
            ViewBag.FromAirId = new SelectList(db.FromAirs.OrderBy(n => n.CreatedAt), "Id", "Name");
            ViewBag.ToAirId   = new SelectList(db.ToAirs.OrderBy(n => n.CreatedAt), "Id", "Name");
            //ViewBag.WareHouseInfoId = new SelectList(db.WareHouseInfoes.Where(n => n.IsActive == true).OrderBy(n => n.CreatedAt), "Id", "Name");
            //ViewBag.MaWBId = new SelectList(db.MAWBs.Where(n => n.AgencyId == user.Agency.Id).Where(n => n.IsActive == true).OrderBy(n => n.CreatedAt), "Id", "Name");
            var WareHouseInfoId = db.WareHouseInfoes.Where(n => n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem()
            {
                Value = n.Id + "", Text = n.Name + " / " + n.Address
            });

            ViewBag.WareHouseInfoId = new SelectList(WareHouseInfoId, "Value", "Text");
            var mawb = db.MAWBs.Where(n => n.AgencyId == user.Agency.Id).Where(n => n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem()
            {
                Value = n.Id, Text = n.Name + " / " + n.Address
            });

            ViewBag.MaWBId   = new SelectList(mawb, "Value", "Text");
            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(5), "Value", "Text");

            return(View(Pager <Shipping> .CreatePagging(item, page, 10)));
        }
        // GET: FlightBooking/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FlightBooking model = db.FlightBookings.Find(id);

            if (model == null)
            {
                return(HttpNotFound());
            }
            ViewBag.AirId         = new SelectList(db.AirInfoes.Select(n => new { Id = n.Id, Name = n.Id + " - " + n.Name }), "Id", "Name", model.AirId);
            ViewBag.StatusId      = new SelectList(StatusUtils.GetStatus(4), "Value", "Text", model.StatusId);
            ViewBag.FlightRouteId = new SelectList(db.FlightRoutes.OrderBy(n => n.CreatedAt), "Id", "Name", model.FlightRouteId);
            ViewBag.Size          = new SelectList(db.SizeTables.OrderBy(n => n.NoOrder), "Id", "Name", model.Size);
            ViewBag.MAWB          = new SelectList(db.MAWBs.Where(n => n.AgencyId == user.Agency.Id), "Id", "Id");
            ViewBag.HAWB          = new SelectList(db.HAWBs.Where(n => n.AgencyId == user.Agency.Id), "Id", "Id");
            return(View(model));
        }
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PackageReturn model = db.PackageReturns.Find(id);

            if (model == null)
            {
                return(HttpNotFound());
            }
            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(6), "Value", "Text", model.StatusId);
            var hawb = db.HAWBs.Where(n => n.AgencyId == user.Agency.Id && n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem()
            {
                Value = n.Id, Text = n.Name + " / " + n.Address
            });

            ViewBag.HAWB = new SelectList(hawb, "Value", "Text", model.ReturnHAWBs.First().HAWBId);
            return(View(model));
        }
        // GET: PackageReturn
        public ActionResult Index(int page = 1, int sort = 15)
        {
            ViewBag.Title = "Danh sách trả hàng";
            ViewBag.Page  = page;
            ViewBag.sort  = sort;
            var status = StatusUtils.GetStatus(6);

            status.Insert(0, new SelectListItem()
            {
                Value = "0", Text = "Tất cả"
            });
            ViewBag.ExportGoodStatus = new SelectList(status, "Value", "Text", sort);
            ViewBag.HAWB             = new SelectList(status, "Value", "Text", sort);
            var item = db.PackageReturns.Where(n => n.AgencyId == user.Agency.Id).OrderByDescending(n => n.CreatedAt);

            if (sort != 0)
            {
                item = item.Where(n => n.StatusId == sort).OrderByDescending(n => n.CreatedAt);
            }
            return(View(Pager <PackageReturn> .CreatePagging(item, page, 10)));
        }
Beispiel #27
0
        // GET: Shipment
        public ActionResult Index(int page = 1, int sort = -1)
        {
            ViewBag.Title = "Danh sách lô hàng";
            ViewBag.sort  = sort;
            ViewBag.page  = page;
            var status = StatusUtils.GetStatus(0);

            status.Insert(0, new SelectListItem()
            {
                Value = "0", Text = "Tất cả"
            });
            ViewBag.StatusId = new SelectList(status, "Value", "Text", sort);
            if (sort != 0)
            {
                return(View(Pager <Shipment> .CreatePagging(db.Shipments.Where(n => n.AgencyId == user.Agency.Id).Where(n => n.StatusId == sort).OrderByDescending(n => n.CreatedAt), page, 10)));
            }
            else
            {
                return(View(Pager <Shipment> .CreatePagging(db.Shipments.Where(n => n.AgencyId == user.Agency.Id).OrderByDescending(n => n.CreatedAt), page, 10)));
            }
        }
Beispiel #28
0
        public ActionResult Edit(Shipping model, Guid Id)
        {
            model.UpdatedAt = DateTime.Now;
            model.UpdatedBy = user.Staff.UserName;
            model.AgencyId  = user.Agency.Id;
            if (PageUtils.IsUpdateShipping(model) != "")
            {
                return(Content(javasctipt_add("/Shipping", PageUtils.IsUpdateShipping(model))));
            }
            if (ModelState.IsValid)
            {
                try
                {
                    db.Entry(model).State = EntityState.Modified;
                    db.SaveChanges();
                    return(Content(javasctipt_add("/Shipping", "Cập nhật dữ liệu thành công")));
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("error", "Có lỗi xảy ra, vui lòng kiểm tra lại dữ liệu");
                }
            }
            ViewBag.FromAirId = new SelectList(db.FromAirs.OrderBy(n => n.CreatedAt), "Id", "Name", model.FromAirId);
            ViewBag.ToAirId   = new SelectList(db.ToAirs.OrderBy(n => n.CreatedAt), "Id", "Name", model.ToAirId);
            var WareHouseInfoId = db.WareHouseInfoes.Where(n => n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem()
            {
                Value = n.Id + "", Text = n.Name + " / " + n.Address
            });

            ViewBag.WareHouseInfoId = new SelectList(WareHouseInfoId, "Value", "Text", model.WareHouseInfoId);
            var mawb = db.MAWBs.Where(n => n.AgencyId == user.Agency.Id).Where(n => n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem()
            {
                Value = n.Id, Text = n.Name + " / " + n.Address
            });

            ViewBag.MaWBId   = new SelectList(mawb, "Value", "Text", model.MaWBId);
            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(5), "Value", "Text", model.StatusId);
            return(Content(javasctipt_add("/Shipping", "Cập nhật dữ liệu thất bại")));
        }
        public ActionResult Edit(ExportGood exportGood, string actionlink = "")
        {
            if (PageUtils.IsUpdateExport(exportGood).Length > 0)
            {
                if (exportGood.ExportGoodDetails.Count() == 0)
                {
                    return(Content(javasctipt_add("/ExportGoods", PageUtils.IsUpdateExport(exportGood)) + ", nội dung kiện hàng."));
                }
                else
                {
                    return(Content(javasctipt_add("/ExportGoods", PageUtils.IsUpdateExport(exportGood))));
                }
            }
            else
            {
                exportGood.UpdatedAt = DateTime.Now;
                exportGood.UpdatedBy = user.Staff.UserName;
                exportGood.StaffId   = user.Staff.UserName;
                exportGood.AgencyId  = user.Agency.Id;

                if (ModelState.IsValid)
                {
                    try
                    {
                        //var upImage = Request.Files["upImage"];
                        //if (upImage.ContentLength > 0 && upImage != null)
                        //{
                        //    string fileName = upImage.FileName.DoiTenHinh();
                        //    upImage.SaveAs(Server.MapPath("~/images/ExportGoods/" + fileName));
                        //    exportGood.Image = fileName;
                        //}
                        db.Entry(exportGood).State = EntityState.Modified;
                        TempData["Message"]        = "Cập nhật dữ liệu thành công";
                        db.SaveChanges();

                        if (actionlink != "")
                        {
                            return(Content(javasctipt_add("/ExportGoods/Detail/" + exportGood.Id, "Cập nhật dữ liệu thành công")));
                        }
                        else
                        {
                            return(Content(javasctipt_add("/ExportGoods", "Cập nhật dữ liệu thành công")));
                        }
                    }
                    catch (Exception)
                    {
                        TempData["Message"] = "Có lỗi xảy ra, vui lòng kiểm tra lại dữ liệu";
                        ModelState.AddModelError("error", "Có lỗi xảy ra, vui lòng kiểm tra lại dữ liệu");
                    }
                }
                var size = db.SizeTables.OrderBy(n => n.NoOrder).Select(n => new SelectListItem()
                {
                    Text = n.Name, Value = n.Id + ""
                }).ToList();
                size.Insert(0, new SelectListItem()
                {
                    Value = " ", Text = " "
                });
                ViewBag.SizeTableId = new SelectList(size, "Value", "Text", exportGood.SizeTableId);
                ViewBag.StatusId    = new SelectList(StatusUtils.GetStatus(3), "Value", "Text", exportGood.StatusId);
                //ViewBag.ExportHour = new SelectList(TimeUtils.TimeHours(), "Value", "Text", exportGood.ExportHour);
                if (actionlink != "")
                {
                    return(Content(javasctipt_add("/ExportGoods/Detail/" + exportGood.Id, "Cập nhật dữ liệu thất bại")));
                }
                else
                {
                    return(Content(javasctipt_add("/ExportGoods", "Cập nhật dữ liệu thất bại")));
                }
            }
        }
Beispiel #30
0
        public ActionResult Booking(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Shipping model = db.Shippings.Find(id);

            //lay danh sach lich su booking
            var lstBookingHistory = model.ShippingBookings.OrderByDescending(n => n.CreatedAt);

            ViewBag.BookingHistory = lstBookingHistory;
            //lay danh sach so kien so kg tham khao
            var lstInformation = new List <BookingInformation>();
            //lay danh sach tren duong
            var    lstTrenDuong = db.Shipments.Where(n => n.AgencyId == user.Agency.Id && n.StatusId == -1);
            double counttracking = 0; double weigh = 0;

            foreach (var item in lstTrenDuong)
            {
                counttracking += item.AgencyPackages.Count();
                weigh         += item.AgencyPackages.Sum(n => n.Weigh).Value;
            }
            var infoTrenDuong = new BookingInformation()
            {
                Notes = "Trên đường", TrackingCount = counttracking, Weigh = weigh
            };

            lstInformation.Add(infoTrenDuong);
            ViewBag.Weigh = weigh; ViewBag.TrackingCount = counttracking;
            counttracking = 0; weigh = 0;
            //lay danh sach luu kho va xuat kho
            //+ lay danh sach luu kho khong nam trong xuat kho
            var lstLuuKho = db.StorageJPs.Where(n => n.AgencyId == user.Agency.Id);

            lstLuuKho      = lstLuuKho.Where(n => n.TrackingDetails.Where(k => db.ExportGoodDetails.Where(m => m.ExportGood.AgencyId == user.Agency.Id).Where(m => m.TrackingDetailId == k.Id).Count() == 0).Count() >= 0);
            weigh         += lstLuuKho.Where(n => n.Weigh != null).Sum(n => n.Weigh).Value;
            counttracking += lstLuuKho.Count();
            infoTrenDuong  = new BookingInformation()
            {
                Notes = "Lưu kho", TrackingCount = counttracking, Weigh = weigh
            };
            lstInformation.Add(infoTrenDuong);
            //+ lay dan sach xuat kho khong nam trong chuyen bay hoac chuyen bay chua thong quan
            var lstXuatKho = db.ExportGoods.Where(n => n.AgencyId == user.Agency.Id);
            //lay kien xuat kho co trong chuyen bay
            int ex_counttracking = 0; double ex_weigh = 0;
            var lstXuatKhoInFlight = lstXuatKho.Where(n => db.ShippingHAWBDetails.Where(m => m.AgencyId == user.Agency.Id).Where(m => m.ShippingHAWB.Shipping.StatusId == 14).Where(m => m.ExportGoodId == n.Id).Count() > 0);

            lstXuatKho = lstXuatKho.Where(n => lstXuatKhoInFlight.Where(m => m.Id == n.Id).Count() == 0);
            foreach (var item in lstXuatKho)
            {
                counttracking    += item.ExportGoodDetails.Count();
                ex_counttracking += item.ExportGoodDetails.Count();
            }
            weigh    += lstXuatKho.Where(n => n.Weigh != null).Sum(n => n.Weigh).Value;
            ex_weigh += lstXuatKho.Where(n => n.Weigh != null).Sum(n => n.Weigh).Value;
            //thong tin xuat kho
            infoTrenDuong = new BookingInformation()
            {
                Notes = "Xuất kho", TrackingCount = ex_counttracking, Weigh = ex_weigh
            };
            lstInformation.Add(infoTrenDuong);

            //thong tin tong cong luu kho + xuat kho
            infoTrenDuong = new BookingInformation()
            {
                Notes = "Lưu kho & xuất kho chưa thông quan", TrackingCount = counttracking, Weigh = weigh
            };
            lstInformation.Add(infoTrenDuong);
            ViewBag.Information = lstInformation;
            //lay trang thai cua booking
            var Status = lstBookingHistory == null || lstBookingHistory.Count() == 0 ? 11 : lstBookingHistory.First().StatusId;

            ViewBag.Status   = Status;
            ViewBag.Count    = lstBookingHistory.Count();
            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(4), "Value", "Text", Status);
            return(View(model));
        }