Example #1
0
        private void UpdateProducts()
        {
            SqlConnection  con  = Database.DatabaseLocator.GenerateConnection.GenerateNewConnection();
            SqlDataAdapter sda1 = new SqlDataAdapter("SELECT * From [PRODUCT]", con);
            DataTable      dt   = new DataTable();

            sda1.Fill(dt);
            con.Open();

            ViewModels.ViewModelLocator.MainWindowViewModel.ProductList.Clear();
            for (int x = 0; x < dt.Rows.Count; x++)
            {
                Classes.PRODUCT newProduct = new Classes.PRODUCT();

                newProduct.ID           = Convert.ToInt16(dt.Rows[x]["ID"]);
                newProduct.ProductName  = dt.Rows[x]["ProductName"].ToString();
                newProduct.GenericName  = dt.Rows[x]["GenericName"].ToString();
                newProduct.Type         = dt.Rows[x]["Type"].ToString();
                newProduct.Form         = dt.Rows[x]["Form"].ToString();
                newProduct.BuyingPrice  = Convert.ToDecimal(dt.Rows[x]["BuyingPrice"]);
                newProduct.SellingPrice = Convert.ToDecimal(dt.Rows[x]["SellingPrice"]);
                newProduct.Quantity     = Convert.ToInt16(dt.Rows[x]["Quantity"]);
                ViewModels.ViewModelLocator.MainWindowViewModel.ProductList.Add(newProduct);
            }
            con.Close();
        }
Example #2
0
 public ORDER(int iD, PRODUCT orderProduct, int quantity)
 {
     ID           = iD;
     OrderProduct = orderProduct;
     Quantity     = quantity;
 }