// GET: ProductInfo
        public ActionResult ProductInfo()
        {
            //查询出商品信息
            var code = Request["id"];
            ViewBag.code = Request["id"];
            var pro = ProService.GetEntity(x => x.Code == code);
            ViewBag.name = pro.Name;
            ViewBag.describe = pro.Describe;//描述
            ViewBag.price = pro.Price;
            ViewBag.img = pro.img;
            //遍历出来图片
            //for(int i=0;i < pro.img.Split(',').Length;i++)
            //{
            //    ViewBag.img[i] = pro.img.Split(',')[i];
            //}
            ViewBag.img1 = pro.img.Split(',')[0];
            ViewBag.img2 = pro.img.Split(',')[1];
            //  ViewBag.img3 = pro.img.Split(',')[2];
            //根据商品查询出来库存
            Stock stock = StockService.GetEntity(x => x.BillId == code);
            ViewBag.stock = stock.num;
            PropertyInfo[] pis = typeof(Stock).GetProperties();//反射  暂时用不到,用来遍历实体用
            //根据商品查询处商品规格
            int? id = pro.SpecificationId;
            Specification specification = SpecificationService.GetEntity(x => x.Id == id);
            var specification1 = SpecificationService.GetEntities(x => x.ProCode == pro.Code);
            ViewBag.Spcification = specification1;
            //产品描述
            ViewBag.describe = pro.Describe;
            //用户评价
            var proDuctReview = ProductReviewService.GetEntities(x => x.Pcode == pro.Code);
            ViewBag.ProReview = proDuctReview.ToList();

            return View();
        }
Example #2
0
 public Service(ApplicationDbContext context)
 {
     //repository
     BillingAddressRepository   = new Repository <BillingAddress>(context);
     CategoryRepository         = new Repository <Category>(context);
     ImageRepository            = new Repository <Image>(context);
     ReviewRepository           = new Repository <Review>(context);
     ManufacturerRepository     = new Repository <Manufacturer>(context);
     OrderRepository            = new Repository <Order>(context);
     OrderCountRepository       = new Repository <OrderCount>(context);
     OrderItemRepository        = new Repository <OrderItem>(context);
     ProductRepository          = new Repository <Product>(context);
     ProductCategoryMapping     = new Repository <ProductCategoryMapping>(context);
     ProductImageMapping        = new Repository <ProductImageMapping>(context);
     ProductManufacturerMapping = new Repository <ProductManufacturerMapping>(context);
     ContactUsMessageRepository = new Repository <ContactUsMessage>(context);
     VisitorCountRepository     = new Repository <VisitorCount>(context);
     //service
     CategoryService      = new CategoryService(context, CategoryRepository, ProductCategoryMapping);
     ProductService       = new ProductService(context, ProductRepository);
     ImageManagerService  = new ImageManagerService(ImageRepository, ProductImageMapping);
     ManufacturerService  = new ManufacturerService(context, ManufacturerRepository, ProductManufacturerMapping);
     ReviewService        = new ReviewService(context, ReviewRepository);
     SpecificationService = new SpecificationService(context, SpecificationRepository, ProductSpecificationMapping);
     ContactUsService     = new ContactUsService(ContactUsMessageRepository);
     OrderService         = new OrderService(OrderRepository, OrderItemRepository, OrderCountService, context);
     OrderCountService    = new OrderCountService(OrderCountRepository);
     VisitorCountService  = new VisitorCountService(VisitorCountRepository, context);
 }
 /// <summary>
 /// Executes the save specification.
 /// </summary>
 /// <param name="evaluation">Evaluation.</param>
 partial void ExecuteSaveSpecification(Evaluation evaluation)
 {
     SpecificationService.ThrowIfAnySpecificationIsNotSatisfiedBy(
         evaluation,
         new EvaluationValidGameSpecification(),
         new EvaluationValidProsAndConsSpecification());
 }
Example #4
0
        public IList <ArticleBase> GetArticlesByGameKey(long gameKey)
        {
            var gameService = new GameService();
            var game        = gameService.GetGameByKey(gameKey);

            SpecificationService.ThrowIfAnySpecificationIsNotSatisfiedBy(game, new GameExistsSpecification());

            var eventService     = new EventService();
            var interviewService = new InterviewService();
            var newsService      = new NewsService();
            var previewService   = new PreviewService();
            var reviewService    = new ReviewService();


            var articles = new List <ArticleBase> ();

            articles.AddRange(eventService.GetEventsByGameKey(gameKey));
            articles.AddRange(interviewService.GetInterviewsByGameKey(gameKey));
            articles.AddRange(newsService.GeNewsByGameKey(gameKey));
            articles.AddRange(previewService.GetPreviewsByGameKey(gameKey));
            articles.AddRange(reviewService.GetReviewsByGameKey(gameKey));


            return(articles.OrderBy(a => a.Title).ToList());
        }
