Exemplo n.º 1
0
        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");
            }
        }
Exemplo n.º 2
0
        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.");
        }
Exemplo n.º 3
0
        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);

            }
        }