private void Submit_Click(object sender, EventArgs e) { ShorashimCourse sc = Program.seekCourse(this.courseNumber1); string data = string.Empty; foreach (DataGridViewRow row in dataGridView1.Rows) { data = Convert.ToString(row.Cells[1].Value); int quantity1 = Convert.ToInt32(row.Cells[3].Value); Product pnew = Program.seekProductByName(data); if (pnew != null) { ProductInCourse NewPIC = new ProductInCourse(sc, pnew, quantity1, true); pnew.setProductQuantity(pnew.get_productQuantity() - quantity1); // change to new quantity attribute pnew.update_product(); // update sql messageBoxForInventoryAlert(); } } foreach (OrderFromSupplier o in Program.ordersFromSuppliers) //check of hahalot - products of every order { o.PrintAll(); } foreach (Product p in Program.products) //check of hahalot - orders of this product { Console.WriteLine("printing ProductInCourse lists of products"); p.printAllthisProductsInCourses(); } }
public static void init_Product_In_Courses()//init data from sql { SqlCommand c = new SqlCommand(); c.CommandText = "EXECUTE dbo.Get_All_Products_In_Courses"; SQL_CON SC = new SQL_CON(); SqlDataReader rdr = SC.execute_query(c); Products_In_Course = new List <ProductInCourse>(); while (rdr.Read()) { ProductInCourse proipCo = new ProductInCourse(seekCourse(rdr.GetValue(0).ToString()), seekProduct((rdr.GetValue(1).ToString())), int.Parse(rdr.GetValue(2).ToString()), false); Products_In_Course.Add(proipCo); } }
public void addProductsToCourse(ProductInCourse pic1) { this.productsInThisCourse.Add(pic1); }
public void addProductToCourse(ProductInCourse pic1) { this.thisProductsInCourses.Add(pic1); }