Boolean MaxMonExceeded(string plancode, string trancode, string yrmo, DateTime effdt) { WashRules wobj = new WashRules(); int _mnthDiff = wobj.MonthDifference(effdt, yrmo); int _day = effdt.Day; int maxmonths; if (plancode.Contains("P5")) { maxmonths = 4; } else { maxmonths = 3; } if (_mnthDiff == maxmonths) { if (_day < 15 && (!trancode.Equals("TERM"))) { return(true); } if (trancode.Equals("TERM")) { return(true); } } if (_mnthDiff > maxmonths) { return(true); } return(false); }
DataSet GetManualAdjustments(string yrmo, string plancode) { IPBA_DAL dobj = new IPBA_DAL(); WashRules wobj = new WashRules(); DataSet dsTemp = new DataSet(); dsTemp.Clear(); DataSet dsManAdj = new DataSet(); dsManAdj.Clear(); DataTable tblManAdj = dsManAdj.Tables.Add("Table"); DataRow row1; DataColumn col; System.Type typeDecimal = System.Type.GetType("System.Decimal"); col = new DataColumn("Py"); tblManAdj.Columns.Add(col); col = new DataColumn("Class"); tblManAdj.Columns.Add(col); col = new DataColumn("Type"); tblManAdj.Columns.Add(col); col = new DataColumn("SSN"); tblManAdj.Columns.Add(col); col = new DataColumn("Name"); tblManAdj.Columns.Add(col); col = new DataColumn("YRMO"); tblManAdj.Columns.Add(col); col = new DataColumn("PriorTier"); tblManAdj.Columns.Add(col); col = new DataColumn("Tier"); tblManAdj.Columns.Add(col); col = new DataColumn("Comments"); tblManAdj.Columns.Add(col); col = new DataColumn("Months"); tblManAdj.Columns.Add(col); col = new DataColumn("Rate", typeDecimal); tblManAdj.Columns.Add(col); col = new DataColumn("typecd"); tblManAdj.Columns.Add(col); col = new DataColumn("flag"); tblManAdj.Columns.Add(col); DateTime effdt; string exprCHG, yrmocalc; int months; string _flag = ""; dsTemp = dobj.GetManAdjData(yrmo, plancode, "NEW"); foreach (DataRow row in dsTemp.Tables[0].Rows) { effdt = Convert.ToDateTime(row["Eff Dt"]); months = wobj.washRuleADD(effdt, yrmo, plancode); _flag = ""; if (MaxMonExceeded(plancode, "NEW", yrmo, effdt)) { _flag = "*"; } if (months != 0) { for (int i = 1; i <= months; i++) { row1 = tblManAdj.NewRow(); row1["Py"] = yrmo.Substring(0, 4); row1["Class"] = row["Class"]; row1["Type"] = row["Type"]; row1["SSN"] = row["SSN"]; row1["Name"] = row["Name"]; row1["YRMO"] = GetYRMO(yrmo, (i - 1)); row1["Tier"] = row["Tier"]; if (row["Class"].ToString().Equals("COBRA") || row["Class"].ToString().Equals("COBRA Pilot")) { if (row["Comments"].ToString().Contains("NEW ENROLLEE EFF: ")) { row1["Comments"] = row["Comments"].ToString().Replace("NEW ENROLLEE EFF: ", "COBRA RETRO PAYMENT - EFF DT: "); } else { row1["Comments"] = row["Comments"].ToString().Replace("RETRO CVG EFF: ", "COBRA RETRO PAYMENT - EFF DT: "); } } else { row1["Comments"] = row["Comments"]; } row1["Months"] = 1; row1["Rate"] = dobj.GetRate(GetYRMO(yrmo, (i - 1)), row["Class"].ToString(), plancode, row["Tier"].ToString()); row1["typecd"] = row["typecd"]; row1["flag"] = _flag; tblManAdj.Rows.Add(row1); } } } dsTemp.Clear(); dsTemp = dobj.GetManAdjData(yrmo, plancode, "TERM"); foreach (DataRow row in dsTemp.Tables[0].Rows) { effdt = Convert.ToDateTime(row["Eff Dt"]); months = wobj.washRuleTERM(effdt, yrmo, plancode); _flag = ""; if (MaxMonExceeded(plancode, "TERM", yrmo, effdt)) { _flag = "*"; } if (months != 0) { for (int i = 1; i <= System.Math.Abs(months); i++) { if (months < 0) { yrmocalc = GetYRMO(yrmo, i); } else { yrmocalc = yrmo; } row1 = tblManAdj.NewRow(); row1["Py"] = yrmo.Substring(0, 4); row1["Class"] = row["Class"]; row1["Type"] = row["Type"]; row1["SSN"] = row["SSN"]; row1["Name"] = row["Name"]; row1["YRMO"] = yrmocalc; row1["Tier"] = row["Tier"]; if (row["Class"].ToString().Equals("COBRA") || row["Class"].ToString().Equals("COBRA Pilot")) { if (months < 0) { row1["Comments"] = row["Comments"].ToString().Replace("TERMINATED CVG EFF: ", "COBRA RETRO CREDIT - EFF DT: "); } else { row1["Comments"] = row["Comments"].ToString().Replace("TERMINATED CVG EFF: ", "COBRA RETRO PAYMENT - EFF DT: "); } } else { row1["Comments"] = row["Comments"]; } if (months < 0) { row1["Months"] = -1; row1["Rate"] = (-1) * dobj.GetRate(yrmocalc, row["Class"].ToString(), plancode, row["Tier"].ToString()); } else { row1["Months"] = 1; row1["Rate"] = dobj.GetRate(yrmocalc, row["Class"].ToString(), plancode, row["Tier"].ToString()); } row1["typecd"] = row["typecd"]; row1["flag"] = _flag; tblManAdj.Rows.Add(row1); } } } dsTemp.Clear(); dsTemp = dobj.GetManAdjData(yrmo, plancode, "CHG"); foreach (DataRow row in dsTemp.Tables[0].Rows) { effdt = Convert.ToDateTime(row["Eff Dt"]); exprCHG = wobj.washRuleCHG(effdt, yrmo, plancode); months = GetMonthsManAdjCHG(exprCHG); _flag = ""; if (MaxMonExceeded(plancode, "CHG", yrmo, effdt)) { _flag = "*"; } for (int i = 1; i <= months; i++) { row1 = tblManAdj.NewRow(); row1["Py"] = yrmo.Substring(0, 4); row1["Class"] = row["Class"]; row1["Type"] = row["Type"]; row1["SSN"] = row["SSN"]; row1["Name"] = row["Name"]; row1["YRMO"] = GetYRMO(yrmo, (i - 1)); row1["PriorTier"] = row["PriorTier"]; row1["Tier"] = row["Tier"]; row1["Comments"] = row["Comments"]; row1["Months"] = 1; row1["Rate"] = GetManAdjAmtCHG(i, yrmo, exprCHG, row["Class"].ToString(), plancode, row["Tier"].ToString(), row["PriorTier"].ToString()); row1["typecd"] = row["typecd"]; row1["flag"] = _flag; tblManAdj.Rows.Add(row1); if (exprCHG.Equals("1-")) { continue; } } } dsTemp.Clear(); return(dsManAdj); }