i have a datatable which contains records that contain DateFrom and DateTo.
i need to take each record and split the date range of each record into 5 weeks slots, create a new record for each 5 week segment in a cloned datatable with a newID. The issue i am having is spliting the date range within each record down to 5 week segments and then inserting these into the new table
DataTable dtAllocation = new DataTable();
DataTable dtCloned = new DataTable();
dtAllocation.TableName = "Allocations";
dtAllocation = DataAccess.GetAllocationDetailsByOptionCode(optionCode);
dtCloned = dtAllocation.Clone();
dtCloned.Columns.Add(new DataColumn("myID", typeof(System.String)));
foreach (DataRow drAllocation in dtAllocation.Rows)
{
//i need another loop of sorts that will take
// drAllocation["DateFrom] and drAllocation["DateTo]
// and split in 5 week ranges
DataRow dr = dtCloned.NewRow();
dr["DateFrom"] = //5 week date range start;
dr["DateTo"] = //5 week date range end
dr["myID"] = //Generated ID
dtCloned.Rows.Add(dr);
//end of date range split loop
}