public ResponseBo <List <PersonProductListBo> > GetList(PersonProductGetListCriteriaBo criteriaBo)
        {
            ResponseBo <List <PersonProductListBo> > responseBo = new ResponseBo <List <PersonProductListBo> >();

            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("@CurrencyId", criteriaBo.CurrencyId, DbType.Int32, ParameterDirection.Input);

                    p.Add("@ProductTypeId", criteriaBo.ProductTypeId, DbType.Int32, ParameterDirection.Input);
                    p.Add("@StockStatId", criteriaBo.StockStatId, DbType.Int32, ParameterDirection.Input);

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

                    p.Add("@PageOffSet", criteriaBo.PageOffSet, DbType.Int32, 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 <PersonProductListBo>("spPersonProductList", p, commandType: CommandType.StoredProcedure).ToList();
                    responseBo.Message   = p.Get <string>("@Message");
                    responseBo.IsSuccess = p.Get <bool>("@IsSuccess");

                    if (responseBo.Bo != null)
                    {
                        foreach (PersonProductListBo item in responseBo.Bo)
                        {
                            if (item.PriceRawJson.IsNotNull())
                            {
                                item.Price = JsonConvert.DeserializeObject <ProductPriceBo>(item.PriceRawJson);
                            }

                            if (item.CodeListRawJson.IsNotNull())
                            {
                                item.CodeList = JsonConvert.DeserializeObject <List <ProductCodeBo> >(item.CodeListRawJson);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                responseBo = base.SaveExLog(ex, this.GetType(), MethodBase.GetCurrentMethod().Name, criteriaBo).ToResponse <List <PersonProductListBo> >();
            }

            return(responseBo);
        }
        public ResponseDto <List <PersonProductListDto> > GetList(PersonProductGetListCriteriaDto criteriaDto)
        {
            PersonProductGetListCriteriaBo criteriaBo = new PersonProductGetListCriteriaBo()
            {
                ProductNameCode = criteriaDto.ProductNameCode,
                ProductTypeId   = criteriaDto.ProductTypeId,

                StockStatId = criteriaDto.StockStatId,

                PersonId   = criteriaDto.PersonId,
                CurrencyId = criteriaDto.CurrencyId,

                PageOffSet = criteriaDto.PageOffSet,

                Session = Session
            };

            ResponseBo <List <PersonProductListBo> > responseBo = personProductBusiness.GetList(criteriaBo);

            ResponseDto <List <PersonProductListDto> > responseDto = responseBo.ToResponseDto <List <PersonProductListDto>, List <PersonProductListBo> >();

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

                        ProductId     = itemBo.ProductId,
                        ProductName   = itemBo.ProductName,
                        ProductTypeId = itemBo.ProductTypeId,

                        VateRate = itemBo.VateRate,

                        Balance = itemBo.Balance,

                        PortraitImageUniqueIdStr = base.GetImageName(itemBo.PortraitImageUniqueId, itemBo.PortraitImageFileTypeId),

                        CodeList = (from x in itemBo.CodeList
                                    select new ProductCodeDto()
                        {
                            Code = x.Code,
                            ProductCodeTypeId = x.ProductCodeTypeId,
                            ProductId = x.ProductId
                        }).ToList(),

                        Price = itemBo.Price == null ? null :
                                new ProductPriceDto()
                        {
                            PurhasePrice    = itemBo.Price.PurhasePrice,
                            SalePrice       = itemBo.Price.SalePrice,
                            OnlineSalePrice = itemBo.Price.OnlineSalePrice,

                            CurrencyId = itemBo.Price.CurrencyId,

                            FromPool = itemBo.Price.FromPool
                        }
                    });
                }
            }

            return(responseDto);
        }