public ResponseDto <List <ShopOrderAreaListDto> > GetOrderAreaList(ShopOrderAreaGetListCriteriaDto criteriaDto) { ShopOrderAreaGetListCriteriaBo criteriaBo = new ShopOrderAreaGetListCriteriaBo() { PersonId = criteriaDto.PersonId, Session = Session }; ResponseBo <List <ShopOrderAreaListBo> > responseBo = shopPersonBusiness.GetOrderAreaList(criteriaBo); ResponseDto <List <ShopOrderAreaListDto> > responseDto = responseBo.ToResponseDto <List <ShopOrderAreaListDto>, List <ShopOrderAreaListBo> >(); if (responseBo.IsSuccess && responseBo.Bo != null) { responseDto.Dto = new List <ShopOrderAreaListDto>(); foreach (ShopOrderAreaListBo itemBo in responseBo.Bo) { responseDto.Dto.Add(new ShopOrderAreaListDto() { Id = itemBo.Id, AddressBoundaryId = itemBo.AddressBoundaryId, AddressName = itemBo.AddressName, CurrencyId = itemBo.CurrencyId, OrderDeliveryTypeId = itemBo.OrderDeliveryTypeId, SubList = (from x in itemBo.SubList select new ShopOrderAreaSubListDto { Id = x.Id, AddressName = x.AddressName, OrderMinPrice = x.OrderMinPrice, OrderDeliveryTimeId = x.OrderDeliveryTimeId, HasStates = x.HasStates }).ToList() }); } } return(responseDto); }
public ResponseBo <List <ShopOrderAreaListBo> > GetOrderAreaList(ShopOrderAreaGetListCriteriaBo criteriaBo) { ResponseBo <List <ShopOrderAreaListBo> > responseBo = new ResponseBo <List <ShopOrderAreaListBo> >(); try { using (SqlConnection conn = DbAccess.Connection.GetConn()) { var p = new DynamicParameters(); p.Add("@Message", dbType: DbType.String, direction: ParameterDirection.Output, size: 255); p.Add("@IsSuccess", dbType: DbType.Boolean, direction: ParameterDirection.Output); p.Add("@PersonId", criteriaBo.PersonId, DbType.Int64, ParameterDirection.Input); p.Add("@MyPersonId", criteriaBo.Session.MyPerson.Id, DbType.Int64, ParameterDirection.Input); p.Add("@OperatorRealId", criteriaBo.Session.RealPerson.Id, DbType.Int64, ParameterDirection.Input); p.Add("@LanguageId", criteriaBo.Session.RealPerson.LanguageId, DbType.Int32, ParameterDirection.Input); responseBo.Bo = conn.Query <ShopOrderAreaListBo>("spPersonOrderAreaList", p, commandType: CommandType.StoredProcedure).ToList(); responseBo.Message = p.Get <string>("@Message"); responseBo.IsSuccess = p.Get <bool>("@IsSuccess"); if (responseBo.IsSuccess && responseBo.Bo != null && responseBo.Bo.Count() > 0) { foreach (ShopOrderAreaListBo item in responseBo.Bo) { // 'SubListRawJson' cannot be null. item.SubList = JsonConvert.DeserializeObject <List <ShopOrderAreaSubListBo> >(item.SubListRawJson); } } } } catch (Exception ex) { responseBo = base.SaveExLog(ex, this.GetType(), MethodBase.GetCurrentMethod().Name, criteriaBo).ToResponse <List <ShopOrderAreaListBo> >(); } return(responseBo); }