public void GetKeyColumn(XmlNode xnP ,PdmKey mKey) { XmlElement xe = (XmlElement)xnP; XmlNodeList nodeList = xe.ChildNodes; foreach (XmlNode node in nodeList) { ColumnInfo ci = new ColumnInfo(); ci.ColumnId = ((XmlElement)node).GetAttribute("Ref"); mKey.AddColumn(ci); } }
public void AddColumn(ColumnInfo mColumn) { if (columns == null) columns = new List<ColumnInfo>(); columns.Add(mColumn); }
private ColumnInfo GetColumn(XmlNode xnColumn) { ColumnInfo mColumn = new ColumnInfo(); XmlElement xe = (XmlElement)xnColumn; mColumn.ColumnId = xe.GetAttribute("Id"); XmlNodeList xnCProperty = xe.ChildNodes; foreach (XmlNode xnP in xnCProperty) { switch (xnP.Name) { case "a:ObjectID": mColumn.ObjectID = xnP.InnerText; break; case "a:Name": mColumn.Name = xnP.InnerText; break; case "a:Code": mColumn.Code = xnP.InnerText; break; case "a:CreationDate": mColumn.CreationDate = Convert.ToInt32(xnP.InnerText); break; case "a:Creator": mColumn.Creator = xnP.InnerText; break; case "a:ModificationDate": mColumn.ModificationDate = Convert.ToInt32(xnP.InnerText); break; case "a:Modifier": mColumn.Modifier = xnP.InnerText; break; case "a:Comment": mColumn.Comment = xnP.InnerText; break; case "a:DataType": mColumn.DataType = xnP.InnerText; break; case "a:Length": mColumn.Length = xnP.InnerText; break; case "a:Identity": mColumn.Identity = xnP.InnerText.Equals("Yes") ? true : false; break; case "a:Mandatory": mColumn.Mandatory = xnP.InnerText.Equals("1") ? true : false; break; case "a:PhysicalOptions": mColumn.PhysicalOptions = xnP.InnerText; break; case "a:ExtendedAttributesText": mColumn.ExtendedAttributesText = xnP.InnerText; break; } } return mColumn; }
private string GenerateColumnScripts(XElement root) { StringBuilder sb = new StringBuilder(); ColumnInfo sd = new ColumnInfo(); foreach (XElement element in root.Elements()) { if (element.Name.LocalName == "Name") { sd.Name = element.Value; } if (element.Name.LocalName == "Code") { sd.Code = element.Value; } if (element.Name.LocalName == "DataType") { sd.DataType = element.Value; } if (element.Name.LocalName == "Mandatory") { sd.Mandatory = element.Value == "1" ? true:false; } if (element.Name.LocalName == "Comment") { sd.Comment = element.Value; } } return sd.Code + " " + sd.DataType + " " + (sd.Mandatory ? " NOT NULL " : " ") + " , --" + sd.Name + (string.IsNullOrWhiteSpace(sd.Comment) ?"": " ; "+sd.Comment); }