private void AddRecsetShape(ref enDev2ColumnArgumentDirection columnDirection, XmlNode c, ref XmlAttribute descAttribute, ref XmlAttribute columnIoDirection) { var cols = new List <IScalar>(); foreach (XmlNode subc in c.ChildNodes) { // It is possible for the .Attributes property to be null, a check should be added AddAttributes(ref columnDirection, ref descAttribute, ref columnIoDirection, cols, subc); } if (c.Attributes != null) { descAttribute = c.Attributes["Description"]; columnIoDirection = c.Attributes["ColumnIODirection"]; } var descriptionValue = ""; columnDirection = enDev2ColumnArgumentDirection.None; if (descAttribute != null) { descriptionValue = descAttribute.Value; } if (columnIoDirection != null) { Enum.TryParse(columnIoDirection.Value, true, out columnDirection); } var recSet = new RecordSet { Columns = new Dictionary <int, List <IScalar> > { { 1, cols } }, Description = descriptionValue, IODirection = columnDirection, IsEditable = false, Name = c.Name }; RecordSets.Add(recSet); var shapeRecSet = new RecordSet { Columns = new Dictionary <int, List <IScalar> > { { 1, cols } }, Description = descriptionValue, IODirection = columnDirection, IsEditable = false, Name = c.Name }; ShapeRecordSets.Add(shapeRecSet); }
/// <summary> /// Used to transform the WorkflowInputs into XML /// </summary> public void SetXmlData() { // For some damn reason this does not always bind like it should! ;) Thread.Sleep(150); StringBuilder result = new StringBuilder("<" + RootTag + ">"); var recordSets = new List<IRecordSet>(); foreach(var item in WorkflowInputs) { string val = item.Value; if (val != null && val.IsXml()) { val = string.Format(GlobalConstants.XMLPrefix + "{0}", Convert.ToBase64String(Encoding.UTF8.GetBytes(val))); } if (item.IsRecordset) { var recordSet = recordSets.FirstOrDefault(set => set.Name == item.Recordset); if (recordSet==null) { recordSet = new RecordSet{Name = item.Recordset}; recordSet.Columns = new Dictionary<int, List<IScalar>>(); recordSets.Add(recordSet); } recordSet.AddColumn(val, item.Field, Convert.ToInt32(item.RecordsetIndex)); } else if(!item.IsRecordset) { DoScalarAppending(result,item); } } foreach(var recordSet in recordSets) { DoRecordSetAppending(recordSet,result); } result.Append("</" + RootTag + ">"); try { XmlData = XElement.Parse(result.ToString()).ToString(); } catch(Exception) { XmlData = "Invalid characters entered"; } }
public void CreateShape(string shape) { XmlDocument xDoc = new XmlDocument(); xDoc.LoadXml(shape); if(xDoc.DocumentElement != null) { XmlNodeList children = xDoc.DocumentElement.ChildNodes; var columnDirection = enDev2ColumnArgumentDirection.None; foreach(XmlNode c in children) { XmlAttribute descAttribute = null; XmlAttribute columnIoDirection = null; if(!DataListUtil.IsSystemTag(c.Name)) { if(c.HasChildNodes) { var cols = new List<IScalar>(); foreach(XmlNode subc in c.ChildNodes) { // It is possible for the .Attributes property to be null, a check should be added if(subc.Attributes != null) { descAttribute = subc.Attributes["Description"]; columnIoDirection = subc.Attributes["ColumnIODirection"]; if(columnIoDirection != null) { Enum.TryParse(columnIoDirection.Value, true, out columnDirection); } } var scalar = new Scalar { Name = subc.Name, IsEditable = true, IODirection = columnDirection }; if(descAttribute != null) { scalar.Description = descAttribute.Value; } cols.Add(scalar); } if(c.Attributes != null) { descAttribute = c.Attributes["Description"]; columnIoDirection = c.Attributes["ColumnIODirection"]; } var descriptionValue = ""; columnDirection = enDev2ColumnArgumentDirection.None; if(descAttribute != null) { descriptionValue = descAttribute.Value; } if(columnIoDirection != null) { Enum.TryParse(columnIoDirection.Value, true, out columnDirection); } var recSet = new RecordSet { Columns = new Dictionary<int, List<IScalar>> { { 1, cols } }, Description = descriptionValue, IODirection = columnDirection, IsEditable = false, Name = c.Name }; RecordSets.Add(recSet); } else { if(c.Attributes != null) { descAttribute = c.Attributes["Description"]; columnIoDirection = c.Attributes["ColumnIODirection"]; } string descriptionValue = ""; columnDirection = enDev2ColumnArgumentDirection.None; if(descAttribute != null) { descriptionValue = descAttribute.Value; } if(columnIoDirection != null) { Enum.TryParse(columnIoDirection.Value, true, out columnDirection); } var scalar = new Scalar { Name = c.Name, Description = descriptionValue, IODirection = columnDirection, IsEditable = true }; Scalars.Add(scalar); } } } } }
public void CreateShape(string shape) { XmlDocument xDoc = new XmlDocument(); xDoc.LoadXml(shape); if (xDoc.DocumentElement != null) { XmlNodeList children = xDoc.DocumentElement.ChildNodes; var columnDirection = enDev2ColumnArgumentDirection.None; foreach (XmlNode c in children) { XmlAttribute descAttribute = null; XmlAttribute columnIoDirection = null; if (!DataListUtil.IsSystemTag(c.Name)) { if (c.HasChildNodes) { var jsonAttribute = false; var xmlAttribute = c.Attributes?["IsJson"]; if (xmlAttribute != null) { bool.TryParse(xmlAttribute.Value, out jsonAttribute); } if (jsonAttribute) { AddComplexObjectFromXmlNode(c); } else { var cols = new List <IScalar>(); foreach (XmlNode subc in c.ChildNodes) { // It is possible for the .Attributes property to be null, a check should be added if (subc.Attributes != null) { descAttribute = subc.Attributes["Description"]; columnIoDirection = subc.Attributes["ColumnIODirection"]; if (columnIoDirection != null) { Enum.TryParse(columnIoDirection.Value, true, out columnDirection); } } var scalar = new Scalar { Name = subc.Name, IsEditable = true, IODirection = columnDirection }; if (descAttribute != null) { scalar.Description = descAttribute.Value; } cols.Add(scalar); } if (c.Attributes != null) { descAttribute = c.Attributes["Description"]; columnIoDirection = c.Attributes["ColumnIODirection"]; } var descriptionValue = ""; columnDirection = enDev2ColumnArgumentDirection.None; if (descAttribute != null) { descriptionValue = descAttribute.Value; } if (columnIoDirection != null) { Enum.TryParse(columnIoDirection.Value, true, out columnDirection); } var recSet = new RecordSet { Columns = new Dictionary <int, List <IScalar> > { { 1, cols } }, Description = descriptionValue, IODirection = columnDirection, IsEditable = false, Name = c.Name }; RecordSets.Add(recSet); var shapeRecSet = new RecordSet { Columns = new Dictionary <int, List <IScalar> > { { 1, cols } }, Description = descriptionValue, IODirection = columnDirection, IsEditable = false, Name = c.Name }; ShapeRecordSets.Add(shapeRecSet); } } else { if (c.Attributes != null) { descAttribute = c.Attributes["Description"]; columnIoDirection = c.Attributes["ColumnIODirection"]; } string descriptionValue = ""; columnDirection = enDev2ColumnArgumentDirection.None; if (descAttribute != null) { descriptionValue = descAttribute.Value; } if (columnIoDirection != null) { Enum.TryParse(columnIoDirection.Value, true, out columnDirection); } var scalar = new Scalar { Name = c.Name, Description = descriptionValue, IODirection = columnDirection, IsEditable = true }; Scalars.Add(scalar); ShapeScalars.Add(scalar); } } } } }