示例#1
0
        public ResponseDto <List <PersonListDto> > GetList(PersonGetListCriteriaDto criteriaDto)
        {
            PersonGetListCriteriaBo criteriaBo = new PersonGetListCriteriaBo()
            {
                PersonTypeIdList = criteriaDto.PersonTypeIdList,
                CurrencyId       = criteriaDto.CurrencyId,

                Session = Session
            };

            ResponseBo <List <PersonListBo> > responseBo = personBusiness.GetList(criteriaBo);

            ResponseDto <List <PersonListDto> > responseDto = responseBo.ToResponseDto <List <PersonListDto>, List <PersonListBo> >();

            if (responseBo.IsSuccess && responseBo.Bo != null)
            {
                responseDto.Dto = new List <PersonListDto>();
                foreach (PersonListBo itemBo in responseBo.Bo)
                {
                    responseDto.Dto.Add(new PersonListDto()
                    {
                        Id = itemBo.Id,

                        FullName     = itemBo.FullName,
                        StatId       = itemBo.StatId,
                        PersonTypeId = itemBo.PersonTypeId,

                        Balance       = itemBo.Balance,
                        BalanceStatId = itemBo.BalanceStatId,

                        DefaultCurrencyId    = itemBo.DefaultCurrencyId,
                        ShopTypeId           = itemBo.ShopTypeId,
                        MasterRelationTypeId = itemBo.MasterRelationTypeId,

                        UrlName = itemBo.UrlName,

                        Address = itemBo.Address == null ? null :
                                  new PersonAddressListDto()
                        {
                            Id                 = itemBo.Address.Id,
                            AddressTypeId      = itemBo.Address.AddressTypeId,
                            StatId             = itemBo.Address.StatId,
                            Name               = itemBo.Address.Name,
                            InvolvedPersonName = itemBo.Address.InvolvedPersonName,

                            CountryName  = itemBo.Address.CountryName,
                            StateName    = itemBo.Address.StateName,
                            CityName     = itemBo.Address.CityName,
                            DistrictName = itemBo.Address.DistrictName,
                            LocalityName = itemBo.Address.LocalityName,

                            Notes = itemBo.Address.Notes,
                            Phone = itemBo.Address.Phone
                        }
                    });
                }
            }

            return(responseDto);
        }