Exemple #1
0
        public ScheduleAppointmentCollection GetShifts()
        {
            ScheduleAppointmentCollection scheduleAppointmentCollection = new ScheduleAppointmentCollection();

            //Adding schedule appointment in schedule appointment collection
            scheduleAppointmentCollection.Add(new ScheduleAppointment()
            {
                StartTime = new DateTime(2019, 06, 23, 10, 0, 0),
                EndTime   = new DateTime(2019, 06, 23, 12, 0, 0),
                Subject   = "Meeting",
                Location  = "Hutchison road",
            });
            scheduleAppointmentCollection.Add(new ScheduleAppointment()
            {
                StartTime = new DateTime(2019, 06, 20, 07, 0, 0),
                EndTime   = new DateTime(2019, 06, 20, 13, 20, 0),
                Subject   = "Meeting",
                Location  = "Hutchison road",
            });
            scheduleAppointmentCollection.Add(new ScheduleAppointment()
            {
                StartTime = new DateTime(2019, 06, 17, 13, 25, 0),
                EndTime   = new DateTime(2019, 06, 17, 19, 40, 0),
                Subject   = "Meeting",
                Location  = "Hutchison road",
            });
            scheduleAppointmentCollection.Add(new ScheduleAppointment()
            {
                StartTime = new DateTime(2019, 06, 21, 22, 15, 0),
                EndTime   = new DateTime(2019, 06, 21, 23, 56, 0),
                Subject   = "Meeting",
                Location  = "Hutchison road",
            });
            return(scheduleAppointmentCollection);
        }
        private void cmbInstructorName_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                ScheduleAppointmentCollection appointments = new ScheduleAppointmentCollection();

                var schedule = DbAccess.GetInstructorSchedule(Convert.ToInt16(cmbInstructorName.SelectedValue));
                foreach (var sc in schedule)
                {
                    if (sc.BookingTpye == 1)
                    {
                        appointments.Add(new ScheduleAppointment()
                        {
                            Subject = sc.BookingName, AppointmentBackground = Brushes.Blue, StartTime = sc.starting, EndTime = sc.ending, Notes = sc.ScheduleInstructorID.ToString(), ReadOnly = true
                        });
                    }
                    else
                    {
                        appointments.Add(new ScheduleAppointment()
                        {
                            Subject = sc.BookingName, AppointmentBackground = Brushes.Green, StartTime = sc.starting, EndTime = sc.ending, Notes = sc.ScheduleInstructorID.ToString(), ReadOnly = true
                        });
                    }
                }

                studentScheduler.Appointments = appointments;
            }
            catch (Exception)
            {
                MessageBox.Show("An error occured while trying to load the schedule", "SYSTEM ERROR", MessageBoxButton.OK, MessageBoxImage.Stop);
            }
        }
        //Creating appointments for ScheduleAppointmentCollection
        private void getAppointments()
        {
            appointmentCollection = new ScheduleAppointmentCollection();
            setColors();
            RandomNumbers();
            setSubjects();
            setStartTime();
            setEndTime();
            for (int i = 0; i < 10; i++)
            {
                var scheduleAppointment = new ScheduleAppointment();
                scheduleAppointment.Color     = Color.ParseColor(colorCollection[i]);
                scheduleAppointment.Subject   = subjectCollection[i];
                scheduleAppointment.StartTime = startTimeCollection[i];
                scheduleAppointment.EndTime   = endTimeCollection[i];
                if (i == 4 || i == 9)
                {
                    scheduleAppointment.IsAllDay = true;
                }
                appointmentCollection.Add(scheduleAppointment);
            }

            // Minimum Height Appointments
            for (int i = 0; i < 5; i++)
            {
                var scheduleAppointment = new ScheduleAppointment();
                scheduleAppointment.Color     = Color.ParseColor(colorCollection[i]);
                scheduleAppointment.Subject   = minTimeSubjectCollection[i];
                scheduleAppointment.StartTime = minStartTimeCollection[i];
                scheduleAppointment.EndTime   = minStartTimeCollection[i];
                // Setting Mininmum Appointment Height for Schedule Appointments
                scheduleAppointment.MinHeight = 50;
                appointmentCollection.Add(scheduleAppointment);
            }
        }
        void AddAppointments_Click(object sender, RoutedEventArgs e)
        {
            Schedule.Appointments.Clear();
            ScheduleAppointmentCollection AppCollection = new ScheduleAppointmentCollection();
            DateTime currectDate = DateTime.Now;

            AppCollection.Add(new ScheduleAppointment
            {
                StartTime             = currectDate.Date.AddHours(3),
                EndTime               = currectDate.Date.AddHours(6),
                AppointmentBackground = new SolidColorBrush(Color.FromArgb(0xFf, 0x8E, 0xC4, 0x41)),
                Subject               = "Business Meeting",
                ReminderTime          = ReminderTimeType.FiveMin
            });

            AppCollection.Add(new ScheduleAppointment
            {
                StartTime             = currectDate.Date.AddDays(1),
                EndTime               = currectDate.Date.AddDays(1).AddHours(4),
                AppointmentBackground = new SolidColorBrush(Color.FromArgb(0xFf, 0x8D, 0xEA, 0xFF)),
                Subject               = "Auditing",
                ReminderTime          = ReminderTimeType.OneDay
            });

            AppCollection.Add(new ScheduleAppointment
            {
                StartTime             = currectDate.Date.AddDays(7),
                EndTime               = currectDate.Date.AddDays(7).AddHours(3),
                AppointmentBackground = new SolidColorBrush(Color.FromArgb(0xFf, 0xF7, 0x94, 0xD7)),
                Subject               = "Conference",
                ReminderTime          = ReminderTimeType.TwoWeeks
            });

            Schedule.Appointments = AppCollection;
        }
