public void LoadSY() { gvSY.DataSource = null; ISchoolYearService syService = new SchoolYearService(); string message = String.Empty; try { var sy = syService.GetAllSY(); SYList = new List <SchoolYear>(sy); gvSY.DataSource = SYList; gvSY.Refresh(); if (gvSY.RowCount != 0) { gvSY.Rows[0].IsSelected = true; } SYcurrent = SYList.Find(x => x.CurrentSY == true); } catch (Exception ex) { message = "Error Loading List of School Years"; MessageBox.Show(ex.ToString()); } }
private void SaveSY() { try { Boolean ret = false; string message = String.Empty; int SYto = 0; SYto = int.Parse(txtSY.Text) + 1; ISchoolYearService syService = new SchoolYearService(); SchoolYear schoolyear = new SchoolYear() { SY = txtSY.Text + "-" + SYto.ToString(), CurrentSY = false }; ret = syService.CreateSY(ref schoolyear, ref message); Log("C", "SchoolYear", schoolyear); MessageBox.Show("Saved Successfully!"); LoadSY(); } catch (Exception ex) { MessageBox.Show("Error: " + ex.ToString()); } }
public ResponseMessageWrap <int> DeleteById(long id) { return(new ResponseMessageWrap <int> { Body = SchoolYearService.DeleteById(id) }); }
public ResponseMessageWrap <int> Update([FromBody] SchoolYear schoolYear) { return(new ResponseMessageWrap <int> { Body = SchoolYearService.Update(schoolYear) }); }
public ResponseMessageWrap <int> Insert([FromBody] SchoolYear schoolYear) { return(new ResponseMessageWrap <int> { Body = SchoolYearService.Insert(schoolYear) }); }
public void GetSubmittableSchoolYears_Should_ReturnAllEnabled() { var schoolYearService = new SchoolYearService(DbContextFactoryMock.Object); var result = schoolYearService.GetSubmittableSchoolYears(); result.ShouldEqual(TestSchoolYears.Where(x => x.Enabled)); }
public void GetSubmittableSchoolYearsDictionary_Should_BeADictionary() { var schoolYearService = new SchoolYearService(DbContextFactoryMock.Object); var result = schoolYearService.GetSubmittableSchoolYearsDictionary(); result.ShouldBeType(typeof(Dictionary <int, string>)); result.Values.ShouldEqual(TestSchoolYears.Select(x => $"{x.StartYear}-{x.EndYear}")); }
private void btnDelete_Click(object sender, EventArgs e) { if (SYSelected != null) { ISchoolYearService syService = new SchoolYearService(); string message = String.Empty; if (!syService.DeleteSY(SYSelected.SY, ref message)) { message = "Deletion of School Year Failed"; } else { Log("D", "SchoolYear", SYSelected); MessageBox.Show("Deleted succesfully!"); } } }
public ActionResult Index() { var focusedSchoolYearId = AppUserService.GetSession().FocusedSchoolYearId; // var focusedSchoolYearId = 8; var focusedEdOrg = EdOrgService.GetEdOrgById( AppUserService.GetSession().FocusedEdOrgId, SchoolYearService.GetSchoolYearById(focusedSchoolYearId).Id); // var focusedEdOrg = EdOrgService.GetEdOrgById(10347, 2018); var recordsRequests = RecordsRequestService.GetAllRecordsRequests() .Where(x => x.RespondingDistrict == focusedEdOrg.Id && x.SchoolYearId == focusedSchoolYearId && (x.Status == RecordsRequestStatus.PartialResponse || x.Status == RecordsRequestStatus.Requested)).ToList(); foreach (var recordRequest in recordsRequests) { recordRequest.RequestingDistrictName = EdOrgService.GetEdOrgById(recordRequest.RequestingDistrict, focusedSchoolYearId).OrganizationName; } var model = new HomeIndexViewModel { AppUserSession = AppUserService.GetSession(), Announcements = AnnouncementService.GetAnnouncements(), YearsOpenForDataSubmission = ValidatedDataSubmissionService.GetYearsOpenForDataSubmission(), AuthorizedEdOrgs = EdOrgService.GetAuthorizedEdOrgs(), FocusedEdOrg = focusedEdOrg, RecordsRequests = recordsRequests, SubmissionCycles = SubmissionCycleService.GetSubmissionCyclesOpenToday() }; if (!model.AuthorizedEdOrgs.Any()) { return(new HttpUnauthorizedResult("Unauthorized - no educational organizations assigned to user.")); } return(View(model)); }
private void UpdateCurrentSY(string szSY, bool bSY) { try { Boolean ret = false; string message = String.Empty; ISchoolYearService syService = new SchoolYearService(); SchoolYear schoolyear = new SchoolYear() { SY = szSY, CurrentSY = bSY }; ret = syService.UpdateSY(ref schoolyear, ref message); schoolyear.CurrentSY = true; Log("U", "SchoolYear", schoolyear); } catch (Exception ex) { MessageBox.Show("Error: " + ex.ToString()); } }
public SchoolYearController(SchoolYearService schoolYearService, ISchoolYearRepository schoolYearRepository) { SchoolYearService = schoolYearService; SchoolYearRepository = schoolYearRepository; }