private void BuildEnum(string Description, int Join, eJoinType JoinType) { tempJoin.description = Description; tempJoin.joinNumber = Join; switch (JoinType) { case eJoinType.analog: enumAnalogList.Add(tempJoin); break; case eJoinType.digital: enumBoolList.Add(tempJoin); break; case eJoinType.serial: enumSerialList.Add(tempJoin); break; case eJoinType.smartObject: enumSOList.Add(tempJoin); break; default: break; } }
private static string buildQueryString( string joinedTableName, TableColumn leftAnchorTableColumn, TableColumn rightAnchorTableColumn, eJoinType joinType) { StringBuilder queryStringBuilder = new StringBuilder(); string joinTypeString = JoinTypeToString(joinType); return(string.Format( "{0} {1} ON {2} = {3}", joinTypeString, joinedTableName, leftAnchorTableColumn.FullyQualifiedName, rightAnchorTableColumn.FullyQualifiedName)); }
public Join( string joinedTableName, TableColumn leftAnchorTableColumn, TableColumn rightAnchorTableColumn, eJoinType joinType) { this.joinedTableName = joinedTableName; this.leftAnchorTableColumn = leftAnchorTableColumn; this.rightAnchorTableColumn = rightAnchorTableColumn; this.joinType = joinType; this.queryString = buildQueryString( joinedTableName, leftAnchorTableColumn, rightAnchorTableColumn, joinType); }
private void ParseFile(StreamReader XMLContent) { //Split into Pages StreamWriter tempStreamWriter = new StreamWriter(string.Format(@"{0}/XMLParsed.csv", saveLocation_String)); //Need to specify where to save the file to /*Within each page look for the Join * Under Children, each Child is an object of some sort * Break down the Child based on: * > Page (Element) * > Children (Element) * > Child (Element) * > UID (Attribute) - Contains Join # * > Target Control (Element) * > Control Name (Element) * > Write To File */ using (XmlReader reader = XmlReader.Create(XMLContent)) { XmlDocument doc = new XmlDocument(); XmlDocument doc2 = new XmlDocument(); doc.Load((string.Format(@"{0}/Debug.txt", Directory.GetCurrentDirectory()))); //Grab the "Children" Section per Page. This contains the information in regards to the objects on the page XmlNodeList nodes = doc.GetElementsByTagName("Children"); //For debugging tempStreamWriter.WriteLine("Object,Object Name,Join Type,Join Number"); //tempStreamWriter.WriteLine("Number of Nodes with Tage Page = " + nodes.Count); //A "Children" is built of "Child", we have data within each "Child" that we want foreach (XmlNode n in nodes) { // Breakdown the node, and grab the following information: XmlAttributeCollection xmlChildAttribute = n.Attributes; XmlNodeList xmlChildNodeList = n.ChildNodes; //tempStreamWriter.WriteLine("Number of Child Nodes Page = " + xmlChildNodeList.Count); //So we iterate through each "Child" and first grab the "Child uid", equivalent to a VT Pro Join Number foreach (XmlNode child in xmlChildNodeList) { //Next we look inside the child and grab // Control Name, Equivalent to the Object added in VT Pro // Object Name, Equivalent to the Object Name in VT Pro string entryToAdd = ""; string objectDetail = ""; string forEnumDetails = ""; string forEnum = ""; foreach (XmlNode chldNode in child.ChildNodes) { if (chldNode.Name.ToUpper() == "TARGETCONTROL") { objectDetail += chldNode.InnerText + ","; } else if (chldNode.Name.ToUpper() == "OBJECTNAME") { objectDetail += chldNode.InnerText + ","; forEnum += chldNode.InnerText.Replace(' ', '_') + "_"; } else if (chldNode.Name.ToUpper() == "PROPERTIES") { foreach (XmlNode chld2 in chldNode.ChildNodes) { if (chld2.Name.ToUpper() == "CONTROLJOIN") { objectDetail += "SmartObject,"; objectDetail += chld2.InnerText; forEnum += "SmartObject"; tempStreamWriter.WriteLine(objectDetail); BuildEnum(forEnum, Convert.ToInt32(chld2.InnerText), eJoinType.smartObject); break; //When the object name is grabbed, break out of the foreach loop } else if (chld2.Name.Contains("Digital") || chld2.Name.Contains("Serial") || chld2.Name.Contains("Analog")) { if (chld2.InnerText != "0") { eJoinType joinType = eJoinType.error; entryToAdd += chld2.Name + ","; entryToAdd += chld2.InnerText; forEnumDetails += chld2.Name; if (chld2.Name.Contains("Digital")) { joinType = eJoinType.digital; } else if (chld2.Name.Contains("Serial")) { joinType = eJoinType.serial; } else if (chld2.Name.Contains("Analog")) { joinType = eJoinType.analog; } if (joinType != eJoinType.error && chld2.InnerText.Length != 0) { BuildEnum(string.Format(forEnum + forEnumDetails), Convert.ToInt32(chld2.InnerText), joinType); } tempStreamWriter.WriteLine(objectDetail + entryToAdd); forEnumDetails = ""; entryToAdd = ""; } else { entryToAdd = ""; } } } } } //tempStreamWriter.WriteLine("Target Control is: " + child.ChildNodes[); //tempStreamWriter.WriteLine("Control Name is: " + child.Attributes[2].InnerText); } } } tempStreamWriter.Close(); CompleteEnum(); //XmlReader.Create() }
public static string JoinTypeToString(eJoinType joinType) { return(joinTypeToString[joinType]); }