Beispiel #1
0
        /**
         * find leader with applicant, if leader level bigger then leaderMaxLevel return null, else return Approver from leader;
         *
         * @param applicantId
         * @param leaderMaxLevel
         * @return
         */
        public Entity.Person FindFirstApprover(string applicantId, int maxLeaderLevel)
        {
            var leaderPO = _personRepository.FindLeaderByPersonId(applicantId);

            if (leaderPO.RoleLevel > maxLeaderLevel)
            {
                return(null);
            }
            else
            {
                return(_personFactory.CreatePerson(leaderPO));
            }
        }
        public IHttpActionResult Get()
        {
            try
            {
                IQueryable <PersonEntity> persons = _repository.GetPersons();

                var result = persons.ToList().Select(eg => _personFactory.CreatePerson(eg));

                return(Ok(result));
            }
            catch (Exception)
            {
                return(InternalServerError());
            }
        }
            public Person MyTestMethod(string first, string last)
            {
                var person = _personFactory.CreatePerson(first, last);

                person.First += "x";
                return(_personFactory.UpdatePerson(person));
            }
Beispiel #4
0
        public void AddPerson(object o)
        {
            IPerson person = m_personFactory.CreatePerson(Name, Address, Phone, IsActive);

            AddedPersonViewModel = m_personFactory.CreatePersonViewModel(person);
            CloseRequested?.Invoke(this, new DialogCloseRequestedEventArgs(true));
        }
Beispiel #5
0
        public void Handle(CreatePerson command)
        {
            if (!DateTime.TryParseExact(command.BirthDay, "yyyy-MM-dd", CultureInfo.InvariantCulture,
                                        DateTimeStyles.None, out var birthDay))
            {
                return;
            }
            var person = _personFactory.CreatePerson(command.Name, birthDay);

            command.Id = person.Id;
            _personRepository.Insert(person);
        }
Beispiel #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="str"> "name, address, phone, isValid" </param>
        public IPerson ToPerson(string str)
        {
            string[] properties = str.Split(new string[] { ", " }, StringSplitOptions.None);
            if (properties.Length != 4)
            {
                throw new PeopleParsingException();
            }
            properties = properties.Select(x => x.Trim()).ToArray();
            if (!bool.TryParse(properties[3], out var isActive))
            {
                throw new PeopleParsingException();
            }
            IPerson person = m_personFactory.CreatePerson(properties[0], properties[1], properties[2], isActive);

            return(person);
        }