public RegPatient(Patient patient) { InitializeComponent(); initialiseCombos(); btnClear.Visible = false; try { txtPatientId.Text = patient.PatientId.ToString(); txtFirstName.Text = patient.FirstName; txtMiddlename.Text = patient.MiddleName; txtSurname.Text = patient.Surname; cbxNumberOfChildren.SelectedIndex = patient.NumberOfChildren; dtcDateOfBirth.Text = patient.DateOfBirth.Date.ToString(); dateOfAssesment.Text = patient.AssesmentDate.Date.ToString(); cbxBreadWinner.SelectedItem = patient.BreadWinner; cbxPositionInFamily.SelectedItem = patient.PositionInFamily; cbxMaritalStatus.SelectedItem = patient.MaritalStatus; cbxSex.SelectedItem = patient.Sex; txtNrcNumber.Text = patient.NrcNumber; txtReligion.Text = patient.Religion; cbxParish.SelectedItem = patient.Parish; cbxSection.SelectedItem = patient.Section; cbxCompound.SelectedItem = patient.Compound; } catch(Exception ex) { } }
public PatientSummary(Patient patient, Login p) { parent = p; InitializeComponent(); this.patient = patient; //PopulateDataGridView(); secure(); }
private void RegPatient_Enter(object sender, EventArgs e) { if (Entity.CurrentPatient==null) { pat = new Patient(); //pat.PatientId = Entity.generateNewPatientId(); } else { //Entity.CurrentPatient = new Patient(); //pat = new } }
private void btnSave_Click(object sender, EventArgs e) { if(txtPatientId.Text=="") { string temp = "doesntexist"; pat=new Patient(); pat.PatientId = Int32.Parse(Entity.validatePatientID(temp)); } else { pat = Entity.CurrentPatient; pat.PatientId = Int32.Parse(txtPatientId.Text); } pat.FirstName = txtFirstName.Text; pat.Surname = txtSurname.Text; pat.MiddleName = txtMiddlename.Text; pat.DateOfBirth = dtcDateOfBirth.Value; pat.Sex = cbxSex.Text; pat.Compound = cbxCompound.Text; pat.NrcNumber = txtNrcNumber.Text; pat.PositionInFamily = cbxPositionInFamily.Text; pat.Parish = cbxParish.Text; pat.Section = cbxSection.Text; pat.BreadWinner = cbxBreadWinner.Text; pat.Religion = txtReligion.Text; try { pat.NumberOfChildren = Int32.Parse(cbxNumberOfChildren.Text); }catch(Exception ex) { pat.NumberOfChildren = 0; } pat.MaritalStatus = cbxMaritalStatus.Text; pat.AssesmentDate = dateOfAssesment.Value; Entity.saveReg(pat); Entity.CurrentPatient = pat; parent.SetUserControl(new PatientSummary(Entity.CurrentPatient,parent)); }
public static void ClearCurrentState() { _currentPatient = null; CurrentSiteId = -1; CurrentUser = null; }
public static void saveReg(Patient patient) { string query; if (!patIdExist(patient.PatientId)) { query = string.Format(@"INSERT INTO registration VALUES({0},'{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}')", patient.PatientId, Utility.parseString(patient.FirstName), Utility.parseString(patient.Surname), patient.MiddleName, formartDateForMySQL(patient.DateOfBirth), patient.Sex, patient.Compound, patient.NrcNumber, patient.PositionInFamily, patient.Parish, patient.Section, patient.BreadWinner, patient.NumberOfChildren, patient.MaritalStatus, formartDateForMySQL(patient.AssesmentDate), patient.Religion); } else { query = string.Format(@"UPDATE registration SET patientID={0},firstname='{1}',surname='{2}',middle_name='{3}',dateofbirth='{4}',sex='{5}',compound='{6}',nrc_number='{7}',position_in_family='{8}',parish='{9}',section='{10}',bread_winner='{11}',number_of_children={12},marital_status='{13}',assesment_date='{14}', religion='{15}' where patientId={0}", patient.PatientId, Utility.parseString(patient.FirstName), patient.Surname, patient.MiddleName, formartDateForMySQL(patient.DateOfBirth), patient.Sex, patient.Compound, patient.NrcNumber, patient.PositionInFamily, patient.Parish, patient.Section, patient.BreadWinner, patient.NumberOfChildren, patient.MaritalStatus, formartDateForMySQL(patient.AssesmentDate), patient.Religion); } db.runNonQuery(query); }
public static void savePatientToDb(Patient patient) { saveReg(patient); //saveVisitsInfo(patient); }
public static Patient LoadReg(string patientid) { Patient pa = new Patient(); return pa; }
public static Patient loadPatient(int patientId) { string query = string.Format(@"select patientID,firstname,surname,middle_name,dateofbirth,sex,compound,nrc_number,position_in_family,parish,section,bread_winner,number_of_children,marital_status,assesment_date, religion from registration where patientid={0}", patientId); string[] loadPat = db.singleRow(query); int count = 0; CurrentPatient = new Patient(Int32.Parse(loadPat[0]), loadPat[1], loadPat[2], loadPat[3], DateTime.Parse(loadPat[4]), loadPat[5], loadPat[6], loadPat[7], loadPat[8], loadPat[9], loadPat[10], loadPat[11], Int32.Parse(loadPat[12]), loadPat[13], DateTime.Parse(loadPat[14]), loadPat[15]); Entity.CurrentPatient.Visits = loadPatientVisits(Entity.CurrentPatient.PatientId); return CurrentPatient; }