Exemplo n.º 1
0
        private void InitAppointments(SchedulerStorage storage)
        {
            for (int i = 0; i < storage.Resources.Count; i++)
            {
                Resource    resource     = storage.Resources[i];
                string      subj         = resource.Caption + "'s ";
                Appointment appointment1 = storage.CreateAppointment(AppointmentType.Normal, DateTime.Today.AddHours(i + 10), DateTime.Today.AddHours(i + 11), subj + "birthday");
                appointment1.LabelKey   = 8;
                appointment1.StatusKey  = 3;
                appointment1.ResourceId = i;
                storage.Appointments.Add(appointment1);
                appointment1.CustomFields["Test"] = "Appointment text1_" + i;

                Appointment appointment2 = storage.CreateAppointment(AppointmentType.Normal, DateTime.Today.AddHours(i + 13), DateTime.Today.AddHours(i + 14), subj + "meeting");
                appointment2.LabelKey   = 2;
                appointment2.StatusKey  = 2;
                appointment2.ResourceId = i;
                storage.Appointments.Add(appointment2);
                appointment2.CustomFields["Test"] = "Appointment text2_" + i;

                Appointment appointment3 = storage.CreateAppointment(AppointmentType.Normal, DateTime.Today.AddHours(i + 15), DateTime.Today.AddHours(i + 16), subj + "phone call");
                appointment3.LabelKey   = 10;
                appointment3.StatusKey  = 0;
                appointment3.ResourceId = i;
                storage.Appointments.Add(appointment3);
                appointment3.CustomFields["Test"] = "Appointment text3_" + i;
            }
        }
        public void Import(IList <Event> events)
        {
            Dictionary <string, Appointment> patternHash    = new Dictionary <string, Appointment>();
            Dictionary <string, Event>       occurrenceHash = new Dictionary <string, Event>();

            Storage.Appointments.BeginUpdate();
            RecurrencePatternParser parser = new RecurrencePatternParser(storage);

            foreach (Event item in events)
            {
                Appointment appointment = null;
                if (item.RecurringEventId != null)  //occurrence?
                {
                    occurrenceHash.Add(item.Id, item);
                }
                else if (item.Recurrence != null)                                                                        //recurrence
                {
                    appointment = parser.Parse(item.Recurrence, ConvertDateTime(item.Start), ConvertDateTime(item.End)); //parse and create pattern
                    patternHash.Add(item.Id, appointment);
                }
                else     //normal appointment
                {
                    appointment = storage.CreateAppointment(AppointmentType.Normal);
                    AssingTimeIntervalPropertiesTo(appointment, item);
                }
                if (appointment == null)
                {
                    continue;
                }
                AssignCommonPropertiesTo(appointment, item);
                Storage.Appointments.Add(appointment);
            }
            LinkOccurrencesWithPatterns(occurrenceHash, patternHash);
            Storage.Appointments.EndUpdate();
        }