Exemple #5
0
        //creating RecurrsiveAppointments
        private void CreateRecurrsiveAppointments()
        {
            RecurssiveAppointmentCollection = new ScheduleAppointmentCollection();

            //Recurrence Appointment 1
            ScheduleAppointment alternativeDayAppointment = new ScheduleAppointment();
            DateTime            currentDate = DateTime.Now;
            DateTime            startTime   = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 9, 0, 0);
            DateTime            endTime     = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 10, 0, 0);

            alternativeDayAppointment.StartTime   = startTime;
            alternativeDayAppointment.EndTime     = endTime;
            alternativeDayAppointment.Color       = Color.FromHex("#FFA2C139");
            alternativeDayAppointment.Subject     = "Occurs every 2 days";
            alternativeDayAppointment.IsRecursive = true;
            RecurrenceProperties recurrencePropertiesForAlternativeDay = new RecurrenceProperties();

            recurrencePropertiesForAlternativeDay.RecurrenceType         = RecurrenceType.Daily;
            recurrencePropertiesForAlternativeDay.IsDailyEveryNDays      = true;
            recurrencePropertiesForAlternativeDay.DailyNDays             = 2;
            recurrencePropertiesForAlternativeDay.IsRangeRecurrenceCount = true;
            recurrencePropertiesForAlternativeDay.IsRangeNoEndDate       = false;
            recurrencePropertiesForAlternativeDay.IsRangeEndDate         = false;
            recurrencePropertiesForAlternativeDay.RangeRecurrenceCount   = 10;
            recurrencePropertiesForAlternativeDay.RecurrenceRule         = "FREQ=DAILY;COUNT=10;INTERVAL=2";
            alternativeDayAppointment.RecurrenceRule = recurrencePropertiesForAlternativeDay.RecurrenceRule;
            RecurssiveAppointmentCollection.Add(alternativeDayAppointment);

            //Recurrence Appointment 2
            ScheduleAppointment weeklyAppointment = new ScheduleAppointment();
            DateTime            startTime1        = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 11, 0, 0);
            DateTime            endTime1          = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 12, 0, 0);

            weeklyAppointment.StartTime   = startTime1;
            weeklyAppointment.EndTime     = endTime1;
            weeklyAppointment.Color       = Color.FromHex("#FFD80073");
            weeklyAppointment.Subject     = "Occurs every monday";
            weeklyAppointment.IsRecursive = true;

            RecurrenceProperties recurrencePropertiesForWeeklyAppointment = new RecurrenceProperties();

            recurrencePropertiesForWeeklyAppointment.RecurrenceType         = RecurrenceType.Weekly;
            recurrencePropertiesForWeeklyAppointment.IsRangeRecurrenceCount = true;
            recurrencePropertiesForWeeklyAppointment.WeeklyEveryNWeeks      = 1;
            recurrencePropertiesForWeeklyAppointment.IsWeeklySunday         = false;
            recurrencePropertiesForWeeklyAppointment.IsWeeklyMonday         = true;
            recurrencePropertiesForWeeklyAppointment.IsWeeklyTuesday        = false;
            recurrencePropertiesForWeeklyAppointment.IsWeeklyWednesday      = false;
            recurrencePropertiesForWeeklyAppointment.IsWeeklyThursday       = false;
            recurrencePropertiesForWeeklyAppointment.IsWeeklyFriday         = false;
            recurrencePropertiesForWeeklyAppointment.IsWeeklySaturday       = false;
            recurrencePropertiesForWeeklyAppointment.RangeRecurrenceCount   = 10;
            recurrencePropertiesForWeeklyAppointment.RecurrenceRule         = "FREQ=WEEKLY;COUNT=10;BYDAY=MO";
            weeklyAppointment.RecurrenceRule = recurrencePropertiesForWeeklyAppointment.RecurrenceRule;
            RecurssiveAppointmentCollection.Add(weeklyAppointment);
        }
Exemple #6
0
        private void LoadAppointments()
        {
            Appointments = new ScheduleAppointmentCollection();
            DateTime currentdate = DateTime.Now.Date;

            if (currentdate.DayOfWeek == System.DayOfWeek.Friday || currentdate.DayOfWeek == System.DayOfWeek.Saturday)
            {
                currentdate = currentdate.SubtractDays(3);
            }
            else if (currentdate.DayOfWeek == System.DayOfWeek.Sunday || currentdate.DayOfWeek == System.DayOfWeek.Monday)
            {
                currentdate = currentdate.AddDays(3);
            }
            Appointments.Add(new Appointment()
            {
                AppointmentImageURI = new BitmapImage(new Uri("pack://application:,,,/CustomizationDemo;Component/Assets/Hospital.png")),
                AppointmentType     = AppointmentTypes.Health,
                Status = new ScheduleAppointmentStatus {
                    Brush = new SolidColorBrush(Colors.Green), Status = "Free"
                },
                StartTime             = currentdate.AddHours(12),
                AppointmentTime       = currentdate.AddHours(12).ToString("hh:mm tt"),
                EndTime               = currentdate.AddHours(15),
                Subject               = "Checkup",
                Location              = "Chennai",
                AppointmentBackground = new SolidColorBrush(Color.FromArgb(255, 236, 12, 12))
            });
            currentdate = currentdate.AddHours(4);
            Appointments.Add(new Appointment()
            {
                AppointmentImageURI = new BitmapImage(new Uri("pack://application:,,,/CustomizationDemo;Component/Assets/Cake.png")),
                AppointmentType     = AppointmentTypes.Family,
                Status = new ScheduleAppointmentStatus {
                    Brush = new SolidColorBrush(Colors.Green), Status = "Free"
                },
                StartTime             = currentdate.Date.SubtractDays(2).AddHours(1),
                AppointmentTime       = currentdate.Date.SubtractDays(2).AddHours(1).ToString("hh:mm tt"),
                EndTime               = currentdate.Date.SubtractDays(2).AddHours(4),
                Subject               = "My B'day",
                AppointmentBackground = new SolidColorBrush(Color.FromArgb(255, 180, 31, 125))
            });
            Appointments.Add(new Appointment()
            {
                AppointmentImageURI = new BitmapImage(new Uri("pack://application:,,,/CustomizationDemo;Component/Assets/Team.png")),
                AppointmentType     = AppointmentTypes.Office,
                Status = new ScheduleAppointmentStatus {
                    Brush = new SolidColorBrush(Colors.Green), Status = "Free"
                },
                StartTime             = currentdate.Date.AddDays(2).AddHours(9),
                AppointmentTime       = currentdate.Date.AddDays(2).AddHours(9).ToString("hh:mm tt"),
                EndTime               = currentdate.Date.AddDays(2).AddHours(12),
                Subject               = "Meeting",
                AppointmentBackground = new SolidColorBrush(Color.FromArgb(255, 60, 181, 75))
            });
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            LinearLayout linearLayout = new LinearLayout(this);

            linearLayout.Orientation = Orientation.Vertical;
            this.AddButton(linearLayout);
            //Creating an instance for SfSchedule Control
            SfSchedule schedule = new SfSchedule(this);

            schedule.ScheduleView = Com.Syncfusion.Schedule.Enums.ScheduleView.WeekView;

            // Creating an instance for schedule appointment Collection

            Calendar startTime = (Calendar)currentDate.Clone();

            //setting start time for the event
            startTime.Set(2017, 08, 03, 10, 0, 0);
            Calendar endTime = (Calendar)currentDate.Clone();

            //setting end time for the event
            endTime.Set(2017, 08, 03, 12, 0, 0);

            // move to date.
            schedule.MoveToDate = startTime;

            // Set exception dates.
            var exceptionDate1 = Calendar.Instance;

            exceptionDate1.Set(2017, 08, 03);
            var exceptionDate2 = Calendar.Instance;

            exceptionDate2.Set(2017, 08, 05);
            exceptionDate3 = Calendar.Instance;
            exceptionDate3.Set(2017, 08, 07);

            ScheduleAppointment recurrenceAppointment = new ScheduleAppointment();

            recurrenceAppointment.Id                       = 1;
            recurrenceAppointment.StartTime                = startTime;
            recurrenceAppointment.EndTime                  = endTime;
            recurrenceAppointment.Subject                  = "Daily Occurs";
            recurrenceAppointment.Color                    = Color.Blue;
            recurrenceAppointment.RecurrenceRule           = "FREQ=DAILY;COUNT=20";
            recurrenceAppointment.RecurrenceExceptionDates = new ObservableCollection <Calendar> {
                exceptionDate1, exceptionDate2, exceptionDate3
            };
            scheduleAppointmentCollection.Add(recurrenceAppointment);

            //Adding schedule appointment collection to SfSchedule appointments
            schedule.ItemsSource = scheduleAppointmentCollection;
            linearLayout.AddView(schedule);
            SetContentView(linearLayout);
        }
Exemple #8
0
        private void Save()
        {
            if (_adding)
            {
                var session           = _viewModel.SaveSession();
                var sessionAppoinment = new SessionAppointment()
                {
                    Session        = session,
                    Subject        = session.Subject.Name,
                    StartTime      = session.Time,
                    EndTime        = session.Time + TimeSpan.FromMinutes(session.Terms * Subject.TermLenght),
                    RecurrenceRule = "week"
                };
                _appointments.Add(sessionAppoinment);
                _remainingSession.RemainingTerms -= session.Terms;
            }
            else
            {
                _viewModel.UpdateSession();
                var session = _viewModel.Session;
                var app     =
                    (SessionAppointment)
                    _appointments.FirstOrDefault(a => (a as SessionAppointment).Session.Id == session.Id);
                app.Session = _viewModel.Session;
                app.EndTime = session.Time + TimeSpan.FromMinutes(session.Terms * Subject.TermLenght);

                _mainWindowViewModel.InitRemainigSessions();
            }

            Close();
        }
