private void bt_them_phong_Click(object sender, EventArgs e) { if (txt_tendv.Text != "" && txt_gia.Text != "") { string querycheck = "SELECT count([ID]) FROM t_dichvu WHERE ([Ten] like N'%" + txt_tendv.Text + "%')"; ql_dichvu_DTO qldv = new ql_dichvu_DTO(lb_temp.Text, txt_tendv.Text, cb_loaidv.SelectedValue.ToString(), txt_gia.Text); if (ql_dichvu_BUS.Instance.checktrung(querycheck) == false) { if (ql_dichvu_BUS.Instance.themdv(qldv)) { MessageBox.Show("Bạn đã thêm thành công dịch vụ " + txt_tendv.Text); load_dgv(); } else { MessageBox.Show("Rất tiếc, thêm không thành công"); } } else { MessageBox.Show("Dịch vụ này đã tồn tại"); } } else { MessageBox.Show("Mời nhập đầy đủ thông tin"); } }
public DataTable timdichvu(ql_dichvu_DTO qldv) { string query = "SELECT * FROM t_dichvu WHERE ID like N'%" + qldv.Temp + "%' or Ten like N'%" + qldv.Temp + "%' or Dongia like N'%" + qldv.Temp + "%' or Idloai like N'%" + qldv.Temp + "%'"; DataTable result = new DataTable(); result = processdata.Instance.ExecuteQuery(query); return(result); }
public bool suadichvu(ql_dichvu_DTO qldv) { string query = "UPDATE t_dichvu SET Ten=N'" + qldv.Tendv + "',Idloai=N'" + qldv.Idloai + "',Dongia =N'" + qldv.Gia + "' WHERE ID ='" + qldv.Madv + "'"; if (processdata.Instance.ExecuteNonQuery(query)) { return(true); } else { return(false); } }
public bool xoadichvu(ql_dichvu_DTO qldv) { string query = "DELETE FROM t_dichvu WHERE ID = '" + qldv.Temp + "'"; if (processdata.Instance.ExecuteNonQuery(query)) { return(true); } else { return(false); } }
public bool themdichvu(ql_dichvu_DTO qldv) { string query = "INSERT INTO t_dichvu VALUES(N'" + qldv.Tendv + "',N'" + qldv.Idloai + "',N'" + qldv.Gia + "')"; if (processdata.Instance.ExecuteNonQuery(query)) { return(true); } else { return(false); } }
private void bt_sua_phong_Click(object sender, EventArgs e) { if (txt_tendv.Text != "" && txt_gia.Text != "") { ql_dichvu_DTO qldv = new ql_dichvu_DTO(lb_temp.Text, txt_tendv.Text, cb_loaidv.SelectedValue.ToString(), txt_gia.Text); if (ql_dichvu_BUS.Instance.suadichvu(qldv)) { MessageBox.Show("Bạn đã sửa thành công dịch vụ : " + txt_tendv.Text); load_dgv(); } else { MessageBox.Show("Rất tiếc, Sửa không thành công"); } } else { MessageBox.Show("Mời bạn nhập đầy đủ thông tin", "Thông báo"); } }
private void bt_xoaphong_Click(object sender, EventArgs e) { if (lb_temp.Text != "") { ql_dichvu_DTO dv = new ql_dichvu_DTO(lb_temp.Text); DialogResult ok = MessageBox.Show("Bạn có muốn xóa dịch vụ có mã " + lb_temp.Text, "Thông Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (ok == DialogResult.Yes) { if (ql_dichvu_BUS.Instance.xoadv(dv)) { MessageBox.Show("Bạn đã xóa thành công dịch vụ mã " + lb_temp.Text); load_dgv(); } else { MessageBox.Show("Rất tiếc, Xóa không thành công"); } } } else { MessageBox.Show("Mời bạn chọn đối tượng muốn xóa", "Thông báo"); } }
public bool suadichvu(ql_dichvu_DTO qldv) { return(ql_dichvu_DAO.Instance.suadichvu(qldv)); }
public DataTable timdv(ql_dichvu_DTO qldv) { return(ql_dichvu_DAO.Instance.timdichvu(qldv)); }
public bool xoadv(ql_dichvu_DTO qldv) { return(ql_dichvu_DAO.Instance.xoadichvu(qldv)); }
public bool themdv(ql_dichvu_DTO qldv) { return(ql_dichvu_DAO.Instance.themdichvu(qldv)); }