private void btnLuuPhieuKham_Click(object sender, EventArgs e) { if (dataGridViewPhieuKham.CurrentRow == null) { MessageBox.Show("Vui lòng chọn bệnh nhân"); return; } if (txtTrieuChung.Text == "") { MessageBox.Show("Vui lòng nhập triệu chứng"); return; } PhieuKham pk = new PhieuKham(); pk.MaPhieuKham = Int32.Parse(dataGridViewPhieuKham.CurrentRow.Cells[0].Value.ToString()); pk.MaBenhNhan = Int32.Parse(dataGridViewPhieuKham.CurrentRow.Cells[1].Value.ToString()); pk.MaNhanVien = Int32.Parse(dataGridViewPhieuKham.CurrentRow.Cells[2].Value.ToString()); pk.NgayKham = Convert.ToDateTime(dataGridViewPhieuKham.CurrentRow.Cells[3].Value.ToString()); pk.TrieuChung = txtTrieuChung.Text; pk.TrangThai = "Đã chẩn đoán"; phieuKhamServices.Update(pk); int mapk = Int32.Parse(dataGridViewPhieuKham.CurrentRow.Cells[0].Value.ToString()); foreach (DataGridViewRow row in dataGridViewChiTietBenh.Rows) { ChiTietBenh ctb = new ChiTietBenh(); int mabenh = Int32.Parse(row.Cells[1].Value.ToString()); ctb.MaBenh = mabenh; ctb.MaPhieuKham = mapk; chiTietBenhServices.Insert(ctb); } modelPhieuKhamBindingSource.DataSource = phieuKhamServices.GetModelUncompletedByIdDoctor(2); MessageBox.Show("Lưu thành công"); }
public void Update(ChiTietBenh entity) { ChiTietBenh ctb = unitOfWork.ChiTietBenhs.GetById(entity.STT); ctb.MaBenh = entity.MaBenh; ctb.MaPhieuKham = entity.MaPhieuKham; unitOfWork.Complete(); }
public void Insert(ChiTietBenh entity) { unitOfWork.ChiTietBenhs.Insert(entity); unitOfWork.Complete(); }
public void Delete(ChiTietBenh entity) { unitOfWork.ChiTietBenhs.Delete(entity); unitOfWork.Complete(); }