protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if ((Request.QueryString["ConfID"] != null)) { int paramConfID = (Convert.ToInt32(Request.QueryString["ConfID"])); //ConfID (URL parameter recuperation) dtoAccount = blAccount.GetCustomerByConfID(paramConfID); //Admin recuperation if (dtoAccount.GetConfirmationID() == 0) { lblRegistrationResult.Text = "Account already confirmed or ConfID invalid"; } else if ((paramConfID == dtoAccount.GetConfirmationID())) //Test parameterConfID =?= ConfID in DB { if (blAccount.UpdateIsConfirmed(dtoAccount.GetEmail()) == 1) //Update isConfirmed { lblRegistrationResult.Text = " you are well registered"; } else { lblRegistrationResult.Text = "Issue during verification"; } } else { Response.Redirect(url); } } else { Response.Redirect(url); } } }
public AccountDTO FindBy(string email) { AccountDTO account; AddressDTO address; string queryString = "SELECT * FROM dbo.Account WHERE email = @email"; try { using (SqlConnection con = new SqlConnection(ConnectionString)) { using (SqlCommand cmd = new SqlCommand(queryString, con)) { cmd.Parameters.AddWithValue("@email", SqlDbType.VarChar).Value = email; cmd.CommandType = CommandType.Text; con.Open(); SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { account = new AccountDTO(); address = new AddressDTO(); account = GenerateAccount(reader, account, address); //return product instance as data object Debug.Print("AccountDAL: /FindByMail/ " + account.GetEmail().ToString()); return(account); } } } } catch (Exception e) { e.GetBaseException(); Debug.Print(e.ToString()); } return(null); }