public string PasswordChange(CMemberEditor m) { List <CMember> SELECTMember = CMemberFactory.fn會員查詢(); CMember member = Session[CMemberSession.Session_Login_User] as CMember; CMember cMember = SELECTMember.FirstOrDefault(n => n.fMemberId == member.fMemberId); if (m.NewfPassword == null || m.ChackNewfPassword == null) { ViewBag.Error = "!不可為空,請輸入密碼"; CMemberEditPassword editPassword = new CMemberEditPassword(); editPassword.PasswordMassage = ViewBag.Error; Session[CMemberSession.Session_Change_Password] = editPassword; return(ViewBag.Error); } else if (m.NewfPassword != m.ChackNewfPassword) { ViewBag.Error = "!與上方密碼不相符"; CMemberEditPassword editPassword = new CMemberEditPassword(); editPassword.PasswordMassage = ViewBag.Error; Session[CMemberSession.Session_Change_Password] = editPassword; return(ViewBag.Error); } else if (m.NewfPassword.Length < 5 || m.NewfPassword.Length > 15) { ViewBag.Error = "!密碼請符合,5字元-15字元之間"; CMemberEditPassword editPassword = new CMemberEditPassword(); editPassword.PasswordMassage = ViewBag.Error; Session[CMemberSession.Session_Change_Password] = editPassword; return(ViewBag.Error); } else if (cMember.fPassword == m.NewfPassword) { ViewBag.Error = "!新密碼與舊密碼相符"; CMemberEditPassword editPassword = new CMemberEditPassword(); editPassword.PasswordMassage = ViewBag.Error; Session[CMemberSession.Session_Change_Password] = editPassword; return(ViewBag.Error); } else { ViewBag.PasswordTrue = "修改成功"; cMember.fPassword = m.ChackNewfPassword; CMemberFactory.fn會員更新(cMember); Session[CMemberSession.Session_Login_User] = cMember; return(ViewBag.PasswordTrue); } }
//會員設定-個人資料------------------------------------------------------------------------------------------------ public ActionResult MemberSetup() { CMemberEditPassword editPassword = Session[CMemberSession.Session_Edit_Password] as CMemberEditPassword; CMemberEditPassword ChangePassword = Session[CMemberSession.Session_Change_Password] as CMemberEditPassword; if (Session[CMemberSession.Session_Login_User] == null) { Session[CMemberSession.Session_Login_User] = "憑證消失,請重新登入"; return(RedirectToAction("../Home/Index")); } if (Session[CMemberSession.Session_Edit_Password] != null) { if (editPassword.PasswordMassage == "密碼相符") { ViewBag.PasswordTrue = "密碼相符"; Session[CMemberSession.Session_Edit_Password] = null; Session[CMemberSession.Session_Change_Password] = null; return(View("../Member/MemberSetup", "_Layout")); } else if (editPassword.PasswordMassage == "!密碼不符") { ViewBag.Passwordfalse = "密碼不符"; ViewBag.Error = "!密碼不符"; Session[CMemberSession.Session_Edit_Password] = null; Session[CMemberSession.Session_Change_Password] = null; return(View("../Member/MemberSetup", "_Layout")); } else if (editPassword.PasswordMassage == "!密碼請符合,5字元-15字元之間") { ViewBag.Passwordfalse = "密碼不符"; ViewBag.Error = "!密碼請符合,5字元-15字元之間"; Session[CMemberSession.Session_Edit_Password] = null; Session[CMemberSession.Session_Change_Password] = null; return(View("../Member/MemberSetup", "_Layout")); } else { ViewBag.Passwordfalse = "密碼不符"; ViewBag.Error = "!不可為空,請輸入密碼"; Session[CMemberSession.Session_Edit_Password] = null; Session[CMemberSession.Session_Change_Password] = null; return(View("../Member/MemberSetup", "_Layout")); } } if (Session[CMemberSession.Session_Change_Password] != null) { if (ChangePassword.PasswordMassage == "!不可為空,請輸入密碼") { ViewBag.PasswordTrue = "密碼相符"; ViewBag.Error = "!不可為空,請輸入密碼"; Session[CMemberSession.Session_Edit_Password] = null; Session[CMemberSession.Session_Change_Password] = null; return(View("../Member/MemberSetup", "_Layout")); } else if (ChangePassword.PasswordMassage == "!密碼請符合,5字元-15字元之間") { ViewBag.PasswordTrue = "密碼相符"; ViewBag.Error = "!密碼請符合,5字元-15字元之間"; Session[CMemberSession.Session_Edit_Password] = null; Session[CMemberSession.Session_Change_Password] = null; return(View("../Member/MemberSetup", "_Layout")); } else if (ChangePassword.PasswordMassage == "!與上方密碼不相符") { ViewBag.PasswordTrue = "密碼相符"; ViewBag.Error = "!與上方密碼不相符"; Session[CMemberSession.Session_Edit_Password] = null; Session[CMemberSession.Session_Change_Password] = null; return(View("../Member/MemberSetup", "_Layout")); } else if (ChangePassword.PasswordMassage == "!新密碼與舊密碼相符") { ViewBag.PasswordTrue = "密碼相符"; ViewBag.Error = "!新密碼與舊密碼相符"; Session[CMemberSession.Session_Edit_Password] = null; Session[CMemberSession.Session_Change_Password] = null; return(View("../Member/MemberSetup", "_Layout")); } else { Session[CMemberSession.Session_Edit_Password] = null; Session[CMemberSession.Session_Change_Password] = null; return(View("../Member/MemberSetup", "_Layout")); } } else { Session[CMemberSession.Session_Edit_Password] = null; Session[CMemberSession.Session_Change_Password] = null; return(View("../Member/MemberSetup", "_Layout")); } }