Exemple #9
0
        public async Task refreshCalendar()
        {
            listEvents = await fireBaseHelperEvents.GetAllEvents();

            ScheduleAppointmentCollection scheduleAppointmentCollection = new ScheduleAppointmentCollection();

            if (listEvents.Count == 0)
            {
                schedule.DataSource = scheduleAppointmentCollection;
            }
            else
            {
                foreach (EventModel ev in listEvents)
                {
                    DateTime startDate = Convert.ToDateTime(ev.StartEventDate.ToString());
                    DateTime endDate   = Convert.ToDateTime(ev.EndEventDate.ToString());

                    //Console.WriteLine("---------------------- ev->" + ev.EventDate.ToString() + "  -------------------- start_Date->" + start_Date.ToString());
                    scheduleAppointmentCollection.Add(new ScheduleAppointment()
                    {
                        BindingContext = this,
                        StartTime      = startDate,
                        EndTime        = endDate,
                        Subject        = ev.Name,
                        Notes          = ev.Description,
                        Color          = ev.Color,
                    });
                    schedule.DataSource = scheduleAppointmentCollection;
                }
            }
        }
Exemple #10
0
        public CustomizationDemo_WinRT()
        {
            InitializeComponent();
            customeEditor.DataContext = this;
            this.schedule             = Schedule;
            var visibleDatesBinding = new Binding {
                Source = this, Mode = BindingMode.TwoWay, Path = new PropertyPath("VisibleDatesCollection")
            };

            BindingOperations.SetBinding(Schedule, SfSchedule.VisibleDatesProperty, visibleDatesBinding);

            DateTime currentdate = DateTime.Now.Date;

            if (currentdate.DayOfWeek == System.DayOfWeek.Friday || currentdate.DayOfWeek == System.DayOfWeek.Saturday)
            {
                currentdate = currentdate.SubtractDays(3);
            }
            else if (currentdate.DayOfWeek == System.DayOfWeek.Sunday || currentdate.DayOfWeek == System.DayOfWeek.Monday)
            {
                currentdate = currentdate.AddDays(3);
            }
            AppointmentCollection = new ScheduleAppointmentCollection();
            AppointmentCollection.Add(new AppointmentWinRT()
            {
                AppointmentType = AppointmentWinRT.AppointmentTypesWinRT.Health, Status = Schedule.AppointmentStatusCollection[0], StartTime = currentdate.AddHours(12), AppointmentTime = currentdate.AddHours(12).ToString("hh:mm tt"), EndTime = currentdate.AddHours(15), Subject = "Checkup", Location = "Chennai", AppointmentBackground = new SolidColorBrush(ColorHelper.FromArgb(255, 236, 12, 12))
            });
            currentdate = currentdate.AddHours(4);
            AppointmentCollection.Add(new AppointmentWinRT()
            {
                AppointmentType = AppointmentWinRT.AppointmentTypesWinRT.Family, Status = Schedule.AppointmentStatusCollection[0], StartTime = currentdate.Date.SubtractDays(2).AddHours(1), AppointmentTime = currentdate.Date.SubtractDays(2).AddHours(1).ToString("hh:mm tt"), EndTime = currentdate.Date.SubtractDays(2).AddHours(4), Subject = "My B'day", AppointmentBackground = new SolidColorBrush(ColorHelper.FromArgb(255, 180, 31, 125))
            });
            AppointmentCollection.Add(new AppointmentWinRT()
            {
                AppointmentType = AppointmentWinRT.AppointmentTypesWinRT.Office, Status = Schedule.AppointmentStatusCollection[0], StartTime = currentdate.Date.AddDays(2).AddHours(9), AppointmentTime = currentdate.Date.AddDays(2).AddHours(9).ToString("hh:mm tt"), EndTime = currentdate.Date.AddDays(2).AddHours(12), Subject = "Meeting", AppointmentBackground = new SolidColorBrush(ColorHelper.FromArgb(255, 60, 181, 75))
            });
            schedule.Appointments = AppointmentCollection;
            ScheduleHeaderStyle mainHeader = new ScheduleHeaderStyle();

            mainHeader.HeaderHeight            = 0;
            schedule.VisibleDatesChanging     += Schedule_VisibleDatesChanging1;
            Schedule.ScheduleHeaderStyle       = mainHeader;
            Schedule.AppointmentEditorOpening += schedule_AppointmentEditorOpening;
            Schedule.ContextMenuOpening       += Schedule_PopupMenuOpening;
            schedule.ScheduleTapped           += schedule_ScheduleTapped;
        }
Exemple #11
0
        //creating RecurrsiveAppointments
        private void CreateRecurrsiveAppointments()
        {
            RecursiveAppointmentCollection = new ScheduleAppointmentCollection();

            //Recurrence Appointment 1
            ScheduleAppointment alternativeDayAppointment = new ScheduleAppointment();
            DateTime            currentDate = DateTime.Now;
            DateTime            startTime   = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 9, 0, 0);
            DateTime            endTime     = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 10, 0, 0);

            alternativeDayAppointment.StartTime = startTime;
            alternativeDayAppointment.EndTime   = endTime;
            alternativeDayAppointment.Color     = Color.FromHex("#FFA2C139");
            alternativeDayAppointment.Subject   = "Occurs every 2 days";
            RecurrenceProperties recurrencePropertiesForAlternativeDay = new RecurrenceProperties();

            recurrencePropertiesForAlternativeDay.RecurrenceType    = RecurrenceType.Daily;
            recurrencePropertiesForAlternativeDay.IsDailyEveryNDays = true;
            recurrencePropertiesForAlternativeDay.Interval          = 2;
            recurrencePropertiesForAlternativeDay.RecurrenceRange   = RecurrenceRange.Count;
            recurrencePropertiesForAlternativeDay.RecurrenceCount   = 10;
            alternativeDayAppointment.RecurrenceRule = DependencyService.Get <IRecurrenceBuilder>().RRuleGenerator(recurrencePropertiesForAlternativeDay, alternativeDayAppointment.StartTime, alternativeDayAppointment.EndTime);
            RecursiveAppointmentCollection.Add(alternativeDayAppointment);

            //Recurrence Appointment 2
            ScheduleAppointment weeklyAppointment = new ScheduleAppointment();
            DateTime            startTime1        = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 11, 0, 0);
            DateTime            endTime1          = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 12, 0, 0);

            weeklyAppointment.StartTime = startTime1;
            weeklyAppointment.EndTime   = endTime1;
            weeklyAppointment.Color     = Color.FromHex("#FFD80073");
            weeklyAppointment.Subject   = "Occurs every Monday";

            RecurrenceProperties recurrencePropertiesForWeeklyAppointment = new RecurrenceProperties();

            recurrencePropertiesForWeeklyAppointment.RecurrenceType  = RecurrenceType.Weekly;
            recurrencePropertiesForWeeklyAppointment.RecurrenceRange = RecurrenceRange.Count;
            recurrencePropertiesForWeeklyAppointment.Interval        = 1;
            recurrencePropertiesForWeeklyAppointment.WeekDays        = WeekDays.Monday;
            recurrencePropertiesForWeeklyAppointment.RecurrenceCount = 10;
            weeklyAppointment.RecurrenceRule = DependencyService.Get <IRecurrenceBuilder>().RRuleGenerator(recurrencePropertiesForWeeklyAppointment, weeklyAppointment.StartTime, weeklyAppointment.EndTime);
            RecursiveAppointmentCollection.Add(weeklyAppointment);
        }
        public Localization()
        {
            Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "fr-fr";

            this.InitializeComponent();

            Random   ran   = new Random();
            DateTime today = DateTime.Now;

            DateTime startMonth   = today.AddDays(-14);
            DateTime endMonth     = today.AddDays(14);
            int      day          = (int)startMonth.DayOfWeek;
            DateTime CurrentStart = startMonth.AddDays(-day);
            ObservableCollection <SolidColorBrush> brush = new ObservableCollection <SolidColorBrush>();

            brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0xA2, 0xC1, 0x39)));
            brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0xD8, 0x00, 0x73)));
            brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0x1B, 0xA1, 0xE2)));
            brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0xE6, 0x71, 0xB8)));
            brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0xF0, 0x96, 0x09)));
            brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0x33, 0x99, 0x33)));
            brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0xAB, 0xA9)));
            brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0xE6, 0x71, 0xB8)));

            ScheduleAppointmentCollection AppointmentCollection = new ScheduleAppointmentCollection();

            for (int i = 0; i < 50; i++)
            {
                if (i % 7 == 0 || i % 7 == 6)
                {
                    //add weekend appointments
                    // NonWorkingDays.Add(CurrentStart.AddDays(i));
                }
                else
                {
                    //Add Workweek appointment
                    WorkWeekDays.Add(CurrentStart.AddDays(i));
                }
            }


            for (int i = 0; i < 30; i++)
            {
                DateTime date = WorkWeekDays[ran.Next(0, WorkWeekDays.Count)].AddHours(ran.Next(9, 17));
                AppointmentCollection.Add(new ScheduleAppointment()
                {
                    StartTime             = date,
                    EndTime               = date.AddHours(1),
                    AppointmentBackground = brush[i % brush.Count],
                    Subject               = SubjectColl[i % SubjectColl.Count]
                });
            }

            schedule.Appointments = AppointmentCollection;
        }
