public Add(bool updateStatus, String nic, StaffRegistration home, DataGridView tblsearch, DataGridView tblalert, Label indicator)
        {
            InitializeComponent();

            this.updateStatus = updateStatus;
            this.nic          = nic;
            h = home;
            this.tblsearch = tblsearch;
            this.tblalert  = tblalert;
            this.indicator = indicator;
        }
Exemple #2
0
        public void reoad()
        {
            StaffRegistration s = new StaffRegistration();

            s.StartPosition = FormStartPosition.WindowsDefaultBounds;
            //s.Left = 250;
            //s.Top = 130;

            s.MdiParent = this.MdiParent;
            s.Show();
            this.Close();
        }
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                MySqlCommand cmd = conn.connConnection().CreateCommand();
                cmd = conn.connConnection().CreateCommand();
                cmd = new MySqlCommand("SELECT * FROM `user` WHERE `User Name` = @1", conn.connConnection());
                cmd.Parameters.AddWithValue("@1", txtUserName.Text);


                conn.connOpen();
                conn.connConnection();


                MySqlDataReader reader1;


                reader1 = cmd.ExecuteReader();

                if (reader1.Read())
                {
                    // MessageBox.Show("test");
                    if (txtPassword.Text.Equals(reader1["Password"].ToString()))
                    {
                        StaffRegistration sr = new StaffRegistration();

                        sr.ShowDialog();
                        this.Dispose();
                    }
                    else
                    {
                        MessageBox.Show("Invalid username or password");
                    }
                }
                else
                {
                    MessageBox.Show("Invalid username or password");
                }



                reader1.Close();
                cmd.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }