Пример #1
0
 //Create new account
 private void btSignIn_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(MyConnect.getString("select Email from LogIn where Email=N'" + txNewEmail.Text + "'")))
     {
         MyChecker.setErr(txNewEmail, errorEmail, "Email Invailable!", Properties.Resources.ERROR); email = false; txNewEmail.Focus(); return;
     }
     if (!username)
     {
         txNewUserName.Focus(); return;
     }
     else if (!email)
     {
         txNewEmail.Focus(); return;
     }
     else if (!password)
     {
         txNewPassword.Focus(); return;
     }
     else if (!confirompw)
     {
         txConfiromPw.Focus(); return;
     }
     else
     {
         if (ac.AddObject(new Account(txNewUserName.Text, StringPassword.EncrytString(txNewPassword.Text, Properties.Resources.KeyCrypt), cbManager.Checked, txNewEmail.Text)))
         {
             MessageBox.Show("Create new account successfully!");
         }
         else
         {
             MessageBox.Show("Can't create account!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         setAutoCompleteCollection();
     }
 }