コード例 #1
0
        public void PutFormulas(IEnumerable <Formula> formulas)
        {
            ICollection <TrainingDay> temp = new HashSet <TrainingDay>();

            foreach (Formula formula in formulas)
            {
                List <TrainingDay> trainingDays = formula.FormulaTrainingDays.Select(td => td.TrainingDay).ToList();
                if (trainingDays != null && formula != null)
                {
                    foreach (TrainingDay day in trainingDays)
                    {
                        if (!temp.Contains(day) && day != null)
                        {
                            temp.Add(day);
                        }
                    }
                }
            }
            foreach (Formula f in formulas)
            {
                SessionFormulas.Add(new SessionFormula(SessionId, this, f.FormulaId, f));
            }
            TrainingDay prefDay = temp.SingleOrDefault(t => t.DayOfWeek.Equals(DateTime.Today.DayOfWeek));

            TrainingDay = prefDay != null ? prefDay : temp.First(t => t != null);
        }
コード例 #2
0
        public Session(IEnumerable <Formula> formulas, Teacher teacher, IEnumerable <Member> members)
        {
            MembersPresent  = new List <Member>();
            SessionFormulas = new List <SessionFormula>();
            Members         = members;

            ICollection <TrainingDay> temp = new HashSet <TrainingDay>();

            foreach (Formula formula in formulas)
            {
                List <TrainingDay> trainingDays = formula.FormulaTrainingDays.Select(td => td.TrainingDay).ToList();
                if (trainingDays != null && formula != null)
                {
                    foreach (TrainingDay day in trainingDays)
                    {
                        if (!temp.Contains(day) && day != null)
                        {
                            temp.Add(day);
                        }
                    }
                }
            }
            TrainingDay prefDay = temp.SingleOrDefault(t => t.DayOfWeek.Equals(DateTime.Today.DayOfWeek));

            TrainingDay = prefDay != null ? prefDay : temp.First(t => t != null);

            Date           = DateTime.Now;
            Teacher        = teacher;
            SessionMembers = new List <SessionMember>();
            NonMembers     = new List <NonMember>();
            foreach (Formula f in formulas)
            {
                SessionFormulas.Add(new SessionFormula(SessionId, this, f.FormulaId, f));
            }
        }
コード例 #3
0
 public FormulaTrainingDay(int formulaId, Formula formula, int trainingDayId, TrainingDay trainingDay)
 {
     FormulaId      = formulaId;
     Formula        = formula;
     TrainingsDayId = trainingDayId;
     TrainingDay    = trainingDay;
 }