40766b24-ff74-431b-b387-6c221ede77cf true p3121-sql-02.sdt.local jazz prd UNC 20180206.1 true <ProgramFilesX64>\Microsoft SDKs\Azure\.NET SDK\v2.9\bin\plugins\Diagnostics\Newtonsoft.Json.dll Amazon.Lambda.S3Events AWSSDK.Core AWSSDK.S3 Amazon Amazon.Auth.AccessControlPolicy Amazon.Auth.AccessControlPolicy.ActionIdentifiers Amazon.Internal Amazon.Lambda.S3Events Amazon.MissingTypes Amazon.Runtime Amazon.Runtime.CredentialManagement Amazon.Runtime.CredentialManagement.Internal Amazon.Runtime.EventStreams Amazon.Runtime.EventStreams.Internal Amazon.Runtime.Internal Amazon.Runtime.Internal.Auth Amazon.Runtime.Internal.Settings Amazon.Runtime.Internal.Transform Amazon.Runtime.Internal.Util Amazon.Runtime.SharedInterfaces Amazon.Runtime.SharedInterfaces.Internal Amazon.S3 Amazon.S3.Encryption Amazon.S3.Encryption.Internal Amazon.S3.Internal Amazon.S3.IO Amazon.S3.Model Amazon.S3.Model.Internal.MarshallTransformations Amazon.S3.Transfer Amazon.S3.Util Amazon.Util Amazon.Util.Internal Amazon.Util.Internal.PlatformServices Newtonsoft.Json Newtonsoft.Json.Converters Newtonsoft.Json.Linq Newtonsoft.Json.Schema Newtonsoft.Json.Serialization System System.Diagnostics System.Diagnostics.Tracing System.IO.Compression ThirdParty.BouncyCastle.Asn1 ThirdParty.BouncyCastle.Asn1.Utilities ThirdParty.BouncyCastle.Math ThirdParty.BouncyCastle.OpenSsl ThirdParty.BouncyCastle.Utilities.IO.Pem ThirdParty.Ionic.Zlib ThirdParty.Json.LitJson ThirdParty.MD5 void Main() { var validPayPeriods = PayPeriodCycles .GroupBy(g => new { g.PayCycleID, g.PayCycleName }, (g, pp) => new { g.PayCycleID, g.PayCycleName, PayPeriods = pp.Select(p => new payperiodtiming { PayPeriodID = p.PayPeriodID, PeriodEndCalendarDate = p.PeriodEndCalendarDate, PeriodStartCalendarDate = p.PeriodStartCalendarDate }).OrderByDescending(p => p.PeriodEndCalendarDate).Take(6) }) .SelectMany(g => g.PayPeriods); DeptPayPeriods .ToList() // .OrderBy(dpp => dpp.DepartmentID) // .ThenByDescending(dpp => dpp.PayPeriodID) .GroupBy(dpp => new { dpp.DepartmentID, dpp.Department }, (g, dpp) => new deptpayperiodtiming { DepartmentID = g.DepartmentID, Department = g.Department, PayPeriodTimings = dpp.Select(d => d.PayPeriodID).Distinct() .Join(validPayPeriods, x => x, vpp => vpp.PayPeriodID, (x, vpp) => vpp) .OrderByDescending(d => d.PayPeriodID) }) .Where(dpp => dpp.PayPeriodTimings.Any()) .Dump("Department PayPeriods"); } public void ShowCycles() { PayPeriodCycles .GroupBy(g => new { g.PayCycleID, g.PayCycleName }, (g, pp) => new { g.PayCycleID, g.PayCycleName, PayPeriods = pp.Select(p => new payperiodtiming { PayPeriodID = p.PayPeriodID, PeriodEndCalendarDate = p.PeriodEndCalendarDate, PeriodStartCalendarDate = p.PeriodStartCalendarDate }).OrderByDescending(p => p.PeriodEndCalendarDate).Take(6) }) .Dump("Pay Period Cycles"); } public IEnumerable DeptPayPeriods => (from fact in FactPayrollSampledPayPeriods join dept in DimDepartments on fact.DepartmentID equals dept.DepartmentID select new deptpayperiod { PayPeriodID = fact.PayPeriodID, DepartmentID = fact.DepartmentID, Department = dept.Name }).Union((from fact in ViewPrimaryStatisticsStaffingByPayPeriod join dept in DimDepartments on fact.DepartmentID equals dept.DepartmentID select new deptpayperiod { PayPeriodID = fact.PayPeriodID, DepartmentID = fact.DepartmentID, Department = dept.Name })).Distinct(); public IEnumerable PayPeriodCycles => from pp in DimPayPeriods where pp.PeriodEndCalendarDate < DateTime.Now select new payperiodcycle { PayPeriodID = pp.PayPeriodID, PayCycleID = pp.PayCycleID, PayCycleName = pp.PayCycleName, PeriodEndCalendarDate = pp.PeriodEndCalendarDate, PeriodStartCalendarDate = pp.PeriodStartCalendarDate }; // Define other methods and classes here public class deptpayperiod { public short PayPeriodID { get; set; } public int DepartmentID { get; set; } public string Department { get; set; } } public class deptpayperiodtiming { public int DepartmentID { get; set; } public string Department { get; set; } internal IEnumerable PayPeriodTimings { get; set; } public IDictionary PayPeriods => PayPeriodTimings.ToDictionary(ppt => ppt.PayPeriodID, ppt => new payperioddate { PeriodStartCalendarDate = ppt.PeriodStartCalendarDate, PeriodEndCalendarDate = ppt.PeriodEndCalendarDate }); public DateTime? PeriodStartDate => PayPeriodTimings.OrderByDescending(ppt => ppt.PayPeriodID).First().PeriodStartCalendarDate; public DateTime? PeriodEndDate => PayPeriodTimings.OrderByDescending(ppt => ppt.PayPeriodID).First().PeriodEndCalendarDate; } public class payperioddate { public DateTime PeriodEndCalendarDate { get; set; } public DateTime? PeriodStartCalendarDate { get; set; } object ToDump() => new { PeriodStartDate = $"{PeriodStartCalendarDate:yyyy MM dd}", PeriodEndDate = $"{PeriodEndCalendarDate:yyyy MM dd}" }; } public class payperiodtiming : payperioddate { public short PayPeriodID { get; set; } object ToDump() => new { PayPeriodID = $"{PayPeriodID}", PeriodStartDate = $"{PeriodStartCalendarDate:yyyy MM dd}", PeriodEndDate = $"{PeriodEndCalendarDate:yyyy MM dd}" }; } public class payperiodcycle : payperiodtiming { public int PayCycleID { get; set; } public string PayCycleName { get; set; } }