예제 #1
0
        public TimeMap GetTimeMap()
        {
            if (_timeMapInstance == null || IsTimeMapExpired())
            {
                lock (_syncRoot)
                {
                    if (_timeMapInstance == null || IsTimeMapExpired())
                    {
                        IOrderUnitOfWork database = _container.Resolve <IOrderUnitOfWork>();
                        IConfig          config   = _container.Resolve <IConfig>();

                        DateTime todayStartDate = DateTimeHelper.GetStartDateOfToday();
                        DateTime todayEndDate   = DateTimeHelper.GetEndDateOfToday();

                        var todayOrdersMap = database.Orders.Find(o =>
                                                                  o.TargetStartDate >= todayStartDate &&
                                                                  o.TargetEndDate <= todayEndDate
                                                                  ).ToList <Order>();

                        var timeMapConfig = new TimeMapConfig(config.WorkingDayStartTime.ToTimeSpan(),
                                                              config.WorkingDayEndTime.ToTimeSpan(),
                                                              config.TimeMapTraySize.ToTimeSpan(),
                                                              config.CookingDelayTime.ToTimeSpan(),
                                                              config.OrderExpireTime.ToTimeSpan(),
                                                              config.TimeMapRules.ToList <TimeMapRule>());

                        _timeMapInstance = new TimeMap(todayOrdersMap, timeMapConfig);

                        database.Dispose();
                    }
                }
            }

            return(_timeMapInstance);
        }
예제 #2
0
 public OrderService(IMapper mapper, IOrderUnitOfWork orderUnitOfWork, IAppCacheService appCacheService)
 {
     _orderUnitOfWork = orderUnitOfWork;
     _mapper          = mapper;
     _orderValidator  = new OrderServiceValidator(_orderUnitOfWork);
     _appCacheService = appCacheService;
 }
예제 #3
0
 private void Refresh(IOrderUnitOfWork orderUnitOfWork)
 {
     _orders.Clear();
     foreach (var item in orderUnitOfWork.Orders.GetAll())
     {
         _orders.Add(item);
     }
 }
예제 #4
0
 public OrderService(
     IOrderRepository orderRepository,
     IOrderUnitOfWork orderUnitOfWork
     )
 {
     this.orderRepository = orderRepository;
     this.orderUnitOfWork = orderUnitOfWork;
 }
예제 #5
0
 public AvailableDriverFoundConsumer(IOrderUnitOfWork unitOfWork,
                                     IOrderService orderService,
                                     IMapper mapper)
 {
     _unitOfWork   = unitOfWork;
     _orderService = orderService;
     _mapper       = mapper;
 }
예제 #6
0
 public SendEmailViewModel(ILoginUnitOfWork loginUnitOfWork, IOrderUnitOfWork orders,
                           OrdersViewModel viewModel, IOrderProcessor processor)
 {
     _orderViemModel = viewModel;
     _users          = loginUnitOfWork.Users.GetAll().ToList();
     _orderDetails   = orders.OrderDetails.GetAll().ToList();
     _orders         = orders.Orders.GetAll().ToList();
     _orderProcessor = processor;
     _reposiroty     = orders;
 }
예제 #7
0
        private OrdersObservableCollection(IOrderUnitOfWork repository)
        {
            _orders = new ObservableCollection <Order>(repository.Orders.GetAll().ToList());

            var timer = new System.Windows.Threading.DispatcherTimer();

            timer.Interval  = new TimeSpan(0, 1, 0);
            timer.IsEnabled = true;
            timer.Tick     += (o, t) => Refresh(repository);
            timer.Start();
        }
예제 #8
0
        private void Refresh(IOrderUnitOfWork orderUnitOfWork)
        {
            SeriesCollection[0].Values.Clear();

            var countOrdersPerDayEnumerable = orderUnitOfWork.Orders.GetAll().OrderBy(y => y.DateTime.Date)
                                              .GroupBy(x => x.DateTime.Date)
                                              .Select(g => new { Count = g.Count() }).ToEnumerable();

            foreach (var item in countOrdersPerDayEnumerable)
            {
                SeriesCollection[0].Values.Add(item.Count);
            }
        }
