コード例 #1
0
 private void Save()
 {
     try
     {
         schedule = new BIZ.RaceSchedule();
         GetControlValue();
         PopulateBussinessLayer(Common.Common.Schedule.Schedule);
         if (ScheduleName.Split(' ').Length > 1)
         {
             if (schedule.Save())
             {
                 ClearControl();
                 ScheduleSelectAll();
             }
         }
         else
         {
             MessageBox.Show("Invalid Schedule Name Value, Please indicate Race Season and Year", "Error");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(Common.Common.CustomError(ex.Message), "Error");
     }
 }
コード例 #2
0
 public override void Validate()
 {
     base.Validate();
     ScheduleId.HasValue("时间节点编码不能为空").MaxLength(50, "时间节点编码限制长度50");
     ScheduleName.HasValue("时间节点不能为空").MaxLength(50, "时间节点限制长度50");
     ProjectId.HasValue("项目编码不能为空").MaxLength(50, "项目编码限制长度50");
     Summary.HasValue("问题摘要不能为空").MaxLength(50, "问题摘要限制长度200");
     //Detail.HasValue("问题详情不能为空").MaxLength(50, "问题详情限制长度200");
     CreateName.HasValue("创建人不能为空").MaxLength(50, "创建人限制长度50");
     PrincipalId.HasValue("负责人编码不能为空").MaxLength(50, "负责人编码限制长度50");
     PrincipalName.HasValue("负责人不能为空").MaxLength(50, "负责人限制长度50");
 }
コード例 #3
0
 private void InitialiseControl()
 {
     try
     {
         this.txtScheduleID.Text   = ScheduleID.ToString();
         this.txtScheduleName.Text = ScheduleName.ToString();
         ScheduleCategorySelectAll();
         this.dataGridView1.Columns[0].Visible = false;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #4
0
 private void InitialiseControl()
 {
     try
     {
         this.txtScheduleID.Text   = ScheduleID.ToString();
         this.txtScheduleName.Text = ScheduleName.ToString();
         ScheduleDetailsSelectAll();
         this.dataGridView1.Columns[0].Visible  = false;
         this.dataGridView1.Columns[1].Visible  = false;
         this.dataGridView1.Columns[5].Visible  = false; //Loading
         this.dataGridView1.Columns[6].Visible  = false; //LoadingTimeFrom
         this.dataGridView1.Columns[9].Visible  = false; //RaceReleasePointID
         this.dataGridView1.Columns[13].Visible = false; //Description
         this.dataGridView1.Columns[14].Visible = false; //IsStop
         this.dataGridView1.Columns[15].Visible = false; //StopFromDate
         this.dataGridView1.Columns[16].Visible = false; //StopFromTime
         this.dataGridView1.Columns[17].Visible = false; //StopToDate
         this.dataGridView1.Columns[18].Visible = false; //StopToTime
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #5
0
        private void NewSchedule_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            var scheduleDialog = new ScheduleName {
                Owner = this
            };

            scheduleDialog.ShowDialog();

            if (!string.IsNullOrEmpty(scheduleDialog.Name))
            {
                if (_viewModel.LastOpenedSchedule != null)
                {
                    _viewModel.LastOpenedSchedule.LastOpened = false;
                    _viewModel.UpdateCurrentSchedule();
                }

                _viewModel.LastOpenedSchedule = new Schedule
                {
                    Id         = scheduleDialog.Name,
                    LastOpened = true
                };
                //_viewModel.ScheduleAppointments = Schedule.Appointments;
                _viewModel.SaveCurrentSchedule();
                _viewModel.InitRemainigSessions();

                // in case this is the first time running
                ScheduleView.Visibility   = Visibility.Visible;
                ClassromsPanel.Visibility = Visibility.Visible;
                ScheduleLabel.Visibility  = Visibility.Hidden;
                GlobalButton.IsEnabled    = true;

                Schedule.Appointments.Clear(); // reset schedule

                Title = $"{scheduleDialog.Name} - {_appTitle}";
            }
        }
コード例 #6
0
        public void DoDemo()
        {
            Task.Factory.StartNew(() =>
            {
                if (DemoStopped())
                {
                    return;
                }
                switch (_nextDemoState)
                {
                case Constants.ApplicationState.ScheduleAdd:
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        DrawerHost.IsLeftDrawerOpen = false;
                        var dialog = new ScheduleName {
                            Owner = this
                        };
                        DemoStateHandler.Instance.DemoState = dialog;
                        dialog.ShowDialog();

                        if (!string.IsNullOrEmpty(dialog.Name))
                        {
                            if (_viewModel.LastOpenedSchedule != null)
                            {
                                _viewModel.UpdateCurrentSchedule();
                            }

                            _viewModel.LastOpenedSchedule = new Schedule
                            {
                                Id = dialog.Name,
                            };

                            _viewModel.SaveCurrentSchedule();
                            _viewModel.InitRemainigSessions();

                            // in case this is the first time running
                            ScheduleView.Visibility   = Visibility.Visible;
                            ClassromsPanel.Visibility = Visibility.Visible;
                            ScheduleLabel.Visibility  = Visibility.Hidden;
                            GlobalButton.IsEnabled    = true;

                            Schedule.Appointments.Clear();

                            Title = $"{dialog.Name} - {_appTitle}";
                        }

                        _nextDemoState = Constants.ApplicationState.Courses;
                        DrawerHost.IsLeftDrawerOpen = true;
                    });
                    DemoStopped();
                    break;

                case Constants.ApplicationState.Courses:
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        var dialog = new CourseList(_viewModel);
                        DemoStateHandler.Instance.DemoState = dialog;
                        dialog.ShowDialog();
                        _nextDemoState = Constants.ApplicationState.Softwares;
                    });
                    DemoStopped();
                    break;

                case Constants.ApplicationState.Softwares:
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        var dialog = new SoftwareList(_viewModel);
                        DemoStateHandler.Instance.DemoState = dialog;
                        dialog.ShowDialog();
                        _nextDemoState = Constants.ApplicationState.Subjects;
                    });
                    DemoStopped();
                    break;

                case Constants.ApplicationState.Subjects:
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        var dialog = new SubjectList(_viewModel);
                        DemoStateHandler.Instance.DemoState = dialog;
                        dialog.ShowDialog();
                        _nextDemoState = Constants.ApplicationState.Classrooms;
                    });
                    DemoStopped();
                    break;

                case Constants.ApplicationState.Classrooms:
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        var dialog = new ClassroomList(_viewModel);
                        DemoStateHandler.Instance.DemoState = dialog;
                        dialog.ShowDialog();
                        _nextDemoState = Constants.ApplicationState.SessionDetails;
                        DrawerHost.IsLeftDrawerOpen = false;
                    });
                    DemoStopped();
                    break;

                case Constants.ApplicationState.SessionDetails:
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        _viewModel.Classroom = _viewModel.Classrooms[0];
                        var startTime        = DateTime.Now.StartOfWeek().Date + new TimeSpan(7, 15, 0);
                        var session          = _viewModel.RemainingSessions[0];
                        var avaibleTerms     = _viewModel.GetAvailableTerms(null, startTime, session);
                        var dialog           = new SessionDetails(_viewModel, Schedule.Appointments, avaibleTerms, startTime,
                                                                  session);
                        DemoStateHandler.Instance.DemoState = dialog;
                        dialog.ShowDialog();
                        _nextDemoState = Constants.ApplicationState.ScheduleAdd;
                    });
                    if (DemoStopped())
                    {
                        return;
                    }
                    //if (DemoStopped()) return;
                    Application.Current.Dispatcher.Invoke(
                        () => { _viewModel.RemoveClassroom(DemoStateHandler.Instance.DemoClassroomId); });
                    DemoStateHandler.Instance.RemoveDemoEntities();
                    _viewModel.LastOpenedSchedule = null;
                    break;
                }
            });
        }