Example #1
0
 public static void ServeFactoryOrder(FactoryOrder AIFactory)
 {
     if (onServeFactoryOrder != null)
     {
         onServeFactoryOrder(AIFactory);
     }
 }
        private void bbiSauvegarderFermer_ItemClick(object sender, ItemClickEventArgs e)
        {
            IsOrderLineModified = false;

            if (_newOrderLine)
            {
                OrderLine = FactoryOrder.CreateOrderLine(comboBoxStock.SelectedItem as Stock, comboBoxProduit.Text,
                                                         Convert.ToInt32(textEditQuantité.EditValue.ToString()));
                MessageBox.Show(Resources.succesAdd);
            }
            else
            {
                var orderLineModif = new OrderLine
                {
                    id       = OrderLineOut.Id,
                    Product  = comboBoxProduit.SelectedItem as Product,
                    Quantity = Convert.ToInt32(textEditQuantité.EditValue.ToString())
                };

                var repositoryOrder = new RepositoryOrder();
                repositoryOrder.Save(OrderLineOut.IdOrder, orderLineModif);
                MessageBox.Show(Resources.succesUpdate);
            }

            Close();
        }
Example #3
0
    void AIorder(FactoryOrder order)
    {
        if (order.ofactory == this.gameObject)
        {
            buildType miner   = unitSettings.miner1;
            buildType missile = unitSettings.missile1;
            buildType mGun    = unitSettings.mGun1;
            buildType utility = unitSettings.repair1;


            if (order.tLevel == 2)
            {
                miner   = unitSettings.miner2;
                missile = unitSettings.missile2;
                mGun    = unitSettings.mGun2;
                utility = unitSettings.repair2;
            }

            if (order.tLevel == 3)
            {
                miner   = unitSettings.miner3;
                missile = unitSettings.missile3;
                mGun    = unitSettings.mGun3;
                utility = unitSettings.repair3;
            }

            if (order.tLevel == 5)
            {
                miner   = unitSettings.minerX;
                missile = unitSettings.missileX;
                mGun    = unitSettings.mGunX;
                utility = unitSettings.repairX;
            }


            if (order.miner == 1)
            {
                AIOrder(miner);
            }
            if (order.missile == 1)
            {
                AIOrder(missile);
            }
            if (order.mgun == 1)
            {
                AIOrder(mGun);
            }
            if (order.utility == 1)
            {
                AIOrder(utility);
            }
        }
    }
        public EntityOrder GetByOrderID(string OrderID)
        {
            var data = base.DataContext.Orders.Where(p => p.OrderID == OrderID);

            if (data.Count() == 1)
            {
                return(FactoryOrder.Get(data.Single()));
            }
            else
            {
                return(null);
            }
        }
        public EntityOrder Get(int Id)
        {
            var data = base.DataContext.Orders.Where(p => p.PK_OrderID == Id);

            if (data.Count() == 1)
            {
                return(FactoryOrder.Get(data.Single()));
            }
            else
            {
                return(null);
            }
        }
        public EntityOrder GetByOrderID(string OrderID, DateTime OrderExecuteDate)
        {
            var data = base.DataContext.Orders.Where(p => p.OrderID == OrderID && DbFunctions.TruncateTime(p.OrderExecuteDate) == OrderExecuteDate);

            if (data.Count() == 1)
            {
                return(FactoryOrder.Get(data.Single()));
            }
            else
            {
                return(null);
            }
        }
Example #7
0
    void cycleOrder()
    {
        if (orderQueue.Count > 0 && myFactories.Count > 0)
        {
            FactoryOrder      currOrder          = orderQueue [0];
            List <GameObject> CandidateFactories = new List <GameObject> ();

            foreach (GameObject factory in myFactories)
            {
                if (factory.GetComponent <factoryManager> ().techLevel >= currOrder.tLevel)
                {
                    CandidateFactories.Add(factory);
                }
            }
            if (CandidateFactories.Count == 0)
            {
                Debug.Log("Player " + playerID + ": no factories with required Tech level");
                orderQueue.RemoveAt(0);
                orderQueue.Add(currOrder);
                return;
            }
            else
            {
                int F = Random.Range(0, CandidateFactories.Count);
                currOrder.ofactory = CandidateFactories [F];
                eventManager.ServeFactoryOrder(currOrder);
                orderQueue.RemoveAt(0);
                Debug.Log("Factory Order Served");
            }
        }



        // currOrder = orderQueue[0]

        // if cash is enough

        // submit order to factory

        //else move to end of list.
    }
