Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            info i = new info();

            try
            {
                i.fname = first_name_textbox.Text;
                i.lname = last_name_textbox.Text;

                Regex r = new Regex(email_regex);
                if (r.IsMatch(reg_email_textbox.Text))
                {
                    i.email = reg_email_textbox.Text;
                }

                i.pass = reg_password_textbox.Text;

                Class1.add_user(i);
            }
            catch (Exception exc)
            {
                MessageBox.Show("Invalid Email Format !");
                return;
            }
            first_name_textbox.Clear();
            last_name_textbox.Clear();
            reg_email_textbox.Clear();
            reg_password_textbox.Clear();

            MessageBox.Show("Registeration Successful !");
        }
Exemplo n.º 2
0
        private void login2_button_Click(object sender, EventArgs e)
        {
            Regex regex = new Regex(email_regex);

            if (regex.IsMatch(email_textbox.Text))
            {
                var  db = new DataClasses1DataContext();
                info i  = null;
                try
                {
                    i = db.infos.Single(p => p.email == email_textbox.Text && p.pass == password_textbox.Text);
                }

                catch (InvalidOperationException exception)
                {
                    verify.ForeColor = Color.DarkRed;
                    verify.BackColor = Color.Transparent;
                    verify.Text      = "Invalid Credentials !";
                    return;
                }
                if (i != null)
                {
                    verify.ForeColor = Color.LightSeaGreen;
                    verify.BackColor = Color.Transparent;
                    verify.Text      = "Login Successful !";
                    email_textbox.Clear();
                    password_textbox.Clear();
                }
                else
                {
                    verify.ForeColor = Color.DarkRed;
                    verify.BackColor = Color.Transparent;
                    verify.Text      = "Invalid Credentials !";
                }
            }
            else
            {
                MessageBox.Show("Please Follow correct Format ! ");
            }
        }
Exemplo n.º 3
0
 partial void Deleteinfo(info instance);
Exemplo n.º 4
0
 partial void Updateinfo(info instance);
Exemplo n.º 5
0
 partial void Insertinfo(info instance);
Exemplo n.º 6
0
 public static void add_user(info l)
 {
     db = new DataClasses1DataContext();
     db.add_user(l.fname, l.lname, l.email, l.pass);
 }