Beispiel #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;
 }
Beispiel #2
0
 public bool Update(Person person ,int old_businessEntityId)
 {
     PersonDAC personComponent = new PersonDAC();
     return personComponent.UpdatePerson( person.BusinessEntityId,  person.NameStyle,  person.EmailPromotion,  person.RowGuid,  DateTime.Now,  person.CreatedDate,  person.NationalityCode,person.Gender,person.DateofBirth,person.PersonImage,  old_businessEntityId);
 }
Beispiel #3
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;
 }
Beispiel #4
0
 public bool Insert(Person person)
 {
     PersonDAC personComponent = new PersonDAC();
     if (person.PersonDefaultLanguage != null)
     {
         int id = 0;
         Common.BusinessEntityLogic.Insert(ref id, new Guid(), DateTime.Now);
         personComponent.InsertNewPerson(id, person.NameStyle, person.EmailPromotion, new Guid(), DateTime.Now, DateTime.Now, person.NationalityCode,person.Gender,person.DateofBirth,person.PersonImage);
         Common.PersonLanguagesLogic.Insert(id, Common.DefaultLanguage.LanguageId, person.Title, person.FirstName, person.MiddleName, person.LastName, person.Suffix, person.DisplayName);
         person.BusinessEntityId = id;
         return true;
     }
     return false;
 }
Beispiel #5
0
 //public static Employees getEmployee(Page currentPage)
 //{
 //    Users user = getUser(currentPage);
 //    return user.CurrentEmployee;
 //}
 public static void UpdateUser(Page currentPage,Person person)
 {
     currentPage.Session["USER"] = person;
 }