示例#1
0
        public JsonResult UpdateSpecialityDataId(AjaxSpecialityDataModel parameters)
        {
            var speciality   = SelectSpecialities(parameters).FirstOrDefault();
            var specialityId = SelectSpecialities(parameters).FirstOrDefault()?.SpecialityId ?? 0;

            return(Json(new { Id = specialityId }));
        }
示例#2
0
        public IQueryable <Speciality> SelectSpecialities(AjaxSpecialityDataModel parameters)
        {
            var specialities = _repository.Specialities;

            if (parameters.GroupId != null)
            {
                specialities = specialities.Where(sp => sp.SpecialityGroupId == parameters.GroupId);
            }
            if (parameters.EducationPlaceId != null)
            {
                specialities = specialities.Where(sp => sp.EducationPlaceId == parameters.EducationPlaceId);
            }
            if (parameters.FinancingTypeId != null)
            {
                specialities = specialities.Where(sp => sp.FinancingTypeId == parameters.FinancingTypeId);
            }
            if (parameters.EducationFormId != null)
            {
                specialities = specialities.Where(sp => sp.EducationFormId == parameters.EducationFormId);
            }
            if (parameters.EducationDurationId != null)
            {
                specialities = specialities.Where(sp => sp.EducationDurationId == parameters.EducationDurationId);
            }
            if (parameters.SpecialityId != null)
            {
                specialities = specialities.Where(sp => sp.NCSQSpecialityId == parameters.SpecialityId);
            }
            if (parameters.SelectedSpecialities != null)
            {
                specialities = specialities.Where(sp => !parameters.SelectedSpecialities.Contains(sp.SpecialityId));
            }
            return(specialities);
        }
示例#3
0
        public JsonResult LoadNCSQSpecialityOptions(AjaxSpecialityDataModel parameters)
        {
            var specialitySet = new HashSet <NCSQSpeciality>(SelectSpecialities(parameters).Select(sp => sp.NCSQSpeciality));
            var options       = specialitySet.Select(sp => new
            {
                Text  = sp.Name,
                Value = sp.NCSQSpecialityId,
                Label = sp.Cipher + " " + sp.Name
            });

            return(Json(options));
        }
示例#4
0
        public JsonResult LoadEducationDurationOptions(AjaxSpecialityDataModel parameters)
        {
            var educationDurationSet = new HashSet <EducationDuration>(SelectSpecialities(parameters).Select(sp => sp.EducationDuration));
            var options = educationDurationSet.Select(sp => new
            {
                Text  = sp.Duration,
                Value = sp.EducationDurationId,
                Label = sp.Duration
            });

            return(Json(options));
        }
示例#5
0
        public JsonResult LoadEducationFormOptions(AjaxSpecialityDataModel parameters)
        {
            var educationFormSet = new HashSet <EducationForm>(SelectSpecialities(parameters).Select(sp => sp.EducationForm));
            var options          = educationFormSet.Select(sp => new
            {
                Text  = sp.Name,
                Value = sp.EducationFormId,
                Label = sp.IsInternal ? "Full-time" : "Correspondence"
            });

            return(Json(options));
        }
示例#6
0
        public JsonResult LoadFinancingTypeOptions(AjaxSpecialityDataModel parameters)
        {
            var finTypeSet = new HashSet <FinancingType>(SelectSpecialities(parameters).Select(sp => sp.FinancingType));
            var options    = finTypeSet.Select(ft => new
            {
                Text  = ft.Type,
                Value = ft.FinancingTypeId,
                Label = ft.Type
            });

            return(Json(options));
        }
示例#7
0
        public JsonResult LoadEducationPlaceOptions(AjaxSpecialityDataModel parameters)
        {
            var options = SelectSpecialities(parameters)
                          .GroupBy(sp => sp.EducationPlace)
                          .Select(group => new
            {
                Text  = group.Key.Name,
                Value = group.Key.EducationPlaceId,
                Label = group.Key.Name
            });

            return(Json(options));
        }