private void ConfigureHandlers() { var redis = ConnectionMultiplexer.Connect("localhost"); var productView = new ProductView(new RedisReadModelRepository<ProductDto>(redis.GetDatabase())); ServiceLocator.ProductView = productView; var eventMappings = new EventHandlerDiscovery() .Scan(productView) .Handlers; var subscriptionName = "admin_readmodel"; var topicFilter1 = "Admin.Common.Events"; var b = RabbitHutch.CreateBus("host=localhost"); b.Subscribe<PublishedMessage>(subscriptionName, m => { Aggregate handler; var messageType = Type.GetType(m.MessageTypeName); var handlerFound = eventMappings.TryGetValue(messageType, out handler); if (handlerFound) { var @event = JsonConvert.DeserializeObject(m.SerialisedMessage, messageType); handler.AsDynamic().ApplyEvent(@event, ((Event)@event).Version); } }, q => q.WithTopic(topicFilter1)); var bus = new RabbitMqBus(b); ServiceLocator.Bus = bus; }
private void ProductButton_Click(object sender, EventArgs e) { ProductView product = new ProductView(); Helper.AssignFormToPanel(DashboardView.Container, product); }
public HomeIndexView() { lastProduct = new ProductView(); LastPdf = new List<PdfView>(); }
public ActionResult Index(SearchParam parameters) { if (TempData["ErrorMessage"] != null) { ViewBag.ErrorMessage = TempData["ErrorMessage"]; } else { ViewBag.ErrorMessage = ""; } if ((parameters.UserLocation != Session["UserLoc"]) || ((parameters.UserLocation == null) && (Session["UserLoc"] != null))) { parameters.UserLocation = Session["UserLoc"].ToString(); //the user has changed the zipcode, so GLatLong loc = new GLatLong(); loc = GeoCodingHelper.GetLatLong(parameters.UserLocation); if (loc != null) { Session["UserLocLat"] = loc.Latitude; Session["UserLocLong"] = loc.Longitude; Session["UserLoc"] = parameters.UserLocation; } else { return(RedirectToAction("LocationToSearch", "Home")); } } else if ((Session["UserLoc"] == null) && (WebSecurity.CurrentUserId != null)) { var LocationsSearched = dbmeals.LocationsSearcheds.Where(x => x.UserID == WebSecurity.CurrentUserId).OrderByDescending(x => x.DateCreated).ToList().FirstOrDefault(); if (LocationsSearched != null) { Session["UserLoc"] = LocationsSearched.Location; parameters.FreeSearch = LocationsSearched.Keywords; Session["UserLocLat"] = LocationsSearched.Latitude; Session["UserLocLong"] = LocationsSearched.Longitude; if (String.IsNullOrEmpty(parameters.DistanceSearch)) { parameters.DistanceSearch = LocationsSearched.Distance.HasValue ? LocationsSearched.Distance.Value.ToString() : string.Empty; } // parameters.PickUpDateSearch = Common.AbsoluteEnd(LocationsSearched.DateRangeStart.HasValue ? LocationsSearched.DateRangeStart.Value : DateTime.Now);// LocationsSearched.DateRangeStart; //parameters.DateRangeEnd = LocationsSearched.DateRangeEnd; } else { return(RedirectToAction("LocationToSearch", "Home")); } } if (String.IsNullOrEmpty(parameters.DistanceSearch)) { parameters.DistanceSearch = "10"; } if (parameters.PickUpDateSearch == null) { parameters.PickUpDateSearch = DateTime.Now; } string pointofreference = Session["UserLocLat"] + "," + Session["UserLocLong"]; LocationsSearched ls = new LocationsSearched(); ls.Location = Convert.ToString(Session["UserLoc"]);//.ToString(); ls.Keywords = parameters.FreeSearch; ls.Latitude = Convert.ToDecimal(Session["UserLocLat"]); ls.Longitude = Convert.ToDecimal(Session["UserLocLong"]); ls.DateRangeStart = Common.AbsoluteStart(parameters.PickUpDateSearch); ls.DateRangeEnd = Common.AbsoluteEnd(parameters.PickUpDateSearch); ls.Distance = Convert.ToInt32(parameters.DistanceSearch); ls.DistanceUnit = "km"; ls.DateCreated = DateTime.Now; ls.UserID = WebSecurity.CurrentUserId; try { dbmeals.LocationsSearcheds.Add(ls); dbmeals.SaveChanges(); } catch (Exception e) { string message = e.Message; } try { ICollection <ISolrFacetQuery> list = AllFacetFields.Except(SelectedFacetFields(parameters)). Select(f => new SolrFacetFieldQuery(f) { MinCount = 1 }) .Cast <ISolrFacetQuery>().ToList(); var start = (parameters.PageIndex - 1) * parameters.PageSize; var matchingProducts = solr.Query(BuildQuery(parameters), new QueryOptions { FilterQueries = BuildFilterQueries(parameters), Rows = parameters.PageSize, Start = start, OrderBy = GetSelectedSort(parameters), SpellCheck = new SpellCheckingParameters(), Facet = new FacetParameters { Queries = list }, ExtraParams = new Dictionary <string, string> { // uncomment for filtering by distance { "fq", "{!geofilt}" }, { "d", parameters.DistanceSearch }, // distance.ToString(CultureInfo.InvariantCulture)} replace distance with your radius filter { "sfield", "latlng" }, // replace lat_long with your field in solr that stores the lat long values { "pt", pointofreference }, // this is the point of reference // {"sort","geodist() asc"}, { "fl", "*,Distance:geodist()" }, } }); var distancemodel = new DistanceViewModel(); // var matchingProducts var ProductModel = new ProductView { WholeSet = matchingProducts, Search = parameters, TotalCount = matchingProducts.NumFound, Facets = matchingProducts.FacetFields, // PickUpTimeFacet = GetPickUpTimeFacet(matchingProducts.FacetQueries), // DistanceFacet = GetDistanceFacet(matchingProducts.FacetQueries), DidYouMean = GetSpellCheckingResult(matchingProducts), //DistanceLimitList.SelectedDistance = parameters.DistanceLimit }; // Preselect the option with Value = "US" // Make sure you have such option in the Countries list List <SolrResultSet> SolrResultSetList = new List <SolrResultSet>(); SolrResultSetList = (from n in ProductModel.WholeSet select n).ToList(); var ProductViewModel = new ResultSetViewModel(); ProductViewModel.Search = ProductModel.Search; ProductViewModel.TotalCount = ProductModel.TotalCount; ProductViewModel.Facets = ProductModel.Facets; ProductViewModel.DidYouMean = ProductModel.DidYouMean; ProductViewModel.FoodItems = (from g in SolrResultSetList select new foodtoshare() { ProviderType = g.ProviderType, Distance = g.Distance, latlng = g.latlng, PhoneNumber = g.PhoneNumber, FullAddress = g.FullAddress, Cuisine = g.Cuisine, MealAdID = g.MealAdID, MealItemName = g.MealItemName, FoodType = g.FoodType, MealType = g.MealType, Price = g.Price, Ingredients = g.Ingredients, AllergenicIngredients = g.AllergenicIngredients, Timestamp = g.Timestamp, Description = g.Description }).ToList(); distancemodel.SelectedDistanceLimit = parameters.DistanceSearch; ProductViewModel.DistanceDD = distancemodel; return(View(ProductViewModel)); } catch (SolrConnectionException e) { string msg = e.Message; return(View(new ResultSetViewModel { QueryError = true, })); } }
public RootTableSource(ProductModel[] products, ProductView owner) { _products = products; this._owner = owner; }
private void RemoveDepartment(ProductView pv) { ProductDao.Instance().Delete(pv.product_cd); ProductViewLists.Remove(pv); }
public void AddProduct(ProductView product) { _products.Add(product); }
public OrderCommandHandlers(IRepository repository, IProductsView ProductsProductsView) { this.repository = repository; this.productView = new ProductView(ProductsProductsView); }
private void OpenWindow(string windowName) { try { WindowName name = windowName.ConvertToWindowName(); Window window = null; switch (name) { case WindowName.NewSaleView: window = new NewSaleView(); break; case WindowName.CustomerView: window = new CustomerView(); break; case WindowName.NewPurchaseView: window = new NewPurchaseView(); break; case WindowName.SupplierView: window = new SupplierView(); break; case WindowName.SaleView: window = new SaleView(); break; case WindowName.PurchaseView: window = new PurchaseView(); break; case WindowName.ProductView: window = new ProductView(); break; case WindowName.ServiceView: window = new ServiceView(); break; case WindowName.ChargeView: window = new ChargeView(); break; case WindowName.SaleReportView: window = new SaleReportView(); break; case WindowName.PurchaseReportView: window = new PurchaseReportView(); break; case WindowName.ProductReportView: window = new ProductReportView(); break; } window?.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public Products() { ProductsProductView = new FakeProductsProductView(); productView = new ProductView(ProductsProductView); }
public void Update(ProductView product) { _productRepository.Update(Mapper.Map <Product>(product)); _productRepository.SaveChanges(); }
public double CalculateAPrice(ProductView productView, double quantity) { double sum = productView.Price * quantity; return(sum); }