public CatalogController( ICatalogRepository repository, ITaskRepository taskRepository, ICatalogView catalogView, INewCatalogView newCatalogView, INewSupplyView newSupplyView, INewHardwareView newHardwareView, IEditSupplyView editSupplyView, IEditHardwareView editHardwareView, INewHardwareSupplyView newHardwareSupplyView, IEditHardwareSupplyView editHardwareSupplyView, IImportHardwareView importHardwareView, ILoadingView loadingView) { this.catalogView = catalogView; this.newCatalogView = newCatalogView; this.newSupplyView = newSupplyView; this.newHardwareView = newHardwareView; this.editSupplyView = editSupplyView; this.editHardwareView = editHardwareView; this.newHardwareSupplyView = newHardwareSupplyView; this.editHardwareSupplyView = editHardwareSupplyView; this.importHardwareView = importHardwareView; this.loadingView = loadingView; this.repository = repository; this.taskRepository = taskRepository; }
/// <summary> /// Executes the command in the specified context. /// </summary> /// <param name="context">The context.</param> public override void Execute(CommandContext context) { Assert.ArgumentNotNull(context, "context"); string id = context.Parameters["id"]; if (!ID.IsID(id)) { return; } Item orderItem = Sitecore.Context.ContentDatabase.GetItem(new ID(id)); if (orderItem == null) { return; } ICatalogView view = context.CustomData as ICatalogView; if (view == null) { return; } ClientPipelineArgs args = new ClientPipelineArgs(new NameValueCollection(context.Parameters)); args.Parameters.Add("uri", orderItem.Uri.ToString()); args.Parameters["fields"] = this.GetFields(view.EditorFields); args.CustomData.Add("catalogView", view); ContinuationManager.Current.Start(this, "Run", args); }
/// <summary> /// Runs the specified args. /// </summary> /// <param name="args">The pipeline args.</param> protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (!args.IsPostBack) { if (Configuration.Settings.GetBoolSetting(SettingName, true)) { this.OpenFieldEditor(args); } else { this.OpenContentEditor(args); } } else { if (args.HasResult) { this.SaveFieldEditorValues(args); ICatalogView view = args.CustomData["catalogView"] as ICatalogView; if (view != null) { view.RefreshGrid(); } } } }
public ApplicationWindow(INavigationView navigationView, IDealView dealView, IProjectView projectView, ICatalogView catalogView, IErrorLogView errorLogView) : this() { this.LeftPanel.Children.Add(navigationView as UserControl); (navigationView as UserControl).Margin = new Thickness(0, 0, 0, 0); (navigationView as UserControl).BorderBrush = Brushes.LightGray; (navigationView as UserControl).BorderThickness = new Thickness(0, 0, 0, 0); this.CenterPanel.Children.Add(dealView as UserControl); (dealView as UserControl).Margin = new Thickness(0, 0, 0, 0); (dealView as UserControl).BorderThickness = new Thickness(0, 0, 0, 0); dealView.HideView(); this.CenterPanel.Children.Add(projectView as UserControl); (projectView as UserControl).Margin = new Thickness(0, 0, 0, 0); (projectView as UserControl).BorderThickness = new Thickness(0, 0, 0, 0); projectView.HideView(); this.CenterPanel.Children.Add(catalogView as UserControl); (catalogView as UserControl).Margin = new Thickness(0, 0, 0, 0); (catalogView as UserControl).BorderThickness = new Thickness(0, 0, 0, 0); catalogView.HideView(); this.FooterPanel.Children.Add(errorLogView as UserControl); (errorLogView as UserControl).Margin = new Thickness(0, 0, 0, 0); (errorLogView as UserControl).BorderThickness = new Thickness(0, 0, 0, 0); }
/// <summary> /// Executes the command in the specified context. /// </summary> /// <param name="context">The context.</param> public override void Execute(CommandContext context) { string orderNumber = context.Parameters["orderNumber"]; string statusCode = context.Parameters["statusCode"]; IOrderManager <Order> orderProvider = Context.Entity.Resolve <IOrderManager <Order> >(); Order order = orderProvider.GetOrder(orderNumber); order.Status = Context.Entity.Resolve <OrderStatus>(statusCode); order.ProcessStatus(); orderProvider.SaveOrder(order); ICatalogView catalogView = context.CustomData as ICatalogView; if (catalogView != null) { IEntity orderEntity = order as IEntity; if (orderEntity != null) { catalogView.SelectedRowsId = new StringCollection { orderEntity.Alias }; catalogView.RefreshGrid(); catalogView.UpdateRibbon(); } } }
public CatalogController(ICatalogService service, ICatalogView view) { this._service = service; this._view = view; this._view.filterChanged += new ViewHandler <ICatalogView>(this.filterChanged); this._view.availabilityButtonClicked += new AvailabilityHandler <ICatalogView>(this.addAvailability); this._view.searchStockButtonClicked += new SearchStockHandler <ICatalogView>(this.searchStockAvailable); }
/* * Adds a new "shipment" to the database for the given day, item id, and stock quantity */ private void addAvailability(ICatalogView view, AvailabilityEventArgs e) { CatalogItemsStock shipment = new CatalogItemsStock(); shipment.CatalogItemId = e.itemId; shipment.AvailableStock = e.itemStock; shipment.Date = e.shipDate; _service.CreateAvailableStock(shipment); _view.NotifyAvailabilityUpdated(); }
/// <summary> /// Gets the order item. /// </summary> /// <param name="context">The context.</param> /// <returns>Returns the order item.</returns> protected virtual Item GetEditItem(CommandContext context) { ICatalogView catalogView = context.CustomData as ICatalogView; if (catalogView == null || catalogView.SelectedRowsId == null || catalogView.SelectedRowsId.Count > 1) { return(null); } return(Sitecore.Context.ContentDatabase.SelectSingleItem(catalogView.SelectedRowsId[0])); }
/// <summary> /// Initializes a new instance of the <see cref="CatalogPresenter"/> class. /// </summary> /// <param name="view">The order catalog view.</param> public CatalogPresenter(ICatalogView view) { this.View = view; this.catalog = new Catalog { ItemUri = this.View.CatalogUri, Database = Database.GetDatabase(this.View.CurrentItemUri.DatabaseName), Language = this.View.CurrentItemUri.Language }; this.View.Search += this.Search; this.View.TextBoxCreating += this.TextBoxCreating; this.View.ChecklistCreating += this.ChecklistCreating; this.View.GridRowDoubleClick += this.GridRowDoubleClick; this.View.GridRowSelect += this.GridRowSelect; }
/// <summary> /// Renders the panel. /// </summary> /// <param name="output">The output writer.</param> /// <param name="ribbon">The ribbon.</param> /// <param name="button">The button.</param> /// <param name="context">The context.</param> public override void Render(HtmlTextWriter output, Ribbon ribbon, Item button, CommandContext context) { this.CatalogView = context.CustomData as ICatalogView; this.Initilize(); Order currentOrder = this.Presenter.CurrentOrder(); if (currentOrder != null) { RenderText(output, this.GetText(currentOrder)); IEnumerable <OrderStatusCommand> commands = this.Presenter.GetOrderStatusesCommands(currentOrder.Status); Sitecore.Context.ClientPage.ClientResponse.DisableOutput(); foreach (OrderStatusCommand command in commands) { this.RenderSmallButton(output, ribbon, string.Empty, command.Title, command.Icon, command.Title, new OrderStatusCommandBuilder(currentOrder, command).ToString(), this.Enabled, false); } Sitecore.Context.ClientPage.ClientResponse.EnableOutput(); } }
/* * Gets the number of stock available for a given item and date, then updates the * view to reflect the result. */ private void searchStockAvailable(ICatalogView view, SearchStockEventArgs e) { int res = _service.GetAvailableStock(e.date, e.itemId); _view.ShowStockAvailability(e, res); }
/* * When a filter is changed in the view, we need to request all catalog items * in the database which satisfy the new filter */ private void filterChanged(ICatalogView view, FilterEventArgs e) { LoadCatalogItems(e.brandFilterValue, e.typeFilterValue); }
/// <summary> /// Constructor /// </summary> public CatalogPresenter(ICatalogView view, Window windowHandler, IStartView mainView) { this.view = view; this.windowHandler = windowHandler; this.mainView = mainView; }