Exemple #1
0
        private void textBox20_TextChanged(object sender, EventArgs e)
        {
            if (textBox20.Text == "")
            {
                label36.Text      = "Validate Medical Staff ID";
                label36.ForeColor = Color.Black;
                label36.Visible   = false;
            }
            else
            {
                DbConnector dbConn = new DbConnector();
                dbConn.connect();

                MedicalStaffHandler mStaffHnd = new MedicalStaffHandler();
                bool goCheckStaffId           = mStaffHnd.checkStaffId(dbConn.getConn(), textBox20.Text);

                if (goCheckStaffId == true)
                {
                    label36.Text      = "Valid Staff ID";
                    label36.ForeColor = Color.Green;
                    label36.Visible   = true;

                    dateTimePicker1_ValueChanged(null, e);
                }
                else if (goCheckStaffId == false)
                {
                    label36.Text      = "Invalid Staff ID";
                    label36.ForeColor = Color.Red;
                    label36.Visible   = true;
                }
            }
        }
Exemple #2
0
        private void textBox21_TextChanged(object sender, EventArgs e)
        {
            if (textBox21.Text == "")
            {
                label41.Text      = "Validate Medical Staff ID";
                label41.ForeColor = Color.Black;
                label41.Visible   = false;
                comboBox7.Enabled = false;
                comboBox8.Enabled = false;
            }
            else
            {
                DbConnector dbConn = new DbConnector();
                dbConn.connect();

                MedicalStaffHandler mStaffHnd = new MedicalStaffHandler();
                bool goCheckStaffId           = mStaffHnd.checkStaffId(dbConn.getConn(), textBox21.Text);

                if (goCheckStaffId == true)
                {
                    label41.Text      = "Valid Staff ID";
                    label41.ForeColor = Color.Green;
                    label41.Visible   = true;
                    comboBox7.Enabled = true;

                    OnShift        oShift    = new OnShift();
                    OnShiftHandler oShiftHnd = new OnShiftHandler();

                    oShift.StaffId = textBox21.Text;

                    comboBox7.DataSource = oShiftHnd.showDate(dbConn.getConn(), oShift);
                }
                else if (goCheckStaffId == false)
                {
                    label41.Text      = "Invalid Staff ID";
                    label41.ForeColor = Color.Red;
                    label41.Visible   = true;

                    comboBox7.Enabled       = false;
                    comboBox8.Enabled       = false;
                    comboBox7.SelectedIndex = 0;
                    comboBox8.SelectedIndex = 0;
                }
            }
        }
Exemple #3
0
        public void medicalStaffDBtable(int num)
        {
            DbConnector dbConn = new DbConnector();

            dbConn.connect();

            MedicalStaff        mStaff    = new MedicalStaff();
            MedicalStaffHandler mStaffHnd = new MedicalStaffHandler();

            if (num == 1)
            {
                mStaff.Name = textBox13.Text;
            }
            else if (num == 2)
            {
                mStaff.Career = "%";
            }

            dataGridView2.DataSource = mStaffHnd.listStaff(dbConn.getConn(), mStaff, num);

            dataGridView2.Columns[0].HeaderText = "ID";
            dataGridView2.Columns[1].HeaderText = "STAFF ID";
            dataGridView2.Columns[2].HeaderText = "NAME";
            dataGridView2.Columns[3].HeaderText = "PASSWORD";
            dataGridView2.Columns[4].HeaderText = "CAREER TYPE";
            dataGridView2.Columns[5].HeaderText = "EMAIL";
            dataGridView2.Columns[6].HeaderText = "CONTACT NUMBER";
            dataGridView2.Columns[7].HeaderText = "PAGER NUMBER";
            dataGridView2.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridView2.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridView2.Columns[0].AutoSizeMode    = DataGridViewAutoSizeColumnMode.Fill;
            dataGridView2.Columns[1].AutoSizeMode    = DataGridViewAutoSizeColumnMode.Fill;
            dataGridView2.Columns[2].AutoSizeMode    = DataGridViewAutoSizeColumnMode.Fill;
            dataGridView2.Columns[3].AutoSizeMode    = DataGridViewAutoSizeColumnMode.Fill;
            dataGridView2.Columns[4].AutoSizeMode    = DataGridViewAutoSizeColumnMode.Fill;
            dataGridView2.Columns[5].AutoSizeMode    = DataGridViewAutoSizeColumnMode.Fill;
            dataGridView2.Columns[6].AutoSizeMode    = DataGridViewAutoSizeColumnMode.Fill;
            dataGridView2.Columns[7].AutoSizeMode    = DataGridViewAutoSizeColumnMode.Fill;
        }
