Esempio n. 1
0
        public IEnumerable <DutyStatusLog> LogRecordsToCompare()
        {
            PTC.Log.MethodStart();
            PTC.Log.Info("Gathering log list....");
            List <DutyStatusLogType> bindLogTypes = LogTypesToUse();

            DutyStatusLogSearch statusSearch = new DutyStatusLogSearch
            {
                FromDate            = lastTime.ReadLastRunFile().AddDays(-14),
                ToDate              = DateTime.UtcNow,
                Statuses            = bindLogTypes,
                IncludeBoundaryLogs = true
            };

            List <DutyStatusLog> logRecordList = geotabCalls.GetLogList(statusSearch).ToList();

            PTC.Log.Info($"{logRecordList.Count()} logs found...");

            PTC.Log.MethodEnd();

            return(logRecordList);
        }
        // change to the one method above
        public IEnumerable <TimeCardModel> CreatePunches()
        {
            Log.MethodStart();
            Log.Info("Creating log punches....");

            List <DutyStatusLogType> bindLogTypes = new List <DutyStatusLogType>();

            bindLogTypes.Add(DutyStatusLogType.D);
            bindLogTypes.Add(DutyStatusLogType.ON);
            bindLogTypes.Add(DutyStatusLogType.YM);
            bindLogTypes.Add(DutyStatusLogType.OFF);
            bindLogTypes.Add(DutyStatusLogType.SB);
            bindLogTypes.Add(DutyStatusLogType.PC);
            bindLogTypes.Add(DutyStatusLogType.WT);

            DutyStatusLogSearch logSearch = new DutyStatusLogSearch
            {
                FromDate            = lastRunTime.ReadLastRunFile(), // last run datetime, store in a temp file to obtain this, a separate have window service create it. once ask finshes, update file with last run date (dattimenow). Create new class (potentially interface) for it, separate methods that grabs stores and update
                ToDate              = DateTime.UtcNow,
                Statuses            = bindLogTypes,
                IncludeBoundaryLogs = true
            };

            Log.Info($"Logsearch for {logSearch.FromDate} to {logSearch.ToDate}...");

            List <DutyStatusLog> listOfLogs = geotabCalls.GetLogList(logSearch).OrderBy(y => y.DateTime).OrderBy(x => x.Driver.Id).ToList();

            Log.Info($"{listOfLogs.Count()} logs were found...");

            List <GeotabInfoModel> listOfGeotabInfo = logcycle.GetGeotabInfo(listOfLogs).ToList();

            //TODO: not duplicating the duty status log types
            List <TimeCardModel> punches = CreateTimeCard(listOfGeotabInfo);

            Log.MethodEnd();

            return(punches);
        }
Esempio n. 3
0
        public IEnumerable <GeotabInfoModel> GetGeotabInfo(List <User> driverList)
        {
            List <GeotabInfoModel> listOfGeotabInfo = new List <GeotabInfoModel>();

            List <DutyStatusLogType> bindLogTypes = LogTypesToUse();

            foreach (var driver in driverList)
            {
                PTC.Log.Info($"Associating {driver.Name} to the log list....");
                DutyStatusLogSearch statusSearch = new DutyStatusLogSearch
                {
                    UserSearch = new UserSearch {
                        Id = driver.Id
                    },
                    FromDate            = lastTime.ReadLastRunFile(), // last run datetime, store in a temp file to obtain this, a separate have window service create it. once ask finshes, update file with last run date (dattimenow). Create new class (potentially interface) for it, separate methods that grabs stores and update
                    ToDate              = DateTime.UtcNow,
                    Statuses            = bindLogTypes,
                    IncludeBoundaryLogs = true
                };

                List <DutyStatusLog> logRecordList = geotabCalls.GetLogList(statusSearch).ToList();

                GeotabInfoModel geotabInfo = new GeotabInfoModel
                {
                    FirstName      = driver.FirstName,
                    LastName       = driver.LastName,
                    EmployeeNumber = driver.EmployeeNo,
                    Logs           = logRecordList
                };

                if (geotabInfo.FirstName != "**<No User>")
                {
                    listOfGeotabInfo.Add(geotabInfo);
                }
            }
            return(listOfGeotabInfo);
        }
Esempio n. 4
0
        public IEnumerable <DutyStatusLog> GetLogList(DutyStatusLogSearch logSearch)
        {
            var logList = api.CallAsync <List <DutyStatusLog> >(GET, typeof(DutyStatusLog), new { search = logSearch }).Result;

            return(logList);
        }