protected void loginUser_Authenticate(object sender, AuthenticateEventArgs e) { var userBLL = new EverythingFootballDemo.BLL.Users(); var userInfo = userBLL.GetUserInfo(loginUser.UserName, loginUser.Password); if (userInfo != null) { e.Authenticated = true; Session["userInfo"] = userInfo; Response.Redirect("HomePage.aspx"); } else { e.Authenticated = false; } }
protected void btnRegister_Click(object sender, EventArgs e) { var user = new EverythingFootballDemo.DAL.User(); user.UserName = txtUserName.Text; user.Password = txtPassword.Text; user.EmailID = txtEmailAddress.Text; user.CreditCardNumber = Convert.ToInt64(txtCreditCardNum.Text); user.SecurityCode = Convert.ToInt16(txtSecCode.Text); user.NameOnCard = txtNameOnCard.Text; user.CCExpMonth = ddlMonth.SelectedItem.Text; user.CCExpYear = ddlYear.SelectedValue; user.PhoneNumber = Convert.ToInt64(txtPhoneNumber.Text); var isUserValid = ValidateUserDetails(user); if (isUserValid) { var usersBLL = new EverythingFootballDemo.BLL.Users(); var isUserCreatedSuccessfully = usersBLL.SaveUser(user); if (isUserCreatedSuccessfully) { Session["userInfo"] = user; divRegister.Visible = false; divStatus.Visible = true; lblStatusMsg.Text = "Congratulations. You have successfully joined The Offside Club."; hlnkHomePage.NavigateUrl = "HomePage.aspx?UserReg=Y"; } else { divRegister.Visible = false; divStatus.Visible = true; lblStatusMsg.Text = "Sorry. We are unable to process your request. Please try later."; hlnkHomePage.NavigateUrl = "HomePage.aspx?UserReg=N"; } } }