Exemple #4
0
        //Onclick "Login" button verify username & password and navigate to Bedside System Page
        private void button1_Click(object sender, EventArgs e)
        {
            DbConnector dbConn = new DbConnector();

            dbConn.connect();

            MedicalStaff        mStaff    = new MedicalStaff();
            MedicalStaffHandler mStaffHnd = new MedicalStaffHandler();

            mStaff.Staffid  = textBox1.Text;
            mStaff.Password = textBox2.Text;

            if ((mStaffHnd.checkMedicalStaffLoginDetail(dbConn.getConn(), mStaff)) == true)
            {
                Central_Station central_station = new Central_Station();
                central_station.Show();
                //this.Close();
            }
            else
            {
                MessageBox.Show("Invalid Username or Password.");
            }
        }
Exemple #5
0
        //Add new medical staff button
        private void button7_Click(object sender, EventArgs e)
        {
            DbConnector dbConn = new DbConnector();

            dbConn.connect();

            MedicalStaff        mStaff    = new MedicalStaff();
            MedicalStaffHandler mStaffHnd = new MedicalStaffHandler();

            bool verifyCareer = false;

            if (textBox14.Text != "" && textBox15.Text != "" && textBox16.Text != "" &&
                (comboBox6.SelectedItem).ToString() != "- SELECT CAREER -")
            {
                if ((comboBox6.SelectedItem).ToString() == "Consultant")
                {
                    if (textBox17.Text != "")
                    {
                        verifyCareer = true;
                    }
                    else
                    {
                        MessageBox.Show("Invalid format for Email !");
                    }
                }
                else if ((comboBox6.SelectedItem).ToString() == "Doctor" || (comboBox6.SelectedItem).ToString() == "Nurse")
                {
                    if (int.TryParse(textBox18.Text, out int theContact))
                    {
                        if (int.TryParse(textBox19.Text, out int thePager))
                        {
                            verifyCareer = true;
                        }
                        else
                        {
                            MessageBox.Show("Invalid format for Pager Number !");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Invalid format for Contact Number!");
                    }
                }
                else
                {
                    MessageBox.Show("Please select a type of career.");
                }

                if (verifyCareer == true)
                {
                    mStaff.Staffid  = textBox14.Text;
                    mStaff.Name     = textBox15.Text;
                    mStaff.Password = textBox16.Text;
                    mStaff.Email    = textBox17.Text;
                    mStaff.Contact  = textBox18.Text;
                    mStaff.Pager    = textBox19.Text;
                    mStaff.Career   = (comboBox6.SelectedItem).ToString();

                    int recordCnt = mStaffHnd.addNewMedicalStaff(dbConn.getConn(), mStaff);
                    MessageBox.Show(recordCnt + " Medical Staff Registered Successfully !");

                    textBox14.Text = "";
                    textBox15.Text = "";
                    textBox16.Text = "";
                    textBox17.Text = "";
                    textBox18.Text = "";
                    textBox19.Text = "";

                    comboBox6.SelectedIndex = 0;

                    medicalStaffDBtable(1);
                }
            }
            else
            {
                MessageBox.Show("Please fill up all fields to register.");
            }
        }