Example #1
0
        private void loginlbl_Click(object sender, EventArgs e)
        {
            if (conn.OpenConnection() == true)
            {
                string          query         = "select*from account where UserName='******' and Password='******'";
                MySqlCommand    SelectCommand = new MySqlCommand(query, conn.connection);
                MySqlDataReader myReader;

                myReader = SelectCommand.ExecuteReader();
                int count = 0;
                while (myReader.Read())
                {
                    count = count + 1;
                }
                if (count == 1)
                {
                    Form3  new_form = new Form3();
                    string uname    = this.unametxt.Text;
                    string pword    = this.pwordtxt.Text;
                    new_form.prop  = uname;
                    new_form.prop2 = pword;
                    new_form.Show();
                    this.Hide();
                }

                else if ((unametxt.Text == "admin") && (pwordtxt.Text == "admin"))
                {
                    Form2     new_form1 = new Form2();
                    string    uname     = this.unametxt.Text;
                    string    pword     = this.pwordtxt.Text;
                    asettings admin     = new asettings();
                    admin.pword = pword;
                    admin.pword = pword;
                    new_form1.Show();
                    this.Hide();
                }

                /*else if ((unametxt.Text == "user") && (pwordtxt.Text == "user"))
                 * {
                 *  Form3 new_form = new Form3();
                 *  new_form.Show();
                 *  this.Hide();
                 * }*/

                else
                {
                    MessageBox.Show("Incorrect username/password!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    unametxt.Text = "";
                    pwordtxt.Text = "";
                    unametxt.Focus();
                }
            }
            conn.CloseConnection();
        }
Example #2
0
 private void settingslbl_Click(object sender, EventArgs e)
 {
     if (settings == null)
     {
         settings             = new asettings();
         settings.MdiParent   = this;
         settings.FormClosed += Settings_FormClosed;
         settings.Show();
     }
     else
     {
         settings.Activate();
     }
 }
Example #3
0
 private void Settings_FormClosed(object sender, FormClosedEventArgs e)
 {
     settings = null;
     //throw new NotImplementedException();
 }