Ejemplo n.º 1
0
        private void UpdatePatientID()
        {
            /* SQL Query Variable(s) */
            string sql = "SELECT strPatientID " +
                         "FROM tblPatient " +
                         "ORDER BY strPatientID DESC " +
                         "LIMIT 1;";
            bool            first  = true;
            MySqlCommand    cmd    = null;
            MySqlDataReader reader = null;

            /* Function Member Variable(s) */
            string lastID = "";

            try
            {
                cmd    = new MySqlCommand(sql, conn);
                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    lastID = reader.GetString("strPatientID");
                    first  = false;
                }

                reader.Close();

                if (first)
                {
                    this.isPrime        = true;
                    lblPatIDVal.Visible = false;
                }
                else
                {
                    this.isPrime        = false;
                    textPatID.Visible   = false;
                    lblPatIDVal.Visible = true;

                    lblPatIDVal.Text = SmartCounter.NextInt(lastID);

                    pboQR.BackgroundImage = QuickRead.GenerateQR(lblPatIDVal.Text.Trim());
                    pboQR.Visible         = true;
                }
            }
            catch (MySqlException me)
            {
                Integrity.GetExceptionDetails(me);
            }
            catch (Exception me)
            {
                Integrity.GetExceptionDetails(me);
            }
        } // private void UpdatePatientID()
Ejemplo n.º 2
0
        } // Action[Validate]: CtrlRegi

        private void textPatID_Leave(object sender, EventArgs e)
        {
            if (!textPatID.Text.Trim().Equals(""))
            {
                if (isPrime)
                {
                    pboQR.BackgroundImage = QuickRead.GenerateQR(textPatID.Text.Trim());
                    pboQR.Visible         = true;
                }
                else
                {
                    pboQR.BackgroundImage = QuickRead.GenerateQR(lblPatID.Text.Trim());
                    pboQR.Visible         = true;
                }
            }
        } // Action[Leave] : textPatID