Example #5
0
 public GetHandler(
     SpecificationService specificationService,
     Configuration configuration)
 {
     _specification.UseFactory(specificationService.Generate);
     _configuration = configuration;
 }
Example #6
0
 /// <summary>
 /// Executes the save specification.
 /// </summary>
 /// <param name="game">Game.</param>
 partial void ExecuteSaveSpecification(Game game)
 {
     SpecificationService.ThrowIfAnySpecificationIsNotSatisfiedBy(
         game,
         new GameUniqueNameSpecification(),
         new GameValidPlatformsSpecification(),
         new GameValidDeveloperCompaniesSpecification());
 }
Example #7
0
        protected IList <TEntity> GetEntitiesByGameKey(long gameKey)
        {
            var gameService = new GameService();
            var game        = gameService.GetGameByKey(gameKey);

            SpecificationService.ThrowIfAnySpecificationIsNotSatisfiedBy(game, new GameExistsSpecification());

            return(MainRepository.FindAll(e => e.GamesRelated.Contains(game)).ToList());
        }
Example #8
0
        public CommodityDetail GetByCommodity(int id)
        {
            // Load();
            var item = CommodityService.GetById(id);

            if (item != null && item.commodityState == CommodityStates.putaway)
            {
                var list = new List <SpecificationAndSpecificationDetail>();
                if (!string.IsNullOrWhiteSpace(item.specificationId))
                {
                    string[] spIds = item.specificationId.Split(',');
                    for (int i = 0; i < spIds.Count(); i++)
                    {
                        int specificationId = 0;
                        int.TryParse(spIds[i], out specificationId);
                        var specification = SpecificationService.GetSpecificationAndSpecificationDetailById(specificationId);
                        if (specification != null)
                        {
                            list.Add(specification);
                        }
                    }
                    //return new CommodityDetail(item, ImageUrl, list,null);
                }
                //int userId = 0;
                //var user = _securityHelper.GetCurrentUser();
                //if (user != null)
                //    userId = user.CurrentUser.UserId;
                //var request = new ReviewRequest();
                //request.CommodityId = item.commodityId;
                //request.State = ReviewStates.Show;
                //request.UserId = userId;
                ////request.State = ReviewStates.Show;
                //ListReviewView ListRv = new ListReviewView();
                //var Review = ReviewService.MicroMallQuery(request);
                //if(Review!=null)
                //{
                //    ListRv.TotalCount = Review.TotalCount;
                //    int TotalPage = Math.Max((Review.TotalCount + request.PageSize - 1) / request.PageSize, 1);
                //    if (1 == TotalPage)
                //    {
                //        ListRv.NextPage = 0;
                //    }
                //    else if (1 < TotalPage)
                //    {
                //        ListRv.NextPage = 2;
                //    }
                //    ListRv.List = Review.ModelList.Select(x => new ReviewView() {Content=x.Content, ReviewId=x.ReviewId, SubmitTime=x.SubmitTime.ToString(), UserId=x.UserId, UserName=x.UserName }).ToList();
                //}
                var site = SiteService.Query(new SiteRequest()).FirstOrDefault();
                if (site != null)
                {
                    ImageUrl = site.imageUrl;
                }
                return(new CommodityDetail(item, ImageUrl, list, null));
            }
            return(new CommodityDetail(null, "", null, null));
        }
        public void SetUp()
        {
            _specifications = Substitute.For <ISpecificationsApiClient>();

            _service = new SpecificationService(_specifications,
                                                new ResiliencePolicies
            {
                SpecificationsRepositoryPolicy = Policy.NoOpAsync()
            });
        }
Example #10
0
        /// <summary>
        /// Asserts the groups.
        /// </summary>
        /// <typeparam name="TTarget">The type of the target.</typeparam>
        /// <param name="target">The target.</param>
        /// <param name="groupKeys">The group keys.</param>
        public static void AssertGroups <TTarget>(TTarget target, params object[] groupKeys)
        {
            var notSatisfiedSpecifications = SpecificationService.FilterSpecificationsAreNotSatisfiedBy(target, groupKeys);

            if (notSatisfiedSpecifications != null && notSatisfiedSpecifications.Any())
            {
                throw new DomainSpecificationNotSatisfiedException()
                      .SetNotSatisfiedSpecificationsErrors(notSatisfiedSpecifications);
            }
        }
