/// <summary> /// read invoicexml /// </summary> /// <param name="filename"></param> /// <returns></returns> public static VoygerBill ReadInvoiceXML(string filename) { DataSet dataSet = ReadXML(filename); if (dataSet != null || dataSet.Tables.Count > 0) { vBill = new VoygerBill(); foreach (DataTable table in dataSet.Tables) { fileWR.WriteLine("TableName: " + table); fileWR.WriteLine(); switch (table.TableName) { case VoyTable.T_Bill: ReadBill(table); break; case VoyTable.T_Customer: ReadCustomer(table); break; case VoyTable.T_LineItem: ReadLineItems(table); break; case VoyTable.T_Payments: ReadPaymentDetails(table); break; default: break; } } return(vBill); } else { return(null); // Error: Incase failed to read or no data present } }
/// <summary> /// Read voyger bill XML file and process it using DataSet /// </summary> /// <param name="xmlFile"></param> /// <returns>No of table is created</returns> public static int ReadVoyBillXML(string xmlFile) { DataSet dataSet = new DataSet(); dataSet.ReadXml(xmlFile, XmlReadMode.InferSchema); fileWR = File.AppendText(xmlFile + "_DataSet.txt"); //TODO: remove it fileWR.WriteLine("xml:{0}: Using DataSet:", xmlFile); int c = dataSet.Tables.Count; fileWR.WriteLine("No of Table is created in current Data is " + c, xmlFile); if (c > 0) { vBill = new VoygerBill(); } else { return(-1); // Error: Incase failed to read or no data present } foreach (DataTable table in dataSet.Tables) { fileWR.WriteLine("TableName: " + table); fileWR.WriteLine(); switch (table.TableName) { case VoyTable.T_Bill: ReadBill(table); break; case VoyTable.T_Customer: ReadCustomer(table); break; case VoyTable.T_LineItem: ReadLineItems(table); break; case VoyTable.T_Payments: ReadPaymentDetails(table); break; default: break; } } WriteVoyDataToFile(); fileWR.Flush(); fileWR.Close(); return(c); }