public void UpdateFromInstance(ServiceControlAuditInstance instance) { SetupServiceAccount(instance); InstanceName = instance.Name; Description = instance.Description; HostName = instance.HostName; PortNumber = instance.Port.ToString(); DatabaseMaintenancePortNumber = instance.DatabaseMaintenancePort.ToString(); LogPath = instance.LogPath; AuditForwardingQueueName = instance.AuditLogQueue; AuditQueueName = instance.AuditQueue; AuditForwarding = AuditForwardingOptions.FirstOrDefault(p => p.Value == instance.ForwardAuditMessages); UpdateAuditRetention(instance.AuditRetentionPeriod); }
public ServiceControlEditViewModel(ServiceControlInstance instance) { DisplayName = "EDIT SERVICECONTROL INSTANCE"; SelectLogPath = new SelectPathCommand(p => LogPath = p, isFolderPicker: true, defaultPath: LogPath); InstanceName = instance.Name; Description = instance.Description; var userAccount = UserAccount.ParseAccountName(instance.ServiceAccount); UseSystemAccount = userAccount.IsLocalSystem(); UseServiceAccount = userAccount.IsLocalService(); UseProvidedAccount = !(UseServiceAccount || UseSystemAccount); if (UseProvidedAccount) { ServiceAccount = instance.ServiceAccount; } HostName = instance.HostName; PortNumber = instance.Port.ToString(); DatabaseMaintenancePortNumber = instance.DatabaseMaintenancePort.ToString(); DatabaseMaintenancePortNumberRequired = instance.Version.Major >= 2; LogPath = instance.LogPath; AuditForwardingQueueName = instance.AuditLogQueue; AuditQueueName = instance.AuditQueue; AuditForwarding = AuditForwardingOptions.FirstOrDefault(p => p.Value == instance.ForwardAuditMessages); ErrorForwarding = ErrorForwardingOptions.FirstOrDefault(p => p.Value == instance.ForwardErrorMessages); UpdateErrorRetention(instance.ErrorRetentionPeriod); UpdateAuditRetention(instance.AuditRetentionPeriod); ErrorQueueName = instance.ErrorQueue; ErrorForwardingQueueName = instance.ErrorLogQueue; SelectedTransport = Transports.First(t => StringComparer.InvariantCultureIgnoreCase.Equals(t.Name, instance.TransportPackage)); ConnectionString = instance.ConnectionString; ServiceControlInstance = instance; ErrorForwardingVisible = instance.Version >= SettingsList.ForwardErrorMessages.SupportedFrom; //Both Audit and Error Retention Property was introduced in same version RetentionPeriodsVisible = instance.Version >= SettingsList.ErrorRetentionPeriod.SupportedFrom; }