コード例 #1
0
 public SizesController(EcommerceContext context)
 {
     _context = context;
 }
コード例 #2
0
        public CustomersController(EcommerceContext context, ICustomerRepository customerRepository)

        {
            _context            = context;
            _customerRepository = customerRepository;
        }
コード例 #3
0
 public UsersController(EcommerceContext db)
 {
     _db = db;
 }
コード例 #4
0
 /// <summary>
 /// Constructeur
 /// </summary>
 /// <param name="contexte">Contexte EF à utiliser</param>
 public ProduitCommand(EcommerceContext contexte)
 {
     _contexte = contexte;
 }
コード例 #5
0
            /// <summary>
            /// Get the Details for a particular product.
            /// </summary>
            /// <param name="productId">The product id you need the details for.</param>
            /// <returns>The View for that product.</returns>
            public async Task <ActionResult> Index(string productId = "")
            {
                EcommerceContext         ecommerceContext         = ServiceUtilities.GetEcommerceContext(this.HttpContext);
                OrgUnitOperationsHandler orgUnitOperationsHandler = new OrgUnitOperationsHandler(ecommerceContext);

                PagedResult <Category> categories = await orgUnitOperationsHandler.GetNavigationalHierarchyCategories(Utilities.DefaultQuerySettings);

                IEnumerable <long> rawCategoryIds = categories.Select(c => c.RecordId);

                ObservableCollection <long> productIds = null;
                Product prod = null;
                Collection <CustomLink> breadcrumbNavLinks = new Collection <CustomLink>();
                long productIdentifier;

                if (string.IsNullOrEmpty(productId) || !long.TryParse(productId, out productIdentifier))
                {
                    RetailLogger.Log.OnlineStoreInvalidProductIdProvided(productId);
                    return(this.RedirectToAction(HomeController.DefaultActionName, HomeController.ControllerName));
                }
                else
                {
                    // add productId to an ObservableCollection
                    productIds = new ObservableCollection <long>();
                    productIds.Add(productIdentifier);

                    ProductSearchCriteria searchCriteria = new ProductSearchCriteria
                    {
                        DataLevelValue = 4,
                        Ids            = productIds
                    };

                    // try and get product information
                    ProductOperationsHandler     productOperationsHandler = new ProductOperationsHandler(ecommerceContext);
                    PagedResult <ProductCatalog> productCatalogs          = await productOperationsHandler.GetProductCatalogs(Utilities.DefaultQuerySettings);

                    IEnumerable <long> activeCatalogIds = productCatalogs.Results.Select(pc => pc.RecordId);

                    PagedResult <Product> products = await productOperationsHandler.SearchProducts(searchCriteria, activeCatalogIds, Utilities.DefaultQuerySettings);

                    if (!products.Results.Any())
                    {
                        var message = string.Format("ProductIds: {0}.", string.Join(",", productIds));
                        RetailLogger.Log.OnlineStoreNoProductsFound(message);
                        return(this.RedirectToAction(HomeController.DefaultActionName, HomeController.ControllerName));
                    }

                    prod = products.Results.First <Product>();

                    // Breadcrumb Navigation Links
                    // add current item
                    breadcrumbNavLinks.Add(new CustomLink("/ProductDetails?productId=" + prod.RecordId, prod.ProductName));

                    Category currentCategory = this.GetCategoryById(prod.CategoryIds.First(), categories);

                    while (currentCategory.ParentCategory != 0)
                    {
                        breadcrumbNavLinks.Add(new CustomLink("/ProductGallery?categoryId=" + currentCategory.RecordId, currentCategory.Name));
                        currentCategory = this.GetCategoryById(currentCategory.ParentCategory, categories);
                    }

                    breadcrumbNavLinks.Add(new CustomLink("/", "Home"));
                }

                prod = (await ProductDetailsController.PopulateViewSpecificProductInfo(new Product[] { prod }, ecommerceContext)).FirstOrDefault();

                return(this.View(ProductDetailsController.ProductDetailsViewName, new ProductDetailsModel(prod, breadcrumbNavLinks)));
            }
