Exemplo n.º 1
0
 public List<Person> GetAllCredentials()
 {
     PersonDAC _personComponent = new PersonDAC();
     IDataReader reader = _personComponent.GetAllPerson("BusinessEntityId in (select BusinessEntityId from Person.Credential)").CreateDataReader();
     List<Person> _personList = new List<Person>();
     while (reader.Read())
     {
         if (_personList == null)
             _personList = new List<Person>();
         Person _person = new Person();
         if (reader["BusinessEntityId"] != DBNull.Value)
             _person.BusinessEntityId = Convert.ToInt32(reader["BusinessEntityId"]);
         if (reader["NameStyle"] != DBNull.Value)
             _person.NameStyle = Convert.ToBoolean(reader["NameStyle"]);
         if (reader["EmailPromotion"] != DBNull.Value)
             _person.EmailPromotion = Convert.ToInt32(reader["EmailPromotion"]);
         if (reader["RowGuid"] != DBNull.Value)
             _person.RowGuid = new Guid(reader["RowGuid"].ToString());
         if (reader["ModifiedDate"] != DBNull.Value)
             _person.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]);
         if (reader["CreatedDate"] != DBNull.Value)
             _person.CreatedDate = Convert.ToDateTime(reader["CreatedDate"]);
         if (reader["NationalityCode"] != DBNull.Value)
             _person.NationalityCode = Convert.ToString(reader["NationalityCode"]);
         if (reader["Gender"] != DBNull.Value)
             _person.Gender = Convert.ToString(reader["Gender"]);
         if (reader["DateofBirth"] != DBNull.Value)
             _person.DateofBirth = Convert.ToDateTime(reader["DateofBirth"]);
         if (reader["PersonImage"] != DBNull.Value)
             _person.PersonImage = Convert.ToString(reader["PersonImage"]);
         _person.NewRecord = false;
         _personList.Add(_person);
     } reader.Close();
     return _personList;
 }