Example #1
0
        public override void CalcSchedules()
        {
            Schedules.Clear();

            Schedules.Add(Device.StartTime);
            var nextTime = Device.StartTime.AddMinutes(GetFirstSpan());

            //如下一次开始时间 < endtime,且够一个周期的时间
            if (nextTime.AddMinutes(Device.Period * (int)Device.TimeType) <= Device.EndTime)
            {
                Schedules.Add(nextTime);

                while (true)
                {
                    nextTime = nextTime.AddMinutes(Device.Period * (int)Device.TimeType);
                    if (nextTime.AddMinutes(Device.Period * (int)Device.TimeType) > Device.EndTime)
                    {
                        break;
                    }
                    Schedules.Add(nextTime);
                }
            }

            LogFactory.Create().Info($"DEVICE{Device.DeviceId} CalcSchedules ==>{Schedules.Count}, first{Schedules.FirstOrDefault():yyyy-MM-dd HH:mm:ss}, last{Schedules.LastOrDefault():yyyy-MM-dd HH:mm:ss}");
        }
Example #2
0
        /// <summary>
        /// Add new control points
        /// </summary>
        /// <param name="LabelName">Label</param>
        /// <param name="Type">Optional Type, defaults to VARS</param>
        public void Add(string LabelName, IdentifierTypes Type = IdentifierTypes.VARS)
        {
            ControlPointInfo newControlPoint = new ControlPointInfo(LabelName, Type);

            switch (Type)
            {
            case IdentifierTypes.VARS:
                Variables.Add(newControlPoint);
                break;

            case IdentifierTypes.INS:
                Inputs.Add(newControlPoint);
                break;

            case IdentifierTypes.OUTS:
                Outputs.Add(newControlPoint);
                break;

            case IdentifierTypes.PRGS:
                Programs.Add(newControlPoint);
                break;

            case IdentifierTypes.SCHS:
                Schedules.Add(newControlPoint);
                break;

            case IdentifierTypes.HOLS:
                Holidays.Add(newControlPoint);
                break;

            default:
                break;
            }
        }
        public void AddScheduledTask(ScheduledTaskModel scheduledTask)
        {
            if (scheduledTask == null)
            {
                throw new ArgumentNullException("ScheduledTask cannot be null!");
            }

            if (string.IsNullOrWhiteSpace(scheduledTask.ScheduleExpression))
            {
                throw new ArgumentException("ScheduledTask has to have a schedule expression!");
            }

            if (CrontabSchedule.Parse(scheduledTask.ScheduleExpression) == null)
            {
                throw new ArgumentException("ScheduledTask has to have a legal schedule expression!");
            }

            if (scheduledTask.Task == null)
            {
                throw new ArgumentException("ScheduledTask has to have a task");
            }

            lock (lockObject)
            {
                Schedules.Add(scheduledTask);
            }
        }
Example #4
0
        async Task SyncSchedules()
        {
            if (!IsBusy)
            {
                Exception Error = null;

                Schedules.Clear();
                try
                {
                    IsBusy = true;
                    var Repository = new Repository();
                    var Items      = await Repository.GetSchedule();

                    foreach (var Service in Items)
                    {
                        Schedules.Add(Service);
                    }
                }
                catch (Exception ex)
                {
                    Error = ex;
                }
                finally
                {
                    IsBusy = false;
                }
                if (Error != null)
                {
                    await _pageDialogService.DisplayAlertAsync("Erro", Error.Message, "OK");
                }
                return;
            }
        }
