Esempio n. 1
0
        public static object HoursBlock(HoursVM z)
        {
            var total     = Tuple.Create("Итого", z.Total);
            var ind       = z.Ind > 0 ? Tuple.Create("Индивидуально", z.Ind) : null;
            var spec      = z.Spec > 0 ? Tuple.Create("Спец", z.Spec) : null;
            var viezd     = z.NoMoscow > 0 ? Tuple.Create("Не Москва", z.NoMoscow) : null;
            var hoursText = z.Courses.Select(x => Tuple.Create(x.Key, x.Value)).ToList()
                            .AddFluent(_.List(ind, total, ind, spec, viezd).Where(x => x != null));
            var hoursBlock = div[h4["Распределение часов"], bh.TableSmall(hoursText.Select(x =>
                                                                                           Row(x.Item1, x.Item2.ToString("0.##") + ak)))];

            return(hoursBlock);
        }
Esempio n. 2
0
        HoursVM GetHours(List <LmsLecture> lectures)
        {
            var model = new HoursVM();

            lectures.Where(x => IsCurrentMonth(x.LectureDateBeg)).ForEach((l, i) => {
                var hours = EntityUtils.GetLectureHours(l.LectureDateBeg, l.LectureDateEnd, l.Breaks);
                model.Courses[l.Course_TC] = model.Courses.GetValueOrDefault(l.Course_TC) + hours;
                if (l.LectureType_TC == LectureTypes.Individual)
                {
                    model.Ind += hours;
                }
                if (l.Complex == Cities.Complexes.NoMoscow)
                {
                    model.NoMoscow += hours;
                }
                else if (l.LectureType_TC == LectureTypes.Special)
                {
                    model.Spec += hours;
                }
            });
            return(model);
        }