Пример #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()
Пример #2
0
        private void btnClear_Click(object sender, EventArgs e)
        {
            textDocFirst.Clear();
            textDocMiddle.Clear();
            textStaffLast.Clear();
            cboGender.SelectedIndex = 0;
            textContact.Clear();
            textUsername.Clear();
            textPassword.Clear();
            cboUserType.SelectedIndex = 0;

            try
            {
                string sql = "SELECT strStaffID " +
                             "FROM tblStaff " +
                             "ORDER BY strStaffID DESC " +
                             "LIMIT 1;";
                MySqlCommand    cmd    = new MySqlCommand(sql, conn);
                MySqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    textDocID.Text     = SmartCounter.NextInt(reader.GetString("strStaffID"));
                    textDocID.ReadOnly = true;
                    isFirst            = false;
                }

                reader.Close();
            }
            catch (MySqlException me)
            {
                Integrity.GetExceptionDetails(me);
            }
            catch (Exception ex)
            {
                Integrity.GetExceptionDetails(ex);
            }

            if (isFirst)
            {
                textDocID.Clear();
            }
        }
Пример #3
0
        public CtrlAddStaff(MySqlConnection conn, string userID)
        {
            InitializeComponent();

            this.cboGender.SelectedIndex   = 0;
            this.cboUserType.SelectedIndex = 0;

            this.conn   = conn;
            this.userID = userID;

            try
            {
                string sql = "SELECT strStaffID " +
                             "FROM tblStaff " +
                             "ORDER BY strStaffID DESC " +
                             "LIMIT 1;";
                MySqlCommand    cmd    = new MySqlCommand(sql, conn);
                MySqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    textDocID.Text     = SmartCounter.NextInt(reader.GetString("strStaffID"));
                    textDocID.ReadOnly = true;
                    isFirst            = false;
                }

                reader.Close();
            }
            catch (MySqlException me)
            {
                Integrity.GetExceptionDetails(me);
            }
            catch (Exception ex)
            {
                Integrity.GetExceptionDetails(ex);
            }
        }