| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 | 
							- using Comal.Classes;
 
- using InABox.Clients;
 
- using InABox.Core;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using System.Text;
 
- using Xamarin.Forms;
 
- using comal.timesheets;
 
- using comal.timesheets.CustomControls;
 
- using Xamarin.Essentials;
 
- namespace comal.timesheets
 
- {
 
-     public static class GlobalVariables
 
-     {
 
-         //do not change these or cache will not be able to find them on the next update
 
-         public const string CacheURLString = "ConnectionSettingsURL";
 
-         public const string CachePortString = "ConnectionSettingsPort";
 
-         public const string CacheUserIDString = "ConnectionSettingsUserID";
 
-         public const string CachePasswordString = "ConnectionSettingsPassword";
 
-         public static List<ProductShell> ProductShells { get; set; }
 
-         public static List<ProductFamily> ProductFamilies { get; set; }
 
-         
 
-         public static bool ProductsLoaded { get; set; }
 
-         public static Guid EmpID { get; set; }
 
-         public static string EmpName { get; set; }
 
-         public static List<EmployeeShell> EmployeeShells { get; set; }
 
-         public static List<EmployeeShell> TeamEmployeeShells { get; set; }
 
-         public static bool EmployeesLoaded { get; set; }
 
-         public static List<String> TeamNames { get; set; }
 
-         public static List<JobShell> JobShells { get; set; }
 
-         public static bool JobsLoaded { get; set; }
 
-         public static int EmployeeFormsToDo { get; set; }
 
-         public static double XamarinWidth { get; set; }
 
-         public static List<GPSTracker> GPSTrackerCache { get; set; }
 
-         public static string DeviceString { get; set; }
 
-         public static bool ChangeUser { get; set; }
 
-         public static bool InternalOnAppearing { get; set; }
 
-         public static int QualificationsNeedingAttention { get; set; }
 
-         public static string LoadFromLinkString { get; set; }
 
-         public static string GetEmployeeName()
 
-         {
 
-             try
 
-             {
 
-                 String employeeName = new Client<Employee>().Query(new Filter<Employee>(x => x.UserLink.ID).IsEqualTo(ClientFactory.UserGuid), new Columns<Employee>(x => x.Name)).Rows.First().ToObject<Employee>().Name;
 
-                 return employeeName;
 
-             }
 
-             catch
 
-             {
 
-                 return "";
 
-             }
 
-         }
 
-         public static Guid GetEmployeeID()
 
-         {
 
-             try
 
-             {
 
-                 Guid employeeID = new Client<Employee>().Query(new Filter<Employee>(x => x.UserLink.ID).IsEqualTo(ClientFactory.UserGuid), new Columns<Employee>(x => x.ID)).Rows.First().ToObject<Employee>().ID;
 
-                 return employeeID;
 
-             }
 
-             catch
 
-             {
 
-                 return Guid.Empty;
 
-             }
 
-         }
 
-         public static bool VisibleToTestTeam()
 
-         {
 
-             bool isVisible = false;
 
-             if (EmpID.Equals(Guid.Parse("40f6ccd9-5272-4b1a-99bf-de7542205aac")) || EmpID.Equals(Guid.Parse("b0d7246e-4506-4149-bd8b-cbeebe047b53"))
 
-                 || EmpID.Equals(Guid.Parse("a83346a1-dde5-4ff7-8053-33daf92a9298"))  || EmpID.Equals(Guid.Parse("3fe88ee9-7f07-4293-8036-fcd8ce6c4342")))
 
-             {
 
-                 isVisible = true;
 
-             }
 
-             return isVisible;
 
-         }
 
-         public static void GetXamarinWidth()
 
-         {
 
-             var mainDisplayInfo = DeviceDisplay.MainDisplayInfo;
 
-             var width = mainDisplayInfo.Width;
 
-             XamarinWidth = width / mainDisplayInfo.Density;
 
-         }
 
-         public static bool UpdateHRItemsNeedingAttention()
 
-         {
 
-             try
 
-             {
 
-                 GlobalVariables.EmployeeFormsToDo = 0;
 
-                 GlobalVariables.QualificationsNeedingAttention = 0;
 
-                 CoreTable table = new Client<EmployeeQualification>().Query(
 
-                     new Filter<EmployeeQualification>(x => x.Employee.ID).IsEqualTo(GlobalVariables.EmpID),
 
-                     new Columns<EmployeeQualification>(
 
-                         x => x.ID, //0
 
-                         x => x.Expiry, //1
 
-                         x => x.FrontPhoto.ID //2
 
-                         )
 
-                     );
 
-                 if (table.Rows.Any())
 
-                 {
 
-                     List<Guid> IDs = new List<Guid>();
 
-                     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] = DateTime.MinValue; } //1
 
-                         if (list[2] == null) { list[2] = Guid.Empty; } //2
 
-                         if (DateTime.Parse(list[1].ToString()) <= DateTime.Today.AddDays(30))
 
-                         {
 
-                             if (!Guid.Parse(list[2].ToString()).Equals(Guid.Empty))
 
-                             {
 
-                                 CoreTable innerTable = new Client<Document>().Query(
 
-                                     new Filter<Document>(x => x.ID).IsEqualTo(Guid.Parse(list[2].ToString())),
 
-                                     new Columns<Document>(x => x.Created)
 
-                                     );
 
-                                 CoreRow innerRow = innerTable.Rows.First();
 
-                                 List<object> innerList = innerRow.Values;
 
-                                 if (DateTime.Parse(innerList[0].ToString()) < DateTime.Today.AddDays(-7)) //if photo was added more than 7 days ago, added to list needing attention
 
-                                 {
 
-                                     if (!IDs.Contains(Guid.Parse(list[0].ToString())))
 
-                                         IDs.Add(Guid.Parse(list[0].ToString()));
 
-                                 }
 
-                             }
 
-                             else
 
-                             {
 
-                                 if (!IDs.Contains(Guid.Parse(list[0].ToString())))
 
-                                     IDs.Add(Guid.Parse(list[0].ToString()));
 
-                             }
 
-                         }
 
-                         if (Guid.Parse(list[2].ToString()).Equals(Guid.Empty))
 
-                         {
 
-                             if (!IDs.Contains(Guid.Parse(list[0].ToString())))
 
-                                 IDs.Add(Guid.Parse(list[0].ToString()));
 
-                         }
 
-                     }
 
-                     GlobalVariables.QualificationsNeedingAttention = IDs.Count;
 
-                 }
 
-                 CoreTable table1 = new Client<EmployeeForm>().Query(
 
-                     new Filter<EmployeeForm>(x => x.Parent.ID).IsEqualTo(GlobalVariables.EmpID).And
 
-                     (x => x.FormCompleted).IsEqualTo(DateTime.MinValue),
 
-                     new Columns<EmployeeForm>(x => x.FormCompleted)
 
-                     );
 
-                 if (table1.Rows.Any())
 
-                 {
 
-                     GlobalVariables.EmployeeFormsToDo = table1.Rows.Count;
 
-                 }
 
-                 if (GlobalVariables.QualificationsNeedingAttention > 0 || GlobalVariables.EmployeeFormsToDo > 0)
 
-                 {
 
-                     return true;
 
-                 }
 
-                 else
 
-                     return false;
 
-             }
 
-             catch
 
-             {
 
-                 return false;
 
-             }
 
-         }
 
-         public static void CheckEmployeeFormsToDo()
 
-         {
 
-             try
 
-             {
 
-                 CoreTable table1 = new Client<EmployeeForm>().Query(
 
-                     new Filter<EmployeeForm>(x => x.Parent.ID).IsEqualTo(GlobalVariables.EmpID).And
 
-                     (x => x.FormCompleted).IsEqualTo(DateTime.MinValue),
 
-                     new Columns<EmployeeForm>(x => x.FormCompleted)
 
-                     );
 
-                 if (table1.Rows.Any())
 
-                 {
 
-                     GlobalVariables.EmployeeFormsToDo = table1.Rows.Count;
 
-                 }
 
-                 else
 
-                 {
 
-                     GlobalVariables.EmployeeFormsToDo = 0;
 
-                 }
 
-             }
 
-             catch
 
-             { 
 
-             
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |