Example #1
0
 private void btnConnect_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtSvName.Text) || string.IsNullOrWhiteSpace(txtSvName.Text))
     {
         MessageBox.Show("Chưa nhập Server Name");
         return;
     }
     if (string.IsNullOrEmpty(txtDBName.Text) || string.IsNullOrWhiteSpace(txtDBName.Text))
     {
         MessageBox.Show("Chưa nhập Database Name");
         return;
     }
     _dbConn = new dbConnection(txtSvName.Text, txtDBName.Text, txtUser.Text, txtPass.Text);
     if (_dbConn.IsAvailable())
     {
         MessageBox.Show("Kết nối thành công");
         quanAnBus                = new QuanAnBUS(_dbConn);
         grvQuanLy.DataSource     = quanAnBus.getAllRestaurant();
         tabControl.SelectedIndex = 0;
     }
     else
     {
         MessageBox.Show("Không thể kết nối Database");
     }
 }
Example #2
0
 private void btnTestConnect_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtSvName.Text) || string.IsNullOrWhiteSpace(txtSvName.Text))
     {
         MessageBox.Show("Chưa nhập Server Name");
         return;
     }
     if (string.IsNullOrEmpty(txtDBName.Text) || string.IsNullOrWhiteSpace(txtDBName.Text))
     {
         MessageBox.Show("Chưa nhập Database Name");
         return;
     }
     _dbConn = new dbConnection(txtSvName.Text, txtDBName.Text, txtUser.Text, txtPass.Text);
     if (_dbConn.IsAvailable())
     {
         MessageBox.Show("Database có thể kết nối");
     }
     else
     {
         MessageBox.Show("Không thể kết nối Database");
     }
 }
 public QuanLyQuanAnRepository(dbConnection dbcon)
 {
     this.conn = dbcon;
 }
 public QuanLyQuanAnRepository(string svName, string dbName, string username, string password)
 {
     conn = new dbConnection(svName, dbName, username, password);
 }
Example #5
0
 public void createConnect(dbConnection conn)
 {
     qlRepo = new QuanLyQuanAnRepository(conn);
 }
Example #6
0
 public QuanAnBUS(dbConnection conn)
 {
     qlRepo = new QuanLyQuanAnRepository(conn);
 }