private void button1_Click(object sender, EventArgs e) { ProductsSuppliers info = new ProductsSuppliers(); info = SuppliersFunctions.GetTwoValues(Convert.ToInt32(relationshipInitial.Text)); productCurrent.Text = info.ProdName; supplierCurrent.Text = info.SupName; }
private void update_Click(object sender, EventArgs e) { int yay = 0; yay = SuppliersFunctions.GetProductsAndSuppliersForUpdate(Convert.ToInt32(relationshipInitial.SelectedValue), Convert.ToInt32(productNew.SelectedValue), Convert.ToInt32(supplierNew.SelectedValue)); if (yay == 1) { MessageBox.Show("Update Successful"); } else { MessageBox.Show("Update Unsuccessful. Product suppliers pair already exists"); } }
private void AddProductsWithSuppliers_Load(object sender, EventArgs e) { //// TODO: This line of code loads data into the 'travelExpertsDataSet.Products' table. You can move, or remove it, as needed. //this.productsTableAdapter.Fill(this.travelExpertsDataSet.Products); //// TODO: This line of code loads data into the 'travelExpertsDataSet.Products_Suppliers' table. You can move, or remove it, as needed. //this.products_SuppliersTableAdapter.Fill(this.travelExpertsDataSet.Products_Suppliers); //// TODO: This line of code loads data into the 'travelExpertsDataSet.Packages_Products_Suppliers' table. You can move, or remove it, as needed. //this.packages_Products_SuppliersTableAdapter.Fill(this.travelExpertsDataSet.Packages_Products_Suppliers); ProductBox.DataSource = jamesProductsDB.GetProducts(); ProductBox.DisplayMember = "ProdName"; ProductBox.ValueMember = "ProductId"; SuppliersBox.DataSource = SuppliersFunctions.GetSuppliers(); SuppliersBox.ValueMember = "SupplierId"; SuppliersBox.DisplayMember = "SupName"; //((DataGridViewComboBoxCell)dgvRow.Cells[2]).Value = // supplierIdPairs[indOfRightElement].SupplierId; }
private void UpdateSuppliersAndProducts_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'travelExpertsDataSet.Products_Suppliers' table. You can move, or remove it, as needed. //this.products_SuppliersTableAdapter.Fill(this.travelExpertsDataSet.Products_Suppliers); //DISPLAYS THE DATA IN TEH FORM relationshipInitial.DataSource = SuppliersFunctions.GetRelations(); relationshipInitial.DisplayMember = "ProductSupplierId"; relationshipInitial.ValueMember = "ProductSupplierId"; productNew.DataSource = jamesProductsDB.GetProducts(); productNew.DisplayMember = "ProdName"; productNew.ValueMember = "ProductId"; supplierNew.DataSource = SuppliersFunctions.GetSuppliers(); supplierNew.ValueMember = "SupplierId"; supplierNew.DisplayMember = "SupName"; //productCurrent.Source = SuppliersFunctions.GetRelations(); //productCurrent.Text = //supplierCurrent.Text = }
private void button1_Click(object sender, EventArgs e) { int success = 0; if (ProductBox.Text == " ") { MessageBox.Show("Please Select a Product"); } else if (SuppliersBox.Text == " ") { MessageBox.Show("Please select a Supplier"); } else { product = ProductBox.Text; supplier = SuppliersBox.Text; } success = SuppliersFunctions.AddSuppliers(Convert.ToInt32(ProductBox.SelectedValue), Convert.ToInt32(SuppliersBox.SelectedValue)); if (success == 1) { MessageBox.Show("Data inserted Correctly"); ProductsWithSuppliers form = new ProductsWithSuppliers(); form.MdiParent = this.MdiParent; form.Show(); this.Close(); } else { MessageBox.Show("Data was not inserted. It already exists"); } this.Close(); }