internal static decimal GetValueForPeriod(this PeriodisedValuesEntity entity, int periodNumber) { switch (periodNumber) { case 1: return(entity.Period_1); case 2: return(entity.Period_2); case 3: return(entity.Period_3); case 4: return(entity.Period_4); case 5: return(entity.Period_5); case 6: return(entity.Period_6); case 7: return(entity.Period_7); case 8: return(entity.Period_8); case 9: return(entity.Period_9); case 10: return(entity.Period_10); case 11: return(entity.Period_11); case 12: return(entity.Period_12); } throw new IndexOutOfRangeException("Invalid periodNumber. Must be between 1 and 12 inclusive"); }
private static void PopulateEarnedByPeriodValues(string academicYear, Dictionary <string, decimal> earnedByPeriod, PeriodisedValuesEntity periodEarnings) { earnedByPeriod.AddOrUpdate("08/" + academicYear.Substring(0, 2), periodEarnings.Period_1); earnedByPeriod.AddOrUpdate("09/" + academicYear.Substring(0, 2), periodEarnings.Period_2); earnedByPeriod.AddOrUpdate("10/" + academicYear.Substring(0, 2), periodEarnings.Period_3); earnedByPeriod.AddOrUpdate("11/" + academicYear.Substring(0, 2), periodEarnings.Period_4); earnedByPeriod.AddOrUpdate("12/" + academicYear.Substring(0, 2), periodEarnings.Period_5); earnedByPeriod.AddOrUpdate("01/" + academicYear.Substring(2), periodEarnings.Period_6); earnedByPeriod.AddOrUpdate("02/" + academicYear.Substring(2), periodEarnings.Period_7); earnedByPeriod.AddOrUpdate("03/" + academicYear.Substring(2), periodEarnings.Period_8); earnedByPeriod.AddOrUpdate("04/" + academicYear.Substring(2), periodEarnings.Period_9); earnedByPeriod.AddOrUpdate("05/" + academicYear.Substring(2), periodEarnings.Period_10); earnedByPeriod.AddOrUpdate("06/" + academicYear.Substring(2), periodEarnings.Period_11); earnedByPeriod.AddOrUpdate("07/" + academicYear.Substring(2), periodEarnings.Period_12); }