public void SetData(AttributionRuleDTO dto) { RuleName = dto.Description; Target = dto.Target; Value = dto.Value; Conditions = new ConditionSet(dto.Conditions); }
public AddOrEditAttributionRuleForm(SocialImportanceAsset asset, AttributionRuleDTO dto) { InitializeComponent(); this.asset = asset; this.dto = dto; this.UpdatedGuid = Guid.Empty; //Validators _targetVariableBox.AllowUniversal = false; _targetVariableBox.AllowNil = false; _targetVariableBox.AllowComposedName = false; _targetVariableBox.AllowLiteral = false; _valueFieldBox.OnlyIntOrVariable = true; _ruleDescriptionTextBox.Text = dto.Description; _valueFieldBox.Value = dto.Value; _targetVariableBox.Value = (Name)dto.Target; if (this.dto.Id != Guid.Empty) { this.Text = "Edit SI Attribution Rule"; button1.Text = "Update"; } }
public void UpdateAttributionRule(AttributionRuleDTO ruleDefinition) { var rule = m_attributionRules.FirstOrDefault(a => a.GUID == ruleDefinition.Id); if (rule == null) { throw new Exception("Attribution rule not found"); } rule.SetData(ruleDefinition); }
public AttributionRuleDTO AddAttributionRule(AttributionRuleDTO ruleDefinition) { var at = new AttributionRule(ruleDefinition); if (m_attributionRules.Add(at)) { return(at.ToDTO()); } return(null); }
private void buttonAddAttRule_Click(object sender, EventArgs e) { var newRule = new AttributionRuleDTO() { Description = "-", Value = WellFormedNames.Name.BuildName("[v]"), Target = WellFormedNames.Name.BuildName("[t]") }; this.auxAddOrUpdateItem(newRule); }
private void auxAddOrUpdateItem(AttributionRuleDTO item) { var diag = new AddOrEditAttributionRuleForm(_loadedAsset, item); diag.ShowDialog(this); if (diag.UpdatedGuid != Guid.Empty) { attributionRules.DataSource = _loadedAsset.GetAttributionRules().ToList(); EditorTools.HighlightItemInGrid <AttributionRuleDTO>(dataGridViewAttributionRules, diag.UpdatedGuid); } }
public AttributionRule(AttributionRuleDTO dto) : this() { SetData(dto); }
public AttributionRule(AttributionRuleDTO dto) { Target = (Name)dto.Target; Value = dto.Value; Conditions = new ConditionSet(dto.Conditions); }