public UserControlRatingQuote(RatingQuoteRule passedRule = null) { this.passedRule = passedRule; InitializeComponent(); InitializeCustomComponents(); InitializePassedRule(); }
public Rule InvokeSubmission(RuleKind ruleKind) { bool parsingSuccessfulRatingClass = double.TryParse(textBoxRatingClass.Text, out double ratingClass); bool parsingSuccessfulNumericValue = double.TryParse(textBoxNumericValue.Text, out double numericValue); if (!parsingSuccessfulNumericValue || !parsingSuccessfulRatingClass) { MessageBox.Show("Bitte eine gültige Zahl eingeben."); return(null); } if (passedRule != null) { passedRule.Name = textBoxName.Text; passedRule.MaxRatio = numericValue; passedRule.RatingClass = ratingClass; return(passedRule); } RatingQuoteRule newRatingQuoteRule = new RatingQuoteRule(ratingClass, numericValue, RuleKind.MAX_RATING_RATIO, textBoxName.Text); TableUtility tableUtility = new TableUtility(); tableUtility.CreateTable(newRatingQuoteRule); tableUtility.InsertTableRow(newRatingQuoteRule); return(newRatingQuoteRule); }