public ActionResult AddStandard(int announcementId, int standardId, int?announcementType) { var standard = SchoolLocator.GetAnnouncementService((AnnouncementTypeEnum?)announcementType).AddAnnouncementStandard(announcementId, standardId); MasterLocator.UserTrackingService.AttachedStandard(Context.Login, standard.Name); return(Json(PrepareFullAnnouncementViewData(announcementId, announcementType))); }
public ActionResult SubmitStandardsToAnnouncement(int announcementId, int?announcementType, IntList standardIds) { var service = SchoolLocator.GetAnnouncementService((AnnouncementTypeEnum?)announcementType); service.SubmitStandardsToAnnouncement(announcementId, standardIds); return(Json(PrepareFullAnnouncementViewData(announcementId, announcementType))); }
protected ActionResult EditTitle(int announcementId, AnnouncementTypeEnum announcementType, string title, Func <string, bool> existsAction) { if (!existsAction(title)) { SchoolLocator.GetAnnouncementService(announcementType).EditTitle(announcementId, title); return(Json(true)); } return(Json(false)); }
public ActionResult Complete(int announcementId, int announcementType, bool?complete) { if (!complete.HasValue) { var prev = SchoolLocator.GetAnnouncementService((AnnouncementTypeEnum)announcementType).GetAnnouncementDetails(announcementId).Complete; complete = !prev; } SchoolLocator.GetAnnouncementService((AnnouncementTypeEnum)announcementType).SetComplete(announcementId, complete.Value); return(Json(true)); }
//TODO: refactor protected AnnouncementViewData PrepareFullAnnouncementViewData(int announcementId, AnnouncementTypeEnum?announcementType, bool forRead = false) { Trace.Assert(Context.PersonId.HasValue); var annDetails = SchoolLocator.GetAnnouncementService(announcementType).GetAnnouncementDetails(announcementId); if (forRead) { return(PrepareFullAnnouncementViewDataForRead(annDetails)); } return(PrepareAnnouncmentViewDataForEdit(annDetails)); }
public ActionResult AttachSettings(int announcementId, int?announcementType) { Trace.Assert(Context.PersonId.HasValue); var assesmentId = (!ApplicationSecurity.HasStudyCenterAccess(Context) && !ApplicationSecurity.HasAssessmentEnabled(Context)) ? null : MasterLocator.ApplicationService.GetAssessmentId(); var type = (AnnouncementTypeEnum?)announcementType ?? AnnouncementTypeEnum.Class; var canAddStandard = SchoolLocator.GetAnnouncementService(type).CanAddStandard(announcementId); var isAppEnabled = BaseSecurity.IsDistrictOrTeacher(Context) && Context.SCEnabled; var isFileCabinetEnabled = Context.Role == CoreRoles.TEACHER_ROLE; //only teacher can use file cabinet for now var apps = MasterLocator.ApplicationService.GetApplications(live: true).ToList(); apps = apps.Where(app => MasterLocator.ApplicationService.HasExternalAttachMode(app)).ToList(); return(Json(AttachSettingsViewData.Create(assesmentId, canAddStandard, isAppEnabled, isFileCabinetEnabled, apps))); }
private void SetCompleteByOptions(int?classId, int option, int?annType, bool complete) { MarkDoneOptions mdo = (MarkDoneOptions)option; if (!annType.HasValue) { SchoolLocator.AdminAnnouncementService.SetComplete(classId, mdo, complete); SchoolLocator.LessonPlanService.SetComplete(classId, mdo, complete); SchoolLocator.ClassAnnouncementService.SetComplete(classId, mdo, complete); SchoolLocator.SupplementalAnnouncementService.SetComplete(classId, mdo, complete); } else { SchoolLocator.GetAnnouncementService((AnnouncementTypeEnum)annType).SetComplete(classId, mdo, complete); } }
protected AnnouncementViewData PrepareAnnouncmentViewDataForEdit(AnnouncementDetails ann) { Trace.Assert(Context.PersonId.HasValue); var annView = (AnnouncementDetailedViewData)PrepareAnnouncmentViewData(ann); annView.CanAddStandard = SchoolLocator.GetAnnouncementService(ann.Type).CanAddStandard(ann.Id); if (annView.Standards != null && annView.Standards.Count > 0) { var mp = SchoolLocator.MarkingPeriodService.GetLastMarkingPeriod(Context.NowSchoolYearTime.Date); if (mp == null) { throw new NoMarkingPeriodException(); } var abIds = ann.AnnouncementStandards.Where(x => x.Standard.AcademicBenchmarkId.HasValue) .Select(x => x.Standard.AcademicBenchmarkId.Value).ToList(); if (ann.ClassRef.HasValue) { annView.SuggestedApps = ApplicationLogic.GetSuggestedAppsForAttach(MasterLocator, SchoolLocator, abIds); annView.AppsWithContent = ApplicationLogic.GetApplicationsWithContent(SchoolLocator, MasterLocator); } } if (annView.ClassAnnouncementData != null && annView.ClassId.HasValue) { var options = SchoolLocator.ClassroomOptionService.GetClassOption(annView.ClassId.Value, true); annView.IsAbleUseExtraCredit = options != null && options.IsAveragingMethodPoints; } //foreach (var annn in annView.AnnouncementAttachments) //{ // //annn.Attachment.IsOwner = true; // annn.Attachment.IsTeacherAttachment = true; //} return(annView); }
public ActionResult DeleteDrafts(int personId, int announcementType) { SchoolLocator.GetAnnouncementService((AnnouncementTypeEnum)announcementType).DeleteDrafts(personId); return(Json(true)); }
public ActionResult Delete(int announcementId, int?announcementType) { SchoolLocator.GetAnnouncementService((AnnouncementTypeEnum?)announcementType).DeleteAnnouncement(announcementId); return(Json(true)); }
public ActionResult RemoveStandard(int announcementId, int standardId, int?announcementType) { SchoolLocator.GetAnnouncementService((AnnouncementTypeEnum?)announcementType).RemoveStandard(announcementId, standardId); return(Json(PrepareFullAnnouncementViewData(announcementId, announcementType))); }
protected void EnsureAnnouncementExsists(int announcementId, int?announcementType) { SchoolLocator.GetAnnouncementService((AnnouncementTypeEnum?)announcementType).GetAnnouncementById(announcementId); }