コード例 #1
0
        public static MvcHtmlString StudentNav(this HtmlHelper html, StudentsListViewModel studentListViewModel)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(@"<ul class=""nav nav-pills nav-stacked"">");

            foreach (StudentDAO student in studentListViewModel.Students)
            {
                TagBuilder li = new TagBuilder("li");
                li.MergeAttribute("role", "presentation");

                TagBuilder a = new TagBuilder("a");
                a.MergeAttribute("href", "/registration/student/" + student.Person.Id);
                a.InnerHtml = student.Person.Name;

                if (studentListViewModel.CurrentStudentId == student.Person.Id)
                {
                    li.AddCssClass("active");
                }

                li.InnerHtml = a.ToString();
                builder.Append(li.ToString());
            }

            builder.Append("</ul>");

            return(MvcHtmlString.Create(builder.ToString()));
        }
コード例 #2
0
        // GET: Student
        public IActionResult Index()
        {
            StudentsListViewModel studentsListViewModel = new StudentsListViewModel();

            studentsListViewModel.Students = _studentRepository.GetStudentsAll;
            return(View(studentsListViewModel));
        }
コード例 #3
0
        public IActionResult List()
        {
            StudentsListViewModel studentsListViewModel = new StudentsListViewModel();

            studentsListViewModel.Students     = studentRepository.GetAll();
            studentsListViewModel.CurrentGroup = "All Group";
            return(View(studentsListViewModel));
        }
コード例 #4
0
        public ActionResult Students()
        {
            string year = DateTime.Now.Year.ToString();
            // The logged in teacher
            Teacher teacher = (Teacher)context.Users.Find(User.Identity.GetUserId());
            IEnumerable <TeacherCourse> teacherCouses = context.TeacherCourses.Where(m => m.TeacherId == teacher.Id).Where(m => m.Year == year).ToList();

            StudentsListViewModel model = new StudentsListViewModel();

            model.Courses = teacherCouses.Select(m => m.Course).ToList();
            return(View(model));
        }
コード例 #5
0
        public ActionResult Students(StudentsListViewModel model)
        {
            // The logged in teacher
            Teacher teacher = (Teacher)context.Users.Find(User.Identity.GetUserId());
            IEnumerable <TeacherCourse> teacherCouses = context.TeacherCourses.Where(m => m.TeacherId == teacher.Id).ToList();

            if (ModelState.IsValid && teacherCouses.Any(m => m.CourseId == model.CourseId))
            {
                model.Students = context.StudentCourses.Where(m => m.CourseId == model.CourseId).ToList();
            }
            model.Courses = teacherCouses.Select(m => m.Course).ToList();
            return(View(model));
        }
コード例 #6
0
        // GET: Student
        public ActionResult Index(string sortOrder, string currentFilter, string searchString, int? page)
        {
            var viewmodel = new StudentsListViewModel
            {
                CurrentSort = sortOrder,
                NameSortParm = string.IsNullOrEmpty(sortOrder) ? "name_desc" : "",
                DateSortParm = sortOrder == "Date" ? "date_desc" : "Date"
            };

            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            viewmodel.CurrentFilter = searchString;

            var students = UoW.Students.GetAll();

            if (!string.IsNullOrEmpty(searchString))
            {
                students = students.Where(s => s.LastName.Contains(searchString)
                                            || s.FirstMidName.Contains(searchString));
            }

            switch (sortOrder)
            {
                case "name_desc":
                    students = students.OrderByDescending(s => s.LastName);
                    break;
                case "Date":
                    students = students.OrderBy(s => s.EnrollmentDate);
                    break;
                case "date_desc":
                    students = students.OrderByDescending(s => s.EnrollmentDate);
                    break;
                default:
                    students = students.OrderBy(s => s.LastName);
                    break;
            }

            int pageSize = 3;
            int pageNumber = (page ?? 1);

            viewmodel.StudentsList = students.ToPagedList(pageNumber, pageSize);

            return View(viewmodel);
        }
コード例 #7
0
        // GET: Student/Create
        public IActionResult Create()
        {
            //var selects = groupRepository.GetGroupsAll;

            ////ViewData["GroupId"] = new SelectList(selects);
            //ViewBag.Hero = mvcContext.Groups.ToList();
            //ViewData["Group"] = new SelectList(selects).ToList();
            StudentsListViewModel studentList = new StudentsListViewModel();

            studentList.Groups = new SelectList(groupRepository.GetGroupsAll, "GroupId", "GroupName");

            TempData["Message"] = null;

            return(View(studentList));
        }