Exemplo n.º 3
0
        public static void GenerateSampleAppointments(SchedulerStorage storage)
        {
            AppointmentCollection appointments = storage.Appointments.Items;

            storage.BeginUpdate();
            try {
                for (int i = 0; i < ExampleUtils.Users.Length; i++)
                {
                    Appointment appointment = storage.CreateAppointment(AppointmentType.Normal);

                    appointment.Start       = baseTime.AddHours((i + 1) * 2);
                    appointment.Duration    = TimeSpan.FromHours(1);
                    appointment.Subject     = ExampleUtils.Users[i] + "'s Appointment";
                    appointment.Location    = "Office";
                    appointment.ResourceId  = i + 1;
                    appointment.HasReminder = true;
                    appointment.Reminder.TimeBeforeStart = TimeSpan.FromMinutes(10);

                    appointments.Add(appointment);
                }
            }
            finally {
                storage.EndUpdate();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool locked = false;

            schedulerDataSet = new DataSet();
            FillDataSet();
            MapAppointment(storage.Appointments.Mappings);
            MapResource(storage.Resources.Mappings);
            storage.Appointments.DataSource = schedulerDataSet.Tables["Appointments"];
            storage.Resources.DataSource    = schedulerDataSet.Tables["Resources"];
            if (Session["AppointmentsCreated"] != null)
            {
                locked = (bool)Session["AppointmentsCreated"];
            }
            if (!IsPostBack && !IsCallback && !locked)
            {
                for (int i = 0; i < 5; i++)
                {
                    Appointment apt      = storage.CreateAppointment(AppointmentType.Normal);
                    DateTime    baseTime = DateTime.Now;
                    apt.Start   = baseTime.AddMinutes(6);
                    apt.End     = baseTime.AddHours(2);
                    apt.Subject = "TestReminder " + i;
                    Reminder reminder = apt.CreateNewReminder();
                    reminder.AlertTime       = apt.Start;
                    reminder.TimeBeforeStart = new TimeSpan(0, 5, 0);
                    apt.Reminders.Add(reminder);
                    storage.Appointments.Add(apt);
                    appointmentsAdapter.Update(schedulerDataSet, "Appointments");
                    Session["AppointmentsCreated"] = true;
                }
            }
        }
Exemplo n.º 5
0
        private static Appointment CreateEvent(SchedulerStorage storage, string subject, object resourceId, int status, int label)
        {
            Appointment apt = storage.CreateAppointment(AppointmentType.Normal);

            apt.Subject    = subject;
            apt.ResourceId = resourceId;
            apt.Start      = DateTime.Today.AddHours(9).AddMinutes(30);
            apt.End        = apt.Start.AddHours(2);
            apt.StatusId   = status;
            apt.LabelId    = label;
            return(apt);
        }
        private void CreateAppointmentWithCustomStatus()
        {
            SchedulerStorage schedulerStorage = schedulerControl1.Storage;
            Appointment      apt      = schedulerStorage.CreateAppointment(AppointmentType.Normal);
            DateTime         baseTime = schedulerControl1.Start;

            apt.Start       = baseTime.AddHours(1);
            apt.End         = baseTime.AddHours(2);
            apt.Subject     = "Test";
            apt.Location    = "Office";
            apt.Description = "Test procedure";
            apt.StatusKey   = 40; // Custom status

            schedulerStorage.Appointments.Add(apt);
        }
        public static Appointment AptCreate(SchedulerStorage storage, object resourceId, string subject, int status, int label)
        {
            Appointment apt = storage.CreateAppointment(AppointmentType.Normal);

            apt.Subject    = subject;
            apt.ResourceId = resourceId;
            Random rnd          = RandomInstance;
            int    rangeInHours = 48;

            apt.Start     = DateTime.Today + TimeSpan.FromHours(rnd.Next(0, rangeInHours));
            apt.End       = apt.Start + TimeSpan.FromHours(rnd.Next(0, rangeInHours / 8));
            apt.StatusKey = status;
            apt.LabelKey  = label;
            return(apt);
        }
        private static Appointment CreateEvent(string subject, object resourceId, int status, int label, SchedulerStorage storage)
        {
            Appointment apt = storage.CreateAppointment(AppointmentType.Normal);

            apt.Subject    = subject;
            apt.ResourceId = resourceId;

            Random rnd            = new Random();
            int    rangeInMinutes = 60 * 24;

            apt.Start     = DateTime.Today + TimeSpan.FromMinutes(rnd.Next(0, rangeInMinutes));
            apt.End       = apt.Start + TimeSpan.FromMinutes(rnd.Next(0, rangeInMinutes / 4));
            apt.StatusKey = status;
            apt.LabelKey  = label;
            return(apt);
        }
        private void GenerateAppointment()
        {
            SchedulerStorage schedulerStorage = schedulerControl1.Storage;
            Appointment      apt      = schedulerStorage.CreateAppointment(AppointmentType.Normal);
            DateTime         baseTime = DateTime.Today;

            apt.Start       = baseTime.AddHours(0.5);
            apt.End         = baseTime.AddHours(2);
            apt.Subject     = "Test";
            apt.Location    = "Office";
            apt.Description = "Test procedure";
            apt.ResourceId  = 0;

            schedulerStorage.Appointments.Add(apt);

            schedulerControl1.Start = baseTime;
        }
        public static void AddRecurrentAppointment(AppointmentCollection eventList, SchedulerStorage storage)
        {
            Appointment aptPattern = storage.CreateAppointment(AppointmentType.Pattern);

            aptPattern.Subject = "Pattern";

            aptPattern.RecurrenceInfo.Type            = RecurrenceType.Hourly;
            aptPattern.RecurrenceInfo.Periodicity     = 4;
            aptPattern.RecurrenceInfo.Duration        = new TimeSpan(0, 30, 0);
            aptPattern.RecurrenceInfo.Range           = RecurrenceRange.OccurrenceCount;
            aptPattern.RecurrenceInfo.OccurrenceCount = 10;
            aptPattern.RecurrenceInfo.Start           = DateTime.Now.AddDays(2);
            aptPattern.StatusKey  = 2;
            aptPattern.ResourceId = 1;

            eventList.Add(aptPattern);
        }
        private void SetupSampleAppointment()
        {
            SchedulerStorage schedulerStorage = schedulerControl1.Storage;
            Appointment      apt      = schedulerStorage.CreateAppointment(AppointmentType.Normal);
            DateTime         baseTime = DateTime.Today;

            apt.Start                   = baseTime.AddHours(1);
            apt.End                     = baseTime.AddHours(2);
            apt.Subject                 = "Test";
            apt.Location                = "Office";
            apt.Description             = "Test procedure";
            apt.CustomFields["cfPrice"] = 10;

            schedulerStorage.Appointments.Add(apt);

            schedulerControl1.Start = baseTime;
        }
Exemplo n.º 12
0
        private static Appointment CreateRecurrentEvent(SchedulerStorage storage, string subject, object resourceId, int status, int label)
        {
            Appointment apt = storage.CreateAppointment(AppointmentType.Pattern);

            apt.Subject    = subject;
            apt.ResourceId = resourceId;
            apt.Start      = DateTime.Today.AddHours(9).AddMinutes(30);
            apt.End        = apt.Start.AddHours(2);
            apt.StatusId   = status;
            apt.LabelId    = label;

            apt.RecurrenceInfo.Type        = RecurrenceType.Daily;
            apt.RecurrenceInfo.Start       = apt.Start;
            apt.RecurrenceInfo.Periodicity = 5;
            apt.RecurrenceInfo.Range       = RecurrenceRange.EndByDate;
            apt.RecurrenceInfo.End         = apt.RecurrenceInfo.Start.AddMonths(1);
            return(apt);
        }
Exemplo n.º 13
0
        public MainWindow()
        {
            InitializeComponent();

            SchedulerStorage schedulerStorage = schedulerControl1.Storage;

            schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(new SchedulerCustomFieldMapping("cfPrice", "Price"));
            Appointment apt = schedulerStorage.CreateAppointment(AppointmentType.Normal);

            apt.CustomFields["cfPrice"] = 10;
            apt.Start   = DateTime.Today.AddHours(1);
            apt.End     = DateTime.Today.AddHours(2);
            apt.Subject = "Test";
            schedulerStorage.AppointmentStorage.Add(apt);

            schedulerControl1.Start = DateTime.Today;
            schedulerControl1.DayView.TopRowTime = TimeSpan.Zero;
        }
Exemplo n.º 14
0
        public MainWindow()
        {
            InitializeComponent();

            SchedulerStorage schedulerStorage = schedulerControl1.Storage;
            Appointment      apt      = schedulerStorage.CreateAppointment(AppointmentType.Normal);
            DateTime         baseTime = DateTime.Today;

            apt.Start       = baseTime.AddHours(1);
            apt.End         = baseTime.AddHours(2);
            apt.Subject     = "Test";
            apt.Location    = "Office";
            apt.Description = "Test procedure";

            schedulerStorage.AppointmentStorage.Add(apt);

            schedulerControl1.Start = baseTime.Date;
        }
        public MainWindow()
        {
            InitializeComponent();

            SchedulerStorage schedulerStorage = schedulerControl1.Storage;
            Appointment      apt      = schedulerStorage.CreateAppointment(AppointmentType.Normal);
            DateTime         baseTime = DateTime.Today;

            apt.Start       = baseTime.AddHours(1);
            apt.End         = baseTime.AddHours(3.5);
            apt.Subject     = "Appointment Subject";
            apt.Location    = "Appointment Location";
            apt.Description = "Appointment description";

            schedulerStorage.AppointmentStorage.Add(apt);

            schedulerControl1.Start = apt.Start.Date;
            schedulerControl1.ActiveView.SelectAppointment(apt);
        }
Exemplo n.º 16
0
        Appointment CreateMeeting(string subject, DateTime date, int[] participants)
        {
            SchedulerStorage schedulerStorage = scheduler.Storage;
            Appointment      apt = schedulerStorage.CreateAppointment(AppointmentType.Normal);

            apt.Start    = date;
            apt.Duration = TimeSpan.FromHours(1);
            apt.Subject  = subject;

            string description = AttendeeDescription;
            int    count       = participants.Length;

            for (int i = 0; i < count; i++)
            {
                Resource resource = schedulerStorage.ResourceStorage[participants[i]];
                description += String.Format("{0}\r\n", resource.Caption);
                apt.ResourceIds.Add(resource.Id);
            }
            apt.Description = description;
            return(apt);
        }
        private static Appointment AddSharedResources(string subject, int status, int label, ResourceCollection collection, SchedulerStorage storage)
        {
            Appointment apt = storage.CreateAppointment(AppointmentType.Normal);

            apt.Subject = subject;
            for (int i = 0; i < collection.Count; i++)
            {
                object resourceId = ((Resource)collection[i]).Id;
                apt.ResourceIds.Add(resourceId);
            }


            Random rnd            = new Random();
            int    rangeInMinutes = 60 * 24;

            apt.Start     = DateTime.Today.AddDays(1) + TimeSpan.FromMinutes(rnd.Next(0, rangeInMinutes));
            apt.End       = apt.Start + TimeSpan.FromMinutes(rnd.Next(0, rangeInMinutes / 4));
            apt.StatusKey = status;
            apt.LabelKey  = label;
            return(apt);
        }