public NewPatientForm(Database.patient patient) { InitializeComponent(); // Set window form name to patients name this.Text = patient.patLastName + ", " + patient.patFirstName; m_patient = patient; m_isNewMode = false; // Update mode // Turn on update only tool strip buttons tsbAppointments.Visible = true; tsbBill.Visible = true; tsbStats.Visible = true; }
public void selectPatient(int patID) { m_nPatientID = patID; m_currentPatient = m_patMgr.getPatient(m_nPatientID); txtPatientName.Text = m_currentPatient.patFirstName + ", " + m_currentPatient.patLastName; }
private void tsbSave_Click(object sender, EventArgs e) { // Form validation if (!ValidateChildren()) { return; } //Setup the patient table object Database.patient patient; if (m_isNewMode) { patient = new Database.patient(); } else { // Since I wrote this class all stupid and have context mixing issues that hack needs to be here/ // I'll fix it later patient = (from pat in m_context.patients where pat.patID == m_patient.patID select pat).First(); } //Inject the data from winform patient.patFirstName = txtFirstName.Text; patient.patLastName = txtLastName.Text; patient.patSex = cbSex.SelectedIndex == 1; patient.patHealthCard = txtHealthCard.Text; //if(cbInsProvider.SelectedIndex != 0) //{ // patient.patInsuranceNum = txtInsurranceNumber.Text; // patient.ipID = Convert.ToInt32(cbInsProvider.SelectedValue); //} patient.patInsuranceProv = txtInsrProv.Text; patient.patAddress = txtAddress.Text; patient.patAddress2 = txtAddress2.Text; patient.patPhoneNumber = txtPhone.Text; patient.patMobileNumber = txtMobile.Text; patient.patSecNumber = txtSecPhone.Text; patient.patPCode = txtPCode.Text; patient.patFlag = txtFlag.Text; patient.patBirthday = dtBirthday.Value; patient.patReferedBy = txtReferedBy.Text; patient.patCity = txtCity.Text; patient.iso = (String)cbCountry.SelectedValue; patient.patProv = txtProv.Text; patient.patNotes = txtNotes.Text; patient.docID = (cbDoctors.SelectedIndex != -1) ? Convert.ToInt32(cbDoctors.SelectedValue) : 1; patient.patActive = true; patient.patDateCreate = DateTime.Now; // Save the newly created parient to the entity dataset if (m_isNewMode) { m_context.AddTopatients(patient); } m_context.SaveChanges(); MessageBox.Show("Saved", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); Utility.clearControls(Controls); }
private void selectPatient(int patID) { m_nPatientID = patID; m_currentPatient = m_patMgr.getPatient(m_nPatientID); txtPatientName.Text = m_currentPatient.patFirstName + ", " + m_currentPatient.patLastName; setDoctor(); }
private void btnSearch_Click(object sender, EventArgs e) { ManagePatientsForm frmPat = new ManagePatientsForm(true); DialogResult r = frmPat.ShowDialog(); if (r == DialogResult.OK) { int patID = frmPat.SelectedID; Patient = m_patMgr.getPatient(frmPat.SelectedID); } }
private void btnCommit_Click(object sender, EventArgs e) { if (m_patient != null) { decimal amount = Math.Round(Convert.ToDecimal(txtAmount.Text), 2); int payID = m_payMgr.insertPayment(amount, Convert.ToInt32(cbPaymentType.SelectedValue), m_patient.patID, (int)cbDoctor.SelectedValue, mcDate.SelectionStart); refreshGrid(); m_patient = null; txtAmount.Text = String.Empty; Patient = null; // Clears patient object, combobox and text field cbPaymentType.SelectedIndex = 0; } else { MessageBox.Show("Select an client first"); } if (m_closeAfterCommit) Close(); }