コード例 #8
0
        private string ProcessUploadedFile(StudentsListViewModel model)
        {
            string uniqueFileName = null;

            if (model.Photos != null)
            {
                string uploadsFoder = Path.Combine(hostingEnvironment.WebRootPath, "images");
                uniqueFileName = Guid.NewGuid().ToString() + "_" + model.Photos.FileName;
                string filePath = Path.Combine(uploadsFoder, uniqueFileName);
                using (var fileStream = new FileStream(filePath, FileMode.Create))
                {
                    model.Photos.CopyTo(fileStream);
                }
            }
            return(uniqueFileName);
        }
コード例 #9
0
        public ActionResult AddEditStudent(string pStudentID)
        {
            StudentsListViewModel model = new StudentsListViewModel();
            model.Student = new Student();

            if (ModelState.IsValid)
            {
                if (!string.IsNullOrEmpty(pStudentID))
                {
                    model.Student.StudentID = pStudentID;
                    model.Student = _StudentService.Get(model.Student);
                }
            }

            return View(model);
        }
コード例 #10
0
        public StudentsListPage(INavigation navi, _Class course)
        {
            Title = Properties.Resources.PageNameStudentsList;
            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);
            var vm = new StudentsListViewModel(navi, course, this);

            BindingContext         = vm;
            Students.ItemSelected += (sender, e) => {
                ((ListView)sender).SelectedItem = null;
            };
            MessagingCenter.Subscribe <StudentsListViewModel, string>(this, Properties.Resources.MsgNetworkError,
                                                                      async(sender, message) =>
            {
                await this.DisplayAlert("Problem z siecią", message, "OK");
            });
        }
コード例 #11
0
        public IActionResult Create(StudentsListViewModel model)
        {
            if (ModelState.IsValid)
            {
                string uniqueFileName = ProcessUploadedFile(model);
                //if (model.Photos != null && model.Photos.Count > 0)
                //{
                //    foreach (IFormFile photo in model.Photos)
                //    {
                //        string uploadsFoder = Path.Combine(hostingEnvironment.WebRootPath, "images");
                //        uniqueFileName = Guid.NewGuid().ToString() + "_" + photo.FileName;
                //        string filePath = Path.Combine(uploadsFoder, uniqueFileName);
                //        photo.CopyTo(new FileStream(filePath, FileMode.Create));
                //    }
                //}

                Student newStudent = new Student
                {
                    Name     = model.Student.Name,
                    UrlImage = uniqueFileName,
                    History  = model.Student.History,
                    GroupId  = model.Student.GroupId
                };
                _studentRepository.AddStudent(newStudent);
                var result = _studentRepository.Commit();

                if (result)
                {
                    TempData["Message"] = "Create Finish";
                }
                else
                {
                    TempData["Message"] = "Create Fails";
                }
                //return RedirectToAction(nameof(Index));
                return(RedirectToAction("Details", new { id = newStudent.StudentId }));
            }
            return(View());
        }
コード例 #12
0
        public StudentsPage(OccupationsListViewModel occupViewModel, Occupation occupation)
        {
            InitializeComponent();

            OccupViewModel = occupViewModel;
            ViewModel      = new StudentsListViewModel(occupation);
            BindingContext = ViewModel;

            this.occupation           = occupation;
            unavaibleButton.IsEnabled = occupation.IdLesson != 0;

            studentListView.ItemTapped += (sender, e) =>
            {
                studentListView.SelectedItem = null;

                if (e.Item is StudentSelect item)
                {
                    item.IsSelected  = !item.IsSelected;
                    ViewModel.OnSite = ViewModel.StudentsList.FindAll(s => s.IsSelected.Equals(false)).Count;
                }
            };
        }
