protected void btnLogSubmit_Click(object sender, EventArgs e) { try { ILoginBO objLog = new LoginBO(); Credantials objCred = new Credantials(); objCred.EmailID = txtLogEmailID.Text; objCred.Password = txtLogPassword.Text; AuthLog objAuth = objLog.Authenticate(objCred); if (Session["Invalid"] != null) { lblErrorMsg.Text = Session["Invalid"].ToString(); Session["Invalid"] = null; objAuth.ID = 0; } if (objAuth.ID != 0) { FormsAuthentication.RedirectFromLoginPage("Job", false); Session["Valid"] = objAuth.Type; Session["ID"] = objAuth.ID; if (objAuth.Type == "Seeker") { Response.Redirect("ProfileSeeker.aspx",false); } else { Response.Redirect("ProfileEmployer.aspx",false); } } if (objAuth.ID == 0) { lblErrorMsg.Text = "Invalid EmailID/Password"; } } catch (Exception ex) { lblErrorMsg.Text = "Something Went Wrong in Login Page"+ ex; } }
public AuthLog AuthPwd(Credantials ObjCred) { AuthLog objLog = new AuthLog(); var obj = _unitOfWork.Repository<LoginSeeker>().GetAll().Where(c => c.EmailID == ObjCred.EmailID).Select(c => c.Password).FirstOrDefault(); if (obj == null) { obj = _unitOfWork.Repository<LoginEmployer>().GetAll().Where(c => c.EmailID == ObjCred.EmailID).Select(c => c.Password).FirstOrDefault(); if (obj != null) { objLog.Pwd = obj; objLog.Type = "Employer"; } } else { objLog.Pwd = obj; objLog.Type = "Seeker"; } return objLog; }
protected void btnForgetOk_Click(object sender, EventArgs e) { try { string email = txtEmailID.Text; ILoginBO objLog = new LoginBO(); Credantials objCred = new Credantials(); objCred.EmailID = txtLogEmailID.Text; objCred.Password = txtLogPassword.Text; AuthLog objAuth = objLog.AuthPwd(objCred); if (objAuth!=null) { new CCDDLWebService().SendPwdMail(email, objAuth.Type, objAuth.Pwd); } } catch (Exception) { } }
public int UpdatePwd(Credantials objCred) { try { var objSeeker = _unitOfWork.Repository<LoginSeeker>().GetAll().Where(c => c.SeekerID == objCred.ID).Where(c => c.Password == objCred.Password).FirstOrDefault(); if (objSeeker == null) { var objEmp = _unitOfWork.Repository<LoginEmployer>().GetAll().Where(c => c.EmployerID == objCred.ID).Where(c => c.Password == objCred.Password).FirstOrDefault(); if (objEmp != null) { objEmp.Password = objCred.NewPassword; _unitOfWork.Repository<LoginEmployer>().Update(objEmp); return 1; } return 2; } else { objSeeker.Password = objCred.NewPassword; _unitOfWork.Repository<LoginSeeker>().Update(objSeeker); return 1; } } catch { return 0; } finally { objCred = null; } }