public void LoadData(int programID, string courses) { this.programID = programID; dataSet11.ViewProgramReport.Clear(); dataSet11.ViewProgramReport.Load(DAC.SelectStatement("Select * From ViewProgramReport Where ProgramID = " + programID), System.Data.LoadOption.OverwriteChanges); dataSet11.viewProgramReportClassDetails.Load(DAC.SelectStatement("Select * From viewProgramReportClassDetails Where ProgramID = " + programID + " AND CourseID IN (" + courses + ")"), System.Data.LoadOption.OverwriteChanges); dataSet11.viewPivotCourseDetails.Load(BusinessLayer.DAC.SelectStatement("Select * From viewPivotCourseDetails Where ProgramID = " + programID + " AND CourseID IN (" + courses + ")"), System.Data.LoadOption.OverwriteChanges); DataTable dt = Pivot(dataSet11.viewPivotCourseDetails.CreateDataReader(), "Name", "DAYNAME", "InstructorName"); foreach (DataRow row in dt.Rows) { BusinessLayer.DataSet1.PivotReportRow prow = dataSet11.PivotReport.NewPivotReportRow(); prow.Name = row["Name"].ToString(); if (dt.Columns.Contains("Sun")) { prow.Sun = row["Sun"].ToString(); } if (dt.Columns.Contains("Mon")) { prow.Mon = row["Mon"].ToString(); } if (dt.Columns.Contains("Tue")) { prow.Tue = row["Tue"].ToString(); } if (dt.Columns.Contains("Wed")) { prow.Wed = row["Wed"].ToString(); } if (dt.Columns.Contains("Thu")) { prow.Thu = row["Thu"].ToString(); } if (dt.Columns.Contains("Fri")) { prow.Fri = row["Fri"].ToString(); } if (dt.Columns.Contains("Sat")) { prow.Sat = row["Sat"].ToString(); } prow.ProgramID = programID; dataSet11.PivotReport.AddPivotReportRow(prow); } }
public void LoadData(int programID) { dataSet1.Clear(); dataSet1.viewPivotCourseDetails.Load(BusinessLayer.DAC.SelectStatement("Select * From viewPivotCourseDetails Where ProgramID = " + programID), System.Data.LoadOption.OverwriteChanges); DataTable dt = Pivot(dataSet1.viewPivotCourseDetails.CreateDataReader(), "Name", "DAYNAME", "InstructorName"); foreach (DataRow row in dt.Rows) { BusinessLayer.DataSet1.PivotReportRow prow = dataSet1.PivotReport.NewPivotReportRow(); prow.Name = row["Name"].ToString(); prow.Sun = row["Sun"].ToString(); prow.Mon = row["Mon"].ToString(); prow.Tue = row["Tue"].ToString(); prow.Wed = row["Wed"].ToString(); prow.Thu = row["Thu"].ToString(); prow.Fri = row["Fri"].ToString(); prow.Sat = row["Sat"].ToString(); dataSet1.PivotReport.AddPivotReportRow(prow); } }
public void LoadData(int programID) { this.programID = programID; dataSet11.ViewProgramReport.Clear(); dataSet11.ViewProgramReport.Load(DAC.SelectStatement("Select * From ViewProgramReport Where ProgramID = " + programID), System.Data.LoadOption.OverwriteChanges); dataSet11.viewProgramReportClassDetails.Load(DAC.SelectStatement("Select * From viewProgramReportClassDetails Where ProgramID = " + programID + " Order By CourseName"), System.Data.LoadOption.OverwriteChanges); DataRow[] prows = dataSet11.ViewProgramReport.Select("ProgramID = " + programID); if (prows.Length > 0) { DataSet1.ViewProgramReportRow prow = prows[0] as DataSet1.ViewProgramReportRow; if (prow != null) { string courseIn = ""; bool isfirst = true; foreach (DataSet1.viewProgramReportClassDetailsRow drow in dataSet11.viewProgramReportClassDetails) { if (isfirst) { isfirst = false; } else { courseIn += ","; } courseIn += drow.CourseId.ToString(); } if (courseIn != "") { IDataReader reader = DAC.SelectStatement("Select Name as CourseName,SpecialRemarks From Course Where CourseId IN(" + courseIn + ") Order By CourseName"); string finalStringRemarks = ""; while (reader.Read()) { if (reader["SpecialRemarks"] != DBNull.Value) { if (reader["SpecialRemarks"].ToString() != "") { finalStringRemarks += reader["CourseName"] + ": \n" + reader["SpecialRemarks"].ToString() + "\n"; } } } prow.CourseSpecialRemarks = finalStringRemarks; } } } dataSet11.viewPivotCourseDetails.Load(BusinessLayer.DAC.SelectStatement("Select * From viewPivotCourseDetails Where ProgramID = " + programID + " Order By Name"), System.Data.LoadOption.OverwriteChanges); DataTable dt = Pivot(dataSet11.viewPivotCourseDetails.CreateDataReader(), "Name", "DAYNAME", "InstructorName"); foreach (DataRow row in dt.Rows) { BusinessLayer.DataSet1.PivotReportRow prow = dataSet11.PivotReport.NewPivotReportRow(); prow.Name = row["Name"].ToString(); if (dt.Columns.Contains("Sun")) { prow.Sun = row["Sun"].ToString(); } if (dt.Columns.Contains("Mon")) { prow.Mon = row["Mon"].ToString(); } if (dt.Columns.Contains("Tue")) { prow.Tue = row["Tue"].ToString(); } if (dt.Columns.Contains("Wed")) { prow.Wed = row["Wed"].ToString(); } if (dt.Columns.Contains("Thu")) { prow.Thu = row["Thu"].ToString(); } if (dt.Columns.Contains("Fri")) { prow.Fri = row["Fri"].ToString(); } if (dt.Columns.Contains("Sat")) { prow.Sat = row["Sat"].ToString(); } prow.ProgramID = programID; dataSet11.PivotReport.AddPivotReportRow(prow); } }