public static HL7InterfaceConfig LoadConfigInfo(HL7InterfaceConfig config) { config.InterfaceName = GetInterfaceName(config); config.InterfaceStatus = GetServiceStatus(config.InterfaceName); return(config); }
public static void UpdateInterfaceName(HL7InterfaceConfig config) { if (string.IsNullOrEmpty(config.InterfaceFolder)) { return; } string strType = config.InterfaceType == InterfaceType.Receiver ? "HL7GW_RCV" : "HL7GW_SND"; string fileName = Path.Combine(Application.StartupPath, config.InterfaceFolder + "\\Bin\\Services\\" + strType + "\\NTServiceHost.xml"); ConfigManager <NTServiceHostConfig> ConfigMgt = new ConfigManager <NTServiceHostConfig>(fileName); if (ConfigMgt.Load()) { ConfigMgt.Config.ServiceName = config.InterfaceName; if (ConfigMgt.Save()) { Program.Log.Write("Update NT Service Host Config success :" + config.InterfaceName); } else { Program.Log.Write(LogType.Error, "Update NT Service Host Config failed :" + fileName); } } else { Program.Log.Write(LogType.Error, "Load NT Service Host Config failed :" + fileName); } }
internal static ManagerConfig CreateDefaultConfig() { ManagerConfig config = new ManagerConfig(); config.LoginUser = "******"; config.LoginPassword = "******"; config.AppCaption = "HL7 Gateway Interface Manager"; config.LogType = LogType.Error; config.InterfaceList = new XCollection <HL7InterfaceConfig>(); HL7InterfaceConfig sender = new HL7InterfaceConfig(); sender.InterfaceFolder = "Sender\\HL7GW_SND"; sender.InstallDate = DateTime.Now; sender.InterfaceName = "HL7GW_SND"; sender.InterfaceType = InterfaceType.Sender; sender.InterfaceStatus = InterfaceStatus.Running; config.InterfaceList.Add(sender); HL7InterfaceConfig receiver = new HL7InterfaceConfig(); receiver.InterfaceFolder = "Receiver\\HL7GW_RCV"; receiver.InstallDate = DateTime.Now; receiver.InterfaceName = "HL7GW_RCV"; receiver.InterfaceType = InterfaceType.Receiver; receiver.InterfaceStatus = InterfaceStatus.Running; config.InterfaceList.Add(receiver); return(config); }