Example #8
0
    void onFactoryOrder(FactoryOrder order)
    {
        int i = 0;

        while (i < order.miner)
        {
            FactoryOrder unitOrder = new FactoryOrder(playerID, order.tLevel, 1, 0, 0, 0);
            orderQueue.Add(unitOrder);
            i++;
        }

        i = 0;

        while (i < order.mgun)
        {
            FactoryOrder unitOrder = new FactoryOrder(playerID, order.tLevel, 0, 1, 0, 0);
            orderQueue.Add(unitOrder);
            i++;
        }

        i = 0;

        while (i < order.missile)
        {
            FactoryOrder unitOrder = new FactoryOrder(playerID, order.tLevel, 0, 0, 1, 0);
            orderQueue.Add(unitOrder);
            i++;
        }

        i = 0;

        while (i < order.utility)
        {
            FactoryOrder unitOrder = new FactoryOrder(playerID, order.tLevel, 0, 0, 0, 1);
            orderQueue.Add(unitOrder);
            i++;
        }
    }
        private void FrmEditOrderLine_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (IsOrderLineModified)
            {
                DialogResult result = XtraMessageBox.Show(this, TagResources.SaveBeforeClose, Application.ProductName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
                if (result == DialogResult.Yes)
                {
                    if (_newOrderLine)
                    {
                        OrderLine = FactoryOrder.CreateOrderLine(comboBoxStock.SelectedItem as Stock, comboBoxProduit.Text,
                                                                 Convert.ToInt32(textEditQuantité.EditValue.ToString()));
                        MessageBox.Show(Resources.succesAdd);
                    }
                    else
                    {
                        var orderLineModif = new OrderLine
                        {
                            id       = OrderLineOut.Id,
                            Product  = comboBoxProduit.SelectedItem as Product,
                            Quantity = Convert.ToInt32(textEditQuantité.EditValue.ToString())
                        };

                        var repositoryOrder = new RepositoryOrder();
                        repositoryOrder.Save(OrderLineOut.IdOrder, orderLineModif);
                        MessageBox.Show(Resources.succesUpdate);
                    }

                    IsOrderLineModified = false;
                }

                if (result == DialogResult.Cancel)
                {
                    e.Cancel = true;
                }
            }
        }
 public List <EntityOrder> GetByEmployee(int EmployeeID, DateTime fhExecute)
 {
     return(FactoryOrder.GetList(base.DataContext.Orders.Where(p => p.FK_EmployeeID == EmployeeID && DbFunctions.TruncateTime(p.OrderExecuteDate) == fhExecute).ToList()));
 }
 public List <EntityOrder> GetAll(List <int> EmployeeID, DateTime fhExecute, bool PreODS)
 {
     return(FactoryOrder.GetList(base.DataContext.Orders.Where(p => EmployeeID.Contains(p.FK_EmployeeID.Value) && DbFunctions.TruncateTime(p.OrderExecuteDate) == fhExecute && p.PreOrder == PreODS).ToList()));
 }
 public List <EntityOrder> GetByRange(DateTime Inicio, DateTime Fin)
 {
     return(FactoryOrder.GetList(base.DataContext.Orders.Where(p => DbFunctions.TruncateTime(p.OrderExecuteDate) >= Inicio && DbFunctions.TruncateTime(p.OrderExecuteDate) <= Fin).ToList()));
 }
 public List <EntityOrder> GetAll()
 {
     return(FactoryOrder.GetList(base.DataContext.Orders.ToList()));
 }
 public List <EntityOrder> GetAll(string SendCRM, DateTime syncDate)
 {
     return(FactoryOrder.GetList(base.DataContext.Orders.Where(p => p.SendCRM == SendCRM & p.FK_StatusSchemeID != 44 & p.OrderExecuteDate >= syncDate).ToList()));
 }
 public List <EntityOrder> GetActives()
 {
     return(FactoryOrder.GetList(base.DataContext.Orders.Where(p => p.Status == true).ToList()));
 }
