public static int UpdateBill(Bill updateBill) { string sqlUpdate = @"UPDATE BILL SET STATE = @STATE, TOTALPRICE = @TOTALPRICE WHERE BILLID=@BILLID"; SqlParameter[] sqlParameters = { new SqlParameter("@BILLID", updateBill.BillID), new SqlParameter("@STATE",updateBill.State), new SqlParameter("@TOTALPRICE",updateBill.TotalPrice)}; return SqlResult.ExecuteNonQuery(sqlUpdate, sqlParameters); }
public static int InsertBill(Bill newBill) { String sqlInsert = @"INSERT INTO BILL(BILLTYPEID, PATIENTID, STAFFID, DATE, STATE, TOTALPRICE) VALUES (@BILLTYPEID, @PATIENTID, @STAFFID, @DATE, @STATE, @TOTALPRICE)"; SqlParameter[] sqlParameters = { new SqlParameter("@BILLTYPEID", newBill.BillTypeID), new SqlParameter("@PATIENTID", newBill.PatientID), new SqlParameter("@STAFFID", newBill.StaffID), new SqlParameter("@DATE", newBill.Date), new SqlParameter("@STATE", newBill.State), new SqlParameter("@TOTALPRICE", newBill.TotalPrice)}; return SqlResult.ExecuteNonQuery(sqlInsert, sqlParameters); }
public FormBillDetail(string userAction, Bill bill) { InitializeComponent(); // Set useraction and bill this.BillDetail = bill; this.UserAction = userAction; this.StaffDetail = Staff.GetStaff(BillDetail.StaffID); this.PatientDetail = Patient.GetPatient(BillDetail.PatientID); reFreshForm(); }
private void buttonPatientService_Click(object sender, EventArgs e) { if (dataViewPatient.SelectedRows.Count > 0) { int patientID = Convert.ToInt32(dataViewPatient.SelectedRows[0].Cells[0].Value); //Current user int staffID = loginStaff.StaffID; Bill newBill = new Bill(Bill.SERVICEBILL, patientID, staffID); FormBillDetail billDetailForm = new FormBillDetail("insert", newBill); billDetailForm.ShowDialog(); } }
private void buttonPatientMaterial_Click(object sender, EventArgs e) { if (dataViewPatient.SelectedRows.Count > 0) { int patientID = Convert.ToInt32(dataViewPatient.SelectedRows[0].Cells[0].Value); if (Patient.GetPatient(patientID).State == 1) { //Current user int staffID = loginStaff.StaffID; Bill newBill = new Bill(Bill.MATERIALBILL, patientID, staffID); FormBillDetail billDetailForm = new FormBillDetail("insert", newBill); billDetailForm.ShowDialog(); } else { MessageBox.Show("Bệnh nhân chưa nhập viện nên không được phép mượn vật tư", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
public static Bill GetBill(int billID) { Bill newBill = new Bill(); string sqlSelect = @"SELECT BILLID, BILLTYPEID, PATIENTID, STAFFID, DATE, TOTALPRICE, STATE FROM BILL WHERE BILLID=@BILLID"; SqlParameter[] sqlParameters = { new SqlParameter("@BILLID", billID) }; DataTable dataTable = SqlResult.ExecuteQuery(sqlSelect, sqlParameters); if (dataTable.Rows.Count > 0) { newBill.BillID = Convert.ToInt32(dataTable.Rows[0]["BILLID"].ToString()); newBill.BillTypeID = Convert.ToInt32(dataTable.Rows[0]["BILLTYPEID"].ToString()); newBill.PatientID = Convert.ToInt32(dataTable.Rows[0]["PATIENTID"]); newBill.StaffID = Convert.ToInt32(dataTable.Rows[0]["STAFFID"]); newBill.Date = (DateTime)dataTable.Rows[0]["DATE"]; newBill.TotalPrice = (decimal)dataTable.Rows[0]["TOTALPRICE"]; newBill.State = (int)dataTable.Rows[0]["STATE"]; } return newBill; }
private void buttonPrescriptionSell_Click(object sender, EventArgs e) { if (dataViewPrescription.SelectedRows.Count > 0) { int prescriptionID = Convert.ToInt32(dataViewPrescription.SelectedRows[0].Cells[0].Value); int patientID = Convert.ToInt32(Prescription.GetPatientIDInPrescription(prescriptionID).Rows[0][0]); int staffID = loginStaff.StaffID; Bill newBill = new Bill(Bill.MEDICINEBILL, patientID, staffID); FormBillDetail billDetailForm = new FormBillDetail("insert", newBill, prescriptionID); billDetailForm.ShowDialog(); } }
private void buttonOk_Click(object sender, System.EventArgs e) { try { if (!superValidator1.Validate()) { return; } if (this.UserAction.Equals("edit")) { ExaminationCertificate newEC = new ExaminationCertificate(); newEC = this.ECDetail; newEC.Result = textBoxResult.Text; newEC.State = comboBoxState.SelectedIndex; newEC.Date = dateCreate.Value; DialogResult dialogResult = MessageBox.Show("Xác nhận cập nhập thông tin phiếu khám bệnh", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult == DialogResult.Yes) { if (ExaminationCertificate.UpdateEC(newEC) > 0) MessageBox.Show("Cập nhập thông tin phiếu khám bệnh thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if (this.UserAction == "updateResult") { ExaminationCertificate newEC = new ExaminationCertificate(); newEC.ECID = Convert.ToInt32(textBoxECID.Text); newEC.PatientID = Convert.ToInt32(textBoxPatientID.Text); newEC.StaffID = Convert.ToInt32(textBoxStaffID.Text); newEC.State = 1; newEC.Date = dateCreate.Value; newEC.Result = textBoxResult.Text; if (ExaminationCertificate.UpdateEC(newEC) > 0) MessageBox.Show("Cập nhập kết quả khám bệnh thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { ExaminationCertificate newEC = new ExaminationCertificate(); newEC.ECID = 0; newEC.PatientID = Convert.ToInt32(textBoxPatientID.Text); newEC.StaffID = Convert.ToInt32(textBoxStaffID.Text); newEC.State = comboBoxState.SelectedIndex; newEC.Date = dateCreate.Value; newEC.Result = textBoxResult.Text; if (ExaminationCertificate.InsertEC(newEC) > 0) { FormReport reportForm = new FormReport(); reportForm.ReportType = "EC"; reportForm.ObjectID = ExaminationCertificate.GetCurrentECID(); reportForm.ShowDialog(); int patientID = newEC.PatientID; //Current user int staffID = LoginStaff.StaffID; Bill newBill = new Bill(Bill.SERVICEBILL, patientID, staffID); FormBillDetail billDetailForm = new FormBillDetail("insertExamination", newBill); billDetailForm.ShowDialog(); } } } catch { MessageBox.Show("Lỗi dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.Close(); }