コード例 #1
0
        public ActionResult CheckRSAID(string txtUsername, string txtPassword)//Email and R Number
        {
            Dal             dal    = new Dal();
            LearnersDetails change = new LearnersDetails();


            try
            {
                change = (
                    from frm in dal.learners.ToList()
                    where frm.RSAID == txtUsername && frm.Email == txtPassword && frm.IsUserActive == 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 (change != null)
            {
                FormsAuthentication.SetAuthCookie(change.Username, false);
                return(RedirectToAction("Reset", "Reset"));
            }
            else
            {
                //return View("Reset");
                return(RedirectToAction("Administrator", "Login"));
            }
        }
        public ActionResult CheckCheck(string txtUsername, string txtPassword)
        {
            Dal             dal    = new Dal();
            LearnersDetails change = new LearnersDetails();

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

            try
            {
                change = (
                    from frm in dal.learners.ToList()
                    where frm.Username == txtUsername && frm.Password == txtPassword && frm.IsUserActive == 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"));
            }
        }
コード例 #3
0
        public ActionResult DoLogin(string txtUsername, string txtPassword)
        {
            //    string message = "Username or Password is incorrect";
            Dal             odal         = new Dal();
            LearnersDetails learnerlogin = new LearnersDetails();

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


            if (learnerlogin != null)
            {
                Session["Names"]    = learnerlogin.Names;
                Session["Username"] = learnerlogin.Username;
                Session["Surname"]  = learnerlogin.Surname;
                FormsAuthentication.SetAuthCookie(learnerlogin.Username, false);
                return(RedirectToAction("Learner_Home", "LearnersHome"));
            }
            else
            {
                return(View("Login"));
            }
        }
コード例 #4
0
        public string UpdateLearner(LearnersDetails LearnersDe)
        {
            string msg;

            if (ModelState.IsValid)
            {
                if (LearnersBL.UpdateLearner(LearnersDe) > 0)
                {
                    msg = "Sucessfully Updated Learner's Details";
                }
                else
                {
                    msg = "Error! System Could Not Update Learner's Details";
                }
            }
            else
            {
                msg = "Sorry! Validation Error";
            }
            return(msg);
        }
コード例 #5
0
        public string InsertLearner(LearnersDetails LearnersDe)
        {
            string msg;

            if (ModelState.IsValid)
            {
                if (LearnersBL.InsertLearner(LearnersDe) > 0)
                {
                    msg = "Sucessfully Inserted Learner's Record";
                }
                else
                {
                    msg = "Error! Could Not Insert Learner's Record";
                }
            }
            else
            {
                msg = "Sorry! Validation Error";
            }
            return(msg);
        }