示例#1
0
 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]));
 }
示例#2
0
文件: Product.cs 项目: msimon16/P4
        // 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
            }
        }
示例#3
0
 public void SetInformation(StorageRoom Source, StorageRoom Destination, BaseProduct Prod)
 {
     Product     = Prod;
     Source      = Source;
     Destination = Destination;
 }
示例#4
0
 public StorageTransaction(Product product, int amount, int sourceInt, int destinationInt, ConcurrentDictionary <int, StorageRoom> storageWithAmountDictionary) : base(product, amount)
 {
     Source      = storageWithAmountDictionary[sourceInt];
     Destination = storageWithAmountDictionary[destinationInt];
 }