Exemple #1
0
        private void GetSourceObjectCommandExecute(object parameter)
        {
            DevExpress.Xpf.Scheduler.SchedulerStorage storage = (DevExpress.Xpf.Scheduler.SchedulerStorage)parameter;

            if (storage.AppointmentStorage.Count > 0)
            {
                ModelAppointment apt = (ModelAppointment)storage.AppointmentStorage[0].GetSourceObject(storage.GetCoreStorage());
                // Alternative: ModelAppointment apt = (ModelAppointment)storage.GetObjectRow(storage.AppointmentStorage[0]);
                MessageBox.Show("First Appointment Price: " + apt.Price.ToString());
            }
        }
 void SelectedAppointments_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     SelectedModelAppointments.CollectionChanged -= SelectedModelAppointment_CollectionChanged;
     SelectGridRows();
     if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
     {
         CurrentModelAppointment = (e.NewItems[0] as Appointment).GetSourceObject(Scheduler.Storage.GetCoreStorage()) as ModelAppointment;
         RaisePropertyChanged("CurrentModelAppointment");
     }
     SelectedModelAppointments.CollectionChanged += SelectedModelAppointment_CollectionChanged;
 }
Exemple #3
0
        private void AddTestData()
        {
            ModelResource res1 = new ModelResource()
            {
                Id    = 0,
                Name  = "Computer1",
                Color = ToRgb(System.Drawing.Color.Yellow)
            };

            ModelResource res2 = new ModelResource()
            {
                Id    = 1,
                Name  = "Computer2",
                Color = ToRgb(System.Drawing.Color.Green)
            };

            ModelResource res3 = new ModelResource()
            {
                Id    = 2,
                Name  = "Computer3",
                Color = ToRgb(System.Drawing.Color.Blue)
            };

            Resources.Add(res1);
            Resources.Add(res2);
            Resources.Add(res3);

            DateTime baseTime = DateTime.Today;

            ModelAppointment apt1 = new ModelAppointment()
            {
                StartTime   = baseTime.AddHours(1),
                EndTime     = baseTime.AddHours(2),
                Subject     = "Test",
                Location    = "Office",
                Description = "Test procedure",
                Price       = 10m
            };

            ModelAppointment apt2 = new ModelAppointment()
            {
                StartTime   = baseTime.AddHours(2),
                EndTime     = baseTime.AddHours(3),
                Subject     = "Test2",
                Location    = "Office",
                Description = "Test procedure",
                ResourceId  = "<ResourceIds>\r\n<ResourceId Type=\"System.Int32\" Value=\"0\" />\r\n<ResourceId Type=\"System.Int32\" Value=\"1\" />\r\n</ResourceIds>"
            };

            Appointments.Add(apt1);
            Appointments.Add(apt2);
        }
        private ModelAppointment CreateEvent(string subject, object resourceId, int status, int label)
        {
            ModelAppointment apt = new ModelAppointment();

            apt.Subject    = subject;
            apt.ResourceId = resourceId;
            Random rnd            = new Random();;
            int    rangeInMinutes = 60 * 24;

            apt.StartTime = DateTime.Today + TimeSpan.FromMinutes(rnd.Next(0, rangeInMinutes));
            apt.EndTime   = apt.StartTime + TimeSpan.FromMinutes(rnd.Next(0, rangeInMinutes / 4));
            apt.Status    = status;
            apt.Label     = label;
            return(apt);
        }
Exemple #5
0
        private void AddNewAppointmentCommandExecute(object parameter)
        {
            DateTime baseTime = DateTime.Today;

            ModelAppointment apt = new ModelAppointment()
            {
                StartTime   = baseTime.AddHours(3),
                EndTime     = baseTime.AddHours(4),
                Subject     = "Test3",
                Location    = "Office",
                Description = "Test procedure",
                Price       = 20m
            };

            Appointments.Add(apt);
        }
        public static void AddTestData(ObservableCollection <ModelResource> resources, ObservableCollection <ModelAppointment> appointments)
        {
            ModelResource res1 = new ModelResource()
            {
                Id    = 0,
                Name  = "Computer1",
                Color = ToRgb(System.Drawing.Color.Yellow)
            };

            ModelResource res2 = new ModelResource()
            {
                Id    = 1,
                Name  = "Computer2",
                Color = ToRgb(System.Drawing.Color.Green)
            };

            ModelResource res3 = new ModelResource()
            {
                Id    = 2,
                Name  = "Computer3",
                Color = ToRgb(System.Drawing.Color.Blue)
            };

            resources.Add(res1);
            resources.Add(res2);
            resources.Add(res3);

            DateTime baseTime = DateTime.Now;

            ModelAppointment apt1 = new ModelAppointment()
            {
                Id          = Guid.NewGuid(),
                StartTime   = baseTime.AddHours(-2),
                EndTime     = baseTime.AddHours(-1),
                Subject     = "Test 1",
                Location    = "Office",
                Description = "Test procedure 1",
                Price       = 10m,
                ResourceId  = 0
            };

            ModelAppointment apt2 = new ModelAppointment()
            {
                Id          = Guid.NewGuid(),
                StartTime   = baseTime,
                EndTime     = baseTime.AddHours(2),
                Subject     = "Test 2",
                Location    = "Office",
                Description = "Test procedure 2",
                ResourceId  = 1
            };

            ModelAppointment apt3 = new ModelAppointment()
            {
                Id          = Guid.NewGuid(),
                StartTime   = baseTime.AddHours(-1),
                EndTime     = baseTime.AddHours(1),
                Subject     = "Test 3",
                Location    = "Office",
                Description = "Test procedure 3",
                ResourceId  = 2
            };

            appointments.Add(apt1);
            appointments.Add(apt2);
            appointments.Add(apt3);
        }