コード例 #13
0
ファイル: HomeController.cs プロジェクト: bomorov/StudentApp
        public ActionResult Student_Filter(int?group, int?gender)
        {
            IQueryable <Student> students = db.Students.Include(p => p.Group).Include(p => p.Group.Facultat).Include(p => p.Gender);

            if (group != null && group != 0)
            {
                students = students.Where(p => p.GroupId == group);
            }
            if (gender != null && gender != 0)
            {
                students = students.Where(p => p.GenderId == gender);
            }

            List <Group> groups = db.Groups.ToList();

            // устанавливаем начальный элемент, который позволит выбрать всех
            groups.Insert(0, new Group {
                Name = "Все", Id = 0
            });

            List <Gender> genders = db.Genders.ToList();

            // устанавливаем начальный элемент, который позволит выбрать всех
            genders.Insert(0, new Gender {
                Name = "Все", Id = 0
            });

            StudentsListViewModel plvm = new StudentsListViewModel
            {
                Students = students.ToList(),
                Groups   = new SelectList(groups, "Id", "Name"),
                Genders  = new SelectList(genders, "Id", "Name"),
            };

            return(View(plvm));
        }  /// Фильтрация студентов по группам и половому признаку
コード例 #14
0
        public ActionResult DeleteStudent(string pStudentID)
        {
            if (!string.IsNullOrEmpty(pStudentID))
            {
                StudentsListViewModel model = new StudentsListViewModel();
                model.Student = new Student();
                model.Student.StudentID = pStudentID;
                int i = _StudentService.Delete(model.Student);

                if (i <= 0)
                    TempData["err"] = StudentRes.MsgDeleteError;
                else
                    TempData["msg"] = StudentRes.MsgDeleteSuccess;
            }

            return RedirectToAction("ManageStudents", "Students");
        }
コード例 #15
0
        public ActionResult DeleteStudentClass(string pStudentClassID, string pStudentID)
        {
            StudentsListViewModel model = new StudentsListViewModel();

            if (model.StudentsClass == null)
                model.StudentsClass = new StudentsClass();

            if (!string.IsNullOrEmpty(pStudentClassID))
            {
                model.StudentsClass.StudentClassID = pStudentClassID;
                model.StudentsClass.StudentID = pStudentID;
                _StudentsClassService.Delete(model.StudentsClass);
            }

            return RedirectToAction("StudentsClass", "Students", new { tn = "6", pStudentID = model.StudentsClass.StudentID });
        }
コード例 #16
0
        public ActionResult UploadStudents(StudentsListViewModel model)
        {
            bool bSuccess = false;

            if (model.Student != null && model.Student.StudentExcelFile != null)
            {
                string[] extensions = { ".xls", ".xlsx" };
                if (!extensions.Any(x => x.Equals(Path.GetExtension(model.Student.StudentExcelFile.FileName.ToLower()), StringComparison.OrdinalIgnoreCase)))
                {
                    TempData["err"] = "Please select valid file type, allowed file type are .xls and .xlsx";
                }
                else
                {
                    model.Student = _StudentService.SaveExcelFile(model.Student);

                    if (!string.IsNullOrEmpty(model.Student.StudentExcelFilePath))
                    {
                        bSuccess = _StudentService.UploadFromExcelFile(model.Student);
                    }

                    if (!bSuccess)
                        TempData["err"] = "Problem occured, please try again";
                    else
                        TempData["msg"] = "Students Informatin uploaded successfully";
                }
            }
            else
            {
                TempData["err"] = "Please select file";
            }

            return RedirectToAction("ManageStudents");
        }
コード例 #17
0
        public Image GetImg(string pStudentID)
        {
            StudentsListViewModel model = new StudentsListViewModel();
            model.Student = new Student();

            if (ModelState.IsValid)
            {
                if (!string.IsNullOrEmpty(pStudentID))
                {
                    model.Student.StudentID = pStudentID;
                    model.Student = _StudentService.Get(model.Student);

                    if (model.Student.Image != null)
                    {
                        MemoryStream ms = new MemoryStream(model.Student.Image);
                        System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
                        img.Save(Response.OutputStream, ImageFormat.Gif);
                        return img;
                    }
                    else
                        return null;
                }
                else
                    return null;
            }
            else
                return null;
        }
