private void btnTimKiem_Click(object sender, EventArgs e) { if (cbTimKiem.Text == "Theo Mã Dich Vụ") { dgvDichVu.DataSource = dvbus.TimKiemDichVu(" SELECT * FROM DichVu where Ma_DV like '%" + txtTimKiem.Text + "%'"); } if (cbTimKiem.Text == "Theo Tên Dịch Vụ") { dgvDichVu.DataSource = dvbus.TimKiemDichVu(" SELECT * FROM DichVu where Ten_DV like '%" + txtTimKiem.Text + "%'"); } if (cbTimKiem.Text == "Theo Giá Dịch Vụ") { dgvDichVu.DataSource = dvbus.TimKiemDichVu(" SELECT * FROM DichVu where Gia_DV like '%" + txtTimKiem.Text + "%'"); } }
private void dgvChiTietPhieuMua_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (dgvDichVuMua.Rows[dongDGV].Cells[2].Value != "" && dgvDichVuMua.Rows[dongDGV].Cells[3].Value != "") { try { string a = (int.Parse(dgvDichVuMua.Rows[dongDGV].Cells[2].Value.ToString()) * int.Parse(dgvDichVuMua.Rows[dongDGV].Cells[3].Value.ToString())).ToString(); // msds.Rows[dong].Cells[3].Value = (double.Parse(msds.Rows[dong].Cells[1].Value.ToString()) * double.Parse(msds.Rows[dong].Cells[2].Value.ToString())).ToString(); dgvDichVuMua.Rows[dongDGV].Cells[4].Value = a; } catch (Exception ex) { // MessageBox.Show("Lỗi/n" + ex); } } try { DataTable dt = new DataTable(); dt = busDichVu.TimKiemDichVu(" Select *from DichVu where Ma_DV = '" + dgvDichVuMua.Rows[dongDGV].Cells[1].Value.ToString() + "'"); dgvDichVuMua.Rows[dongDGV].Cells[3].Value = double.Parse(dt.Rows[0]["Gia_DV"].ToString()).ToString(); } catch (Exception ex) { //MessageBox.Show("Lỗi/n" + ex); } }
private void txttimkiem_TextChanged(object sender, EventArgs e) { dgvdichvu.DataSource = dv.TimKiemDichVu(txttimkiem.Text); }