Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            PatientService patientService = new PatientService();
            patientService.save(createPatientFromForm());

            owner.Fill_GridView();
            this.Close();
        }
Ejemplo n.º 2
0
        public bool delete_patient()
        {
            string name = patients_dataGridView.CurrentRow.Cells["name"].Value.ToString();
             DialogResult dialogresult = MessageBox.Show(
            "Are you sure you want to delete patient \""+name+"\" from the database?",
            "Confirm delete", MessageBoxButtons.OKCancel);

             if(dialogresult == DialogResult.OK) {
            int id = Int32.Parse(patients_dataGridView.CurrentRow.Cells["id"].Value.ToString());
            PatientService patientservice = new PatientService();
            patientservice.deletePatient(id);
            patients_dataGridView.Rows.Remove(patients_dataGridView.CurrentRow);
            return true;
             }
             return false;
        }
Ejemplo n.º 3
0
        public PatientInfoForm(int id, Home _owner)
        {
            InitializeComponent();
            owner = _owner;
            var service = new PatientService();
            patient = service.getPatientById(id);
            name_txt.Text = patient.name;
            id_txt.Text = patient.id.ToString();
            age_txt.Text = patient.dateOfBirth != DateTime.MinValue ?
                service.dateofBirthToAge(patient.dateOfBirth).ToString() : "";
            gender_txt.Text = patient.gender;
            phone_txt.Text = patient.phone;
            if (patient.medical_history != null)
            {
               medicalHistory_txt.Text = patient.medical_history + ".";
            }
            else
            {
               medicalHistory_txt.Text = "None.";
            }

            fillGridView();
            edit_visit_btn.Enabled = true;
        }
Ejemplo n.º 4
0
        private void fillFormFromPatient(int id)
        {
            var service = new PatientService();
            Patient patient = service.getPatientById(id);
            fillCheckBoxList();
            name_txt.Text = patient.name;
            phone_txt.Text = patient.phone;
            age_text.Text = patient.dateOfBirth != DateTime.MinValue ?
                service.dateofBirthToAge(patient.dateOfBirth).ToString() : "";

            if(patient.gender=="Male")gender_ComboBox.SelectedIndex = 0;
            else gender_ComboBox.SelectedIndex = 1;

            String history = patient.medical_history;
            if (history != null)
            {
                var splitted = history.Split(new[] { ", " },StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < disease_checklist.Items.Count; i++)
                {
                    foreach (String disease in splitted)
                    {
                        if (disease == (string)disease_checklist.Items[i])
                        {
                            disease_checklist.SetItemChecked(i, true);
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
 private void save_edits_btn_Click(object sender, EventArgs e)
 {
     PatientService patientService = new PatientService();
     patientService.update(gid, createPatientFromForm());
     owner.Fill_GridView();
     this.Close();
 }
Ejemplo n.º 6
0
 private DataTable queryPatientDb()
 {
     PatientService patientService = new PatientService();
      return patientService.getAllPatients();
 }