Exemplo n.º 1
0
        private async void btnCopySchedule_Click(object sender, RoutedEventArgs e)
        {
            if (classSchedule.SelectedAppointment != null)
            {
                ScheduleAppointment appointment       = classSchedule.SelectedAppointment as ScheduleAppointment;
                EditScheduleWindow  newScheduleWindow = new EditScheduleWindow();
                newScheduleWindow.Om       = OperationMode.CopyMode;
                newScheduleWindow.Schedule = appointment;

                if (newScheduleWindow.ShowDialog() == true)
                {
                    ScheduleAppointment sa         = new ScheduleAppointment();
                    ScheduleEditModel   affterEdit = newScheduleWindow.AffterEditSchedule;
                    RadScheduleViewCommands.BeginEditAppointment.Execute(sa, null);
                    sa.ScheduleId = affterEdit.ScheduleId;
                    sa.Start      = affterEdit.StartTime;
                    sa.End        = affterEdit.EndTime;
                    if (affterEdit.StatusDes == "Normal")
                    {
                        sa.Category = new Category("Green Category", new SolidColorBrush(Colors.Green));
                    }
                    else
                    {
                        sa.Category = new Category("Red Category", new SolidColorBrush(Colors.Red));
                    }

                    RadScheduleViewCommands.CommitEditAppointment.Execute(sa, null);
                }

                await bindSchedule();
            }
        }
Exemplo n.º 2
0
        private async void btnSetSchedule_Click(object sender, RoutedEventArgs e)
        {
            if (classSchedule.SelectedAppointment != null)
            {
                ScheduleAppointment appointment       = classSchedule.SelectedAppointment as ScheduleAppointment;
                EditScheduleWindow  newScheduleWindow = new EditScheduleWindow();
                if (appointment.ScheduleId == 0)
                {
                    newScheduleWindow.Om       = OperationMode.AddMode;
                    newScheduleWindow.Schedule = appointment;

                    if (newScheduleWindow.ShowDialog() == true)
                    {
                        ScheduleEditModel affterEdit = newScheduleWindow.AffterEditSchedule;
                        RadScheduleViewCommands.BeginEditAppointment.Execute(appointment, null);
                        appointment.ScheduleId = affterEdit.ScheduleId;
                        appointment.Start      = affterEdit.StartTime;
                        appointment.End        = affterEdit.EndTime;
                        if (affterEdit.StatusDes == "Normal")
                        {
                            appointment.Category = new Category("Green Category", new SolidColorBrush(Colors.Green));
                        }
                        else
                        {
                            appointment.Category = new Category("Red Category", new SolidColorBrush(Colors.Red));
                        }

                        RadScheduleViewCommands.CommitEditAppointment.Execute(appointment, null);

                        await bindSchedule();
                    }
                }
                else
                {
                    newScheduleWindow.Om       = OperationMode.EditMode;
                    newScheduleWindow.Schedule = appointment;

                    if (newScheduleWindow.ShowDialog() == true)
                    {
                        ScheduleEditModel affterEdit = newScheduleWindow.AffterEditSchedule;
                        RadScheduleViewCommands.BeginEditAppointment.Execute(appointment, null);

                        appointment.End           = affterEdit.EndTime;
                        appointment.ScheduleId    = affterEdit.ScheduleId;
                        appointment.Start         = affterEdit.StartTime;
                        appointment.Subject       = affterEdit.ClassName;
                        appointment.TeacherName   = affterEdit.TeacherName;
                        appointment.AssistantName = affterEdit.AssistantName;
                        appointment.ClassroomName = affterEdit.ClassroomName;
                        if (affterEdit.StatusDes == "Normal")
                        {
                            appointment.Category = new Category("Green Category", new SolidColorBrush(Colors.Green));
                        }
                        else
                        {
                            appointment.Category = new Category("Red Category", new SolidColorBrush(Colors.Red));
                        }

                        RadScheduleViewCommands.CommitEditAppointment.Execute(appointment, null);

                        await bindSchedule();
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void SetSchedule(object parameter)
        {
            IEnumerable appointments = parameter as IEnumerable;

            if (appointments != null)
            {
                foreach (ScheduleAppointment appointment in appointments.OfType <ScheduleAppointment>())
                {
                    EditScheduleWindow newScheduleWindow = new EditScheduleWindow();
                    if (appointment.ScheduleId == 0)
                    {
                        newScheduleWindow.Om       = OperationMode.AddMode;
                        newScheduleWindow.Schedule = appointment;

                        if (newScheduleWindow.ShowDialog() == true)
                        {
                            ScheduleEditModel affterEdit = newScheduleWindow.AffterEditSchedule;
                            RadScheduleViewCommands.BeginEditAppointment.Execute(appointment, null);
                            appointment.ScheduleId = affterEdit.ScheduleId;
                            appointment.Start      = affterEdit.StartTime;
                            appointment.End        = affterEdit.EndTime;
                            if (affterEdit.StatusDes == "Normal")
                            {
                                appointment.Category = new Category("Green Category", new SolidColorBrush(Colors.Green));
                            }
                            else
                            {
                                appointment.Category = new Category("Red Category", new SolidColorBrush(Colors.Red));
                            }

                            RadScheduleViewCommands.CommitEditAppointment.Execute(appointment, null);
                        }
                    }
                    else
                    {
                        newScheduleWindow.Om       = OperationMode.EditMode;
                        newScheduleWindow.Schedule = appointment;

                        if (newScheduleWindow.ShowDialog() == true)
                        {
                            ScheduleEditModel affterEdit = newScheduleWindow.AffterEditSchedule;
                            RadScheduleViewCommands.BeginEditAppointment.Execute(appointment, null);

                            appointment.End           = affterEdit.EndTime;
                            appointment.ScheduleId    = affterEdit.ScheduleId;
                            appointment.Start         = affterEdit.StartTime;
                            appointment.Subject       = affterEdit.ClassName;
                            appointment.TeacherName   = affterEdit.TeacherName;
                            appointment.AssistantName = affterEdit.AssistantName;
                            appointment.ClassroomName = affterEdit.ClassroomName;
                            if (affterEdit.StatusDes == "Normal")
                            {
                                appointment.Category = new Category("Green Category", new SolidColorBrush(Colors.Green));
                            }
                            else
                            {
                                appointment.Category = new Category("Red Category", new SolidColorBrush(Colors.Red));
                            }

                            RadScheduleViewCommands.CommitEditAppointment.Execute(appointment, null);
                        }
                    }
                }
            }
        }