コード例 #18
0
        public ActionResult StudentsTransport(StudentsListViewModel model)
        {
            FillAllTransportDropdowns();

            string strSuccessMsg = string.Empty;
            string strErrorMsg = string.Empty;

            if (model != null && model.StudentsTransport != null && !string.IsNullOrEmpty(model.StudentsTransport.StudentID))
            {
                strSuccessMsg = StudentRes.MsgEditSuccess;
                strErrorMsg = StudentRes.MsgEditError;

                int i = _StudentsTransportService.AddEdit(model.StudentsTransport);

                if (i <= 0)
                {
                    TempData["err"] = strErrorMsg;
                }
                else
                {
                    TempData["msg"] = strSuccessMsg;
                }
            }

            return RedirectToAction("AddEditStudent", "Students", new { tn = "4", pStudentID = model.StudentsTransport.StudentID });
        }
コード例 #19
0
        public ActionResult UploadStudents()
        {
            StudentsListViewModel model = new StudentsListViewModel();
            model.Student = new Student();

            return View(model);
        }
コード例 #20
0
        public ActionResult EditStudentClass(StudentsListViewModel model)
        {
            FillAllDropdownsForClassAssignment();

            string strSuccessMsg = string.Empty;
            string strErrorMsg = string.Empty;

            if (model != null && model.StudentsClass != null)
            {
                if (string.IsNullOrEmpty(model.StudentsClass.StudentClassID))
                {
                    strSuccessMsg = StudentsClassRes.MsgAddSuccess;
                    strErrorMsg = StudentsClassRes.MsgAddError;
                }
                else
                {
                    strSuccessMsg = StudentsClassRes.MsgEditSuccess;
                    strErrorMsg = StudentsClassRes.MsgEditError;
                }

                int i = _StudentsClassService.AddEdit(model.StudentsClass);

                if (i <= 0)
                {
                    TempData["err"] = strErrorMsg;
                }
                else
                {
                    TempData["msg"] = strSuccessMsg;
                }
            }

            return RedirectToAction("StudentsClass", "Students", new { tn = "6", pStudentID = model.StudentsClass.StudentID });
        }
コード例 #21
0
        public ActionResult StudentsTransport(string pStudentID)
        {
            FillAllTransportDropdowns();

            StudentsListViewModel model = new StudentsListViewModel();
            model.StudentsTransport = new StudentsTransport();

            if (ModelState.IsValid)
            {
                if (!string.IsNullOrEmpty(pStudentID))
                {
                    model.StudentsTransport.StudentID = pStudentID;
                    model.StudentsTransport = _StudentsTransportService.Get(model.StudentsTransport);
                }

                if (model.StudentsTransport == null)
                    model.StudentsTransport = new StudentsTransport();

                if (string.IsNullOrEmpty(model.StudentsTransport.StudentID))
                    model.StudentsTransport.StudentID = pStudentID;

                if (string.IsNullOrEmpty(Convert.ToString(model.StudentsTransport.SchoolVehicleOpted)))
                    model.StudentsTransport.SchoolVehicleOpted = false;
            }

            return PartialView("_StudentsTransport", model);
        }
コード例 #22
0
        public ActionResult StudentDetails(string pStudentID)
        {
            FillAllStudentsDropdowns();

            StudentsListViewModel model = new StudentsListViewModel();
            model.Student = new Student();

            if (ModelState.IsValid)
            {
                if (!string.IsNullOrEmpty(pStudentID))
                {
                    model.Student.StudentID = pStudentID;
                    model.Student = _StudentService.Get(model.Student);
                }
            }

            return PartialView("_StudentDetails", model);
        }
コード例 #23
0
        public ActionResult ManageStudents(StudentsListViewModel model, string submit)
        {
            FillAllStudentsDropdowns();

            if (model.Student == null)
            {
                model.Student = new Student();
            }

            if (!string.IsNullOrEmpty(model.Student.sort))
            {
                model.Student.SortExp = model.Student.sort + " " + model.Student.sortdir;
            }

            if (model.Student.PageSize == 0)
            {
                int PageSize = Convert.ToInt32(ConfigurationManager.AppSettings["PageSize"]);
                model.Student.PageSize = PageSize;
            }

            if (model.Student.PageIndex == 0)
            {
                model.Student.PageIndex = 1;
            }
            model.StudentList = new List<Student>();
            model.Student.TotalCount = 0;

            //Searh Criteria
            if (model != null && model.Student != null)
            {
                if (!string.IsNullOrEmpty(model.Student.SearchFormNo))
                    model.Student.FormNo = model.Student.SearchFormNo;

                if (!string.IsNullOrEmpty(model.Student.SearchFirstName))
                    model.Student.FirstName = model.Student.SearchFirstName;

                if (!string.IsNullOrEmpty(model.Student.SearchLastName))
                    model.Student.LastName = model.Student.SearchLastName;

                if (!string.IsNullOrEmpty(Convert.ToString(model.Student.SearchCurrentRollNo)))
                    model.Student.CurrentRollNo = model.Student.SearchCurrentRollNo;
            }

            model.StudentList = _StudentService.GetAll(model.Student).ToList();

            if (model.StudentList != null && model.StudentList.Count > 0)
            {
                int TotalCount = model.StudentList[0].TotalCount;
                model.Student.TotalCount = TotalCount;
            }

            return View(model);
        }
コード例 #24
0
        public ActionResult StudentsAttendance(StudentsListViewModel model)
        {
            if (model == null)
            {
                model = new StudentsListViewModel();
            }
            if (model.StudentsAttendance == null)
            {
                model.StudentsAttendance = new StudentsAttendance();
            }
            if (model.StudentsAttendanceList == null)
            {
                model.StudentsAttendanceList = new List<StudentsAttendance>();
            }

            ViewBag.AYList = GetAllAY();
            ViewBag.ClassList = GetAllClass();
            ViewBag.SectionList = GetAllSection();
            ViewBag.MonthList = GetCalendarMonths();

            List<SelectListItem> lstWeeks = new List<SelectListItem>();
            for (int i = 1; i < 6; i++)
            {
                SelectListItem item = new SelectListItem();
                item.Text = i.ToString();
                item.Value = i.ToString();
                lstWeeks.Add(item);
            }

            SelectList retList = new SelectList(lstWeeks, "Value", "Text");

            ViewBag.WeeksList = retList;

            if (!string.IsNullOrEmpty(model.StudentsAttendance.Week))
            {
                model.StudentsAttendanceList = _StudentsAttendanceService.GetAll(model.StudentsAttendance).ToList();
                int year = DateTime.Now.Year;

                int lookupWeek = Convert.ToInt32(model.StudentsAttendance.Week);

                int daysInMonth = DateTime.DaysInMonth(year, Convert.ToInt32(model.StudentsAttendance.Month));
                int weekCounter = 1;

                List<DateTime> weekDays = new List<DateTime>();

                for (int day = 1; day <= daysInMonth; day++)
                {
                    DateTime date = new DateTime(year, Convert.ToInt32(model.StudentsAttendance.Month), day);
                    if (date.DayOfWeek == DayOfWeek.Sunday && day > 1) weekCounter++;

                    if (weekCounter == lookupWeek && date.DayOfWeek != DayOfWeek.Sunday)
                    {
                        weekDays.Add(date);
                    }
                }
                model.lstWeekDates = weekDays;
            }
            return View(model);
        }
コード例 #25
0
        public ActionResult StudentsClass(string pStudentID)
        {
            StudentsListViewModel model = new StudentsListViewModel();

            if (model.Student == null)
                model.Student = new Student();

            if (model.StudentsClass == null)
                model.StudentsClass = new StudentsClass();

            model.StudentsClass.StudentID = pStudentID;

            model.StudentsClassList = new List<StudentsClass>();
            model.StudentsClassList = _StudentsClassService.GetAll(model.StudentsClass).ToList();

            return PartialView("_StudentsClass", model);
        }
コード例 #26
0
        public ActionResult StudentsMedical(string pStudentID)
        {
            StudentsListViewModel model = new StudentsListViewModel();
            model.StudentsMedical = new StudentsMedical();

            if (ModelState.IsValid)
            {
                if (!string.IsNullOrEmpty(pStudentID))
                {
                    model.StudentsMedical.StudentID = pStudentID;
                    model.StudentsMedical = _StudentsMedicalService.Get(model.StudentsMedical);
                }

                if (model.StudentsMedical == null)
                    model.StudentsMedical = new StudentsMedical();

                if (string.IsNullOrEmpty(model.StudentsMedical.StudentID))
                    model.StudentsMedical.StudentID = pStudentID;

                if (string.IsNullOrEmpty(Convert.ToString(model.StudentsMedical.AnyPhysicalHandicapOrDisability)))
                    model.StudentsMedical.AnyPhysicalHandicapOrDisability = false;

                if (string.IsNullOrEmpty(Convert.ToString(model.StudentsMedical.AnyOtherHealthProblems)))
                    model.StudentsMedical.AnyOtherHealthProblems = false;
            }

            return PartialView("_StudentsMedical", model);
        }