Exemple #13
0
 public SchedulerViewModel()
 {
     ScheduleAppointmentCollection = new ScheduleAppointmentCollection();
     ScheduleAppointmentCollection.Add(new ScheduleAppointment()
     {
         StartTime = DateTime.Now,
         EndTime   = DateTime.Now.AddHours(1),
         Subject   = "Meeting",
         Location  = "Hutchison road",
     });
 }
Exemple #14
0
        private ScheduleAppointmentCollection GetFilterCollection()
        {
            string[] football = new string[] { "USA vs IRN ", "RUS vs ARG", "POR vs SWI", "BEL vs ARG", "USA vs RUS", "IRN vs POR", "CRO vs MEX", "JPN vs ITA", "COL vs URU" };
            string[] cricket  = new string[] { "IND vs PAk", "AUS vs SA", "SRI vs WI", "SA vs IND", "ZIM vs PAK", "SRI vs AUS" };
            string[] news     = new string[] { "Cricket news", "Football news", "Hockey news", "Tennis news", "news of Athletics", "Golf news", "Kabaddi news", "VolleyBall news" };
            string[] pgms     = new string[] { "FootBall", "Cricket", "News" };
            ScheduleAppointmentCollection app = new ScheduleAppointmentCollection();

            for (int dc = 0; dc < datecoll.Count - 1; dc++)
            {
                DateTime date = datecoll[dc];
                dateselected.Add(date);

                for (int sd = 0; sd < dateselected.Count - 1; sd++)
                {
                    if (date == dateselected[sd])
                    {
                        date = date.AddDays(1);
                    }
                }
                ScheduleAppointment app1 = new ScheduleAppointment()
                {
                    StartTime = date
                };
                app1.ResourceCollection.Add(new Resource()
                {
                    ResourceName = "TV" + random.Next(1, 4), TypeName = "TV"
                });
                app1.ResourceCollection.Add(new Resource()
                {
                    ResourceName = pgms[random.Next(0, 3)], TypeName = "programs"
                });
                if ((app1.ResourceCollection[1] as Resource).ResourceName.Equals("FootBall"))
                {
                    app1.Subject = football[random.Next(0, football.Length)];
                    app1.EndTime = date.AddHours(1);
                }
                else if ((app1.ResourceCollection[1] as Resource).ResourceName.Equals("Cricket"))
                {
                    app1.Subject = cricket[random.Next(0, cricket.Length)];
                    app1.EndTime = date.AddHours(1);
                }
                else
                {
                    app1.Subject = news[random.Next(0, news.Length)];
                    app1.EndTime = date.AddHours(1);
                }
                app1.AppointmentBackground = new SolidColorBrush(Colors.DimGray);

                app.Add(app1);
            }
            return(app);
        }
