public PersonPhone GetByID(int _id) { PersonPhoneDAC _personPhoneComponent = new PersonPhoneDAC(); IDataReader reader = _personPhoneComponent.GetByIDPersonPhone(_id); PersonPhone _personPhone = null; while(reader.Read()) { _personPhone = new PersonPhone(); if(reader["Id"] != DBNull.Value) _personPhone.Id = Convert.ToInt32(reader["Id"]); if(reader["BusinessEntityId"] != DBNull.Value) _personPhone.BusinessEntityId = Convert.ToInt32(reader["BusinessEntityId"]); if(reader["PhoneNumber"] != DBNull.Value) _personPhone.PhoneNumber = Convert.ToString(reader["PhoneNumber"]); if(reader["PhoneNumberTypeId"] != DBNull.Value) _personPhone.PhoneNumberTypeId = Convert.ToInt32(reader["PhoneNumberTypeId"]); if(reader["ModifiedDate"] != DBNull.Value) _personPhone.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]); if(reader["PhoneVerified"] != DBNull.Value) _personPhone.PhoneVerified = Convert.ToBoolean(reader["PhoneVerified"]); if(reader["PhoneVerificationCode"] != DBNull.Value) _personPhone.PhoneVerificationCode = Convert.ToString(reader["PhoneVerificationCode"]); _personPhone.NewRecord = false; } reader.Close(); return _personPhone; }
public List<PersonPhone> GetAll() { PersonPhoneDAC _personPhoneComponent = new PersonPhoneDAC(); IDataReader reader = _personPhoneComponent.GetAllPersonPhone().CreateDataReader(); List<PersonPhone> _personPhoneList = new List<PersonPhone>(); while(reader.Read()) { if(_personPhoneList == null) _personPhoneList = new List<PersonPhone>(); PersonPhone _personPhone = new PersonPhone(); if(reader["Id"] != DBNull.Value) _personPhone.Id = Convert.ToInt32(reader["Id"]); if(reader["BusinessEntityId"] != DBNull.Value) _personPhone.BusinessEntityId = Convert.ToInt32(reader["BusinessEntityId"]); if(reader["PhoneNumber"] != DBNull.Value) _personPhone.PhoneNumber = Convert.ToString(reader["PhoneNumber"]); if(reader["PhoneNumberTypeId"] != DBNull.Value) _personPhone.PhoneNumberTypeId = Convert.ToInt32(reader["PhoneNumberTypeId"]); if(reader["ModifiedDate"] != DBNull.Value) _personPhone.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]); if(reader["PhoneVerified"] != DBNull.Value) _personPhone.PhoneVerified = Convert.ToBoolean(reader["PhoneVerified"]); if(reader["PhoneVerificationCode"] != DBNull.Value) _personPhone.PhoneVerificationCode = Convert.ToString(reader["PhoneVerificationCode"]); _personPhone.NewRecord = false; _personPhoneList.Add(_personPhone); } reader.Close(); return _personPhoneList; }
public bool Update(PersonPhone personphone ,int old_id) { PersonPhoneDAC personphoneComponent = new PersonPhoneDAC(); return personphoneComponent.UpdatePersonPhone(personphone.BusinessEntityId, personphone.PhoneNumber, personphone.PhoneNumberTypeId, DateTime.Now, personphone.PhoneVerified, personphone.PhoneVerificationCode, old_id); }
public bool Insert(PersonPhone personphone) { int autonumber = 0; PersonPhoneDAC personphoneComponent = new PersonPhoneDAC(); bool endedSuccessfuly = personphoneComponent.InsertNewPersonPhone( ref autonumber, personphone.BusinessEntityId, personphone.PhoneNumber, personphone.PhoneNumberTypeId, DateTime.Now, personphone.PhoneVerified, personphone.PhoneVerificationCode); if(endedSuccessfuly) { personphone.Id = autonumber; } return endedSuccessfuly; }