string tempDay = null;
string tempTime = null;
if (resultTable.Rows.Count > 0)
{
for (int i = 0; i < resultTable.Rows.Count; i++)
{
//tempDay and tempTime is used to compare with the database values so that the timetable can be displayed correctly.
tempDay = resultTable.Rows[i][2].ToString();
tempTime = resultTable.Rows[i][4] + ConfigurationSettings.AppSettings["DASH"] + resultTable.Rows[i][5];
for (int a = 0; a < dr.Length; a++)
{
for (int b = 0; b < keys.Length; b++)
{
string day = keys[b].ColumnName.Substring(0, 3).ToString();
if (tempDay == day)
{
if (tempTime == dr[a][keys[0]].ToString())
{
//additional loop to check whether there is V as one of the week type
for (int z = 0; z < dr.Length; z++)
{
//check whether there is "V" in the database, supervisor dont want the V to be shown.
if (resultTable.Rows[i][3].ToString() == ConfigurationSettings.AppSettings["EVERYWEEK"])
{
string result = ConfigurationSettings.AppSettings["WEEK"] + ConfigurationSettings.AppSettings["SPACE"] + resultTable.Rows[i][10].ToString() + ConfigurationSettings.AppSettings["DASH"] + resultTable.Rows[i][11].ToString() + ConfigurationSettings.AppSettings["NEWLINE"] + resultTable.Rows[i][6].ToString() + ConfigurationSettings.AppSettings["SPACE"] + resultTable.Rows[i][7].ToString() + ConfigurationSettings.AppSettings["NEWLINE"] + resultTable.Rows[i][8].ToString() + ConfigurationSettings.AppSettings["SPACE"] + resultTable.Rows[i][1].ToString();
dr[a][keys[b]] = result;
}
// if there are no V, normally display the timetable out with the complimenting week type
else
{
string result = ConfigurationSettings.AppSettings["WEEK"] + ConfigurationSettings.AppSettings["SPACE"] + resultTable.Rows[i][10].ToString() + ConfigurationSettings.AppSettings["DASH"] + resultTable.Rows[i][11].ToString() + ConfigurationSettings.AppSettings["SPACE"] + ConfigurationSettings.AppSettings["LEFT_BRACKET"] + resultTable.Rows[i][3].ToString() + ConfigurationSettings.AppSettings["RIGHT_BRACKET"] + ConfigurationSettings.AppSettings["NEWLINE"] + resultTable.Rows[i][6].ToString() + ConfigurationSettings.AppSettings["SPACE"] + resultTable.Rows[i][7].ToString() + ConfigurationSettings.AppSettings["NEWLINE"] + resultTable.Rows[i][8].ToString() + ConfigurationSettings.AppSettings["SPACE"] + resultTable.Rows[i][1].ToString();
dr[a][keys[b]] = result;
}
}
break;
}
}
}
}
}
}
|