예제 #1
0
        public async Task <ActionResult> ContentAttach(int announcementApplicationId, string contentId)
        {
            if (string.IsNullOrWhiteSpace(contentId))
            {
                throw new ChalkableApiException("Invalid param. ContentId is missing");
            }
            var content = ContentStorage.GetStorage().GetContentById(contentId);

            if (content == null)
            {
                throw new ChalkableApiException("Content not found");
            }
            PrepareBaseData(announcementApplicationId);
            var updateAnnAppMeta = Connector.Announcement.UpdateAnnouncementApplicationMeta(announcementApplicationId, content.Text, content.ImageUrl, content.Description);

            var ids           = defaultAbIds.Select(Guid.Parse).ToList();
            var standardsTask = Connector.Standards.GetStandardsByIds(ids);
            var relationsTask = Connector.Standards.GetListOfStandardRelations(ids);



            return(View("Attach", DefaultJsonViewData.Create(new
            {
                Content = content,
                Standards = await standardsTask,
                Relations = await relationsTask,
                UpdatedAnnAppMeate = await updateAnnAppMeta,
            })));
        }
예제 #2
0
        public ActionResult Index()
        {
            var history = AnnAppHistoryStorage.GetStorage().GetHistory(null);
            var res     = DefaultJsonViewData.Create(new
            {
                History = history
            });

            return(View("Index", res));
        }
예제 #3
0
        public async Task <ActionResult> Practice(string standardId, string commonCoreStandard, string standardName)
        {
            const string defaultScore = "60";

            var res = await Connector.StudyCenter.SetPracticeGrade(Guid.Parse(standardId), defaultScore);

            return(View("ViewMode", DefaultJsonViewData.Create(new
            {
                Score = defaultScore,
                StandardId = standardId,
                CommonCoreStandard = commonCoreStandard,
                StandardName = standardName,
                Success = res
            })));
        }
예제 #4
0
        public async Task <ActionResult> ViewMode(int announcementApplicationId)
        {
            PrepareBaseData(announcementApplicationId);

            const string defaultScore = "60";

            await Connector.Grading.SetAutoGrade(announcementApplicationId, CurrentUser.Id, defaultScore);

            return(View("ViewMode", DefaultJsonViewData.Create(new
            {
                AnnouncementApplicationId = announcementApplicationId,
                StudentId = CurrentUser.Id,
                Score = defaultScore
            })));
        }
예제 #5
0
        public async Task <ActionResult> SimpleAttach(int announcementApplicationId)
        {
            PrepareBaseData(announcementApplicationId);
            var annApp = await Connector.Announcement.GetAnnouncementApplicationById(announcementApplicationId);

            var annTask = Connector.Announcement.GetRead(annApp.AnnouncementId, annApp.AnnouncementType);
            // var announcementAppIdsTask = Connector.Announcement.StudentAnnouncementAppicationIds(3787, 179);
            var announcementApplicationRecipients = Connector.Announcement.GetAnnouncementApplicationRecipients(null);
            //var topicId = Guid.Parse("585FCDB8-B949-11E0-9185-BB84D8FDF33C");
            //var topicsTask = Connector.Standards.GetTopicsByIds(new List<Guid> { topicId });

            //var ids = defaultAbIds.Select(Guid.Parse).ToList();
            //var standardsTask = Connector.Standards.GetStandardsByIds(ids);
            //var relationsTask = Connector.Standards.GetListOfStandardRelations(ids);

            var isSchoolDay = await Connector.Calendar.IsSchoolDay(null);

            var limitedEnglishList = Connector.Person.GetLimitedEnglishList();

            var studentAttendance = await Connector.Attendance.GetStudentAttendance(3688, new DateTime(2015, 12, 22, 12, 0, 0));

            studentAttendance = await Connector.Attendance.GetStudentAttendance(3688, new DateTime(2015, 12, 23, 12, 0, 0));

            studentAttendance = await Connector.Attendance.GetStudentAttendance(3688, new DateTime(2015, 12, 24, 12, 0, 0));

            studentAttendance = await Connector.Attendance.GetStudentAttendance(3688, null);

            return(View("Attach", DefaultJsonViewData.Create(new
            {
                // AnnouncementApplicationIds = await announcementAppIdsTask,
                //Topics = await topicsTask,
                AnnouncementApplicationRecipients = await announcementApplicationRecipients,
                Announcement = await annTask,
                //Standards = await standardsTask,
                //Relations = await relationsTask,
                IsSchoolDay = isSchoolDay,
                Me = await Connector.Person.GetMe(),
                LimitedEnglishList = await limitedEnglishList
            })));
        }
예제 #6
0
 protected void PrepareBaseData(int?announcementApplicationId)
 {
     ViewBag.AnnouncementApplicationId = announcementApplicationId;
     ViewBag.CurrentUser = DefaultJsonViewData.Create(CurrentUser);
 }