/// <summary> /// Updates serializable properties with values from another ChoiceValues. /// </summary> /// <param name="source">The source ChoiceValues</param> private void CopyAllSettings(ChoiceValues source) { OutField = new OutField(source.OutField); DefaultValue = new FieldValue(source.DefaultValue); SampleValues = source.SampleValues != null ? new List <FieldValue>(from v in source.SampleValues select new FieldValue(v)) : new List <FieldValue>(); Choices = source.Choices != null ? new ObservableCollection <FieldValue>(from c in source.Choices select new FieldValue(c)) : new ObservableCollection <FieldValue>(); }
/// <summary> /// Updates ChoiceValues from cache, service or domain information. /// </summary> /// <returns>true if cached, otherwise false</returns> private bool UpdateChoiceValues() { var cached = ChoiceValuesCached.ContainsKey(OutField); if (cached) { var choiceOptions = ChoiceValuesCached[OutField]; if (choiceOptions != null) { UseDefaultValue = choiceOptions.UseDefault; ComparisonOperator = choiceOptions.ComparisonOperator; ComparisonOperators = choiceOptions.ComparisonOperators; ChoiceValues = choiceOptions.ChoiceValues; } } else { ChoiceValues = new ChoiceValues(OutField); if (UseDefaultValue && ChoiceValues.DefaultValue != null) ChoiceValues.DefaultValue.IsEditing = true; if (Field.Domain == null && Field.Type != Field.FieldType.Date) InitializeWithServiceData(); else if(Field.Domain != null) InitializeWithDomain(); } return cached; }
/// <summary> /// Updates properties of current object with properties of source object. /// </summary> /// <param name="source"></param> public void ApplyChanges(ChoiceValues source) { CopyAllSettings(source); }
/// <summary> /// Copy constructor for the ChoiceValues object. /// </summary> /// <param name="source"></param> public ChoiceValues(ChoiceValues source) { CopyAllSettings(source); }
/// <summary> /// Updates serializable properties with values from another ChoiceValues. /// </summary> /// <param name="source">The source ChoiceValues</param> private void CopyAllSettings(ChoiceValues source) { OutField = new OutField(source.OutField); DefaultValue = new FieldValue(source.DefaultValue); SampleValues = source.SampleValues != null ? new List<FieldValue>(from v in source.SampleValues select new FieldValue(v)) : new List<FieldValue>(); Choices = source.Choices != null ? new ObservableCollection<FieldValue>(from c in source.Choices select new FieldValue(c)) : new ObservableCollection<FieldValue>(); }