Ejemplo n.º 3
0
        public void UpdatePatientInfo()
        {
            string patientType = "";
            string guardID     = "";

            string sql = "SELECT * FROM tblPatient WHERE strPatientID = '" + patientID + "';";

            try
            {
                /* Patient Main Info */
                MySqlCommand cmd = new MySqlCommand(sql, conn);
                cmd.Prepare();
                MySqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    lblPatIDVal.Text   = reader.GetString("strPatientID");
                    lblIDNoVal.Text    = reader.GetString("strIDNumber");
                    lblPatNameVal.Text = reader.GetString("strPatientLastName") + ", " +
                                         reader.GetString("strPatientFirstName") + " " +
                                         reader.GetString("strPatientMiddleName");
                    lblBirthdateVal.Text = reader.GetDateTime("dtmDateOfBirth").ToString("MM / dd / yyyy");
                    lblGenderVal.Text    = reader.GetString("strGender");
                    lblContactNoVal.Text = reader.GetString("strPatientContactNumber");

                    guardID = reader.GetString("strGuardianID");

                    textPatNo.Text         = reader.GetString("strIDNumber");
                    textPatFirstName.Text  = reader.GetString("strPatientFirstName");
                    textPatLastName.Text   = reader.GetString("strPatientLastName");
                    textPatMiddleName.Text = reader.GetString("strPatientMiddleName");
                    datBirthdate.Value     = reader.GetDateTime("dtmDateOfBirth");
                    cboGender.SelectedText = reader.GetString("strGender");
                    textPatCont.Text       = reader.GetString("strPatientContactNumber");

                    cboGender.SelectedIndex = 0;
                }

                reader.Close();

                /* Patient Address Info */
                sql    = "SELECT * FROM tblHomeAddress WHERE strPatientID = '" + patientID + "';";
                cmd    = new MySqlCommand(sql, conn);
                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    lblAddressVal.Text = reader.GetString("strHomeAddress") + ", " +
                                         reader.GetString("strCity") + ", " +
                                         reader.GetString("strProvince") + ", " +
                                         reader.GetString("strRegion");

                    textHomeAddress.Text = reader.GetString("strHomeAddress");
                    textCity.Text        = reader.GetString("strCity");
                    textProvince.Text    = reader.GetString("strProvince");
                    textRegion.Text      = reader.GetString("strRegion");
                }

                reader.Close();

                /* Guardian Info */
                sql    = "SELECT * FROM tblGuardian WHERE strGuardianID = '" + guardID + "';";
                cmd    = new MySqlCommand(sql, conn);
                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    lblGuardNameVal.Text = reader.GetString("strLastName") + ", " +
                                           reader.GetString("strFirstName") + " " +
                                           reader.GetString("strMiddleName");
                    lblGuardContactNoVal.Text = reader.GetString("strContact");
                    lblRelationVal.Text       = reader.GetString("strRelation");

                    textGuardFirst.Text  = reader.GetString("strFirstName");
                    textGuardMiddle.Text = reader.GetString("strMiddleName");
                    textGuardLast.Text   = reader.GetString("strLastName");
                    textGuardCont.Text   = reader.GetString("strContact");
                    textRelation.Text    = reader.GetString("strRelation");
                }

                reader.Close();

                /* Get Patient Sub Info */
                sql    = "SELECT * FROM tblPatientType WHERE strPatientID = '" + patientID + "';";
                cmd    = new MySqlCommand(sql, conn);
                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    patientType            = reader.GetString("strTypeDesc");
                    lblPatientTypeVal.Text = reader.GetString("strTypeDesc");
                }

                reader.Close();

                if (patientType.ToUpper().Equals("STUDENT"))
                {
                    lblCourse.Text = "Course:";

                    sql = "SELECT a.strCollegeDesc, b.strCourseDesc " +
                          "FROM tblCollege a, tblCourse b, tblPatientType c " +
                          "WHERE a.strCollegeCode = c.strCollegeCode AND " +
                          "b.strCourseCode = c.strCourseCode AND " +
                          "c.strPatientID = '" + patientID + "';";
                    cmd    = new MySqlCommand(sql, conn);
                    reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        lblCollegeVal.Text = reader.GetString("strCollegeDesc");
                        lblCourseVal.Text  = reader.GetString("strCourseDesc");

                        //cboCollege.SelectedText = reader.GetString("strCollegeDesc");
                        //cboCourse.SelectedText = reader.GetString("strCourseDesc");
                    }

                    reader.Close();
                }
                else if (patientType.ToUpper().Equals("PROFESSOR"))
                {
                    lblCourse.Text = "Department:";

                    sql = "SELECT a.strCollegeDesc, b.strDeptDesc " +
                          "FROM tblCollege a, tblDepartment b, tblPatientType c " +
                          "WHERE a.strCollegeCode = c.strCollegeCode AND " +
                          "b.strDeptCode = c.strDeptCode AND " +
                          "c.strPatientID = '" + patientID + "';";
                    cmd    = new MySqlCommand(sql, conn);
                    reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        lblCollegeVal.Text = reader.GetString("strCollegeDesc");
                        lblCourseVal.Text  = reader.GetString("strDeptDesc");

                        //cboCollege.SelectedText = reader.GetString("strCollegeDesc");
                        //cboCourse.SelectedText = reader.GetString("strDeptDesc");
                    }

                    reader.Close();
                }
                else
                {
                    lblCollege.Visible    = false;
                    lblCollegeVal.Visible = false;

                    lblCourse.Text = "Department:";

                    sql = "SELECT a.strDesc " +
                          "FROM tblStaffDepartment a, tblPatientType b " +
                          "WHERE a.strStaffDeptCode = b.strStaffDeptCode AND " +
                          "b.strPatientID = '" + patientID + "';";
                    cmd    = new MySqlCommand(sql, conn);
                    reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        lblCourseVal.Text = reader.GetString("strDesc");

                        //cboCourse.SelectedText(reader.GetString("strDesc"));
                    }

                    reader.Close();

                    lblCourse.Text = "Department:";
                }

                pboQR.BackgroundImage      = QuickRead.GenerateQR(patientID.Trim());
                pboPrintQR.BackgroundImage = QuickRead.GenerateQR(patientID.Trim());
            }
            catch (MySqlException me)
            {
                Integrity.GetExceptionDetails(me);
            }
            catch (Exception ex)
            {
                Integrity.GetExceptionDetails(ex);
            }

            lblPrintName.Text  = textPatLastName.Text + "\n" + textPatFirstName.Text + " " + textPatMiddleName.Text;
            lblPrintID.Text    = lblIDNoVal.Text;
            lblPrintPatID.Text = lblPatIDVal.Text;
        }