public ActionResult CheckRSA(string txtUsername, string txtPassword)//Email and R Number
        {
            Dal       dals    = new Dal();
            MentorsBL changes = new MentorsBL();


            try
            {
                changes = (
                    from frm in dals.mentors.ToList()
                    where frm.RSAID == txtUsername && frm.Email == txtPassword && frm.IsActive == true
                    select frm).Single();
            }
            catch (Exception)
            {
                Reset_ rrr = new Models.Reset_();

                ViewBag.Error = "Learner does not exist. Please verify your Identity Number and Email Address";
                // ViewBag.Err = rrr.error;
                return(View("Reset"));
            }



            if (changes != null)
            {
                FormsAuthentication.SetAuthCookie(changes.Username, false);
                return(RedirectToAction("Reset", "Reset"));
            }
            else
            {
                //return View("Reset");
                return(RedirectToAction("Administrator", "Login"));
            }
        }
Beispiel #2
0
        public ActionResult CheckChecks(string txtUsername, string txtPassword)
        {
            Dal       dal    = new Dal();
            MentorsBL change = new MentorsBL();

            ViewBag.Error = "Username does not exist. Please verify your Username or Password";

            try
            {
                change = (
                    from frm in dal.mentors.ToList()
                    where frm.Username == txtUsername && frm.Password == txtPassword && frm.IsActive == true
                    select frm).Single();
            }
            catch (Exception)
            {
                ViewBag.Error = "Username does not exist. Please verify your Username or Password";
                return(View("_ChangePassword"));
            }



            if (change != null)
            {
                FormsAuthentication.SetAuthCookie(change.Username, false);
                return(RedirectToAction("_EnterNewPassword", "_ChangePassword"));
            }
            else
            {
                return(View("_ChangePassword"));
            }
        }
        public string UpdateMentor(MentorsBL MentorDe)
        {
            string msg;

            if (ModelState.IsValid)
            {
                if (MentorsBL.UpdateMentor(MentorDe) > 0)
                {
                    msg = "Sucessfully Updated Mentor's Details";
                }
                else
                {
                    msg = "Error! System Could Not Update  Mentor's Details";
                }
            }
            else
            {
                msg = "Sorry! Validation Error";
            }
            return(msg);
        }
        public string InsertMentor(MentorsBL MentorDe)
        {
            string msg;

            if (ModelState.IsValid)
            {
                if (MentorsBL.InsertMentor(MentorDe) > 0)
                {
                    msg = "Sucessfully Inserted Mentor's Record";
                }
                else
                {
                    msg = "Error! Could Not Insert Mentor's Record";
                }
            }
            else
            {
                msg = "Sorry! Validation Error";
            }
            return(msg);
        }
        public ActionResult DoLogin(string txtUsername, string txtPassword)
        {
            Dal       dal         = new Dal();
            MentorsBL mentorlogin = new MentorsBL();

            ViewBag.Error = "Username or Password is incorret";

            try
            {
                mentorlogin = (
                    from frm in dal.mentors.ToList()
                    where frm.Username == txtUsername && frm.Password == txtPassword && frm.IsActive == true
                    select frm).Single();
            }
            catch (Exception)
            {
                ViewBag.Error = "Username or Password is incorrect.";
                return(View("Login"));
            }



            if (mentorlogin != null)
            {
                Session["FirstName"] = mentorlogin.FirstName.ToString();
                Session["Surname"]   = mentorlogin.Surname.ToString();
                //Session["Role"] = mentorlogin.Role.ToString();

                FormsAuthentication.SetAuthCookie(mentorlogin.Username, false);
                return(RedirectToAction("Sign", "Sign"));
            }
            else
            {
                return(View("Login"));
            }
        }