|
|
@@ -13,277 +13,276 @@ using InABox.DynamicGrid;
|
|
|
using InABox.WPF;
|
|
|
using InABox.Wpf;
|
|
|
|
|
|
-namespace PRSDesktop
|
|
|
-{
|
|
|
+namespace PRSDesktop;
|
|
|
|
|
|
- public class EmployeePanelSettings : IUserConfigurationSettings
|
|
|
- {
|
|
|
- public DynamicSplitPanelView View { get; set; }
|
|
|
- public double AnchorWidth { get; set; }
|
|
|
-
|
|
|
- public double RoleHeight { get; set; }
|
|
|
- public double RosterHeight { get; set; }
|
|
|
|
|
|
- public EmployeePanelSettings()
|
|
|
- {
|
|
|
- View = DynamicSplitPanelView.Combined;
|
|
|
- AnchorWidth = 250;
|
|
|
- RoleHeight = 250;
|
|
|
- RosterHeight = 400;
|
|
|
- }
|
|
|
- }
|
|
|
+public class EmployeePanelSettings : IUserConfigurationSettings
|
|
|
+{
|
|
|
+ public DynamicSplitPanelView View { get; set; }
|
|
|
+ public double AnchorWidth { get; set; }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// Interaction logic for EmployeePanel.xaml
|
|
|
- /// </summary>
|
|
|
- public partial class EmployeePanel : UserControl, IPanel<Employee>
|
|
|
+ public double RoleHeight { get; set; }
|
|
|
+ public double RosterHeight { get; set; }
|
|
|
+
|
|
|
+ public EmployeePanelSettings()
|
|
|
{
|
|
|
+ View = DynamicSplitPanelView.Combined;
|
|
|
+ AnchorWidth = 250;
|
|
|
+ RoleHeight = 250;
|
|
|
+ RosterHeight = 400;
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
- private enum Suppress
|
|
|
- {
|
|
|
- Events
|
|
|
- }
|
|
|
+/// <summary>
|
|
|
+/// Interaction logic for EmployeePanel.xaml
|
|
|
+/// </summary>
|
|
|
+public partial class EmployeePanel : UserControl, IPanel<Employee>
|
|
|
+{
|
|
|
|
|
|
- private EmployeePanelSettings _settings;
|
|
|
+ private enum Suppress
|
|
|
+ {
|
|
|
+ Events
|
|
|
+ }
|
|
|
|
|
|
- private void DoLoadSettings()
|
|
|
- {
|
|
|
- using (new EventSuppressor(Suppress.Events))
|
|
|
- {
|
|
|
- _settings = new UserConfiguration<EmployeePanelSettings>().Load();
|
|
|
+ private EmployeePanelSettings _settings;
|
|
|
|
|
|
- SplitPanel.View = _settings.View;
|
|
|
- SplitPanel.AnchorWidth = _settings.AnchorWidth;
|
|
|
- RoleGridRow.Height = new GridLength(_settings.RoleHeight, GridUnitType.Pixel);
|
|
|
- RosterGridRow.Height = new GridLength(_settings.RosterHeight, GridUnitType.Pixel);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void DoSaveSettings()
|
|
|
- {
|
|
|
- _settings.View = SplitPanel.View;
|
|
|
- _settings.AnchorWidth = SplitPanel.AnchorWidth;
|
|
|
- _settings.RoleHeight = RoleGridRow.Height.Value;
|
|
|
- _settings.RosterHeight = RosterGridRow.Height.Value;
|
|
|
- new UserConfiguration<EmployeePanelSettings>().Save(_settings);
|
|
|
- }
|
|
|
-
|
|
|
- public EmployeePanel()
|
|
|
+ private void DoLoadSettings()
|
|
|
+ {
|
|
|
+ using (new EventSuppressor(Suppress.Events))
|
|
|
{
|
|
|
- using (new EventSuppressor(Suppress.Events))
|
|
|
- InitializeComponent();
|
|
|
- }
|
|
|
+ _settings = new UserConfiguration<EmployeePanelSettings>().Load();
|
|
|
+
|
|
|
+ SplitPanel.View = _settings.View;
|
|
|
+ SplitPanel.AnchorWidth = _settings.AnchorWidth;
|
|
|
+ RoleGridRow.Height = new GridLength(_settings.RoleHeight, GridUnitType.Pixel);
|
|
|
+ RosterGridRow.Height = new GridLength(_settings.RosterHeight, GridUnitType.Pixel);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void DoSaveSettings()
|
|
|
+ {
|
|
|
+ _settings.View = SplitPanel.View;
|
|
|
+ _settings.AnchorWidth = SplitPanel.AnchorWidth;
|
|
|
+ _settings.RoleHeight = RoleGridRow.Height.Value;
|
|
|
+ _settings.RosterHeight = RosterGridRow.Height.Value;
|
|
|
+ new UserConfiguration<EmployeePanelSettings>().Save(_settings);
|
|
|
+ }
|
|
|
+
|
|
|
+ public EmployeePanel()
|
|
|
+ {
|
|
|
+ using (new EventSuppressor(Suppress.Events))
|
|
|
+ InitializeComponent();
|
|
|
+ }
|
|
|
|
|
|
- public bool IsReady { get; set; }
|
|
|
+ public bool IsReady { get; set; }
|
|
|
|
|
|
|
|
|
- public event DataModelUpdateEvent? OnUpdateDataModel;
|
|
|
+ public event DataModelUpdateEvent? OnUpdateDataModel;
|
|
|
|
|
|
- public Dictionary<string, object[]> Selected()
|
|
|
- {
|
|
|
- return new Dictionary<string, object[]> { { typeof(Employee).EntityName(), Employees.SelectedRows } };
|
|
|
- }
|
|
|
+ public Dictionary<string, object[]> Selected()
|
|
|
+ {
|
|
|
+ return new Dictionary<string, object[]> { { typeof(Employee).EntityName(), Employees.SelectedRows } };
|
|
|
+ }
|
|
|
|
|
|
- public void Setup()
|
|
|
+ public void Setup()
|
|
|
+ {
|
|
|
+ using (new EventSuppressor(Suppress.Events))
|
|
|
{
|
|
|
- using (new EventSuppressor(Suppress.Events))
|
|
|
+ DoLoadSettings();
|
|
|
+
|
|
|
+ Employees.HiddenColumns.Add(x => x.RosterTemplate.ID);
|
|
|
+ Employees.HiddenColumns.Add(x => x.RosterStart);
|
|
|
+
|
|
|
+ Employees.Refresh(true, false);
|
|
|
+ Rosters.Refresh(true, false);
|
|
|
+ Teams.Refresh(true, false);
|
|
|
+ Roles.Refresh(true, false);
|
|
|
+ Activities.Refresh(true, false);
|
|
|
+ Forms.Refresh(true, false);
|
|
|
+ Qualifications.Refresh(true, false);
|
|
|
+ Spreadsheets.Refresh(true, false);
|
|
|
+ Jobs.Refresh(true, false);
|
|
|
+
|
|
|
+ RoleCrossTab.Visibility = Security.CanView<Employee>()
|
|
|
+ && Security.CanView<Role>()
|
|
|
+ && Security.CanView<EmployeeRole>() ? Visibility.Visible : Visibility.Collapsed;
|
|
|
+ var visibleTabItems = Tab.Items.OfType<DynamicTabItem>().Where(x => x.Visibility == Visibility.Visible).ToList();
|
|
|
+ if(visibleTabItems.Count <= 1)
|
|
|
{
|
|
|
- DoLoadSettings();
|
|
|
-
|
|
|
- Employees.HiddenColumns.Add(x => x.RosterTemplate.ID);
|
|
|
- Employees.HiddenColumns.Add(x => x.RosterStart);
|
|
|
-
|
|
|
- Employees.Refresh(true, false);
|
|
|
- Rosters.Refresh(true, false);
|
|
|
- Teams.Refresh(true, false);
|
|
|
- Roles.Refresh(true, false);
|
|
|
- Activities.Refresh(true, false);
|
|
|
- Forms.Refresh(true, false);
|
|
|
- Qualifications.Refresh(true, false);
|
|
|
- Spreadsheets.Refresh(true, false);
|
|
|
- Jobs.Refresh(true, false);
|
|
|
-
|
|
|
- RoleCrossTab.Visibility = Security.CanView<Employee>()
|
|
|
- && Security.CanView<Role>()
|
|
|
- && Security.CanView<EmployeeRole>() ? Visibility.Visible : Visibility.Collapsed;
|
|
|
- var visibleTabItems = Tab.Items.OfType<DynamicTabItem>().Where(x => x.Visibility == Visibility.Visible).ToList();
|
|
|
- if(visibleTabItems.Count <= 1)
|
|
|
+ foreach(var tab in visibleTabItems)
|
|
|
{
|
|
|
- foreach(var tab in visibleTabItems)
|
|
|
- {
|
|
|
- tab.Visibility = Visibility.Collapsed;
|
|
|
- Tab.SelectedItem = tab;
|
|
|
- }
|
|
|
+ tab.Visibility = Visibility.Collapsed;
|
|
|
+ Tab.SelectedItem = tab;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- public void Shutdown(CancelEventArgs? cancel)
|
|
|
- {
|
|
|
- }
|
|
|
+ public void Shutdown(CancelEventArgs? cancel)
|
|
|
+ {
|
|
|
+ }
|
|
|
|
|
|
- public void CreateToolbarButtons(IPanelHost host)
|
|
|
- {
|
|
|
- HumanResourcesSetupActions.SecurityGroups(host);
|
|
|
- host.CreateSetupSeparator();
|
|
|
- HumanResourcesSetupActions.EmployeeGroups(host);
|
|
|
- HumanResourcesSetupActions.EmployeePositions(host);
|
|
|
- HumanResourcesSetupActions.EmployeeRoles(host);
|
|
|
- HumanResourcesSetupActions.EmployeeTeams(host);
|
|
|
- HumanResourcesSetupActions.EmployeeActivities(host);
|
|
|
- HumanResourcesSetupActions.EmployeeQualifications(host);
|
|
|
- HumanResourcesSetupActions.EmployeeRosters(host);
|
|
|
- host.CreateSetupSeparator();
|
|
|
- HumanResourcesSetupActions.EmployeeOvertimeRules(host);
|
|
|
- HumanResourcesSetupActions.EmployeeOvertime(host);
|
|
|
- HumanResourcesSetupActions.EmployeeStandardLeave(host);
|
|
|
- host.CreateSetupSeparator();
|
|
|
- HumanResourcesSetupActions.EmployeeSpreadsheetTemplates(host);
|
|
|
- }
|
|
|
+ public void CreateToolbarButtons(IPanelHost host)
|
|
|
+ {
|
|
|
+ HumanResourcesSetupActions.SecurityGroups(host);
|
|
|
+ host.CreateSetupSeparator();
|
|
|
+ HumanResourcesSetupActions.EmployeeGroups(host);
|
|
|
+ HumanResourcesSetupActions.EmployeePositions(host);
|
|
|
+ HumanResourcesSetupActions.EmployeeRoles(host);
|
|
|
+ HumanResourcesSetupActions.EmployeeTeams(host);
|
|
|
+ HumanResourcesSetupActions.EmployeeActivities(host);
|
|
|
+ HumanResourcesSetupActions.EmployeeQualifications(host);
|
|
|
+ HumanResourcesSetupActions.EmployeeRosters(host);
|
|
|
+ host.CreateSetupSeparator();
|
|
|
+ HumanResourcesSetupActions.EmployeeOvertimeRules(host);
|
|
|
+ HumanResourcesSetupActions.EmployeeOvertime(host);
|
|
|
+ HumanResourcesSetupActions.EmployeeStandardLeave(host);
|
|
|
+ host.CreateSetupSeparator();
|
|
|
+ HumanResourcesSetupActions.EmployeeSpreadsheetTemplates(host);
|
|
|
+ }
|
|
|
|
|
|
- private bool _loaded = false;
|
|
|
+ private bool _loaded = false;
|
|
|
|
|
|
- private void Tab_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
- {
|
|
|
- if (sender != Tab || !_loaded) return;
|
|
|
- RefreshCurrentTab();
|
|
|
- }
|
|
|
+ private void Tab_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
+ {
|
|
|
+ if (sender != Tab || !_loaded) return;
|
|
|
+ RefreshCurrentTab();
|
|
|
+ }
|
|
|
|
|
|
- private void RefreshCurrentTab()
|
|
|
+ private void RefreshCurrentTab()
|
|
|
+ {
|
|
|
+ if (Tab.SelectedTab == EmployeeTab)
|
|
|
{
|
|
|
- if (Tab.SelectedTab == EmployeeTab)
|
|
|
- {
|
|
|
- RefreshEmployeeTab();
|
|
|
- }
|
|
|
- else if (Tab.SelectedTab == RoleCrossTab)
|
|
|
- {
|
|
|
- RefreshRoleTab();
|
|
|
- }
|
|
|
+ RefreshEmployeeTab();
|
|
|
}
|
|
|
-
|
|
|
- private void RefreshRoleTab()
|
|
|
+ else if (Tab.SelectedTab == RoleCrossTab)
|
|
|
{
|
|
|
- EmployeeRoles.Refresh(true, true);
|
|
|
+ RefreshRoleTab();
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- private void RefreshEmployeeTab()
|
|
|
- {
|
|
|
- Employees.Refresh(false, true);
|
|
|
- Rosters.Refresh(false, true);
|
|
|
- Teams.Refresh(false, true);
|
|
|
- Roles.Refresh(false, true);
|
|
|
- Activities.Refresh(false, true);
|
|
|
- Forms.Refresh(false, true);
|
|
|
- Qualifications.Refresh(false, true);
|
|
|
- Spreadsheets.Refresh(false, true);
|
|
|
- Jobs.Refresh(false, true);
|
|
|
- }
|
|
|
+ private void RefreshRoleTab()
|
|
|
+ {
|
|
|
+ EmployeeRoles.Refresh(true, true);
|
|
|
+ }
|
|
|
|
|
|
- public void Refresh()
|
|
|
- {
|
|
|
- RefreshCurrentTab();
|
|
|
- _loaded = true;
|
|
|
- }
|
|
|
+ private void RefreshEmployeeTab()
|
|
|
+ {
|
|
|
+ Employees.Refresh(false, true);
|
|
|
+ Rosters.Refresh(false, true);
|
|
|
+ Teams.Refresh(false, true);
|
|
|
+ Roles.Refresh(false, true);
|
|
|
+ Activities.Refresh(false, true);
|
|
|
+ Forms.Refresh(false, true);
|
|
|
+ Qualifications.Refresh(false, true);
|
|
|
+ Spreadsheets.Refresh(false, true);
|
|
|
+ Jobs.Refresh(false, true);
|
|
|
+ }
|
|
|
|
|
|
- public string SectionName => "Employees";
|
|
|
+ public void Refresh()
|
|
|
+ {
|
|
|
+ RefreshCurrentTab();
|
|
|
+ _loaded = true;
|
|
|
+ }
|
|
|
|
|
|
- public DataModel DataModel(Selection selection)
|
|
|
- {
|
|
|
- var ids = Employees.ExtractValues(x => x.ID, selection).ToArray();
|
|
|
- return new AutoDataModel<Employee>(Filter<Employee>.Where(x => x.ID).InList(ids));
|
|
|
- }
|
|
|
+ public string SectionName => "Employees";
|
|
|
|
|
|
- public void Heartbeat(TimeSpan time)
|
|
|
- {
|
|
|
- }
|
|
|
+ public DataModel DataModel(Selection selection)
|
|
|
+ {
|
|
|
+ var ids = Employees.ExtractValues(x => x.ID, selection).ToArray();
|
|
|
+ return new AutoDataModel<Employee>(Filter<Employee>.Where(x => x.ID).InList(ids));
|
|
|
+ }
|
|
|
|
|
|
- private void Employees_OnOnSelectItem(object sender, DynamicGridSelectionEventArgs e)
|
|
|
- {
|
|
|
- var employee = e.Rows?.FirstOrDefault()?.ToObject<Employee>() ?? new Employee();
|
|
|
+ public void Heartbeat(TimeSpan time)
|
|
|
+ {
|
|
|
+ }
|
|
|
|
|
|
- Rosters.Load(employee, null);
|
|
|
- //Rosters.Refresh(false, true);
|
|
|
+ private void Employees_OnOnSelectItem(object sender, DynamicGridSelectionEventArgs e)
|
|
|
+ {
|
|
|
+ var employee = e.Rows?.FirstOrDefault()?.ToObject<Employee>() ?? new Employee();
|
|
|
|
|
|
- Teams.EmployeeID = employee.ID;
|
|
|
- Teams.Refresh(false, true);
|
|
|
+ Rosters.Load(employee, null);
|
|
|
+ //Rosters.Refresh(false, true);
|
|
|
|
|
|
- //LoadEmployeeThumbnail(employee.Thumbnail.ID);
|
|
|
-
|
|
|
- Roles.EmployeeID = employee.ID;
|
|
|
- Roles.Refresh(false, true);
|
|
|
+ Teams.EmployeeID = employee.ID;
|
|
|
+ Teams.Refresh(false, true);
|
|
|
|
|
|
- Activities.Left = employee;
|
|
|
- Activities.Refresh(false,true);
|
|
|
+ //LoadEmployeeThumbnail(employee.Thumbnail.ID);
|
|
|
+
|
|
|
+ Roles.EmployeeID = employee.ID;
|
|
|
+ Roles.Refresh(false, true);
|
|
|
|
|
|
- Forms.Left = employee;
|
|
|
- Forms.Refresh(false, true);
|
|
|
-
|
|
|
- Qualifications.Load(employee, null);
|
|
|
+ Activities.Left = employee;
|
|
|
+ Activities.Refresh(false,true);
|
|
|
|
|
|
- Spreadsheets.Master = employee;
|
|
|
- Spreadsheets.Refresh(false,true);
|
|
|
+ Forms.Left = employee;
|
|
|
+ Forms.Refresh(false, true);
|
|
|
+
|
|
|
+ Qualifications.Load(employee, null);
|
|
|
|
|
|
- Jobs.Left = employee;
|
|
|
- Jobs.Refresh(false, true);
|
|
|
- }
|
|
|
+ Spreadsheets.Master = employee;
|
|
|
+ Spreadsheets.Refresh(false,true);
|
|
|
|
|
|
- // private void LoadEmployeeThumbnail(Guid imageid)
|
|
|
- // {
|
|
|
- // Thumbnail.Source = null;
|
|
|
- // if (imageid == Guid.Empty)
|
|
|
- // return;
|
|
|
- // Bitmap result = null;
|
|
|
- // new Client<Document>().Query(
|
|
|
- // Filter<Document>.Where(x => x.ID).IsEqualTo(imageid),
|
|
|
- // new Columns<Document>(x => x.ID, x => x.Data),
|
|
|
- // null,
|
|
|
- // (o, e) => Dispatcher.Invoke(() =>
|
|
|
- // {
|
|
|
- // if (o?.Rows.Any() == true)
|
|
|
- // {
|
|
|
- // var ms = new MemoryStream(o.Rows.First().Get<Document, byte[]>(x => x.Data));
|
|
|
- // Thumbnail.Source = new Bitmap(ms).AsBitmapImage();
|
|
|
- // }
|
|
|
- // })
|
|
|
- // );
|
|
|
- // }
|
|
|
-
|
|
|
- private void SplitPanel_OnChanged(object sender, DynamicSplitPanelSettings e)
|
|
|
- {
|
|
|
- if (EventSuppressor.IsSet(Suppress.Events))
|
|
|
- return;
|
|
|
- DoSaveSettings();
|
|
|
- }
|
|
|
-
|
|
|
- private void Roles_OnSizeChanged(object sender, SizeChangedEventArgs e)
|
|
|
- {
|
|
|
- if (EventSuppressor.IsSet(Suppress.Events))
|
|
|
- return;
|
|
|
- DoSaveSettings();
|
|
|
- }
|
|
|
-
|
|
|
- private void Roles_OnOnChanged(object sender, EventArgs args)
|
|
|
- {
|
|
|
- Activities.Refresh(false,true);
|
|
|
- Forms.Refresh(false, true);
|
|
|
- }
|
|
|
+ Jobs.Left = employee;
|
|
|
+ Jobs.Refresh(false, true);
|
|
|
+ }
|
|
|
|
|
|
+ // private void LoadEmployeeThumbnail(Guid imageid)
|
|
|
+ // {
|
|
|
+ // Thumbnail.Source = null;
|
|
|
+ // if (imageid == Guid.Empty)
|
|
|
+ // return;
|
|
|
+ // Bitmap result = null;
|
|
|
+ // new Client<Document>().Query(
|
|
|
+ // Filter<Document>.Where(x => x.ID).IsEqualTo(imageid),
|
|
|
+ // new Columns<Document>(x => x.ID, x => x.Data),
|
|
|
+ // null,
|
|
|
+ // (o, e) => Dispatcher.Invoke(() =>
|
|
|
+ // {
|
|
|
+ // if (o?.Rows.Any() == true)
|
|
|
+ // {
|
|
|
+ // var ms = new MemoryStream(o.Rows.First().Get<Document, byte[]>(x => x.Data));
|
|
|
+ // Thumbnail.Source = new Bitmap(ms).AsBitmapImage();
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+
|
|
|
+ private void SplitPanel_OnChanged(object sender, DynamicSplitPanelSettings e)
|
|
|
+ {
|
|
|
+ if (EventSuppressor.IsSet(Suppress.Events))
|
|
|
+ return;
|
|
|
+ DoSaveSettings();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void Roles_OnSizeChanged(object sender, SizeChangedEventArgs e)
|
|
|
+ {
|
|
|
+ if (EventSuppressor.IsSet(Suppress.Events))
|
|
|
+ return;
|
|
|
+ DoSaveSettings();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void Roles_OnOnChanged(object sender, EventArgs args)
|
|
|
+ {
|
|
|
+ Activities.Refresh(false,true);
|
|
|
+ Forms.Refresh(false, true);
|
|
|
+ }
|
|
|
|
|
|
- private void Rosters_OnOnChanged(object sender, EventArgs args)
|
|
|
- {
|
|
|
- //Employees.Refresh(false, true);
|
|
|
- }
|
|
|
|
|
|
- private void Rosters_OnSizeChanged(object sender, SizeChangedEventArgs e)
|
|
|
- {
|
|
|
- if (EventSuppressor.IsSet(Suppress.Events))
|
|
|
- return;
|
|
|
- DoSaveSettings();
|
|
|
- }
|
|
|
+ private void Rosters_OnOnChanged(object sender, EventArgs args)
|
|
|
+ {
|
|
|
+ //Employees.Refresh(false, true);
|
|
|
+ }
|
|
|
|
|
|
- private void Rosters_EmployeeChanged()
|
|
|
- {
|
|
|
- Employees.Refresh(false, true);
|
|
|
- }
|
|
|
+ private void Rosters_OnSizeChanged(object sender, SizeChangedEventArgs e)
|
|
|
+ {
|
|
|
+ if (EventSuppressor.IsSet(Suppress.Events))
|
|
|
+ return;
|
|
|
+ DoSaveSettings();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void Rosters_EmployeeChanged()
|
|
|
+ {
|
|
|
+ Employees.Refresh(false, true);
|
|
|
}
|
|
|
}
|