Exemplo n.º 1
0
 public ProductForm(Product prod, DataTable deps, DataTable produser)
 {
     InitializeComponent();
       product = prod;
       _deps = deps;
       _produser = produser;
 }
Exemplo n.º 2
0
        private void DelProductBtn_Click(object sender, EventArgs e)
        {
            int index = dataGridViewProducts.CurrentCell.RowIndex;

              Product product = new Product();

              product.SetValues(
            Convert.ToInt32(dataGridViewProducts.Rows[index].Cells["Id"].Value),
            dataGridViewProducts.Rows[index].Cells["Title"].Value.ToString(),
            Convert.ToDouble(dataGridViewProducts.Rows[index].Cells["PurchasePrice"].Value),
            Convert.ToDouble(dataGridViewProducts.Rows[index].Cells["Markup"].Value),
            Convert.ToDouble(dataGridViewProducts.Rows[index].Cells["Price"].Value),
            Convert.ToInt32(dataGridViewProducts.Rows[index].Cells["DepartmentId"].Value),
            Convert.ToInt32(dataGridViewProducts.Rows[index].Cells["ProduserId"].Value),
            Convert.ToInt32(dataGridViewProducts.Rows[index].Cells["Quantity"].Value),
            Convert.ToBoolean(dataGridViewProducts.Rows[index].Cells["CriticalQ"].Value));

              client.DelProduct(product);
              //_waitForResponse.WaitOne();
        }
Exemplo n.º 3
0
        void SetProduct(Product product)
        {
            if (product.Id == 0)
              {
            product.SetId(client.GetCurIdentity("Product") + 1);
              }

              ProductForm pf = new ProductForm(product, _db._ds.Tables["Department"], _db._ds.Tables["Client"]);
              pf.ShowDialog();

              product = pf.product;

              if (product.Id != 0)
              {
            client.SetProduct(product);
            //_waitForResponse.WaitOne();
              }

              bsProducts = new BindingSource { DataSource = _db._ds.Tables["Product"] };
              dataGridViewProducts.DataSource = bsProducts;
              bindingNavigatorProducts.BindingSource = bsProducts;

              ProductsBinding();
        }
Exemplo n.º 4
0
        private void OnEditProduct(object sender, EventArgs e)
        {
            int index = dataGridViewProducts.CurrentCell.RowIndex;

              Product product = new Product();

              product.SetValues(
            Convert.ToInt32(dataGridViewProducts.Rows[index].Cells["Id"].Value),
            dataGridViewProducts.Rows[index].Cells["Title"].Value.ToString(),
            Convert.ToDouble(dataGridViewProducts.Rows[index].Cells["PurchasePrice"].Value),
            Convert.ToDouble(dataGridViewProducts.Rows[index].Cells["Markup"].Value),
            Convert.ToDouble(dataGridViewProducts.Rows[index].Cells["Price"].Value),
            Convert.ToInt32(dataGridViewProducts.Rows[index].Cells["DepartmentId"].Value),
            Convert.ToInt32(dataGridViewProducts.Rows[index].Cells["ProduserId"].Value),
            Convert.ToInt32(dataGridViewProducts.Rows[index].Cells["Quantity"].Value),
            Convert.ToBoolean(dataGridViewProducts.Rows[index].Cells["CriticalQ"].Value));

              SetProduct(product);
        }
Exemplo n.º 5
0
        public void SetProduct(Product product)
        {
            DataRow row = _db._ds.Tables["Product"].Rows.Find(product.Id);
              if (row == null)
              {
            row = _db._ds.Tables["Product"].NewRow();
            row["Id"] = product.Id;
            row["Title"] = product.Title;
            row["PurchasePrice"] = product.PurchasePrice;
            row["Markup"] = product.Markup;
            row["Price"] = product.Price;
            row["DepartmentId"] = product.DepartmentId;
            row["ProduserId"] = product.ProduserId;
            row["Quantity"] = product.Quantity;
            row["CriticalQ"] = product.CriticalQ;

            _db._ds.Tables["Product"].Rows.Add(row);
              }
              else
              {
            row["Id"] = product.Id;
            row["Title"] = product.Title;
            row["PurchasePrice"] = product.PurchasePrice;
            row["Markup"] = product.Markup;
            row["Price"] = product.Price;
            row["DepartmentId"] = product.DepartmentId;
            row["ProduserId"] = product.ProduserId;
            row["Quantity"] = product.Quantity;
            row["CriticalQ"] = product.CriticalQ;
              }

              _db._adapterProduct.Update(_db._ds.Tables["Product"]);

              OnDBChanged(_db);
        }
Exemplo n.º 6
0
 public void DelProduct(Product product)
 {
     _db._ds.Tables["Product"].Rows.Find(product.Id).Delete();
       _db._adapterProduct.Update(_db._ds.Tables["Product"]);
       OnDBChanged(_db);
 }