Ejemplo n.º 1
0
        public void CreateBasketWithValidOrders()
        {
            using (var storage = NewApplicationStorage())
            {
                var item1 = new Item {
                    Name = "Gibson SG", Price = 345.56f
                };
                item1 = storage.CreateLineItem(item1);
                var item2 = new Item {
                    Name = "Peavey ValveKing", Price = 220.3f
                };
                item2 = storage.CreateLineItem(item2);
                var item3 = new Item {
                    Name = "Big Muff Pi", Price = 20f
                };
                item3 = storage.CreateLineItem(item3);

                var order1 = new ItemOrder {
                    Item = item1, Amount = 1
                };
                var order2 = new ItemOrder {
                    Item = item2, Amount = 2
                };
                var basket = new Basket {
                    Owner = "me", Orders = { order1, order2 }
                };
                basket = storage.CreateBasket(basket);
                Assert.NotNull(basket);

                Assert.Equal("me", basket.Owner);
                Assert.Equal(2, basket.Orders.Count);
                Assert.Contains(order1, basket.Orders);
                Assert.Contains(order2, basket.Orders);
            }
        }
        //商品管理
        public IActionResult ItemManage(int page = 1, int pageSize = 10, string keyWord = "", int category_ID = 0, ItemOrder itemOrder = ItemOrder.none)
        {
            //判断用户权限
            int  userId  = Convert.ToInt32(HttpContext.Session.GetInt32("id"));
            bool isadmin = Convert.ToBoolean(HttpContext.Session.GetString("admin"));

            if (userId != 0 && isadmin)
            {
                //获取所有商品列表
                //页数必须大于0
                page = (page < 1) ? 1 : page;
                //获取商品类别
                List <Category> categories = ItemManager.GetCategoryList();
                ViewData["categories"] = categories;
                //获取商品
                int         totalPages = 0;
                List <Item> items      = ItemManager.GetItemList(out totalPages, page - 1, pageSize, keyWord, category_ID, itemOrder);
                ViewData["items"] = items;
                ViewData["pages"] = totalPages;
                //url参数
                ViewData["page"]        = page;
                ViewData["pageSize"]    = pageSize;
                ViewData["keyWord"]     = keyWord;
                ViewData["category_ID"] = category_ID;
                ViewData["itemOrder"]   = itemOrder;

                return(View());
            }
            else
            {
                //重定向至首页
                HttpContext.Session.SetString("tip", "无访问权限");
                return(RedirectToAction("Index", "Home"));
            }
        }
Ejemplo n.º 3
0
        public async Task <UpDateQTDeResponse> UpdateQTD(ItemOrder itemOrder)
        {
            var itemorderDB = await itemOrderRespository.GetItemOrder(itemOrder.Id);


            if (itemorderDB != null)
            {
                itemorderDB.UpDateQTDe(itemOrder.Quantity);

                if (itemOrder.Quantity == 0)
                {
                    await itemOrderRespository.RemoveItemOrder(itemOrder.Id);
                }

                await context.SaveChangesAsync();

                var order = await GetOrder();

                var chartViewModel = new ChartViewModel(order.Itens);

                return(new UpDateQTDeResponse(itemorderDB, chartViewModel));
            }

            throw new ArgumentException("ItemOrder not found!");
        }
Ejemplo n.º 4
0
        public void ClearBasket()
        {
            using (var storage = NewApplicationStorage())
            {
                var item1 = new Item {
                    Name = "Gibson SG", Price = 345.56f
                };
                item1 = storage.CreateLineItem(item1);
                var item2 = new Item {
                    Name = "Peavey ValveKing", Price = 220.3f
                };
                item2 = storage.CreateLineItem(item2);
                var item3 = new Item {
                    Name = "Big Muff Pi", Price = 20f
                };
                item3 = storage.CreateLineItem(item3);

                var order1 = new ItemOrder {
                    Item = item1, Amount = 1
                };
                var order2 = new ItemOrder {
                    Item = item2, Amount = 2
                };
                var basket = new Basket {
                    Owner = "me", Orders = { order1, order2 }
                };
                basket = storage.CreateBasket(basket);
                Assert.NotNull(basket);
                Assert.True(storage.ClearBasket(basket.Id));
                Assert.False(storage.ClearBasket(334));
                basket = storage.GetBasket(basket.Id);
                Assert.NotNull(basket);
                Assert.Empty(basket.Orders);
            }
        }
Ejemplo n.º 5
0
    public WalkerSave(GameObject go) : base(go)
    {
        Walker w = go.GetComponent <Walker>();

        //save origin and destination as coordinates
        Structure o = w.Origin;

        if (o != null)
        {
            origin = new Node(o.X, o.Y);
        }
        Structure d = w.Destination;

        if (d != null)
        {
            destination = new Node(d.X, d.Y);
        }

        prevx       = w.Prevx;
        prevy       = w.Prevy;
        laborPoints = w.LaborPoints;

        movementDistance = w.MovementDistance;

        stuck         = w.Stuck;
        returningHome = w.ReturningHome;

        direction = new Node3d(w.Direction);
        order     = w.Order;

        path         = w.Path;
        visitedSpots = w.VisitedSpots;
    }
Ejemplo n.º 6
0
        public void AddSaleOrder(ItemOrder order)
        {
            var isFirstOrder = !HasPurchaseOrders && !HasSaleOrders;

            this.Log($"CartAgent got {(isFirstOrder ? "first " : "")}sale order for {order.Amount} {order.Item}");

            var targetExchange = Locator.Market.GetExchange(order.Item);

            if (!targetExchange)
            {
                this.Log($"Cart {Cart.name} cannot fullfill sale order for {order.Amount} {order.Item}: Market {Locator.Market} does not have a matching exchange", LogType.Error);
                return;
            }

            SaleOrders.Enqueue(order);
            SaleOrderPlaced?.Invoke(this, new ItemOrderEventArgs(order));

            if (isFirstOrder &&
                State == CartState.Idle &&
                Entity.Location == Cart.Company.Location &&
                FulfillableSaleOrder != null)
            {
                this.Log($"CartAgent will fulfill the placed sale order");
                ChangeState(CartState.Market);
            }
            else if (FulfillableSaleOrder == null)
            {
                Cart.Company.Production.Registry.RecipeFinished += OnRecipeFinished;
            }
        }
Ejemplo n.º 7
0
        public void AddPurchaseOrder(ItemOrder order)
        {
            var isFirstOrder = !HasPurchaseOrders && !HasSaleOrders;

            this.Log($"CartAgent got {(isFirstOrder ? "first " : "")}purchase order for {order.Amount} {order.Item}");

            var targetExchange = Locator.Market.GetExchange(order.Item);

            if (!targetExchange)
            {
                this.Log(
                    $"Cart {Cart.name} cannot fullfill order {order}: Market {Locator.Market} does not have a matching exchange",
                    LogType.Error);
                return;
            }

            PurchaseOrders.Enqueue(order);
            PurchaseOrderPlaced?.Invoke(this, new ItemOrderEventArgs(order));

            if (isFirstOrder && State == CartState.Idle && Entity.Location == Cart.Company.Location)
            {
                this.Log($"CartAgent will fulfill the placed purchase order");
                ChangeState(CartState.Market);
            }
        }
Ejemplo n.º 8
0
    public virtual void ExportProduct()
    {
        ItemOrder io = new ItemOrder(stockpile, product);

        //try to send carryer to other generator first; then try to storage
        if (DontSendItemsToGenerators)
        {
            SpawnGiverToStorage(io);
        }
        else if (SpawnGiverToGenerator(io) == null)
        {
            SpawnGiverToStorage(io);
        }

        if (!ActiveSmartWalker)
        {
            return;
        }
        Producing     = false;
        AmountStored -= stockpile;
        if (!string.IsNullOrEmpty(byproduct))
        {
            ByproductsMade += ByproductsStored;
        }

        //only deteriorate machinery once this production cycle is finished
        Deteriorate();
    }
