public IList <UnitEnergy> GetUnitsOfMesurement(int ingredientId) { ds = SqlHelper.ExecuteDataset(cs, "getUnitsOfMesurementForIngredient", ingredientId); IList <UnitEnergy> units = new List <UnitEnergy>(); foreach (DataRow row in ds.Tables[0].Rows) { var unitOFMesurement = new UnitOfMesurement { Id = (int)row["IDUnitOfMesurement"], Type = row["UnitOfMesurement"].ToString() }; units.Add ( new UnitEnergy { Id = (int)row["IDIngredientUnit"], Kcal = Double.Parse(row["EnergyKcal"].ToString()), Value = Double.Parse(row["Value"].ToString()), Unit = unitOFMesurement } ); } return(units); }
public Item(string name, string code, decimal quantity, UnitOfMesurement type) { this.Name = name; this.Code = code; this.Quantity = quantity; this.Type = type; }
public void InsertUnitOfMesurement(UnitOfMesurement unit) { SqlHelper.ExecuteNonQuery(cs, "insertUnitOfMesurement", unit.Type); }