コード例 #1
0
        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);
        }
コード例 #2
0
 public Item(string name, string code, decimal quantity, UnitOfMesurement type)
 {
     this.Name     = name;
     this.Code     = code;
     this.Quantity = quantity;
     this.Type     = type;
 }
コード例 #3
0
 public void InsertUnitOfMesurement(UnitOfMesurement unit)
 {
     SqlHelper.ExecuteNonQuery(cs, "insertUnitOfMesurement", unit.Type);
 }