示例#1
0
        /// <summary>
        /// This data field property.
        /// </summary>
        /// <param name="e">Dependency Property parameter.</param>
        public void OnDataFieldPropertyChanged(DependencyPropertyChangedEventArgs e)
        {
            _dataField = e.NewValue as string;
            if (_dataObject != null)
            {
                TextContent = ComponentUtils.GetTextDo(this.DataObject, _dataField, DataAllowed);
            }
            DataTable itemSource = _itemSource as DataTable;

            if (itemSource != null)
            {
                if (!string.IsNullOrEmpty(_dataField))
                {
                    DataColumnCollection collection = itemSource.Columns;
                    if (collection.Contains(_dataField))
                    {
                        string value = _filler.FetchDataFieldValue(itemSource, _dataField);
                        if (!string.IsNullOrEmpty(value))
                        {
                            if (DataAllowed == ControlExt.DataType.Email)
                            {
                                value = value.Replace("#", "@");
                            }
                            TextContent = value;
                        }
                    }
                }
            }
        }
示例#2
0
 /// <summary>
 /// This data field property.
 /// </summary>
 /// <param name="e">Dependency Property parameter.</param>
 public void OnDataFieldPropertyChanged(DependencyPropertyChangedEventArgs e)
 {
     _dataField = e.NewValue as string;
     if (DataObject != null)
     {
         TextContent = ComponentUtils.GetTextDo(this.DataObject, _dataField, DataAllowed);
     }
 }
示例#3
0
        public void Execute()
        {
            var cpValue = ComponentUtils.GetTextDo(DataObject, "CP", DataType.Any);

            if (!string.IsNullOrEmpty(cpValue))
            {
                var provinceValue = cpValue.Substring(0, 2);
                ComponentUtils.SetPropValue(DataObject, "PROV", provinceValue);
            }
        }
示例#4
0
        private void AssociatedObject_DataSearchTextBoxChanged(object sender, RoutedEventArgs e)
        {
            var value      = e;
            var brandValue = ComponentUtils.GetTextDo(DataObject, "Value.MAR", DataType.Any);

            if (!string.IsNullOrEmpty(brandValue))
            {
                var brand = RelatedBrandPath;
                ExecuteRuleWithCode(brandValue);
                SetVariant();
            }
        }
示例#5
0
        private void SetVariant()
        {
            var box = this.RelatedVariantObject as DataField;

            if (box != null)
            {
                var variante = ComponentUtils.GetTextDo(DataObject, "Value.VARIANTE", DataType.Any);

                if (!string.IsNullOrEmpty(variante))
                {
                    box.TextContent = variante;
                }
            }
        }
示例#6
0
        private void ExecuteRules(object newValue)
        {
            var newDataObject = newValue;
            var box           = this.RelatedObject as DualFieldSearchBox;

            if (newDataObject != null)
            {
                var cpValue = ComponentUtils.GetTextDo(newDataObject, "CP", DataType.Any);
                if (!string.IsNullOrEmpty(cpValue))
                {
                    var provinceValue = cpValue.Substring(0, 2);
                    if (newValue is BaseViewObject)
                    {
                        SetValues(provinceValue, "PROV", "PROVINCIA", newDataObject);
                    }
                    else
                    {
                        SetValues(provinceValue, "Value.PROV", "Value.PROVINCIA", newDataObject);
                    }
                }
            }
            ExecuteRuleOnPobla(newValue);

            /*
             * Basically this does the same as above but with the related paths.
             */
            if (!string.IsNullOrEmpty(RelatedPath))
            {
                var relatedValue = ComponentUtils.GetTextDo(newDataObject, Path, DataType.Any);
                if (!string.IsNullOrEmpty(relatedValue))
                {
                    var    provinceValue = relatedValue.Substring(0, 2);
                    string pathStr;
                    if (newDataObject is BaseViewObject)
                    {
                        pathStr = RelatedPath;
                    }
                    else
                    {
                        pathStr = "Value." + RelatedPath;
                    }
                    ComponentUtils.SetPropValue(newDataObject, pathStr, provinceValue);
                }
            }
            if (box != null)
            {
                box.DataView = newDataObject;
            }
        }
示例#7
0
        private string GetPropertyValue(object dataObject, string name, DataType type)
        {
            if (dataObject == null)
            {
                return(string.Empty);
            }
            var tmp = ComponentUtils.GetTextDo(dataObject, name, type);

            if (type != DataType.Email)
            {
                return(tmp);
            }
            tmp = tmp.Replace("#", "@");;
            return(tmp);
        }
示例#8
0
        private void SetValues(string provinceValue, string provField, string proveExt, object newDataObject)
        {
            var prov = ComponentUtils.GetTextDo(newDataObject, provField, DataType.Any);

            if (!string.IsNullOrEmpty(prov))
            {
                ComponentUtils.SetPropValue(newDataObject, provField, provinceValue);
            }
            else
            {
                var provincia =
                    ComponentUtils.GetTextDo(newDataObject, proveExt, DataType.Any);
                if (!string.IsNullOrEmpty(provincia))
                {
                    ComponentUtils.SetPropValue(newDataObject, proveExt, provinceValue);
                }
            }
        }
示例#9
0
        private void ExecuteRuleOnPobla(object newValue)
        {
            var newDataObject = newValue;
            var box           = this.RelatedObject as DualFieldSearchBox;

            if (newValue != null)
            {
                var cpValue = ComponentUtils.GetTextDo(newDataObject, "POBLACION", DataType.Any);
                if (!string.IsNullOrEmpty(cpValue))
                {
                    var provinceValue = cpValue.Substring(0, 2);
                    if (newValue is BaseViewObject)
                    {
                        SetValues(provinceValue, "PROV", "PROVINCIA", newDataObject);
                    }
                    else
                    {
                        SetValues(provinceValue, "Value.PROV", "Value.PROVINCIA", newDataObject);
                    }
                }
            }
        }