Ejemplo n.º 1
0
        //Sign Up
        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox4.Text.Length == 0 || textBox3.Text.Length == 0 || textBox5.Text.Length == 0 || textBox6.Text.Length == 0 || textBox7.Text.Length == 0 || comboBox1.Text.Length == 0 || comboBox2.Text.Length == 0 || comboBox3.Text.Length == 0 || comboBox4.Text.Length == 0)
            {
                MessageBox.Show("Each field is nesseccary !");
            }
            else
            {
                context  con = new context(new check_customer());
                customer c   = new customer();
                if (con.my_function(textBox3.Text))
                {
                    MessageBox.Show("This email is already exisit !");
                }
                else
                {
                    if (comboBox4.Text == "male" || comboBox4.Text == "female")
                    {
                        DateTime d  = new DateTime(int.Parse(comboBox1.Text), int.Parse(comboBox2.Text), int.Parse(comboBox3.Text));
                        DateTime to = DateTime.Today;
                        c.age      = to.Year - d.Year;
                        c.name     = textBox4.Text;
                        c.e_mail   = textBox3.Text;
                        c.password = textBox7.Text;
                        c.sex      = comboBox4.Text;
                        c.address  = textBox5.Text;
                        c.phone    = textBox6.Text;
                        c.add(c);
                        t1 = c.name;

                        MessageBox.Show(" done ");
                        menu f = new menu(c.name, c.e_mail);
                        this.Hide();
                        f.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("invalid sex!!");
                    }
                }
            }
        }
Ejemplo n.º 2
0
        //Sign in
        private void button1_Click(object sender, EventArgs e)
        {
            customer c = new customer();

            if (textBox1.Text.Length == 0 || textBox2.Text.Length == 0)
            {
                MessageBox.Show("Enter email & password !");
            }
            else
            {
                if (c.check_sign_in(textBox1.Text, textBox2.Text))
                {
                    t1 = textBox1.Text;
                    menu f = new menu(c.name, c.e_mail);
                    this.Hide();
                    f.ShowDialog();
                }
                else
                {
                    MessageBox.Show("This email not found !");
                }
            }
        }