예제 #1
0
 private void toolStripButton_Exit_Click(object sender, EventArgs e)
 {
     main.pnl_Menu();
     UCslide.Slide(main, this);
     this.Dispose();
     main.Controls.Remove(this);
 }
예제 #2
0
 private void metroButton_Cancel_Click(object sender, EventArgs e)
 {
     main.pnl_Menu();
     UCslide.Slide(main, this);
     this.Dispose();
     main.Controls.Remove(this);
 }
예제 #3
0
        private void metroButton_Login_Click(object sender, EventArgs e)
        {
            SQLFilmDataContext filmDC = new SQLFilmDataContext();

            if (metroTextBox_Username.Text == "")
            {
                metroToolTip_Login.Show("Username cannot be empty!", metroTextBox_Username);
            }
            else if (metroTextBox_Password.Text == "")
            {
                metroToolTip_Login.Show("Password cannot be empty!", metroTextBox_Password);
            }
            else
            {
                TbQuanLyNhanSu qlns = filmDC.TbQuanLyNhanSus.SingleOrDefault(ns => ns.TenDangNhap == metroTextBox_Username.Text);
                if (qlns != null)
                {
                    if (qlns.MatKhau == metroTextBox_Password.Text && qlns.TrangThai == "Activated")
                    {
                        MetroFramework.MetroMessageBox.Show(this, "Welcome to Margarita.", "SUCCESSFUL!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                        main.tendangnhap = qlns.TenDangNhap;
                        if (qlns.PhanQuyen == "Administrator")
                        {
                            main.isAdministator = true;
                        }
                        else
                        {
                            main.isAdministator = false;
                        }
                        main.pnl_Menu();
                        main.sessionIN();
                        UCslide.Slide(main, this);
                        this.Dispose();
                        main.Controls.Remove(this);
                    }
                    else if (qlns.MatKhau == metroTextBox_Password.Text && qlns.TrangThai != "Activated")
                    {
                        MetroFramework.MetroMessageBox.Show(this, "BUT Your account is temporarily locked!", "SUCCESSFUL!");
                    }
                    else
                    {
                        metroToolTip_Login.Show("That password is incorrect", metroTextBox_Password);
                    }
                }
                else
                {
                    metroToolTip_Login.Show("That username is incorrect", metroTextBox_Username);
                }
            }
        }