private void btnCancel_Click(object sender, EventArgs e)
        {
            frmMenuOptions mo = new frmMenuOptions();

            mo.Show();
            this.Close();
        }
        private void btnOk_Click(object sender, EventArgs e)
        {
            // Save to textfile
            List <string> objList = new List <string>();

            objList.Add(this.qInput.generateQuote());
            fh.Writefile(txtQuotaFilename.Text, objList, false);
            MessageBox.Show(string.Format("Quota saved in : {0} ", txtQuotaFilename.Text));

            frmMenuOptions mo = new frmMenuOptions();

            mo.Show();
            this.Close();
        }
Example #3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (edtUsername.Text.Trim() == "")
            {
                edtUsername.Focus();
                MessageBox.Show("Username is required.");
                return;
            }
            if (mskedtPassword.Text.Trim() == "")
            {
                mskedtPassword.Focus();
                MessageBox.Show("Password is required.");
                return;
            }
            try
            {
                List <Users> userList = dh.GetUserData();

                var usenameCheck = (from user in userList
                                    where user.Username == edtUsername.Text
                                    select user).FirstOrDefault();

                if (usenameCheck != null)
                {
                    string pass = GeneratePassword(edtUsername.Text);
                    if (pass == mskedtPassword.Text)
                    {
                        MessageBox.Show("Login Succesful");
                        frmMenuOptions f2 = new frmMenuOptions();
                        f2.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show(string.Format("Invalid login Password : "******"Username or Password is incorrect!!!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }