コード例 #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            _userController = new UserController();

            User currentUser = _userController.GetByLogin(txtUsername.Text, txtPassword.Text);

            if (currentUser != null)
            {
                if (currentUser.UserRole == UserRole.Standart)
                {
                    frmMain frm = new frmMain(currentUser);
                    //frm main ctor'unda user göndericez (gönderdik=>currentUser)
                    frm.Owner = this;
                    frm.Show();
                    this.Hide();
                }
                else
                {
                    frmAdmin frm = new frmAdmin();
                    frm.Owner = this;
                    frm.Show();
                    this.Hide();
                }
            }
            else
            {
                MessageBox.Show("Hatalı giriş bilgileri!");
            }
        }
コード例 #2
0
ファイル: frmLogin.cs プロジェクト: EmineAkgul/NoteBoard
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            _userController = new UserController();

            User currentUser = _userController.GetByLogin(txtKAdi.Text, txtSifre.Text);

            if (currentUser != null)
            {
                if (currentUser.UserRole == UserRole.Standart)
                {
                    frmMain frm = new frmMain(currentUser);
                    frm.Owner = this;
                    frm.Show();
                    this.Hide();
                }
                else
                {
                    frmAdmin frm = new frmAdmin();
                    frm.Owner = this;
                    frm.Show();
                    this.Hide();
                }
            }
            else
            {
                MessageBox.Show("Hatalı Giriş Bilgileri.!");
            }
        }