Exemple #15
0
        private void CreateAppointments()
        {
            Orders = new ScheduleAppointmentCollection();
            CreateColorCollection();
            Calendar calendar = Calendar.Instance;
            Calendar DateFrom = Calendar.Instance;

            DateFrom.Add(CalendarField.Date, -10);
            Calendar DateTo = Calendar.Instance;

            DateTo.Add(CalendarField.Date, 10);
            Calendar dateRangeStart = Calendar.Instance;

            dateRangeStart.Add(CalendarField.Date, -3);
            Calendar dateRangeEnd = Calendar.Instance;

            dateRangeEnd.Add(CalendarField.Date, 3);

            for (int index = 0; index < schedulerList.Count; index++)
            {
                ScheduleAppointment order             = new ScheduleAppointment();
                Java.Util.Calendar  startTimeCalendar = Java.Util.Calendar.Instance;

                CultureInfo provider = CultureInfo.InvariantCulture;

                DateTime startDateTime = DateTime.ParseExact(schedulerList[index].Start_date, "yyyy-MM-dd HH:mm:ss", provider);
                DateTime endDateTime   = DateTime.ParseExact(schedulerList[index].End_date, "yyyy-MM-dd HH:mm:ss", provider);

                if (startDateTime >= DateTime.Now && startDateTime != endDateTime)
                {
                    if (Orders.Count == 0)
                    {
                        minDateTime = startDateTime;
                    }
                    else
                    {
                        minDateTime = (minDateTime < startDateTime) ? minDateTime : startDateTime;
                    }
                    startTimeCalendar.Set(startDateTime.Year, startDateTime.Month - 1, startDateTime.Day, startDateTime.Hour, startDateTime.Minute);

                    order.StartTime = startTimeCalendar;

                    Calendar endTimeCalendar = Calendar.Instance;
                    endTimeCalendar.Set(endDateTime.Year, endDateTime.Month - 1, endDateTime.Day, endDateTime.Hour, endDateTime.Minute);
                    order.EndTime      = endTimeCalendar;
                    order.Color        = Color.ParseColor(colorCollection[index % colorCollection.Count]);
                    order.Subject      = schedulerList[index].Text;
                    order.RecurrenceId = int.Parse(schedulerList[index].Id);
                    Orders.Add(order);
                }
            }
        }
        /// <summary>
        /// Initialize the appointment.
        /// </summary>
        /// <param name="count">Count</param>
        /// <param name="visibleDates">Visible dates</param>
        private void IntializeAppoitments(int count, List <DateTime> visibleDates)
        {
            ScheduleAppointmentCollection appointments = new ScheduleAppointmentCollection();
            var      random     = new Random();
            DateTime randomDate = new DateTime();

            // Adding Appointment based on Visible dates count
            for (int i = 0; i < count; i++)
            {
                var date = visibleDates[i];
                randomDate = visibleDates[random.Next(0, count)];

                // Two appointments per day
                for (int a = 0; a < 2; a++)
                {
                    var scheduleAppointment = new ScheduleAppointment();
                    scheduleAppointment.StartTime = new DateTime(date.Year, date.Month, date.Day, random.Next(9, 18), 0, 0);
                    scheduleAppointment.EndTime   = scheduleAppointment.StartTime.AddHours(1);
                    scheduleAppointment.Color     = Color.FromRgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255));
                    scheduleAppointment.Subject   = this.subjectCollection[random.Next(0, 25)];

                    appointments.Add(scheduleAppointment);
                }
            }

            // Allday Appointment per view
            var alldayAppointment = new ScheduleAppointment();

            alldayAppointment.StartTime = new DateTime(randomDate.Year, randomDate.Month, randomDate.Day, random.Next(9, 18), 0, 0);
            alldayAppointment.EndTime   = alldayAppointment.StartTime.AddHours(1);
            alldayAppointment.Color     = Color.FromRgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255));
            alldayAppointment.Subject   = this.subjectCollection[random.Next(0, 25)];
            alldayAppointment.IsAllDay  = true;
            appointments.Add(alldayAppointment);

            this.schedule.DataSource = appointments;
        }
        private void CreateResourceAppointments()
        {
            Events = new ScheduleAppointmentCollection();
            Random randomTime = new Random();

            List <Point> randomTimeCollection = this.GettingTimeRanges();
            var          resurceCollection    = this.Resources as ObservableCollection <object>;

            this.eventNames = new List <string>();
            this.eventNames.Add("General Meeting");
            this.eventNames.Add("Plan Execution");
            this.eventNames.Add("Project Plan");
            this.eventNames.Add("Consulting");
            this.eventNames.Add("Performance Check");
            this.eventNames.Add("Yoga Therapy");

            for (int resource = 0; resource < resurceCollection.Count; resource++)
            {
                var      scheduleResource = resurceCollection[resource] as SchedulerResource;
                DateTime date;
                DateTime dateFrom       = DateTime.Now.AddDays(-15);
                DateTime dateTo         = DateTime.Now.AddDays(15);
                DateTime dateRangeStart = DateTime.Now.AddDays(-15);
                DateTime dateRangeEnd   = DateTime.Now.AddDays(15);

                for (date = dateFrom; date < dateTo; date = date.AddDays(1))
                {
                    if ((DateTime.Compare(date, dateRangeStart) > 0) && (DateTime.Compare(date, dateRangeEnd) < 0))
                    {
                        for (int additionalAppointmentIndex = 0; additionalAppointmentIndex < 4; additionalAppointmentIndex++)
                        {
                            //int dateTime = randomTime.Next(0, 23);
                            DateTime dateTime1 = new DateTime(date.Year, date.Month, date.Day, randomTime.Next(0, 23), 0, 0);
                            Events.Add(new ScheduleAppointment()
                            {
                                StartTime            = dateTime1,
                                EndTime              = dateTime1.AddHours(2),
                                Subject              = this.eventNames[randomTime.Next(4)],
                                ResourceIdCollection = new ObservableCollection <object>()
                                {
                                    scheduleResource.Id
                                },
                                AppointmentBackground = scheduleResource.Background,
                            });
                        }
                    }
                }
            }
        }
Exemple #18
0
        private void AppointmentsListener_Succes(object sender, EventArgs e)
        {
            var snapshot = (QuerySnapshot)sender;

            _appointments = new ScheduleAppointmentCollection();
            if (!snapshot.IsEmpty)
            {
                var documents = snapshot.Documents;
                try
                {
                    foreach (var document in documents)
                    {
                        var newAppointment = new ScheduleAppointment();

                        Calendar startTimeCalendar = Calendar.Instance;
                        Calendar endTimeCalendar   = Calendar.Instance;
                        startTimeCalendar.TimeInMillis = document.GetDate("startTime").Time;
                        // set start time of appointment and ending of it
                        endTimeCalendar.TimeInMillis = document.GetDate("endTime").Time;



                        newAppointment.StartTime = startTimeCalendar;
                        newAppointment.EndTime   = endTimeCalendar;
                        if (document.GetString("clientId").Equals(clientLogged.Id))
                        {
                            newAppointment.Subject = document.Get("type").ToString();
                        }
                        else
                        {
                            newAppointment.Color = Color.Black;
                        }

                        newAppointment.Notes    = "Durata: " + document.Get("duration").ToString();
                        newAppointment.Location = "Daily vet";

                        _appointments.Add(newAppointment);
                    }
                    _scheduler.ItemsSource = _appointments;
                    progress.Dismiss();
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error caught: ", ex.Message);
                    progress.Dismiss();
                    Toast.MakeText(this, "Eroare la vizualizarea programarilor!", ToastLength.Long);
                }
            }
        }
Exemple #19
0
        //Creating appointments for ScheduleAppointmentCollection
        private ScheduleAppointmentCollection getChineseAppointments()
        {
            ScheduleAppointmentCollection appointmentCollection = new ScheduleAppointmentCollection();

            for (int i = 0; i < 10; i++)
            {
                ScheduleAppointment scheduleAppointment = new ScheduleAppointment();
                scheduleAppointment.Color     = (Color.ParseColor(colorCollection[i]));
                scheduleAppointment.Subject   = chineseCollection[i];
                scheduleAppointment.StartTime = (startTimeCollection[i]);
                scheduleAppointment.EndTime   = (endTimeCollection[i]);
                appointmentCollection.Add(scheduleAppointment);
            }
            return(appointmentCollection);
        }
        public SchedulerViewModel()
        {
            AppointmentCollection = new ScheduleAppointmentCollection();
            //Creating new event
            var      clientMeeting = new Syncfusion.SfSchedule.XForms.ScheduleAppointment();
            DateTime currentDate   = DateTime.Now;
            DateTime startTime     = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 10, 0, 0);
            DateTime endTime       = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 12, 0, 0);

            clientMeeting.StartTime = startTime;
            clientMeeting.EndTime   = endTime;
            clientMeeting.Color     = Color.Green;
            clientMeeting.Subject   = "ClientMeeting";
            AppointmentCollection.Add(clientMeeting);
        }
        public MainWindow()
        {
            this.InitializeComponent();
            ScheduleAppointmentCollection appointmentCollection = new ScheduleAppointmentCollection();
            //Creating new event
            ScheduleAppointment clientMeeting = new ScheduleAppointment();
            DateTime            currentDate   = DateTime.Now;
            DateTime            startTime     = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 10, 0, 0);
            DateTime            endTime       = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 12, 0, 0);

            clientMeeting.StartTime = startTime;
            clientMeeting.EndTime   = endTime;
            clientMeeting.Subject   = "ClientMeeting";
            appointmentCollection.Add(clientMeeting);
            Schedule.ItemsSource = appointmentCollection;
        }
        public ScheduleAppointmentCollection MapToScheduleAppointmentCollection(List<EventItem> eventItems)
        {
            if (eventItems == null || eventItems.Count == 0)
            {
                return null;
            }

            var scheduleAppointmentCollection = new ScheduleAppointmentCollection();

            foreach (var eventItem in eventItems)
            {
                scheduleAppointmentCollection.Add(MapTo(eventItem));
            }

            return scheduleAppointmentCollection;
        }
        //Creating appointments for ScheduleAppointmentCollection
        private ScheduleAppointmentCollection GetEnglishAppointments()
        {
            ScheduleAppointmentCollection appointmentCollection = new ScheduleAppointmentCollection();

            for (int i = 0; i < 10; i++)
            {
                ScheduleAppointment scheduleAppointment = new ScheduleAppointment();
                scheduleAppointment.Color     = Color.ParseColor(colorCollection[i]);
                scheduleAppointment.Subject   = englishCollection[i];
                scheduleAppointment.StartTime = startTimeCollection[i];
                scheduleAppointment.EndTime   = endTimeCollection[i];
                appointmentCollection.Add(scheduleAppointment);
            }

            return(appointmentCollection);
        }
