Beispiel #1
0
        public ResponseDto <ProductFilterListSummaryDto> GetListSummary(ProductFilterGetListCriteriaDto criteriaDto)
        {
            ProductFilterGetListCriteriaBo criteriaBo = new ProductFilterGetListCriteriaBo()
            {
                SearchWord        = criteriaDto.SearchWord,
                ProductCategoryId = criteriaDto.ProductCategoryId,
                PropertyList      = criteriaDto.PropertyList,

                MinPrice = criteriaDto.MinPrice,
                MaxPrice = criteriaDto.MaxPrice,

                Session = Session
            };

            ResponseBo <ProductFilterListSummaryBo> responseBo = productFilterBusiness.GetListSummary(criteriaBo);

            ResponseDto <ProductFilterListSummaryDto> responseDto = responseBo.ToResponseDto <ProductFilterListSummaryDto, ProductFilterListSummaryBo>();

            if (responseBo.IsSuccess && responseBo.Bo != null)
            {
                responseDto.Dto = new ProductFilterListSummaryDto();

                responseDto.Dto.Count    = responseBo.Bo.Count;
                responseDto.Dto.PageSize = responseBo.Bo.PageSize;

                if (responseBo.Bo.PropertyList != null)
                {
                    responseDto.Dto.PropertyList = responseBo.Bo.PropertyList.
                                                   GroupBy(x => x.GroupId).Select(x => x.First()).
                                                   Select(
                        x => new PropertyListDto()
                    {
                        Id           = x.GroupId,
                        Name         = x.GroupName,
                        UrlName      = x.GroupUrlName,
                        PropertyList = responseBo.Bo.PropertyList.Where(y => y.GroupId == x.GroupId).Select(
                            y => new PropertyListDto()
                        {
                            Id      = y.PropertyId,
                            Name    = y.PropertyName,
                            UrlName = y.PropertyUrlName,
                            Count   = y.PropertyCount
                        }).ToList()
                    }).ToList();

                    //responseDto.Dto.PropertyCountList = new List<ProductFilterListCountDto>();
                    //foreach (PropertyListBo item in responseBo.Bo.PropertyList)
                    //{
                    //    responseDto.Dto.PropertyCountList.Add(new ProductFilterListCountDto()
                    //    {
                    //        PropertyId = item.PropertyId,
                    //        Cnt = item.Cnt
                    //    });
                    //}
                }
            }

            return(responseDto);
        }
Beispiel #2
0
        public ResponseDto <List <ProductFilterListDto> > GetList(ProductFilterGetListCriteriaDto criteriaDto)
        {
            ProductFilterGetListCriteriaBo criteriaBo = new ProductFilterGetListCriteriaBo()
            {
                SearchWord        = criteriaDto.SearchWord,
                ProductCategoryId = criteriaDto.ProductCategoryId,
                PropertyList      = criteriaDto.PropertyList,
                MinPrice          = criteriaDto.MinPrice,

                MaxPrice = criteriaDto.MaxPrice,

                PageNumber = criteriaDto.PageNumber,

                Session = Session
            };

            ResponseBo <List <ProductFilterListBo> > responseBo = productFilterBusiness.GetList(criteriaBo);

            ResponseDto <List <ProductFilterListDto> > responseDto = responseBo.ToResponseDto <List <ProductFilterListDto>, List <ProductFilterListBo> >();

            if (responseBo.IsSuccess && responseBo.Bo != null)
            {
                responseDto.Dto = new List <ProductFilterListDto>();
                foreach (ProductFilterListBo itemBo in responseBo.Bo)
                {
                    responseDto.Dto.Add(new ProductFilterListDto()
                    {
                        PersonProductId = itemBo.PersonProductId,
                        OnlineSalePrice = itemBo.OnlineSalePrice,

                        StarCount = itemBo.StarCount,
                        StarSum   = itemBo.StarSum,

                        Notes = itemBo.Notes,

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

                        ShopId        = itemBo.ShopId,
                        ShopFullName  = itemBo.ShopFullName,
                        ShopUrlName   = itemBo.ShopUrlName,
                        ShopStarCount = itemBo.ShopStarCount,
                        ShopStarSum   = itemBo.ShopStarSum,
                        ShopTypeName  = itemBo.ShopTypeName
                    });
                }
            }

            return(responseDto);
        }
        public ResponseBo <List <ProductFilterListBo> > GetList(ProductFilterGetListCriteriaBo criteriaBo)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            ResponseBo <List <ProductFilterListBo> > responseBo = new ResponseBo <List <ProductFilterListBo> >();

            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("@SearchWord", criteriaBo.SearchWord, DbType.String, ParameterDirection.Input, 50);
                    p.Add("@ProductCategoryId", criteriaBo.ProductCategoryId, DbType.Int32, ParameterDirection.Input);
                    p.Add("@PropertyListStr", criteriaBo.PropertyList.ToStrSeparated(), DbType.String, ParameterDirection.Input, 4000);

                    p.Add("@MinPrice", criteriaBo.MinPrice, DbType.Decimal, ParameterDirection.Input);
                    p.Add("@MaxPrice", criteriaBo.MaxPrice, DbType.Decimal, ParameterDirection.Input);

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

                    p.Add("@ApiSessionId", criteriaBo.Session.ApiSessionId, 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 <ProductFilterListBo>("spProductFilterList", 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 <ProductFilterListBo> >();
            }

            stopwatch.Stop();

            return(responseBo);
        }
        public ResponseBo <ProductFilterListSummaryBo> GetListSummary(ProductFilterGetListCriteriaBo criteriaBo)
        {
            ResponseBo <ProductFilterListSummaryBo> responseBo = new ResponseBo <ProductFilterListSummaryBo>();

            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("@SearchWord", criteriaBo.SearchWord, DbType.String, ParameterDirection.Input, 50);
                    p.Add("@ProductCategoryId", criteriaBo.ProductCategoryId, DbType.Int32, ParameterDirection.Input);
                    p.Add("@PropertyListStr", criteriaBo.PropertyList.ToStrSeparated(), DbType.String, ParameterDirection.Input, 4000);

                    p.Add("@MinPrice", criteriaBo.MinPrice, DbType.Decimal, ParameterDirection.Input);
                    p.Add("@MaxPrice", criteriaBo.MaxPrice, DbType.Decimal, ParameterDirection.Input);

                    p.Add("@ApiSessionId", criteriaBo.Session.ApiSessionId, 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 <ProductFilterListSummaryBo>("spProductFilterListSummary", p, commandType: CommandType.StoredProcedure).FirstOrDefault();
                    responseBo.Message   = p.Get <string>("@Message");
                    responseBo.IsSuccess = p.Get <bool>("@IsSuccess");

                    if (responseBo.Bo != null && responseBo.Bo.PropertyListJson.IsNotNull())
                    {
                        responseBo.Bo.PropertyList = JsonConvert.DeserializeObject <List <PropertyListBo> >(responseBo.Bo.PropertyListJson);
                    }
                }
            }
            catch (Exception ex)
            {
                responseBo = base.SaveExLog(ex, this.GetType(), MethodBase.GetCurrentMethod().Name, criteriaBo).ToResponse <ProductFilterListSummaryBo>();
            }

            return(responseBo);
        }