예제 #9
0
        public StatisticViewModel(int row, IOrderUnitOfWork orderUnitOfWork)
        {
            Row = row;

            CountOrdersPerDay = new ChartValues <int>();

            var countOrdersPerDayEnumerable = orderUnitOfWork.Orders.GetAll().OrderBy(y => y.DateTime.Date)
                                              .GroupBy(x => x.DateTime.Date)
                                              .Select(g => new { Count = g.Count() }).ToEnumerable();


            foreach (var item in countOrdersPerDayEnumerable)
            {
                CountOrdersPerDay.Add(item.Count);
            }

            //var start = DateTime.Now.StartOfWeek();
            //var end = DateTime.Now.EndOfWeek();
            //.Where(x => x.Date >= start && x.Date <= end)

            Labels = orderUnitOfWork.Orders.GetAll().OrderBy(y => y.DateTime.Date)
                     .Select(x => x.DateTime.Date.ToString("dd/MM/yyyy"))
                     .Distinct().ToArray();

            SeriesCollection = new SeriesCollection()
            {
                new LineSeries
                {
                    Values            = CountOrdersPerDay,
                    PointGeometry     = DefaultGeometries.Circle,
                    PointGeometrySize = 10,
                    PointForeground   = MyColorForPoint
                }
            };

            YFormatter = value => value.ToString("C");

            ((LineSeries)SeriesCollection[0]).Stroke = MyColorForStroke;
            ((LineSeries)SeriesCollection[0]).Fill   = MyColorForFill;

            var timer = new System.Windows.Threading.DispatcherTimer();

            timer.Interval  = new TimeSpan(0, 1, 0);
            timer.IsEnabled = true;
            timer.Tick     += (o, t) => Refresh(orderUnitOfWork);
            timer.Start();
        }
예제 #10
0
 public CartController
     (IProductRepository productRep,
     IShoppingCartRepository shoppingCartRep,
     IOrderUnitOfWork orderUnitOfWork,
     IConfiguration config,
     IWebHostEnvironment webHostEnvironment,
     UserManager <IdentityUser> userManager,
     IEmailSender emailSender)
 {
     _productRep         = productRep;
     _orderUnitOfWork    = orderUnitOfWork;
     _shoppingCartRep    = shoppingCartRep;
     _config             = config;
     _webHostEnvironment = webHostEnvironment;
     _userManager        = userManager;
     _emailSender        = emailSender;
 }
예제 #11
0
        public MainViewModel(IProductUnitOfWork productUnitOfWork, IOrderUnitOfWork orderUnitOfWork, ILoginUnitOfWork login, IOrderProcessor processor)
        {
            OrdersViewModel ordersVM = new OrdersViewModel(orderUnitOfWork, 0);

            PageViewModels.Add(ordersVM);
            PageViewModels.Add(new ProductImagesViewModel(productUnitOfWork, 1));
            PageViewModels.Add(new ProductsViewModel(productUnitOfWork, 2));
            PageViewModels.Add(new ProductSizesViewModel(productUnitOfWork, 3));
            PageViewModels.Add(new StatisticViewModel(4, orderUnitOfWork));
            CurrentPageViewModel = PageViewModels[0];

            AddViews.Add(this);
            AddViews.Add(new SendEmailViewModel(login, orderUnitOfWork, ordersVM, processor));
            AddViews.Add(new AddNewImageViewModel(productUnitOfWork, this));
            AddViews.Add(new AddNewSizeViewModel(productUnitOfWork, this));
            AddViews.Add(new AddProductViewModel(productUnitOfWork, this));
            AddViews.Add(new StatisticRightViewModel(orderUnitOfWork));
            CurrentAddView = AddViews[1];

            CloseWindowCommand = new RelayCommand(x => CloseWindow((ICloseable)x));
        }
        public OrderService(IOrderUnitOfWork ordersDatabase, IContactService contactService, ITimeMapService timeMapService, IConfig config, OrderFactory orderFactory)
        {
            if (ordersDatabase == null)
            {
                throw new ArgumentNullException(nameof(ordersDatabase));
            }

            _ordersDatabase = ordersDatabase;

            if (contactService == null)
            {
                throw new ArgumentNullException(nameof(contactService));
            }

            _contactService = contactService;

            if (timeMapService == null)
            {
                throw new ArgumentNullException(nameof(timeMapService));
            }

            _timeMapService = timeMapService;

            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            _config = config;

            if (orderFactory == null)
            {
                throw new ArgumentNullException(nameof(orderFactory));
            }

            _orderFactory = orderFactory;
        }