Exemple #24
0
 //Creating appointments for ScheduleAppointmentCollection
 private void getAppointments()
 {
     appointmentCollection = new ScheduleAppointmentCollection();
     setColors();
     RandomNumbers();
     setSubjects();
     setStartTime();
     setEndTime();
     for (int i = 0; i < 3; i++)
     {
         ScheduleAppointment scheduleAppointment = new ScheduleAppointment();
         scheduleAppointment.Color     = Color.ParseColor(colorCollection[i]);
         scheduleAppointment.Subject   = subjectCollection[i];
         scheduleAppointment.StartTime = startTimeCollection[i];
         scheduleAppointment.EndTime   = endTimeCollection[i];
         appointmentCollection.Add(scheduleAppointment);
     }
 }
Exemple #25
0
 //Creating appointments for ScheduleAppointmentCollection
 private void getAppointments()
 {
     appointmentCollection = new ScheduleAppointmentCollection();
     setColors();
     RandomNumbers();
     setSubjects();
     setStartTime();
     setEndTime();
     for (int i = 0; i < 10; i++)
     {
         var scheduleAppointment = new ScheduleAppointment();
         scheduleAppointment.Color     = Color.ParseColor(colorCollection[i]);
         scheduleAppointment.Subject   = subjectCollection[i];
         scheduleAppointment.StartTime = startTimeCollection[i];
         scheduleAppointment.EndTime   = endTimeCollection[i];
         if (i == 2 || i == 4)
         {
             scheduleAppointment.IsAllDay = true;
         }
         appointmentCollection.Add(scheduleAppointment);
     }
 }
        public async void LoadClasses()
        {
            Classes                   = new ObservableCollection <Class>(await _databaseService.GetClassesAsync());
            ClassCalendarEvents       = new CalendarEventCollection();
            ClassScheduleAppointments = new ScheduleAppointmentCollection();

            foreach (var _class in Classes)
            {
                var appointment = new CalendarInlineEvent();
                appointment.Subject   = _class.Detail;
                appointment.Color     = Color.FromHex("#FF6400");
                appointment.StartTime = _class.DateAndTime;
                appointment.EndTime   = _class.DateAndTime.AddHours(2);
                this.ClassCalendarEvents.Add(appointment);

                ClassScheduleAppointments.Add(new ScheduleAppointment()
                {
                    StartTime = _class.DateAndTime,
                    EndTime   = _class.DateAndTime.AddHours(2),
                    Subject   = _class.Detail,
                    Location  = _class.Location
                });
            }
        }
        public MainWindow()
        {
            this.InitializeComponent();
            this.OrderByDate.IsChecked = true;
            Random   ran   = new Random();
            DateTime today = DateTime.Now;

            if (today.Month == 12)
            {
                today = today.AddMonths(-1);
            }
            else if (today.Month == 1)
            {
                today = today.AddMonths(1);
            }
            int      day         = (int)today.DayOfWeek;
            DateTime currentWeek = DateTime.Now.AddDays(-day);

            DateTime startMonth = new DateTime(today.Year, today.Month - 1, 1, 0, 0, 0);

            for (int i = 1; i < 30; i += 2)
            {
                for (int j = -7; j < 14; j++)
                {
                    datecoll.Add(currentWeek.Date.AddDays(j).AddHours(ran.Next(9, 18)));
                }
            }

            ObservableCollection <SolidColorBrush> brush = new ObservableCollection <SolidColorBrush>();

            brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0xA2, 0xC1, 0x39)));
            brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0xD8, 0x00, 0x73)));
            brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0x1B, 0xA1, 0xE2)));
            brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0xE6, 0x71, 0xB8)));
            brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0xF0, 0x96, 0x09)));
            brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0x33, 0x99, 0x33)));
            brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0xAB, 0xA9)));
            brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0xE6, 0x71, 0xB8)));

            AppCollection = new ScheduleAppointmentCollection();
            ScheduleAppointmentCollection tempcollection = new ScheduleAppointmentCollection();

            AppCollection = tempcollection;
            int count = 0;

            for (int m = 0; m < 30; m++)
            {
                currentdate = datecoll[ran.Next(0, datecoll.Count)];
                DateTime nextdate = datecoll[ran.Next(0, datecoll.Count)];
                count++;
                ScheduleAppointment appointment1 = new ScheduleAppointment()
                {
                    StartTime = currentdate, EndTime = currentdate.AddHours(ran.Next(0, 2)), Subject = subject[count % subject.Length], Location = "Chennai", AppointmentBackground = brush[m % 3]
                };
                appointment1.ResourceCollection.Add(new Resource()
                {
                    TypeName = "Doctors", ResourceName = "Dr.Jacob"
                });
                count++;
                ScheduleAppointment appointment2 = new ScheduleAppointment()
                {
                    StartTime = nextdate, EndTime = nextdate.AddHours(ran.Next(0, 2)), Subject = subject[count % subject.Length], Location = "Chennai", AppointmentBackground = brush[(m + 2) % 3]
                };
                appointment2.ResourceCollection.Add(new Resource()
                {
                    TypeName = "Doctors", ResourceName = "Dr.Darsy"
                });
                tempcollection.Add(appointment1);
                tempcollection.Add(appointment2);
            }

            Schedule1.AppointmentStatusCollection.Add(new ScheduleAppointmentStatus()
            {
                Status = "Temporary"
            });
            this.DataContext = this;

            (this.Schedule1.ScheduleResourceTypeCollection[0].ResourceCollection[0] as CustomResource).ResourceImageUri = new BitmapImage(new Uri("pack://application:,,,/ResourceDemo;Component/Assets/emp1.png"));
            (this.Schedule1.ScheduleResourceTypeCollection[0].ResourceCollection[1] as CustomResource).ResourceImageUri = new BitmapImage(new Uri("pack://application:,,,/ResourceDemo;Component/Assets/emp2.png"));
        }
