internal override RuleBifurcationInfo ToRuleBifurcationInfo(out RuleBifurcationInfo additionalBifurcationInfo) { RuleBifurcationInfo ruleBifurcationInfo = new RuleBifurcationInfo(); RuleBifurcationInfo ruleBifurcationInfo2 = new RuleBifurcationInfo(); foreach (SmtpAddress smtpAddress in this.Addresses) { if (!smtpAddress.IsValidAddress) { throw new ArgumentException(RulesTasksStrings.InvalidRecipient(smtpAddress.ToString()), "Address"); } ruleBifurcationInfo.FromLists.Add(smtpAddress.ToString()); ruleBifurcationInfo2.Lists.Add(smtpAddress.ToString()); } foreach (SmtpAddress smtpAddress2 in this.Addresses2) { if (!smtpAddress2.IsValidAddress) { throw new ArgumentException(RulesTasksStrings.InvalidRecipient(smtpAddress2.ToString()), "Address"); } ruleBifurcationInfo.Lists.Add(smtpAddress2.ToString()); ruleBifurcationInfo2.FromLists.Add(smtpAddress2.ToString()); } additionalBifurcationInfo = ruleBifurcationInfo2; return(ruleBifurcationInfo); }
internal override Action ToInternalAction() { StringBuilder stringBuilder = new StringBuilder(); foreach (SmtpAddress smtpAddress in this.Addresses) { if (!smtpAddress.IsValidAddress) { throw new ArgumentException(RulesTasksStrings.InvalidRecipient(smtpAddress.ToString()), "Addresses"); } string value = smtpAddress.ToString(); if (string.IsNullOrEmpty(value)) { throw new ArgumentException(RulesTasksStrings.InvalidRecipient(smtpAddress.ToString()), "Addresses"); } if (stringBuilder.Length > 0) { stringBuilder.Append(";"); } stringBuilder.Append(value); } return(TransportRuleParser.Instance.CreateAction("ModerateMessageByUser", new ShortList <Argument> { new Value(stringBuilder.ToString()) }, Utils.GetActionName(this))); }
protected override void ValidateRead(List <ValidationError> errors) { if (this.Addresses == null || this.Addresses.Length == 0) { errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.ArgumentNotSet, base.Name)); return; } foreach (SmtpAddress smtpAddress in this.Addresses) { if (!smtpAddress.IsValidAddress) { errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.InvalidRecipient(smtpAddress.ToString()), base.Name)); return; } } if (this.Addresses2 == null || this.Addresses2.Length == 0) { errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.ArgumentNotSet, base.Name)); return; } foreach (SmtpAddress smtpAddress2 in this.Addresses2) { if (!smtpAddress2.IsValidAddress) { errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.InvalidRecipient(smtpAddress2.ToString()), base.Name)); return; } } base.ValidateRead(errors); }
internal override RuleBifurcationInfo ToRuleBifurcationInfo(out RuleBifurcationInfo additionalBifurcationInfo) { additionalBifurcationInfo = null; RuleBifurcationInfo ruleBifurcationInfo = new RuleBifurcationInfo(); foreach (SmtpAddress smtpAddress in this.Addresses) { if (!smtpAddress.IsValidAddress) { throw new ArgumentException(RulesTasksStrings.InvalidRecipient(smtpAddress.ToString()), "Address"); } ruleBifurcationInfo.Recipients.Add(smtpAddress.ToString()); } return(ruleBifurcationInfo); }
internal override Condition ToInternalCondition() { ShortList <string> shortList = new ShortList <string>(); foreach (SmtpAddress smtpAddress in this.Addresses) { string text = smtpAddress.ToString(); if (string.IsNullOrEmpty(text)) { throw new ArgumentException(RulesTasksStrings.InvalidRecipient(text), "Address"); } shortList.Add(text); } return(TransportRuleParser.Instance.CreatePredicate(this.internalPredicateName, TransportRuleParser.Instance.CreateProperty(this.internalPropertyName), shortList)); }
internal override RuleBifurcationInfo ToRuleBifurcationInfo(out RuleBifurcationInfo additionalBifurcationInfo) { additionalBifurcationInfo = null; RuleBifurcationInfo ruleBifurcationInfo = new RuleBifurcationInfo(); foreach (SmtpAddress smtpAddress in this.Addresses) { string text = smtpAddress.ToString(); if (string.IsNullOrEmpty(text)) { throw new ArgumentException(RulesTasksStrings.InvalidRecipient(text), "Address"); } ruleBifurcationInfo.Managers.Add(text); } ruleBifurcationInfo.IsSenderEvaluation = (this.EvaluatedUser == EvaluatedUser.Sender); return(ruleBifurcationInfo); }
internal override Action[] ToInternalActions() { List <Action> list = new List <Action>(); foreach (SmtpAddress smtpAddress in this.Addresses) { ShortList <Argument> shortList = new ShortList <Argument>(); string text = smtpAddress.ToString(); if (string.IsNullOrEmpty(text)) { throw new ArgumentException(RulesTasksStrings.InvalidRecipient(text), "Addresses"); } shortList.Add(new Value(text)); Action item = TransportRuleParser.Instance.CreateAction(this.internalActionName, shortList, Utils.GetActionName(this)); list.Add(item); } return(list.ToArray()); }