Ejemplo n.º 1
0
        public void AddNewProduct()
        {
            AddNewProductWindow productWindow = new AddNewProductWindow();

            productWindow.Owner = Application.Current.MainWindow;
            productWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;

            PRODUCT prod = new PRODUCT();

            productWindow.DataContext = prod;

            var result = productWindow.ShowDialog();

            if (result == true)
            {
                productList.Add(prod);
            }
        }
Ejemplo n.º 2
0
        public void RefreshProduct()
        {
            SqlConnection  con = SQLCONNECTION.GetConnection();
            SqlDataAdapter sda = new SqlDataAdapter("SELECT * From [PRODUCT]", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);

            ProductList.Clear();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                PRODUCT prod = new PRODUCT();
                prod.ProductID     = Convert.ToInt16(dt.Rows[i]["Product_ID"]);
                prod.ProductName   = dt.Rows[i]["Product_Name"].ToString();
                prod.ProductType   = dt.Rows[i]["Product_Type"].ToString();
                prod.Quantity      = Convert.ToInt16(dt.Rows[i]["Quantity"]);
                prod.Measurement   = dt.Rows[i]["Measurement"].ToString();
                prod.OriginalPrice = Convert.ToDouble(dt.Rows[i]["Original_Price"]);
                prod.SellingPrice  = Convert.ToDouble(dt.Rows[i]["Selling_Price"]);
                ProductList.Add(prod);
            }
        }