public FolioModel getFolio(int tDte, String rutEmisor) { FolioModel f = new FolioModel(); try { SQLiteConnection myConn = bd.ConnectSqlite(); myConn.Open(); string sql = "select * from folio where tipoDte = " + tDte + " and rut ='" + rutEmisor + "' order by fch;"; SQLiteCommand command = new SQLiteCommand(sql, myConn); SQLiteDataReader reader = command.ExecuteReader(); while (reader.Read()) { f.rut = reader["rut"].ToString(); } f.rsnsocial = reader["rsnsocial"].ToString(); f.tipoDte = Int32.Parse(reader["tipoDte"].ToString()); f.folioIni = Int32.Parse(reader["folioIni"].ToString()); f.folioFin = Int32.Parse(reader["folioFin"].ToString()); f.folioSgte = Int32.Parse(reader["folioSgte"].ToString()); f.fecha = reader["fecha"].ToString(); f.rango = reader["rango"].ToString(); myConn.Close(); return(f); } catch (Exception e) { Console.WriteLine("ERROR: {0}", e.ToString()); return(f); } }
public void save(FolioModel foliomodel) { try { BaseDato con = new BaseDato(); OdbcConnection conexion = con.ConnectPostgres(); OdbcCommand select = new OdbcCommand(); select.Connection = conexion; select.CommandText = "INSERT INTO folio(" + "folio, estado, idcaf, \"codSucSii\")" + " VALUES (" + foliomodel.folio + ",'" + "DISPONIBLE" + "'," + foliomodel.idcaf + ",'" + foliomodel.codSucSii + "'" + ");"; OdbcDataReader reader = select.ExecuteReader(); } catch (Exception ex) { throw new Exception("Error" + ex.Message); } }
public FolioModel getCaf(String rut, String tipoDte) { XmlDocument xDoc = new XmlDocument(); FolioModel folio = new FolioModel(); //La ruta del documento XML permite rutas relativas //respecto del ejecutable! xDoc.Load(@"C:/AdmToSii/cafs/77398570-7/notacredito/FoliosSII77398570611382015691252.xml"); XmlNodeList lista = xDoc.GetElementsByTagName("AUTORIZACION"); XmlNodeList lista1 = ((XmlElement)lista[0]).GetElementsByTagName("CAF"); XmlNodeList lista2 = ((XmlElement)lista1[0]).GetElementsByTagName("DA"); XmlNodeList lista3 = ((XmlElement)lista2[0]).GetElementsByTagName("RNG"); foreach (XmlElement nodo in lista) { int i = 0; XmlNodeList rutCaf = nodo.GetElementsByTagName("RE"); XmlNodeList rzSoc = nodo.GetElementsByTagName("RS"); XmlNodeList tpoDte = nodo.GetElementsByTagName("TD"); XmlNodeList folioIni = nodo.GetElementsByTagName("D"); XmlNodeList folioFinal = nodo.GetElementsByTagName("H"); folio.rut = rutCaf[i].InnerText; folio.rsnsocial = rzSoc[i].InnerText; // folio.tipoDte = tipoDte[i].InnerText; // folio.folioIni = folioIni[i].InnerText; // folio.folioFin = folioFinal[i].InnerText; int final = Convert.ToInt32(folioFinal[i].InnerText); int inicial = Convert.ToInt32(folioIni[i].InnerText); // folio.rango = final - inicial + 1; Console.WriteLine(" Rut: {0} Razon Social: {1} Tipo Dte {2} Folio Inicial: {3} Folio Final {4} Rango {5}", folio.rut, folio.rsnsocial, // folio.tpoDte, folio.folioIni, folio.folioFin, folio.rango);; } return(folio); }