Exemple #1
0
        private void registerbtn_Click(object sender, EventArgs e)
        {
            if ((string.IsNullOrEmpty(usertxt.Text)) || (string.IsNullOrEmpty(passtxt.Text)) || (string.IsNullOrEmpty(conpasstxt.Text)) || (string.IsNullOrEmpty(idnummask.Text)) ||
                (string.IsNullOrEmpty(acctcmb.Text)))
            {
                MessageBox.Show("Kindly Complete the Information", "Incomplete");
            }
            else
            {
                if (MessageBox.Show("Confirm Registration?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if ((passtxt.Text.Length >= 8) && (conpasstxt.Text.Length >= 8))
                    {
                        if (passtxt.Text == conpasstxt.Text)
                        {
                            en_username = AES.AES_Encryption.EncryptString(usertxt.Text, strpass);
                            en_password = AES.AES_Encryption.EncryptString(passtxt.Text, strpass);
                            en_idnum    = AES.AES_Encryption.EncryptString(idnummask.Text, strpass);
                            en_accttype = AES.AES_Encryption.EncryptString(acctcmb.Text, strpass);
                            string query = "INSERT INTO users (username, password, id_num, user_type) VALUES ('" + en_username + "', '" + en_password + "', '" + en_idnum +
                                           "', '" + en_accttype + "')";

                            if (LogIn.OpenConnection())
                            {
                                try
                                {
                                    MySqlCommand cmd = new MySqlCommand(query, LogIn.conn);
                                    cmd.ExecuteNonQuery();
                                    MessageBox.Show("You're Registered");
                                    Form login = new LogIn();
                                    login.Show();
                                    this.Hide();
                                    usertxt.Text   = null;
                                    passtxt.Text   = null;
                                    idnummask.Text = null;
                                    acctcmb.Text   = null;
                                }
                                catch (MySqlException ex)
                                {
                                    MessageBox.Show(ex.Message);
                                }
                                finally
                                {
                                    LogIn.CloseConnection();
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("Password Confirmation didn't Match", "Password Unmatched");
                            conpasstxt.Text = "";
                        }
                    }
                    else
                    {
                        MessageBox.Show("Password Length must be at least 8 characters.", "Password Length Error");
                    }
                }
                else
                {
                }
            }
        }
Exemple #2
0
 //public LenderMainForm lender{ get; set;}
 public AddItem()//LenderMainForm _form1)
 {
     //lender = _form1;
     InitializeComponent();
     LogIn.Initialize();
 }
Exemple #3
0
 public LenderMainForm()
 {
     InitializeComponent();
     LogIn.Initialize();
 }
Exemple #4
0
 public CpEControl()
 {
     InitializeComponent();
     LogIn.Initialize();
 }