private void AdapterConfig() { EntityAssemblyConfig cfg = GetSelectedAdapterConfig(); if (cfg == null) { return; } // FormMain.AdapterEnableUpdate() may save NTServiceConfig.xml file, the EntityAssemblyConfig in this file should be readonly. // Therefore we use EntityAssemblyConfig in SolutionDir instead, as the EntityInitializeArgument and other properties in the EntityAssemblyConfig // may be modified when it is need to load the IMessageEntityConfig from the assembly. // And therefore, there is no need to deep copy EntityAssemblyConfig object. EntityContractBase contract = _solutionConfigMgr.Config.FindEntityByID(cfg.EntityInfo.EntityID); if (contract == null) { return; } EntityAssemblyConfig safeCfg = contract.AssemblyConfig; safeCfg.AssemblyLocation = Path.Combine(_solutionDirPath, safeCfg.AssemblyLocation); safeCfg.InitializeArgument.ConfigFilePath = Path.Combine(_solutionDirPath, safeCfg.InitializeArgument.ConfigFilePath); safeCfg.InitializeArgument.Description = "HL7 Gateway Configuration GUI"; FormEntity frm = new FormEntity(safeCfg); frm.ShowDialog(this); }
private void DeleteEntity() { if (this.listViewEntity.SelectedItems.Count < 1) { return; } EntityContractBase c = this.listViewEntity.SelectedItems[0].Tag as EntityContractBase; //Program.ConfigMgt.Config.Entities.Remove(c); Program.ConfigMgt.Config.UnregisterEnity(c); RefreshEntityList(); }
static void UnregisterEntityFromSolution() { try { EntityAssemblyConfig entity = Program.ConfigMgt.Config.EntityAssembly; EntityContractBase contract = null; foreach (EntityContractBase e in SolutionMgt.Config.Entities) { if (e.EntityID == entity.EntityInfo.EntityID) { contract = e; break; } } if (contract == null) { MessageBox.Show("Following message entity does not exist in the integration solution.\r\n\r\n" + entity.EntityInfo.Name + " (" + entity.EntityInfo.EntityID + ")", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { //SolutionMgt.Config.Entities.Remove(contract); SolutionMgt.Config.UnregisterEnity(contract); if (SolutionMgt.Save()) { Log.Write("Save solution dir file succeeded. " + SolutionMgt.FileName); MessageBox.Show("Unregister following message entity from the integration solution succeeded.\r\n\r\n" + entity.EntityInfo.Name + " (" + entity.EntityInfo.EntityID + ")", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { Log.Write(LogType.Error, "Save solution dir file failed."); Log.Write(SolutionMgt.LastError); MessageBox.Show("Unregister following message entity from the integration solution failed.\r\n\r\n" + entity.EntityInfo.Name + " (" + entity.EntityInfo.EntityID + ")", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception err) { Log.Write(err); } }
public ResponserWrapper(EntityContractBase p) { Responser = p; }
public PublisherWrapper(EntityContractBase p) { Publisher = p; }
static void RegisterEntityIntoSolution() { try { EntityAssemblyConfig entity = Program.ConfigMgt.Config.EntityAssembly; foreach (EntityContractBase e in SolutionMgt.Config.Entities) { if (e.EntityID == entity.EntityInfo.EntityID) { MessageBox.Show("Following message entity has already existed in the integration solution.\r\n\r\n" + entity.EntityInfo.Name + " (" + entity.EntityInfo.EntityID + ")", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } EntityConfigAgent agent = new EntityConfigAgent(Program.ConfigMgt.Config.EntityAssembly, Program.Log); if (agent.Initialize(Program.ConfigMgt.Config.EntityAssembly.InitializeArgument)) { EntityConfigBase cfg = agent.EntityConfig; EntityContractBase c = new EntityContractBase(); c.Name = cfg.Name; c.DeviceName = cfg.DeviceName; c.Direction = cfg.Direction; c.Interaction = cfg.Interaction; c.Description = cfg.Description; c.EntityID = cfg.EntityID; if (cfg.PublishConfig != null) { c.Publication = cfg.PublishConfig.Publication; } if (cfg.ResponseConfig != null) { c.ResponseDescription = cfg.ResponseConfig.ResponseContract; } c.AssemblyConfig = GetEntityAssemblyConfigForSolution(entity); //string webConfigFilePath = Path.Combine(Application.StartupPath, EntityWebConfig.EntityWebConfigFileName); //ConfigManager<EntityWebConfig> webmgt = new ConfigManager<EntityWebConfig>(webConfigFilePath); //if (webmgt.Load()) //{ // Log.Write("Register entity with default web config at: " + webConfigFilePath); // SolutionMgt.Config.RegisterEntity(c, webmgt.Config); //} //else //{ // Log.Write("Register entity without default web config."); // SolutionMgt.Config.RegisterEntity(c); //} Log.Write("Registering entity."); SolutionMgt.Config.RegisterEntity(c); if (SolutionMgt.Save()) { Log.Write("Save solution dir file succeeded. " + SolutionMgt.FileName); MessageBox.Show("Register following message entity into the integration solution succeeded.\r\n\r\n" + entity.EntityInfo.Name + " (" + entity.EntityInfo.EntityID + ")", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { Log.Write(LogType.Error, "Save solution dir file failed."); Log.Write(SolutionMgt.LastError); MessageBox.Show("Register following message entity into the integration solution failed.\r\n\r\n" + entity.EntityInfo.Name + " (" + entity.EntityInfo.EntityID + ")", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } agent.Uninitialize(); } } catch (Exception err) { Log.Write(err); } }