public override void CreateFromRow(Row Table) { _id = Convert.ToInt32(Table.Values[0]); Product = new Product(Convert.ToInt32(Table.Values[1])); Amount = Convert.ToInt32(Table.Values[2]); Date = Convert.ToDateTime(Table.Values[3]); Source = new StorageRoom(Convert.ToInt32(Table.Values[4])); Destination = new StorageRoom(Convert.ToInt32(Table.Values[5])); }
// Henter storage status fra databasen om hvilke lagere der har hvilket antal af produkter public void GetStorageStatus() { string sql = $"SELECT * FROM `storage_status` WHERE `product_id` = '{ID}'"; try { TableDecode Results = Mysql.RunQueryWithReturn(sql); foreach (var row in Results.RowData) { int StorageRoomID = Convert.ToInt32(row.Values[1]); int Amount = Convert.ToInt32(row.Values[2]); StorageRoom storgeRoom = new StorageRoom(StorageRoomID); StorageWithAmount.TryAdd(storgeRoom.ID, Amount); } } catch (EmptyTableException) { //Ignore EmptyTableException } }
public void SetInformation(StorageRoom Source, StorageRoom Destination, BaseProduct Prod) { Product = Prod; Source = Source; Destination = Destination; }
public StorageTransaction(Product product, int amount, int sourceInt, int destinationInt, ConcurrentDictionary <int, StorageRoom> storageWithAmountDictionary) : base(product, amount) { Source = storageWithAmountDictionary[sourceInt]; Destination = storageWithAmountDictionary[destinationInt]; }