public ActionResult WelcomeUser()
 {
     User objUser = new User();
     if (eSchoolSession.IsInSession(SessionKeys.CurrentUser))
     {
         objUser = (User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser);
     }
     return PartialView(objUser);
 }
        public ActionResult GetExamByClass(string AYID, string ClassID, string AssessmentType)
        {
            User objUser = new User();
            if (eSchoolSession.IsInSession(SessionKeys.CurrentUser))
            {
                objUser = (User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser);
            }

            SelectList retList = null;
            retList = GetAllExams(AYID, objUser.SchoolID, ClassID, AssessmentType);

            return Json(retList);
        }
        public ActionResult WorkingSchool()
        {
            School objSchoolReturn = new School();

            User objUser = new User();
            if (eSchoolSession.IsInSession(SessionKeys.CurrentUser))
                objUser = (User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser);

            if (objUser != null && !string.IsNullOrEmpty(objUser.SchoolID))
            {
                School objSchool = new School();
                objSchool.SchoolID = objUser.SchoolID;
                objSchoolReturn = _SchoolService.Get(objSchool);
            }

            return PartialView(objSchoolReturn);
        }
        public ActionResult RptFormatOne(ExamListViewModel model)
        {
            if (model == null)
            {
                model = new ExamListViewModel();
            }
            if (model.Exam == null)
            {
                model.Exam = new Models.Exam();
            }
            if (model.ExamList == null)
            {
                model.ExamList = new List<Models.Exam>();
            }
            if (model.ExamMarks == null)
            {
                model.ExamMarks = new ExamMarks();
            }
            if (model.ExamSubjects == null)
            {
                model.ExamSubjects = new ExamSubjects();
            }
            if (model.ExamMarksDetailIs == null)
            {
                model.ExamMarksDetailIs = new ExamMarksDetailIs();
            }
            if (model.ExamStudentsList == null)
            {
                model.ExamStudentsList = new List<ExamMarksDetailIs>();
            }
            if (!string.IsNullOrEmpty(model.Exam.ExamID))
            {
                model.Exam = _ExamService.Get(model.Exam);
            }
            if (!string.IsNullOrEmpty(model.ExamMarks.SubjectID))
            {
                model.ExamSubjects = new ExamSubjects();
                model.ExamSubjects.ExamID = model.Exam.ExamID;
                model.ExamSubjects.SubjectID = model.ExamMarks.SubjectID;

                // GET MAX QUESTIONS
                model.ExamSubjects = _IExamSubjectsService.Get(model.ExamSubjects);

                // GET ALL STUDENTS FOR GIVEN CLASS
                model.ExamMarksDetailIs.ClassID = model.Exam.ClassID;
                model.ExamStudentsList = _IExamMarksDetailIsService.GetStudentsForClass(model.ExamMarksDetailIs).ToList();

                // GET DETAILS FOR EXAM MARKS DETAILS
                model.ExamMarksDetailIs.ExamID = model.Exam.ExamID;
                model.ExamMarksDetailIs.SubjectID = model.ExamSubjects.SubjectID;
                model.ExamMarksDetailIsList = _IExamMarksDetailIsService.GetAll(model.ExamMarksDetailIs).ToList();

            }

            User objUser = new User();
            if (eSchoolSession.IsInSession(SessionKeys.CurrentUser))
            {
                objUser = (User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser);
            }

            ViewBag.ExamSubjectsList = GetAllExamSubjects(model.Exam.ExamID, "Marks");
            ViewBag.AYList = GetAllAY();
            ViewBag.ClassList = GetAllClass();
            ViewBag.SectionList = GetAllSection();
            ViewBag.ExamList = GetAllExams("", objUser.SchoolID);
            ViewBag.AssessmentTypeList = GetLookupValues("AssessmentType");

            return View(model);
        }
        public ActionResult ForgotPassword(User model)
        {
            bool bSuccess = false;
            string sFromEmailID = string.Empty;
            string strEmailBody = string.Empty;
            string strEmailSubject = string.Empty;

            Messages msgGetEmail = null;
            Messages msgGetSubject = null;

            if (model != null && model.EmailAddress != null)
            {
                User objUser = new User();
                objUser.EmailAddress = model.EmailAddress;
                objUser = _UserService.ValidateUserByEmailAddress(objUser);

                if (objUser != null && objUser.EmailAddress != null)
                {
                    //get the from email from web-config file, the from email id will same for all the notificaiton send
                    if (ConfigurationManager.AppSettings[FROM_EMAIL_ID] != null)
                        sFromEmailID = Convert.ToString(ConfigurationManager.AppSettings[FROM_EMAIL_ID]);

                    if (!string.IsNullOrEmpty(sFromEmailID))
                    {
                        string Url = ConfigurationManager.AppSettings["loginurl"].ToString();

                        msgGetEmail = new Messages();
                        msgGetEmail.MsgKey = "001";
                        msgGetEmail = _MessagesService.Get(msgGetEmail);

                        msgGetSubject = new Messages();
                        msgGetSubject.MsgKey = "001";
                        msgGetSubject = _MessagesService.Get(msgGetSubject);

                        if (msgGetEmail != null && !string.IsNullOrEmpty(msgGetEmail.MessageID) && !string.IsNullOrEmpty(msgGetEmail.Value))
                        {
                            strEmailBody = msgGetEmail.Value;
                        }

                        if (msgGetSubject != null && !string.IsNullOrEmpty(msgGetSubject.MessageID) && !string.IsNullOrEmpty(msgGetSubject.Value))
                        {
                            strEmailSubject = msgGetSubject.Value;
                        }

                        if (!string.IsNullOrEmpty(strEmailBody) && !string.IsNullOrEmpty(strEmailSubject))
                        {
                            //if (strEmailBody.Contains("@@FirstName@@"))
                            //    strEmailBody = strEmailBody.Replace("@@FirstName@@", objUser.FirstName);

                            //if (strEmailBody.Contains("@@LastName@@"))
                            //    strEmailBody = strEmailBody.Replace("@@LastName@@", objUser.LastName);

                            if (strEmailBody.Contains("@@EmailAddress@@"))
                                strEmailBody = strEmailBody.Replace("@@EmailAddress@@", objUser.EmailAddress);

                            if (strEmailBody.Contains("@@Password@@"))
                                strEmailBody = strEmailBody.Replace("@@Password@@", objUser.Password);

                            if (strEmailBody.Contains("@@url@@"))
                                strEmailBody = strEmailBody.Replace("@@url@@", Url);

                            //if (strEmailSubject.Contains("@@FirstName@@"))
                            //    strEmailSubject = strEmailSubject.Replace("@@FirstName@@", objUser.FirstName);

                            //if (strEmailSubject.Contains("@@LastName@@"))
                            //    strEmailSubject = strEmailSubject.Replace("@@LastName@@", objUser.LastName);

                            EmailSender emailTest = new EmailSender(sFromEmailID, objUser.EmailAddress, "", "", strEmailSubject, strEmailBody);
                            emailTest.IsBodyHtml = true;
                            emailTest.SendEmail();
                            bSuccess = true;

                            //Notification objNot = new Notification();

                            //objNot.ObjectID = Utility.USER_OBJECT_ID;
                            //objNot.ObjectInstanceID = objUser.UserID;
                            //objNot.Subject = strEmailSubject;
                            //objNot.Body = strEmailBody;
                            //objNot.ToEmailAddress = objUser.EmailAddress;
                            //objNot.FromEmailAddress = sFromEmailID;
                            //objNot.DateSent = DateTime.Now;

                            //_NotificationService.AddEditBySupplier(objNot);
                            TempData["EmailSend"] = UserRes.MsgEmailSend;
                        }
                    }
                }
                else
                {
                    ModelState.AddModelError("", "No such EmailAddress Exist.");
                    return View();
                }
            }
            else
            {
                ModelState.AddModelError("", "Please enter EmailAddress.");
                return View();
            }

            if (bSuccess)
            {
                TempData["msg"] = "";

                // return RedirectToAction("SearchJob", "SearchJob");
            }
            else if (!bSuccess)
            {
                TempData["err"] = "";
            }

            return View();
        }
 private ActionResult RedirectToLocal(User model, string returnUrl)
 {
     if (returnUrl != "/" && Url.IsLocalUrl(returnUrl))
     {
         FormsAuthentication.SetAuthCookie(model.UserID, false);
         return Redirect(returnUrl);
     }
     else
     {
         FormsAuthentication.SetAuthCookie(model.UserID, false);
         return RedirectToAction("Dashboard", "Home");
     }
 }
        public ActionResult Login(Login objLogin, string returnUrl)
        {
            FillAllDropdowns();

            if (ModelState.IsValid)
            {
                if (objLogin != null)
                {
                    User objUser = new User();
                    objUser.EmailAddress = objLogin.EmailAddress;
                    objUser.Password = objLogin.Password;
                    objUser.SchoolID = objLogin.SchoolID;

                    if (_UserService.ValidateUser(objUser))
                    {
                        return RedirectToLocal(objUser, returnUrl);
                    }
                    else
                    {
                        ViewBag.Message = Validation.LoginFail;
                    }
                }
            }

            return View(objLogin);
        }
        public ActionResult SaveAttendance(List<StudentsAttendance> StudentsAttendanceData)
        {
            if (StudentsAttendanceData != null)
            {
                User objSessionUser = new User();
                if (eSchoolSession.IsInSession(SessionKeys.CurrentUser))
                {
                    objSessionUser = (eSchool.Models.User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser);
                }
                foreach (StudentsAttendance objIn in StudentsAttendanceData)
                {
                    if (objIn.IsPresent == false)
                    {
                        objIn.IsAbsent = true;
                    }
                    objIn.CreatedByID = objSessionUser.UserID;
                    objIn.ModifiedByID = objSessionUser.UserID;

                    objIn.StudentsAttendanceID = string.IsNullOrEmpty(objIn.StudentsAttendanceID) == true ? Utility.GeneratorUniqueId("SATT_") : objIn.StudentsAttendanceID;

                    _StudentsAttendanceService.AddEdit(objIn);
                }
            }
            return Json("1");
        }