Beispiel #1
0
        private void Btl_Insert_Click(object sender, EventArgs e)
        {
            if (Insert_GridView.SelectedRows.Count > 0)
            {
                product_suppliers itemToInsert = (product_suppliers)Insert_GridView.SelectedRows[0].DataBoundItem;
                foreach (package_product_supplier element in List_info)
                {
                    if (element.Productname == itemToInsert.Productname && element.suppliername == itemToInsert.Suppliername)
                    {
                        MessageBox.Show("this information already exists,Please insert a new value");
                    }
                }
                if (Package_Product_SupplierDB.insert_info(InsertName, itemToInsert.Productname, itemToInsert.Suppliername))
                {
                    MessageBox.Show("Sucessfully Inserted");
                }
                else
                {
                    MessageBox.Show("Insert failure Please contact Administrator");
                }

                /*
                 * TravelExperts info = new TravelExperts();
                 * List_info = Package_Product_SupplierDB.getPackageinfo(InsertName);
                 * info.DisplayBox_info(List_info);
                 */
            }
            else
            {
                MessageBox.Show("need to choose a row first");
            }
        }
Beispiel #2
0
 private void InsertForm_Load(object sender, EventArgs e)
 {
     product_list       = Package_Product_SupplierDB.loadProduct();
     supplier_list      = Package_Product_SupplierDB.loadSuppliers();
     Package_label.Text = InsertName.ToString();
     display_packages();
 }
Beispiel #3
0
 private void PackageNameCombo_SelectedIndexChanged(object sender, EventArgs e)
 {
     name = PackageNameCombo.SelectedItem.ToString();
     info = Package_Product_SupplierDB.getPackageinfo(name);
     DisplayBox_info(info);
     btlDelete.Visible = true;
     btlInsert.Visible = true;
 }
Beispiel #4
0
        private void btlInsert_Click(object sender, EventArgs e)
        {
            SearchForm Insert_window = new SearchForm(name, info);

            Insert_window.ShowDialog(this); //this line will prevent the code after it executing if the
            name = PackageNameCombo.SelectedItem.ToString();
            info = Package_Product_SupplierDB.getPackageinfo(name);
            DisplayBox_info(info);
        }
Beispiel #5
0
 private void button2_Click(object sender, EventArgs e)
 {
     product_get  = Product_box.SelectedItem.ToString();
     supplier_get = Supplier_box.SelectedItem.ToString();
     if (product_get == null || supplier_get == null)
     {
         MessageBox.Show("need to choose choose product type or suppliers");
     }
     else
     {
         product_suppliers_list = Package_Product_SupplierDB.getProduct_Suppliers(product_get, supplier_get);
         DisplayBox_info(product_suppliers_list);
     }
 }
Beispiel #6
0
 private void btlDelete_Click(object sender, EventArgs e)
 {
     if (product_supplier_packageBox.SelectedRows.Count > 0)
     {
         package_product_supplier itemToDelete = (package_product_supplier)product_supplier_packageBox.SelectedRows[0].DataBoundItem;
         Package_Product_SupplierDB.delete_info(itemToDelete.package_id, itemToDelete.Product_id, itemToDelete.supplier_id);
         name = PackageNameCombo.SelectedItem.ToString();
         info = Package_Product_SupplierDB.getPackageinfo(name);
         DisplayBox_info(info);
     }
     else
     {
         MessageBox.Show("need to choose a row first");
     }
 }
Beispiel #7
0
 private void BtlUpdate_Click(object sender, EventArgs e)
 {
     if (Insert_GridView.SelectedRows.Count > 0)
     {
         product_suppliers itemToUpdate = (product_suppliers)Insert_GridView.SelectedRows[0].DataBoundItem;
         if (Package_Product_SupplierDB.Update_info(InsertName, selected.Productname, selected.suppliername, itemToUpdate.Productname, itemToUpdate.Suppliername))
         {
             oldSupplier.Text = itemToUpdate.Suppliername.ToString();
             oldProduct.Text  = itemToUpdate.Productname.ToString();
             MessageBox.Show("Row Updated");
         }
         else
         {
             MessageBox.Show("Fail to Update please contact Administrator");
         }
         //TravelExperts info = new TravelExperts();
         //List_info = Package_Product_SupplierDB.getPackageinfo(InsertName);
         //info.DisplayBox_info(List_info);
     }
     else
     {
         MessageBox.Show("No rows selected.");
     }
 }
Beispiel #8
0
 private void TravelExperts_Load(object sender, EventArgs e)
 {
     access = Package_Product_SupplierDB.loadPackage();
     product_supplier_packageBox.ReadOnly = false;
     display_packages();
 }