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; }
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; }
public bool Update(ContactType contacttype ,int old_contactTypeId) { ContactTypeDAC contacttypeComponent = new ContactTypeDAC(); return contacttypeComponent.UpdateContactType( contacttype.ContactTypeId, contacttype.Name, contacttype.ModifiedDate, old_contactTypeId); }
public bool Insert(ContactType contacttype) { ContactTypeDAC contacttypeComponent = new ContactTypeDAC(); return contacttypeComponent.InsertNewContactType( contacttype.ContactTypeId, contacttype.Name, contacttype.ModifiedDate); }