/// <summary> /// If username and password are valid add record in table User. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnRegister_Click(object sender, EventArgs e) { if (valForm.IsValid) { RegisterBL register = new RegisterBL(); register.RegisterUser(txtUsername.Text, txtPassword.Text); Response.Redirect("Login.aspx", false); } }
public ActionResult <RegisterResponseModel> Register([FromBody] RegisterInputModel data) { try { RegisterBL userBL = new RegisterBL(DbContext); return(userBL.Register(data, RoleEnum.MediaOwner)); } catch (Exception ex) { RegisterResponseModel logres = new RegisterResponseModel(); logres.Message = ex.Message; logres.Response = false; return(logres); } }
/// <summary> /// Check if the username is already registered in the database. /// Check if username has five or more characters. /// Check if username is left open or not. /// </summary> /// <param name="source"></param> /// <param name="args"></param> protected void valForm_ServerValidate(object source, ServerValidateEventArgs args) { args.IsValid = true; // Reference the custom validator. valForm.ErrorMessage = string.Empty; // Compares username to database records for duplicates. if (RegisterBL.DuplicateUser(txtUsername.Text) > 0) { args.IsValid = false; valForm.ErrorMessage = "Username already Taken! "; } // Checks user name length. if (txtUsername.Text.Length < 5) { args.IsValid = false; valForm.ErrorMessage = "Username must be 5 or more characters long. "; } // Checks password length. if (txtPassword.Text.Length < 8) { args.IsValid = false; valForm.ErrorMessage = valForm.ErrorMessage + "Password must be 8 or more characters long. "; } // Checks if password contains white spaces. if (txtPassword.Text.Contains(" ")) { args.IsValid = false; valForm.ErrorMessage = valForm.ErrorMessage + "Password must not contain white spaces. "; } // Checks that confirmation password matched the password. if (args.IsValid && !txtPassword.Text.Equals(txtConfirmPassword.Text)) { args.IsValid = false; valForm.ErrorMessage = valForm.ErrorMessage + "Passwords do not match. "; } }
protected void Page_Load(object sender, EventArgs e) { string userID = Request.Params["user_id"].ToString(); string password = Request.Params["password"].ToString(); RegisterBL rbl = new RegisterBL(); if (rbl.ValidateUser(userID, password)) { Session["UserName"] = userID; //string username = Session["UserName"]; //Session["Pwd"] = tbpwd.Text; Response.Write("<script>window.location.href ='http://localhost:62241/Passport.aspx'</script>"); } else { ViewState["UserName"] = userID; Response.Write("<script>alert('Incorrect User ID PASSWORD')</script><script>window.location.href ='http://localhost:62241/Login.html'</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserName"] != null) { string s = Session["UserName"].ToString(); RegisterBL b = new RegisterBL(); DataTable dt = b.UserInfo(s); string fname = dt.Rows[0][0].ToString(); string mname = dt.Rows[0][1].ToString(); string lname = dt.Rows[0][2].ToString(); string email = dt.Rows[0][3].ToString(); string User_ID = dt.Rows[0][4].ToString(); ViewState["fname"] = fname; ViewState["mname"] = mname; ViewState["lname"] = lname; ViewState["e_mail"] = email; ViewState["User_ID"] = User_ID; newpassport.HRef = "newpassport.html?" + fname + "&" + mname + "&" + lname + "&" + email + "&" + User_ID; } }
public ActionResult Member_Save(RegisterModel rm) { RegisterBL rbl = new RegisterBL(); string msg = string.Empty; if (rm != null) { var mid = rbl.Check_Member(rm); if (mid == null || mid == "") { HttpPostedFileBase imgfile = Request.Files["imgdata"]; string photoname = string.Empty; photoname = imgfile.FileName; if (!string.IsNullOrWhiteSpace(photoname)) { if (!Directory.Exists(Photo)) { Directory.CreateDirectory(Photo); } string path = Photo + rm.MemberID + Path.GetExtension(photoname); imgfile.SaveAs(path); rm.Photo = rm.MemberID + Path.GetExtension(photoname); } else { rm.Photo = "Default.png"; } msg = rbl.Member_Save(rm); if (msg == "Insert Success") { Session["Imsg"] = "Insert"; } } else { HttpPostedFileBase imgfile = Request.Files["imgdata"]; string photoname = string.Empty; photoname = imgfile.FileName; if (!string.IsNullOrWhiteSpace(photoname)) { if (!Directory.Exists(Photo)) { Directory.CreateDirectory(Photo); } string path = Photo + rm.MemberID + Path.GetExtension(photoname); imgfile.SaveAs(path); rm.Photo = rm.MemberID + Path.GetExtension(photoname); } else { DataTable dt = rbl.MemberCheck(mid); rm.Photo = dt.Rows[0]["Photo"].ToString(); } msg = rbl.Member_Update(rm); if (msg == "OK") { Session["Umsg"] = "Update"; } } } return(RedirectToAction("Register_List")); }
public RegisterController() { register = new RegisterBL(); }