Exemplo n.º 1
0
        public void addIngredient(clsIngredient ingr)
        {
            _strSQL = "INSERT INTO Ingredients (Name, Description, Season) VALUES ('" + ingr.name + "', '" +
                      ingr.description + "', '" + ingr.season + "')";

            executesql();
        }
Exemplo n.º 2
0
        private void getIngredients()
        {
            foreach (ListViewItem item in lstIngredients.CheckedItems)
            {
                String        query = "Name='" + item.Text + "'";
                DataRow[]     dr    = _ingredients.Select(query);
                clsIngredient ingr  = new clsIngredient();
                ingr.id          = Int32.Parse(dr[0]["Ingr_id"].ToString());
                ingr.name        = dr[0]["Name"].ToString();
                ingr.description = dr[0]["Description"].ToString();
                ingr.season      = dr[0]["Season"].ToString();
                _ingredientsUsed.Add(ingr);
            }


            //for (int i = 0; i < lstIngredients.CheckedItems.Count; ++i)
            //{

            //    string itemname = lstIngredients.Items[i].Text;
            //    for (int k = 0; k < _ingredients.Rows.Count; ++k)
            //    {
            //        DataRow dr = _ingredients.Rows[k];
            //        if (dr["Name"].ToString().Equals(itemname))
            //        {
            //            clsIngredient ingr = new clsIngredient();
            //            ingr.id = Int32.Parse(dr["Ingr_id"].ToString());
            //            ingr.name = dr["Name"].ToString();
            //            ingr.description = dr["Description"].ToString();
            //            ingr.season = dr["Season"].ToString();
            //            _ingredientsUsed.Add(ingr);
            //        }
            //    }
            //}
        }
Exemplo n.º 3
0
 private void getIngredients()
 {
     foreach (ListViewItem item in lstIngredients.CheckedItems)
     {
         String        query = "Name='" + item.Text + "'";
         DataRow[]     dr    = _ingredients.Select(query);
         clsIngredient ingr  = new clsIngredient();
         ingr.id          = Int32.Parse(dr[0]["Ingr_id"].ToString());
         ingr.name        = dr[0]["Name"].ToString();
         ingr.description = dr[0]["Description"].ToString();
         ingr.season      = dr[0]["Season"].ToString();
         _strIngredients.Add(ingr);
     }
 }
 private void getIngredients()
 {
     for (int i = 0; i < lstIngredients.CheckedItems.Count; ++i)
     {
         string itemname = lstIngredients.Items[i].Text;
         for (int k = 0; k < _ingredients.Rows.Count; ++k)
         {
             DataRow dr = _ingredients.Rows[k];
             if (dr["Name"].ToString().Equals(itemname))
             {
                 clsIngredient ingr = new clsIngredient();
                 ingr.id          = Int32.Parse(dr["Ingr_id"].ToString());
                 ingr.name        = dr["Name"].ToString();
                 ingr.description = dr["Description"].ToString();
                 ingr.season      = dr["Season"].ToString();
                 _ingredientsUsed.Add(ingr);
             }
         }
     }
 }
Exemplo n.º 5
0
 public frmAddIngredient(frmAddRecipe frmRec)
 {
     _frmRec     = frmRec;
     _ingredient = new clsIngredient();
     InitializeComponent();
 }