Пример #1
0
        private void btnDangNhap_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Form frm = this.CheckFormExist(typeof(frListAdmin));

            if (frm != null)
            {
                frm.Activate();
            }
            else
            {
                frListAdmin f = new frListAdmin();
                f.MdiParent = this;
                f.Show();
            }
        }
Пример #2
0
        private void btnDangNhap_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            SplashScreenManager.ShowForm(typeof(frWait));
            Form frm = this.CheckFormExist(typeof(frListAdmin));

            if (frm != null)
            {
                frm.Activate();
            }
            else
            {
                frListAdmin f = new frListAdmin();
                f.MdiParent = this;
                f.Show();
            }
            SplashScreenManager.CloseForm();
        }
Пример #3
0
        private void bttDangNhap_Click(object sender, EventArgs e)
        {
            string username;
            string pass;
            string chucvu;

            if (txtTaiKhoan.Text.Replace(" ", "") != "" && txtMatKhau.Text.Replace(" ", "") != "")
            {
                username = txtTaiKhoan.Text.Trim();
                pass     = txtMatKhau.Text;
                chucvu   = cbxChucVu.Text;
                if (chucvu == "Học Viên")
                {
                    ObjectParameter idpq   = new ObjectParameter("idpq", typeof(int));
                    ObjectParameter idhv   = new ObjectParameter("idhv", typeof(int));
                    var             result = context.sp_KiemTraTaiKhoanHV(idpq, idhv, username, pass);
                    if (idpq.Value == DBNull.Value)
                    {
                        MessageBox.Show("Tài Khoản Không Tồn Tại");
                    }
                    else
                    {
                        Global.HocVienID = Convert.ToInt32(idhv.Value);
                        if (Convert.ToInt32(idpq.Value) == 4)
                        {
                            SplashScreenManager.ShowForm(typeof(frWait));
                            Form frm = this.CheckFormExist(typeof(frListAdmin));
                            if (frm != null)
                            {
                                frm.Activate();
                            }
                            else
                            {
                                frListAdmin f = new frListAdmin();
                                f.Show();
                            }
                            SplashScreenManager.CloseForm();
                        }
                    }
                }
                else
                {
                    ObjectParameter idpq   = new ObjectParameter("idpq", typeof(int));
                    ObjectParameter idnv   = new ObjectParameter("idnv", typeof(int));
                    var             result = context.sp_KiemTraTaiKhoanNV(idpq, idnv, username, pass, chucvu);
                    if (idpq.Value == DBNull.Value)
                    {
                        MessageBox.Show("Tài Khoản Không Tồn Tại");
                    }
                    else
                    {
                        Global.NhanVienID = Convert.ToInt32(idnv.Value);
                        if (Convert.ToInt32(idpq.Value) == 1)
                        {
                            SplashScreenManager.ShowForm(typeof(frWait));
                            Form frm = this.CheckFormExist(typeof(frMain));
                            if (frm != null)
                            {
                                frm.Activate();
                            }
                            else
                            {
                                frMain f = new frMain();
                                f.Show();
                            }
                            SplashScreenManager.CloseForm();
                        }
                        else if (Convert.ToInt32(idpq.Value) == 3)
                        {
                            SplashScreenManager.ShowForm(typeof(frWait));
                            Form frm = this.CheckFormExist(typeof(frKeToan));
                            if (frm != null)
                            {
                                frm.Activate();
                            }
                            else
                            {
                                frKeToan f = new frKeToan();
                                f.Show();
                            }
                            SplashScreenManager.CloseForm();
                        }
                        else if (Convert.ToInt32(idpq.Value) == 2)
                        {
                            SplashScreenManager.ShowForm(typeof(frWait));
                            Form frm = this.CheckFormExist(typeof(frGiaoVien));
                            if (frm != null)
                            {
                                frm.Activate();
                            }
                            else
                            {
                                frGiaoVien f = new frGiaoVien();
                                f.Show();
                            }
                            SplashScreenManager.CloseForm();
                        }
                    }
                }
            }
        }