Example #16
0
 public string  ProcessOrder(string orderType)
 {
     orderObj = FactoryOrder.GetOrder(orderType);
     return(orderObj.processOrder());
 }
Example #17
0
    void actionList()
    {
        if (orderQueue.Count != 0)
        {
            reCacheUnits(5);

            Order             currOrder    = orderQueue [0];
            missionLoadout    loadout      = new missionLoadout(0, 0, 0, 0, 0);
            List <GameObject> missionUnits = new List <GameObject> ();

            int factory_mgun    = 0;
            int factory_missile = 0;
            int factory_utility = 0;
            int factory_miner   = 0;

            if (currOrder._type == Order.Type.Recon)
            {
                Debug.Log("Set Recon Loadout");
                loadout = reconLoadout;
            }
            if (currOrder._type == Order.Type.Mine)
            {
                loadout = miningLoadout;
            }
            if (currOrder._type == Order.Type.Build)
            {
                Debug.Log("Set build Loadout");
                loadout = buildingLoadout;
            }
            if (currOrder._type == Order.Type.Patrol)
            {
                loadout = patrolLoadout;
            }
            if (currOrder._type == Order.Type.Attack)
            {
                loadout = new missionLoadout(0, 3, 3, 0, 1);
            }

            //Check Mgun Amount

            if (idle_mGuns.Count >= loadout.mGun)
            {
                int i = 0;
                while (i < loadout.mGun)
                {
                    missionUnits.Add(idle_mGuns [i]);
                    Debug.Log("Added mGun Units");
                    i++;
                }
            }

            else
            {
                Debug.Log("Not enough MGuns");
                factory_mgun = (loadout.mGun - idle_mGuns.Count);
            }


            //Check Miner Amount

            if (idle_miners.Count >= loadout.miners)
            {
                int i = 0;
                while (i < loadout.miners)
                {
                    missionUnits.Add(idle_miners [i]);
                    i++;
                }
            }
            else
            {
                factory_miner = (loadout.miners - idle_miners.Count);
            }


            //Check Missile Amount

            if (idle_missiles.Count >= loadout.missiles)
            {
                int i = 0;
                while (i < loadout.missiles)
                {
                    missionUnits.Add(idle_missiles [i]);
                    i++;
                }
            }
            else
            {
                factory_missile = (loadout.missiles - idle_missiles.Count);
            }


            //Check Utility Amount

            if (idle_utilities.Count >= loadout.utilities)
            {
                int i = 0;
                while (i < loadout.utilities)
                {
                    missionUnits.Add(idle_utilities [i]);
                    Debug.Log("Added Units");
                    i++;
                }
            }
            else
            {
                factory_utility = (loadout.utilities - idle_utilities.Count);
                Debug.Log("added units to factory order");
            }



            if ((factory_mgun + factory_miner + factory_missile + factory_utility) < 1)
            {
                GameObject[] units = missionUnits.ToArray();
                foreach (GameObject unit in units)
                {
                    eventManager.SelectEvent(unit, playerID);
                }
                currSelect = units;
                serveOrder(currOrder, units);
                orderQueue.RemoveAt(0);
                Debug.Log("ORDER: " + currOrder._type + " order served to " + missionUnits.Count + " units.");
                reCacheUnits(5);
                return;
            }
            else
            {
                Debug.Log("not enough units");

                if (currOrder.onHold == true)
                {
                    orderQueue.RemoveAt(0);
                    orderQueue.Add(currOrder);
                    return;
                }

                currOrder.onHold = true;

                FactoryOrder factoryReq = new FactoryOrder(playerID, command.techLevel, factory_miner, factory_mgun, factory_missile, factory_utility);

                eventManager.AIFactoryOrder(factoryReq);

                orderQueue.RemoveAt(0);
                orderQueue.Add(currOrder);
                return;
            }
        }
    }
        public void Write(int numCommande, Client client, DateTime dateLivraison, string adresseLivraison, Priorite priorite, GestionCommande etat, bool livraisonSurPlace, DateTime dateCommande, IEnumerable <OrderLine> orderLine)
        {
            var order = FactoryOrder.CreateOrder(numCommande, client, orderLine, adresseLivraison, livraisonSurPlace, priorite, etat, dateLivraison, dateCommande);

            _repositoryOrder.Save(order);
        }