Beispiel #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //MessageBox.Show(cboUser.SelectedValue.ToString() + " " + txtPass.Text);
            using (ShopDBEntities db = new ShopDBEntities())
            {
                int userid = Convert.ToInt32(cboUser.SelectedValue);
                var user   = db.Users.SingleOrDefault(u => u.UserID == userid);

                string pass = security.Decrypt(user.Password, true);
                //MessageBox.Show("Password: "******"Authorization OK!", "Welcome " + cboUser.Text, System.Drawing.Color.Green);
                    this.Hide();
                    frMain f = new frMain();
                    f.Show();
                }
                else
                {
                    MessageBox.Show("Password error. please try again with valid password.", "Error Password", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;

                    txtPass.Clear();
                    txtPass.Focus();
                }
            }
        }
 public frLogin(frMain frmain)
 {
     InitializeComponent();
     this.frmain = frmain;
 }