private void UpdateWarehouses() { var oldSelectedWarehouse = _selectedWarehouse; Warehouses.Clear(); var allWarehouse = new Warehouse { ID = -1, Name = "All" }; Warehouses.Add(new WarehouseVM { Model = allWarehouse }); using (var context = new ERPContext()) { var warehousesFromDatabase = context.Warehouses.OrderBy(warehouse => warehouse.Name); foreach (var warehouse in warehousesFromDatabase) { Warehouses.Add(new WarehouseVM { Model = warehouse }); } } UpdateSelectedWarehouse(oldSelectedWarehouse); }
private void OpenAddStorageDialog() { var dialog = dialogService.ShowDialog <AddStorageDialogWindow, AddStorageDialogViewModel>(); if (dialog.DialogResult == true) { Warehouses.Add(dialog.ResultInfo.CreatedWarehouse); } }
public void AddNewBuilding(Location l) { if (l.Building is Warehouse) { Warehouses.Add(l); } else if (l.Building is Shop) { Shops.Add(l); applyShopRadiusToCells(l); } }
private async void Add(object p) { var w = new Warehouse() { Available = true }; using var db = MyDbContext.Instance; db.Warehouses.Add(w); await db.SaveChangesAsync(); Warehouses.Add(w); }
public void UpdateWarehouses() { Warehouses.Clear(); using (var context = new ERPContext()) { var warehouses = context.Warehouses.OrderBy(warehouse => warehouse.Name); foreach (var warehouse in warehouses) { Warehouses.Add(new WarehouseVM { Model = warehouse }); } } }
public async void InitAsync() { Warehouses.Clear(); IEnumerable <Warehouse> allWarehouse = null; await Task.Run(() => { using var db = MyDbContext.Instance; allWarehouse = MyDbContext.Instance.Warehouses.AsEnumerable(); }); foreach (var i in allWarehouse) { if (i.Available) { Warehouses.Add(i); } } }
public void Initialize() { Nomenclature.Add(new Nomenclature("AMD")); Nomenclature.Add(new Nomenclature("INTEL")); Nomenclature.Add(new Nomenclature("NVIDIA")); Nomenclature.Add(new Nomenclature("KINGSTON")); Nomenclature.Add(new Nomenclature("CORSAIR")); Nomenclature.Add(new Nomenclature("WD")); Nomenclature.Add(new Nomenclature("SEAGATE")); Nomenclature.Add(new Nomenclature("SAMSUNG")); Nomenclature.Add(new Nomenclature("PHILIPS")); Nomenclature.Add(new Nomenclature("TYPE-A")); Nomenclature.Add(new Nomenclature("TYPE-B")); Nomenclature.Add(new Nomenclature("TYPE-C")); Warehouses.Add(new Warehouse("Main")); Warehouses.Add(new Warehouse("Additional")); Warehouses.Add(new Warehouse("Another")); }
public Block[,] GetMap() { Block[,] map = new Rails[8, 12]; // De map wordt vanaf links boven gemaakt // Bovenste rij for (int i = 0; i < 12; i++) { if (i == 9) { var w = new Wharf(RailType.HORIZONTAL); map[0, i] = w; Wharf = w; } else { if (i == 11) { map[0, i] = new Rails(RailType.BOTTOMLEFT); } else { map[0, i] = new Rails(RailType.HORIZONTAL); } } } //Rechts boven for (int i = 1; i < 4; i++) { if (i == 3) { map[i, 11] = new Rails(RailType.TOPLEFT); } else { map[i, 11] = new Rails(RailType.VERTICAL); } } map[3, 10] = new Rails(RailType.HORIZONTAL); var s1 = new Switch(RailType.TOPRIGHT, 3); map[3, 9] = s1; Switches.Add(s1); for (int i = 5; i < 10; i++) { if (i == 9) { map[2, i] = new Rails(RailType.BOTTOMLEFT); } else if (i == 5) { map[2, i] = new Rails(RailType.BOTTOMRIGHT); } else { map[2, i] = new Rails(RailType.HORIZONTAL); } } var s2 = new Switch(RailType.TOPLEFT, 2); map[3, 5] = s2; Switches.Add(s2); map[3, 4] = new Rails(RailType.HORIZONTAL); var s3 = new Switch(RailType.TOPRIGHT, 1); map[3, 3] = s3; Switches.Add(s3); for (int i = 1; i < 4; i++) { if (i == 3) { map[2, i] = new Rails(RailType.BOTTOMLEFT); } else { map[2, i] = new Rails(RailType.HORIZONTAL); } } for (int i = 1; i < 4; i++) { if (i == 3) { map[4, i] = new Rails(RailType.TOPLEFT); } else { map[4, i] = new Rails(RailType.HORIZONTAL); } } map[4, 5] = new Rails(RailType.TOPRIGHT); map[4, 6] = new Rails(RailType.BOTTOMLEFT); map[4, 8] = new Rails(RailType.BOTTOMRIGHT); map[4, 9] = new Rails(RailType.TOPLEFT); var s4 = new Switch(RailType.TOPRIGHT, 4); map[5, 6] = s4; Switches.Add(s4); map[5, 7] = new Rails(RailType.HORIZONTAL); var s5 = new Switch(RailType.TOPLEFT, 5); map[5, 8] = s5; Switches.Add(s5); for (int i = 1; i < 7; i++) { if (i == 6) { map[6, i] = new Rails(RailType.TOPLEFT); } else { map[6, i] = new Rails(RailType.HORIZONTAL); } } for (int i = 8; i < 12; i++) { if (i == 8) { map[6, i] = new Rails(RailType.TOPRIGHT); } else if (i == 11) { map[6, i] = new Rails(RailType.BOTTOMLEFT); } else { map[6, i] = new Rails(RailType.HORIZONTAL); } } for (int i = 1; i < 9; i++) { map[7, i] = new Parking(RailType.HORIZONTAL); } for (int i = 8; i < 12; i++) { if (i == 11) { map[7, i] = new Rails(RailType.TOPLEFT); } else { map[7, i] = new Rails(RailType.HORIZONTAL); } } // Warehouses var w1 = new Warehouse(RailType.HORIZONTAL, 'A'); var w2 = new Warehouse(RailType.HORIZONTAL, 'B'); var w3 = new Warehouse(RailType.HORIZONTAL, 'C'); Warehouses.Add(w1); Warehouses.Add(w2); Warehouses.Add(w3); map[2, 0] = w1; map[4, 0] = w2; map[6, 0] = w3; map = LinkMap(map); return(map); }
private void GenerateFields() { WaterField TempWaterField2 = null; FieldArray[0, 0] = new EndWaterField { Game = this }; for (int i = 1; i < 12; i++) { WaterField TempWaterField = new WaterField { Game = this }; FieldArray[i, 0] = TempWaterField; if (i == 9) { TempWaterField2 = TempWaterField; } if (i == 11) { TempWaterField.MoveAble = this.Ship; Ship.CurrentField = TempWaterField; ShipField = TempWaterField; } } FieldArray[0, 1] = new EndField(); for (int i = 1; i < 12; i++) { FieldArray[i, 1] = new Field(); if (i == 9) { Quay TempQuay = new Quay { Game = this }; FieldArray[i, 1] = TempQuay; TempWaterField2.LowerField = TempQuay; } } FieldArray[11, 2] = new Field(); Warehouse TempHouse = new Warehouse { Game = this }; FieldArray[0, 3] = TempHouse; Warehouses.Add(TempHouse); for (int i = 1; i < 12; i++) { if (i != 4 && i != 10) { FieldArray[i, 3] = new Field(); } } FieldArray[3, 5] = new Field(); FieldArray[4, 4] = new Field(); FieldArray[10, 4] = new Field(); FieldArray[11, 4] = new Field(); TempHouse = new Warehouse { Game = this }; FieldArray[0, 5] = TempHouse; Warehouses.Add(TempHouse); FieldArray[1, 5] = new Field(); FieldArray[2, 5] = new Field(); FieldArray[5, 5] = new Field(); FieldArray[9, 5] = new Field(); FieldArray[6, 6] = new Field(); FieldArray[8, 6] = new Field(); FieldArray[7, 7] = new Field(); TempHouse = new Warehouse { Game = this }; FieldArray[0, 8] = TempHouse; Warehouses.Add(TempHouse); for (int i = 1; i < 12; i++) { if (i != 7) { FieldArray[i, 8] = new Field(); } } FieldArray[1, 9] = new ManeuveringField(); FieldArray[0, 9] = new EndManeuveringField(); for (int i = 2; i < 12; i++) { FieldArray[i, 9] = new ManeuveringField(); if (i == 9 || i == 10 || i == 11) { FieldArray[i, 9] = new Field(); } } Switch TempSwitch = new Switch { UpperField = FieldArray[5, 3], LowerField = FieldArray[5, 5], MayChangeNextField = true }; FieldArray[5, 4] = TempSwitch; Switches.Add(TempSwitch); TempSwitch = new Switch { UpperField = FieldArray[9, 3], LowerField = FieldArray[9, 5] }; FieldArray[9, 4] = TempSwitch; Switches.Add(TempSwitch); TempSwitch = new Switch { UpperField = FieldArray[8, 6], LowerField = FieldArray[8, 8], MayChangeNextField = true }; FieldArray[8, 7] = TempSwitch; Switches.Add(TempSwitch); TempSwitch = new Switch { UpperField = FieldArray[6, 6], LowerField = FieldArray[6, 8] }; FieldArray[6, 7] = TempSwitch; Switches.Add(TempSwitch); TempSwitch = new Switch { UpperField = FieldArray[3, 3], LowerField = FieldArray[3, 5] }; FieldArray[3, 4] = TempSwitch; Switches.Add(TempSwitch); }