protected override void OnWizardClosed(DialogResult result)
        {
            if (result == DialogResult.OK)
            {
                foreach(var i in newProjectSupplyPage.TypedPage.CatalogHardwareViewModel)
                {
                    for (int cpt = 0; cpt < i.Quantity; cpt++)
                    {
                        var command = new CreateNewProjectHardwareCommand(
                        projectId,
                        i.CatalogId,
                        i.Id);

                        this.EventBroker.Publish(command, Topics.COMMANDS);
                    }
                }
            }
        }
示例#2
0
        public void ProcessAction(CreateNewProjectHardwareCommand eventObject)
        {
            var catalog = this.catalogRepository.FindById(eventObject.CatalogId);
            var hardware = catalog.Hardwares.Where(x => x.Id == eventObject.HardwareId).First();
            var project = this.projectRepository.FindById(eventObject.ProjectId);

            var projectHardware = MapProjectHardware(project, hardware, new ProjectHardware(),  catalog);

            project.Hardwares.Add(projectHardware);
            int index = project.Hardwares.IndexOf(projectHardware);

            this.projectRepository.Save(project);
            projectHardware = project.Hardwares[index];

            this.eventBroker.Publish(new ProjectHardwareCreatedEvent(project.Id, projectHardware.Id), Topics.EVENTS);
        }