Example #11
0
        protected override void Load(ContainerBuilder builder)
        {
            // database
            builder.RegisterType <DefaultDbContext>().As <DefaultDbContext>().InstancePerRequest();

            var userService = new UserService();

            builder.Register(c => userService).As <IUserService>().InstancePerRequest();
            builder.RegisterType <ManufacturerService>().As <IApiService <ManufacturerViewModel, int> >().As <IManufacturerService>().InstancePerRequest();

            var specificationService = new SpecificationService();

            builder.Register(c => specificationService).As <IApiService <SpecificationViewModel, int> >().As <ISpecificationService>().InstancePerRequest();
            builder.RegisterType <CategoryService>().As <IApiService <CategoryViewModel, int> >().As <ICategoryService>()
            .WithParameter("specificationService", specificationService)
            .InstancePerRequest();

            var productDetailService = new ProductDetailService();

            builder.Register(c => productDetailService).As <IApiService <ProductDetailViewModel, int> >().As <IProductDetailService>().InstancePerRequest();
            builder.RegisterType <ProductService>().As <IApiService <ProductViewModel, int> >().As <IProductService>()
            .WithParameter("productDetailService", productDetailService)
            .InstancePerRequest();

            builder.RegisterType <CustomerService>().As <IApiService <CustomerViewModel, int> >().As <ICustomerService>()
            .WithParameter("userService", userService)
            .InstancePerRequest();

            builder.RegisterType <BodyService>().As <IApiService <BodyViewModel, int> >().As <IBodyService>().InstancePerRequest();
            builder.RegisterType <TrackingRecordService>().As <IApiService <TrackingRecordViewModel, int> >().As <ITrackingRecordService>().InstancePerRequest();
            builder.RegisterType <SkinService>().As <IApiService <SkinViewModel, int> >().As <ISkinService>().InstancePerRequest();

            var purchaseDetailService = new PurchaseDetailService();

            builder.Register(c => purchaseDetailService).As <IApiService <PurchaseDetailViewModel, int> >().As <IPurchaseDetailService>().InstancePerRequest();
            builder.RegisterType <PurchaseService>().As <IApiService <PurchaseViewModel, int> >()
            .WithParameter("purchaseDetailService", purchaseDetailService)
            .InstancePerRequest();

            var shipmentDetailService = new ShipmentDetailService(userService);

            builder.Register(c => shipmentDetailService).As <IApiService <ShipmentDetailViewModel, int> >().As <IShipmentDetailService>().InstancePerRequest();
            builder.RegisterType <ShipmentService>().As <IApiService <ShipmentViewModel, int> >()
            .WithParameter("shipmentDetailService", shipmentDetailService)
            .WithParameter("userService", userService)
            .InstancePerRequest();

            builder.RegisterType <QueryService>().As <IQueryService>()
            .WithParameter("userService", userService)
            .InstancePerRequest();

            base.Load(builder);
        }
Example #12
0
        /// <summary>
        /// Executes the save specification.
        /// </summary>
        /// <param name="developer">Developer.</param>
        partial void ExecuteSaveSpecification(Developer developer)
        {
            SpecificationService.ThrowIfAnySpecificationIsNotSatisfiedBy(
                developer,

                new MustNotHaveNullOrDefaultPropertySpecification <Developer>(
                    d => d.AccountsAtIssuers,
                    d => d.Email,
                    d => d.FullName),

                new DeveloperMustHaveValidUsernameSpecification(),

                new MustBeUniqueSpecification <Developer>((t) => GetDeveloperByUsername(t.Username), "username"),

                new MustBeUniqueSpecification <Developer>((t) => GetDeveloperByEmail(t.Email), "e-mail"));

            SpecificationService.ThrowIfAnySpecificationIsNotSatisfiedByAny(
                developer.AccountsAtIssuers,
                new MustNotHaveNullOrDefaultPropertySpecification <DeveloperAccountAtIssuer>(
                    a => a.AchievementIssuerId,
                    a => a.Username));
        }
Example #13
0
 public DataGetHandler(
     SpecificationService specificationService)
 {
     _specification.UseFactory(specificationService.Generate);
 }
Example #14
0
 /// <summary>
 /// Executes the save specification.
 /// </summary>
 /// <param name="company">Company.</param>
 partial void ExecuteSaveSpecification(Company company)
 {
     SpecificationService.ThrowIfAnySpecificationIsNotSatisfiedBy(
         company,
         new CompanyUniqueNameSpecification());
 }
Example #15
0
 /// <summary>
 /// Executes the delete specification.
 /// </summary>
 /// <param name="gameKey">Game key.</param>
 /// <param name="game">Game.</param>
 partial void ExecuteDeleteSpecification(long gameKey, Game game)
 {
     SpecificationService.ThrowIfAnySpecificationIsNotSatisfiedBy(game, new GameExistsSpecification());
 }
 /// <summary>
 /// Executes the save specification.
 /// </summary>
 /// <param name="appliedtag">Appliedtag.</param>
 partial void ExecuteSaveSpecification(AppliedTag appliedtag)
 {
     SpecificationService.ThrowIfAnySpecificationIsNotSatisfiedBy(
         appliedtag,
         new AppliedTagSaveSpecification());
 }
 public SpecificationController()
 {
     _specificationService = new SpecificationService();
     _specificationMapper  = new SpecificationMapper();
 }
Example #18
0
 public CachedSpecificationService(SpecificationService specificationService)
 {
     _specificationService = specificationService;
 }