Example #5
0
        public void TestSchedule()
        {
            var schedules1 = new Schedules();

            schedules1.Add(new Schedule("13:00", "14:00"));
            Assert.IsTrue(schedules1.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 13, 23, 00)));
            Assert.IsTrue(schedules1.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 11, 23, 00)));

            var schedules2 = new Schedules();

            schedules2.Add(new Schedule("13:00", "14:00", "OFF"));
            Assert.IsFalse(schedules2.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 13, 23, 00)));
            Assert.IsTrue(schedules2.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 11, 23, 00)));

            var schedules4 = new Schedules("OFF");

            schedules4.Add(new Schedule("13:00", "14:00", "OFF"));
            Assert.IsFalse(schedules4.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 13, 23, 00)));
            Assert.IsFalse(schedules4.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 11, 23, 00)));

            var schedules5 = new Schedules("OFF");

            schedules5.Add(new Schedule("13:00", "14:00", "ON"));
            Assert.IsTrue(schedules5.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 13, 23, 00)));
            Assert.IsFalse(schedules5.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 11, 23, 00)));

            var schedules3 = new Schedules();

            schedules3.Add(new Schedule("13:00", "14:00", "OFF", DateTime.Now.DayOfWeek.ToString()));
            Assert.IsFalse(schedules3.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 13, 23, 00)));
            Assert.IsTrue(schedules3.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day + 1, 13, 23, 00)));
            Assert.IsTrue(schedules3.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 14, 00, 01)));
            Assert.IsTrue(schedules3.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day + 1, 14, 00, 01)));
        }
Example #6
0
 internal void AddSchedule(Schedule schedule)
 {
     lock (m_LockSchedules)
     {
         Schedules.Add(schedule);
     }
 }
 private void GetSchedules()
 {
     Schedules.Clear();
     foreach (var item in _dataService.GetSchedules())
     {
         Schedules.Add(item);
     }
 }
Example #8
0
        public async Task CreateSchedule(JsonElement newSchedule)
        {
            var schedule = JsonSerializer.Deserialize <TUISchedule>(newSchedule.ToString());

            Schedules.Add(schedule);
            await OnCreateCalendarEventOrTask.InvokeAsync(schedule);

            Debug.WriteLine("New Schedule Created");
        }
Example #9
0
        public void AddPassanger(Customer customer, Schedule schedule)
        {
            if (!Schedules.Contains(schedule))
            {
                Schedules.Add(schedule);
            }

            customer.SetFlightSchedule(schedule);
        }
Example #10
0
 public void AddToSchedules(ScheduleModelProxy schedule)
 {
     try {
         Execute.OnUIThread(() =>
         {
             Schedules.Add(new ResourceContainer(schedule.Name, schedule, IconsDescription.Schedule));
         });
     }
     catch (TaskCanceledException) { }
 }
 private void LoadSchedules(List <Schedule> medicalCenterSchedules)
 {
     Schedules.Clear();
     dialogService.ShowProgress();
     foreach (Schedule schedule in medicalCenterSchedules)
     {
         ScheduleViewModel scheduleViewModel = new ScheduleViewModel();
         ViewModelHelper.SetScheduleToScheduleViewModel(scheduleViewModel, schedule);
         Schedules.Add(scheduleViewModel);
     }
     dialogService.HideProgress();
 }
        public override async System.Threading.Tasks.Task ExecuteLoadSchedulesCommand()
        {
            if (IsBusy)
            {
                return;
            }

            if (!IsRefreshing)
            {
                IsBusy = true;
            }

            try
            {
                if (!Users.Any())
                {
                    var lookups = await DataService.GetLookups(1000);

                    lookups.Users.ForEach(u => Users.Add(u));
                }

                ScheduleDateFormatted = ScheduleDate.ToShortDateString();
                OnPropertyChanged("ScheduleDateFormatted");

                Schedules.Clear();
                var items = await DataService.GetItemsAsync <Schedule>($"schedules?start={ScheduleDate.ToString("MM-dd-yyyy")}&end={ScheduleDate.ToString("MM-dd-yyyy")}{(CanManageSchedule ? "" : "&assigned=true")}");

                NoSchedules = !items.Data.Any();
                OnPropertyChanged("NoSchedules");
                this.WeekUnpublished = false;
                foreach (var item in items.Data.OrderBy(d => d.User == null ? "zzzzzz" : d.User.FirstName))
                {
                    if (item.UserId != null && !item.PublishedValue)
                    {
                        this.WeekUnpublished = true;
                    }
                    var displayItem = new DisplayItem();
                    scheduleToDisplayItem(displayItem, item);
                    Schedules.Add(displayItem);
                }
            }
            catch (Exception ex)
            {
                IsBusy       = false;
                IsRefreshing = false;
                ExceptionHelper.ShowException(ex);
            }
            finally
            {
                IsBusy       = false;
                IsRefreshing = false;
            }
        }
