Ejemplo n.º 1
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            string connectionString     = "Data Source=" + cboIP.Text.Trim() + ";Initial Catalog= QuanLyChungCu" + ";User ID=" + txtTaiKhoanDB.Text.Trim() + ";Password="******"";
            DataLinqDataContext context = new DataLinqDataContext(connectionString);

            try
            {
                PropertieConst.connectionString = connectionString;
                PropertieConst.accountDB        = txtTaiKhoanDB.Text.Trim();
                PropertieConst.passDB           = txtMatKhauDB.Text.Trim();
                var userLogin = context.kiemtraDangNhap(PropertieConst.accountDB, PropertieConst.passDB).FirstOrDefault();
                PropertieConst.quyen = userLogin.quyen;
                OnEventConnection();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Thông tin kết nối tới cơ sở dữ liệu không chính xác !", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }