示例#1
0
 /// <inheritdoc />
 public object Clone()
 {
     return(new MarkCollection()
     {
         ShowMarkBar = ShowMarkBar,
         ShowGridLines = ShowGridLines,
         Level = Level,
         Name = Name,
         _marks = new ObservableCollection <IMark>(Marks.Select(x => (IMark)x.Clone())),
         Decorator = (MarkDecorator)Decorator.Clone()
     });
 }
        public IHttpActionResult GetStudentMarks(Guid id)
        {
            IEnumerable <MarkDto> Marks;

            try
            {
                Marks = db.GetStudentMarks(id);
            }
            catch (NullReferenceException e)
            {
                logger.Error(e.Message);
                return(NotFound());
            }
            return(Ok(Marks.Select(x =>
            {
                x.AccessType = EAccessType.Student;
                return x;
            })));
        }
示例#3
0
        public Enrollee ToModel(IDictionary <long, PlanEntry> plansDict)
        {
            Enrollee enrollee = new Enrollee()
            {
                Id            = Id,
                FullName      = FullName,
                Year          = Year,
                KindPrivilege = KindPrivilege,
                Doc           = Doc,
                Status        = Status,
                EnrolledTo    = FinTypes.SingleOrDefault(f => f.Enrolled)?.PlanId ?? 0,
                ApprovedTo    = ConsentRecord?.ToModel()
            };

            enrollee.Plans = Plans.Select(p => p.ToModel(plansDict[p.PlanId], FinTypes.Where(f => f.PlanId == p.PlanId), enrollee)).ToArray();
            enrollee.Exams = Marks.Select(m => m.ToModel()).ToArray();

            return(enrollee);
        }
示例#4
0
        internal void End(string stepDescription, int recursion = 0)
        {
            Stopwatch.Stop();
            var tm = new TimerMark()
            {
                Milliseconds = Stopwatch.ElapsedMilliseconds, Ticks = Stopwatch.ElapsedTicks, StepDescription = stepDescription
            };

            lock (Marks)
            {
                Marks.Add(tm);
                Marks = Marks.Select(x => x != null ? x : new TimerMark()
                {
                    StepDescription = "MISSINGNO"
                }).OrderBy(x => x.Ticks).ToList();
            }
            #region test
            //            if (tm != null)
            //            {

            //            }
            //            else
            //            {
            //#if DEBUG
            //                throw new CodeFirstException("Null timer mark");
            //#else
            //                if(recursion < 10)
            //                {
            //                    End(stepDescription, recursion++);
            //                }
            //                else
            //                {
            //                    throw new CodeFirstException("Null timer mark - tried 10 times");
            //                }
            //#endif
            //            }
            #endregion
        }