/// <summary>
        /// Method for adding divers to schedule list
        /// </summary>
        /// <param name="scheduleRaw">Contains file content. Every file line is one array element</param>
        private void AddDiveSchedule(string[] scheduleRaw)
        {
            string[] timeline;
            string   date;
            string   time;
            string   maxDepth;
            string   numOfDivers;

            foreach (string s in scheduleRaw)
            {
                timeline = s.Split(';');

                date        = timeline[0];
                time        = timeline[1];
                maxDepth    = timeline[2];
                numOfDivers = timeline[3];

                if (timeline.Count() != 4 || !Validation.ValidateDepth(maxDepth) || !Validation.ValidateNumOfDivers(numOfDivers))
                {
                    Console.WriteLine("{0} Preskačem pogrešan redak: {1};{2};{3};{4}\n", Validation.diveInputErr, date, time, maxDepth, numOfDivers);
                    continue;
                }

                DiveSchedule schedule = new DiveSchedule(date, time, Int32.Parse(maxDepth), Int32.Parse(numOfDivers));
                diveSchedule.Add(schedule);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Update dive schedule list when subject transmits update
        /// Add dive only if there's divers with federation name = this.federationName
        /// </summary>
        /// <param name="subject">concrete subject</param>
        public override void Update(Subject subject)
        {
            DiveSchedule dive      = subject.GetDive();
            int          diversNum = dive.diveGroups.Where(x => x.diverPair.Any(z => z.certificate.authorizedFederation == institutionName)).Count();

            if (diversNum > 0)
            {
                diveSchedule.Add(dive);
            }
        }
Esempio n. 3
0
        private void AddDiveSchedule(string[] scheduleRaw)
        {
            string[] timeline;
            foreach (string s in scheduleRaw)
            {
                timeline = s.Split(';');

                DiveSchedule schedule = new DiveSchedule(timeline[0], timeline[1], Int32.Parse(timeline[2]), Int32.Parse(timeline[3]));
                diveSchedule.Add(schedule);
            }
        }
 /// <summary>
 /// Add dive to list and notify all observers
 /// </summary>
 /// <param name="dive">Dive schedule object</param>
 public void SetDive(DiveSchedule dive)
 {
     diveSchedule.Add(dive);
     NotifyObserver();
 }
Esempio n. 5
0
 public void addDive(DiveSchedule dive)
 {
     diveSchedule.Add(dive);
 }