public bool Insert(PhoneNumberType phonenumbertype)
 {
     int autonumber = 0;
     PhoneNumberTypeDAC phonenumbertypeComponent = new PhoneNumberTypeDAC();
     bool endedSuccessfuly = phonenumbertypeComponent.InsertNewPhoneNumberType( ref autonumber,  phonenumbertype.Name,  phonenumbertype.ModifiedDate);
     if(endedSuccessfuly)
     {
         phonenumbertype.PhoneNumberTypeId = autonumber;
     }
     return endedSuccessfuly;
 }
 public PhoneNumberType GetByID(int _phoneNumberTypeId)
 {
     PhoneNumberTypeDAC _phoneNumberTypeComponent = new PhoneNumberTypeDAC();
      IDataReader reader = _phoneNumberTypeComponent.GetByIDPhoneNumberType(_phoneNumberTypeId);
      PhoneNumberType _phoneNumberType = null;
      while(reader.Read())
      {
          _phoneNumberType = new PhoneNumberType();
          if(reader["PhoneNumberTypeId"] != DBNull.Value)
              _phoneNumberType.PhoneNumberTypeId = Convert.ToInt32(reader["PhoneNumberTypeId"]);
          if(reader["Name"] != DBNull.Value)
              _phoneNumberType.Name = Convert.ToString(reader["Name"]);
          if(reader["ModifiedDate"] != DBNull.Value)
              _phoneNumberType.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]);
      _phoneNumberType.NewRecord = false;             }             reader.Close();
      return _phoneNumberType;
 }
 public List<PhoneNumberType> GetAll()
 {
     PhoneNumberTypeDAC _phoneNumberTypeComponent = new PhoneNumberTypeDAC();
      IDataReader reader =  _phoneNumberTypeComponent.GetAllPhoneNumberType().CreateDataReader();
      List<PhoneNumberType> _phoneNumberTypeList = new List<PhoneNumberType>();
      while(reader.Read())
      {
      if(_phoneNumberTypeList == null)
          _phoneNumberTypeList = new List<PhoneNumberType>();
          PhoneNumberType _phoneNumberType = new PhoneNumberType();
          if(reader["PhoneNumberTypeId"] != DBNull.Value)
              _phoneNumberType.PhoneNumberTypeId = Convert.ToInt32(reader["PhoneNumberTypeId"]);
          if(reader["Name"] != DBNull.Value)
              _phoneNumberType.Name = Convert.ToString(reader["Name"]);
          if(reader["ModifiedDate"] != DBNull.Value)
              _phoneNumberType.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]);
      _phoneNumberType.NewRecord = false;
      _phoneNumberTypeList.Add(_phoneNumberType);
      }             reader.Close();
      return _phoneNumberTypeList;
 }
 public bool Update(PhoneNumberType phonenumbertype ,int old_phoneNumberTypeId)
 {
     PhoneNumberTypeDAC phonenumbertypeComponent = new PhoneNumberTypeDAC();
     return phonenumbertypeComponent.UpdatePhoneNumberType( phonenumbertype.Name,  phonenumbertype.ModifiedDate,  old_phoneNumberTypeId);
 }