/// <summary> /// /// </summary> /// <returns></returns> public SortedList <int, IBGCTestSchedule> GetScheduleList() { SortedList <int, IBGCTestSchedule> schedules = new SortedList <int, IBGCTestSchedule>(); SqlConnection connection = DBUtility.getConnection(); connection.Open(); SqlCommand command = new SqlCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "sp_displaySchedule"; command.Connection = connection; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { int bgcId = Convert.ToInt32(reader["BGCID"]); DateTime fromDate = Convert.ToDateTime(reader["fromDate"]); DateTime toDate = Convert.ToDateTime(reader["toDate"]); int adminID = Convert.ToInt32(reader["AdministratorId"]); IBGCTestSchedule sch = new BGCTestScheduleFactory().CreateSchedule(fromDate, toDate, adminID); sch.BGCId = bgcId; schedules.Add(sch.BGCId, sch); } connection.Close(); return(schedules); }
/// <summary> /// /// /// </summary> /// <param name="fromdate"></param> /// <param name="toDate"></param> /// <param name="adminID"></param> /// <returns></returns> public int AddBGCSchedule(DateTime fromdate, DateTime toDate, int adminID) { IBGCTestSchedule sch = new BGCTestScheduleFactory().CreateSchedule(fromdate, toDate, adminID); IBGCScheduleDB sdb = new BGCScheduleDBFactory().CreateBGCScheduleDB(); return(sdb.AddBGCSchedule(sch)); }