Ejemplo n.º 1
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            InputFunctions inputfuncs = new InputFunctions();
            FileFunctions  filefuncs  = new FileFunctions();
            string         email      = txtEmail.Text;

            if (!inputfuncs.verifyEmail(email))
            {
                MessageBox.Show("Please enter a valid email address");
            }
            else if (filefuncs.checkUser(email, "users.csv"))
            {
                string password = filefuncs.getField(email, 3, "users.csv");
                if (password == txtPassword.Text)
                {
                    this.Hide();
                    User.Name     = filefuncs.getField(email, 0, "users.csv");
                    User.Email    = email;
                    User.Password = password;
                    frmProfile profile = new frmProfile();
                    profile.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Invalid password.");
                }
            }
            else
            {
                MessageBox.Show("An account does not exist with that email address.");
            }
        }
Ejemplo n.º 2
0
        private void BtnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                decimal.Parse(txtCreditCard.Text);
            }
            catch
            {
                MessageBox.Show("Please enter a valid credit card number.");
            }

            try
            {
                int.Parse(txtCSV.Text);
            }
            catch
            {
                MessageBox.Show("Please enter a valid CSV.");
            }

            if (txtCreditCard.Text.Length == 16)
            {
                if (txtCSV.Text.Length == 3)
                {
                    User.CSV = txtCSV.Text;
                }
                else
                {
                    MessageBox.Show("CSV must be 3 digits long.");
                    return;
                }
                User.CreditCard = txtCreditCard.Text;
                User.CCName     = txtName.Text;
                confirmationForm();
                this.Hide();
                frmProfile profile = new frmProfile();
                profile.ShowDialog();
            }
            else
            {
                MessageBox.Show("Credit card number must be 16 digits long.");
                return;
            }
        }