|
@@ -204,7 +204,6 @@ namespace PRSDesktop
|
|
|
settings.CalendarView = CalendarViewType.Day;
|
|
|
settings.BackgroundType = CalendarBackgroundType.Automatic;
|
|
|
settings.TimeInterval = CalendarTimeInterval.FifteenMinutes;
|
|
|
- settings.Zoom = 40.0F;
|
|
|
settings.EmployeeSelection = new EmployeeSelectorData(new Guid[] { Guid.Empty }, new Guid[] { Employee.ID });
|
|
|
settings.Zoom = _settings.Zoom;
|
|
|
return settings;
|
|
@@ -231,64 +230,74 @@ namespace PRSDesktop
|
|
|
|
|
|
public void Setup()
|
|
|
{
|
|
|
- Parallel.ForEach(
|
|
|
- new Action[]
|
|
|
- {
|
|
|
- () => _settings = new UserConfiguration<DailyActivityScreenSettings>().Load(),
|
|
|
- () => Employee = new Client<Employee>().Load(new Filter<Employee>(x => x.UserLink.ID).IsEqualTo(ClientFactory.UserGuid)).FirstOrDefault(),
|
|
|
- },
|
|
|
- (a => a())
|
|
|
- );
|
|
|
-
|
|
|
- Calendar.Setup();
|
|
|
-
|
|
|
- LoadRequiredReports();
|
|
|
-
|
|
|
- if (!RequiredReports.Any())
|
|
|
+ Calendar.DisableUpdate();
|
|
|
+ try
|
|
|
{
|
|
|
- var start = TimeSpan.FromHours(6);
|
|
|
- var finish = TimeSpan.FromHours(18);
|
|
|
- var blocks = Calendar.GetRoster(Employee.ID, DateTime.Today)?.GetBlocks(DateTime.Today, TimeSpan.FromSeconds(0), TimeSpan.FromDays(1));
|
|
|
- if (blocks?.Any() == true)
|
|
|
+
|
|
|
+
|
|
|
+ Parallel.ForEach(
|
|
|
+ new Action[]
|
|
|
+ {
|
|
|
+ () => _settings = new UserConfiguration<DailyActivityScreenSettings>().Load(),
|
|
|
+ () => Employee = new Client<Employee>().Load(new Filter<Employee>(x => x.UserLink.ID).IsEqualTo(ClientFactory.UserGuid)).FirstOrDefault(),
|
|
|
+ },
|
|
|
+ (a => a())
|
|
|
+ );
|
|
|
+
|
|
|
+ Calendar.Setup();
|
|
|
+
|
|
|
+ LoadRequiredReports();
|
|
|
+
|
|
|
+ if (!RequiredReports.Any())
|
|
|
{
|
|
|
- start = blocks.Aggregate(TimeSpan.FromDays(1), (time, block) => time.Ticks < block.Start.Ticks ? time : block.Start);
|
|
|
- finish = blocks.Aggregate(TimeSpan.Zero, (time, block) => time.Ticks > block.Finish.Ticks ? time : block.Start);
|
|
|
+ var start = TimeSpan.FromHours(6);
|
|
|
+ var finish = TimeSpan.FromHours(18);
|
|
|
+ var blocks = Calendar.GetRoster(Employee.ID, DateTime.Today)?.GetBlocks(DateTime.Today, TimeSpan.FromSeconds(0), TimeSpan.FromDays(1));
|
|
|
+ if (blocks?.Any() == true)
|
|
|
+ {
|
|
|
+ start = blocks.Aggregate(TimeSpan.FromDays(1), (time, block) => time.Ticks < block.Start.Ticks ? time : block.Start);
|
|
|
+ finish = blocks.Aggregate(TimeSpan.Zero, (time, block) => time.Ticks > block.Finish.Ticks ? time : block.Start);
|
|
|
+ }
|
|
|
+ RequiredReports.Add(new RequiredReport(Guid.Empty, DateTime.Today, start, finish, ""));
|
|
|
+ ConfirmDock.Visibility = Visibility.Collapsed;
|
|
|
}
|
|
|
- RequiredReports.Add(new RequiredReport(Guid.Empty, DateTime.Today, start, finish, ""));
|
|
|
- ConfirmDock.Visibility = Visibility.Collapsed;
|
|
|
- }
|
|
|
|
|
|
- ConfigureEditor(Title, new TextBoxEditor());
|
|
|
- ConfigureEditor(ActivityNotes, new MemoEditor());
|
|
|
- ConfigureEditor(Start, new TimeOfDayEditor());
|
|
|
- ConfigureEditor(Duration, new TimeOfDayEditor());
|
|
|
- ConfigureEditor(Finish, new TimeOfDayEditor());
|
|
|
- ConfigureEditor(Notes, new MemoEditor());
|
|
|
-
|
|
|
- Activity.EditorDefinition = DatabaseSchema.Property(typeof(Assignment), CoreUtils.GetFullPropertyName<Assignment,Guid>(c=>c.ActivityLink.ID,".")).Editor;
|
|
|
- Activity.OtherColumns["Color"] = CoreUtils.GetFullPropertyName<Assignment,String>(c=>c.ActivityLink.Color,".");
|
|
|
- Activity.OtherColumns["Description"] = CoreUtils.GetFullPropertyName<Assignment,String>(c=>c.ActivityLink.Description,".");
|
|
|
- ConfigureEditor(Activity);
|
|
|
-
|
|
|
- ITP.EditorDefinition = DatabaseSchema.Property(typeof(Assignment), "ITP.ID").Editor;
|
|
|
- ITP.OtherColumns["Code"] = "ITP.Code";
|
|
|
- //ConfigureEditor(ITP);
|
|
|
-
|
|
|
- Kanban.EditorDefinition = DatabaseSchema.Property(typeof(Assignment), "Task.ID").Editor;
|
|
|
- Kanban.OtherColumns["JobLink.ID"] = "JobLink.ID";
|
|
|
- Kanban.OtherColumns["JobLink.JobNumber"] = "JobLink.JobNumber";
|
|
|
- Kanban.OtherColumns["JobLink.Name"] = "JobLink.Name";
|
|
|
- ConfigureEditor(Kanban);
|
|
|
-
|
|
|
- Job.EditorDefinition = DatabaseSchema.Property(typeof(Assignment), "JobLink.ID").Editor;
|
|
|
- Job.OtherColumns["JobNumber"] = "JobLink.JobNumber";
|
|
|
- Job.OtherColumns["Name"] = "JobLink.Name";
|
|
|
- Job.OnDefineFilter += (sender, type) => { return LookupFactory.DefineFilter<Assignment, Job>(new[] { SelectedAssignment }); };
|
|
|
- ConfigureEditor(Job);
|
|
|
-
|
|
|
- GotoCurrentRequiredReport();
|
|
|
-
|
|
|
- LoadKanbans("Open");
|
|
|
+ ConfigureEditor(Title, new TextBoxEditor());
|
|
|
+ ConfigureEditor(ActivityNotes, new MemoEditor());
|
|
|
+ ConfigureEditor(Start, new TimeOfDayEditor());
|
|
|
+ ConfigureEditor(Duration, new TimeOfDayEditor());
|
|
|
+ ConfigureEditor(Finish, new TimeOfDayEditor());
|
|
|
+ ConfigureEditor(Notes, new MemoEditor());
|
|
|
+
|
|
|
+ Activity.EditorDefinition = DatabaseSchema.Property(typeof(Assignment), CoreUtils.GetFullPropertyName<Assignment,Guid>(c=>c.ActivityLink.ID,".")).Editor;
|
|
|
+ Activity.OtherColumns["Color"] = CoreUtils.GetFullPropertyName<Assignment,String>(c=>c.ActivityLink.Color,".");
|
|
|
+ Activity.OtherColumns["Description"] = CoreUtils.GetFullPropertyName<Assignment,String>(c=>c.ActivityLink.Description,".");
|
|
|
+ ConfigureEditor(Activity);
|
|
|
+
|
|
|
+ ITP.EditorDefinition = DatabaseSchema.Property(typeof(Assignment), "ITP.ID").Editor;
|
|
|
+ ITP.OtherColumns["Code"] = "ITP.Code";
|
|
|
+ //ConfigureEditor(ITP);
|
|
|
+
|
|
|
+ Kanban.EditorDefinition = DatabaseSchema.Property(typeof(Assignment), "Task.ID").Editor;
|
|
|
+ Kanban.OtherColumns["JobLink.ID"] = "JobLink.ID";
|
|
|
+ Kanban.OtherColumns["JobLink.JobNumber"] = "JobLink.JobNumber";
|
|
|
+ Kanban.OtherColumns["JobLink.Name"] = "JobLink.Name";
|
|
|
+ ConfigureEditor(Kanban);
|
|
|
+
|
|
|
+ Job.EditorDefinition = DatabaseSchema.Property(typeof(Assignment), "JobLink.ID").Editor;
|
|
|
+ Job.OtherColumns["JobNumber"] = "JobLink.JobNumber";
|
|
|
+ Job.OtherColumns["Name"] = "JobLink.Name";
|
|
|
+ Job.OnDefineFilter += (sender, type) => { return LookupFactory.DefineFilter<Assignment, Job>(new[] { SelectedAssignment }); };
|
|
|
+ ConfigureEditor(Job);
|
|
|
+
|
|
|
+ GotoCurrentRequiredReport();
|
|
|
+
|
|
|
+ LoadKanbans("Open");
|
|
|
+ }
|
|
|
+ finally
|
|
|
+ {
|
|
|
+ Calendar.EnableUpdate();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void Shutdown()
|
|
@@ -954,9 +963,15 @@ namespace PRSDesktop
|
|
|
|
|
|
if (!RequiredReports.Any())
|
|
|
{
|
|
|
- RequiredReports.Add(new RequiredReport(Guid.Empty, DateTime.Today,
|
|
|
- Employee.UsualStart.Ticks != 0L ? Employee.UsualStart : new TimeSpan(8, 0, 0),
|
|
|
- Employee.UsualFinish.Ticks != 0L ? Employee.UsualFinish : new TimeSpan(17, 0, 0), ""));
|
|
|
+ var start = TimeSpan.FromSeconds(0);
|
|
|
+ var finish = TimeSpan.FromDays(1);
|
|
|
+ var blocks = Calendar.GetRoster(Employee.ID, DatePicker.SelectedDate.Value)?.GetBlocks(DatePicker.SelectedDate.Value, start, finish);
|
|
|
+ if (blocks?.Any() == true)
|
|
|
+ {
|
|
|
+ start = blocks.Aggregate(start, (time, block) => time.Ticks < block.Start.Ticks ? time : block.Start);
|
|
|
+ finish = blocks.Aggregate(finish, (time, block) => time.Ticks > block.Finish.Ticks ? time : block.Start);
|
|
|
+ }
|
|
|
+ RequiredReports.Add(new RequiredReport(Guid.Empty, DateTime.Today, start, finish, ""));
|
|
|
ConfirmDock.Visibility = Visibility.Collapsed;
|
|
|
}
|
|
|
|