Exemple #28
0
        public Tasks()
        {
            try
            {
                InitializeComponent();
                customeEditorTache.DataContext     = this;
                customeEditorTache.Visibility      = Visibility.Collapsed;
                Schedule.AppointmentEditorOpening += Schedule_AppointmentEditorOpening;
                Schedule.ReminderOpening          += Schedule_ReminderOpening;
                Activities = Activity.SelectActivite(userId);
                foreach (DataRow ligneact in this.Activities.Rows)
                {
                    taches = Taches.SelectTache((int)ligneact["Id"]);
                    if (this.taches != null)
                    {
                        foreach (DataRow ligne in this.taches.Rows)
                        {
                            int             iddoc;
                            DataTable       docs     = new DataTable();
                            BL.CLS_Document document = new BL.CLS_Document();
                            docs = document.RechDocument((int)ligne["Id"]);
                            if (docs.Rows.Count == 0)
                            {
                                iddoc = -1;
                            }
                            else
                            {
                                iddoc = (int)docs.Rows[0]["Id"];
                            }
                            DateTime date1   = new DateTime(int.Parse(((string)ligne["HeureDebut"]).Substring(0, 4)), int.Parse(((string)ligne["HeureDebut"]).Substring(5, 2)), int.Parse(((string)ligne["HeureDebut"]).Substring(8, 2)), int.Parse(((string)ligne["HeureDebut"]).Substring(11, 2)), int.Parse(((string)ligne["HeureDebut"]).Substring(14, 2)), 0);
                            DateTime date2   = new DateTime(int.Parse(((string)ligne["HeureFin"]).Substring(0, 4)), int.Parse(((string)ligne["HeureFin"]).Substring(5, 2)), int.Parse(((string)ligne["HeureFin"]).Substring(8, 2)), int.Parse(((string)ligne["HeureFin"]).Substring(11, 2)), int.Parse(((string)ligne["HeureFin"]).Substring(14, 2)), 0);
                            int      cpt     = 0;
                            int      iter    = 1;
                            int      semaine = 7;
                            if ((string)ligneact["Designation"] == "Planning")
                            {
                                iter = 19;
                                if (IdentifiantEmploiDuTemps == 0)
                                {
                                    IdentifiantEmploiDuTemps = (int)ligne["ActiviteId"];
                                }
                            }

                            while (cpt < iter)
                            {
                                AppointmentCollection.Add(new Appointment()
                                {
                                    StartTime             = date1,
                                    EndTime               = date2,
                                    AppointmentBackground = colorTache,
                                    Subject               = (string)ligne["Designation"],
                                    selectedEtat          = (int)ligne["Etat"],
                                    TypeAjout             = TypeAjout.TASK,
                                    selectedPriority      = (int)ligne["Priorite"],
                                    IdActivite            = (int)ligne["ActiviteId"],
                                    IdTache               = (int)ligne["Id"],
                                    IdCellule             = (int)ligne["Etat"],
                                    Notes            = (string)ligne["Commentaire"],
                                    selectedActivity = ((int)ligne["ActiviteId"] - 1),
                                    IdDocument       = iddoc,
                                    selectedReminder = (int)ligne["Alerte"]
                                });
                                date1 = date1.AddDays(semaine);
                                date2 = date2.AddDays(semaine);
                                cpt++;
                            }
                        }
                    }
                }
                Schedule.Appointments = AppointmentCollection;
            }
            catch (Exception ex)
            {
                MaterialMessageBox.Show("Une erreur est survenue");
            }
        }
        private ScheduleAppointmentCollection GenerateRandomAppointments()
        {
            DateTime today = DateTime.Now;

            if (today.Month == 12)
            {
                today = today.AddMonths(-1);
            }
            else if (today.Month == 1)
            {
                today = today.AddMonths(1);
            }

            DateTime currentdate = new DateTime(today.Year, today.Month - 1, 1, 0, 0, 0);

            var Appointments  = new ScheduleAppointmentCollection();
            var exceptionDate = new ObservableCollection <DateTime>();

            //DAILY RECURSIVE APPOINTMENTS
            ScheduleAppointment SchApp = new ScheduleAppointment();

            SchApp.Subject               = "Team Meeting";
            SchApp.Notes                 = "Daily Recurrence";
            SchApp.Location              = "Meeting Hall 1";
            SchApp.StartTime             = currentdate;
            SchApp.EndTime               = currentdate.AddHours(4);
            SchApp.AppointmentBackground = new SolidColorBrush((Color.FromArgb(0xFF, 0xD8, 0x00, 0x73)));
            //Avoid the recurrence appoinments for following specified dates
            for (int i = 0; i < 14; i++)
            {
                exceptionDate.Add(currentdate.AddMonths(1).AddDays(i + 15));
            }
            SchApp.RecursiveExceptionDates = exceptionDate;

            // Setting Recurrence Properties
            RecurrenceProperties RecProp = new RecurrenceProperties();

            RecProp.RecurrenceType         = RecurrenceType.Weekly;
            RecProp.IsWeeklyTuesday        = true;
            RecProp.IsWeeklyWednesday      = true;
            RecProp.IsWeeklyThursday       = true;
            RecProp.IsDailyEveryNDays      = false;
            RecProp.IsRangeRecurrenceCount = true;
            RecProp.IsRangeNoEndDate       = false;
            RecProp.IsRangeEndDate         = false;
            RecProp.RangeRecurrenceCount   = 50;

            // Generating RRule using ScheduleHelper

            SchApp.RecurrenceRule = ScheduleHelper.RRuleGenerator(RecProp, SchApp.StartTime, SchApp.EndTime);
            SchApp.IsRecursive    = true;
            Appointments.Add(SchApp);

            //WEEKLY RECURSIVE APPOINTMENT
            ScheduleAppointment SchAppWeek = new ScheduleAppointment();

            SchAppWeek.Subject               = "Doctor Appointment";
            SchAppWeek.Notes                 = "Weekly Recurrence";
            SchAppWeek.Location              = "Global Hospital";
            SchAppWeek.StartTime             = currentdate;
            SchAppWeek.EndTime               = currentdate.AddHours(4);
            SchAppWeek.AppointmentBackground = new SolidColorBrush((Color.FromArgb(0xFF, 0xA2, 0xC1, 0x39)));

            //Setting RRule as per ICalc standard by generating from RecurrenceProperties. You can assign string directly also.
            RecurrenceProperties RecPropWeek = new RecurrenceProperties();

            RecPropWeek.RecurrenceType         = RecurrenceType.Weekly;
            RecPropWeek.WeeklyEveryNWeeks      = 1;
            RecPropWeek.IsWeeklySunday         = true;
            RecPropWeek.IsRangeRecurrenceCount = true;
            RecPropWeek.IsRangeNoEndDate       = false;
            RecPropWeek.IsRangeEndDate         = false;
            RecPropWeek.RangeRecurrenceCount   = 20;

            SchAppWeek.RecurrenceRule = "FREQ=WEEKLY;COUNT=20;BYDAY=SU";
            SchAppWeek.IsRecursive    = true;
            Appointments.Add(SchAppWeek);

            //Montly Recursive Appointment
            var SchAppMonth = new ScheduleAppointment();

            SchAppMonth.Subject               = "Client Meeting";
            SchAppMonth.Notes                 = "Monthly Recurrence";
            SchAppMonth.Location              = "Chennai";
            SchAppMonth.StartTime             = currentdate;
            SchAppMonth.EndTime               = currentdate.AddHours(4);
            SchAppMonth.AppointmentBackground = new SolidColorBrush((Color.FromArgb(0xFF, 0x33, 0x99, 0x33)));

            //Setting RRule as per ICalc standard.
            SchAppMonth.RecurrenceRule = "FREQ=MONTHLY;COUNT=5;BYDAY=6;BYSETPOS=3";
            SchAppMonth.IsRecursive    = true;
            Appointments.Add(SchAppMonth);

            // Yearly Recursive Appointment
            var SchAppYear = new ScheduleAppointment();

            SchAppYear.Subject               = "Wedding Anniversary";
            SchAppYear.Notes                 = "Yearly Recurrence";
            SchAppYear.Location              = "Home";
            SchAppYear.StartTime             = currentdate.AddHours(9);
            SchAppYear.EndTime               = currentdate.AddHours(12);
            SchAppYear.AppointmentBackground = new SolidColorBrush((Color.FromArgb(0xFF, 0x00, 0xAB, 0xA9)));

            //Setting RRule as per ICalc standard.
            SchAppYear.RecurrenceRule = "FREQ=YEARLY;COUNT=3;BYMONTHDAY=" + (DateTime.Now.Day).ToString() + ";BYMONTH=" + (DateTime.Now.Month).ToString() + "";
            SchAppYear.IsRecursive    = true;
            Appointments.Add(SchAppYear);
            return(Appointments);
        }
