Esempio n. 1
0
 /// <summary>
 /// Updates <see cref="Item"/>'s <see cref="MeassurementUnit"/>
 /// </summary>
 public void UpdateUnitOfMeassure(int itemID, MeassurementUnit unit)
 {
     using (IDbConnection connection = new SQLiteConnection(DbConnectionString)) {
         connection.Open();
         connection.Execute(new CommandDefinition($"UPDATE {DbItemMetadata.DName} SET {DbItemMetadata.DName}.{nameof(DbItemMetadata.UnitOfMeassure)} = {unit.ToString()}"));
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Sets the unit of measure for the item, can update the database
 /// </summary>
 public void SetUnitOfMeassure(MeassurementUnit unit, bool updateDatabase = false)
 {
     UnitOfMeassure = unit;
     if (updateDatabase)
     {
         DatabaseAccess.Access.UpdateUnitOfMeassure(ID, unit);
     }
 }
Esempio n. 3
0
 public void WriteUnitOfMeassureForItemToDatabase(string itemName, MeassurementUnit unit)
 {
     foreach (JToken tok in itemDatabaseJson)
     {
         if (tok[nameof(Item.userFriendlyName)].Value <string>() == itemName)
         {
             tok[nameof(Item.unitOfMeassure)] = unit.ToString();
         }
     }
     File.WriteAllText(itemDatabaseFile.FullName, itemDatabaseJson.ToString());
     itemDatabase[itemName].SetUnitOfMeassure(unit);
 }
Esempio n. 4
0
 internal void SetUnitOfMeassure(MeassurementUnit unit)
 {
     unitOfMeassure = unit;
 }