public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { if (null != context && null != context.Instance && null != context.Container) { IElement element = context.Instance as IElement; if (null != element) { if (element is IExpression || element is IVisibleExpression) { SourceField sf = GetSourceField(element); string ep = null; if (element is IExpression) { ep = ((IExpression)element).Expression; } else { ep = ((IVisibleExpression)element).VisibleExpression; } using (MES.Report.MESReportExpressionEditor expEditor = new MES.Report.MESReportExpressionEditor(ep)) { expEditor.ControlName = element.Name; if (expEditor.ShowDialog() == DialogResult.OK) { return(expEditor.ExpressionText); } } } } } return(base.EditValue(context, provider, value)); }
private static IEnumerable<SourceField> GetNewFieldForDynamicValue(string expressionXml, SourceField grrField) { var result = new List<SourceField>(); var functionsConnected = GetGageRRFunctionsConnected(expressionXml, grrField); foreach (var function in functionsConnected) { var fieldName = string.Format("{0} - {1} - Part Value", grrField.Name, function.ExpressionName); var innerName = string.Format("Part_{0}", GetGageRRFunctionFieldRelationSuffix(function)); result.Add( new SourceField(grrField.Connector.Owner) { DataType = NodeDataType.Double, Name = fieldName, ConnectorOut = { DataType = NodeDataType.Double, Name = fieldName }, SetName = SourceFieldSetNames.MsaItem, InnerName = innerName, UniqueName = innerName, ParentField = grrField }); } return result; }
void AddSourceBtn_Click(object sender, RoutedEventArgs e) { System.Windows.Forms.OpenFileDialog openFile = new System.Windows.Forms.OpenFileDialog(); if (openFile.ShowDialog() == System.Windows.Forms.DialogResult.OK) { mainController.AddController(openFile.FileName); int key = 0; SourceField newSource = new SourceField(); if (sources.Count != 0) { key = keys[keys.Count - 1]; while (keys.IndexOf(key) != -1) { key++; } keys.Add(++key); } else { keys.Add(key); } sources.Add(key, newSource); newSource.Key = key; newSource.Path = openFile.FileName; newSource.KeyChanged += OnSourceKeyChanged; SourceStack.Children.Add(newSource); if (SourceAdded != null) { SourceAdded(newSource, new EventArgs()); } } }
public void TestProperties() { var obj = new SourceField(new Connection()); TestsHelper.TestPublicPropertiesGetSet(obj, null, true); //IsGroupingField has private setter var isGroupingFieldProperty = typeof(SourceField).GetProperty("IsGroupingField"); Assert.IsNotNull(isGroupingFieldProperty); var accessors = isGroupingFieldProperty.GetAccessors(false); Assert.AreEqual(1, accessors.Length); Assert.AreEqual("get_IsGroupingField", accessors[0].Name); //KeepSubfieldsAlive has private setter var keepSubfieldsAliveProperty = typeof(SourceField).GetProperty("KeepSubfieldsAlive"); Assert.IsNotNull(keepSubfieldsAliveProperty); accessors = keepSubfieldsAliveProperty.GetAccessors(false); Assert.AreEqual(1, accessors.Length); Assert.AreEqual("get_KeepSubfieldsAlive", accessors[0].Name); //IsGroupingField has private setter var hideConnectorProperty = typeof(SourceField).GetProperty("HideConnector"); Assert.IsNotNull(hideConnectorProperty); accessors = hideConnectorProperty.GetAccessors(false); Assert.AreEqual(1, accessors.Length); Assert.AreEqual("get_HideConnector", accessors[0].Name); }
public SourceBindDialog(SourceField allField, SourceField currentField, bool isFilterField) { InitializeComponent(); SourceField = currentField; _allField = allField; _isFilterField = isFilterField; }
private bool CheckSubSourceFieldName(TreeNodeCollection Aim, string value) { bool result = false; foreach (TreeNode node in Aim) { if (node.Nodes != null) { result = CheckSubSourceFieldName(node.Nodes, value); if (result == false) { return(result); } } SourceField sf = node.Tag as SourceField; if (sf != null && sf.ID != this.ID && sf.GetType() == typeof(SourceFieldDataTable)) { if (sf.Name == value) { result = false; return(result); } } } result = true; return(result); }
private bool SelectNode(SourceField sf, TreeNode node) { if (null != sf && null != node) { if (node.Text == sf.Name) { this.DataSourceTreeView.SelectedNode = node; node.Expand(); return(true); } foreach (TreeNode temp in node.Nodes) { if (temp.Text != sf.Name) { if (SelectNode(sf, temp)) { return(true); } } else { this.DataSourceTreeView.SelectedNode = temp; temp.Expand(); return(true); } } } else { this.DataSourceTreeView.SelectedNode = this.DataSourceTreeView.Nodes[0]; } return(false); }
public FieldBindDialog(SourceField sf, string value) { InitializeComponent(); SourceField = sf; Value = value; this.FieldTextTb.Text = value; }
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { if (null != context && null != context.Instance && null != context.Container) { IElement element = context.Instance as IElement; if (null != element) { SourceField sf = GetSourceField(element); using (FieldBindDialog fbd = new FieldBindDialog(sf, null != value ? value.ToString() : null)) { if (sf == null) { fbd.BindingSourceField = false; } if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { IPmsReportDataBind dataBind = element as IPmsReportDataBind; if (null != dataBind) { //Label要求知道数据源 dataBind.SourceField = fbd.SourceField; } fbd.Close(); return(fbd.Value); } } } } return(base.EditValue(context, provider, value)); }
public int SetMultiDataSetParameter(String strDatasetPath, String strDSName, String strSQL) { if (null != _ReportRuntime) { if (null != _ReportRuntime.FieldTreeViewData) { FieldTreeNodeData node = _ReportRuntime.FieldTreeViewData.FindNodeByPath("数据集." + strDatasetPath.Replace('\\', '.')); if (null != node && node.Tag is SourceField) { SourceField sf = node.Tag as SourceField; if (null == sf.MultiDataSource) { sf.MultiDataSource = new List <DSSqlPair> (); } DSSqlPair sp = sf.MultiDataSource.Find(o => o.DataSource == strDSName); if (null != sp) { sp.Sql = strSQL; } else { sf.MultiDataSource.Add(new DSSqlPair(strDSName, strSQL)); } return(1); } } } return(0); }
public static void CopyProperties <TSource>(TSource Source, object LinqDestination) { Type DestinationType = LinqDestination.GetType(); Type SourceType = typeof(TSource); System.Reflection.FieldInfo[] SourceFields = SourceType.GetFields(); foreach (System.Reflection.FieldInfo SourceField in SourceFields) { //bool DataIgnore = false; object[] attr = SourceField.GetCustomAttributes(typeof(DataIgnoreAttrib), true); if (attr.Length > 0) { continue; //DataIgnore = true; } string DestPropName = SourceField.Name; attr = SourceField.GetCustomAttributes(typeof(DataNameAttrib), true); if (attr.Length > 0) { DestPropName = ((DataNameAttrib)attr[0]).DataName; } System.Reflection.PropertyInfo DestProp = DestinationType.GetProperty(DestPropName); if (DestProp == null) { continue; } //if ((!DestProp.PropertyType.FullName.StartsWith("System.")) && DataIgnore) continue; object v = SourceField.GetValue(Source); if (v != null) { v = Convert.ChangeType(v, DestProp.PropertyType); } DestProp.SetValue(LinqDestination, v, null); } }
public int SetDataSetParameter(String strDatasetPath, String strDSName) { if (null != _ReportRuntime) { if (null != _ReportRuntime.FieldTreeViewData) { FieldTreeNodeData node = _ReportRuntime.FieldTreeViewData.FindNodeByPath("数据集." + strDatasetPath.Replace('\\', '.')); if (null != node && node.Tag is SourceField) { SourceField sf = node.Tag as SourceField; if (strDSName.Contains(':')) { string[] strArr = strDSName.Split(":".ToArray()); if (strArr.Count() == 3 && strArr [1].Trim() == ":") { switch (strArr [0]) { case "SecondarySort": sf.SecondarySort = strArr [2]; break; } } } sf.DBSource = strDSName; return(1); } } } return(0); }
public void SetAggregatedFieldMap(MigrationTestEnvironment env, Configuration config) { // Aggregated fields AggregatedFields aggregatedFields = new AggregatedFields(); FieldsAggregationGroup group = new FieldsAggregationGroup(); group.MapFromSide = env.GetSourceSideTypeEnum(); group.TargetFieldName = FIELD_DESCRIPTION; group.Format = AggregationFormat; SourceField f0 = new SourceField(); f0.Index = 0; f0.SourceFieldName = FIELD_TITLE; SourceField f1 = new SourceField(); f1.Index = 1; f1.SourceFieldName = "System.Rev"; group.SourceField.Add(f0); group.SourceField.Add(f1); aggregatedFields.FieldsAggregationGroup.Add(group); // construct FieldMap // Map all fields explictly using wildcard MappedField defaultField = env.NewMappedField("*", "*"); FieldMap fieldMap = new FieldMap(); fieldMap.name = "BugToBugFieldMap"; fieldMap.MappedFields.MappedField.Add(defaultField); // TODO: Create another test case for aggreated fields feature // Construct configurations with conflicting field maps //MappedField mField1 = env.NewMappedField(FIELD_TITLE,FIELD_DESCRIPTION); //MappedField mField2 = env.NewMappedField(FIELD_DESCRIPTION,FIELD_TITLE); //fieldMap.MappedFields.MappedField.Add(mField1); //fieldMap.MappedFields.MappedField.Add(mField2); fieldMap.AggregatedFields = aggregatedFields; WorkItemTypeMappingElement typeMapping = new WorkItemTypeMappingElement(); typeMapping.LeftWorkItemTypeName = "Bug"; typeMapping.RightWorkItemTypeName = "Bug"; typeMapping.fieldMap = fieldMap.name; WITSessionCustomSetting customSetting = new WITSessionCustomSetting(); customSetting.WorkItemTypes.WorkItemType.Add(typeMapping); customSetting.FieldMaps.FieldMap.Add(fieldMap); SetWitSessionCustomSetting(config, customSetting); }
public void OneArgumentConstructorTest() { var expressionObject = new Connection(); var field = new SourceField(expressionObject); Assert.IsNotNull(field.ConnectorOut); Assert.AreEqual(field.ConnectorOut.Id, field.Id); Assert.AreEqual(field.ConnectorOut.Owner, expressionObject); }
public void HasSubfieldsShouldReturnTrueIfSubfieldsRetriverIsNotNullAndSubfieldsCountGreaterThatZero() { var sf = new SourceField(null); sf.ConnectorOut = new ConnectorOut(null); sf.SubfieldsRetriever = Mock.Create<IExpressionFieldsRetriever>(); sf.Subfields.Add(new DestinationField(null)); Assert.IsTrue(sf.HasSubfields); }
private void OKClick(object sender, EventArgs e) { Value = this.FieldTextTb.Text; if (null != this.DataSourceTreeView.SelectedNode) { //Label要求知道数据源 SourceField = this.DataSourceTreeView.SelectedNode.Tag as SourceField; } this.DialogResult = DialogResult.OK; }
private void SplitDateTime(List <PmsField> lp, SourceField sf, ComboBox comboBox, ArrayList al, string dateType) { PmsField pf = new PmsField(); pf.fieldName = sf.RecordField + "_" + dateType; pf.fieldDescription = sf.Name + "." + dateType; lp.Add(pf); al.Add(new ComboxItem(pf.fieldDescription, pf.fieldName)); //comboBox.Items.Add(pf.fieldName); }
protected virtual void DealWithDataTable() { IPmsReportDataBind pd = this as IPmsReportDataBind; SourceField parent = GetSourceField(this); using (SourceBindDialog fbd = new SourceBindDialog(parent, pd.SourceField, true)) { if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { bool contain = false; if (fbd.SourceField != null) { FieldTreeViewData sfAll = (PMS.Libraries.ToolControls.PMSPublicInfo.CurrentPrjInfo.GetCurrentReportDataDefine()) as FieldTreeViewData; List <SourceField> lpdb = fbd.SourceField.GetSubSourceField(sfAll); foreach (SourceField pdb in lpdb) { try { if (!string.IsNullOrEmpty(pdb.DataType)) { string typ = pdb.DataType.ToUpper(); if (typ.Equals("INT", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("FLOAT", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("REAL", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("INT32", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("INT16", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("INT64", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.SINGLE", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.DOUBLE", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.INT32", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.DECIMAL", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.DateTime", StringComparison.InvariantCultureIgnoreCase)) { contain = true; } } } catch { throw new Exception("lpdb"); } } if (contain) { this.SourceField = fbd.SourceField; } else { MessageBox.Show("没有合适的数据集!"); } } else { this.SourceField = null; } NotifyDesignSurfaceChange(); } } }
public object Clone() { PmsImageBoxWrapper pib = new PmsImageBoxWrapper(); pib.Border = this.Border; pib.BorderName = this.BorderName; if (null != this.Image) { pib.Image = this.Image.Clone() as Image; } if (null != ErrorImage) { pib.ErrorImage = this.ErrorImage.Clone() as Image; } pib.ExternDatas = new List <PMS.Libraries.ToolControls.Report.Elements.Util.ExternData>(); pib.Mode = this.Mode; foreach (ExternData ed in ExternDatas) { object value = ed.Value; if (null != value && value is ICloneable) { value = ((ICloneable)value).Clone(); } pib.ExternDatas.Add(new ExternData(ed.Key, value)); } if (null != this.Border) { pib.Border = this.Border.Clone() as ElementBorder; pib.Border.OwnerElement = pib; } if (null != SourceField) { pib.SourceField = SourceField.Clone() as SourceField; } pib.DbField = DbField; pib.Width = this.Width; pib.Height = this.Height; pib.HasLeftBorder = this.HasLeftBorder; pib.HasTopBorder = this.HasTopBorder; pib.HasRightBorder = this.HasRightBorder; pib.HasBottomBorder = this.HasBottomBorder; pib.HasBorder = this.HasBorder; pib.Location = this.Location; pib.BackColor = this.BackColor; pib.Visible = Visible; pib.MESType = MESType; pib.Name = Name; if (null != ((IElement)this).ExtendObject) { ((IElement)pib).ExtendObject = ((IElement)this).ExtendObject.Clone() as ExtendObject; } return(pib); }
void TestEnvironment_InsertWronglyIndexedAggrSrcField(Configuration config) { // Aggregated fields AggregatedFields aggregatedFields = new AggregatedFields(); FieldsAggregationGroup group = new FieldsAggregationGroup(); group.MapFromSide = SourceSideTypeEnum.Left; group.TargetFieldName = FIELD_DESCRIPTION; group.Format = AggregationFormat; // NOTE: both source fields are assigned with indice 10 SourceField f0 = new SourceField(); f0.Index = 10; f0.SourceFieldName = FIELD_TITLE; SourceField f1 = new SourceField(); f1.Index = 10; f1.SourceFieldName = FIELD_DESCRIPTION; group.SourceField.Add(f0); group.SourceField.Add(f1); aggregatedFields.FieldsAggregationGroup.Add(group); // construct FieldMap // Map all fields explictly using wildcard MappedField defaultField = new MappedField(); defaultField.LeftName = "*"; defaultField.RightName = "*"; defaultField.MapFromSide = SourceSideTypeEnum.Left; FieldMap fieldMap = new FieldMap(); fieldMap.name = "BugToBugFieldMap"; fieldMap.MappedFields.MappedField.Add(defaultField); fieldMap.AggregatedFields = aggregatedFields; WorkItemTypeMappingElement typeMapping = new WorkItemTypeMappingElement(); typeMapping.LeftWorkItemTypeName = "Bug"; typeMapping.RightWorkItemTypeName = "Bug"; typeMapping.fieldMap = fieldMap.name; WITSessionCustomSetting customSetting = new WITSessionCustomSetting(); customSetting.WorkItemTypes.WorkItemType.Add(typeMapping); customSetting.FieldMaps.FieldMap.Add(fieldMap); SetWitSessionCustomSetting(config, customSetting); }
/// <inheritdoc/> public override int GetHashCode() { unchecked { int result = base.GetHashCode(); result = (result * 397) ^ (SourceType != null ? SourceType.GetHashCode() : 0); result = (result * 397) ^ (SourceField != null ? SourceField.GetHashCode() : 0); result = (result * 397) ^ (TargetType != null ? TargetType.GetHashCode() : 0); result = (result * 397) ^ (TargetField != null ? TargetField.GetHashCode() : 0); return(result); } }
public override string ToString() { string value = "Field Mapping"; if (SourceField != default(DataTableField)) { value = SourceField.ToString(); } return(value); }
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string)) { SourceField sf = value as SourceField; if (null != sf) { return(sf.Name); } } return(base.ConvertTo(context, culture, value, destinationType)); }
public SourceFieldDataTable(SourceField Aim) { base.Name = Aim.Name; base.SqlText = Aim.SqlText; base.FormatString = Aim.FormatString; base.ID = Aim.ID; base.RecordField = Aim.RecordField; base.ParentNode = Aim.ParentNode; base.SubCode = Aim.SubCode; base.Tag = Aim.Tag; base.TableName = Aim.TableName; base.ReadOnly = Aim.ReadOnly; base.RelationField = Aim.RelationField; base.Standard = Aim.Standard; base.IsChildModify = Aim.IsChildModify; base.IsSampling = Aim.IsSampling; base.SamplingField = Aim.SamplingField; base.SamplingDistance = Aim.SamplingDistance; base.TimeUnit = Aim.TimeUnit; base.SamplingCount = Aim.SamplingCount; base.SortType = Aim.SortType; base.SamplingStart = Aim.SamplingStart; base.SamplingEnd = Aim.SamplingEnd; base.SamplingType = Aim.SamplingType; base.DBSource = Aim.DBSource; base.FieldType = Aim.FieldType; base.FieldDataTable = Aim.FieldDataTable; base.DataType = Aim.DataType; base.RecordFields = Aim.RecordFields; base.SourceTable = Aim.SourceTable; base.RecordFieldsCurrentValue = Aim.RecordFieldsCurrentValue; base.NodeType = Aim.NodeType; base.VarName = Aim.VarName; if (base.ReplaceList == null) { base.ReplaceList = new List <PMS.Libraries.ToolControls.PmsSheet.PmsPublicData.ValueMap>(); } if (this.ReplaceList == null) { this.ReplaceList = new List <PMS.Libraries.ToolControls.PmsSheet.PmsPublicData.ValueMap>(); } base.ReplaceList.Clear(); foreach (PMS.Libraries.ToolControls.PmsSheet.PmsPublicData.ValueMap vw in Aim.ReplaceList) { base.ReplaceList.Add(vw.Clone()); } }
private void Clear(object sender, RoutedEventArgs e) { Button button = (Button)e.Source; string name = button.Name; switch (name) { case "Field1": SourceField.Clear(); break; case "Field2": EncryptField.Text = ""; break; case "Field3": DecryptField.Text = ""; break; } }
public void TwoArgumentConstructorTest() { var expressionObject = new Connection(); var field = new SourceField(expressionObject, true); Assert.IsNotNull(field.ConnectorOut); Assert.AreEqual(field.ConnectorOut.Id, field.Id); Assert.AreEqual(field.ConnectorOut.Owner, expressionObject); Assert.IsTrue(field.IsGroupingField); Assert.IsTrue(field.IsGroupCollapsed); Assert.IsTrue(field.KeepSubfieldsAlive); Assert.IsTrue(field.HideConnector); }
private string FindPahtByTreeNode(TreeNode node) { if (null != node) { string fieldText = node.Text; SourceField parentSf = null; TreeNode nodeParent = node.Parent; if (null != nodeParent) { parentSf = nodeParent.Tag as SourceField; } if (null == SourceField || (null != parentSf && !parentSf.ID.Equals(SourceField.ID))) { if (null != node.Tag && (node.Tag is PMSVar)) { fieldText = "[%" + fieldText + "%]"; } else if (null != node.Tag && (node.Tag.ToString() == "Param")) { fieldText = "[#" + fieldText + "#]"; } else { string path = FindSourceParentPath(node); fieldText = "[" + path + "]"; } } else { if (null != node.Tag && (node.Tag is PMSVar)) { fieldText = "[%" + fieldText + "%]"; } else if (null != node.Tag && (node.Tag.ToString() == "Param")) { fieldText = "[#" + fieldText + "#]"; } else { fieldText = "[" + fieldText + "]"; } } return(fieldText); } return(string.Empty); }
public string GetFieldReturnValue(SourceField field) { var result = new StringBuilder(); if (_sourceFields.FirstOrDefault(x => x.Id == field.Id) == null) return result.ToString(); result.Append("var msa = MsaSub.CreateNew();").AppendLine(); result.Append( AssignStaticSubFields(field)).AppendLine(); result.Append( AssignDynamicSubFields(field)).AppendLine(); result.Append("\n" + _indent + "return msa;"); return result.ToString(); }
//private void InsertBtnClick(object sender, EventArgs e) //{ // if (null != this.DocumentParamCmb.SelectedItem) // { // string tempText = "[#" + this.DocumentParamCmb.SelectedItem.ToString() + "#]"; // InsertField(tempText); // } //} private string FindSourceParentPath(TreeNode node) { if (null == node) { return(string.Empty); } SourceField sf = node.Tag as SourceField; if (null == sf) { return(string.Empty); } string path = sf.Name; if (null != node.Parent && node.Parent.Level != 0) { return(FindSourceParentPath(node.Parent) + "/" + path); } return(path); }
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { if (null != context && null != context.Instance && null != context.Container) { IElement element = context.Instance as IElement; if (null != element) { SourceField sf = GetSourceField(element); IPmsReportDataBind rdb = element as IPmsReportDataBind; if (null != rdb) { SourceBindDialog fbd = new SourceBindDialog(sf, rdb.SourceField, true); if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { return(fbd.SourceField); } } } } return(base.EditValue(context, provider, value)); }
private void OkBtnClick(object sender, EventArgs e) { TreeNode node = this.DataSourceTreeView.SelectedNode; if (0 == node.Level) { SourceField = null; this.DialogResult = DialogResult.OK; return; } if (null != node && ((null != _allField && node.Level > 1) || null == _allField)) { SourceField tmp = node.Tag as SourceField; if (tmp is SourceFieldDataTable) { if (cb_CustomMode.Checked) { tmp.CustomMode = true; tmp.CustomTablePath = tb_TablePath.Text; } else { tmp.CustomMode = false; tmp.CustomTablePath = tb_TablePath.Text; } SourceField = tmp; this.DialogResult = DialogResult.OK; } else { MessageBox.Show("无效选择,只能选择子数据表"); } } else { MessageBox.Show("无效选择,只能选择子数据表"); } }
internal static EntityPropertyDefinition InitFromScalar(EntityPropertyDefinition ed, ScalarPropertyDefinition pd) { if (!pd.PropertyType.IsEntityType) { throw new ArgumentException(string.Format("EntityProperty type must be a entity type. Passed {0}", pd.PropertyType.Identifier)); } pd.CopyTo(ed); ed._sf = pd.SourceFragment; var pks = pd.PropertyType.Entity.GetPkProperties(); string propAlias = null; if (pks.Count() != 0) { propAlias = pks.First().PropertyAlias; } SourceField field = new SourceField( propAlias, ed._sf, pd.SourceFieldExpression, pd.SourceTypeSize, pd.IsNullable, pd.SourceType, pd.SourceField.DefaultValue, pd.SourceFieldAlias ); ed._fields.Add(field); if (string.IsNullOrEmpty(propAlias)) { EntityDefinition.PropertyAddedDelegate d = null; d = (e, p) => { if (p.HasAttribute(Field2DbRelations.PK)) { field.PropertyAlias = p.PropertyAlias; e.PropertyAdded -= d; } }; pd.PropertyType.Entity.PropertyAdded += d; } return(ed); }
private void FieldBindAction() { SourceField sf = GetSourceField(this); using (FieldBindDialog fbd = new FieldBindDialog(sf, null != DbField ? DbField : null)) { if (sf == null) { fbd.BindingSourceField = false; } if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { IPmsReportDataBind dataBind = this as IPmsReportDataBind; if (null != dataBind) { dataBind.SourceField = fbd.SourceField; } DbField = fbd.Value; NotifyDesignSurfaceChange(); } } }
private static IEnumerable<IExpressionProcessor> GetGageRRFunctionsConnected(string expressionXml, SourceField grrField) { var serializer = new XmlExpressionsSerializer(); var container = serializer.Deserialize(expressionXml); var fieldOutConnections = container.Expressions .Where( c => c is IConnection && grrField.ConnectorOut.Id == ((IConnection)c).Source.Id) .Cast<IConnection>(); var functionsConnected = container.Expressions .Where( f => f is IExpressionProcessor && f.GetConnectors().Select(i => i.Id) .Intersect( fieldOutConnections.Select(i => i.Sink.Id)) .Any()) .Cast<IExpressionProcessor>(); return functionsConnected; }
private void SourceBindAction() { IPmsReportDataBind pd = this as IPmsReportDataBind; SourceField parent = GetSourceField(this); using (SourceBindDialog fbd = new SourceBindDialog(parent, pd.SourceField, true)) { if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (null != pd) { if (null != fbd.SourceField) { pd.SourceField = fbd.SourceField.Clone(); } else { pd.SourceField = null; } NotifyDesignSurfaceChange(); } } } }
/// <summary> /// Adds the version fields. /// </summary> /// <param name="process">The process.</param> /// <param name="source">The source.</param> private static void AddVersionFields(IProcessEdit process, SourceFieldList source) { const string VersionDateName = "Version Date"; if (process.ProcessOptionChoose != ProcessOption.VersionEnabled) return; var dataType = SourceNodeFactory.GetDataType(typeof (string)); var sf = new SourceField(source) { DataType = dataType, Name = Constants.VersionNumberName, ConnectorOut = { DataType = dataType, Name = Constants.VersionNumberName }, SetName = SourceFieldSetNames.Item, InnerName = Constants.VersionNumber, SystemName = Constants.VersionNumber }; source.Fields.Add(sf); dataType = SourceNodeFactory.GetDataType(typeof (DateTime)); sf = new SourceField(source) { DataType = dataType, Name = VersionDateName, ConnectorOut = {DataType = dataType, Name = VersionDateName}, SetName = SourceFieldSetNames.Item, InnerName = Constants.VersionDate, SystemName = Constants.VersionDate }; source.Fields.Add(sf); dataType = SourceNodeFactory.GetDataType(typeof(int)); sf = new SourceField(source) { DataType = dataType, Name = Constants.VersionMasterId, ConnectorOut = { DataType = dataType, Name = Constants.VersionMasterId }, SetName = SourceFieldSetNames.Item, InnerName = Constants.VersionMasterId, SystemName = Constants.VersionMasterId, }; source.Fields.Add(sf); }
private static void AddLastModifiedOnField(ProcessEdit process, SourceFieldList source) { const string LastModifiedOnDisplyField = "Last Modified On"; var dataType = SourceNodeFactory.GetDataType(typeof(DateTime)); var sf = new SourceField(source) { DataType = dataType, Name = LastModifiedOnDisplyField, ConnectorOut = { DataType = dataType, Name = LastModifiedOnDisplyField }, SetName = SourceFieldSetNames.Item, InnerName = Constants.LastModifiedOn, SystemName = Constants.LastModifiedOn }; source.Fields.Add(sf); }
/// <summary> /// Adds the identifier fields. /// </summary> /// <param name="process">The process.</param> /// <param name="source">The source.</param> private static void AddIdFields(IProcessEdit process, SourceFieldList source) { const string IdName = "Id"; const string BaseIdName = "Base Id"; var dataType = SourceNodeFactory.GetDataType(typeof(int)); var sf = new SourceField(source) { DataType = dataType, Name = IdName, ConnectorOut = { DataType = dataType, Name = IdName }, SetName = SourceFieldSetNames.Item, InnerName = Constants.IdColumnName, SystemName = Constants.IdColumnName, ObjectName = "context" }; source.Fields.Add(sf); if (process.BaseProcess != null) { sf = new SourceField(source) { DataType = dataType, Name = BaseIdName, ConnectorOut = {DataType = dataType, Name = BaseIdName}, SetName = SourceFieldSetNames.Item, InnerName = Constants.BaseIdColumnName, SystemName = Constants.BaseIdColumnName, }; source.Fields.Add(sf); } }
/// <summary> /// Adds the state fields. /// </summary> /// <param name="process">The process.</param> /// <param name="source">The source.</param> private static void AddStateFields(IProcessEdit process, SourceFieldList source) { const string CurrentStateName = "Current State"; const string CurrentStateSystemName = "CurrentStateName"; if (!process.IsStateEnabled) return; var dataType = SourceNodeFactory.GetDataType(typeof (string)); var sf = new SourceField(source) { DataType = dataType, Name = CurrentStateName, ConnectorOut = {DataType = dataType, Name = CurrentStateName}, SetName = SourceFieldSetNames.Item, InnerName = CurrentStateSystemName, SystemName = CurrentStateSystemName }; source.Fields.Add(sf); }
/// <summary> /// Creates the generic source field. /// </summary> /// <param name="field">The field.</param> /// <param name="owner">The owner.</param> /// <returns>SourceField.</returns> private static SourceField CreateSourceFieldFromDataVariable(DataVariableEdit field, ExpressionObjectBase owner) { var dataType = GetDataType(field); var sf = new SourceField(owner) { DataType = dataType, Name = field.VariableName, ConnectorOut = { DataType = dataType, Name = field.VariableName }, SetName = SourceFieldSetNames.DataTriggerSourceItem, InnerName = field.VariableSystemName, SystemName = field.VariableSystemName }; return sf; }
/// <summary> /// 克隆 /// </summary> /// <returns>对象</returns> public object Clone() { BarCodeWrapper bcw = new BarCodeWrapper(); bcw.Name = Name; bcw.AutoSize = AutoSize; bcw.BackColor = BackColor; if (null != BackgroundImage) { bcw.BackgroundImage = BackgroundImage.Clone() as Image; } bcw.BackgroundImageLayout = BackgroundImageLayout; if (null != Border) { bcw.Border = Border.Clone() as ElementBorder; bcw.Border.OwnerElement = bcw; } bcw.BorderName = BorderName; if (null != ExternDatas) { bcw.ExternDatas = new List <ExternData>(); foreach (ExternData ed in ExternDatas) { object value = ed.Value; if (null != value && value is ICloneable) { value = ((ICloneable)value).Clone(); } bcw.ExternDatas.Add(new ExternData(ed.Key, value)); } } if (null != Font) { bcw.Font = Font.Clone() as Font; } bcw.HasBorder = HasBorder; bcw.HasBottomBorder = HasBottomBorder; bcw.HasLeftBorder = HasLeftBorder; bcw.HasRightBorder = HasRightBorder; bcw.HasTopBorder = HasTopBorder; bcw.Height = Height; bcw.HorizontalScale = HorizontalScale; bcw.Location = Location; bcw.MESType = MESType; bcw.MoveX = MoveX; bcw.MoveY = MoveY; bcw.Parent = Parent; bcw.Text = Text; bcw.VerticalScale = VerticalScale; bcw.Width = Width; if (null != SourceField) { bcw.SourceField = SourceField.Clone(); } bcw.EnableMapping = EnableMapping; bcw.MappingTable = MappingTable; bcw.Expression = Expression; bcw.RealText = RealText; bcw.IncludeLabel = IncludeLabel; bcw.BarCodeAlign = BarCodeAlign; bcw.BarCodeType = BarCodeType; bcw.Visible = Visible; bcw.MESType = MESType; if (null != ((IElement)this).ExtendObject) { ((IElement)bcw).ExtendObject = ((IElement)this).ExtendObject.Clone() as ExtendObject; } return(bcw); }
public void SerializationOfGroupingRelatedPropertiesTest() { var field = new SourceField(new Connection(), true); //Serialize properties var tw = new StringWriter(); using (var xw = XmlWriter.Create(tw)) { xw.WriteStartElement("Node"); field.Serialize(xw); xw.WriteEndElement(); } //Deserialize field and restore properties' values var sr = new StringReader(tw.ToString()); using (var wr = XmlReader.Create(sr)) { wr.ReadToFollowing("Node"); var restoredField = new SourceField(new Connection()); restoredField.Deserialize(wr); Assert.AreEqual(field.IsGroupingField, restoredField.IsGroupingField); Assert.AreEqual(field.IsGroupCollapsed, restoredField.IsGroupCollapsed); Assert.AreEqual(field.KeepSubfieldsAlive, restoredField.KeepSubfieldsAlive); Assert.AreEqual(field.HideConnector, restoredField.HideConnector); } }
/// <summary> /// Creates the source field. /// </summary> /// <param name="field">The field.</param> /// <param name="owner">The owner.</param> /// <returns>The SourceField.</returns> private static SourceField CreateSourceField(FieldEdit field, ExpressionObjectBase owner) { var dataType = GetDataType(field); var systemName = field.SystemName; if (dataType == NodeDataType.List) systemName = systemName + "List"; var sf = new SourceField(owner) { DataType = dataType, Name = field.Name, ConnectorOut = { DataType = dataType, Name = field.Name }, SetName = SourceFieldSetNames.DataTriggerSourceItem, InnerName = systemName, SystemName = systemName, SubfieldsRetriever = GetSourceFieldsRetriever(field) }; if (dataType == NodeDataType.CrossReference) { var crossRefStep = (CrossRefRequiredStepEdit)field.StepList.FirstOrDefault(x => x is CrossRefRequiredStepEdit); if (crossRefStep != null) sf.AdditionalInfo = new CrossReferenceFieldInfo(crossRefStep.CrossRefProcess.SystemName); } return sf; }
/// <summary> /// Creates the complex source field. /// </summary> /// <param name="field">The field.</param> /// <param name="owner">The owner.</param> /// <returns>The SourceField.</returns> private SourceField CreateComplexSourceField(ServiceExposedTypeFieldEdit field, ExpressionObjectBase owner) { var type = _knownTypes.First(t => t.Guid == field.TypeGuid); var dataType = field.AllowMultiple ? NodeDataType.Array : NodeDataType.Entity; var result = new SourceField(owner) { DataType = dataType, Name = field.Name, ConnectorOut = { DataType = dataType, Name = field.Name }, SystemName = field.Name, SetName = SourceFieldSetNames.IntegrationServiceSourceItem, SubfieldsRetriever = new ComplexTypeSubfieldsRetriever(type, _knownTypes) }; return result; }
/// <summary> /// Edits the expression. /// </summary> /// <param name="parentWindow">The parent window.</param> /// <param name="process">The process.</param> /// <param name="expressionDesignerString">The expression designer string.</param> /// <param name="parameterType">Type of the parameter.</param> /// <param name="saveAction">The save action.</param> /// <param name="cancelAction">The cancel action.</param> /// <param name="removeAction">The remove action.</param> public void EditExpression(ITopLevelWindow parentWindow, ProcessEdit process, string expressionDesignerString, SystemParameterType parameterType, Action saveAction, Action cancelAction, Action removeAction) { this.saveAction = saveAction; this.cancelAction = cancelAction; this.removeAction = removeAction; var source = new SourceFieldList {ExpressionName = process.Name, Top = 10, Left = 10}; AddIdFields(process, source); AddProcessIdFields(process, source); AddStateFields(process, source); AddVersionFields(process, source); AddLastModifiedOnField(process, source); foreach (var field in process.GetAllFields()) { if (field.FieldType.ColumnType == ColumnTypes.Reference) { var crossRefStep = (CrossRefRequiredStepEdit)field.StepList.FirstOrDefault(x => x is CrossRefRequiredStepEdit); if (crossRefStep != null) { if (crossRefStep.AllowMultiple) { source.Fields.Add(BuildSourceFieldForList(source, field, new CrSubfieldsRetriever(field.Id))); } else { source.Fields.Add(new SourceField(source) { DataType = NodeDataType.CrossReference, Name = field.Name, ConnectorOut = { DataType = NodeDataType.CrossReference, Name = field.Name }, SetName = SourceFieldSetNames.Item, InnerName = field.SystemName, SystemName = string.Format("{0}Member", field.SystemName), SubfieldsRetriever = new CrSubfieldsRetriever(field.Id) }); } } } else { if (field.FieldType.ColumnType == ColumnTypes.ReverseReference || field.FieldType.ColumnType == ColumnTypes.ReverseMultiReference) { var crossRefStep = (ReverseCrossRefRequiredStepEdit)field.StepList.FirstOrDefault(x => x is ReverseCrossRefRequiredStepEdit); if (crossRefStep != null) { if (crossRefStep.DisplayMultiple) { source.Fields.Add(BuildSourceFieldForList(source, field, new ReverseCrSubfieldsRetriever(field.Id))); } else { source.Fields.Add(new SourceField(source) { DataType = NodeDataType.ReverseCrossReference, Name = field.Name, ConnectorOut = { DataType = NodeDataType.ReverseCrossReference, Name = field.Name }, SetName = SourceFieldSetNames.Item, InnerName = field.SystemName, SystemName = string.Format("{0}Member", field.SystemName), SubfieldsRetriever = new ReverseCrSubfieldsRetriever(field.Id) }); } } } else if (field.FieldType.ColumnType == ColumnTypes.Checklist) { source.Fields.Add(BuildSourceFieldForList(source, field, new ChecklistSubFieldsRetriever(field.Id))); } else if (field.FieldType.ColumnType == ColumnTypes.DisplayList) { source.Fields.Add(BuildSourceFieldForList(source, field, new DisplayListSubFieldsRetriever(field.Id))); } else if (field.FieldType.ColumnType == ColumnTypes.Result) { source.Fields.Add(new SourceField(source) { DataType = NodeDataType.Result, Name = field.Name, ConnectorOut = { DataType = NodeDataType.Result, Name = field.Name }, SetName = SourceFieldSetNames.Item, InnerName = field.SystemName, SystemName = field.SystemName }); } else { //var fieldType = GetType(field.FieldType); var dataType = SourceNodeFactory.GetDataType(GetType(field.FieldType)); var sf = new SourceField(source) { DataType = dataType, Name = field.Name, ConnectorOut = { DataType = dataType, Name = field.Name }, SetName = SourceFieldSetNames.Item, InnerName = field.SystemName, SystemName = field.SystemName }; source.Fields.Add(sf); } } } var expressions = new List<IExpressionObjectBase>(); var isNew = true; ExpressionContainer expressionsContainer; try { expressionsContainer = Serializer.Deserialize(expressionDesignerString); } catch { expressionsContainer = null; } if (!string.IsNullOrWhiteSpace(expressionDesignerString) && expressionsContainer != null) { isNew = false; expressions.AddRange(expressionsContainer.Expressions); } else { expressions.Add(source); var destination = new DestinationFieldList { Top = 200, Left = 600, ExpressionName = "Expression Result" }; destination.Fields.Add(new DestinationField(destination) { Name = "Result", SystemName = "Result", InnerName = "Result", DataType = GetNodeType(parameterType), ConnectorIn = { Name = "Result", DataType = GetNodeType(parameterType) } }); expressions.Add(destination); } if (expressionsContainer != null) { var sourceFieldList = (from fl in expressions where fl is SourceFieldList select fl).Cast<SourceFieldList>().FirstOrDefault(); if (sourceFieldList != null) { var fieldList = sourceFieldList.Fields.Cast<IExpressionField>().ToList(); UpdateStoredFields(fieldList, source.Fields, (sf) => FinalizeUpdate(sourceFieldList, fieldList, source, expressions, parentWindow)); // Here we load all subtypes async that's why we need reload window after all subtypes are loaded } } if (!isNew) { return; } var userInfoSource = SourceNodeFactory.CreateUserInformationItem(CurrentUserInformationItemName); userInfoSource.Left = 175; userInfoSource.Top = 10; expressions.Add(userInfoSource); this.expressionDesigner.Diagram.Items.Clear(); ExpressionTranslator.TranslateToDiagram(expressions, this.expressionDesigner.Diagram); WindowManager.Value.ShowChildWindow(parentWindow, this); }
/// <summary> /// Creates the source field. /// </summary> /// <param name="field">The field.</param> /// <param name="owner">The owner.</param> /// <returns>SourceField.</returns> private static SourceField CreateSourceField(ProviderFieldEdit field, ExpressionObjectBase owner) { var dataType = SourceNodeFactory.GetDataType(GetType(field.Type)); var result = new SourceField(owner) { DataType = dataType, Name = field.Name, ConnectorOut = { DataType = dataType, Name = field.Name }, SetName = SourceFieldSetNames.ESyncSourceItem, SystemName = field.SystemName, ObjectName = "providerItem" }; return result; }
/// <summary> /// Creates the generic source field. /// </summary> /// <param name="field">The field.</param> /// <param name="owner">The owner.</param> /// <returns>SourceField.</returns> private static SourceField CreateGenericSourceField(FieldInfo field, ExpressionObjectBase owner) { var dataType = SourceNodeFactory.GetDataType(GetType(field)); var sf = new SourceField(owner) { DataType = dataType, Name = field.Name, ConnectorOut = { DataType = dataType, Name = field.Name }, SetName = SourceFieldSetNames.DataTriggerSourceItem, InnerName = field.SystemName, SystemName = field.SystemName }; return sf; }
/// <summary> /// Creates the source field. /// </summary> /// <param name="field">The field.</param> /// <param name="owner">The owner.</param> /// <returns>SourceField.</returns> private SourceField CreateSourceField(FieldInfo field, ExpressionObjectBase owner) { var dataType = GetNodeDataType(field.ColumnType); var result = new SourceField(owner) { DataType = dataType, Name = field.Name, ConnectorOut = { DataType = dataType, Name = field.Name }, SetName = SourceFieldSetNames.Item, InnerName = field.SystemName, SystemName = field.SystemName, SubfieldsRetriever = GetSubfieldsRetriever(field) }; return result; }
public void InsertSubconnectorsMethod_ExpandGroupsTest() { var vmMock = Mock.Create<IDiagramViewModel>(); var listMock = Mock.Create<SourceFieldList>(Behavior.Loose); Mock.Arrange(() => listMock.Fields).Returns(new ObservableCollection<SourceField>()); //Mock SourceFieldsExpressionNode var nodeMock = Mock.Create<SourceFieldsExpressionNode>(Behavior.Loose, vmMock, listMock); var privateAccessor = new PrivateAccessor(nodeMock); //Arrange Mock.NonPublic.Arrange(nodeMock, "InsertSubconnectors", ArgExpr.IsAny<ExpressionConnectorViewModel>(), ArgExpr.IsAny<bool>(), ArgExpr.IsAny<bool>(), ArgExpr.IsAny<ExpressionConnector>()).CallOriginal(); Mock.Arrange(() => nodeMock.ConnectorsOut).Returns(new List<IConnectorViewModel>()); var expressionConnectorMock = Mock.Create<ExpressionConnector>(Constructor.Mocked, Behavior.Loose); var subfieldMock = new SourceField(null, true); Mock.Arrange(() => expressionConnectorMock.GetSubconnectors()).Returns(new List<IExpressionField>{subfieldMock}); //Act privateAccessor.CallMethod("InsertSubconnectors", Mock.Create<ExpressionConnectorViewModel>(), false, true, expressionConnectorMock); //Assert Mock.NonPublic.Assert(nodeMock, "ExpandSubconnectors", Occurs.Never(), ArgExpr.IsAny<ExpressionConnectorViewModel>(), ArgExpr.IsAny<bool>(), ArgExpr.IsAny<bool>()); }
/// <summary> /// Creates the cross reference source field. /// </summary> /// <param name="field">The field.</param> /// <param name="owner">The owner.</param> /// <returns>SourceField.</returns> private static SourceField CreateCrossReferenceSourceField(FieldInfo field, string processName, ExpressionObjectBase owner) { var dataType = field.ColumnType == ColumnTypes.Reference ? NodeDataType.CrossReference : NodeDataType.List; var sf = new SourceField(owner) { DataType = dataType, Name = field.Name, ConnectorOut = { DataType = dataType, Name = field.Name }, SystemName = field.SystemName, SetName = SourceFieldSetNames.DataTriggerSourceItem, SubfieldsRetriever = new CrossReferenceSubfieldsRetriever(field, CanBeSourceField, CreateSourceField) }; if (dataType == NodeDataType.CrossReference) { PublishedProcessInfo.BeginGetProcessInfoByCrossReferenceField(processName, field.SystemName, true, result => { if (result.Error == null && result.Object != null) { sf.AdditionalInfo = new CrossReferenceFieldInfo(result.Object.SystemName); } }); } return sf; }
/// <summary> /// Begins the load worker. /// </summary> /// <param name="sourceField">The source field.</param> /// <param name="action">The action.</param> /// <param name="processId">The process identifier.</param> public void BeginLoadWorker(IExpressionField sourceField, Action<IExpressionField, IEnumerable<IExpressionField>> action, int processId) { FieldList.BeginGetFieldList( processId, (s, e) => { var result = new List<IExpressionField>(); foreach (var field in e.Object) { if (field.ColumnType == ColumnTypes.MultiReference) { var sf = new SourceField(sourceField.Connector.Owner) { DataType = NodeDataType.String, Name = field.Name, ConnectorOut = { DataType = NodeDataType.String, Name = field.Name }, SetName = SourceFieldSetNames.Item, InnerName = field.SystemName, SystemName = string.Format("{0}.{1}", ((SourceField)sourceField).SystemName, field.SystemName) }; result.Add(sf); } else if (field.ColumnType == ColumnTypes.Result) { var sf = new SourceField(sourceField.Connector.Owner) { DataType = NodeDataType.Result, Name = field.Name, ConnectorOut = { DataType = NodeDataType.Result, Name = field.Name }, SetName = SourceFieldSetNames.Item, InnerName = field.SystemName, SystemName = string.Format("{0}.{1}", ((SourceField)sourceField).SystemName, field.SystemName) }; result.Add(sf); } else { if (field.FieldType.ColumnType != ColumnTypes.Reference) { var dataType = SourceNodeFactory.GetDataType(ExpressionDesignerSystemParametersViewModel.GetType(field.FieldType)); var sf = new SourceField(sourceField.Connector.Owner) { DataType = dataType, Name = field.Name, ConnectorOut = { DataType = dataType, Name = field.Name }, SetName = SourceFieldSetNames.Item, InnerName = field.SystemName, SystemName = string.Format("{0}.{1}", ((SourceField)sourceField).SystemName, field.SystemName) }; result.Add(sf); } else { result.Add(new SourceField(sourceField.Connector.Owner) { DataType = NodeDataType.CrossReference, Name = field.Name, ConnectorOut = { DataType = NodeDataType.CrossReference, Name = field.Name }, SetName = SourceFieldSetNames.Item, InnerName = field.SystemName, SystemName = string.Format("{0}.{1}Member", ((SourceField)sourceField).SystemName, field.SystemName), SubfieldsRetriever = new CrSubfieldsRetriever(field.Id) }); } } } action(sourceField, result); }); }
private void AddToTree(SourceField field) { if (field == null) return; var parentField = field.ParentField as SourceField; if (parentField != null && parentField.DataType == NodeDataType.List) { return; } AddToTree(parentField); var treeItem = TreeViewItemInfo.CreateFromSource(field); if (parentField != null) { TreeViewItemInfo parentNode; if (_treeViewItems.TryGetValue(parentField.Id, out parentNode)) { parentNode.AddSubItem(treeItem); } } else _rootTreeViewItem.AddSubItem(treeItem); TreeViewItemInfo currentNode; if (!_treeViewItems.TryGetValue(field.Id, out currentNode)) { _treeViewItems.Add(field.Id, treeItem); } }
public void SerializationOfAdditionalInfoTest() { var field = new SourceField(new Connection(), true); field.AdditionalInfo = new CrossReferenceFieldInfo("Process"); //Serialize properties var tw = new StringWriter(); using (var xw = XmlWriter.Create(tw)) { xw.WriteStartElement("SourceField"); field.Serialize(xw); xw.WriteEndElement(); } //Deserialize field and restore properties' values var sr = new StringReader(tw.ToString()); using (var wr = XmlReader.Create(sr)) { wr.ReadToFollowing("SourceField"); var restoredField = new SourceField(new Connection()); restoredField.Deserialize(wr); Assert.IsNotNull(restoredField.AdditionalInfo); Assert.AreEqual( ((CrossReferenceFieldInfo)field.AdditionalInfo).ReferencedProcessName, ((CrossReferenceFieldInfo)restoredField.AdditionalInfo).ReferencedProcessName); } }
/// <summary> /// Creates the file source field. /// </summary> /// <param name="field">The field.</param> /// <param name="owner">The owner.</param> /// <returns>SourceField.</returns> private static SourceField CreateFileSourceField(FieldInfo field, ExpressionObjectBase owner) { const NodeDataType DataType = NodeDataType.File; var sf = new SourceField(owner) { DataType = DataType, Name = field.Name, ConnectorOut = { DataType = DataType, Name = field.Name }, SystemName = field.SystemName, SetName = SourceFieldSetNames.DataTriggerSourceItem, SubfieldsRetriever = new FileSubfieldsRetriever(SourceFieldSetNames.DataTriggerSourceItem) }; return sf; }
public IControlTranslator ToElement(bool transferChild) { PmsImageBoxWrapper pib = new PmsImageBoxWrapper(); pib.Border = this.Border; pib.BorderName = this.BorderName; if (null != this.Image) { pib.Image = this.Image.Clone() as Image; } if (null != ErrorImage) { pib.ErrorImage = this.ErrorImage.Clone() as Image; } pib.ExternDatas = new List <PMS.Libraries.ToolControls.Report.Elements.Util.ExternData>(); pib.Mode = this.Mode; foreach (ExternData data in ExternDatas) { object value = data.Value; if (null != value && value is ICloneable) { value = ((ICloneable)value).Clone(); } pib.ExternDatas.Add(new ExternData(data.Key, value)); } if (null != this.Border) { pib.Border = this.Border.Clone() as ElementBorder; pib.Border.OwnerElement = pib; } if (null != SourceField) { pib.SourceField = SourceField.Clone() as SourceField; } if (_orginalFontSize > 0) { pib.Font = new Font(Font.FontFamily, _orginalFontSize); } else { pib.Font = new Font(this.Font.FontFamily, this.Font.Size); } pib.VerticalScale = 1f; pib.HorizontalScale = 1f; pib.DbField = DbField; pib.Visible = Visible; pib.MESType = MESType; pib.Name = Name; if (_orginalHeight > 0) { pib.Height = this._orginalHeight; } else { pib.Height = this.Height; } if (_orginalWidth > 0) { pib.Width = _orginalWidth; } else { pib.Width = this.Width; } //pib.VerticalScale = this.VerticalScale; //pib.HorizontalScale = this.HorizontalScale; if (_orginalLocation != Point.Empty) { pib.Location = this._orginalLocation; } else { pib.Location = this.Location; } pib.HasLeftBorder = this.HasLeftBorder; pib.HasTopBorder = this.HasTopBorder; pib.HasRightBorder = this.HasRightBorder; pib.HasBottomBorder = this.HasBottomBorder; pib.HasBorder = this.HasBorder; pib.BackColor = this.BackColor; if (null != ((IElement)this).ExtendObject) { ((IElement)pib).ExtendObject = ((IElement)this).ExtendObject.Clone() as ExtendObject; } return(pib); }
/// <summary> /// Creates the primitive source field. /// </summary> /// <param name="field">The field.</param> /// <param name="owner">The owner.</param> /// <returns>The SourceField.</returns> private SourceField CreatePrimitiveSourceField(ServiceExposedTypeFieldEdit field, ExpressionObjectBase owner) { var type = ServicePrimitiveTypes.FindByGuid(field.TypeGuid); var dataType = field.AllowMultiple ? NodeDataType.Array : SourceNodeFactory.GetDataType(type.Type); var subfieldsRetriever = field.AllowMultiple ? new ArraySubfieldsRetriever(type) : null; if (ReferenceEquals(type, ServicePrimitiveTypes.Byte)) { dataType = NodeDataType.ByteArray; subfieldsRetriever = null; } var result = new SourceField(owner) { DataType = dataType, Name = field.Name, ConnectorOut = { DataType = dataType, Name = field.Name }, SetName = SourceFieldSetNames.IntegrationServiceSourceItem, InnerName = field.Name, SystemName = field.Name, SubfieldsRetriever = subfieldsRetriever }; return result; }
public void HasParentFieldOfTypeMethodTest() { var field = new SourceField(new Connection()); field.ParentField = new SourceField(new Connection()){DataType = NodeDataType.Boolean, ParentField = new SourceField(new Connection()){DataType = NodeDataType.GageRR}}; //Doesn't match Assert.IsFalse(field.HasParentFieldOfType(NodeDataType.File)); //Matches Assert.IsTrue(field.HasParentFieldOfType(NodeDataType.GageRR)); }
/// <summary> /// Begins the load. /// </summary> /// <param name="field">The field.</param> /// <param name="action">The action.</param> public void BeginLoad(IExpressionField field, Action<IExpressionField, IEnumerable<IExpressionField>> action) { var dataType = SourceNodeFactory.GetDataType(_type.Type); var result = new SourceField(field.Connector.Owner) { DataType = dataType, Name = Constants.ArrayItemGenericFieldName, ConnectorOut = { DataType = dataType, Name = Constants.ArrayItemGenericFieldName }, SetName = SourceFieldSetNames.IntegrationServiceSourceItem, InnerName = string.Empty, SystemName = Constants.ArrayItemGenericFieldName }; action(field, new[] { result }); }
/// <summary> /// Creates the cross reference source field. /// </summary> /// <param name="field">The field.</param> /// <param name="owner">The owner.</param> /// <returns>SourceField.</returns> private static SourceField CreateCrossReferenceSourceField(FieldEdit field, ExpressionObjectBase owner) { var dataType = field.IsSingleCrossReference() ? NodeDataType.CrossReference : NodeDataType.List; var requiredStep = (CrossRefRequiredStepEdit)field.StepList.FirstOrDefault(s => s is CrossRefRequiredStepEdit); IExpressionFieldsRetriever subfieldsRetriever = null; if (requiredStep != null && requiredStep.CrossRefProcessId.HasValue) { subfieldsRetriever = new CrossReferenceSubfieldsRetriever(requiredStep.CrossRefProcessId.Value, CanBeSourceField, CreateSourceField); } var sf = new SourceField(owner) { DataType = dataType, Name = field.Name, ConnectorOut = { DataType = dataType, Name = field.Name }, SystemName = field.SystemName, SetName = SourceFieldSetNames.DataTriggerSourceItem, SubfieldsRetriever = subfieldsRetriever }; return sf; }
public static TreeViewItemInfo CreateFromSource(SourceField field) { if (field == null) return null; return new TreeViewItemInfo { Id = field.Id, Name = field.Name }; }