예제 #1
0
 public bool Insert(AirLine airline)
 {
     int autonumber = 0;
     AirLineDAC airlineComponent = new AirLineDAC();
     bool endedSuccessfuly = airlineComponent.InsertNewAirLine( ref autonumber,  airline.Name);
     if(endedSuccessfuly)
     {
         airline.ID = autonumber;
     }
     return endedSuccessfuly;
 }
예제 #2
0
 public AirLine GetByID(int _iD)
 {
     AirLineDAC _airLineComponent = new AirLineDAC();
      IDataReader reader = _airLineComponent.GetByIDAirLine(_iD);
      AirLine _airLine = null;
      while(reader.Read())
      {
          _airLine = new AirLine();
          if(reader["ID"] != DBNull.Value)
              _airLine.ID = Convert.ToInt32(reader["ID"]);
          if(reader["Name"] != DBNull.Value)
              _airLine.Name = Convert.ToString(reader["Name"]);
      _airLine.NewRecord = false;             }             reader.Close();
      return _airLine;
 }
예제 #3
0
 public List<AirLine> GetAll()
 {
     AirLineDAC _airLineComponent = new AirLineDAC();
      IDataReader reader =  _airLineComponent.GetAllAirLine().CreateDataReader();
      List<AirLine> _airLineList = new List<AirLine>();
      while(reader.Read())
      {
      if(_airLineList == null)
          _airLineList = new List<AirLine>();
          AirLine _airLine = new AirLine();
          if(reader["ID"] != DBNull.Value)
              _airLine.ID = Convert.ToInt32(reader["ID"]);
          if(reader["Name"] != DBNull.Value)
              _airLine.Name = Convert.ToString(reader["Name"]);
      _airLine.NewRecord = false;
      _airLineList.Add(_airLine);
      }             reader.Close();
      return _airLineList;
 }
예제 #4
0
 public bool Update(AirLine airline ,int old_iD)
 {
     AirLineDAC airlineComponent = new AirLineDAC();
     return airlineComponent.UpdateAirLine( airline.Name,  old_iD);
 }