public void Validate(ValidationResult result) { if (Timers == null) { Timers = new List <Timer>(); } if (Inputs.Select(param => param.Key).Distinct().Count() != Inputs.Count()) { result.AddUserError("Duplicate Keys found on Inputs."); } if (Attributes.Select(param => param.Key).Distinct().Count() != Attributes.Count()) { result.AddUserError("Duplicate Keys found on Attributes."); } if (InputCommands.Select(param => param.Key).Distinct().Count() != InputCommands.Count()) { result.AddUserError("Duplicate Keys found on Input Commands."); } if (StateMachines.Select(param => param.Key).Distinct().Count() != StateMachines.Count()) { result.AddUserError("Duplicate Keys found on State Machines."); } if (OutputCommands.Select(param => param.Key).Distinct().Count() != OutputCommands.Count()) { result.AddUserError("Duplicate Keys found on Output Commands."); } if (Timers.Select(param => param.Key).Distinct().Count() != Timers.Count()) { result.AddUserError("Duplicate Keys found on Timers."); } foreach (var input in Inputs) { input.Validate(this, result); } foreach (var attribute in Attributes) { attribute.Validate(this, result); } foreach (var inputCommand in InputCommands) { inputCommand.Validate(this, result); } foreach (var stateMachine in StateMachines) { stateMachine.Validate(this, result); } foreach (var outputCommand in OutputCommands) { outputCommand.Validate(this, result); } foreach (var timer in Timers) { timer.Validate(this, result); } }
/// <summary> /// This should be call before doing final storage, will reduce the size of /// unused fields /// </summary> public void SetEmptyValueToNull() { foreach (var err in ErrorMessages) { err.SetEmptyValueToNull(); } if (String.IsNullOrEmpty(MediaItemId)) { MediaItemId = null; } if (String.IsNullOrEmpty(MessageId)) { MessageId = null; } if (!Log.Any()) { Log = null; } if (!OutputCommands.Any()) { OutputCommands = null; } if (!OutgoingMessages.Any()) { OutgoingMessages = null; } if (!ErrorMessages.Any()) { ErrorMessages = null; } if (!InfoMessages.Any()) { InfoMessages = null; } if (!WarningMessages.Any()) { WarningMessages = null; } if (Envelope.SetEmptyValueToNull()) { Envelope = null; } }
/// <summary> /// Method for Output commands /// </summary> /// <param name="command">Enum for OutputCommands</param> private void DesignOutputCommand(OutputCommands command) { try { switch (command) { case OutputCommands.Closeout: DesignAndProcessCommand(new CloseoutDialog(mainForm)); break; case OutputCommands.Header: DesignAndProcessCommand(new HeaderoutDialog(mainForm)); break; case OutputCommands.Printout: DesignAndProcessCommand(new PrintoutDialog(mainForm)); break; case OutputCommands.Reports: DesignAndProcessCommand(new ReportDialog(mainForm)); break; case OutputCommands.Routeout: DesignAndProcessCommand(new RouteoutDialog(mainForm)); break; case OutputCommands.StoreOutput: DesignAndProcessCommand(new StoringOutputDialog(mainForm)); break; case OutputCommands.Type: DesignAndProcessCommand(new TypeoutDialog(mainForm)); break; default: break; } //switch } //try finally { //programEditor.SavePGM(Files.LastPgm); }//finally }
/// <summary> /// Method for Output commands /// </summary> /// <param name="command">Enum for OutputCommands</param> private void DesignOutputCommand(OutputCommands command) { try { switch (command) { case OutputCommands.Closeout: DesignAndProcessCommand(new CloseoutDialog(mainForm)); break; case OutputCommands.Header: DesignAndProcessCommand(new HeaderoutDialog(mainForm)); break; case OutputCommands.Printout: DesignAndProcessCommand(new PrintoutDialog(mainForm)); break; case OutputCommands.Reports: DesignAndProcessCommand(new ReportDialog(mainForm)); break; case OutputCommands.Routeout: DesignAndProcessCommand(new RouteoutDialog(mainForm)); break; case OutputCommands.StoreOutput: DesignAndProcessCommand(new StoringOutputDialog(mainForm)); break; case OutputCommands.Type: DesignAndProcessCommand(new TypeoutDialog(mainForm)); break; default: break; }//switch } //try finally { //programEditor.SavePGM(Files.LastPgm); }//finally }