public ResponseBo <ShopProfileBo> GetProfile(ShopProfileGetCriteriaBo criteriaBo) { if (criteriaBo.UrlName.IsNull() || criteriaBo.UrlName.Trim().Length > 50) { return(new ResponseBo <ShopProfileBo>() { IsSuccess = false, Message = Stc.GetDicValue("xNoShopFound", criteriaBo.Session.RealPerson.LanguageId) }); } ResponseBo <ShopProfileBo> responseBo = new ResponseBo <ShopProfileBo>(); 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("@UrlName", criteriaBo.UrlName, DbType.String, ParameterDirection.Input, 50); 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 <ShopProfileBo>("spShopProfileGet", p, commandType: CommandType.StoredProcedure).FirstOrDefault(); responseBo.Message = p.Get <string>("@Message"); responseBo.IsSuccess = p.Get <bool>("@IsSuccess"); if (responseBo.IsSuccess && responseBo.Bo != null) { if (responseBo.Bo.OrderAccountListRawJson.IsNotNull()) { responseBo.Bo.OrderAccountList = JsonConvert.DeserializeObject <List <Enums.AccountTypes> >(responseBo.Bo.OrderAccountListRawJson); } if (responseBo.Bo.OrderCurrencyListRawJson.IsNotNull()) { responseBo.Bo.OrderCurrencyList = JsonConvert.DeserializeObject <List <Enums.Currencies> >(responseBo.Bo.OrderCurrencyListRawJson); } } } } catch (Exception ex) { responseBo = base.SaveExLog(ex, this.GetType(), MethodBase.GetCurrentMethod().Name, criteriaBo).ToResponse <ShopProfileBo>(); } return(responseBo); }
public ResponseDto <ShopProfileDto> GetProfile(ShopProfileGetCriteriaDto criteriaDto) { ShopProfileGetCriteriaBo criteriaBo = new ShopProfileGetCriteriaBo { UrlName = criteriaDto.UrlName, Session = Session }; ResponseBo <ShopProfileBo> responseBo = shopPersonBusiness.GetProfile(criteriaBo); ResponseDto <ShopProfileDto> responseDto = responseBo.ToResponseDto <ShopProfileDto, ShopProfileBo>(); if (responseBo.IsSuccess && responseBo.Bo != null) { responseDto.Dto = new ShopProfileDto() { ShopId = responseBo.Bo.ShopId, UrlName = responseBo.Bo.UrlName, ShortName = responseBo.Bo.ShortName, ShopTypeName = responseBo.Bo.ShopTypeName, ShopIsAvailable = responseBo.Bo.ShopIsAvailable, ShopIsFoodBeverage = responseBo.Bo.ShopIsFoodBeverage, StarCount = responseBo.Bo.StarCount, StarSum = responseBo.Bo.StarSum, TakesOrder = responseBo.Bo.TakesOrder, TakesOrderOutTime = responseBo.Bo.TakesOrderOutTime, OrderAccountList = responseBo.Bo.OrderAccountList, OrderCurrencyList = responseBo.Bo.OrderCurrencyList, WorkingHoursTodayStr = responseBo.Bo.WorkingHoursTodayStr, HasWorkingHours = responseBo.Bo.HasWorkingHours, PortraitImageUniqueIdStr = base.GetImageName(responseBo.Bo.PortraitImageUniqueId, responseBo.Bo.PortraitImageFileTypeId), IsShopOwner = responseBo.Bo.IsShopOwner, OrderMinPrice = responseBo.Bo.OrderMinPrice, OrderDeliveryTimeId = responseBo.Bo.OrderDeliveryTimeId, OrderCurrencyId = responseBo.Bo.OrderCurrencyId, AddressId = responseBo.Bo.AddressId, AddressCountryName = responseBo.Bo.AddressCountryName, AddressStateName = responseBo.Bo.AddressStateName, AddressCityName = responseBo.Bo.AddressCityName, AddressDistrictName = responseBo.Bo.AddressDistrictName, AddressLocalityName = responseBo.Bo.AddressLocalityName, AddressNotes = responseBo.Bo.AddressNotes, AddressZipCode = responseBo.Bo.AddressZipCode, HasAddress = responseBo.Bo.HasAddress, Phone = responseBo.Bo.Phone, Phone2 = responseBo.Bo.Phone2, Email = responseBo.Bo.Email }; } return(responseDto); }