Exemple #1
0
 public Person GetByUserName(string UserName)
 {
     PersonDAC _personComponent = new PersonDAC();
      IDataReader reader = _personComponent.GetByUserNamePerson(UserName);
      Person _person = null;
      while (reader.Read())
      {
          _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;
      } reader.Close();
      return _person;
 }