Example #1
0
        public ResponseDto <List <ProductCategoryRawListDto> > GetRawList(ProductCategoryGetListAdminCriteriaDto criteriaDto)
        {
            ProductCategoryGetListAdminCriteriaBo criteriaBo = new ProductCategoryGetListAdminCriteriaBo()
            {
                ParentId = criteriaDto.ParentId,

                Session = Session
            };

            ResponseBo <List <ProductCategoryListAdminBo> > responseBo = productCategoryBusiness.GetListAdmin(criteriaBo);

            ResponseDto <List <ProductCategoryRawListDto> > responseDto = responseBo.ToResponseDto <List <ProductCategoryRawListDto>, List <ProductCategoryListAdminBo> >();

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

                        ParentId = itemBo.ParentId
                    });
                }
            }

            return(responseDto);
        }
        public ResponseBo <List <ProductCategoryListAdminBo> > GetListAdmin(ProductCategoryGetListAdminCriteriaBo criteriaBo)
        {
            ResponseBo <List <ProductCategoryListAdminBo> > responseBo = new ResponseBo <List <ProductCategoryListAdminBo> >();

            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("@ParentId", criteriaBo.ParentId, 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 <ProductCategoryListAdminBo>("spProductCategoryListAdmin", 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 <ProductCategoryListAdminBo> >();
            }

            return(responseBo);
        }