Ejemplo n.º 1
0
 private void dgvCuocPhi_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgvCuocPhi.Columns[e.ColumnIndex].Name == "xem_Cuoc" && e.RowIndex > -1)//Xem
     {
         FormCuocPhi.state  = 1;
         FormCuocPhi.MaCuoc = Convert.ToInt32(dgvCuocPhi.Rows[e.RowIndex].Cells["macuocphi"].Value);
         FormCuocPhi frm = new FormCuocPhi();
         frm.ShowDialog();
         dgvCuocPhi.DataSource = balCuoc.GetAll();
     }
     else if (dgvCuocPhi.Columns[e.ColumnIndex].Name == "sua_Cuoc" && e.RowIndex > -1)//Sửa
     {
         FormCuocPhi.state  = -1;
         FormCuocPhi.MaCuoc = Convert.ToInt32(dgvCuocPhi.Rows[e.RowIndex].Cells["macuocphi"].Value);
         FormCuocPhi frm = new FormCuocPhi();
         frm.ShowDialog();
         dgvCuocPhi.DataSource = balCuoc.GetAll();
     }
     else if (dgvCuocPhi.Columns[e.ColumnIndex].Name == "xoa_Cuoc" && e.RowIndex > -1)//Xóa
     {
         if (DialogResult.Yes == MessageBox.Show("Bạn muốn xóa dữ liệu trên?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
         {
             try
             {
                 balCuoc.XoaCuocPhi(Convert.ToInt32(dgvCuocPhi.Rows[e.RowIndex].Cells["macuocphi"].Value));
                 MessageBox.Show("Xóa dữ liệu thành công.", "Thông báo");
                 dgvCuocPhi.DataSource = balCuoc.GetAll();
             }
             catch (Exception ex)
             { MessageBox.Show("Xóa dữ liệu thất bại.\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); }
         }
     }
 }
Ejemplo n.º 2
0
        private void mniThemCuocPhi_Click(object sender, EventArgs e)
        {
            FormCuocPhi.state = 0;
            FormCuocPhi frm = new FormCuocPhi();

            frm.ShowDialog();
        }
Ejemplo n.º 3
0
        private void btnThem_Cuoc_Click(object sender, EventArgs e)
        {
            FormCuocPhi.state = 0;
            FormCuocPhi frm = new FormCuocPhi();

            frm.ShowDialog();
            dgvCuocPhi.DataSource = balCuoc.GetAll();
        }
Ejemplo n.º 4
0
 private void dgvCuocPhi_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgvCuocPhi.Columns[e.ColumnIndex].Name == "xem_Cuoc" && e.RowIndex > -1)
     {
         FormCuocPhi.state  = 1;
         FormCuocPhi.MaCuoc = Convert.ToInt32(dgvCuocPhi.Rows[e.RowIndex].Cells["macuocphi"].Value);
         FormCuocPhi frm = new FormCuocPhi();
         frm.ShowDialog();
     }
 }
Ejemplo n.º 5
0
 private void dgvCuocPhi_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgvCuocPhi.Columns[e.ColumnIndex].Name == "xem" && e.RowIndex > -1)
     {
         FormCuocPhi.state  = 1;
         FormCuocPhi.MaCuoc = Convert.ToInt32(dgvCuocPhi.Rows[e.RowIndex].Cells["macuocphi"].Value);
         FormCuocPhi frm = new FormCuocPhi();
         frm.ShowDialog();
     }
     else if (dgvCuocPhi.Columns[e.ColumnIndex].Name == "chon" && e.RowIndex > -1)
     {
         if (dgvCuocPhi.Rows[e.RowIndex].Cells["chon"].Value.ToString() == "Chọn")
         {
             dgvCuocPhi.Rows[e.RowIndex].Cells["chon"].Value    = "Đã chọn";
             dgvCuocPhi.Rows[e.RowIndex].Cells["soluong"].Value = 1;
         }
         else
         {
             dgvCuocPhi.Rows[e.RowIndex].Cells["chon"].Value    = "Chọn";
             dgvCuocPhi.Rows[e.RowIndex].Cells["soluong"].Value = 0;
         }
     }
     else if (dgvCuocPhi.Columns[e.ColumnIndex].Name == "tang" && e.RowIndex > -1)
     {
         int soluong = Convert.ToInt32(dgvCuocPhi.Rows[e.RowIndex].Cells["soluong"].Value);
         dgvCuocPhi.Rows[e.RowIndex].Cells["soluong"].Value = soluong + 1;
     }
     else if (dgvCuocPhi.Columns[e.ColumnIndex].Name == "giam" && e.RowIndex > -1)
     {
         if (Convert.ToInt32(dgvCuocPhi.Rows[e.RowIndex].Cells["soluong"].Value) > 0)
         {
             int soluong = Convert.ToInt32(dgvCuocPhi.Rows[e.RowIndex].Cells["soluong"].Value);
             dgvCuocPhi.Rows[e.RowIndex].Cells["soluong"].Value = soluong - 1;
         }
     }
 }