diff --git a/DataCenter_Windows/WindowsDataCenter/Interfaces/AppDetails.cs b/DataCenter_Windows/WindowsDataCenter/Interfaces/AppDetails.cs new file mode 100644 index 0000000..c9195d9 --- /dev/null +++ b/DataCenter_Windows/WindowsDataCenter/Interfaces/AppDetails.cs @@ -0,0 +1,11 @@ +namespace Interfaces +{ + public class AppDetails + { + public string ApplicationName { get; set; } + public string Version { get; set; } + public string DataBaseProvider { get; set; } + public string LoggerProvider { get; set; } + public string ErrorEmailAddress { get; set; } + } +} diff --git a/DataCenter_Windows/WindowsDataCenter/Interfaces/Interfaces.csproj b/DataCenter_Windows/WindowsDataCenter/Interfaces/Interfaces.csproj index 5dec2a9..90c1283 100644 --- a/DataCenter_Windows/WindowsDataCenter/Interfaces/Interfaces.csproj +++ b/DataCenter_Windows/WindowsDataCenter/Interfaces/Interfaces.csproj @@ -40,6 +40,7 @@ + diff --git a/DataCenter_Windows/WindowsDataCenter/Interfaces/Properties/AssemblyInfo.cs b/DataCenter_Windows/WindowsDataCenter/Interfaces/Properties/AssemblyInfo.cs index b188278..9df079e 100644 --- a/DataCenter_Windows/WindowsDataCenter/Interfaces/Properties/AssemblyInfo.cs +++ b/DataCenter_Windows/WindowsDataCenter/Interfaces/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.1.2.0")] -[assembly: AssemblyFileVersion("0.1.2.0")] +[assembly: AssemblyVersion("0.1.4.0")] +[assembly: AssemblyFileVersion("0.1.4.0")] diff --git a/DataCenter_Windows/WindowsDataCenter/Interfaces/TimeLogList.cs b/DataCenter_Windows/WindowsDataCenter/Interfaces/TimeLogList.cs index 58d5191..5f08129 100644 --- a/DataCenter_Windows/WindowsDataCenter/Interfaces/TimeLogList.cs +++ b/DataCenter_Windows/WindowsDataCenter/Interfaces/TimeLogList.cs @@ -19,5 +19,6 @@ namespace Interfaces get { return Math.Round(TimeLogs.Sum(x => x.DailyTotal), 2); } } public float HoursPerWeekMinutes { get; set; } + public User UserInformation { get; set; } } } \ No newline at end of file diff --git a/DataCenter_Windows/WindowsDataCenter/Interfaces/User.cs b/DataCenter_Windows/WindowsDataCenter/Interfaces/User.cs index 2fca02f..b9e3214 100644 --- a/DataCenter_Windows/WindowsDataCenter/Interfaces/User.cs +++ b/DataCenter_Windows/WindowsDataCenter/Interfaces/User.cs @@ -21,5 +21,7 @@ namespace Interfaces } public List AssociatedIdentifiers { get; set; } + + public bool State { get; set; } } } \ No newline at end of file diff --git a/DataCenter_Windows/WindowsDataCenter/NLogLogger/Properties/AssemblyInfo.cs b/DataCenter_Windows/WindowsDataCenter/NLogLogger/Properties/AssemblyInfo.cs index b0b6e8c..03a903a 100644 --- a/DataCenter_Windows/WindowsDataCenter/NLogLogger/Properties/AssemblyInfo.cs +++ b/DataCenter_Windows/WindowsDataCenter/NLogLogger/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.1.2.0")] -[assembly: AssemblyFileVersion("0.1.2.0")] +[assembly: AssemblyVersion("0.1.4.0")] +[assembly: AssemblyFileVersion("0.1.4.0")] diff --git a/DataCenter_Windows/WindowsDataCenter/SQLiteRepository/Properties/AssemblyInfo.cs b/DataCenter_Windows/WindowsDataCenter/SQLiteRepository/Properties/AssemblyInfo.cs index 13a4415..1a0a124 100644 --- a/DataCenter_Windows/WindowsDataCenter/SQLiteRepository/Properties/AssemblyInfo.cs +++ b/DataCenter_Windows/WindowsDataCenter/SQLiteRepository/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.1.2.0")] +[assembly: AssemblyVersion("0.1.4.0")] [assembly: AssemblyFileVersion("0.1.2.0")] diff --git a/DataCenter_Windows/WindowsDataCenter/SQLiteRepository/SQLiteProcedures.cs b/DataCenter_Windows/WindowsDataCenter/SQLiteRepository/SQLiteProcedures.cs index 4873cb6..a5488c3 100644 --- a/DataCenter_Windows/WindowsDataCenter/SQLiteRepository/SQLiteProcedures.cs +++ b/DataCenter_Windows/WindowsDataCenter/SQLiteRepository/SQLiteProcedures.cs @@ -2,28 +2,50 @@ namespace SQLiteRepository { internal static class SQLiteProcedures { - public const string GET_LOGS_IN_LAST_X_MINUTES= "select * from TimeLogDb where "+nameof(TimeLogDb.SwipeEventDateTime)+" > ? AND "+nameof(TimeLogDb.UserId_FK)+"=?"; - public const string GET_TIMELOGS = "select * from "+nameof(TimeLogDb)+ " where (" + nameof(TimeLogDb.UserId_FK) + "=? AND " + nameof(TimeLogDb.CalendarWeek) + "=? and " + nameof(TimeLogDb.Year) + "=?)"; - public const string GET_ALL_USERS = "select * from " + nameof(UserIdentity); - public const string GET_USER_BY_ID = "select * from " + nameof(UserIdentity) + " where " + nameof(UserIdentity.Id) + "=?"; + public const string GET_LOGS_IN_LAST_X_MINUTES = + "select * from TimeLogDb where " + nameof(TimeLogDb.SwipeEventDateTime) + " > ? AND " + + nameof(TimeLogDb.UserId_FK) + "=?"; - public const string GET_CARDS_BY_USER_ID = "select * from " + nameof(CardUniqueId) + " where " + nameof(CardUniqueId.UserId_FK) + "=?"; - public const string GET_CARDS_BY_UNIQUE_ID = "select * from " + nameof(CardUniqueId) + " where " + nameof(CardUniqueId.CardUId) + "=?"; - public const string GET_UNASSIGNED_CARD_LIST = "select * from " + nameof(CardUniqueId) + " where " + nameof(CardUniqueId.UserId_FK) + "=?"; + public const string GET_TIMELOGS = + "select * from " + nameof(TimeLogDb) + " where (" + nameof(TimeLogDb.UserId_FK) + "=? AND " + + nameof(TimeLogDb.CalendarWeek) + "=? and " + nameof(TimeLogDb.Year) + "=?)"; - public const string GET_USER_BY_FIRST_AND_LAST = - "select * from " + nameof(UserIdentity) + " where " + nameof(UserIdentity.FirstName) + " = ? AND " + nameof(UserIdentity.LastName) + " = ?"; + public const string GET_ALL_USERS = + "select * from " + nameof(UserIdentity) + " order by " + nameof(UserIdentity.LastName) + " collate nocase, " + + nameof(UserIdentity.FirstName) + " collate nocase"; - public const string UPDATE_CARD_USER_ID = "update " + nameof(CardUniqueId) + " set " + nameof(CardUniqueId.UserId_FK) + "=? where " + nameof(CardUniqueId.Id) + "=?"; + public const string GET_ALL_USERS_PAGINATE = + "select * from " + nameof(UserIdentity) + " order by " + nameof(UserIdentity.LastName) + " collate nocase, " + + nameof(UserIdentity.FirstName) + " collate nocase limit ? offset ?"; - public const string SEARCH_USER_LIST = "SELECT * FROM " + nameof(UserIdentity) + " where(" + nameof(UserIdentity.FirstName) + " Like ? OR " + nameof(UserIdentity.LastName) + " Like ?)"; + public const string GET_USER_BY_ID = + "select * from " + nameof(UserIdentity) + " where " + nameof(UserIdentity.Id) + "=?"; - public const string GET_LAST_TIMELOG_DIRECTION = "SELECT * FROM " + nameof(TimeLogDb) + " where " + nameof(TimeLogDb.UserId_FK) + " = ? order by " + nameof(TimeLogDb.SwipeEventDateTime) + " desc LIMIT 1"; + public const string GET_CARDS_BY_USER_ID = + "select * from " + nameof(CardUniqueId) + " where " + nameof(CardUniqueId.UserId_FK) + "=?"; - public const string GET_ALL_USERS_PAGINATE = "select * from "+ nameof(UserIdentity)+" limit ? offset ?"; + public const string GET_CARDS_BY_UNIQUE_ID = + "select * from " + nameof(CardUniqueId) + " where " + nameof(CardUniqueId.CardUId) + "=?"; - public const string GET_TOTAL_USER_COUNT = "select Max("+nameof(UserIdentity.Id)+") from " + nameof(UserIdentity); + public const string GET_UNASSIGNED_CARD_LIST = + "select * from " + nameof(CardUniqueId) + " where " + nameof(CardUniqueId.UserId_FK) + "=?"; - public const string GET_USER_CONTRACTED_HOURS = "select "+nameof(UserIdentity.HoursPerWeek)+ " From UserIdentity where " + nameof(UserIdentity.Id) + "=?"; + public const string UPDATE_CARD_USER_ID = + "update " + nameof(CardUniqueId) + " set " + nameof(CardUniqueId.UserId_FK) + "=? where " + + nameof(CardUniqueId.Id) + "=?"; + + public const string SEARCH_USER_LIST = + "SELECT * FROM " + nameof(UserIdentity) + " where(" + nameof(UserIdentity.FirstName) + " Like ? OR " + + nameof(UserIdentity.LastName) + " Like ?)"; + + public const string GET_LAST_TIMELOG_DIRECTION = + "SELECT * FROM " + nameof(TimeLogDb) + " where " + nameof(TimeLogDb.UserId_FK) + " = ? order by " + + nameof(TimeLogDb.SwipeEventDateTime) + " desc LIMIT 1"; + + public const string GET_TOTAL_USER_COUNT = + "select Max(" + nameof(UserIdentity.Id) + ") from " + nameof(UserIdentity); + + public const string GET_USER_CONTRACTED_HOURS = + "select " + nameof(UserIdentity.HoursPerWeek) + " From UserIdentity where " + nameof(UserIdentity.Id) + "=?"; } } \ No newline at end of file diff --git a/DataCenter_Windows/WindowsDataCenter/SQLiteRepository/SQLiteRepository.cs b/DataCenter_Windows/WindowsDataCenter/SQLiteRepository/SQLiteRepository.cs index 6745187..cfbbd77 100644 --- a/DataCenter_Windows/WindowsDataCenter/SQLiteRepository/SQLiteRepository.cs +++ b/DataCenter_Windows/WindowsDataCenter/SQLiteRepository/SQLiteRepository.cs @@ -82,6 +82,8 @@ namespace SQLiteRepository Id = card.Id }); } + userObj.State = GetUserState(GetLogDirection(user.Id)); + ret.Users.Add(userObj); } if (pageNumber == -1 && pageSize == -1) @@ -98,6 +100,17 @@ namespace SQLiteRepository return ret; } + private bool GetUserState(LogDirectionDb logDirection) + { + switch (logDirection) + { + case LogDirectionDb.OUT: + return true; + default: + return false; + } + } + public UserList Search(string searchParam) { _logger.Trace("Searching SQLite database for the term: {0}", searchParam); @@ -205,6 +218,7 @@ namespace SQLiteRepository _logger.Error(ex, "Error in GetUserContracterHours with Id: {0} and selected date: {1}, Exception: {2}", userId, selectedDate, ex); } + ret.UserInformation = GetUser(userId); return ret; } diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/App.config b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/App.config index 00e1396..e54d778 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/App.config +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/App.config @@ -3,7 +3,8 @@ - + + diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Controllers/ApplicationController.cs b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Controllers/ApplicationController.cs new file mode 100644 index 0000000..e9835fd --- /dev/null +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Controllers/ApplicationController.cs @@ -0,0 +1,27 @@ +using System.Configuration; +using System.Reflection; +using System.Web.Http; +using Interfaces; + +namespace WindowsDataCenter +{ + [RoutePrefix("api/app")] + public class ApplicationController:ApiController + { + [Route("")] + public IHttpActionResult GetAppDetails() + { + var ninjectHelper = NinjectHelper.GetInstance(); + var appDetails = new AppDetails + { + ApplicationName = "Flexitime Tracker", + DataBaseProvider = ninjectHelper.Get().GetType().ToString(), + LoggerProvider = ninjectHelper.Get().GetType().ToString(), + Version = Assembly.GetEntryAssembly().GetName().Version.ToString(), + ErrorEmailAddress = ConfigurationManager.AppSettings["BugSubmissionEmailAddress"] ?? "NONE" + }; + + return Ok(appDetails); + } + } +} diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Properties/AssemblyInfo.cs b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Properties/AssemblyInfo.cs index 970703e..59ba13e 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Properties/AssemblyInfo.cs +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.1.2.0")] -[assembly: AssemblyFileVersion("0.1.2.0")] +[assembly: AssemblyVersion("0.1.4.0")] +[assembly: AssemblyFileVersion("0.1.4.0")] diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/WindowsDataCenter.csproj b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/WindowsDataCenter.csproj index 03cfb28..518c4da 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/WindowsDataCenter.csproj +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/WindowsDataCenter.csproj @@ -147,6 +147,7 @@ + diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/index.html b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/index.html index 983b120..5948257 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/index.html +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/index.html @@ -37,6 +37,9 @@ + @@ -61,15 +64,24 @@ + - + @@ -116,6 +128,7 @@ +
@@ -186,54 +199,92 @@
-
- -
-
-
-
-
-
-
+
+
+
+ +
+

+ Logs for: +

+
+
+
+ +
+
+
+
-
- -
First Name Last Name Contractor +
+ + IN + + + OUT + +
- - - - - - - - - - - - - - - - - - - - - - + +
+ +
Day Of WeekInOutSub-Total
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Day Of WeekInOut Sub-Total
Weekly Total
+ + + + + +