コード例 #27
0
        public ActionResult StudentsDocs(StudentsListViewModel model)
        {
            FillAllDocDropdowns();

            string strSuccessMsg = string.Empty;
            string strErrorMsg = string.Empty;

            if (model != null && model.StudentsDocs != null
                && model.StudentsDocs.DocImageFile != null
                && !Utility.IsImage(model.StudentsDocs.DocImageFile))
            {
                ModelState.AddModelError("", Validation.MsgUploadValidFileFormatImage);
                return RedirectToAction("AddEditStudent", "Students", new { tn = "5", pStudentID = model.StudentsDocs.StudentID });
            }

            if (model != null && model.StudentsDocs != null)
            {
                strSuccessMsg = StudentRes.MsgEditSuccess;
                strErrorMsg = StudentRes.MsgEditError;

                //Upload Image
                if (model.StudentsDocs.DocImageFile != null && !string.IsNullOrEmpty(model.StudentsDocs.DocImageFile.FileName)
                    && Utility.IsImage(model.StudentsDocs.DocImageFile))
                {
                    using (MemoryStream ms = new MemoryStream())
                    {
                        model.StudentsDocs.DocImageFile.InputStream.CopyTo(ms);
                        byte[] array = ms.GetBuffer();
                        model.StudentsDocs.Image = array;
                    }

                    model.StudentsDocs.FileName = model.StudentsDocs.DocImageFile.FileName;
                }

                int i = _StudentsDocsService.AddEdit(model.StudentsDocs);

                if (i <= 0)
                {
                    TempData["err"] = strErrorMsg;
                }
                else
                {
                    TempData["msg"] = strSuccessMsg;
                }
            }

            return RedirectToAction("AddEditStudent", "Students", new { tn = "5", pStudentID = model.StudentsDocs.StudentID });
        }
コード例 #28
0
        public ActionResult StudentsDocs(string pStudentID)
        {
            FillAllDocDropdowns();

            StudentsListViewModel model = new StudentsListViewModel();
            model.StudentsDocs = new StudentsDocs();

            if (ModelState.IsValid)
            {
                if (!string.IsNullOrEmpty(pStudentID))
                {
                    model.StudentsDocs.StudentID = pStudentID;
                    model.StudentsDocsList = _StudentsDocsService.GetAllDocs(model.StudentsDocs).ToList();
                }

                if (model.StudentsDocs == null)
                    model.StudentsDocs = new StudentsDocs();

                if (string.IsNullOrEmpty(model.StudentsDocs.StudentID))
                    model.StudentsDocs.StudentID = pStudentID;
            }

            return PartialView("_StudentsDocs", model);
        }
コード例 #29
0
        public ActionResult StudentsParent(string pStudentID)
        {
            StudentsListViewModel model = new StudentsListViewModel();
            model.StudentsParent = new StudentsParent();

            if (ModelState.IsValid)
            {
                if (!string.IsNullOrEmpty(pStudentID))
                {
                    model.StudentsParent.StudentID = pStudentID;
                    model.StudentsParent = _StudentsParentService.Get(model.StudentsParent);
                }

                if (model.StudentsParent == null)
                    model.StudentsParent = new StudentsParent();

                if (string.IsNullOrEmpty(model.StudentsParent.StudentID))
                    model.StudentsParent.StudentID = pStudentID;
            }

            return PartialView("_StudentsParent", model);
        }
