private void PatientScreen_Load(object sender, EventArgs e)
        {
            viewControlPanel.Width     = 879;
            viewControlPanel.Height    = 365;
            viewControlPanel.Location  = new Point(5, 195);
            addRecordPanel.Width       = 879;
            addRecordPanel.Height      = 365;
            addRecordPanel.Location    = new Point(5, 195);
            updateRecordPanel.Width    = 879;
            updateRecordPanel.Height   = 365;
            updateRecordPanel.Location = new Point(5, 195);
            deleteRecordPanel.Width    = 879;
            deleteRecordPanel.Height   = 365;
            deleteRecordPanel.Location = new Point(5, 195);
            DBConnector dBconn = new DBConnector();

            dBconn.connect();

            PatientHandler patientHandler = new PatientHandler();

            patientGridView.DataSource = patientHandler.getAllPatient(dBconn.getConn());

            viewControlPanel.Show();
            addRecordPanel.Hide();
            updateRecordPanel.Hide();
            deleteRecordPanel.Hide();
        }
        public PatientScreen()
        {
            InitializeComponent();
            genderComboBox.SelectedIndex = 0;
            DBConnector dBConn = new DBConnector();

            dBConn.connect();
            PatientHandler patientHandler = new PatientHandler();

            patientGridView.DataSource = patientHandler.getAllPatient(dBConn.getConn());
        }
        //-----------------------------------------------------------Add Record----------------------------------------------------------------------------//
        private void viewRecordBtn_Click(object sender, EventArgs e)
        {
            DBConnector dBconn = new DBConnector();

            dBconn.connect();

            PatientHandler patientHandler = new PatientHandler();

            patientGridView.DataSource = patientHandler.getAllPatient(dBconn.getConn());
            viewControlPanel.Show();
            addRecordPanel.Hide();
            updateRecordPanel.Hide();
            deleteRecordPanel.Hide();
        }
        private void choosePatientComboBox_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                if (choosePatientIDUpdateComboBox.SelectedIndex == 0)
                {
                    MessageBox.Show("Please select valid ID");
                }
                else
                {
                    nricUpdateTextBox.Enabled      = true;
                    fullNameUpdateTextBox.Enabled  = true;
                    emailUpdateTextBox.Enabled     = true;
                    genderUpdatecomboBox.Enabled   = true;
                    phoneUpdateTextBox.Enabled     = true;
                    addressUpdateTextBox.Enabled   = true;
                    ageUpdateTextBox.Enabled       = true;
                    bedsideIdUpdateTextBox.Enabled = true;
                    genderUpdatecomboBox.Items.Add("Male");
                    genderUpdatecomboBox.Items.Add("Female");
                    DBConnector dbC = new DBConnector();
                    dbC.connect();
                    PatientHandler patientHandler = new PatientHandler();
                    List <Patient> patientList    = new List <Patient>();
                    patientList = patientHandler.getAllPatient(dbC.getConn());
                    for (int i = 0; i < patientList.Count; i++)
                    {
                        if (choosePatientIDUpdateComboBox.SelectedItem.ToString() == patientList[i].Id.ToString())
                        {
                            nricUpdateTextBox.Text     = patientList[i].IdentityCard.ToString();
                            fullNameUpdateTextBox.Text = patientList[i].FullName;
                            emailUpdateTextBox.Text    = patientList[i].Email;

                            for (int n = 0; n < genderUpdatecomboBox.Items.Count; n++)
                            {
                                if (patientList[i].Gender == genderUpdatecomboBox.Items[n].ToString())
                                {
                                    genderUpdatecomboBox.SelectedIndex = n;
                                }
                            }

                            phoneUpdateTextBox.Text     = patientList[i].Phone.ToString();
                            addressUpdateTextBox.Text   = patientList[i].Address;
                            ageUpdateTextBox.Text       = patientList[i].Age.ToString();
                            bedsideIdUpdateTextBox.Text = patientList[i].BedsideId.ToString();
                        }
                    }
                }
            }
        }
        //public int alterTable(MySqlConnection conn, int id)
        //{
        //    string sql = "ALTER TABLE patient AUTO INCREMENT= '" + id + "'";
        //    MySqlCommand alterCommand = new MySqlCommand(sql, conn);
        //    return alterCommand.ExecuteNonQuery();
        //}

        public void FetchId(ComboBox selectedcomboBox)
        {
            selectedcomboBox.Items.Add("--Select ID--");

            selectedcomboBox.SelectedIndex = 0;
            DBConnector dbC = new DBConnector();

            dbC.connect();
            PatientHandler patientHandler = new PatientHandler();
            List <Patient> patientList    = new List <Patient>();

            patientList = patientHandler.getAllPatient(dbC.getConn());
            for (int i = 0; i < patientList.Count; i++)
            {
                selectedcomboBox.Items.Add(patientList[i].Id);
            }
        }