public ActionResult Details(string ProductId) { if (String.IsNullOrWhiteSpace(ProductId)) { ProductId = "PGI7BK"; } CompanyGroup.Dto.ServiceRequest.GetAllStructure allStructure = new CompanyGroup.Dto.ServiceRequest.GetAllStructure(); CompanyGroup.Dto.WebshopModule.Structures structures = this.PostJSonData<CompanyGroup.Dto.WebshopModule.Structures>("StructureService", "GetAll", allStructure); CompanyGroup.Dto.ServiceRequest.GetItemByProductId request = new CompanyGroup.Dto.ServiceRequest.GetItemByProductId() { ProductId = ProductId, DataAreaId = CatalogueController.DataAreaId, VisitorId = this.ReadObjectIdFromCookie(), Currency = this.ReadCurrencyFromCookie() }; CompanyGroup.Dto.WebshopModule.Product product = this.PostJSonData<CompanyGroup.Dto.WebshopModule.Product>("ProductService", "GetItemByProductId", request); CompanyGroup.Dto.WebshopModule.CompatibleProducts compatibleProducts = this.PostJSonData<CompanyGroup.Dto.WebshopModule.CompatibleProducts>("ProductService", "GetCompatibleProducts", request); Cms.CommonCore.Models.Visitor visitor = this.GetVisitorInfo(); CompanyGroup.Dto.ServiceRequest.GetBannerList bannerListRequest = new CompanyGroup.Dto.ServiceRequest.GetBannerList() { BscFilter = true, HrpFilter = true, Category1IdList = new List<string>() { product.FirstLevelCategory.Id }, Category2IdList = new List<string>() { product.SecondLevelCategory.Id }, Category3IdList = new List<string>() { product.ThirdLevelCategory.Id }, Currency = this.ReadCurrencyFromCookie(), VisitorId = visitor.Id }; CompanyGroup.Dto.WebshopModule.BannerList bannerList = this.PostJSonData<CompanyGroup.Dto.WebshopModule.BannerList>("ProductService", "GetBannerList", bannerListRequest); //kosár lekérdezések bool shoppingCartOpenStatus = this.ReadShoppingCartOpenedFromCookie(); bool catalogueOpenStatus = this.ReadCatalogueOpenedFromCookie(); Cms.CommonCore.Models.Response.ShoppingCartInfo cartInfo = Cms.CommonCore.Models.Factory.CreateShoppingCartInfo(); //(visitor.IsValidLogin) ? this.GetCartInfo() : if (visitor.IsValidLogin && !String.IsNullOrEmpty(this.ReadCartIdFromCookie())) { CompanyGroup.Dto.WebshopModule.ShoppingCartInfo shoppingCartInfo = this.PostJSonData<CompanyGroup.Dto.WebshopModule.ShoppingCartInfo>("ShoppingCartService", "GetShoppingCartInfo", new { CartId = this.ReadCartIdFromCookie(), VisitorId = visitor.Id }); cartInfo.ActiveCart = (shoppingCartInfo != null) ? shoppingCartInfo.ActiveCart : cartInfo.ActiveCart; cartInfo.OpenedItems = (shoppingCartInfo != null) ? shoppingCartInfo.OpenedItems : cartInfo.OpenedItems; cartInfo.StoredItems = (shoppingCartInfo != null) ? shoppingCartInfo.StoredItems : cartInfo.StoredItems; cartInfo.LeasingOptions = (shoppingCartInfo != null) ? shoppingCartInfo.LeasingOptions : cartInfo.LeasingOptions; } CompanyGroup.Dto.PartnerModule.DeliveryAddresses deliveryAddresses; if (visitor.IsValidLogin) { CompanyGroup.Dto.ServiceRequest.GetDeliveryAddresses getDeliveryAddresses = new CompanyGroup.Dto.ServiceRequest.GetDeliveryAddresses() { DataAreaId = CatalogueController.DataAreaId, VisitorId = visitor.Id }; deliveryAddresses = this.PostJSonData<CompanyGroup.Dto.PartnerModule.DeliveryAddresses>("CustomerService", "GetDeliveryAddresses", new { DataAreaId = CatalogueController.DataAreaId, VisitorId = visitor.Id }); } else { deliveryAddresses = new CompanyGroup.Dto.PartnerModule.DeliveryAddresses() { Items = new List<CompanyGroup.Dto.PartnerModule.DeliveryAddress>() }; } //aktív kosár azonosítójának mentése http cookie-ba if (!String.IsNullOrWhiteSpace(cartInfo.ActiveCart.Id)) { this.WriteCartIdToCookie(cartInfo.ActiveCart.Id); } return View("Details", new Cms.Webshop.Models.CatalogueItem(structures, product, compatibleProducts.Items, compatibleProducts.ReverseItems, visitor, bannerList, cartInfo.ActiveCart, cartInfo.OpenedItems, cartInfo.StoredItems, shoppingCartOpenStatus, catalogueOpenStatus, deliveryAddresses, cartInfo.LeasingOptions)); }
/// <summary> /// view első betöltődés /// </summary> /// <returns></returns> public ActionResult Index() { //látogató lekérdezése Cms.CommonCore.Models.Visitor visitor = this.GetVisitorInfo(); //struktúrák lekérdezése CompanyGroup.Dto.ServiceRequest.GetAllStructure allStructure = new CompanyGroup.Dto.ServiceRequest.GetAllStructure() { ActionFilter = false, BargainFilter = false, Category1IdList = new List<string>(), Category2IdList = new List<string>(), Category3IdList = new List<string>(), HrpFilter = true, BscFilter = true, IsInNewsletterFilter = false, ManufacturerIdList = new List<string>(), NewFilter = false, StockFilter = false, TextFilter = String.Empty, PriceFilter = "0", PriceFilterRelation = "0", NameOrPartNumberFilter = "" }; CompanyGroup.Dto.WebshopModule.Structures structures = this.PostJSonData<CompanyGroup.Dto.WebshopModule.Structures>("StructureService", "GetAll", allStructure); //katalógus lekérdezése CompanyGroup.Dto.ServiceRequest.GetAllProduct allProduct = new CompanyGroup.Dto.ServiceRequest.GetAllProduct() { ActionFilter = false, BargainFilter = false, Category1IdList = new List<string>(), Category2IdList = new List<string>(), Category3IdList = new List<string>(), Currency = this.ReadCurrencyFromCookie(), CurrentPageIndex = 1, HrpFilter = true, BscFilter = true, IsInNewsletterFilter = false, ItemsOnPage = 30, ManufacturerIdList = new List<string>(), NewFilter = false, Sequence = 0, StockFilter = false, TextFilter = String.Empty, PriceFilter = "0", PriceFilterRelation = "0", VisitorId = visitor.Id, NameOrPartNumberFilter = "" }; CompanyGroup.Dto.WebshopModule.Products products = this.PostJSonData<CompanyGroup.Dto.WebshopModule.Products>("ProductService", "GetAll", allProduct); //banner lista lekérdezése CompanyGroup.Dto.ServiceRequest.GetBannerList bannerListRequest = new CompanyGroup.Dto.ServiceRequest.GetBannerList() { BscFilter = true, HrpFilter = true, Category1IdList = new List<string>(), Category2IdList = new List<string>(), Category3IdList = new List<string>(), Currency = this.ReadCurrencyFromCookie(), VisitorId = visitor.Id }; CompanyGroup.Dto.WebshopModule.BannerList bannerList = this.PostJSonData<CompanyGroup.Dto.WebshopModule.BannerList>("ProductService", "GetBannerList", bannerListRequest); //kosár lekérdezések bool shoppingCartOpenStatus = this.ReadShoppingCartOpenedFromCookie(); bool catalogueOpenStatus = this.ReadCatalogueOpenedFromCookie(); Cms.CommonCore.Models.Response.ShoppingCartInfo cartInfo = Cms.CommonCore.Models.Factory.CreateShoppingCartInfo(); //(visitor.IsValidLogin) ? this.GetCartInfo() : if (visitor.IsValidLogin && !String.IsNullOrEmpty(this.ReadCartIdFromCookie())) { CompanyGroup.Dto.WebshopModule.ShoppingCartInfo shoppingCartInfo = this.PostJSonData<CompanyGroup.Dto.WebshopModule.ShoppingCartInfo>("ShoppingCartService", "GetShoppingCartInfo", new { CartId = this.ReadCartIdFromCookie(), VisitorId = visitor.Id }); cartInfo.ActiveCart = (shoppingCartInfo != null) ? shoppingCartInfo.ActiveCart : cartInfo.ActiveCart; cartInfo.OpenedItems = (shoppingCartInfo != null) ? shoppingCartInfo.OpenedItems : cartInfo.OpenedItems; cartInfo.StoredItems = (shoppingCartInfo != null) ? shoppingCartInfo.StoredItems : cartInfo.StoredItems; cartInfo.LeasingOptions = (shoppingCartInfo != null) ? shoppingCartInfo.LeasingOptions : cartInfo.LeasingOptions; } CompanyGroup.Dto.PartnerModule.DeliveryAddresses deliveryAddresses; if (visitor.IsValidLogin) { CompanyGroup.Dto.ServiceRequest.GetDeliveryAddresses getDeliveryAddresses = new CompanyGroup.Dto.ServiceRequest.GetDeliveryAddresses() { DataAreaId = CatalogueController.DataAreaId, VisitorId = visitor.Id }; deliveryAddresses = this.PostJSonData<CompanyGroup.Dto.PartnerModule.DeliveryAddresses>("CustomerService", "GetDeliveryAddresses", new { DataAreaId = CatalogueController.DataAreaId, VisitorId = visitor.Id }); } else { deliveryAddresses = new CompanyGroup.Dto.PartnerModule.DeliveryAddresses() { Items = new List<CompanyGroup.Dto.PartnerModule.DeliveryAddress>() }; } Cms.Webshop.Models.Catalogue catalogue = new Cms.Webshop.Models.Catalogue(structures, products, visitor, cartInfo.ActiveCart, cartInfo.OpenedItems, cartInfo.StoredItems, shoppingCartOpenStatus, catalogueOpenStatus, deliveryAddresses, bannerList, cartInfo.LeasingOptions); //aktív kosár azonosítójának mentése http cookie-ba if (!String.IsNullOrWhiteSpace(cartInfo.ActiveCart.Id)) { this.WriteCartIdToCookie(cartInfo.ActiveCart.Id); } return View("Index", catalogue); }