Example #13
0
        /// <summary>
        /// Adds a new schedule and saves the settings.
        /// </summary>
        /// <param name="schedule">The <see cref="Schedule"/> object to be added.</param>
        /// <param name="makeActive">If the schedule added should be set as the active schedule.</param>
        public void AddSchedule(Schedule schedule, bool makeActive)
        {
            if (makeActive)
            {
                Schedules.ForEach(s => s.Active = false);
                schedule.Active = true;
            }

            Schedules.Add(schedule);
            Schedules = Schedules.OrderBy(s => s.Name).ToList();
            SaveSettings();
        }
Example #14
0
        private void AddSchedule(int id, ScheduleType type, int gid, DateTime start, DateTime end, string description, int subId)
        {
            var sched = new Schedule {
                Id = id, Type = type, Group_Id = gid, DateStart = start, DateEnd = end, Description = description
            };

            if (Schedules.Find(id) != null)
            {
                return;
            }
            Schedules.Add(sched);
            Subjects.Find(subId).Schedules.Add(sched);
        }
        private void addSchedule()
        {
            var schedule = _dialogs.ShowScheduleDialog(null);

            if (schedule != null)
            {
                Schedules.Add(new ScheduleModel()
                {
                    Schedule = schedule
                });
                refreshItems();
            }
        }
Example #16
0
 public void InitSchedules()
 {
     if (Schedules != null)
     {
         Schedules = new List <DateTime>();
     }
     for (int i = 24; i == 1; i--)
     {
         if (i % 2 == 0)
         {
             Schedules.Add(DateTime.Parse(i.ToString() + ":00"));
         }
     }
 }
Example #17
0
        /// <summary>
        /// Schedules a task to run
        /// </summary>
        /// <typeparam name="T">Task to schedule</typeparam>
        /// <returns></returns>
        public Schedule Schedule <T>() where T : ITask
        {
            var schedule = new Schedule(() => GetTaskInstance <T>().Execute());

            if (AllTasksConfiguredAsNonReentrant)
            {
                schedule.NonReentrant();
            }
            lock (((ICollection)Schedules).SyncRoot)
            {
                Schedules.Add(schedule);
            }
            return(schedule);
        }
Example #18
0
        /// <summary>
        /// Schedules a task to run
        /// </summary>
        /// <param name="action">Task to schedule</param>
        /// <returns></returns>
        public Schedule Schedule(Action action)
        {
            var schedule = new Schedule(action);

            if (AllTasksConfiguredAsNonReentrant)
            {
                schedule.NonReentrant();
            }
            lock (((ICollection)Schedules).SyncRoot)
            {
                Schedules.Add(schedule);
            }
            return(schedule);
        }
Example #19
0
        /// <summary>
        /// Schedules a task to run
        /// </summary>
        /// <typeparam name="T">Task to schedule</typeparam>
        /// <returns></returns>
        public Schedule Schedule <T>() where T : ITask
        {
            var schedule = new Schedule(() => TaskManager.TaskFactory.GetTaskInstance <T>().Execute());

            if (AllTasksConfiguredAsNonReentrant)
            {
                schedule.NonReentrant();
            }
            lock (((ICollection)Schedules).SyncRoot)
            {
                Schedules.Add(schedule);
            }
            schedule.Name = typeof(T).Name;
            return(schedule);
        }
Example #20
0
 private void Populate(string[] schedule)
 {
     for (int i = 0; i < schedule.Length; i++)
     {
         char action = schedule[i][0];
         int  num, ind = 1, transaction = 0;
         while (int.TryParse(schedule[i][ind].ToString(), out num))
         {
             transaction = transaction * (int)Math.Pow(10, ind - 1) + num;
             ind++;
         }
         Transactions.Add(transaction);
         char item = schedule[i][schedule[i].Length - 1];
         Schedules.Add(new Operation(action, transaction, item));
     }
 }
