Esempio n. 1
0
        private void profileBtn_Click(object sender, EventArgs e)
        {
            ProfileForm pf = new ProfileForm(user, pass);

            this.Hide();
            pf.Show();
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            using (var db = new PartDbEntities())
            {
                try
                {
                    string     username = usernameTextBox.Text;
                    string     password = passwordTextBox.Text;
                    Encryption en       = new Encryption();
                    password = en.Encrypt(password);

                    var acc = db.Accounts.FirstOrDefault(u => u.Username == username && u.Password == password);

                    if (acc == null)
                    {
                        MessageBox.Show("Invalid account");
                        return;
                    }

                    if (acc.Username == username && acc.Password == password)
                    {
                        isValidAcc = true;

                        if (acc.FirstName != null && acc.LastName != null && acc.Email != null && acc.Phone != null && acc.Address != null)
                        {
                            this.Hide();
                            Parts p = new Parts(username, password);
                            p.Show();
                        }
                        else
                        {
                            this.Hide();
                            ProfileForm pf = new ProfileForm(username, password);
                            pf.Show();
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }