コード例 #1
0
ファイル: FireDriverCommand.cs プロジェクト: masuar/BRIATORES
        public void Execute(object parameter)
        {
            Vehicle theCar = parameter as Vehicle;
            OrderingAppServices tCmdr = new OrderingAppServices();
            tCmdr.PlaceTeamOrder(theCar.Team, EOrderType.FireDriver, theCar.Id.ToString());

            if (this.CommandExecutedSuccessfully != null)
                CommandExecutedSuccessfully(this, new EventArgs());
        }
コード例 #2
0
ファイル: BuildPartCommand.cs プロジェクト: masuar/BRIATORES
        public void Execute(object parameter)
        {
            PartDesign theDesign = parameter as PartDesign;
            OrderingAppServices tCmdr = new OrderingAppServices();
            string parameters = string.Concat(theDesign.Id.ToString());
            tCmdr.PlaceTeamOrder(theDesign.Owner, EOrderType.BuildPartFromDesign, parameters);

            if (this.CommandExecutedSuccessfully != null)
                CommandExecutedSuccessfully(this, new EventArgs());
        }
コード例 #3
0
        public void Execute(object parameter)
        {
            Part thePart = parameter as Part;

            OrderingAppServices tCmdr = new OrderingAppServices();
            tCmdr.PlaceTeamOrder(thePart.Owner, EOrderType.UnmountPart, thePart.Id.ToString());

            if (this.CommandExecutedSuccessfully != null)
                CommandExecutedSuccessfully(this, new EventArgs());
        }
コード例 #4
0
ファイル: MountPartCommand.cs プロジェクト: masuar/BRIATORES
        public void Execute(object parameter)
        {
            Vehicle theCar = parameter as Vehicle;
            MountPartDialog dlg = new MountPartDialog(theCar.Team);
            dlg.ShowDialog();
            if (dlg.DialogResult == true)
            {
                OrderingAppServices tCmdr = new OrderingAppServices();
                string parameters = string.Concat(((Part)dlg.cmbParts.SelectedItem).Id.ToString(), "|", theCar.Id.ToString());
                tCmdr.PlaceTeamOrder(theCar.Team, EOrderType.MountPart, parameters);

                if (this.CommandExecutedSuccessfully != null)
                    CommandExecutedSuccessfully(this, new EventArgs());
            }
        }
コード例 #5
0
ファイル: BuyDesignCommand.cs プロジェクト: masuar/BRIATORES
        public void Execute(object parameter)
        {
            Team theTeam = parameter as Team;
            BuyDesignDialog dlg = new BuyDesignDialog();
            dlg.ShowDialog();
            if (dlg.DialogResult == true)
            {
                OrderingAppServices tCmdr = new OrderingAppServices();
                string parameters = string.Concat(theTeam.Id.ToString(), "|", ((PartDesign)dlg.cmbDesigns.SelectedItem).Id.ToString());
                tCmdr.PlaceTeamOrder(theTeam, EOrderType.BuyDesign, parameters);

                if (this.CommandExecutedSuccessfully != null)
                    CommandExecutedSuccessfully(this, new EventArgs());
            }
        }
コード例 #6
0
ファイル: HireDriverCommand.cs プロジェクト: masuar/BRIATORES
        public void Execute(object parameter)
        {
            Vehicle theCar = parameter as Vehicle;
            Driver notThisOne = theCar.Team.Vehicles.SingleOrDefault(x => x.Id != theCar.Id).Driver;

            HireDriverDialog dlg = new HireDriverDialog(notThisOne);
            dlg.ShowDialog();
            if (dlg.DialogResult == true)
            {
                OrderingAppServices tCmdr = new OrderingAppServices();
                string parameters = string.Concat(((Driver)dlg.cmbDrivers.SelectedItem).Id.ToString(), "|", theCar.Id.ToString());
                tCmdr.PlaceTeamOrder(theCar.Team, EOrderType.HireDriver, parameters);

                if (this.CommandExecutedSuccessfully != null)
                    CommandExecutedSuccessfully(this, new EventArgs());
            }
        }
コード例 #7
0
ファイル: OrdersJob.cs プロジェクト: masuar/BRIATORES
        /// <summary>
        /// Executes the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        public void Execute(JobExecutionContext context)
        {
            OrderingAppServices orderSvc = new OrderingAppServices();
            var orders = orderSvc.GetAllOrders();
            DateTime now = DateTime.Now;
            bool processed = false;
            foreach (var order in orders)
            {
                int oldValue = order.CountdownToProcess;
                orderSvc.UpdateOrder(order);
                Console.WriteLine("{0}: Order {1} updated. Previous minutes: {2} Lasting minutes: {3}", now.ToString(), order.Id.ToString(), oldValue.ToString(), order.CountdownToProcess.ToString());
                processed = true;
            }

            if (!processed)
            {
                Console.WriteLine("{0}: Nothing to process.");
            }
        }