|
@@ -1,11 +1,9 @@
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
-using System.Text;
|
|
|
using System.Threading;
|
|
|
using System.Threading.Tasks;
|
|
|
using Xamarin.Forms;
|
|
|
-using Xamarin.Forms.Maps;
|
|
|
using InABox.Core;
|
|
|
using InABox.Configuration;
|
|
|
using InABox.Clients;
|
|
@@ -77,6 +75,7 @@ namespace comal.timesheets
|
|
|
deviceName = MobileUtils.GetDeviceID();
|
|
|
|
|
|
LoadCacheLists();
|
|
|
+
|
|
|
InitToolEntryList();
|
|
|
|
|
|
Timer t = new Timer(RecentlyAskedToUpdateTimer, null, 600000, 600000); //user is reminded to update when opening screen after timer of 10 minutes
|
|
@@ -88,8 +87,8 @@ namespace comal.timesheets
|
|
|
InitNotificationCentre();
|
|
|
firstLoad = false;
|
|
|
//if (GlobalVariables.EmpID == Guid.Parse("40f6ccd9-5272-4b1a-99bf-de7542205aac"))
|
|
|
- // RunCustomScript();
|
|
|
- NotifyChanges();
|
|
|
+ //RunCustomScript();
|
|
|
+ NotifyChanges();
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
@@ -98,12 +97,12 @@ namespace comal.timesheets
|
|
|
NavigationPage.SetHasBackButton(this, false);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
private void RunCustomScript()
|
|
|
{
|
|
|
-
|
|
|
- }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
private void NotifyChanges()
|
|
|
{
|
|
@@ -1306,12 +1305,12 @@ namespace comal.timesheets
|
|
|
}
|
|
|
|
|
|
#region Background Loading
|
|
|
- private void LoadCacheLists()
|
|
|
+ private async Task LoadCacheLists()
|
|
|
{
|
|
|
GlobalVariables.ProductsLoaded = false;
|
|
|
GlobalVariables.JobsLoaded = false;
|
|
|
GlobalVariables.GetXamarinWidth();
|
|
|
- LoadJobShells();
|
|
|
+ await CacheLoader.LoadJobs();
|
|
|
LoadEmployeeShells();
|
|
|
LoadProducts();
|
|
|
LoadCompanyDevices();
|
|
@@ -1418,52 +1417,6 @@ namespace comal.timesheets
|
|
|
|
|
|
}
|
|
|
|
|
|
- async void LoadJobShells()
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- await Task.Run(() =>
|
|
|
- {
|
|
|
- List<JobShell> jobShells = new List<JobShell>();
|
|
|
- CoreTable table = new Client<Job>().Query(
|
|
|
- new Filter<Job>(x => x.JobStatus.Active).IsEqualTo(true),
|
|
|
- new Columns<Job>(x => x.ID, x => x.Name, x => x.JobNumber, x => x.JobStatus.Description, x => x.Color),
|
|
|
- new SortOrder<Job>(x => x.JobNumber)
|
|
|
- );
|
|
|
- foreach (CoreRow row in table.Rows)
|
|
|
- {
|
|
|
- List<object> list = row.Values;
|
|
|
- if (list[0] == null) { list[0] = Guid.Empty; } //0
|
|
|
- if (list[1] == null) { list[1] = ""; } //1
|
|
|
- if (list[2] == null) { list[2] = ""; } //2
|
|
|
- if (list[3] == null) { list[3] = ""; } //3
|
|
|
- if (list[4] == null) { list[4] = ""; } //4
|
|
|
- JobShell jobshell = new JobShell
|
|
|
- {
|
|
|
- ID = Guid.Parse(list[0].ToString()),
|
|
|
- Name = list[1].ToString(),
|
|
|
- JobNumber = list[2].ToString(),
|
|
|
- JobStatusDescription = list[3].ToString(),
|
|
|
- Color = Color.FromHex(list[4].ToString())
|
|
|
- };
|
|
|
- if (jobshell.JobStatusDescription.Equals("Active Projects"))
|
|
|
- jobshell.JobStatusDescription = "Active";
|
|
|
- else if (jobshell.JobStatusDescription.Equals("Projects - Hidden from View"))
|
|
|
- jobshell.JobStatusDescription = "Hidden";
|
|
|
- else if (jobshell.JobStatusDescription.Equals("Projects in Defect Liability Period"))
|
|
|
- jobshell.JobStatusDescription = "Defect Liability";
|
|
|
-
|
|
|
- jobshell.DisplayName = "(" + jobshell.JobNumber + ") " + jobshell.Name;
|
|
|
- jobShells.Add(jobshell);
|
|
|
- }
|
|
|
- GlobalVariables.JobShells = jobShells;
|
|
|
- GlobalVariables.JobShells.Insert(0, new JobShell { ID = Guid.Empty, JobNumber = "No Job", Name = "Empty Job", JobStatusDescription = "Hidden" });
|
|
|
- GlobalVariables.JobsLoaded = true;
|
|
|
- });
|
|
|
- }
|
|
|
- catch { }
|
|
|
- }
|
|
|
-
|
|
|
private async void LoadHRToDos()
|
|
|
{
|
|
|
try
|