public List <ClassRoomsType> getAllActived() { String sql = "SP_GETALLCLASSROOMACTIVESTYPE"; try { SqlCommand oCommand = new SqlCommand(sql); oCommand.CommandType = CommandType.StoredProcedure; DataTable oDataTable = DAO.getInstance().executeQuery(oCommand); List <ClassRoomsType> listClassRoomsType = new List <ClassRoomsType>(); foreach (DataRow oDataRow in oDataTable.Rows) { ClassRoomsType oClassRoomsType = new ClassRoomsType(); oClassRoomsType.code = Convert.ToInt32(oDataRow[0].ToString()); oClassRoomsType.description = oDataRow[1].ToString(); oClassRoomsType.state = Convert.ToInt16(oDataRow[2].ToString()); listClassRoomsType.Add(oClassRoomsType); } return(listClassRoomsType); } catch (Exception ex) { throw ex; } finally { } }
public List <ClassRoom> getAllActiveBySchedule(int periodId, int programid, Entities.Schedule oSchedule, int[] days) { String sql = "SP_CLASSROOMBYSCHEDULE"; try { SqlCommand oCommand = new SqlCommand(sql); oCommand.CommandType = System.Data.CommandType.StoredProcedure; oCommand.Parameters.AddWithValue("@period", periodId); oCommand.Parameters.AddWithValue("@program", programid); oCommand.Parameters.AddWithValue("@inicialHour", oSchedule.startTime); oCommand.Parameters.AddWithValue("@finalhour", oSchedule.endTime); oCommand.Parameters.AddWithValue("@day1", Convert.ToInt32(days[0])); oCommand.Parameters.AddWithValue("@day2", Convert.ToInt32(days[1])); oCommand.Parameters.AddWithValue("@day3", Convert.ToInt32(days[2])); oCommand.Parameters.AddWithValue("@day4", Convert.ToInt32(days[3])); oCommand.Parameters.AddWithValue("@day5", Convert.ToInt32(days[4])); oCommand.Parameters.AddWithValue("@day6", Convert.ToInt32(days[5])); oCommand.Parameters.AddWithValue("@day7", Convert.ToInt32(days[6])); DataTable oDataTable = DAO.getInstance().executeQuery(oCommand); List <ClassRoom> listClassRoom = new List <ClassRoom>(); foreach (DataRow oDataRow in oDataTable.Rows) { ClassRoom oClassRoom = new ClassRoom(); Location oLocation = new Location(); Headquarters oHeadquarters = new Headquarters(); ClassRoomsType oClassRoomsType = new ClassRoomsType(); oClassRoom.code = Convert.ToInt32(oDataRow[0].ToString()); oClassRoom.num_room = oDataRow[1].ToString(); oClassRoomsType.description = oDataRow[2].ToString(); oLocation.code = Convert.ToInt32(oDataRow[3].ToString()); oLocation.building = oDataRow[4].ToString(); oLocation.module = oDataRow[5].ToString(); oHeadquarters.description = oDataRow[6].ToString(); oLocation.oHeadquarters = oHeadquarters; oClassRoom.oClassRoomsType = oClassRoomsType; oClassRoom.oLocation = oLocation; listClassRoom.Add(oClassRoom); } return(listClassRoom); } catch (Exception) { throw; } finally { } }
public List <ClassRoom> getAllByProgram(Int32 pCode) { String sql = "SP_GETALLCLASSROOMBYPROGRAM"; try { SqlCommand oCommand = new SqlCommand(sql); oCommand.CommandType = System.Data.CommandType.StoredProcedure; oCommand.Parameters.AddWithValue("@PROGRAM_ID", pCode); DataTable oDataTable = DAO.getInstance().executeQuery(oCommand); List <ClassRoom> listClassRoom = new List <ClassRoom>(); foreach (DataRow oDataRow in oDataTable.Rows) { ClassRoom oClassRoom = new ClassRoom(); Program oProgram = new Program(); Location oLocation = new Location(); Headquarters oHeadquarters = new Headquarters(); ClassRoomsType oClassRoomsType = new ClassRoomsType(); oClassRoom.code = Convert.ToInt32(oDataRow[0].ToString()); oClassRoom.num_room = oDataRow[1].ToString(); oClassRoom.size = Convert.ToInt32(oDataRow[2].ToString()); oProgram.code = Convert.ToInt32(oDataRow[3].ToString()); oProgram.name = oDataRow[4].ToString(); oClassRoomsType.code = Convert.ToInt32(oDataRow[5].ToString()); oClassRoomsType.description = oDataRow[6].ToString(); oLocation.code = Convert.ToInt16(oDataRow[7].ToString()); oHeadquarters.code = Convert.ToInt16(oDataRow[8].ToString()); oHeadquarters.description = oDataRow[9].ToString(); oLocation.building = oDataRow[10].ToString(); oLocation.module = oDataRow[11].ToString(); oLocation.oHeadquarters = oHeadquarters; oClassRoom.state = Convert.ToInt16(oDataRow[12].ToString()); oClassRoom.oProgram = oProgram; oClassRoom.oClassRoomsType = oClassRoomsType; oClassRoom.oLocation = oLocation; listClassRoom.Add(oClassRoom); } return(listClassRoom); } catch (Exception ex) { throw ex; } finally { } }
public Int32 modify(ClassRoomsType oClassRoomsType) { String oSql = "SP_MODIFYCLASSROOMSTYPE"; try { SqlCommand oCommand = new SqlCommand(oSql); oCommand.CommandType = CommandType.StoredProcedure; oCommand.Parameters.AddWithValue("@ID", oClassRoomsType.code); oCommand.Parameters.AddWithValue("@DESCRIPTION", oClassRoomsType.description); oCommand.Parameters.AddWithValue("@STATE", oClassRoomsType.state); return(DAO.getInstance().executeSQL(oCommand)); } catch (Exception ex) { throw ex; } finally { } }