Esempio n. 1
0
        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());
        }
Esempio n. 2
0
        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());
        }
Esempio n. 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());
        }
Esempio n. 4
0
        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());
            }
        }
Esempio n. 5
0
        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());
            }
        }
Esempio n. 6
0
        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());
            }
        }
Esempio n. 7
0
        /// <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.");
            }
        }