コード例 #1
0
        public async Task <IActionResult> GetReportsByType(Guid personId, Guid classId, int type, DateTime?date = null)
        {
            if (date.HasValue == false)
            {
                date = DateTime.UtcNow;
            }
            var startDate = new DateTime(date.Value.Year, date.Value.Month, date.Value.Day);
            var endDate   = new DateTime(date.Value.Year, date.Value.Month, date.Value.Day, 23, 59, 59);

            switch (type)
            {
            case (int)EnumDailyReportType.NapsSleep:
            {
                var naps = await _unitOfWork.DailyReportNaps.GetAsync(x => x.IsActive &&
                                                                      x.PersonId == personId &&
                                                                      x.ClassId == classId &&
                                                                      x.Date >= startDate && x.Date <= endDate);

                return(PartialView("PartialDailyReportNap", DailyReportNap.Init(naps)));
            }

            case (int)EnumDailyReportType.Meals:
            {
                var meals = await _unitOfWork.DailyReportMeals.GetAsync(x => x.IsActive && x.OrganizationId == _organizationId &&
                                                                        x.ClassId == classId &&
                                                                        x.PersonId == personId &&
                                                                        x.Date >= startDate && x.Date <= endDate,
                                                                        include : p => p.Include(x => x.DailyReportFoods)
                                                                        );

                return(PartialView("PartialDailyReportMeal", DailyReportMeal.Init(meals)));
            }

            case (int)EnumDailyReportType.Bathroom:
            {
                var baths = await _unitOfWork.DailyReportBathrooms.GetAsync(x => x.IsActive && x.OrganizationId == _organizationId &&
                                                                            x.ClassId == classId &&
                                                                            x.PersonId == personId &&
                                                                            x.Date >= startDate && x.Date <= endDate

                                                                            );

                return(PartialView("PartialDailyReportBathroom", DailyReportBathroom.Init(baths)));
            }

            case (int)EnumDailyReportType.Medication:
            {
                var medications = await _unitOfWork.DailyReportMedications.GetAsync(x => x.IsActive && x.OrganizationId == _organizationId &&
                                                                                    x.ClassId == classId &&
                                                                                    x.PersonId == personId &&
                                                                                    x.Date >= startDate && x.Date <= endDate

                                                                                    );

                return(PartialView("PartialDailyReportMedication", DailyReportMedication.Init(medications)));
            }
            }

            return(View());
        }
コード例 #2
0
        public async Task <IActionResult> AddEditBathroom(Guid personId, Guid classId, Guid organizationId, DateTime?date = null)
        {
            if (date.HasValue == false)
            {
                date = DateTime.UtcNow;
            }

            var model = DailyReportBathroom.Init(personId, classId, organizationId, date.Value);

            return(View(model));
        }
コード例 #3
0
        public async Task <IActionResult> GetBathrooms(Guid personId, Guid classId, Guid organizationId, DateTime?date)
        {
            if (date.HasValue == false)
            {
                date = DateTime.UtcNow;
            }
            var startDate = new DateTime(date.Value.Year, date.Value.Month, date.Value.Day);
            var endDate   = new DateTime(date.Value.Year, date.Value.Month, date.Value.Day, 23, 59, 59);

            var baths = await _unitOfWork.DailyReportBathrooms.GetAsync(x => x.IsActive && x.OrganizationId == _organizationId &&
                                                                        x.ClassId == classId &&
                                                                        x.PersonId == personId &&
                                                                        x.Date >= startDate && x.Date <= endDate
                                                                        );


            return(PartialView("PartialDailyReportBathroom", DailyReportBathroom.Init(baths)));
        }