示例#1
0
        public ActionResult ValidateDispatch(UploadDispatchModel model)
        {
            var          dispatch = GetDispatchNote(model);
            const string msg      = "{0} - New dispatch note was created with date {1:d} and contains {2} lines";

            ViewBag.Message = string.Format(msg, dispatch.HaulierName, dispatch.DispatchDate, dispatch.Lines.Count);
            LiteDispatchSession.LastDispatch = dispatch;
            return(View(dispatch));
        }
示例#2
0
        private DispatchNoteModel GetDispatchNote(UploadDispatchModel model)
        {
            var result = new DispatchNoteModel {
                DispatchNoteStatus = DispatchNoteStatusEnum.New, DispatchDate = model.DispatchDate.Value, HaulierName = "UnKnown", TruckReg = model.TruckReg, DispatchReference = model.ReferenceNumber
            };
            var haulier = LiteDispatchSession.UserHaulier();

            result.HaulierId   = haulier.Id;
            result.HaulierName = haulier.Name;
            var linea = new DispatchLineModel
            {
                Id          = 1,
                ProductType = "Fresh",
                Product     = "Hake",
                Metric      = "Kg",
                Quantity    = 25,
                ShopId      = 18,
                Client      = "RedSquid"
            };

            result.Lines.Add(linea);

            linea = new DispatchLineModel
            {
                Id          = 2,
                ProductType = "Frozen",
                Product     = "Frozen Squid",
                Metric      = "Pallet",
                Quantity    = 4,
                ShopId      = 4,
                ShopLetter  = "A",
                Client      = "Alaska Brothers"
            };

            result.Lines.Add(linea);

            linea = new DispatchLineModel
            {
                Id          = 3,
                ProductType = "Shellfish",
                Product     = "Mussel",
                Metric      = "Sac",
                Quantity    = 20,
                ShopId      = 112,
                Client      = "Irish Seafoods"
            };

            result.Lines.Add(linea);

            return(result);
        }
示例#3
0
        public ActionResult UploadFile(UploadDispatchModel model, HttpPostedFileBase uploadedFile)
        {
            var invalidFlag = IsInvalidUploadFile(uploadedFile);

            if (!ModelState.IsValid || invalidFlag)
            {
                ModelState.AddModelError("", "Please, check that all fields were entered correctly");
                if (invalidFlag)
                {
                    ModelState.AddModelError("", InvalidUploadFileNotification(uploadedFile));
                }
                return(View("Index", model));
            }
            return(RedirectToAction("ValidateDispatch", model));
        }
        private DispatchNoteModel GetDispatchNote(UploadDispatchModel model)
        {
            var result = new DispatchNoteModel {DispatchNoteStatus = DispatchNoteStatusEnum.New, DispatchDate = model.DispatchDate.Value, HaulierName = "UnKnown", TruckReg = model.TruckReg, DispatchReference = model.ReferenceNumber};
              var haulier = LiteDispatchSession.UserHaulier();
              result.HaulierId = haulier.Id;
              result.HaulierName = haulier.Name;
              var linea = new DispatchLineModel
            {
              Id = 1,
              ProductType = "Fresh",
              Product = "Hake",
              Metric = "Kg",
              Quantity = 25,
              ShopId = 18,
              Client = "RedSquid"
            };

              result.Lines.Add(linea);

              linea = new DispatchLineModel
              {
            Id = 2,
            ProductType = "Frozen",
            Product = "Frozen Squid",
            Metric = "Pallet",
            Quantity = 4,
            ShopId = 4,
            ShopLetter = "A",
            Client = "Alaska Brothers"
              };

              result.Lines.Add(linea);

              linea = new DispatchLineModel
              {
            Id = 3,
            ProductType = "Shellfish",
            Product = "Mussel",
            Metric = "Sac",
            Quantity = 20,
            ShopId = 112,
            Client = "Irish Seafoods"
              };

              result.Lines.Add(linea);

              return result;
        }
 public ActionResult ValidateDispatch(UploadDispatchModel model)
 {
     var dispatch = GetDispatchNote(model);
       const string msg = "{0} - New dispatch note was created with date {1:d} and contains {2} lines";
       ViewBag.Message = string.Format(msg, dispatch.HaulierName, dispatch.DispatchDate, dispatch.Lines.Count);
       LiteDispatchSession.LastDispatch = dispatch;
       return View(dispatch);
 }
 public ActionResult UploadFile(UploadDispatchModel model, HttpPostedFileBase uploadedFile)
 {
     var invalidFlag = IsInvalidUploadFile(uploadedFile);
       if (!ModelState.IsValid || invalidFlag)
       {
     ModelState.AddModelError("", "Please, check that all fields were entered correctly");
     if (invalidFlag)
     {
       ModelState.AddModelError("", InvalidUploadFileNotification(uploadedFile));
     }
     return View("Index", model);
       }
       return RedirectToAction("ValidateDispatch", model);
 }