public static int InsertHN(HeathMonitoringNote newHN) { String sqlInsert = @"INSERT INTO HEATHMONITORINGNOTE(PATIENTID, STAFFID, DATE, WEIGHT, BLOODPRESSURE, PATIENTSTATE) VALUES (@PATIENTID,@STAFFID,@DATE,@WEIGHT,@BLOODPRESSURE,@PATIENTSTATE)"; SqlParameter[] sqlParameters = { new SqlParameter("@PATIENTID", newHN.PatientID), new SqlParameter("@STAFFID", newHN.StaffID), new SqlParameter("@DATE", newHN.Date), new SqlParameter("@WEIGHT", newHN.Weight), new SqlParameter("@BLOODPRESSURE", newHN.BloodPressure), new SqlParameter("@PATIENTSTATE",newHN.PatientState)}; return SqlResult.ExecuteNonQuery(sqlInsert, sqlParameters); }
private void buttonOk_Click(object sender, System.EventArgs e) { if(!superValidator1.Validate()) return; if (Patient.IsPatientExist(int.Parse(textBoxPatientID.Text))) { try { if (UserAction == "edit") { HeathMonitoringNote newHN = new HeathMonitoringNote(); newHN.HNID = int.Parse(textBoxHNID.Text); newHN.PatientID = int.Parse(textBoxPatientID.Text); newHN.StaffID = int.Parse(textBoxStaffID.Text); newHN.PatientState = textBoxPatientState.Text; newHN.Weight = textBoxWeight.Text; newHN.BloodPressure = textBoxBloodPressure.Text; newHN.Date = dateCreate.Value; DialogResult dialogResult = MessageBox.Show("Xác nhận cập nhập thông tin phiếu theo dõi sức khỏe", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) { if (HeathMonitoringNote.UpdateHN(newHN) > 0) MessageBox.Show("Cập nhập thông tin phiếu theo dõi sức khỏe thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { HeathMonitoringNote newHN = new HeathMonitoringNote(); newHN.HNID = 0; newHN.PatientID = int.Parse(textBoxPatientID.Text); newHN.StaffID = int.Parse(textBoxStaffID.Text); newHN.PatientState = textBoxPatientState.Text; newHN.Weight = textBoxWeight.Text; newHN.BloodPressure = textBoxBloodPressure.Text; newHN.Date = dateCreate.Value; if(HeathMonitoringNote.InsertHN(newHN)>0) MessageBox.Show("Thêm phiếu theo dõi sức khỏe thành công thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch { MessageBox.Show("Lỗi dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.Close(); } else { MessageBox.Show("Thiếu thông tin", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public static int UpdateHN(HeathMonitoringNote updateHN) { string sqlUpdate = @"UPDATE HEATHMONITORINGNOTE SET PATIENTID =@PATIENTID, DATE =@DATE, WEIGHT =@WEIGHT, BLOODPRESSURE =@BLOODPRESSURE, PATIENTSTATE =@PATIENTSTATE WHERE HNID=@HNID "; SqlParameter[] sqlParameters = { new SqlParameter("@HNID", updateHN.HNID), new SqlParameter("@PATIENTID", updateHN.PatientID), new SqlParameter("@DATE", updateHN.Date), new SqlParameter("@WEIGHT", updateHN.Weight), new SqlParameter("@BLOODPRESSURE", updateHN.BloodPressure), new SqlParameter("@PATIENTSTATE", updateHN.PatientState)}; return SqlResult.ExecuteNonQuery(sqlUpdate, sqlParameters); }
//This constructor for update in Heath Note Management public FormHNDetail(HeathMonitoringNote hnDetail, String userAction) { InitializeComponent(); this.UserAction = userAction; textBoxHNID.Text = hnDetail.HNID.ToString(); textBoxPatientID.Text = hnDetail.PatientID.ToString(); textBoxStaffID.Text = hnDetail.StaffID.ToString(); dateCreate.Value = hnDetail.Date; textBoxPatientState.Text = hnDetail.PatientState; textBoxBloodPressure.Text = hnDetail.BloodPressure; textBoxWeight.Text = hnDetail.Weight; }
public static int InsertHN(HeathMonitoringNote newHN) { String sqlInsert = @"INSERT INTO HEATHMONITORINGNOTE(PATIENTID, STAFFID, DATE, WEIGHT, BLOODPRESSURE, PATIENTSTATE) VALUES (@PATIENTID,@STAFFID,@DATE,@WEIGHT,@BLOODPRESSURE,@PATIENTSTATE)"; SqlParameter[] sqlParameters = { new SqlParameter("@PATIENTID", newHN.PatientID), new SqlParameter("@STAFFID", newHN.StaffID), new SqlParameter("@DATE", newHN.Date), new SqlParameter("@WEIGHT", newHN.Weight), new SqlParameter("@BLOODPRESSURE", newHN.BloodPressure), new SqlParameter("@PATIENTSTATE", newHN.PatientState) }; return(SqlResult.ExecuteNonQuery(sqlInsert, sqlParameters)); }
public static int UpdateHN(HeathMonitoringNote updateHN) { string sqlUpdate = @"UPDATE HEATHMONITORINGNOTE SET PATIENTID =@PATIENTID, DATE =@DATE, WEIGHT =@WEIGHT, BLOODPRESSURE =@BLOODPRESSURE, PATIENTSTATE =@PATIENTSTATE WHERE HNID=@HNID "; SqlParameter[] sqlParameters = { new SqlParameter("@HNID", updateHN.HNID), new SqlParameter("@PATIENTID", updateHN.PatientID), new SqlParameter("@DATE", updateHN.Date), new SqlParameter("@WEIGHT", updateHN.Weight), new SqlParameter("@BLOODPRESSURE", updateHN.BloodPressure), new SqlParameter("@PATIENTSTATE", updateHN.PatientState) }; return(SqlResult.ExecuteNonQuery(sqlUpdate, sqlParameters)); }
public static HeathMonitoringNote GetHN(int hNID) { HeathMonitoringNote hN = new HeathMonitoringNote(); string sqlSelect = @"SELECT HNID, PATIENTID, STAFFID, DATE, WEIGHT, BLOODPRESSURE, PATIENTSTATE FROM HEATHMONITORINGNOTE WHERE HNID=@HNID"; SqlParameter[] sqlParameters = { new SqlParameter("@HNID", hNID) }; DataTable dataTable = SqlResult.ExecuteQuery(sqlSelect, sqlParameters); if (dataTable.Rows.Count > 0) { hN.HNID = Convert.ToInt32(dataTable.Rows[0][0]); hN.PatientID = Convert.ToInt32(dataTable.Rows[0][1]); hN.StaffID = Convert.ToInt32(dataTable.Rows[0][2]); hN.Date = (DateTime)dataTable.Rows[0][3]; hN.Weight = (String)dataTable.Rows[0][4]; hN.BloodPressure = (String)dataTable.Rows[0][5]; hN.PatientState = (String)dataTable.Rows[0][6]; } return(hN); }
public static HeathMonitoringNote GetHN(int hNID) { HeathMonitoringNote hN = new HeathMonitoringNote(); string sqlSelect = @"SELECT HNID, PATIENTID, STAFFID, DATE, WEIGHT, BLOODPRESSURE, PATIENTSTATE FROM HEATHMONITORINGNOTE WHERE HNID=@HNID"; SqlParameter[] sqlParameters = { new SqlParameter("@HNID", hNID) }; DataTable dataTable = SqlResult.ExecuteQuery(sqlSelect, sqlParameters); if (dataTable.Rows.Count > 0) { hN.HNID = Convert.ToInt32(dataTable.Rows[0][0]); hN.PatientID = Convert.ToInt32(dataTable.Rows[0][1]); hN.StaffID = Convert.ToInt32(dataTable.Rows[0][2]); hN.Date = (DateTime)dataTable.Rows[0][3]; hN.Weight = (String)dataTable.Rows[0][4]; hN.BloodPressure = (String)dataTable.Rows[0][5]; hN.PatientState = (String)dataTable.Rows[0][6]; } return hN; }