Ejemplo n.º 9
0
        public void Save(OrderRequest orderRequest)
        {
            var user     = _userService.Get(orderRequest.IdUser);
            var products = _productService.Get(orderRequest.IdsProducts);

            var     order      = new Order();
            var     items      = new List <ItemOrder>();
            decimal totalPrice = 0;

            foreach (Product product in products)
            {
                var item = new ItemOrder();
                item.ProductId = product.Id;
                item.Price     = product.Price;
                item.Quantity  = orderRequest.IdsProducts.Where(x => x == product.Id).Count();
                totalPrice    += (item.Price * item.Quantity);
                items.Add(item);
            }

            order.Items  = items;
            order.Price  = totalPrice;
            order.UserId = user.Id;

            _orderRepository.Insert(order);
            _orderRepository.Save();
        }
Ejemplo n.º 10
0
        public void AddToListbox(string Size, string Amount, int index)//Productname, Priceproduct, Size, Amount
        {
            Product     product   = new Product();
            ItemOrder   itemorder = new ItemOrder();
            DetailOrder detail    = new DetailOrder();

            product.Find((index + 1).ToString());
            //thành tiền sản phẩm
            int totalprice = int.Parse(product.Price) * int.Parse(Amount);

            itemorder.PriceTotal  = totalprice.ToString();
            itemorder.Quantity    = Amount;
            itemorder.Image       = product.Image;
            itemorder.ProductName = product.ProductName;
            itemorder.IdProduct   = (index + 1).ToString();
            itemorder.Size        = Size;
            detail.ListProduct.Add(itemorder);
            sum += totalprice;

            //binding
            OrderedList.Insert(0, detail.ListProduct);
            listOrder.Add(itemorder);

            //binding tổng tiền
            TotalPriceProductsTextblock = sum.ToString();

            //gán để binding xóa item trong listbox
            DetailListbox.ListProduct.Insert(0, itemorder);
        }
Ejemplo n.º 11
0
 void SetProduct()
 {
     if (item != null && amountProduced > 0)
     {
         Product = new ItemOrder(amountProduced, item);
     }
 }
