Пример #1
0
 public JsonResult ShowStudentProfile()
 {
     return(Json(new
     {
         Html = RenderPartial.RenderPartialView(this, "~/Views/Student/_profile.cshtml", null),
         Message = "",
         Status = "OK"
     }, JsonRequestBehavior.AllowGet));
 }
Пример #2
0
 public JsonResult BindDashboardByRole()
 {
     return(Json(new
     {
         Html = RenderPartial.RenderPartialView(this, "~/Views/Dashboard/_adminDashboard.cshtml", null),
         Message = "",
         Status = "OK"
     }, JsonRequestBehavior.AllowGet));
 }
Пример #3
0
 public JsonResult ShowStudentTransaction()
 {
     return(Json(new
     {
         //Html = RenderPartial.RenderPartialView(this, "~/Views/Student/_payTransactionSummary.cshtml", null),
         Html = RenderPartial.RenderPartialView(this, "~/Views/Student/_pay.cshtml", null),
         Message = "",
         Status = "OK"
     }, JsonRequestBehavior.AllowGet));
 }
Пример #4
0
        public JsonResult GetStudentById(int studentId)
        {
            var result = _studentRepository.GetById(studentId);

            //return Json(result, JsonRequestBehavior.AllowGet);
            return(Json(new
            {
                Html = RenderPartial.RenderPartialView(this, "~/Views/Student/_demographic.cshtml", result.Model),
                Message = "",
                Status = "OK"
            }, JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        public JsonResult ShowPeriodModal(int periodId)
        {
            ViewBag.Grade        = _gradeRepository.GetAll(periodId).Data;
            ViewBag.IsReadyToAdd = _repository.IsReadyToAdd();

            return(Json(new
            {
                Html = RenderPartial.RenderPartialView(this, "~/Views/Period/_create.cshtml", null),
                Message = "",
                Status = "OK"
            }, JsonRequestBehavior.AllowGet));
        }
Пример #6
0
        public JsonResult ShowGradeAvailables(int periodId = 0)
        {
            var grades = _gradeRepository.GetAll(periodId).Data;

            ViewBag.Grade = grades;

            return(Json(new
            {
                Html = RenderPartial.RenderPartialView(this, "~/Views/PeriodGrade/_create.cshtml", null),
                Message = "",
                Status = "OK",
                TotalRecords = grades.Count()
            }, JsonRequestBehavior.AllowGet));
        }
Пример #7
0
        public JsonResult ShowStudentTransaction()
        {
            ViewBag.Teachers = _userRepository.GetUserByRole(Model.Enumerator.Enum.UserRoles.Teacher).Data
                               .Select(i => new SelectListItem()
            {
                Text  = i.UserModel.UserFullName,
                Value = i.UserRoleId.ToString()
            });

            return(Json(new
            {
                Html = RenderPartial.RenderPartialView(this, "~/Views/GradeGroup/_addGroup.cshtml", null),
                Message = "",
                Status = "OK"
            }, JsonRequestBehavior.AllowGet));
        }
Пример #8
0
        public JsonResult ShowSearch()
        {
            //ViewBag.Period = _periodRepository.GetAll().Data
            //                                    .Select(i => new SelectListItem()
            //                                    {
            //                                        Text = i.YearFrom.ToString() + " - " + i.YearTo.ToString(),
            //                                        Value = i.PeriodId.ToString()
            //                                    });

            //ViewBag.Grade = _gradeRepository.GetAll(0).Data
            //                                    .Select(i => new SelectListItem()
            //                                    {
            //                                        Text =i.GradeDescription,
            //                                        Value = i.GradeId.ToString()
            //                                    });

            ViewBag.Gender = _genderRepository.GetAll().Data
                             .Select(i => new SelectListItem()
            {
                Text  = i.GenderDescription,
                Value = i.GenderId.ToString()
            });

            ViewBag.City = _cityRepository.GetAll().Data
                           .Select(i => new SelectListItem()
            {
                Text  = i.CityDescription,
                Value = i.CityId.ToString()
            });

            return(Json(new
            {
                Html = RenderPartial.RenderPartialView(this, "~/Views/Student/_search.cshtml", null),

                Message = "",
                Status = "OK"
            }, JsonRequestBehavior.AllowGet));
        }
Пример #9
0
        public JsonResult ShowStudentCreate(int studentId, string isEnrollment)
        {
            var controlToLoad = isEnrollment == "N"? "_addStudent.cshtml": "_enrollment.cshtml";

            try
            {
                var allowedStattus = new[] { 1, 3 };
                ViewBag.Period = _periodRepository.GetAll().Data
                                 .Where(m => allowedStattus.Contains(m.PeriodStatusTypeModel.PeriodStatusTypeId))
                                 .Select(i => new SelectListItem()
                {
                    Text  = i.YearFrom + ' ' + i.YearTo,
                    Value = i.PeriodId.ToString()
                });

                ViewBag.Grade = _gradeRepository.GetAll(0).Data
                                .Select(i => new SelectListItem()
                {
                    Text  = i.GradeDescription,
                    Value = i.GradeId.ToString()
                });



                ViewBag.TransactionType = _transactionTypeRepository.GetAll().Data;


                if (isEnrollment == "N")
                {
                    ViewBag.Cities = _cityRepository.GetAll().Data
                                     .Select(i => new SelectListItem()
                    {
                        Text  = i.CityDescription,
                        Value = i.CityId.ToString()
                    });

                    ViewBag.Gender = _genderRepository.GetAll().Data
                                     .Select(i => new SelectListItem()
                    {
                        Text  = i.GenderDescription,
                        Value = i.GenderId.ToString()
                    });
                }


                // Get Student Info
                var studentResponse = new ServiceResponseModel <StudentModel>();
                if (studentId != 0)
                {
                    studentResponse = _studentRepository.GetById(studentId);

                    if (studentResponse.Response == Model.Enumerator.Enum.ServiceResponses.Failure)
                    {
                        throw new Exception(studentResponse.Reason);
                    }
                }

                return(Json(new
                {
                    //Html = RenderPartial.RenderPartialView(this, "~/Views/Student/_addStudent.cshtml", studentResponse.Model),
                    Html = RenderPartial.RenderPartialView(this, "~/Views/Student/" + controlToLoad, studentResponse.Model),
                    Message = "",
                    Status = "OK"
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    Message = ex.Message,
                    Status = "ERROR"
                }, JsonRequestBehavior.AllowGet));
            }
        }