Пример #1
0
 public bool Insert(TransportationType transportationtype)
 {
     int autonumber = 0;
     TransportationTypeDAC transportationtypeComponent = new TransportationTypeDAC();
     bool endedSuccessfuly = transportationtypeComponent.InsertNewTransportationType( ref autonumber,  transportationtype.TypeName);
     if(endedSuccessfuly)
     {
         transportationtype.ID = autonumber;
     }
     return endedSuccessfuly;
 }
Пример #2
0
 public TransportationType GetByID(int _iD)
 {
     TransportationTypeDAC _transportationTypeComponent = new TransportationTypeDAC();
      IDataReader reader = _transportationTypeComponent.GetByIDTransportationType(_iD);
      TransportationType _transportationType = null;
      while(reader.Read())
      {
          _transportationType = new TransportationType();
          if(reader["ID"] != DBNull.Value)
              _transportationType.ID = Convert.ToInt32(reader["ID"]);
          if(reader["TypeName"] != DBNull.Value)
              _transportationType.TypeName = Convert.ToString(reader["TypeName"]);
      _transportationType.NewRecord = false;             }             reader.Close();
      return _transportationType;
 }
Пример #3
0
 public List<TransportationType> GetAll()
 {
     TransportationTypeDAC _transportationTypeComponent = new TransportationTypeDAC();
      IDataReader reader =  _transportationTypeComponent.GetAllTransportationType().CreateDataReader();
      List<TransportationType> _transportationTypeList = new List<TransportationType>();
      while(reader.Read())
      {
      if(_transportationTypeList == null)
          _transportationTypeList = new List<TransportationType>();
          TransportationType _transportationType = new TransportationType();
          if(reader["ID"] != DBNull.Value)
              _transportationType.ID = Convert.ToInt32(reader["ID"]);
          if(reader["TypeName"] != DBNull.Value)
              _transportationType.TypeName = Convert.ToString(reader["TypeName"]);
      _transportationType.NewRecord = false;
      _transportationTypeList.Add(_transportationType);
      }             reader.Close();
      return _transportationTypeList;
 }
Пример #4
0
 public bool Update(TransportationType transportationtype ,int old_iD)
 {
     TransportationTypeDAC transportationtypeComponent = new TransportationTypeDAC();
     return transportationtypeComponent.UpdateTransportationType( transportationtype.TypeName,  old_iD);
 }