示例#1
0
 public ContactType GetByID(int _contactTypeId)
 {
     ContactTypeDAC _contactTypeComponent = new ContactTypeDAC();
      IDataReader reader = _contactTypeComponent.GetByIDContactType(_contactTypeId);
      ContactType _contactType = null;
      while(reader.Read())
      {
          _contactType = new ContactType();
          if(reader["ContactTypeId"] != DBNull.Value)
              _contactType.ContactTypeId = Convert.ToInt32(reader["ContactTypeId"]);
          if(reader["Name"] != DBNull.Value)
              _contactType.Name = Convert.ToString(reader["Name"]);
          if(reader["ModifiedDate"] != DBNull.Value)
              _contactType.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]);
      _contactType.NewRecord = false;             }             reader.Close();
      return _contactType;
 }
示例#2
0
 public List<ContactType> GetAll()
 {
     ContactTypeDAC _contactTypeComponent = new ContactTypeDAC();
      IDataReader reader =  _contactTypeComponent.GetAllContactType().CreateDataReader();
      List<ContactType> _contactTypeList = new List<ContactType>();
      while(reader.Read())
      {
      if(_contactTypeList == null)
          _contactTypeList = new List<ContactType>();
          ContactType _contactType = new ContactType();
          if(reader["ContactTypeId"] != DBNull.Value)
              _contactType.ContactTypeId = Convert.ToInt32(reader["ContactTypeId"]);
          if(reader["Name"] != DBNull.Value)
              _contactType.Name = Convert.ToString(reader["Name"]);
          if(reader["ModifiedDate"] != DBNull.Value)
              _contactType.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]);
      _contactType.NewRecord = false;
      _contactTypeList.Add(_contactType);
      }             reader.Close();
      return _contactTypeList;
 }
示例#3
0
 public bool Update(ContactType contacttype ,int old_contactTypeId)
 {
     ContactTypeDAC contacttypeComponent = new ContactTypeDAC();
     return contacttypeComponent.UpdateContactType( contacttype.ContactTypeId,  contacttype.Name,  contacttype.ModifiedDate,  old_contactTypeId);
 }
示例#4
0
 public bool Insert(ContactType contacttype)
 {
     ContactTypeDAC contacttypeComponent = new ContactTypeDAC();
     return contacttypeComponent.InsertNewContactType( contacttype.ContactTypeId,  contacttype.Name,  contacttype.ModifiedDate);
 }