Esempio n. 1
0
        public EfficiencyShift(
            [CanBeNull] Employee employee,
            EfficiencyTimeSheet timeSheet,
            DateTime siteNow,
            string[] siteEmployeeCodes,
            [CanBeNull] EmployeeShiftSupevisor employeeShiftSupevisor,
            EfficiencyTransactionType[] transactionTypes,
            BusinessUnitType businessUnitType) :
            this(
                employee,
                employeeShiftSupevisor,
                siteEmployeeCodes,
                transactionTypes,
                businessUnitType)
        {
            StartTime       = timeSheet.PunchInTime;
            IsClockedIn     = !timeSheet.PunchOutTime.HasValue || timeSheet.PunchOutTime > siteNow;
            EndTime         = IsClockedIn ? MinDate(siteNow, timeSheet.PunchOutTime) : timeSheet.PunchOutTime.Value;
            OperationalDate = timeSheet.OperationalDate;


            ShiftCode            = timeSheet.ShiftCode;
            SiteCode             = timeSheet.SiteCode;
            WorkedWorkCenterCode = timeSheet.WorkedWorkCenterCode;
            TimeSheetId          = timeSheet.TimeSheetId;

            IsTransactional         = employee?.IsTransactional == true && timeSheet.IsTransactionalWorkCenter != false;
            IsEmployeeTransactional = employee?.IsTransactional ?? true;                        //Chandra;
            WorkcenterType          = timeSheet.WorkcenterType ?? WorkcenterType.TRANSACTIONAL; //Chandra
        }
Esempio n. 2
0
        public EfficiencyShift(
            [CanBeNull] Employee employee,
            bool isLtl,
            string siteCode,
            IReadOnlyCollection <string> siteEmployeeCodes,
            EfficiencyTransactionType[] transactionTypes,
            BusinessUnitType businessUnitType,
            [CanBeNull] EmployeeShiftSupevisor employeeShiftSupevisor = null) :
            this(
                employee,
                employeeShiftSupevisor,
                siteEmployeeCodes,
                transactionTypes,
                businessUnitType)
        {
            IsClockedIn = false;

            ShiftCode            = null;
            SiteCode             = siteCode;
            WorkedWorkCenterCode = null;
            TimeSheetId          = null;

            IsTransactional         = !isLtl && (employee?.IsTransactional ?? true);
            IsEmployeeTransactional = !isLtl && (employee?.IsTransactional ?? true);
            WorkcenterType          = WorkcenterType.TRANSACTIONAL;
        }
Esempio n. 3
0
        private EfficiencyShift(
            [CanBeNull] Employee employee,
            [CanBeNull] EmployeeShiftSupevisor employeeShiftSupevisor,
            IReadOnlyCollection <string> siteEmployeeCodes,
            [CanBeNull] EfficiencyTransactionType[] transactionTypes,
            BusinessUnitType businessUnitType)
        {
            EmployeeNumber     = employee?.Number;
            EmployeeFullName   = employee?.FullName;
            Supervisor         = employee?.SupervisorFullName;
            ShiftSupervisor    = employeeShiftSupevisor?.Supervisor?.FullName;
            EmployeeJobCode    = employee?.JobCode;
            SalaryClassCode    = employee?.SalaryClassCode;
            IsPartTimeEmployee = employee?.IsPartTime ?? false;
            SiteEmployeeCodes  = siteEmployeeCodes.Distinct(StringComparer.OrdinalIgnoreCase).ToArray();

            TransactionTypes = transactionTypes ?? new EfficiencyTransactionType[0];
            BusinessUnitType = businessUnitType;
        }
        private IEnumerable <EfficiencyShift> GetOrphanedShifts([NotNull] string siteCode, bool isLtl, [NotNull] IReadOnlyCollection <string> siteEmployeeCodes,
                                                                [NotNull] IEnumerable <EfficiencyTimeSheet> knownTimeSheets, DateTime startTime, DateTime endTime, EfficiencyTransactionType[] transactionTypes,
                                                                BusinessUnitType businessUnitType, [CanBeNull] Employee employee = null, [CanBeNull] EmployeeShiftSupevisor employeeShiftSupevisor = null)
        {
            var transactionCacheRepository = _transactionCacheRepositoryFactory.GetCurrent();
            var transactions = transactionCacheRepository.GetTransactionsByDateRange(siteCode, siteEmployeeCodes, startTime, endTime);

            EfficiencyShift ShiftFactory() => new EfficiencyShift(employee, isLtl, siteCode, siteEmployeeCodes, transactionTypes, businessUnitType, employeeShiftSupevisor);

            return(TimeSheetShiftHelpers.GetOrphanShifts(ShiftFactory, knownTimeSheets, transactions.OrderBy(t => t.TransactionDate)));
        }