コード例 #1
0
        /// <summary>
        /// Executes an order.
        /// </summary>
        /// <param name="order">The order to execute.</param>
        private void ExecuteOrder(Order order)
        {
            var appSvc = new ApplicationServices();
            Type teamAppSvcType = appSvc.GetType();
            MethodInfo theMethod = teamAppSvcType.GetMethod(order.OrderType.OrderTypeValue.ToString());

            theMethod.Invoke(appSvc, new object[] { order.Parameters });
        }
コード例 #2
0
ファイル: OrderingServices.cs プロジェクト: masuar/BRIATORES
        /// <summary>
        /// Drops an order.
        /// </summary>
        /// <param name="order">The order to drop.</param>
        public void DropOrder(Order order)
        {
            var orderRepo = this.container.Resolve<IOrderRepository>();
            var uow = this.container.Resolve<IUnitOfWork>();

            orderRepo.Delete(order);
            uow.Commit();
        }
コード例 #3
0
        /// <summary>
        /// Updates an order.
        /// </summary>
        /// <param name="order">The order to update.</param>
        public void UpdateOrder(Order order)
        {
            OrderingServices orderingSvc = new OrderingServices();
            int lastingHours = order.OrderType.TimeToProcess - Convert.ToInt32((DateTime.Now - order.DateTime).TotalMinutes);

            if (lastingHours <= 0)
            {
                // Execute order & drop it
                this.ExecuteOrder(order);
                orderingSvc.DropOrder(order);
            }
            else
            {
                orderingSvc.UpdateLastingHours(order, lastingHours);
            }
        }
コード例 #4
0
ファイル: OrderingServices.cs プロジェクト: masuar/BRIATORES
        /// <summary>
        /// Places a team order.
        /// </summary>
        /// <param name="theTeam">The team which made the order.</param>
        /// <param name="orderTypeValue">The order type.</param>
        /// <param name="parameters">The parameters of the order.</param>
        public void PlaceTeamOrder(Team theTeam, EOrderType orderTypeValue, string parameters)
        {
            var orderTypeRepo = this.container.Resolve<IOrderTypeRepository>();
            OrderType orderType = orderTypeRepo.GetByOrderTypeValue(orderTypeValue);

            var uow = this.container.Resolve<IUnitOfWork>();
            Order order = new Order()
            {
                Team = theTeam,
                OrderType = orderType,
                Parameters = parameters,
                DateTime = DateTime.Now,
                CountdownToProcess = orderType.TimeToProcess
            };

            orderRepo.Save(order);
            uow.Commit();
        }
コード例 #5
0
ファイル: OrderingServices.cs プロジェクト: masuar/BRIATORES
        /// <summary>
        /// Updates the order lasting hours.
        /// </summary>
        /// <param name="order">The order to update.</param>
        /// <param name="lastingHours">The lasting hours.</param>
        public void UpdateLastingHours(Order order, int lastingHours)
        {
            var orderRepo = this.container.Resolve<IOrderRepository>();
            var uow = this.container.Resolve<IUnitOfWork>();

            order.CountdownToProcess = lastingHours;
            orderRepo.Update(order);
            uow.Commit();
        }