public ResponseBo <List <PersonAddressListBo> > GetList(PersonAddressGetListCriteriaBo criteriaBo)
        {
            ResponseBo <List <PersonAddressListBo> > responseBo = new ResponseBo <List <PersonAddressListBo> >();

            try
            {
                using (SqlConnection conn = DbAccess.Connection.GetConn())
                {
                    var p = new DynamicParameters();
                    base.AddStandartSpParams(ref p, criteriaBo);

                    p.Add("@OwnerPersonId", criteriaBo.OwnerPersonId, DbType.Int64, ParameterDirection.Input);

                    p.Add("@AddressTypeIdList", criteriaBo.AddressTypeIdList.ToStrSeparated(), DbType.String, ParameterDirection.Input, 50);
                    p.Add("@StatId", criteriaBo.StatId, DbType.Int32, ParameterDirection.Input);

                    p.Add("@AddressIdList", criteriaBo.AddressIdList.ToStrSeparated(), DbType.String, ParameterDirection.Input, 255);

                    responseBo.Bo        = conn.Query <PersonAddressListBo>("spPersonAddressList", p, commandType: CommandType.StoredProcedure).ToList();
                    responseBo.Message   = p.Get <string>("@Message");
                    responseBo.IsSuccess = p.Get <bool>("@IsSuccess");
                }
            }
            catch (Exception ex)
            {
                responseBo = base.SaveExLog(ex, this.GetType(), MethodBase.GetCurrentMethod().Name, criteriaBo).ToResponse <List <PersonAddressListBo> >();
            }

            return(responseBo);
        }
Ejemplo n.º 2
0
        public ResponseDto <List <PersonAddressListDto> > GetList(PersonAddressGetListCriteriaDto criteriaDto)
        {
            PersonAddressGetListCriteriaBo criteriaBo = new PersonAddressGetListCriteriaBo()
            {
                OwnerPersonId = criteriaDto.OwnerPersonId,

                AddressTypeIdList = criteriaDto.AddressTypeIdList,
                StatId            = criteriaDto.StatId,

                AddressIdList = criteriaDto.AddressIdList,

                Session = Session
            };

            ResponseBo <List <PersonAddressListBo> > responseBo = personAddressBusiness.GetList(criteriaBo);

            ResponseDto <List <PersonAddressListDto> > responseDto = responseBo.ToResponseDto <List <PersonAddressListDto>, List <PersonAddressListBo> >();

            if (responseBo.IsSuccess && responseBo.Bo != null)
            {
                responseDto.Dto = new List <PersonAddressListDto>();
                foreach (PersonAddressListBo itemBo in responseBo.Bo)
                {
                    responseDto.Dto.Add(new PersonAddressListDto()
                    {
                        Id                 = itemBo.Id,
                        AddressTypeId      = itemBo.AddressTypeId,
                        StatId             = itemBo.StatId,
                        Name               = itemBo.Name,
                        InvolvedPersonName = itemBo.InvolvedPersonName,

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

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

            return(responseDto);
        }