Esempio n. 1
0
        private async void SendUpdates()
        {
            EmployeeLogFilter employeeLogFilter = new EmployeeLogFilter
            {
                LogDateFrom = DateTime.Now.AddHours(-1),
                LogDateTo   = DateTime.Now
            };
            var employeeLogs = await _iEmployeeLogApi.Read(employeeLogFilter);

            var emailNotificationbody = EmployeeLogNotification(employeeLogs);

            EmailNotification emailNotification = new EmailNotification
            {
                Body = emailNotificationbody,
                To   = ConfigurationManager.AppSettings["ElectronicLogbookNotificationEmail"]
            };

            emailNotification = await _iEmailNotificationApi.Create(emailNotification);

            Application.ExitThread();
        }
        public IHttpActionResult Read(EmployeeLogFilter employeeLogFilter)
        {
            var employees    = _iFEmployee.Read();
            var employeeLogs = _iFEmployeeLog.Read(employeeLogFilter);
            var logTypes     = _iFLogType.Read();

            foreach (var employeeLog in employeeLogs)
            {
                var employee = employees.FirstOrDefault(a => a.EmployeeId == employeeLog.EmployeeId);
                if (employee != null)
                {
                    employeeLog.FirstName  = employee.FirstName;
                    employeeLog.LastName   = employee.LastName;
                    employeeLog.MiddleName = employee.MiddleName;
                }

                var logType = logTypes.FirstOrDefault(a => a.LogTypeId == employeeLog.LogTypeId);
                if (logType != null)
                {
                    employeeLog.LogType = logType.Name;
                }
            }
            return(Ok(employeeLogs));
        }
Esempio n. 3
0
        public List <EmployeeLog> Read(EmployeeLogFilter employeeLogFilter)
        {
            List <EEmployeeLog> eEmployeeLogs = _iDEmployeeLog.List <EEmployeeLog>(a => a.LogDate >= employeeLogFilter.LogDateFrom && a.LogDate <= employeeLogFilter.LogDateTo);

            return(EmployeeLogs(eEmployeeLogs));
        }
 public async Task <List <EmployeeLog> > Read(EmployeeLogFilter employeeLogFilter)
 {
     DestinationUrl = "/api/EmployeeLogApi/Read";
     return(await PostWithAuthentication <List <EmployeeLog>, EmployeeLogFilter>(employeeLogFilter));
 }