private void btncancel_Click(object sender, EventArgs e)
        {
            txtuserid.Clear();
            this.Hide();
            frmlogin frm = new frmlogin();

            frm.Show();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            db_connection();
            this.Hide();
            frmlogin frm = new frmlogin();

            frm.Show();
        }
        private void metroTile15_Click_2(object sender, EventArgs e)
        {
            MessageBox.Show("Goodbye", "JobCard System", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Visible = false;
            this.Hide();
            frmlogin frm = new frmlogin();

            frm.Show();
        }
        private void btnsubmit_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtuserid.Text))
            {
                MetroFramework.MetroMessageBox.Show(this, "Empty fields detected", "Automated Technical workshop System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (txtuserid.Text.Length < 7)
            {
                MetroFramework.MetroMessageBox.Show(this, "ID No length not valid!", "Automated Technical workshop System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            else
            {
                try
                {
                    db_connection();
                    MySqlCommand     cmd = new MySqlCommand("select * from login where idno = '" + txtuserid.Text + "'", connect);
                    MySqlDataAdapter da  = new MySqlDataAdapter(cmd);
                    DataSet          ds1 = new DataSet();
                    da.Fill(ds1);
                    int i = ds1.Tables [0].Rows.Count;
                    if (i > 0)
                    {
                        //MessageBox.Show ("Record exists");
                        MetroFramework.MetroMessageBox.Show(this, "User exists proceed to reset your password");
                        clear();
                        this.Hide();
                        frmnewpassword frm = new frmnewpassword();
                        frm.Show();

                        /* if (result == DialogResult.Yes)
                         * {
                         *   frmnewpassword frm = new frmnewpassword ();
                         *   frm.Show ();
                         *   //this.Hide ();
                         *   //code for Yes
                         * }*/
                        // Exist
                    }
                    else
                    {
                        MetroFramework.MetroMessageBox.Show(this, "User does not exists contact admin to create your account", "TWMS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        clear();
                        this.Hide();
                        frmlogin frm = new frmlogin();
                        frm.Show();
                    }
                }
                catch (Exception ex)
                {
                    writeErrorLog(ex.Message);
                }
            }
        }
        /// <summary>
        /// Intialization of the timer event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timer1_Tick(object sender, EventArgs e)
        {
            DialogResult dialogresult = MetroFramework.MetroMessageBox.Show(this, "Session timeout!,do you want to continue using it", "Automated Job  Card System", MessageBoxButtons.YesNo, MessageBoxIcon.Error);

            if (dialogresult == DialogResult.Yes)
            {
                //timer1.Start ();

                frmlogin At = new frmlogin();
                At.Show();
                this.Hide();
                // return;
            }
            else if (dialogresult == DialogResult.No)
            {
                MessageBox.Show("Goodbye", "Time Elapsed");
                this.Close();
            }
        }
        private void calllogin()
        {
            frmlogin login = new frmlogin();

            login.Show();
        }