private void btnRefer_Click(object sender, EventArgs e)
 {
     try
     {
         frmReferToDoctor frt = new frmReferToDoctor(Int32.Parse(txtDoctorID.Text.Trim()), Int32.Parse(txtAppID.Text.Trim()), Int32.Parse(txtPatientID.Text.Trim()));
         frt.ShowDialog(this);
     }
     catch (Exception ex)
     {
         CommonLogger.Info(ex.ToString());
     }
 }
Exemple #2
0
        private void SelectPatient(string pid, string pnum)
        {
            try
            {
                txtPatientID.Text = pid;
                txtPatNum.Text    = pnum;

                /* SJ COMMENTED ON 12FEB2019
                 * MessageBox.Show("Please select the Doctor");
                 * cmbDoc.Focus();
                 ****/

                frmReferToDoctor frt = new frmReferToDoctor(Int32.Parse(txtPatientID.Text.Trim()));
                frt.ShowDialog(this);
            }
            catch (Exception ex)
            {
                CommonLogger.Info(ex.ToString());
            }
        }
Exemple #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateChildren(ValidationConstraints.Enabled))
                {
                    int  logged_in_user = LoggedUser.id;
                    int  rtn            = -1;
                    int  exists         = -1;
                    char gender;
                    if (rbGender1.Checked == true)
                    {
                        gender = 'M';
                    }
                    else
                    {
                        gender = 'F';
                    }

                    /*
                     * char patient_type;
                     * if (rbInpatient.Checked == true)
                     *  patient_type = 'I';
                     * else
                     *  patient_type = 'O';
                     */
                    if (txtID.Text.Trim() == "") //add data
                    {
                        dtpPathakaExpiry.Visible = true;
                        exists = pat.existPatients(txtFirstName.Text.Trim(), txtLastName.Text.Trim(), gender, Convert.ToDateTime(dtpDob.Text), txtNationality.Text.Trim(), txtPhone.Text.Trim());
                        if (exists <= 0)
                        {
                            rtn = pat.addPatients(txtFirstName.Text.Trim(), txtLastName.Text.Trim(), gender, Convert.ToDateTime(dtpDob.Text), txtNationality.Text, txtPathaka.Text, Convert.ToDateTime(dtpPathakaExpiry.Text), txtAddress.Text, txtCity.Text, txtDistrict.Text, txtZip.Text, txtPhone.Text, txtEmail.Text, txtHistory.Text, txtAllergies.Text, logged_in_user, Convert.ToInt32(txtAgeYr.Text));

                            if (rtn >= 1)
                            {
                                ShowStatus(1, "Record succesfully added. ");
                                clearFormFields();
                                if (chkAppointment.Checked == true)
                                {
                                    frmReferToDoctor frt = new frmReferToDoctor(rtn);
                                    frt.ShowDialog(this);

                                    /*
                                     * SJ COMMENTED ON 12FEB2019
                                     * Instead of redirecting to appt form,
                                     * if (LoggedUser.type_name.ToUpper() == "DOCTOR")
                                     * {
                                     *  if (Application.OpenForms.OfType<frmConsultations>().Count() == 1)
                                     *      Application.OpenForms.OfType<frmConsultations>().First().BringToFront();
                                     *  else
                                     *  {
                                     *      frmConsultations frm = new frmConsultations();
                                     *      frm.MdiParent = this.ParentForm;
                                     *      frm.Show();
                                     *  }
                                     * }
                                     * else
                                     * {
                                     *
                                     *  if (Application.OpenForms.OfType<frmAppointments>().Count() == 1)
                                     *      Application.OpenForms.OfType<frmAppointments>().First().BringToFront();
                                     *  else
                                     *  {
                                     *      frmAppointments app = new frmAppointments(rtn);
                                     *      app.MdiParent = this.ParentForm;
                                     *      app.Show();
                                     *  }
                                     * }
                                     */
                                }
                            }
                            else if (rtn == -1)
                            {
                                ShowStatus(0, "Some error occurred... Record cannot be added.");
                            }
                        }
                        else
                        {
                            ShowStatus(0, "Patient already exists, cannot be added.");
                        }
                    }
                    else //edit record
                    {
                        rtn = pat.editPatients(Int32.Parse(txtID.Text), txtFirstName.Text.Trim(), txtLastName.Text.Trim(), gender, Convert.ToDateTime(dtpDob.Text), txtNationality.Text, txtPathaka.Text, Convert.ToDateTime(dtpPathakaExpiry.Text), txtAddress.Text, txtCity.Text, txtDistrict.Text, txtZip.Text, txtPhone.Text, txtEmail.Text, txtHistory.Text, txtAllergies.Text, logged_in_user, Int32.Parse(txtAgeYr.Text));

                        if (rtn > -1)
                        {
                            ShowStatus(1, "Record succesfully updated");
                            clearFormFields();
                        }
                        else if (rtn == -1)
                        {
                            ShowStatus(0, "Some error occurred... Record cannot be added.");
                        }
                    }
                }
                //dtpPathakaExpiry.Visible = false;
            }
            catch (Exception ex)
            {
                CommonLogger.Info(ex.ToString());
            }
        }