コード例 #30
0
        public ActionResult StudentsParent(StudentsListViewModel model, string submit)
        {
            if (model != null && model.StudentsParent != null
                && model.StudentsParent.GovtIDImageFile != null
                && !Utility.IsImage(model.StudentsParent.GovtIDImageFile))
            {
                ModelState.AddModelError("", Validation.MsgUploadValidFileFormatImage);
                return RedirectToAction("AddEditStudent", "Students", new { tn = "2", pStudentID = model.StudentsParent.StudentID });
            }

            if (!string.IsNullOrEmpty(submit))
            {
                if (submit.Trim().ToLower() == StudentRes.DeletePhoto.Trim().ToLower())
                {
                    if (model != null && model.Student != null)
                    {
                        if (!string.IsNullOrEmpty(model.StudentsParent.StudentID))
                        {
                            _StudentsParentService.DeleteGovtIDPhoto(model.StudentsParent);
                            model.StudentsParent.GovtIDImageFile = null;
                            model.StudentsParent.GovtIDImage = null;
                        }
                        else
                        {
                            model.StudentsParent.GovtIDImageFile = null;
                            model.StudentsParent.GovtIDImage = null;
                        }
                    }
                    else
                    {
                        model.StudentsParent.GovtIDImageFile = null;
                        model.StudentsParent.GovtIDImage = null;
                    }
                }
                else if (submit.Trim().ToLower() == StudentRes.UploadPhoto.Trim().ToLower())
                {
                    if (model != null && model.StudentsParent != null)
                    {
                        if (model != null && model.StudentsParent != null && model.StudentsParent.GovtIDImageFile == null)
                        {
                            ModelState.AddModelError("", Validation.MsgSelectFileAndUploadImage);
                            return RedirectToAction("AddEditStudent", "Students", new { tn = "1", pStudentID = model.StudentsParent.StudentID });
                        }

                        //Upload Photo
                        if (model.StudentsParent.GovtIDImageFile != null && !string.IsNullOrEmpty(model.StudentsParent.GovtIDImageFile.FileName)
                            && Utility.IsImage(model.StudentsParent.GovtIDImageFile))
                        {
                            using (MemoryStream ms = new MemoryStream())
                            {
                                model.StudentsParent.GovtIDImageFile.InputStream.CopyTo(ms);
                                byte[] array = ms.GetBuffer();
                                model.StudentsParent.GovtIDImage = array;
                            }
                        }

                        int i = _StudentsParentService.AddEdit(model.StudentsParent);
                    }

                    return RedirectToAction("AddEditStudent", "Students", new { tn = "1", pStudentID = model.StudentsParent.StudentID });
                }
                else if (submit.Trim().ToLower() == StudentRes.Save.Trim().ToLower())
                {
                    string strSuccessMsg = string.Empty;
                    string strErrorMsg = string.Empty;

                    if (model != null && model.StudentsParent != null && !string.IsNullOrEmpty(model.StudentsParent.StudentID))
                    {
                        strSuccessMsg = StudentRes.MsgEditSuccess;
                        strErrorMsg = StudentRes.MsgEditError;

                        //Upload Photo
                        if (model.StudentsParent.GovtIDImageFile != null && !string.IsNullOrEmpty(model.StudentsParent.GovtIDImageFile.FileName)
                            && Utility.IsImage(model.StudentsParent.GovtIDImageFile))
                        {
                            using (MemoryStream ms = new MemoryStream())
                            {
                                model.StudentsParent.GovtIDImageFile.InputStream.CopyTo(ms);
                                byte[] array = ms.GetBuffer();
                                model.StudentsParent.GovtIDImage = array;
                            }
                        }

                        int i = _StudentsParentService.AddEdit(model.StudentsParent);

                        if (i <= 0)
                        {
                            TempData["err"] = strErrorMsg;
                        }
                        else
                        {
                            TempData["msg"] = strSuccessMsg;
                        }
                    }
                }
            }

            return RedirectToAction("AddEditStudent", "Students", new { tn = "2", pStudentID = model.StudentsParent.StudentID });
        }
コード例 #31
0
        public ActionResult AssignStudentToClass(StudentsListViewModel model, string submit, string[] ids)
        {
            FillAllDropdownsForClassAssignment();

            if (submit == StudentsClassRes.Save)
            {
                if (model.StudentsClass.IsCurrentClass)
                {
                    foreach (string strStudentID in ids)
                    {
                        StudentsClass obj = new StudentsClass();
                        obj.StudentID = strStudentID;
                        obj.AcademicYearID = model.StudentsClass.AcademicYearID;
                        obj.ClassID = model.StudentsClass.ClassID;
                        obj.SectionID = model.StudentsClass.SectionID;
                        obj.BatchID = model.StudentsClass.BatchID;
                        obj.IsCurrentClass = model.StudentsClass.IsCurrentClass;

                        _StudentsClassService.SetAllCurrentClassFalse(obj);
                        _StudentsClassService.AddEdit(obj);

                        Student objStudent = new Student();
                        objStudent.StudentID = strStudentID;
                        objStudent.CurrentAcademicYearID = model.StudentsClass.AcademicYearID;
                        objStudent.CurrentClassID = model.StudentsClass.ClassID;
                        objStudent.CurrentSectionID = model.StudentsClass.SectionID;
                        objStudent.CurrentBatchID = model.StudentsClass.BatchID;

                        _StudentService.UpdateStudentsClassRollNo(objStudent);

                    }
                }
            }

            if (model.Student == null)
                model.Student = new Student();

            if (model.StudentsClass == null)
                model.StudentsClass = new StudentsClass();

            model.StudentList = new List<Student>();
            model.StudentList = _StudentService.GetAllStudentForClassAssignment(model.Student).ToList();

            return View(model);
        }