예제 #13
0
 public static ViewManager GetInstance(ILoginUnitOfWork loginUnitOfWork, IProductUnitOfWork productUnitOfWork, IOrderUnitOfWork orderUnitOfWork, IOrderProcessor processor)
 {
     if (_instance == null)
     {
         _instance = new ViewManager(loginUnitOfWork, productUnitOfWork, orderUnitOfWork, processor);
     }
     return(_instance);
 }
 public OrderIncomeInvoiceQueryHandler(IOrderUnitOfWork unitOfWork)
 {
     _unitOfWork = unitOfWork;
 }
예제 #15
0
 public AppView(ILoginUnitOfWork loginUnitOfWork, IProductUnitOfWork productUnitOfWork, IOrderUnitOfWork orderUnitOfWork, IOrderProcessor processor)
 {
     InitializeComponent();
     DataContext = ViewManager.GetInstance(loginUnitOfWork, productUnitOfWork, orderUnitOfWork, processor);
 }
 public OrderServiceValidator(IOrderUnitOfWork orderUnitOfWork)
 {
     _orderUnitOfWork = orderUnitOfWork;
 }
예제 #17
0
 /// <summary>
 /// Initializes a new instance of the <seealso cref="OrderController"/> class.
 /// </summary>
 /// <param name="unitOfWork"></param>
 public OrderController(IOrderUnitOfWork unitOfWork)
 {
     _unitOfWork = unitOfWork;
 }
 public RideFinishedConsumer(IOrderUnitOfWork unitOfWork,
                             IOrderService orderService)
 {
     _unitOfWork   = unitOfWork;
     _orderService = orderService;
 }
예제 #19
0
 public OrdersQueryHandler(IOrderUnitOfWork unitOfWork)
 {
     _unitOfWork = unitOfWork;
 }
예제 #20
0
 public OrderService(IOrderUnitOfWork unitOfWork, IMapper mapper, ILogger <OrderService> logger)
 {
     _unitOfWork = unitOfWork;
     _mapper     = mapper;
     _logger     = logger;
 }
예제 #21
0
 public AccountController(IOrderUnitOfWork orderUnitOfWork)
 {
     _orderUnitOfWork = orderUnitOfWork;
 }
예제 #22
0
 public OrderRepository(IOrderUnitOfWork unitOfWork) : base(unitOfWork)
 {
 }
예제 #23
0
 /// <summary>
 /// Constructor for OrderService.
 /// </summary>
 /// <param name="orderUnitOfWork"></param>
 /// <param name="orderProductUnitOfWork"></param>
 public OrderService(IOrderUnitOfWork <OrderEntity> orderUnitOfWork,
                     IOrderProductUnitOfWork <OrderProductEntity> orderProductUnitOfWork)
 {
     this._orderUnitOfWork        = orderUnitOfWork;
     this._orderProductUnitOfWork = orderProductUnitOfWork;
 }
 public OrderPaymentInvoiceQueryHandler(IOrderUnitOfWork unitOfWork)
 {
     _unitOfWork = unitOfWork;
 }
예제 #25
0
 public GridController(IOrderUnitOfWork work, IHostingEnvironment hostingEnvironment)
 {
     this.work           = work;
     _hostingEnvironment = hostingEnvironment;
 }
 public OrderCancelledConsumer(IOrderUnitOfWork unitOfWork)
 {
     _unitOfWork = unitOfWork;
 }
예제 #27
0
 private ViewManager(ILoginUnitOfWork loginUnitOfWork, IProductUnitOfWork productUnitOfWork, IOrderUnitOfWork orderUnitOfWork, IOrderProcessor processor)
 {
     PageViewModels.Add(new LoginViewModel(loginUnitOfWork));
     PageViewModels.Add(new MainViewModel(productUnitOfWork, orderUnitOfWork, loginUnitOfWork, processor));
     CurrentPageViewModel = PageViewModels[0];
 }
예제 #28
0
 public static OrdersObservableCollection GetInstance(IOrderUnitOfWork repository)
 {
     return(_instance ?? (_instance = new OrdersObservableCollection(repository)));
 }
예제 #29
0
 public OrdersViewModel(IOrderUnitOfWork repository, int row)
 {
     _orders       = OrdersObservableCollection.GetInstance(repository);
     Row           = row;
     _orderDetails = repository.OrderDetails.GetAll().ToList();
 }
예제 #30
0
 public CheckoutController(IOrderUnitOfWork orderUnitOfWork)
 {
     _orderUnitOfWork = orderUnitOfWork;
 }