Ejemplo n.º 12
0
        public async Task <IActionResult> Edit(int id, [Bind("OrderId,Item,Quantity,Price,OrderType,CurrentStatus,OrderMessage,Table,Message")] ItemOrder itemOrder)
        {
            if (id != itemOrder.OrderId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(itemOrder);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ItemOrderExists(itemOrder.OrderId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Item"]      = new SelectList(_context.Item, "ItemId", "ItemName", itemOrder.Item);
            ViewData["OrderType"] = new SelectList(_context.OrderType, "TypeId", "OrderType1", itemOrder.OrderType);
            return(View(itemOrder));
        }
Ejemplo n.º 13
0
        public void OrdereIsCreatedWithDefaultValues()
        {
            var order = new ItemOrder();

            Assert.IsTrue(order.IsTaxInclusive);
            Assert.AreEqual(DocumentAction.Print, order.DeliveryStatus);
        }
Ejemplo n.º 14
0
        public async Task <ActionResult <List <Order> > > CreateNewOrder(Order order, int itemId)
        {
            var itemInStock = db.Items.FirstOrDefault(i => i.Id == itemId);

            if (itemInStock.NumberInStock < 1)
            {
                return(Ok(new { message = "That item is not in stock" }));
            }
            else
            {
                await db.Orders.AddAsync(order);

                await db.SaveChangesAsync();

                var orderId   = order.Id;
                var itemOrder = new ItemOrder
                {
                    OrderId = orderId,
                    ItemId  = itemId
                };
                await db.ItemOrders.AddAsync(itemOrder);

                await db.SaveChangesAsync();

                order.ItemOrders = null;
                return(Ok(order));
            }
        }
        private ItemOrder MapItemOrder(DbDataReader dr)
        {
            ItemOrder itemOrder = new ItemOrder();

            itemOrder.OrderId     = NullHandler.GetString(dr["OrderId"]);
            itemOrder.SrId        = NullHandler.GetString(dr["SrId"]);
            itemOrder.MarketId    = NullHandler.GetString(dr["MarketId"]);
            itemOrder.OrderDate   = NullHandler.GetDateTime(dr["Date"]);
            itemOrder.OrderCount  = NullHandler.GetInt32(dr["OrderCount"]);
            itemOrder.ReturnCount = NullHandler.GetInt32(dr["ReturnCount"]);
            itemOrder.DamageCount = NullHandler.GetInt32(dr["DamagedCount"]);
            itemOrder.SellsCount  = NullHandler.GetInt32(dr["SoldCount"]);


            itemOrder.CompanyId   = NullHandler.GetString(dr["CompanyId"]);
            itemOrder.ItemId      = NullHandler.GetString(dr["ItemId"]);
            itemOrder.ItemName    = NullHandler.GetString(dr["ItemName"]);
            itemOrder.CountPerBox = NullHandler.GetInt32(dr["CountPerBox"]);
            itemOrder.Price       = NullHandler.GetDouble(dr["Price"]);
            itemOrder.TotalPrice  = Math.Round(itemOrder.Price * itemOrder.SellsCount, 2);

            itemOrder.StockId                  = NullHandler.GetString(dr["StockId"]);
            itemOrder.CurrentStockTotal        = NullHandler.GetInt32(dr["TotalStock"]);
            itemOrder.CurrentDamagedStockTotal = NullHandler.GetInt32(dr["DamagedStock"]);
            itemOrder.ChalanNo                 = NullHandler.GetString(dr["ChalanNo"]);
            itemOrder.StockEntryDate           = NullHandler.GetDateTime(dr["StockEntryDate"]);

            itemOrder.CalculateBoxesFromTotalStock();
            itemOrder.CalculateOrdersInBox();

            return(itemOrder);
        }
Ejemplo n.º 16
0
    public override void VisitBuilding(int a, int b)
    {
        base.VisitBuilding(a, b);

        Distributer d = (Distributer)Origin;
        Generator   g = world.Map.GetBuildingAt(a, b).GetComponent <Generator>();

        if (g == null)
        {
            return;
        }

        if (g.MachineryResource.ToString() != d.item)
        {
            return;
        }

        int needed = g.RepairsNeeded;

        if (d.AmountStored < needed)
        {
            needed = (int)d.AmountStored;
        }

        ItemOrder io = new ItemOrder(needed, d.item);

        if (g.MachineryResource != (ResourceType)io.item)
        {
            return;
        }

        g.MaintainFactory(io);
        d.AmountStored -= needed;
    }
Ejemplo n.º 17
0
        public void SaveOrder()
        {
            List <ItemOrder> list  = GetOrders();
            Login            login = GetLoginInProperties();

            if (login != null)
            {
                List <ItemPanier> listItemPanier = GetPizzaInPanier();
                ItemOrder         it             = new ItemOrder();
                it.Pizzas    = "";
                it.Price     = 0;
                it.OrderDate = DateTime.Now;
                foreach (var itPanier in listItemPanier)
                {
                    it.Pizzas = it.Pizzas + " - " + itPanier.Pizza.name;
                    it.Price += itPanier.Pizza.price;
                }
                list.Add(it);
                string valueJsonPanier = JsonConvert.SerializeObject(new List <ItemPanier>());

                Application.Current.Properties[login.login] = valueJsonPanier;
            }

            string key       = login.login;
            string valueJson = JsonConvert.SerializeObject(list);

            Application.Current.Properties[key] = valueJson;
            Application.Current.SavePropertiesAsync();
        }
        // GET: OrderMasters/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OrderMaster orderMaster = db.OrderMaster.Find(id);

            if (orderMaster == null)
            {
                return(HttpNotFound());
            }
            DeliveryView deliveryView = new DeliveryView();

            deliveryView.orderMaster  = orderMaster;
            deliveryView.orderDetails = new List <ItemOrder>();
            List <OrderDetail> details = db.Order_Detail.Where(e => e.OrderMasterID == id).ToList();

            foreach (OrderDetail orderDetail in details)
            {
                var itemOrder = new ItemOrder
                {
                    detailId         = orderDetail.Id,
                    NameItem         = orderDetail.Items.NameItem,
                    Price            = orderDetail.Items.Price,
                    quantity         = Convert.ToInt32(orderDetail.quantity),
                    deliveryQuantity = orderDetail.deliveryQuantity
                };
                deliveryView.orderDetails.Add(itemOrder);
            }
            return(View(deliveryView));
        }
Ejemplo n.º 19
0
        public void BasketPrice()
        {
            using (var storage = NewApplicationStorage())
            {
                var item1 = new Item {
                    Name = "Gibson SG", Price = 345.56f
                };
                item1 = storage.CreateLineItem(item1);
                var item2 = new Item {
                    Name = "Peavey ValveKing", Price = 220.3f
                };
                item2 = storage.CreateLineItem(item2);
                var item3 = new Item {
                    Name = "Big Muff Pi", Price = 20f
                };
                item3 = storage.CreateLineItem(item3);
                var order1 = new ItemOrder {
                    Item = item1, Amount = 3
                };
                var order2 = new ItemOrder {
                    Item = item2, Amount = 2
                };
                var basket1 = new Basket {
                    Owner = "me", Orders = { order1, order2 }
                };
                basket1 = storage.CreateBasket(basket1);
                var basket2 = new Basket {
                    Owner = "vasco"
                };
                basket2 = storage.CreateBasket(basket2);

                Assert.Equal(0f, basket2.GetPrice(), 2);
                Assert.Equal((item1.Price * order1.Amount) + (item2.Price * order2.Amount), basket1.GetPrice(), 2);
            }
        }
Ejemplo n.º 20
0
        public async Task AddItem(string code)
        {
            var product = await context.Set <Product>()
                          .Where(p => p.Code == code)
                          .SingleOrDefaultAsync();

            if (product == null)
            {
                throw new ArgumentException("Product is Not Found!");
            }

            var order = await GetOrder();

            var itemOrder = await context.Set <ItemOrder>()
                            .Where(i => i.Product.Code == code && i.Order.Id == order.Id)
                            .SingleOrDefaultAsync();

            if (itemOrder == null)
            {
                itemOrder = new ItemOrder(order, product, 1, product.Cost);
                await context.Set <ItemOrder>()
                .AddAsync(itemOrder);

                await context.SaveChangesAsync();
            }
        }
Ejemplo n.º 21
0
    public SimplePriorityQueue <Generator> FindGeneratorToAccept(ItemOrder io)
    {
        int    num  = io.amount;
        string item = io.GetItemName();

        GameObject[] objs = GameObject.FindGameObjectsWithTag("Generator");
        SimplePriorityQueue <Generator> queue = new SimplePriorityQueue <Generator>();

        if (objs.Length == 0)
        {
            return(queue);
        }


        foreach (GameObject go in objs)
        {
            Generator gen = go.GetComponent <Generator>();


            //if null, continue
            if (gen == null)
            {
                continue;
            }

            if (!gen.Operational)
            {
                continue;
            }

            int index = gen.IngredientIndex(item);

            //only add to list if it needs this ingredient
            if (index == -1)
            {
                continue;
            }

            //only add to list if it has an entrance
            List <Node> entrancesHere  = GetAdjRoadTiles();
            List <Node> entrancesThere = gen.GetAdjRoadTiles();
            if (entrancesHere.Count == 0 || entrancesThere.Count == 0)
            {
                continue;
            }

            //only add to list if it has none of this item
            if (gen.IngredientNeeded(index) <= 0)
            {
                continue;
            }

            float distance = entrancesHere[0].DistanceTo(entrancesThere[0]);

            queue.Enqueue(gen, distance);
        }

        return(queue);
    }
Ejemplo n.º 22
0
 public void OpenDeal(ItemOrder io)
 {
     if (ContainsDeal(io))
     {
         Debug.LogError(io + " is already open");
     }
     TradeOrders.Add(io);
 }
Ejemplo n.º 23
0
 public override void RemoveItem(ItemOrder io)
 {
     if (io.GetItemName() != item)
     {
         Debug.LogError(name + " removed " + io + " in error");
     }
     AmountStored -= io.amount;
 }
Ejemplo n.º 24
0
    public void CloseTrade(ItemOrder io)
    {
        if (CurrentCity == null)
        {
            return;
        }

        tradeController.TradeOrders.Remove(io);
    }
Ejemplo n.º 25
0
    public override void RemoveItem(ItemOrder io)
    {
        if (io.GetItemName() != product)
        {
            Debug.LogError(name + " can't remove " + io.GetItemName());
        }

        AmountStored -= io.amount;
    }
Ejemplo n.º 26
0
    public void Enqueue(ItemOrder io)
    {
        if (!CanAccept(io))
        {
            Debug.LogError("Enqueueing " + io + " without being able to accept");
        }

        queue += io.amount;
    }
Ejemplo n.º 27
0
    public SimplePriorityQueue <StorageBuilding> FindStorageBuildingToAccept(ItemOrder io)
    {
        int      num  = io.amount;
        int      item = io.item;
        ItemType type = io.type;

        GameObject[] objs = GameObject.FindGameObjectsWithTag("StorageBuilding");
        SimplePriorityQueue <StorageBuilding> queue = new SimplePriorityQueue <StorageBuilding>();

        if (objs.Length == 0)
        {
            return(queue);
        }


        foreach (GameObject go in objs)
        {
            StorageBuilding strg = go.GetComponent <StorageBuilding>();

            //if null, continue
            if (strg == null)
            {
                continue;
            }

            //only add to list if it stores this type
            if (strg.typeStored != type)
            {
                continue;
            }

            if (!strg.Operational)
            {
                continue;
            }

            //only add to list if it has an entrance
            List <Node> entrancesHere  = GetAdjRoadTiles();
            List <Node> entrancesThere = strg.GetAdjRoadTiles();
            if (entrancesHere.Count == 0 || entrancesThere.Count == 0)
            {
                continue;
            }

            //only add to list if it can accept amount
            if (!strg.CanAcceptAmount(num, item))
            {
                continue;
            }

            float distance = entrancesHere[0].DistanceTo(entrancesThere[0]);

            queue.Enqueue(strg, distance);
        }

        return(queue);
    }
Ejemplo n.º 28
0
    void CreateGoalList()
    {
        //add housing goal to level info
        if (scenario.HasHouseGoal)
        {
            GameObject go = Instantiate(uiDatabase.scenarioGoal);

            ScenarioGoal sg = go.GetComponent <ScenarioGoal>();
            sg.goalDesc.text = scenario.HousingGoalToString();
            sg.toggle.isOn   = scenario.HousingComplete;
            sg.transform.SetParent(gridThing.transform);
            sg.transform.localScale = new Vector3(1, 1, 1);
        }

        //add pop goal
        if (scenario.HasPopGoal)
        {
            GameObject go = Instantiate(uiDatabase.scenarioGoal);

            ScenarioGoal sg = go.GetComponent <ScenarioGoal>();
            sg.goalDesc.text = scenario.PopulationToString();
            sg.toggle.isOn   = scenario.PopulationComplete;
            sg.transform.SetParent(gridThing.transform);
            sg.transform.localScale = new Vector3(1, 1, 1);
        }

        //add prosperity goal
        if (scenario.HasProspGoal)
        {
            GameObject go = Instantiate(uiDatabase.scenarioGoal);

            ScenarioGoal sg = go.GetComponent <ScenarioGoal>();
            sg.goalDesc.text = scenario.ProsperityToString();
            sg.toggle.isOn   = scenario.ProsperityComplete;
            sg.transform.SetParent(gridThing.transform);
            sg.transform.localScale = new Vector3(1, 1, 1);
        }

        if (scenario.HasStorageGoals)
        {
            List <string> storageGoals = scenario.storageGoals;

            for (int i = 0; i < storageGoals.Count; i++)
            {
                ItemOrder io = new ItemOrder(storageGoals[i]);

                GameObject go = Instantiate(uiDatabase.scenarioGoal);

                ScenarioGoal sg = go.GetComponent <ScenarioGoal>();
                sg.goalDesc.text = scenario.StorageGoalToString(i);
                sg.toggle.isOn   = scenario.worldController.HasGood(io);
                sg.transform.SetParent(gridThing.transform);
                sg.transform.localScale = new Vector3(1, 1, 1);
            }
        }
    }
Ejemplo n.º 29
0
 public void Initialize()
 {
     File.Copy(FILE_PATH, TEST_FILE_PATH, true);
     _typeInfo   = new TypeInfo();
     _itemInfo   = new ItemInfo(_typeInfo, TEST_FILE_PATH);
     _itemOrder  = new ItemOrder(_itemInfo);
     _testTarget = new PrivateObject(_itemOrder);
     _itemInfo._stockChangeEvent    += this.EventTriggerTest;
     _itemInfo._itemDataUpdateEvent += this.EventTriggerTest;
 }
Ejemplo n.º 30
0
 public override void ReceiveItem(ItemOrder io)
 {
     for (int a = 0; a < ingredientMax.Length; a++)
     {
         if (ingredients[a] == io.GetItemName())
         {
             IngredientAmount[a] += io.amount;
         }
     }
 }
Ejemplo n.º 31
0
        public SelectItem(IEnumerable<LcarsDef> defs, RectangleF frame, float minWidth, float hgap, float vgap, ItemOrder align)
            : base(frame)
        {
            Defs = defs.ToArray ();
            Array.Sort (Defs, (a, b) => a.Caption.CompareTo (b.Caption));

            Align = align;

            if (minWidth > 1) {
                MinWidth = minWidth;
            } else {
                if (App.Inst.IsIPad) {
                    MinWidth = 160;
                } else {
                    MinWidth = 60;
                }
            }

            if (App.Inst.IsIPad) {
                ButtonHeight = 44;
            } else {
                ButtonHeight = 24;
            }

            if (vgap > 1) {
                ButtonVerticalGap = vgap;
            } else {
                ButtonVerticalGap = 0.3f * ButtonHeight;
            }

            if (hgap > 1) {
                ButtonHorizontalGap = hgap;
            } else {
                ButtonHorizontalGap = 20;
            }

            Initialize ();
        }
Ejemplo n.º 32
0
 public void AddItemOrder(ItemOrder order)
 {
     repo.Add(order);
     repo.SaveChanges();
 }
Ejemplo n.º 33
0
 public void RemoveItemOrder(ItemOrder order)
 {
     repo.Delete(order);
     repo.SaveChanges();
 }
Ejemplo n.º 34
0
    //private void __MoveShipsTo(ITarget target) {
    //    ItemOrder<ShipOrders> moveToOrder = new ItemOrder<ShipOrders>(ShipOrders.MoveTo, target, Speed);
    //    _fleet.Ships.ForAll(s => s.CurrentOrder = moveToOrder);
    //}

    private void __MoveShipsTo(ITarget target) {
        ItemOrder<ShipOrders> moveToOrder = new ItemOrder<ShipOrders>(ShipOrders.MoveTo, target, Speed);
        _fleet.Elements.ForAll(s => s.CurrentOrder = moveToOrder);
    }