public bool Insert_DoiBong(DoiBong entity)
        {
            SqlParameter[] pa = new SqlParameter[4];
            string ma = "DB";
            int madb = 0;
            if (string.Compare(entity.Madb, "") != 0 )
            {
                madb = int.Parse(entity.Madb.Replace("DB", ""));
            }
            madb ++ ;
            if (madb < 10)
            {
                entity.Madb = ma + "0" + madb;
            }
            else
            {
                entity.Madb = ma + madb;
            }

            pa[0] = new SqlParameter("@madb", entity.Madb);
            pa[1] = new SqlParameter("@tendb", entity.Tendb);
            pa[2] = new SqlParameter("@masan", entity.Masan);
            pa[3] = new SqlParameter("@diachi", entity.Diachi);
            return SQLProvider.Execute_NonQuery("insert_DoiBong", pa);//true;
        }
        public DoiBong GetValueForm()
        {
            DoiBong db = new DoiBong();
            if(mode == 1 || mode == 3)
            {
                int ma = dataGridView1.Rows.Count;
                if (ma > 0)
                {
                    db.Madb = dataGridView1.Rows[ma - 1].Cells[0].Value.ToString();
                }
                else
                {
                    db.Madb = "";
                }
            }
            else
            {
                db.Madb = tbMaDB.Text;
            }
            db.Tendb = this.tbTenDB.Text;
            DB_TimMaSan_dataGridView2.DataSource = ql.TimMaSanTheoTen(cbbMaSan.Text);
            db.Diachi = this.tbDiaChi.Text;

            if (DB_TimMaSan_dataGridView2[0, 0].Value != null)
            db.Masan = DB_TimMaSan_dataGridView2[0, 0].Value.ToString();
                      
            return db;
        }
 public bool Update_DoiBong(DoiBong entity)
 {
     SqlParameter[] pa = new SqlParameter[4];
     pa[0] = new SqlParameter("@madb_1", entity.Madb);
     pa[1] = new SqlParameter("@tendb_3", entity.Tendb);
     pa[2] = new SqlParameter("@masan_5", entity.Masan);
     pa[3] = new SqlParameter("@diachi_4", entity.Diachi);
     return SQLProvider.Execute_NonQuery("update_DoiBong", pa);
 }
        private void btXoa_Click(object sender, EventArgs e)
        {
            mode = 2;
            int flg = 0;
            foreach (DataGridViewRow item in dataGridView1.SelectedRows)
            {
                DoiBong db = new DoiBong();
                db.Madb = item.Cells[0].Value.ToString();
                if (ql.Delete_DoiBong(db))
                {
                    flg = 1;
                }
                dataGridView1.Rows.RemoveAt(item.Index);
            }

            if (flg == 1)
            {
                MessageBox.Show("Xoá đội bóng thành công");
                this.ChiTietDanhSachDoiBong_Load(sender, e);
            }
            else
            {
                MessageBox.Show("Qúa trình thực hiện thất bại");
            }
        }
 public bool Update_DoiBong(DoiBong db)
 {
     return adapter.Update_DoiBong(db);
 }
 public bool Delete_DoiBong(DoiBong db)
 {
     return adapter.Delete_DoiBong(db);
 }
 public bool Insert_DoiBong(DoiBong db)
 {
     return adapter.Insert_DoiBong(db);
 }
 public bool Delete_DoiBong(DoiBong entity)
 {
     SqlParameter[] pa = new SqlParameter[1];
     pa[0] = new SqlParameter("@madb", entity.Madb);
     return SQLProvider.Execute_NonQuery("delete_DoiBong", pa);//true;
 }