//public List<Schools> getAllSchools(opensisContext context) public SchoolListViewModel getAllSchools(SchoolViewModel objModel) { logger.Info("Method getAllSchools called."); SchoolListViewModel schoolList = new SchoolListViewModel(); try { if (TokenManager.CheckToken(objModel._tenantName, objModel._token)) { List <Schools> schools = this.schoolRepository.GetAllSchools(); schoolList.schoolList = schools; schoolList._message = SUCCESS; schoolList._failure = false; logger.Info("Method getAllSchools end with success."); } else { schoolList._failure = true; schoolList._message = TOKENINVALID; } } catch (Exception ex) { schoolList._message = ex.Message; schoolList._failure = true; logger.Error("Method getAllSchools end with error :" + ex.Message); } return(schoolList); }
//public bool IsMandatoryFieldsArePresent(Schools schools) //{ // bool isvalid = false; // if (schools.tenant_id != "" && schools.school_name != "") // { // isvalid = true; // } // return isvalid; //} /// <summary> /// Student Enrollment School List /// </summary> /// <param name="schoolListViewModel"></param> /// <returns></returns> public SchoolListViewModel StudentEnrollmentSchoolList(SchoolListViewModel schoolListViewModel) { logger.Info("Method studentEnrollmentSchoolList called."); SchoolListViewModel schoolListView = new SchoolListViewModel(); try { if (TokenManager.CheckToken(schoolListViewModel._tenantName + schoolListViewModel._userName, schoolListViewModel._token)) { schoolListView = this.schoolRepository.StudentEnrollmentSchoolList(schoolListViewModel); schoolListView._message = SUCCESS; schoolListView._failure = false; logger.Info("Method StudentEnrollmentSchoolList end with success."); } else { schoolListView._failure = true; schoolListView._message = TOKENINVALID; } } catch (Exception ex) { schoolListView._message = ex.Message; schoolListView._failure = true; logger.Error("Method StudentEnrollmentSchoolList end with error :" + ex.Message); } return(schoolListView); }
private SchoolListViewModel GetSchoolViewModelList(dynamic response, string orderBy, int page) { var schoolListVm = new List <SchoolViewModel>(); var vm = new SchoolListViewModel(schoolListVm, null, orderBy); if (response != null) { foreach (var result in response.Results) { var schoolVm = new SchoolViewModel(result); schoolListVm.Add(schoolVm); } vm.SchoolComparisonList = base.ExtractSchoolComparisonListFromCookie(); var filters = _filterBuilder.ConstructTrustSchoolSearchFilters(Request.QueryString, response.Facets); vm.Filters = filters; vm.FilterSelectionState = DetermineSelectionState(filters); vm.Pagination = new Pagination { Start = (SearchDefaults.TRUST_SCHOOLS_PER_PAGE * (page - 1)) + 1, Total = response.NumberOfResults, PageLinksPerPage = SearchDefaults.LINKS_PER_PAGE, MaxResultsPerPage = SearchDefaults.TRUST_SCHOOLS_PER_PAGE }; } return(vm); }
public ActionResult <SchoolListViewModel> StudentEnrollmentSchoolList(SchoolListViewModel schoolListViewModel) { SchoolListViewModel schoolListView = new SchoolListViewModel(); try { schoolListView = _schoolRegisterService.StudentEnrollmentSchoolList(schoolListViewModel); } catch (Exception es) { schoolListView._message = es.Message; schoolListView._failure = true; } return(schoolListView); }
public ActionResult AddEditSchool(string pSchoolID) { FillAllDropdowns(); User objUser = null; if (eSchoolSession.IsInSession(SessionKeys.CurrentUser)) objUser = (User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser); SchoolListViewModel model = new SchoolListViewModel(); model.School = new School(); if (ModelState.IsValid) { if (!string.IsNullOrEmpty(pSchoolID)) { model.School.SchoolID = pSchoolID; model.School = _ObjService.Get(model.School); } } return View(model); }
public ActionResult AddEditSchool(SchoolListViewModel model, string submit) { FillAllDropdowns(); if (!string.IsNullOrEmpty(submit)) { if (submit.Trim().ToLower() == SchoolRes.DeleteLogo.Trim().ToLower()) { if (model != null && model.School != null) { if (!string.IsNullOrEmpty(model.School.SchoolID)) { _ObjService.DeleteLogo(model.School); model.School.SchoolLogoFile = null; model.School.SchoolLogo = null; } else { model.School.SchoolLogoFile = null; model.School.SchoolLogo = null; } } else { model.School.SchoolLogoFile = null; model.School.SchoolLogo = null; } return View(model); } else if (submit.Trim().ToLower() == SchoolRes.UploadLogo.Trim().ToLower()) { if (model != null && model.School != null) { if (model != null && model.School != null && model.School.SchoolLogoFile == null) { ModelState.AddModelError("", Validation.MsgSelectFileAndUploadLogo); return View(model); } else if (!Utility.IsImage(model.School.SchoolLogoFile)) { ModelState.AddModelError("", Validation.MsgUploadValidFileFormatImage); return View(model); } //Upload Image if (model.School.SchoolLogoFile != null && !string.IsNullOrEmpty(model.School.SchoolLogoFile.FileName) && Utility.IsImage(model.School.SchoolLogoFile)) { using (MemoryStream ms = new MemoryStream()) { model.School.SchoolLogoFile.InputStream.CopyTo(ms); byte[] array = ms.GetBuffer(); model.School.SchoolLogo = array; } } if (!string.IsNullOrEmpty(model.School.SchoolID)) { _ObjService.UpdateLogo(model.School); } } return View(model); } else if (submit.Trim().ToLower() == SchoolRes.Save.Trim().ToLower()) { string strSuccessMsg = string.Empty; string strErrorMsg = string.Empty; if (model != null && model.School != null) { if (model != null && model.School != null && model.School.SchoolLogoFile != null && !Utility.IsImage(model.School.SchoolLogoFile)) { ModelState.AddModelError("", Validation.MsgUploadValidFileFormatImage); return View(model); } if (string.IsNullOrEmpty(model.School.SchoolID)) { strSuccessMsg = SchoolRes.MsgAddSuccess; strErrorMsg = SchoolRes.MsgAddError; } else { strSuccessMsg = SchoolRes.MsgEditSuccess; strErrorMsg = SchoolRes.MsgEditError; } int i = _ObjService.AddEdit(model.School); if (i <= 0) { TempData["err"] = strErrorMsg; } else { TempData["msg"] = strSuccessMsg; } } } } return RedirectToAction("ManageSchool", "School"); }
public ActionResult ManageSchool(SchoolListViewModel model) { User objUser = null; if (eSchoolSession.IsInSession(SessionKeys.CurrentUser)) objUser = (User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser); if (model.School == null) { model.School = new School(); } if (!string.IsNullOrEmpty(model.School.sort)) { model.School.SortExp = model.School.sort + " " + model.School.sortdir; } if (model.School.PageSize == 0) { int PageSize = Convert.ToInt32(ConfigurationManager.AppSettings["PageSize"]); model.School.PageSize = PageSize; } if (model.School.PageIndex == 0) { model.School.PageIndex = 1; } model.SchoolList = new List<School>(); model.School.TotalCount = 0; //Searh Criteria if (model != null && model.School != null) { if (!string.IsNullOrEmpty(model.School.SearchSchoolName)) model.School.SchoolName = model.School.SearchSchoolName; if (!string.IsNullOrEmpty(model.School.SearchSchoolCode)) model.School.SchoolCode = model.School.SearchSchoolCode; } model.SchoolList = _ObjService.GetAll(model.School).ToList(); Lookup entity = new Lookup(); if (model.SchoolList != null && model.SchoolList.Count > 0) { int TotalCount = model.SchoolList[0].TotalCount; model.School.TotalCount = TotalCount; } return View(model); }
public ActionResult DeleteSchool(string pSchoolID) { if (!string.IsNullOrEmpty(pSchoolID)) { SchoolListViewModel model = new SchoolListViewModel(); model.School = new School(); model.School.SchoolID = pSchoolID; int i = _ObjService.Delete(model.School); if (i <= 0) TempData["err"] = SchoolRes.MsgDeleteError; else TempData["msg"] = SchoolRes.MsgDeleteSuccess; } return RedirectToAction("ManageSchool", "School"); }