コード例 #32
0
        public ActionResult AssignRollNo(StudentsListViewModel model, string submit)
        {
            FillAllDropdownsForClassAssignment();

            if (submit == StudentsClassRes.Save)
            {
                if (model.StudentList != null && model.StudentList.Count > 0)
                {
                    foreach (Student objStudent in model.StudentList)
                    {
                        if (objStudent.CurrentRollNo != 0)
                        {
                            Student objGetStudent = new Student();
                            objGetStudent.StudentID = objStudent.StudentID;
                            objGetStudent = _StudentService.Get(objGetStudent);

                            if (objGetStudent != null && !string.IsNullOrEmpty(objGetStudent.FirstName))
                            {
                                objStudent.CurrentAcademicYearID = objGetStudent.CurrentAcademicYearID;
                                objStudent.CurrentClassID = objGetStudent.CurrentClassID;
                                objStudent.CurrentSectionID = objGetStudent.CurrentSectionID;
                                objStudent.CurrentBatchID = objGetStudent.CurrentBatchID;
                                _StudentService.UpdateStudentsClassRollNo(objStudent);

                                StudentsClass obj = new StudentsClass();
                                obj.StudentID = objStudent.StudentID; ;
                                obj.AcademicYearID = objGetStudent.CurrentAcademicYearID;
                                obj.ClassID = objGetStudent.CurrentClassID;
                                obj.SectionID = objGetStudent.CurrentSectionID;
                                obj.BatchID = objGetStudent.CurrentBatchID;
                                obj.RollNo = objGetStudent.CurrentRollNo;

                                _StudentsClassService.UpdateCurrentClassRollNo(obj);
                            }

                        }
                    }
                }
            }

            if (model.Student == null)
                model.Student = new Student();

            if (model.StudentsClass == null)
                model.StudentsClass = new StudentsClass();

            model.StudentList = new List<Student>();
            model.StudentList = _StudentService.GetAllStudentForClassAssignment(model.Student).ToList();

            return View(model);
        }
コード例 #33
0
        public ActionResult StudentsMedical(StudentsListViewModel model)
        {
            string strSuccessMsg = string.Empty;
            string strErrorMsg = string.Empty;

            if (model != null && model.StudentsMedical != null && !string.IsNullOrEmpty(model.StudentsMedical.StudentID))
            {
                strSuccessMsg = StudentRes.MsgEditSuccess;
                strErrorMsg = StudentRes.MsgEditError;

                int i = _StudentsMedicalService.AddEdit(model.StudentsMedical);

                if (i <= 0)
                {
                    TempData["err"] = strErrorMsg;
                }
                else
                {
                    TempData["msg"] = strSuccessMsg;
                }
            }

            return RedirectToAction("AddEditStudent", "Students", new { tn = "3", pStudentID = model.StudentsMedical.StudentID });
        }
コード例 #34
0
        public ActionResult EditStudentClass(string pStudentClassID, string pStudentID)
        {
            FillAllDropdownsForClassAssignment();

            StudentsListViewModel model = new StudentsListViewModel();

            if (model.StudentsClass == null)
                model.StudentsClass = new StudentsClass();

            if (!string.IsNullOrEmpty(pStudentClassID))
            {
                model.StudentsClass.StudentClassID = pStudentClassID;
                model.StudentsClass.StudentID = pStudentID;
                model.StudentsClass = _StudentsClassService.Get(model.StudentsClass);
            }

            return PartialView("_EditStudentClass", model);
        }