public override bool Execute() { DATASET_PATH = SVNRootPath.ItemSpec + @"DATASET\"; wssGetList.getList myList = new wssGetList.getList("http://hd16.hafsjold.dk", "administrator", "m733", "hd16"); System.Xml.Serialization.XmlSerializer ser; XmlTextWriter writer; System.Data.DataSet dsListItems = myList.getListData("ProPurList"); dsListItems.SchemaSerializationMode = SchemaSerializationMode.IncludeSchema; ser = new System.Xml.Serialization.XmlSerializer(dsListItems.GetType()); writer = new XmlTextWriter(DATASET_PATH + "dsListItems.xml", System.Text.Encoding.UTF8); writer.Formatting = Formatting.Indented; ser.Serialize(writer, dsListItems); writer.Close(); System.Data.DataSet dsListTypeItems = myList.getListData("ProPurListType"); dsListTypeItems.SchemaSerializationMode = SchemaSerializationMode.IncludeSchema; ser = new System.Xml.Serialization.XmlSerializer(dsListTypeItems.GetType()); writer = new XmlTextWriter(DATASET_PATH + "dsListTypeItems.xml", System.Text.Encoding.UTF8); writer.Formatting = Formatting.Indented; ser.Serialize(writer, dsListTypeItems); writer.Close(); System.Data.DataSet dsTypeItems = myList.getListData("ProPurType"); dsTypeItems.SchemaSerializationMode = SchemaSerializationMode.IncludeSchema; ser = new System.Xml.Serialization.XmlSerializer(dsTypeItems.GetType()); writer = new XmlTextWriter(DATASET_PATH + "dsTypeItems.xml", System.Text.Encoding.UTF8); writer.Formatting = Formatting.Indented; ser.Serialize(writer, dsTypeItems); writer.Close(); System.Data.DataSet dsTypeColumnItems = myList.getListData("ProPurTypeColumn"); dsTypeColumnItems.SchemaSerializationMode = SchemaSerializationMode.IncludeSchema; ser = new System.Xml.Serialization.XmlSerializer(dsTypeColumnItems.GetType()); writer = new XmlTextWriter(DATASET_PATH + "dsTypeColumnItems.xml", System.Text.Encoding.UTF8); writer.Formatting = Formatting.Indented; ser.Serialize(writer, dsTypeColumnItems); writer.Close(); System.Data.DataSet dsFieldItems = myList.getListData("ProPurColumn"); dsFieldItems.SchemaSerializationMode = SchemaSerializationMode.IncludeSchema; ser = new System.Xml.Serialization.XmlSerializer(dsFieldItems.GetType()); writer = new XmlTextWriter(DATASET_PATH + "dsFieldItems.xml", System.Text.Encoding.UTF8); writer.Formatting = Formatting.Indented; ser.Serialize(writer, dsFieldItems); writer.Close(); return(true); }
public static void GenerateMetadataMain(MemoryStream sXML) { InitParams(sXML); wssGetList.getList myList = new wssGetList.getList("http://hd16.hafsjold.dk", "administrator", "m733", "hd16"); System.Xml.Serialization.XmlSerializer ser; XmlTextWriter writer; System.Data.DataSet dsListItems = myList.getListData("ProPurList"); dsListItems.SchemaSerializationMode = SchemaSerializationMode.IncludeSchema; ser = new System.Xml.Serialization.XmlSerializer(dsListItems.GetType()); writer = new XmlTextWriter(DATASET_PATH + "dsListItems.xml", System.Text.Encoding.UTF8); writer.Formatting = Formatting.Indented; ser.Serialize(writer, dsListItems); writer.Close(); System.Data.DataSet dsListTypeItems = myList.getListData("ProPurListType"); dsListTypeItems.SchemaSerializationMode = SchemaSerializationMode.IncludeSchema; ser = new System.Xml.Serialization.XmlSerializer(dsListTypeItems.GetType()); writer = new XmlTextWriter(DATASET_PATH + "dsListTypeItems.xml", System.Text.Encoding.UTF8); writer.Formatting = Formatting.Indented; ser.Serialize(writer, dsListTypeItems); writer.Close(); System.Data.DataSet dsTypeItems = myList.getListData("ProPurType"); dsTypeItems.SchemaSerializationMode = SchemaSerializationMode.IncludeSchema; ser = new System.Xml.Serialization.XmlSerializer(dsTypeItems.GetType()); writer = new XmlTextWriter(DATASET_PATH + "dsTypeItems.xml", System.Text.Encoding.UTF8); writer.Formatting = Formatting.Indented; ser.Serialize(writer, dsTypeItems); writer.Close(); System.Data.DataSet dsTypeColumnItems = myList.getListData("ProPurTypeColumn"); dsTypeColumnItems.SchemaSerializationMode = SchemaSerializationMode.IncludeSchema; ser = new System.Xml.Serialization.XmlSerializer(dsTypeColumnItems.GetType()); writer = new XmlTextWriter(DATASET_PATH + "dsTypeColumnItems.xml", System.Text.Encoding.UTF8); writer.Formatting = Formatting.Indented; ser.Serialize(writer, dsTypeColumnItems); writer.Close(); System.Data.DataSet dsFieldItems = myList.getListData("ProPurColumn"); dsFieldItems.SchemaSerializationMode = SchemaSerializationMode.IncludeSchema; ser = new System.Xml.Serialization.XmlSerializer(dsFieldItems.GetType()); writer = new XmlTextWriter(DATASET_PATH + "dsFieldItems.xml", System.Text.Encoding.UTF8); writer.Formatting = Formatting.Indented; ser.Serialize(writer, dsFieldItems); writer.Close(); }
static void Main(string[] args) { wssGetList.getList myList = new wssGetList.getList("http://hd16.hafsjold.dk", "administrator", "m733", "hd16"); string listName = myList.getListName("ProPurColumn"); System.Data.DataSet dsFieldItems = myList.getListData("ProPurColumn"); DataTable Field_rows = dsFieldItems.Tables["row"]; System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); string xmlString = "<Batch OnError='Continue' ListVersion='1'>"; foreach (DataRow Column_row in Field_rows.Rows) { string ows_ID = (string)Column_row["ows_ID"]; string TestOpdat; try { TestOpdat = (string)Column_row["ows_TestOpdat"]; } catch { TestOpdat = null; } if (TestOpdat == "1234") { //update xmlString += "<Method ID='" + ows_ID + "' Cmd='Update'>"; xmlString += "<Field Name='ID'>" + ows_ID + "</Field>"; xmlString += "<Field Name='TestOpdat'>Andreas Hafsjold</Field>"; xmlString += "</Method>"; } else { // do not update } } xmlString += "</Batch>"; doc.LoadXml(xmlString); System.Xml.XmlNode myitems = doc.SelectSingleNode("//Batch"); System.Xml.XmlNode myresult = myList.updateListData(listName, myitems); }