コード例 #6
0
 public SalesPriceDAO(EcommerceContext contexto)
 {
     this.contexto = contexto;
 }
コード例 #7
0
 public UserDetailsRepository(EcommerceContext context)
 {
     _context = context;
 }
コード例 #8
0
 public UsuariosController(EcommerceContext context)
 {
     _context = context;
 }
コード例 #9
0
 public UsersController(EcommerceContext context, IHttpContextAccessor httpContextAccessor)
 {
     _context             = context;
     _httpContextAccessor = httpContextAccessor;
 }
コード例 #10
0
 public Responsitory(EcommerceContext _context)
 {
     _dbContext = _context;
     _dbSet     = _context.Set <T>();
 }
コード例 #11
0
 public ChangePriceOfferServices(EcommerceContext context)
 {
     _context = context;
 }
コード例 #12
0
 public EmailSender(EcommerceContext context)
 {
     _context = context;
 }
コード例 #13
0
 public ProductTypesController(EcommerceContext context)
 {
     _context = context;
 }
コード例 #14
0
 public ProductsController(EcommerceContext db)
 {
     _db = db;
 }
コード例 #15
0
 public ProductService(EcommerceContext context)
 {
     _context = context;
 }
コード例 #16
0
 public void ClienteController1(EcommerceContext parametro)
 {
     ContextCliente = parametro;
 }
コード例 #17
0
 public PictureHelperController(IWebHostEnvironment environment, EcommerceContext context)
 {
     _environment = environment;
     _context     = context;
 }
コード例 #18
0
 public CategoryDAO()
 {
     db = new EcommerceContext();
 }
コード例 #19
0
 public PurchaseController(EcommerceContext db)
 {
     this.db = db;
 }
コード例 #20
0
 public ReportsController(EcommerceContext context, IReportRepository reportRepository)
 {
     _context          = context;
     _reportRepository = reportRepository;
 }
コード例 #21
0
 public ItemsController(EcommerceContext context)
 {
     _context = context;
 }
コード例 #22
0
 public ProdutoCorRepository(EcommerceContext context) : base(context)
 {
     _context = context;
 }
コード例 #23
0
            public static async Task <IEnumerable <Product> > PopulateViewSpecificProductInfo(IEnumerable <Product> products, EcommerceContext ecommerceContext)
            {
                if (products == null)
                {
                    return(products);
                }

                foreach (Product product in products)
                {
                    string extensionPropertyValue = await Utilities.ToCurrencyString((decimal)product.AdjustedPrice, ecommerceContext);

                    product.ExtensionProperties.SetPropertyValue("FormattedAdjustedPrice", ExtensionPropertyTypes.String, extensionPropertyValue);

                    extensionPropertyValue = await Utilities.ToCurrencyString((decimal)product.BasePrice, ecommerceContext);

                    product.ExtensionProperties.SetPropertyValue("FormattedBasePrice", ExtensionPropertyTypes.String, extensionPropertyValue);

                    decimal savingsPercent = 0M;
                    if (product.BasePrice > 0)
                    {
                        savingsPercent = 100 - ((decimal)product.AdjustedPrice / (decimal)product.BasePrice * 100);
                    }

                    extensionPropertyValue = await Utilities.ToCurrencyString(savingsPercent, ecommerceContext);

                    product.ExtensionProperties.SetPropertyValue("SavingsPercent", ExtensionPropertyTypes.String, extensionPropertyValue);
                }

                return(products);
            }
コード例 #24
0
 public UserProductsController(EcommerceContext context, UserManager <K101User> userManager, IWebHostEnvironment appEnvironment)
 {
     _context        = context;
     _userManager    = userManager;
     _appEnvironment = appEnvironment;
 }
コード例 #25
0
 public ProductDAO(EcommerceContext contexto)
 {
     this.contexto = contexto;
 }
コード例 #26
0
 public LogsController(EcommerceContext context)
 {
     _context = context;
 }
