public ResponseDto <ShopOrderAreaDto> GetOrderArea(ShopOrderAreaGetCriteriaDto criteriaDto) { ShopOrderAreaGetCriteriaBo criteriaBo = new ShopOrderAreaGetCriteriaBo() { Id = criteriaDto.Id, Session = Session }; ResponseBo <ShopOrderAreaBo> responseBo = shopPersonBusiness.GetOrderArea(criteriaBo); ResponseDto <ShopOrderAreaDto> responseDto = responseBo.ToResponseDto <ShopOrderAreaDto, ShopOrderAreaBo>(); if (responseBo.IsSuccess && responseBo.Bo != null) { responseDto.Dto = new ShopOrderAreaDto() { PersonId = responseBo.Bo.PersonId, Id = responseBo.Bo.Id, AddressBoundaryId = responseBo.Bo.AddressBoundaryId, AddressCountryId = responseBo.Bo.AddressCountryId, AddressStateId = responseBo.Bo.AddressStateId, AddressCityId = responseBo.Bo.AddressCityId, AddressDistrictId = responseBo.Bo.AddressDistrictId, CurrencyId = responseBo.Bo.CurrencyId, OrderDeliveryTypeId = responseBo.Bo.OrderDeliveryTypeId, SubList = (from x in responseBo.Bo.SubList select new ShopOrderAreaSubDto { Id = x.Id, AddressCountryId = x.AddressCountryId, AddressStateId = x.AddressStateId, AddressCityId = x.AddressCityId, AddressDistrictId = x.AddressDistrictId, AddressLocalityId = x.AddressLocalityId, OrderMinPrice = x.OrderMinPrice, OrderDeliveryTimeId = x.OrderDeliveryTimeId }).ToList() }; } return(responseDto); }
public ResponseBo <ShopOrderAreaBo> GetOrderArea(ShopOrderAreaGetCriteriaBo criteriaBo) { ResponseBo <ShopOrderAreaBo> responseBo = new ResponseBo <ShopOrderAreaBo>(); 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("@Id", criteriaBo.Id, 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 <ShopOrderAreaBo>("spPersonOrderAreaGet", p, commandType: CommandType.StoredProcedure).FirstOrDefault(); responseBo.Message = p.Get <string>("@Message"); responseBo.IsSuccess = p.Get <bool>("@IsSuccess"); if (responseBo.IsSuccess && responseBo.Bo != null) { // 'SubListRawJson' cannot be null. responseBo.Bo.SubList = JsonConvert.DeserializeObject <List <ShopOrderAreaSubBo> >(responseBo.Bo.SubListRawJson); } } } catch (Exception ex) { responseBo = base.SaveExLog(ex, this.GetType(), MethodBase.GetCurrentMethod().Name, criteriaBo).ToResponse <ShopOrderAreaBo>(); } return(responseBo); }