Exemple #30
0
        public RecurrenceAppointment()
        {
            ApplicationLanguages.PrimaryLanguageOverride = "en-US";
            this.InitializeComponent();
            DateTime today = DateTime.Now;

            DateTime currentdate = today.AddDays(-7);
            ScheduleAppointmentCollection AppointmentCollection = new ScheduleAppointmentCollection();

            // Daily Recursive Appointment

            ScheduleAppointment SchApp = new ScheduleAppointment();

            SchApp.Subject               = "Team Meeting";
            SchApp.Notes                 = "Daily Recurrence";
            SchApp.Location              = "Meeting Hall 1";
            SchApp.StartTime             = currentdate;
            SchApp.EndTime               = currentdate.AddHours(4);
            SchApp.AppointmentBackground = new SolidColorBrush((Color.FromArgb(0xFF, 0xD8, 0x00, 0x73)));

            // Setting Recurrence Properties

            RecurrenceProperties RecurrenceProperty = new RecurrenceProperties();

            RecurrenceProperty.RecurrenceType    = RecurrenceType.Daily;
            RecurrenceProperty.IsDailyEveryNDays = false;
            //RecProp.DailyNDays = 2;
            RecurrenceProperty.IsRangeRecurrenceCount = true;
            RecurrenceProperty.IsRangeNoEndDate       = false;
            RecurrenceProperty.IsRangeEndDate         = false;
            RecurrenceProperty.RangeRecurrenceCount   = 100;

            // Generating RRule using ScheduleHelper

            SchApp.RecurrenceRule = ScheduleHelper.RRuleGenerator(RecurrenceProperty, SchApp.StartTime, SchApp.EndTime);
            SchApp.IsRecursive    = true;
            AppointmentCollection.Add(SchApp);

            Schedule.Appointments = AppointmentCollection;

            // Weekly Recursive Appointment

            ScheduleAppointment SchAppointmentWeek = new ScheduleAppointment();

            SchAppointmentWeek.Subject               = "Doctor Appointment";
            SchAppointmentWeek.Notes                 = "Weekly Recurrence";
            SchAppointmentWeek.Location              = "Global Hospital";
            SchAppointmentWeek.StartTime             = currentdate;
            SchAppointmentWeek.EndTime               = currentdate.AddHours(4);
            SchAppointmentWeek.AppointmentBackground = new SolidColorBrush((Color.FromArgb(0xFF, 0xA2, 0xC1, 0x39)));

            // Setting Recurrence Properties

            RecurrenceProperties RecurrencePropertyWeek = new RecurrenceProperties();

            RecurrencePropertyWeek.RecurrenceType         = RecurrenceType.Weekly;
            RecurrencePropertyWeek.WeeklyEveryNWeeks      = 1;
            RecurrencePropertyWeek.IsWeeklySunday         = true;
            RecurrencePropertyWeek.IsRangeRecurrenceCount = true;
            RecurrencePropertyWeek.IsRangeNoEndDate       = false;
            RecurrencePropertyWeek.IsRangeEndDate         = false;
            RecurrencePropertyWeek.RangeRecurrenceCount   = 20;

            // Generating RRule using ScheduleHelper

            SchAppointmentWeek.RecurrenceRule = ScheduleHelper.RRuleGenerator(RecurrencePropertyWeek, SchAppointmentWeek.StartTime, SchAppointmentWeek.EndTime);
            SchAppointmentWeek.IsRecursive    = true;
            AppointmentCollection.Add(SchAppointmentWeek);


            // Yearly Recursive Appointment

            ScheduleAppointment SchAppointmentYear = new ScheduleAppointment();

            SchAppointmentYear.Subject               = "Wedding Anniversary";
            SchAppointmentYear.Notes                 = "Yearly Recurrence";
            SchAppointmentYear.Location              = "Home";
            SchAppointmentYear.StartTime             = currentdate;
            SchAppointmentYear.EndTime               = currentdate.AddHours(4);
            SchAppointmentYear.AppointmentBackground = new SolidColorBrush((Color.FromArgb(0xFF, 0x00, 0xAB, 0xA9)));

            // Setting Recurrence Properties using RRule

            SchAppointmentYear.RecurrenceRule = "FREQ=YEARLY;COUNT=3;BYMONTHDAY=" + (DateTime.Now.Day).ToString() + ";BYMONTH=" + (DateTime.Now.Month).ToString() + "";
            SchAppointmentYear.IsRecursive    = true;
            AppointmentCollection.Add(SchAppointmentYear);
        }
Exemple #31
0
        //Creating appointments for ScheduleAppointmentCollection
        public void GetAppointments()
        {
            appointmentCollection = new ScheduleAppointmentCollection();

            //Recurrence Appointment 1
            ScheduleAppointment appointment1 = new ScheduleAppointment();
            Calendar            currentDate  = Calendar.Instance;
            Calendar            startTime    = (Calendar)currentDate.Clone();
            Calendar            endTime      = (Calendar)currentDate.Clone();

            startTime.Set(
                currentDate.Get(CalendarField.Year),
                currentDate.Get(CalendarField.Month),
                currentDate.Get(CalendarField.DayOfMonth),
                4,
                0,
                0);
            endTime.Set(
                currentDate.Get(CalendarField.Year),
                currentDate.Get(CalendarField.Month),
                currentDate.Get(CalendarField.DayOfMonth),
                6,
                0,
                0);
            appointment1.StartTime = startTime;
            appointment1.EndTime   = endTime;
            appointment1.Color     = Color.ParseColor("#FF1BA1E2");
            appointment1.Subject   = "Occurs once in every two days";
            RecurrenceProperties recurrenceProp1 = new RecurrenceProperties();

            recurrenceProp1.RecurrenceType  = RecurrenceType.Daily;
            recurrenceProp1.Interval        = 2;
            recurrenceProp1.RecurrenceRange = RecurrenceRange.Count;
            recurrenceProp1.RecurrenceCount = 10;
            appointment1.RecurrenceRule     = ScheduleHelper.RRuleGenerator(recurrenceProp1, appointment1.StartTime, appointment1.EndTime);
            appointmentCollection.Add(appointment1);

            //Recurrence Appointment 2
            ScheduleAppointment scheduleAppointment1 = new ScheduleAppointment();
            Calendar            currentDate1         = Calendar.Instance;
            Calendar            startTime1           = (Calendar)currentDate1.Clone();
            Calendar            endTime1             = (Calendar)currentDate1.Clone();

            startTime1.Set(
                currentDate.Get(CalendarField.Year),
                currentDate.Get(CalendarField.Month),
                currentDate.Get(CalendarField.DayOfMonth),
                10,
                0,
                0);
            endTime1.Set(
                currentDate.Get(CalendarField.Year),
                currentDate.Get(CalendarField.Month),
                currentDate.Get(CalendarField.DayOfMonth),
                12,
                0,
                0);

            scheduleAppointment1.StartTime = startTime1;
            scheduleAppointment1.EndTime   = endTime1;
            scheduleAppointment1.Color     = Color.ParseColor("#FFD80073");
            scheduleAppointment1.Subject   = "Occurs every Monday";
            RecurrenceProperties recurrenceProperties1 = new RecurrenceProperties();

            recurrenceProperties1.RecurrenceType  = RecurrenceType.Weekly;
            recurrenceProperties1.RecurrenceRange = RecurrenceRange.Count;
            recurrenceProperties1.Interval        = 1;
            recurrenceProperties1.WeekDays        = WeekDays.Monday;
            recurrenceProperties1.RecurrenceCount = 10;
            scheduleAppointment1.RecurrenceRule   = ScheduleHelper.RRuleGenerator(recurrenceProperties1, scheduleAppointment1.StartTime, scheduleAppointment1.EndTime);

            appointmentCollection.Add(scheduleAppointment1);
        }