private void ValidateTrungTaiKhoan(string _tendangnhap)
        {
            TAIKHOAN _taikhoan = TaiKhoanLogic.SelectTheoTenDangNhap(_tendangnhap);

            if (_taikhoan != null)
            {
                throw new ArgumentException("Tên đăng nhập đã có người sử dụng\nVui lòng lấy tên đăng nhập khác");
            }
        }
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtTenDangNhap.Text.ToLower() == KeyTrongPhanMem.AdminUser_key && txtMatKhau.Text == KeyTrongPhanMem.AdminPass_key)
                {
                    //TAIKHOAN tk = TaiKhoan.Select(txtTenDangNhap.Text);
                    GlobalSettings.UserID   = -1;
                    GlobalSettings.UserCode = txtTenDangNhap.Text.Trim().ToLower();
                    GlobalSettings.UserName = "******";
                    GlobalSettings.UserType = UserType.QuanTri;

                    //Settings.Default.Login_UserName = txtTenDangNhap.Text;
                    //Settings.Default.Login_Password = txtMatKhau.Text;
                    //Settings.Default.Save();
                    LoadDuLieuSauKhiDangNhap();
                }
                else
                {
                    if (TaiKhoanLogic.IsValid(txtTenDangNhap.Text, txtMatKhau.Text))
                    {
                        TAIKHOAN _taikhoan = TaiKhoanLogic.SelectTheoTenDangNhap(txtTenDangNhap.Text);
                        GlobalSettings.UserID   = _taikhoan.TaiKhoanId;//TaiKhoanLogic.FullUserID(_taikhoan);
                        GlobalSettings.UserCode = txtTenDangNhap.Text.Trim().ToLower();
                        GlobalSettings.UserName = TaiKhoanLogic.FullUserName(_taikhoan);
                        GlobalSettings.UserType = (UserType)TaiKhoanLogic.FullUserType(_taikhoan);

                        //Settings.Default.Login_UserName = txtTenDangNhap.Text;
                        //Settings.Default.Login_Password = txtMatKhau.Text;
                        //Settings.Default.Save();
                        Base.KiemTraLicense.KiemTraLicenseHopLe();
                        LoadDuLieuSauKhiDangNhap();
                    }
                    else
                    {
                        lblNotification.Text = "Tên đăng nhập hoặc mật khẩu không chính xác";
                        System.Media.SystemSounds.Exclamation.Play();
                    }
                }
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Error(ex);
            }
        }
Example #3
0
 public frmDoiMatKhau(string userName)
 {
     InitializeComponent();
     this.currentUser = TaiKhoanLogic.SelectTheoTenDangNhap(userName);
 }