private void _Mtd_CrearArchivoISLR(string _P_Str_ID_Archivo) { System.IO.DirectoryInfo _DirInf = new System.IO.DirectoryInfo("c:\\seniat"); if (!_DirInf.Exists) { _DirInf.Create(); } string _Str_Cadena = "SELECT REPLACE(crifagenretencion,'-','') AS crifagenretencion,cfecha FROM TARCHIVOISLRD WHERE cgroupcomp='" + Frm_Padre._Str_GroupComp + "' AND ccompany='" + Frm_Padre._Str_Comp + "' AND cidarchivoislr='" + _P_Str_ID_Archivo + "'"; DataSet _Ds = Program._MyClsCnn._mtd_conexion._Mtd_RetornarDataset(_Str_Cadena); if (_Ds.Tables[0].Rows.Count > 0) { string _Str_RifAgente = _Ds.Tables[0].Rows[0]["crifagenretencion"].ToString().Trim(); string _Str_Periodo = _Ds.Tables[0].Rows[0]["cfecha"].ToString().Trim(); _Str_Cadena = "SELECT REPLACE(crifprovee,'-','') AS RifRetenido,REPLACE(cnumfact,'-','') AS NumeroFactura, REPLACE(cnumcont,'-','') AS NumeroControl,CONVERT(VARCHAR,cfechaoperacion,103) AS FechaOperacion,ccodigoconcepto AS CodigoConcepto,REPLACE(cmontdocu,',','.') AS MontoOperacion,REPLACE(cporcenreten,',','.') AS PorcentajeRetencion FROM TARCHIVOISLRD WHERE cgroupcomp='" + Frm_Padre._Str_GroupComp + "' AND ccompany='" + Frm_Padre._Str_Comp + "' AND cidarchivoislr='" + _P_Str_ID_Archivo + "'"; _Ds = Program._MyClsCnn._mtd_conexion._Mtd_RetornarDataset(_Str_Cadena); _Ds.Tables[0].TableName = "DetalleRetencion"; //const string _Str_Comillas = "\""; //_Ds.DataSetName = "RelacionRetencionesISLR RifAgente=" + _Str_Comillas + _Str_RifAgente + _Str_Comillas + " Periodo=" + _Str_Periodo; _Ds.DataSetName = "RelacionRetencionesISLR"; _Ds.EnforceConstraints = false; XmlDataDocument _Xml_d = new XmlDataDocument(_Ds); XmlDeclaration _Xml_Decl = _Xml_d.CreateXmlDeclaration("1.0", "ISO-8859-1", null); XmlElement _Xml_Elem = _Xml_d.DocumentElement; _Xml_d.InsertBefore(_Xml_Decl, _Xml_Elem); XmlAttribute _Xml_a = _Xml_d.CreateAttribute("RifAgente"); _Xml_a.Value = _Str_RifAgente; _Xml_d["RelacionRetencionesISLR"].Attributes.Append(_Xml_a); _Xml_a = _Xml_d.CreateAttribute("Periodo"); _Xml_a.Value = _Str_Periodo; _Xml_d["RelacionRetencionesISLR"].Attributes.Append(_Xml_a); _Xml_d.Save("c:\\seniat\\XML_relacionRetencionesISLR_.xml"); } }
public static void InitLogger() { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); startTime = DateTime.Now; times = new List <DateTime>(); fpss = new List <int>(1000); stopwatches = new List <Stopwatch>(); doc = new XmlDataDocument(); doc.CreateXmlDeclaration("1.0", "UTF-8", "yes"); dbgDoc = new XmlDataDocument(); dbgDoc.CreateXmlDeclaration("1.0", "UTF-8", "yes"); XmlElement html = doc.CreateElement("html"); XmlElement head = doc.CreateElement("head"); XmlElement link = doc.CreateElement("link"); XmlAttribute type = doc.CreateAttribute("type"); type.InnerText = "text/css"; link.Attributes.Append(type); XmlAttribute rel = doc.CreateAttribute("rel"); rel.InnerText = "Stylesheet"; link.Attributes.Append(rel); XmlAttribute href = doc.CreateAttribute("href"); href.InnerText = "logging.css"; link.Attributes.Append(href); head.AppendChild(link); html.AppendChild(head); XmlElement body = doc.CreateElement("body"); XmlElement text = doc.CreateElement("div"); text.InnerXml = "Logger verze 0.3; cas zacatku: " + startTime.ToString(); body.AppendChild(text); html.AppendChild(body); doc.AppendChild(html); dbgDoc = (XmlDataDocument)doc.CloneNode(true); bodyNode = doc.GetElementsByTagName("body")[0]; dbgBodyNode = dbgDoc.GetElementsByTagName("body")[0]; //Save(); bInitialized = true; Console.WriteLine("Logger spusten"); AddError("test"); }
public void CreateXml(DataSet dataset_for_index_doc, DataSet dataset_for_folder, string indexing, string fullPath, string filename, SqlConnection connection, string folderID, string docID) { string temp_string = System.IO.Path.GetExtension(filename); string output_filename = filename.Replace(temp_string, ".xml"); string temp_fullpath = string.Format("{0}\\{1}", fullPath, output_filename); //String SQLCommand = " select * from obj where parent_id =" + indexing ; DataRow[] indexRow = dataset_for_index_doc.Tables[0].Select("DocID = " + docID); XmlDataDocument doc = new XmlDataDocument(); XmlDeclaration xmlDeclaration = doc.CreateXmlDeclaration("1.0", "UTF-8", null); XmlElement root = doc.DocumentElement; doc.InsertBefore(xmlDeclaration, root); DataRow[] r = dataset_for_folder.Tables[0].Select("folderID = " + folderID); string temp_index_name = r[0].ItemArray[0].ToString().Replace(" ", ""); XmlElement element1 = doc.CreateElement(string.Empty, temp_index_name, string.Empty); doc.AppendChild(element1); //Create an element representing the first customer record. //foreach (DataRow row in ds.Tables[0].Rows) //{ // string temp_index_name1 = row.ItemArray[3].ToString().Replace(" ", ""); // XmlElement element2 = doc.CreateElement(string.Empty, temp_index_name1, string.Empty); // XmlText text1 = doc.CreateTextNode(row.ItemArray[3].ToString()); // element2.AppendChild(text1); // element1.AppendChild(element2); //} foreach (DataRow index in indexRow) { string temp_index_name1 = index.ItemArray[4].ToString().Replace(" ", ""); XmlElement element2 = doc.CreateElement(string.Empty, temp_index_name1, string.Empty); XmlText text1 = doc.CreateTextNode(index.ItemArray[3].ToString()); element2.AppendChild(text1); element1.AppendChild(element2); } doc.Save(temp_fullpath); }