public AppraisalRule(AppraisalRuleDTO appraisalRuleDTO) { m_id = (appraisalRuleDTO.Id == Guid.Empty)?Guid.NewGuid() : appraisalRuleDTO.Id; EventName = (Name)appraisalRuleDTO.EventMatchingTemplate; if (appraisalRuleDTO.Desirability == null) { Desirability = (Name)"0"; } else { Desirability = appraisalRuleDTO.Desirability; } if (appraisalRuleDTO.Praiseworthiness == null) { Praiseworthiness = (Name)"0"; } else { Praiseworthiness = appraisalRuleDTO.Praiseworthiness; } Conditions = appraisalRuleDTO.Conditions == null ? new ConditionSet() : new ConditionSet(appraisalRuleDTO.Conditions); }
private void addOrEditButton_Click_1(object sender, EventArgs e) { AppraisalRuleDTO newRule = new AppraisalRuleDTO(); try { newRule = new AppraisalRuleDTO() { EventMatchingTemplate = WellFormedNames.Name.BuildName( (Name)AMConsts.EVENT, (Name)comboBoxEventType.Text, textBoxSubject.Value, textBoxObject.Value, textBoxTarget.Value), Conditions = new ConditionSetDTO() }; if (_appraisalRuleToEdit != null) { newRule.Id = _appraisalRuleToEdit.Id; newRule.Conditions = _appraisalRuleToEdit.Conditions; newRule.AppraisalVariables = _appraisalRuleToEdit.AppraisalVariables; } _appraisalRulesVM.AddOrUpdateAppraisalRule(newRule); Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, Resources.ErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public AddOrEditAppraisalVariablesForm(AppraisalRulesVM appRulesVM, AppraisalRuleDTO selectedRule) { InitializeComponent(); this.appraisalVariables = new BindingListView <AppraisalVariableDTO>(new List <AppraisalVariableDTO>()); _vm = appRulesVM; this.dataGridViewAppraisalVariables.AutoGenerateColumns = true; _selectedRule = selectedRule; if (selectedRule == null) { return; } if (_selectedRule.AppraisalVariables == null) { _selectedRule.AppraisalVariables = new AppraisalVariables(new System.Collections.Generic.List <AppraisalVariableDTO>()); } this.appraisalVariables.DataSource = null; this.appraisalVariables.DataSource = selectedRule.AppraisalVariables.appraisalVariables; this.dataGridViewAppraisalVariables.DataSource = this.appraisalVariables; this.dataGridViewAppraisalVariables.Refresh(); }
public AddOrEditAppraisalRuleForm(AppraisalRulesVM ruleVM, AppraisalRuleDTO ruleToEdit = null) { InitializeComponent(); _appraisalRulesVM = ruleVM; _appraisalRuleToEdit = ruleToEdit; //validationRules textBoxSubject.AllowNil = false; textBoxSubject.AllowComposedName = false; //defaultValues textBoxSubject.Value = WellFormedNames.Name.UNIVERSAL_SYMBOL; textBoxObject.Value = WellFormedNames.Name.UNIVERSAL_SYMBOL; textBoxTarget.Value = WellFormedNames.Name.UNIVERSAL_SYMBOL; comboBoxEventType.DataSource = AppraisalRulesVM.EventTypes; if (ruleToEdit != null) { this.Text = Resources.EditAppraisalRuleFormTitle; this.addOrEditButton.Text = Resources.UpdateButtonLabel; comboBoxEventType.Text = ruleToEdit.EventMatchingTemplate.GetNTerm(1).ToString(); textBoxSubject.Value = ruleToEdit.EventMatchingTemplate.GetNTerm(2); textBoxObject.Value = ruleToEdit.EventMatchingTemplate.GetNTerm(3); textBoxTarget.Value = ruleToEdit.EventMatchingTemplate.GetNTerm(4); } }
public AppraisalRule(AppraisalRuleDTO appraisalRuleDTO) { EventName = Name.BuildName(appraisalRuleDTO.EventMatchingTemplate); Desirability = appraisalRuleDTO.Desirability; Praiseworthiness = appraisalRuleDTO.Praiseworthiness; Conditions = new ConditionSet(appraisalRuleDTO.Conditions.Select(c => Condition.Parse(c.Condition))); }
private void addOrEditButton_Click_1(object sender, EventArgs e) { var newRule = new AppraisalRuleDTO() { EventMatchingTemplate = eventTextBox.Text, Desirability = int.Parse(comboBoxDesirability.Text), Praiseworthiness = int.Parse(comboBoxPraiseworthiness.Text), Conditions = new List <ConditionDTO>(), }; try { if (_appraisalRuleToEdit != null) { newRule.Id = _appraisalRuleToEdit.Id; newRule.Conditions = _appraisalRuleToEdit.Conditions; } _appraisalRulesVM.AddOrUpdateAppraisalRule(newRule); Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, Resources.ErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public AddOrEditAppraisalVariableForm(AppraisalRulesVM ruleVM, AppraisalRuleDTO appraisalRule, AppraisalVariableDTO variable = null) { InitializeComponent(); _appraisalRulesVM = ruleVM; _toEdit = variable; _appraisalRule = appraisalRule; //validationRules appraisalVariableValueTextBox.AllowNil = false; appraisalVariableValueTextBox.AllowComposedName = false; appraisalVariableValueTextBox.AllowUniversal = false; //defaultValues appraisalVariableName.Items.Add(OCCAppraisalVariables.DESIRABILITY); appraisalVariableName.Items.Add(OCCAppraisalVariables.PRAISEWORTHINESS); appraisalVariableName.Items.Add(OCCAppraisalVariables.GOALSUCCESSPROBABILITY); appraisalVariableName.Items.Add(OCCAppraisalVariables.LIKE); appraisalVariableName.SelectedItem = OCCAppraisalVariables.DESIRABILITY; appraisalVariableValueTextBox.Value = (Name)"0"; //appraisalVariableName.DataSource = AppraisalRulesVM.EventTypes; appraisalVariableTarget.Enabled = true; if (_toEdit.Name != null) { this.addOrEditButton.Text = Resources.UpdateButtonLabel; appraisalVariableValueTextBox.Value = _toEdit.Value; appraisalVariableTarget.Value = _toEdit.Target; appraisalVariableName.SelectedIndex = appraisalVariableName.Items.IndexOf(_toEdit.Name); } }
public void ChangeCurrentRule(AppraisalRuleDTO rule) { if (rule != null) { this.SelectedRuleId = rule.Id; CurrentRuleConditions.SetData(_ea.GetAllAppraisalRuleConditions(SelectedRuleId)); } }
public void ChangeCurrentRule(AppraisalRuleDTO rule) { if (rule != null) { this.SelectedRuleId = rule.Id; this.CurrentRuleConditions.DataSource = _emotionalAppraisalAsset.GetAllAppraisalRuleConditions(SelectedRuleId).Set; this.CurrentRuleConditions.Refresh(); } }
/// <summary> /// Adds an emotional reaction to an event /// </summary> /// <param name="emotionalAppraisalRule">the AppraisalRule to add</param> public void AddOrUpdateAppraisalRule(AppraisalRuleDTO emotionalAppraisalRuleDTO) { AppraisalRule existingRule = GetAppraisalRule(emotionalAppraisalRuleDTO.Id); if (existingRule != null) { RemoveAppraisalRule(existingRule.Id); existingRule.EventName = emotionalAppraisalRuleDTO.EventMatchingTemplate; existingRule.Conditions = new ConditionSet(emotionalAppraisalRuleDTO.Conditions); existingRule.AppraisalVariables = emotionalAppraisalRuleDTO.AppraisalVariables; } else { existingRule = new AppraisalRule(emotionalAppraisalRuleDTO); } AddAppraisalRule(existingRule); }
public AppraisalRule(AppraisalRuleDTO appraisalRuleDTO) { m_id = (appraisalRuleDTO.Id == Guid.Empty)?Guid.NewGuid() : appraisalRuleDTO.Id; EventName = (Name)appraisalRuleDTO.EventMatchingTemplate; if (appraisalRuleDTO.AppraisalVariables != null) { AppraisalVariables = appraisalRuleDTO.AppraisalVariables; } else { AppraisalVariables = new AppraisalVariables(); } Conditions = appraisalRuleDTO.Conditions == null ? new ConditionSet() : new ConditionSet(appraisalRuleDTO.Conditions); }
/// <summary> /// Adds an emotional reaction to an event /// </summary> /// <param name="emotionalAppraisalRule">the AppraisalRule to add</param> public void AddOrUpdateAppraisalRule(AppraisalRuleDTO emotionalAppraisalRuleDTO) { AppraisalRule existingRule = null; var existingRulePair = findExistingAppraisalRule(emotionalAppraisalRuleDTO.Id, out existingRule); if (existingRule == null) { this.AddEmotionalReaction(new AppraisalRule(emotionalAppraisalRuleDTO)); } else { existingRule.Desirability = emotionalAppraisalRuleDTO.Desirability; existingRule.Praiseworthiness = emotionalAppraisalRuleDTO.Praiseworthiness; existingRule.EventName = Name.BuildName(emotionalAppraisalRuleDTO.EventMatchingTemplate); Rules.Remove(existingRulePair); Rules.Add(existingRule.EventName, existingRulePair.Value); } }
/// <summary> /// Adds an emotional reaction to an event /// </summary> /// <param name="emotionalAppraisalRule">the AppraisalRule to add</param> public void AddOrUpdateAppraisalRule(AppraisalRuleDTO emotionalAppraisalRuleDTO) { AppraisalRule existingRule = GetAppraisalRule(emotionalAppraisalRuleDTO.Id); if (existingRule != null) { RemoveAppraisalRule(existingRule); existingRule.Desirability = emotionalAppraisalRuleDTO.Desirability; existingRule.Praiseworthiness = emotionalAppraisalRuleDTO.Praiseworthiness; existingRule.EventName = emotionalAppraisalRuleDTO.EventMatchingTemplate; existingRule.Conditions = new ConditionSet(emotionalAppraisalRuleDTO.Conditions); } else { existingRule = new AppraisalRule(emotionalAppraisalRuleDTO); } AddEmotionalReaction(existingRule); }
public AddOrEditAppraisalRuleForm(AppraisalRulesVM ruleVM, AppraisalRuleDTO ruleToEdit = null) { InitializeComponent(); _appraisalRulesVM = ruleVM; _appraisalRuleToEdit = ruleToEdit; //defaultValues comboBoxDesirability.Text = "0"; comboBoxPraiseworthiness.Text = "0"; if (ruleToEdit != null) { this.Text = Resources.EditAppraisalRuleFormTitle; this.addOrEditButton.Text = Resources.UpdateButtonLabel; eventTextBox.Text = ruleToEdit.EventMatchingTemplate; comboBoxDesirability.Text = ruleToEdit.Desirability.ToString(); comboBoxPraiseworthiness.Text = ruleToEdit.Praiseworthiness.ToString(); } }
public void AddOrUpdateAppraisalRule(AppraisalRuleDTO newRule) { _ea.AddOrUpdateAppraisalRule(newRule); RefreshData(); }
/// <summary> /// Adds an emotional reaction to an event /// </summary> /// <param name="emotionalAppraisalRule">the AppraisalRule to add</param> public void AddOrUpdateAppraisalRule(AppraisalRuleDTO emotionalAppraisalRule) { m_appraisalDerivator.AddOrUpdateAppraisalRule(emotionalAppraisalRule); }
public void AddOrUpdateAppraisalRule(AppraisalRuleDTO newRule) { _emotionalAppraisalAsset.AddOrUpdateAppraisalRule(newRule); RefreshData(); _mainForm.SetModified(); }
public void AddOrUpdateAppraisalRule(AppraisalRuleDTO newRule) { _emotionalAppraisalAsset.AddOrUpdateAppraisalRule(newRule); RefreshData(); }