private void bSendCode_Click(object sender, EventArgs e) { try { USER temp = new USER(); temp.Email = this.tbxEmail.Text; if (CheckEmail() == 0) { lbValidEmail.Show(); } else if (temp.CheckEmail() == 1) { this.EmailVerify = new EmailVerify(tbxEmail.Text); this.EmailVerify.GetRandomCode(); this.EmailVerify.SendMail(); lbCodeSent.Show(); this.IsCodeSent = true; } else { lbUsedMail.Show(); } } catch (Exception ex) { MessageBox.Show("Đã xảy ra lỗi, vui lòng liên hệ đội ngũ phát triển!"); ReportError rp = new ReportError(this, ex); rp.Show(); } }
private void bSignUp_Click(object sender, EventArgs e) { try { MessageBoxButtons buttons = MessageBoxButtons.OK; if (CheckPassword() == 1 && CheckCode() == 1 && CheckFullInfo() == 1 && CheckExistID() == 0) { USER user = new USER(); user.ID = tbxID.Text; MD5Encoder PasswordEncoder = new MD5Encoder(); user.Password = PasswordEncoder.FromString(tbxPass.Text); user.Birthday = dateBirth.Value; user.Email = tbxEmail.Text; user.Name = tbxName.Text; user.Class = tbxClass.Text; user.Gender = tbxGender.Text; this.EmailVerify = new EmailVerify(user.Email); user.AddUserToDatabase(); MessageBox.Show("Đăng ký thành công!", "StudentSupportApp", buttons); this.Close(); this.parent.Show(); } else if (CheckCode() == 0) { MessageBox.Show("Mã xác nhận không đúng! Vui lòng thử lại!", "StudentSupportApp", buttons); lbCodeSent.Hide(); } else if (CheckPassword() == 2) { lbShortPass.Visible = true; } else if (CheckPassword() == 3) { lbConfirmWrong.Visible = true; } else if (CheckExistID() == 1) { lbUsedID.Visible = true; } } catch (Exception ex) { MessageBox.Show("Đã xảy ra lỗi, vui lòng liên hệ đội ngũ phát triển!"); ReportError rp = new ReportError(this, ex); rp.Show(); } }