Example #21
0
        private async System.Threading.Tasks.Task ExecuteLoadSchedulesCommand()
        {
            if (IsBusy)
            {
                return;
            }

            if (!IsRefreshing)
            {
                IsBusy = true;
            }

            try
            {
                //StartDateFormatted = StartDate.ToShortDateString();
                //OnPropertyChanged("StartDateFormatted");

                Schedules.Clear();
                var items = await DataService.GetItemsAsync <Schedule>($"schedules?start={StartDate.ToString("MM-dd-yyyy")}&end={StartDate.AddDays(6).ToString("MM-dd-yyyy")}&forUser=true");

                NoSchedules = !items.Data.Any();
                OnPropertyChanged("NoSchedules");
                foreach (var item in items.Data.OrderBy(d => d.ScheduleDate.GetValueOrDefault()).ThenBy(s => s.StartTime.GetValueOrDefault().TimeOfDay))
                {
                    Schedules.Add(new DisplayItem()
                    {
                        Line1 = $"{item.ScheduleDateValue.DayOfWeek} - {item.ScheduleDateValue.ToShortDateString()}",
                        Line2 = $"{item.StartTimeTimezonedValue.ToShortTimeString()} - {item.EndTimeTimezonedValue.ToShortTimeString()}",
                        Line3 = $"{item.Shift.ShiftName} - {item.Task.TaskName}" +
                                (item.ScheduleTrades.Any(t => t.TradeStatusValue < (int)TRADE_STATUS.APPROVED) ? " *" : ""),
                        Tag  = item,
                        Tag2 = string.IsNullOrEmpty(item.Task.TextColor) ? Color.LightGray : Color.FromHex(item.Task.TextColor),
                    });
                }
            }
            catch (Exception ex)
            {
                IsBusy       = false;
                IsRefreshing = false;
                ExceptionHelper.ShowException(ex);
            }
            finally
            {
                IsBusy       = false;
                IsRefreshing = false;
            }
        }
        private async System.Threading.Tasks.Task ExecuteLoadSchedulesCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsRefreshing = false;
            IsBusy       = true;

            try
            {
                StartDateFormatted = StartDate.ToShortDateString();
                OnPropertyChanged("StartDateFormatted");

                var user = AuthService.UserToken.User;
                Schedules.Clear();
                var items = await DataService.GetItemsAsync <ScheduleTrade>($"scheduleTrades?start={StartDate.ToString("MM-dd-yyyy")}&end={StartDate.AddDays(6).ToString("MM-dd-yyyy")}&status=0");

                NoTrades = !items.Data.Any();
                OnPropertyChanged("NoTrades");
                foreach (var item in items.Data.Where(d => d.Schedule.UserIdValue != user.UserIdValue).OrderBy(d => d.Schedule.ScheduleDate.GetValueOrDefault()).ThenBy(s => s.Schedule.StartTime.GetValueOrDefault().TimeOfDay))
                {
                    var sched = item.Schedule;
                    Schedules.Add(new DisplayItem()
                    {
                        Line1 = $"{sched.ScheduleDateValue.DayOfWeek} - {sched.ScheduleDateValue.ToShortDateString()}",
                        Line2 = $"{sched.StartTimeTimezonedValue.ToShortTimeString()} - {sched.EndTimeTimezonedValue.ToShortTimeString()}",
                        Line3 = $"{sched.Shift.ShiftName} - {sched.Task.TaskName}",
                        Line4 = sched.User == null ? "" : sched.User.DisplayName,
                        Tag   = item,
                        Tag2  = sched.User != null
                    });
                }
            }
            catch (Exception ex)
            {
                IsBusy = false;
                ExceptionHelper.ShowException(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Example #23
0
        private async void SaveSchedule()
        {
            if (CurrentSchedule == null)
            {
                throw new Exception("Расписание не выбрано");
            }

            if (string.IsNullOrWhiteSpace(CurrentSchedule.Name))
            {
                throw new Exception("Не задано название расписания");
            }

            try
            {
                IsBusy = true;
                var sc = Schedules.FirstOrDefault(s => s.Id == CurrentSchedule.Id) ?? new ScheduleClass();
                if (sc.Id == 0)
                {
                    sc.SetType(CurrentSchedule.Type);
                }
                sc.Days = CurrentSchedule.DaySchedules.Select(s => new List <ValueTimeRange>(s.Spans)).ToArray();
                sc.Name = CurrentSchedule.Name;

                var savedSchedule = await _scheduleRepository.SaveSchedule(sc, CurrentSchedule.Id == 0);

                if (savedSchedule == null)
                {
                    throw new Exception("Не удалось сохранить расписание, попробуйте позже.");
                }
                else
                {
                    if (CurrentSchedule.Id != 0)
                    {
                        Schedules.Remove(SelectedSchedule);
                    }

                    Schedules.Add(savedSchedule);
                    SelectedSchedule = savedSchedule;
                }
            }
            finally
            {
                IsBusy = false;
            }
        }
Example #24
0
        public void EvalPartitions(int cpuid, int coreid, IEnumerable <Job> tasks)
        {
            CoreSchedule     tc = new CoreSchedule(cpuid, coreid);
            HashSet <string> uniqueTaskNames = new HashSet <string>();

            foreach (Job task in tasks)
            {
                tc.AddTask(task);
                if (!eventMap.ContainsKey(task.Name))
                {
                    eventMap.Add(task.Name, new List <IMeasurement>());
                }

                uniqueTaskNames.Add(task.Name);
            }
            uniqueTaskNames.ForEach(tName => eventMap[tName].Add(tc));
            Schedules.Add(tc);
        }
        private MemberWorkTime TeacherGenerator()
        {
            Random rm       = new Random();
            string memberId = PublicMethod.GetToken();

            MemberWorkTime Teacher = new MemberWorkTime()
            {
                MemberId      = memberId,
                ReadyTime     = rm.Next(0, 13),
                Status        = Status.Enabled,
                EffectiveDate = DateTimeOffset.Now
            };

            for (int i = 0; i < 7; i++)
            {
                for (int j = 0; j < 24; j++)
                {
                    if (rm.Next(0, 3) == 2)
                    {
                        MemberWorkTimeItem work = new MemberWorkTimeItem()
                        {
                            Id            = PublicMethod.GetToken(),
                            MemberId      = memberId,
                            Weekday       = (DayOfWeek)i,
                            Time          = TimeSpan.FromHours(j),
                            EffectiveDate = DateTime.Now
                        };
                        Teacher.Times.Add(work);
                    }
                }
            }

            Schedules.Add(new Schedule()
            {
                Id       = PublicMethod.GetToken(),
                MemberId = memberId,
                Name     = "Chinese Class",
                Type     = ScheduleType.Class,
                Color    = "#F4A460",
                Visibled = true,
                IsSystem = false
            });
            return(Teacher);
        }
        private void GetSchedultCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            try
            {
                if (e.Error != null)
                {
                    Deployment.Current.Dispatcher.BeginInvoke(() => MessageBox.Show(e.Error.Message));
                }
                else
                {
                    TextReader textReader = new StringReader(e.Result);
                    var        xElement   = XElement.Load(textReader);

                    var items = (from item in xElement.Descendants("date")
                                 select new Schedule
                    {
                        Date = item.GetAttributeOrDefault("name"),
                        Halls = (from hall in item.Elements("hall")
                                 select new Hall
                        {
                            HallId = hall.GetAttributeIntOrDefault("id"),
                            Sessions = (from session in hall.Elements("item")
                                        select new Session
                            {
                                Id = session.GetAttributeIntOrDefault("id"),
                                Time = session.GetAttributeOrDefault("time"),
                                Price = session.GetAttributeIntOrDefault("price")
                            }).ToList()
                        }).ToList()
                    }).ToList();

                    Schedules.Clear();
                    foreach (var schedule in items)
                    {
                        Schedules.Add(schedule);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #27
0
        public void BuildSchedules()
        {
            Schedule schedule1 = new Schedule();

            schedule1.ID                 = 1;
            schedule1.ExternalId         = "2826018c-69cc-4ead-946b-70bb5a47ab02";
            schedule1.ScheduleType       = ScheduleType.Daily;
            schedule1.ScheduleItemType   = ItemType.Script;
            schedule1.ScheduleItemId     = 1;
            schedule1.Project            = Projects.SingleOrDefault(p => p.ID == 1);
            schedule1.ScheduleDetails    = new List <ScheduleDetail>();
            schedule1.ScheduleParameters = new List <ScheduleParameter>();

            Schedules.Add(schedule1);

            Schedule schedule2 = new Schedule();

            schedule2.ID                 = 2;
            schedule2.ExternalId         = "3b42b7c0-d4fc-4440-93fa-407cb1060768";
            schedule2.ScheduleType       = ScheduleType.Weekly;
            schedule2.ScheduleItemType   = ItemType.Script;
            schedule2.ScheduleItemId     = 2;
            schedule2.Project            = Projects.SingleOrDefault(p => p.ID == 1);
            schedule2.ScheduleDetails    = new List <ScheduleDetail>();
            schedule2.ScheduleParameters = new List <ScheduleParameter>();

            Schedules.Add(schedule2);

            Schedule schedule3 = new Schedule();

            schedule3.ID                 = 3;
            schedule3.ExternalId         = "b9260c90-62ce-4f41-a448-e766e897a175";
            schedule3.ScheduleType       = ScheduleType.Monthly;
            schedule3.ScheduleItemType   = ItemType.Sequence;
            schedule3.ScheduleItemId     = 1;
            schedule3.Project            = Projects.SingleOrDefault(p => p.ID == 1);
            schedule3.ScheduleDetails    = new List <ScheduleDetail>();
            schedule3.ScheduleParameters = new List <ScheduleParameter>();

            Schedules.Add(schedule3);
        }
        private async System.Threading.Tasks.Task ExecuteLoadSchedulesCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsRefreshing = false;
            IsBusy       = true;

            try
            {
                Schedules.Clear();
                Schedules.Add(new DisplayItem()
                {
                    Line1 = "Trade Only",
                    Line2 = ""
                });
                var items = await DataService.GetItemsAsync <Schedule>($"schedules?start={StartDate.ToString("MM-dd-yyyy")}&end={StartDate.AddDays(6).ToString("MM-dd-yyyy")}&forUser=true");

                foreach (var item in items.Data.OrderBy(d => d.ScheduleDate.GetValueOrDefault()).ThenBy(s => s.StartTime.GetValueOrDefault().TimeOfDay))
                {
                    Schedules.Add(new DisplayItem()
                    {
                        Line1 = $"{item.ScheduleDate.GetValueOrDefault().DayOfWeek} - {item.ScheduleDate.GetValueOrDefault().ToShortDateString()} {item.StartTimeTimezonedValue.ToShortTimeString()} - {item.EndTimeTimezonedValue.ToShortTimeString()}",
                        Line2 = $"{item.Shift.ShiftName} - {item.Task.TaskName}",
                        Tag   = item,
                    });
                }
            }
            catch (Exception ex)
            {
                IsBusy = false;
                ExceptionHelper.ShowException(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
        public void ShowSchedule()
        {
            Schedules.Clear();

            List <Schedule> schedules = _manager.Get();

            foreach (Schedule schedule in schedules)
            {
                if (schedule is SchedulePeriod)
                {
                    Schedules.Add(new SchedulePeriodViewModel((SchedulePeriod)schedule));
                }
                else if (schedule is ScheduleReminder)
                {
                    Schedules.Add(new ScheduleReminderViewModel((ScheduleReminder)schedule));
                }
                else
                {
                    Schedules.Add(new ScheduleViewModel(schedule));
                }
            }
        }
Example #30
0
        /// <summary>
        /// Add Schedule control point info
        /// </summary>
        /// <param name="schedule">Schedule Point</param>
        /// <param name="index">Index</param>
        public void Add(SchedulePoint schedule, int index)
        {
            try
            {
                ControlPointInfo newCPInfo = new ControlPointInfo
                {
                    ControlPointName = "SCH" + index,
                    Label            = schedule.Label,
                    FullLabel        = schedule.Description,
                    Type             = IdentifierTypes.SCHS,
                    Value            = "",
                    Units            = "",
                    AutoManual       = schedule.AutoManual == 0 ? "Auto" : "Manual",
                    Index            = (short)index
                };

                Schedules.Add(newCPInfo);
            }
            catch (Exception ex)
            {
                ExceptionHandler.Show(ex, "Addition of new Schedule to ControlPointsInfo");
            }
        }