public List<Travel> GetAllByConferenceID(int ConferenceID) { TravelDAC _travelComponent = new TravelDAC(); IDataReader reader = _travelComponent.GetAllTravel("ConferenceID = " + ConferenceID).CreateDataReader(); List<Travel> _travelList = new List<Travel>(); while (reader.Read()) { if (_travelList == null) _travelList = new List<Travel>(); Travel _travel = new Travel(); if (reader["ID"] != DBNull.Value) _travel.ID = Convert.ToInt32(reader["ID"]); if (reader["Name"] != DBNull.Value) _travel.Name = Convert.ToString(reader["Name"]); if (reader["TransportationTypeID"] != DBNull.Value) _travel.TransportationTypeID = Convert.ToInt32(reader["TransportationTypeID"]); if (reader["Description"] != DBNull.Value) _travel.Description = Convert.ToString(reader["Description"]); if (reader["ConferenceID"] != DBNull.Value) _travel.ConferenceID = Convert.ToInt32(reader["ConferenceID"]); _travel.NewRecord = false; _travelList.Add(_travel); } reader.Close(); return _travelList; }
public Travel GetByID(int _iD) { TravelDAC _travelComponent = new TravelDAC(); IDataReader reader = _travelComponent.GetByIDTravel(_iD); Travel _travel = null; while(reader.Read()) { _travel = new Travel(); if(reader["ID"] != DBNull.Value) _travel.ID = Convert.ToInt32(reader["ID"]); if(reader["Name"] != DBNull.Value) _travel.Name = Convert.ToString(reader["Name"]); if(reader["TransportationTypeID"] != DBNull.Value) _travel.TransportationTypeID = Convert.ToInt32(reader["TransportationTypeID"]); if(reader["Description"] != DBNull.Value) _travel.Description = Convert.ToString(reader["Description"]); if (reader["ConferenceID"] != DBNull.Value) _travel.ConferenceID = Convert.ToInt32(reader["ConferenceID"]); _travel.NewRecord = false; } reader.Close(); return _travel; }
public bool Update(Travel travel ,int old_iD) { TravelDAC travelComponent = new TravelDAC(); return travelComponent.UpdateTravel( travel.Name, travel.TransportationTypeID, travel.Description,travel.ConferenceID, old_iD); }
public bool Insert(Travel travel) { int autonumber = 0; TravelDAC travelComponent = new TravelDAC(); bool endedSuccessfuly = travelComponent.InsertNewTravel( ref autonumber, travel.Name, travel.TransportationTypeID, travel.Description,travel.ConferenceID); if(endedSuccessfuly) { travel.ID = autonumber; } return endedSuccessfuly; }