コード例 #27
0
 public StockEntriesController(EcommerceContext context)
 {
     _context = context;
 }
コード例 #28
0
            /// <summary>
            /// Return View with optional search criteria added.
            /// </summary>
            /// <param name="categoryId">Required: Category id to show products for.</param>
            /// <param name="filterBrands">List of brands to show (comma separated).</param>
            /// <param name="filterCategories">List of categories to show (comma separated).</param>
            /// <returns>View of Products.</returns>
            public async Task <ActionResult> Index(string categoryId = "", string[] filterBrands = null, string[] filterCategories = null)
            {
                EcommerceContext         ecommerceContext         = ServiceUtilities.GetEcommerceContext(this.HttpContext);
                OrgUnitOperationsHandler orgUnitOperationsHandler = new OrgUnitOperationsHandler(ecommerceContext);

                PagedResult <Category> categories = await orgUnitOperationsHandler.GetNavigationalHierarchyCategories(Utilities.DefaultQuerySettings);

                IEnumerable <long> rawCategoryIds = categories.Select(c => c.RecordId);

                // determine what category to load products for, if null, load all products
                ObservableCollection <long> categoryIds;

                if (string.IsNullOrEmpty(categoryId))
                {
                    categoryIds = new ObservableCollection <long>(rawCategoryIds);
                }
                else
                {
                    categoryIds = new ObservableCollection <long>();
                    categoryIds.Add(long.Parse(categoryId));
                }

                // Category Id to Name Mapping
                Dictionary <long, string> mapping = new Dictionary <long, string>();

                foreach (Category category in categories)
                {
                    mapping.Add(category.RecordId, category.Name);
                }

                // Retrieving Products - make sure we include products from descendant categories too
                ProductSearchCriteria searchCriteria = new ProductSearchCriteria
                {
                    DataLevelValue = 4,
                    CategoryIds    = categoryIds,
                    IncludeProductsFromDescendantCategories = true
                };

                // try and get product information
                ProductOperationsHandler productOperationsHandler = new ProductOperationsHandler(ecommerceContext);

                PagedResult <ProductCatalog> productCatalogs = await productOperationsHandler.GetProductCatalogs(Utilities.DefaultQuerySettings);

                IEnumerable <long> activeCatalogIds = productCatalogs.Results.Select(pc => pc.RecordId);

                PagedResult <Product> products = await productOperationsHandler.SearchProducts(searchCriteria, activeCatalogIds, Utilities.DefaultQuerySettings);

                // Breadcrumb Navigation Links
                Collection <CustomLink> breadcrumbNavLinks = new Collection <CustomLink>();
                Category currentCategory = this.GetCategoryById(long.Parse(categoryId), categories);

                while (!currentCategory.ParentCategory.Equals((long?)0))
                {
                    breadcrumbNavLinks.Add(new CustomLink("/ProductGallery?categoryId=" + currentCategory.RecordId, currentCategory.Name));
                    currentCategory = this.GetCategoryById(currentCategory.ParentCategory, categories);
                }

                breadcrumbNavLinks.Add(new CustomLink("/", "Home"));

                // Filter Mapping
                Dictionary <string, string[]> filters = new Dictionary <string, string[]>();

                filters.Add("brand", filterBrands);
                filters.Add("categories", filterCategories);

                IEnumerable <Product> productList = await ProductDetailsController.PopulateViewSpecificProductInfo(products.Results, ecommerceContext);

                // create a new product gallery model for the view
                ProductGalleryModel productGalleryModel = new ProductGalleryModel(long.Parse(categoryId), productList, breadcrumbNavLinks, mapping, filters);

                return(this.View(ProductGalleryController.ProductGalleryViewName, productGalleryModel));
            }
コード例 #29
0
 public Repository(EcommerceContext context)
 {
     this.context = context;
     this.dbSet   = this.context.Set <T>();
 }
コード例 #30
0
 public AdminProductsController(EcommerceContext context)
 {
     _context = context;
 }