Beispiel #1
0
        private void Deletebtn_Click(object sender, EventArgs e)
        {
            DialogResult DeleteCustomer = MessageBox.Show("Are You Sure You Wish To DELETE This Customer?", "Delete Customer", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (DeleteCustomer == DialogResult.Yes)
            {
                MySqlConnection con = new MySqlConnection();
                con.ConnectionString = LoginForm.constring;
                MySqlDataAdapter dataadapter = new MySqlDataAdapter();
                con.Open();

                MySqlCommand command = con.CreateCommand();
                command.CommandText = "DELETE FROM customer WHERE customer_id='" + CustomerIDtxt.Text + "'";
                command.ExecuteNonQuery();
                MessageBox.Show("The Customer Deleted Successfully.");
                con.Close();

                ManageStock ManageStock = new ManageStock();
                ManageStock.Show();
                this.Close();
            }
        }
Beispiel #2
0
        private void Updatebtn_Click(object sender, EventArgs e)
        {
            DialogResult UpdateCustomer = MessageBox.Show("Are You Sure You Wish To EDIT This Customer?", "Update Product", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (UpdateCustomer == DialogResult.Yes)
            {
                MySqlConnection con = new MySqlConnection();
                con.ConnectionString = LoginForm.constring;
                MySqlDataAdapter dataadapter = new MySqlDataAdapter();
                con.Open();

                MySqlCommand command = con.CreateCommand();
                command.CommandText = "UPDATE customer SET customer_forename='" + Forenametxt.Text + "', customer_surname='" + Surnametxt.Text + "', customer_email='" + Emailtxt.Text + "', customer_phone='" + Phonetxt.Text + "'WHERE product_id='" + CustomerIDtxt.Text + "'";
                command.ExecuteNonQuery();

                MySqlCommand commandaddress = con.CreateCommand();
                commandaddress.CommandText = "UPDATE address SET address_line1='" + Addl1txt.Text + "', address_line2='" + Addl2txt.Text + "', address_city='" + Countytxt.Text + "', address_postcode='" + Postcodetxt.Text + "'WHERE address_id='" + addressid + "'";
                commandaddress.ExecuteNonQuery();

                MessageBox.Show("The Customer Details Have Been Updated.");
                con.Close();

                ManageStock ManageStock = new ManageStock();
                ManageStock.Show();
                this.Close();
            }
        }
Beispiel #3
0
        private void Savebtn_Click(object sender, EventArgs e)
        {
            DialogResult SaveProduct = MessageBox.Show("Are You Sure You Wish To ADD This Product?", "Add Product", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (SaveProduct == DialogResult.Yes)
            {
                MySqlConnection con = new MySqlConnection();
                con.ConnectionString = LoginForm.constring;
                MySqlDataAdapter dataadapter = new MySqlDataAdapter();
                con.Open();

                MySqlCommand command = con.CreateCommand();
                command.CommandText = "INSERT INTO product (category_id, product_name, product_price, product_description, product_quantity) VALUES" + "('" + Categorycb.SelectedItem.ToString() + "','" + ProductNametxt.Text + "'," + ProductPricetxt.Text + ",'" + ProductDescriptiontxt.Text + "'," + ProductQuantitytxt.Text + ");";

                command.ExecuteNonQuery();

                MessageBox.Show("The Product Has Been Added Successfully.");

                ManageStock ManageStock = new ManageStock();
                ManageStock.Show();
                this.Close();
            }
        }
Beispiel #4
0
        private void Updatebtn_Click(object sender, EventArgs e)
        {
            DialogResult UpdateProduct = MessageBox.Show("Are You Sure You Wish To UPDATE This Product?", "Update Product", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (UpdateProduct == DialogResult.Yes)
            {
                MySqlConnection con = new MySqlConnection();
                con.ConnectionString = LoginForm.constring;
                MySqlDataAdapter dataadapter = new MySqlDataAdapter();
                con.Open();

                MySqlCommand command = con.CreateCommand();
                command.CommandText = "UPDATE product SET category_id='" + Categorycb.Text.ToString() + "', product_name='" + ProductNametxt.Text + "', product_description='" + ProductDescriptiontxt.Text + "', product_quantity=" + ProductQuantitytxt.Text + ", product_price=" + ProductPricetxt.Text + " WHERE product_id=" + ProductIDtxt.Text + ";";
                command.ExecuteNonQuery();
                MessageBox.Show("The Product Details Have Been Updated.");
                con.Close();

                ManageStock ManageStock = new ManageStock();
                ManageStock.Show();
                this.Close();
            }
        }
Beispiel #5
0
 private void ManageStockbtn_Click(object sender, EventArgs e)
 {
     ManageStock ManageStock = new ManageStock();
     ManageStock.Show();
     this.Dispose(false);
 }