private static IEnumerable <PayerPlanPeriod> GetPayerPlanPeriods(string destination) { var dataText = File.ReadAllLines(destination); foreach (var line in dataText) { var pp = new PayerPlanPeriod { StartDate = DateTime.Parse(line.Split('\t')[0]), EndDate = DateTime.Parse(line.Split('\t')[1]), PayerSourceValue = line.Split('\t')[2].Trim().ToLower() == "null" ? null : line.Split('\t')[2].Trim(), PlanSourceValue = line.Split('\t').Count() > 3 && line.Split('\t')[3].Trim().ToLower() != "null" ? line.Split('\t')[3].Trim() : null }; pp.AdditionalFields = new Dictionary <string, string>(); pp.AdditionalFields.Add("plantyp", pp.PayerSourceValue); if (line.Split('\t').Count() == 5) { pp.AdditionalFields.Add("datatyp", line.Split('\t')[4].Trim().ToLower() == "null" ? null : line.Split('\t')[4].Trim()); } yield return(pp); } }
/// <summary> /// Condition for the combining two periods /// </summary> /// <param name="current">1st period</param> /// <param name="other">2nd period</param> /// <returns>Can those periods be combined</returns> public virtual bool CanPayerPlanPeriodBeCombined(PayerPlanPeriod current, PayerPlanPeriod other) { if (string.IsNullOrEmpty(current.PlanSourceValue)) { return(current.PayerSourceValue == other.PayerSourceValue); } return(current.PlanSourceValue == other.PlanSourceValue && current.PayerSourceValue == other.PayerSourceValue); }