private void button3_Click(object sender, EventArgs e) { //clear balance projectpizzaDataSet ds = new projectpizzaDataSet(); projectpizzaDataSetTableAdapters.balanceTableAdapter daCust = new projectpizzaDataSetTableAdapters.balanceTableAdapter(); while (dataGridView1.Rows.Count > 0) { dataGridView1.Rows.RemoveAt(0); } this.balanceTableAdapter.Update(projectpizzaDataSet.balance); }
private void button1_Click(object sender, EventArgs e) { projectpizzaDataSet ds = new projectpizzaDataSet(); projectpizzaDataSetTableAdapters.customersTableAdapter daCust = new projectpizzaDataSetTableAdapters.customersTableAdapter(); daCust.Fill(ds.customers); projectpizzaDataSet.customersRow dr = ds.customers.FindByTel_Numbers(textBox1.Text); try { if(textBox1.Text != null && textBox2.Text != null && textBox3.Text !=null && textBox5.Text !=null) daCust.Insert(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text); // to create new customer } catch (Exception ex) { MessageBox.Show("This customer already exist"); } }
private void button1_Click(object sender, EventArgs e) { projectpizzaDataSet ds = new projectpizzaDataSet(); projectpizzaDataSetTableAdapters.usersTableAdapter daCust = new projectpizzaDataSetTableAdapters.usersTableAdapter(); daCust.Fill(ds.users); projectpizzaDataSet.usersRow dr = ds.users.FindByidusers(textBox1.Text); projectpizzaDataSet dss = new projectpizzaDataSet(); projectpizzaDataSetTableAdapters.simuserTableAdapter daCusts = new projectpizzaDataSetTableAdapters.simuserTableAdapter(); daCusts.Fill(dss.simuser); projectpizzaDataSet.simuserRow drr = dss.simuser.FindByidsimuser(textBox1.Text); if ((textBox1.Text == "") || (textBox2.Text == "")) { MessageBox.Show("You must fill the textboxes!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (dr != null && dr.password == textBox2.Text) { MessageBox.Show("You had successfully logged in as a Manager!", "Welcome", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Form1 staff = new Form1(); staff.Show(); } else if (drr != null && drr.password == textBox2.Text) { MessageBox.Show("You had successfully logged in as a Simple User!", "Welcome", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Form6 staff = new Form6(); staff.Show(); } else { MessageBox.Show("Invalid UserName or Password! Please try again!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void button3_Click(object sender, EventArgs e) { //to fill the texts projectpizzaDataSet ds = new projectpizzaDataSet(); projectpizzaDataSetTableAdapters.customersTableAdapter daCust = new projectpizzaDataSetTableAdapters.customersTableAdapter(); daCust.Fill(ds.customers); projectpizzaDataSet.customersRow dr = ds.customers.FindByTel_Numbers(textBox1.Text); //for (int i = 0; i < ds.customers.Count; i++) //{ // if (textBox1.Text == ds.customers[i].Tel_Numbers) // { // textBox2.Text = ds.customers[i].Name; // break; // } // else textBox2.Text = ""; if (dr != null) { textBox2.Text = dr.Name; textBox3.Text = dr.Address; textBox4.Text = dr.Post_code; textBox5.Text = dr.City; } else MessageBox.Show("No such customer.Create new or Search again."); }
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { projectpizzaDataSet ds = new projectpizzaDataSet(); projectpizzaDataSetTableAdapters.productsTableAdapter daCust = new projectpizzaDataSetTableAdapters.productsTableAdapter(); daCust.Fill(ds.products); projectpizzaDataSet.productsRow dr = ds.products.FindByidproducts(comboBox2.Text); if (dr != null && dr.idproducts == comboBox2.Text && checkBox1.Checked) { double y = dr.price; y = y + 2.00; string fin = y.ToString(); textBox6.Text = fin; } else { try { string stat = dr.price.ToString(); textBox6.Text = stat; } catch (Exception ex) { } } }
private void button6_Click(object sender, EventArgs e) { projectpizzaDataSet ds = new projectpizzaDataSet(); projectpizzaDataSetTableAdapters.customersTableAdapter daCust = new projectpizzaDataSetTableAdapters.customersTableAdapter(); daCust.Fill(ds.customers); projectpizzaDataSet.customersRow dr = ds.customers.FindByTel_Numbers(textBox1.Text); if (dr != null && dr.Tel_Numbers == textBox1.Text) { daCust.Delete(Original_Tel_Numbers = textBox1.Text, Original_Name = textBox2.Text, Original_Address = textBox3.Text, Original_City = textBox4.Text, Original_Post_code = textBox5.Text); } }
private void button4_Click(object sender, EventArgs e) { //BALANCE TABLE //balance open projectpizzaDataSet ds = new projectpizzaDataSet(); projectpizzaDataSetTableAdapters.balanceTableAdapter daCust = new projectpizzaDataSetTableAdapters.balanceTableAdapter(); if (textBox1.Text == null || textBox6.Text==null) { MessageBox.Show("Telephone number or Price must fill first!"); } else { string y = comboBox2.Text; int x = Convert.ToInt32(textBox1.Text); double p = Convert.ToDouble(textBox6.Text); daCust.Insert(x, y, p); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; checkBox1.Checked = false; checkBox2.Checked = false; } }