public DataSet GetStatChgData(DataSet dsCurr) { string statcd_1, statcd_2; Boolean _found; DataSet dsPrev = new DataSet(); dsPrev.Clear(); DataSet dsResult = new DataSet(); dsResult.Clear(); DataTable dsTable; dsTable = dsResult.Tables.Add("dsStatChg"); DataRow row; DataColumn col; col = new DataColumn("EE#"); dsTable.Columns.Add(col); col = new DataColumn("Name"); dsTable.Columns.Add(col); col = new DataColumn("Status Code"); dsTable.Columns.Add(col); col = new DataColumn("Status Date"); dsTable.Columns.Add(col); dsPrev = HRAOperDAL.GetPrevEligData("EligStat"); foreach (DataRow row1 in dsCurr.Tables[0].Rows) { _found = false; if (dsPrev.Tables.Count > 0) { foreach (DataRow row2 in dsPrev.Tables[0].Rows) { if ((row1["empno"].ToString()).Equals(row2["empno"].ToString())) { _found = true; statcd_1 = row1["statcd"].ToString().Trim().ToUpper(); statcd_2 = row2["statcd"].ToString().Trim().ToUpper(); if (!statcd_1.Equals(statcd_2)) { row = dsTable.NewRow(); row["EE#"] = row1["empno"]; row["Name"] = row1["name"]; row["Status Code"] = row1["statcd"]; row["Status Date"] = row1["statdt"]; dsTable.Rows.Add(row); } break; } } } if (!_found) { row = dsTable.NewRow(); row["EE#"] = row1["empno"]; row["Name"] = row1["name"]; row["Status Code"] = row1["statcd"]; row["Status Date"] = row1["statdt"]; dsTable.Rows.Add(row); } } return(dsResult); }
public DataSet GetAddrChgData(DataSet dsCurr) { string addr1_1, addr1_2, addr2_1, addr2_2, city_1, city_2, state_1, state_2, zip_1, zip_2; Boolean _found; DataSet dsPrev = new DataSet(); dsPrev.Clear(); DataSet dsResult = new DataSet(); dsResult.Clear(); DataTable dsTable; dsTable = dsResult.Tables.Add("dsAddrChg"); DataRow row; DataColumn col; col = new DataColumn("EE#"); dsTable.Columns.Add(col); col = new DataColumn("Name"); dsTable.Columns.Add(col); col = new DataColumn("Prior Addr1"); dsTable.Columns.Add(col); col = new DataColumn("Prior Addr2"); dsTable.Columns.Add(col); col = new DataColumn("Prior City"); dsTable.Columns.Add(col); col = new DataColumn("Prior State"); dsTable.Columns.Add(col); col = new DataColumn("Prior Zip"); dsTable.Columns.Add(col); col = new DataColumn("New Addr1"); dsTable.Columns.Add(col); col = new DataColumn("New Addr2"); dsTable.Columns.Add(col); col = new DataColumn("New City"); dsTable.Columns.Add(col); col = new DataColumn("New State"); dsTable.Columns.Add(col); col = new DataColumn("New Zip"); dsTable.Columns.Add(col); dsPrev = HRAOperDAL.GetPrevEligData("EligAddr"); foreach (DataRow row1 in dsCurr.Tables[0].Rows) { _found = false; if (dsPrev.Tables.Count > 0) { foreach (DataRow row2 in dsPrev.Tables[0].Rows) { if ((row1["empno"].ToString()).Equals(row2["empno"].ToString())) { _found = true; addr1_1 = row1["addr1"].ToString().Trim().ToUpper(); addr1_2 = row2["addr1"].ToString().Trim().ToUpper(); addr2_1 = row1["addr2"].ToString().Trim().ToUpper(); addr2_2 = row2["addr2"].ToString().Trim().ToUpper(); city_1 = row1["city"].ToString().Trim().ToUpper(); city_2 = row2["city"].ToString().Trim().ToUpper(); state_1 = row1["state"].ToString().Trim().ToUpper(); state_2 = row2["state"].ToString().Trim().ToUpper(); zip_1 = row1["zip"].ToString().Trim().ToUpper(); zip_2 = row2["zip"].ToString().Trim().ToUpper(); if ((!addr1_1.Equals(addr1_2)) || (!addr2_1.Equals(addr2_2)) || (!city_1.Equals(city_2)) || (!state_1.Equals(state_2)) || (!zip_1.Equals(zip_2))) { row = dsTable.NewRow(); row["EE#"] = row1["empno"]; row["Name"] = row1["name"]; row["Prior Addr1"] = row2["addr1"]; row["Prior Addr2"] = row2["addr2"]; row["Prior City"] = row2["city"]; row["Prior State"] = row2["state"]; row["Prior Zip"] = row2["zip"]; row["New Addr1"] = row1["addr1"]; row["New Addr2"] = row1["addr2"]; row["New City"] = row1["city"]; row["New State"] = row1["state"]; row["New Zip"] = row1["zip"]; dsTable.Rows.Add(row); } break; } } } if (!_found) { row = dsTable.NewRow(); row["EE#"] = row1["empno"]; row["Name"] = row1["name"]; row["Prior Addr1"] = String.Empty; row["Prior Addr2"] = String.Empty; row["Prior City"] = String.Empty; row["Prior State"] = String.Empty; row["Prior Zip"] = String.Empty; row["New Addr1"] = row1["addr1"]; row["New Addr2"] = row1["addr2"]; row["New City"] = row1["city"]; row["New State"] = row1["state"]; row["New Zip"] = row1["zip"]; dsTable.Rows.Add(row); } } if ((dsPrev.Tables.Count > 0) && (dsPrev.Tables[0].Rows.Count > dsCurr.Tables[0].Rows.Count)) { foreach (DataRow row2 in dsPrev.Tables[0].Rows) { _found = false; foreach (DataRow row1 in dsCurr.Tables[0].Rows) { if ((row1["empno"].ToString()).Equals(row2["empno"].ToString())) { _found = true; break; } } if (!_found) { row = dsTable.NewRow(); row["EE#"] = row2["empno"]; row["Name"] = row2["name"]; row["Prior Addr1"] = row2["addr1"]; row["Prior Addr2"] = row2["addr2"]; row["Prior City"] = row2["city"]; row["Prior State"] = row2["state"]; row["Prior Zip"] = row2["zip"]; row["New Addr1"] = String.Empty; row["New Addr2"] = String.Empty; row["New City"] = String.Empty; row["New State"] = String.Empty; row["New Zip"] = String.Empty; dsTable.Rows.Add(row); } } } return(dsResult); }