|
@@ -54,7 +54,7 @@ namespace comal.timesheets
|
|
}
|
|
}
|
|
private void RunCustomScript()
|
|
private void RunCustomScript()
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
private void InitItems()
|
|
private void InitItems()
|
|
@@ -238,14 +238,18 @@ namespace comal.timesheets
|
|
GlobalVariables.EmpID = GlobalVariables.GetEmployeeID();
|
|
GlobalVariables.EmpID = GlobalVariables.GetEmployeeID();
|
|
GlobalVariables.EmpName = GlobalVariables.GetEmployeeName();
|
|
GlobalVariables.EmpName = GlobalVariables.GetEmployeeName();
|
|
}
|
|
}
|
|
|
|
+
|
|
clockOnButton.IsEnabled = false;
|
|
clockOnButton.IsEnabled = false;
|
|
|
|
|
|
bool PRSReady = (App.Data.Employee != null) && (App.Data.TimeSheets != null) && (GlobalVariables.EmpID != Guid.Empty);
|
|
bool PRSReady = (App.Data.Employee != null) && (App.Data.TimeSheets != null) && (GlobalVariables.EmpID != Guid.Empty);
|
|
|
|
+ if (!PRSReady)
|
|
|
|
+ App.Data.Refresh();
|
|
|
|
|
|
bool GateReady = CheckLocation();
|
|
bool GateReady = CheckLocation();
|
|
|
|
|
|
CurrentLocation.Text = DisplayAddress();
|
|
CurrentLocation.Text = DisplayAddress();
|
|
- if (CurrentLocation.Text.Contains("ERROR"))
|
|
|
|
|
|
+
|
|
|
|
+ if (CurrentLocation.Text.ToUpper().Contains("ERROR"))
|
|
CurrentLocation.Text = "Unknown Address";
|
|
CurrentLocation.Text = "Unknown Address";
|
|
|
|
|
|
Title = null;
|
|
Title = null;
|
|
@@ -287,27 +291,31 @@ namespace comal.timesheets
|
|
|
|
|
|
private void CheckClockOnRequired()
|
|
private void CheckClockOnRequired()
|
|
{
|
|
{
|
|
- if (GlobalVariables.IsJobOnlyEmployee)
|
|
|
|
- {
|
|
|
|
- clockOnButton.IsVisible = false;
|
|
|
|
- CurrentLocation.IsVisible = false;
|
|
|
|
- buttonsGrid.IsVisible = false;
|
|
|
|
- taskBtn.IsVisible = false;
|
|
|
|
- row0.Height = 0;
|
|
|
|
- row1.Height = 0;
|
|
|
|
- row2.Height = 150;
|
|
|
|
- Image img = new Image { Source = "logo.png" };
|
|
|
|
- img.Margin = 15;
|
|
|
|
- Grid.SetRow(img, 2);
|
|
|
|
- homeScreenGrid.Children.Add(img);
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
|
|
+ try
|
|
{
|
|
{
|
|
- clockOnButton.IsVisible = true;
|
|
|
|
- CurrentLocation.IsVisible = true;
|
|
|
|
- buttonsGrid.IsVisible = true;
|
|
|
|
- taskBtn.IsVisible = true;
|
|
|
|
|
|
+ if (GlobalVariables.IsJobOnlyEmployee)
|
|
|
|
+ {
|
|
|
|
+ clockOnButton.IsVisible = false;
|
|
|
|
+ CurrentLocation.IsVisible = false;
|
|
|
|
+ buttonsGrid.IsVisible = false;
|
|
|
|
+ taskBtn.IsVisible = false;
|
|
|
|
+ row0.Height = 0;
|
|
|
|
+ row1.Height = 0;
|
|
|
|
+ row2.Height = 150;
|
|
|
|
+ Image img = new Image { Source = "logo.png" };
|
|
|
|
+ img.Margin = 15;
|
|
|
|
+ Grid.SetRow(img, 2);
|
|
|
|
+ homeScreenGrid.Children.Add(img);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ clockOnButton.IsVisible = true;
|
|
|
|
+ CurrentLocation.IsVisible = true;
|
|
|
|
+ buttonsGrid.IsVisible = true;
|
|
|
|
+ taskBtn.IsVisible = true;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ catch { }
|
|
}
|
|
}
|
|
|
|
|
|
private void Job_OnJobNumberChanged(string jobnumber)
|
|
private void Job_OnJobNumberChanged(string jobnumber)
|
|
@@ -343,18 +351,6 @@ namespace comal.timesheets
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
#region Clock on/off
|
|
#region Clock on/off
|
|
- private void DataChanged(object sender, Type type, Exception e)
|
|
|
|
- {
|
|
|
|
- RefreshScreen();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void DataRefreshed()
|
|
|
|
- {
|
|
|
|
- //if (bSharedDevice)
|
|
|
|
- // return;
|
|
|
|
- Device.BeginInvokeOnMainThread(() => { RefreshScreen(); });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
bool bBusy = false;
|
|
bool bBusy = false;
|
|
|
|
|
|
async void ClockOnOff_Clicked(object sender, System.EventArgs e)
|
|
async void ClockOnOff_Clicked(object sender, System.EventArgs e)
|
|
@@ -552,85 +548,6 @@ namespace comal.timesheets
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- private void RecentlyUpdatedTilesTimer(object o)
|
|
|
|
- {
|
|
|
|
- bRecentlyUpdatedTiles = false;
|
|
|
|
- App.Data.Refresh(true);
|
|
|
|
- MainPageUtils.SearchForNewNotifications();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void LocationFound(LocationServices sender)
|
|
|
|
- {
|
|
|
|
- //if (bSharedDevice)
|
|
|
|
- // return;
|
|
|
|
- if (App.Bluetooth.RecentlyScanned)
|
|
|
|
- UploadTiles();
|
|
|
|
-
|
|
|
|
- try
|
|
|
|
- {
|
|
|
|
- TimeSheet timesheet = App.Data.TimeSheets?.Rows.FirstOrDefault()?.ToObject<TimeSheet>();
|
|
|
|
- if (timesheet != null)
|
|
|
|
- {
|
|
|
|
- if (timesheet.StartLocation.Latitude.Equals(0.0F) && timesheet.StartLocation.Longitude.Equals(0.0F))
|
|
|
|
- {
|
|
|
|
- timesheet.StartLocation.Latitude = sender.Latitude;
|
|
|
|
- timesheet.StartLocation.Longitude = sender.Longitude;
|
|
|
|
- timesheet.StartLocation.Timestamp = sender.TimeStamp;
|
|
|
|
- timesheet.Address = sender.Address;
|
|
|
|
- new Client<TimeSheet>().Save(timesheet, "Updating Timesheet with GPS Coordinates", (o, e) => { });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!string.IsNullOrWhiteSpace(matchedDeviceName))
|
|
|
|
- {
|
|
|
|
- InABox.Core.Location curlocation = new InABox.Core.Location() { Latitude = App.GPS.Latitude, Longitude = App.GPS.Longitude };
|
|
|
|
- curlocation.Timestamp = DateTime.Now;
|
|
|
|
-
|
|
|
|
- GPSTrackerLocation gpsTrackerLocation = new GPSTrackerLocation();
|
|
|
|
- gpsTrackerLocation.DeviceID = matchedDeviceName;
|
|
|
|
- gpsTrackerLocation.Location.Timestamp = curlocation.Timestamp;
|
|
|
|
- gpsTrackerLocation.Location = curlocation;
|
|
|
|
-
|
|
|
|
- new Client<GPSTrackerLocation>().Save(gpsTrackerLocation, "Updated company device location from Timebench");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Device.BeginInvokeOnMainThread(() =>
|
|
|
|
- {
|
|
|
|
- RefreshScreen();
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- catch { }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void LocationError(LocationServices sebder, Exception error)
|
|
|
|
- {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void ScanFinished(Bluetooth sender)
|
|
|
|
- {
|
|
|
|
- try
|
|
|
|
- {
|
|
|
|
- //if (bSharedDevice)
|
|
|
|
- // return;
|
|
|
|
- Device.BeginInvokeOnMainThread(() =>
|
|
|
|
- {
|
|
|
|
- RefreshScreen();
|
|
|
|
- //if (Button2.BackgroundColor == Color.WhiteSmoke)
|
|
|
|
- // Button2.BackgroundColor = Color.Red;
|
|
|
|
- //else
|
|
|
|
- // Button2.BackgroundColor = Color.WhiteSmoke;
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (App.GPS.RecentlyLocated)
|
|
|
|
- UploadTiles();
|
|
|
|
- }
|
|
|
|
- catch { }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
@@ -1177,14 +1094,18 @@ namespace comal.timesheets
|
|
{
|
|
{
|
|
if (App.Data.CanBypassGates)
|
|
if (App.Data.CanBypassGates)
|
|
{
|
|
{
|
|
- if (App.GPS.TimeStamp > DateTime.Now.Subtract(new TimeSpan(0, 5, 0)))
|
|
|
|
|
|
+ if (App.GPS.TimeStamp > DateTime.Now.Subtract(new TimeSpan(0, 15, 0)))
|
|
return true;
|
|
return true;
|
|
else
|
|
else
|
|
|
|
+ {
|
|
|
|
+ App.GPS.GetLocation(true);
|
|
return false;
|
|
return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
if (App.Data.Gates == null)
|
|
if (App.Data.Gates == null)
|
|
return false;
|
|
return false;
|
|
- if (App.Bluetooth.TimeStamp < DateTime.Now.Subtract(new TimeSpan(0, 2, 0)))
|
|
|
|
|
|
+ if (App.Bluetooth.TimeStamp < DateTime.Now.Subtract(new TimeSpan(0, 15, 0)))
|
|
return false;
|
|
return false;
|
|
if (!App.Bluetooth.Devices.Any())
|
|
if (!App.Bluetooth.Devices.Any())
|
|
return false;
|
|
return false;
|