Ejemplo n.º 1
0
        public static Dictionary <Type, List <EntryObjectDTO> > SplitByType(this TrainingDayDTO day, bool loadedOnly)
        {
            Dictionary <Type, List <EntryObjectDTO> > dict = new Dictionary <Type, List <EntryObjectDTO> >();

            SplitByType(day, dict, loadedOnly);
            return(dict);
        }
Ejemplo n.º 2
0
 public static void SplitByType(TrainingDayDTO day, Dictionary <Type, List <EntryObjectDTO> > entriesGroup, bool loadedOnly)
 {
     foreach (var entry in day.Objects)
     {
         if (!loadedOnly || entry.IsLoaded)
         {
             Type type = entry.GetType();
             if (!entriesGroup.ContainsKey(type))
             {
                 entriesGroup.Add(type, new List <EntryObjectDTO>());
             }
             entriesGroup[type].Add(entry);
         }
     }
 }
Ejemplo n.º 3
0
        public TrainingDayDTO Copy()
        {
            TrainingDayDTO newDay = new TrainingDayDTO();

            newDay.Comment      = Comment;
            newDay.ProfileId    = ProfileId;
            newDay.TrainingDate = TrainingDate;

            foreach (var obj in Objects)
            {
                ICloneable copyable = obj as ICloneable;
                if (copyable != null)
                {
                    newDay.AddEntry((SpecificEntryObjectDTO)copyable.Clone());
                }
            }

            return(newDay);
        }