Exemple #1
0
 public InvoiceProcessedIntegrationEventHandler(DispatchRepository dispatchOrderRepository, IEventBus eventBus
                                                , ILogger <InvoiceProcessedIntegrationEventHandler> logger)
 {
     this._dispatchOrderRepository = dispatchOrderRepository ?? throw new ArgumentNullException(nameof(dispatchOrderRepository));
     this._eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus));
     this._logger   = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public List <DispatchCatalogModel> GetDispatches(uint[] drivers = null, uint[] companies = null, DateTime?fromDate = null, DateTime?toDate = null, bool?includeCancelled = null)
 {
     using (var db = DB.GetContext())
     {
         return(DispatchRepository.GetDispatches(db, drivers, companies, null, fromDate, toDate, includeCancelled));
     }
 }
        public string DispatchStudent()
        {
            var view = new GenericView();
            DispatchRepository dispatchRepo = new DispatchRepository();

            var result = dispatchRepo.GetDispatchStudent(Auth.User().Id);

            return(view.Show(result));
        }
        public string Index()
        {
            DispatchView       view         = new DispatchView();
            DispatchRepository dispatchRepo = new DispatchRepository();

            var result = dispatchRepo.GetAvailableCourse();

            return(view.ShowAvailableCourse(result));
        }
        public static DispatchManager CreateEdit(uint dispatchID)
        {
            var db    = DB.GetContext();
            var model = DispatchRepository.GetDispatch(db, dispatchID);

            if (model == null)
            {
                throw new ArgumentException("No dispatch with the specified ID!");
            }

            return(new DispatchManager(model));
        }
        public CheckResult DeleteDispatch(DispatchModel model)
        {
            try
            {
                using (var db = DB.GetContext())
                {
                    var check = DispatchValidator.ValidateDelete(db, model);
                    if (check.Failed)
                    {
                        return(check);
                    }

                    DispatchRepository.DeleteDispatch(db, model);
                    db.SaveChanges();
                    return(check);
                }
            }
            catch (Exception ex)
            {
                return(new CheckResult(ex));
            }
        }
        public CheckResult SaveDispatch(DispatchModel model)
        {
            try
            {
                using (var db = DB.GetContext())
                {
                    var check = DispatchValidator.ValidateSave(db, model);
                    if (check.Failed)
                    {
                        return(check);
                    }

                    KeyBinder key = new KeyBinder();
                    DispatchRepository.SaveDispatch(db, key, model);
                    db.SaveChanges();
                    key.BindKeys();
                    return(check);
                }
            }
            catch (Exception ex)
            {
                return(new CheckResult(ex));
            }
        }
Exemple #8
0
 public DispatchController(DispatchRepository dispatchRepository)
 {
     this._dispatchRepository = dispatchRepository ?? throw new ArgumentNullException(nameof(dispatchRepository));
 }
 public OrderCreatedIntegrationEventHandler(DispatchRepository dispatchRepository,
                                            ILogger <OrderCreatedIntegrationEventHandler> logger)
 {
     this._dispatchRepository = dispatchRepository ?? throw new ArgumentNullException(nameof(dispatchRepository));
     this._logger             = logger ?? throw new ArgumentNullException(nameof(logger));
 }