Example #1
0
        private DispatchNoteModel SaveDispatchImpl(IRepositoryLocator locator, DispatchNoteModel dispatchModel)
        {
            var entity = DispatchNote.Create(locator, dispatchModel);

            locator.FlushModifications(); // need to flush in order to get the Id into the DTO
            return(Mapper.Map <DispatchNote, DispatchNoteModel>(entity));
        }
Example #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);
        }
        public static DispatchNote Create(IRepositoryLocator locator, DispatchNoteModel model)
        {
            var haulier  = locator.GetById <Haulier>(model.HaulierId);
            var instance = new DispatchNote
            {
                CreationDate       = model.CreationDate,
                LastUpdate         = model.CreationDate,
                DispatchDate       = model.DispatchDate,
                DispatchNoteStatus = New,
                DispatchReference  = model.DispatchReference,
                Haulier            = haulier,
                TruckReg           = model.TruckReg,
                User = model.User
            };

            locator.Save(instance);
            model.Lines.ForEach(l => instance.AddLine(locator, l));
            return(instance);
        }
        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;
        }
 private DispatchNoteModel SaveDispatchImpl(IRepositoryLocator locator, DispatchNoteModel dispatchModel)
 {
     var entity = DispatchNote.Create(locator, dispatchModel);
       locator.FlushModifications(); // need to flush in order to get the Id into the DTO
       return Mapper.Map<DispatchNote, DispatchNoteModel>(entity);
 }
 public DispatchNoteModel SaveDispatch(DispatchNoteModel dispatchModel)
 {
     return ExecuteCommand(locator => SaveDispatchImpl(locator, dispatchModel));
 }
Example #7
0
 public DispatchNoteModel SaveDispatch(DispatchNoteModel dispatchModel)
 {
     return(ExecuteCommand(locator => SaveDispatchImpl(locator, dispatchModel)));
 }