示例#1
0
        /// <summary>
        /// Get person by id Dto
        /// </summary>
        /// <param name="id">Id person to search</param>
        /// <returns>Return object person</returns>
        public static PersonDto GetDto(long id, ModelUnibookContainer objContex)
        {
            PersonDto personDto = null;

            try
            {
                Person person = PersonDal.Get(id, objContex);
                personDto          = new PersonDto();
                personDto.PersonId = person.PersonId;
                personDto.Name     = person.Name;
                personDto.LastName = person.LastName;
                personDto.BirthDay = person.Birthday;
                personDto.Deleted  = person.Deleted;
                personDto.Gender   = GenderBrl.GetDto(person.Gender.GenderId, objContex);
            }
            catch (DbEntityValidationException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(personDto);
        }
示例#2
0
        /// <summary>
        /// Get a person with identifier
        /// </summary>
        /// <param name="id"></param>
        /// <param name="objContex"></param>
        /// <returns></returns>
        public static Person Get(int id, PeopleContainer objContex)
        {
            try
            {
                return(PersonDal.Get(id, objContex));
            }
            catch (Exception)
            {
            }

            return(null);
        }
示例#3
0
        /// <summary>
        /// Get person by id
        /// </summary>
        /// <param name="id">Id person to search</param>
        /// <returns>Return object person</returns>
        public static Person Get(long id, ModelUnibookContainer objContex)
        {
            Person person = null;

            try
            {
                person = PersonDal.Get(id, objContex);
            }
            catch (DbEntityValidationException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(person);
        }
示例#4
0
 /// <summary>
 /// Update a Person
 /// </summary>
 /// <param name="objContex">Get table to object</param>
 public static void Update(PersonDto personDto, ModelUnibookContainer objContex)
 {
     try
     {
         Person person = PersonDal.Get(personDto.PersonId, objContex);
         person.Name     = personDto.Name;
         person.LastName = personDto.LastName;
         person.Birthday = personDto.BirthDay;
         person.Deleted  = personDto.Deleted;
         //person.Gender = GenderBrl.Get(personDto.Gender.GenderId, objContex);
         PersonDal.Update(objContex);
     }
     catch (DbEntityValidationException ex)
     {
         throw ex;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }