private List <GastoViajeComprobante> GetList() { try { CN_CapGastoViajeComprobante clsGastoViajeComprobante = new CN_CapGastoViajeComprobante(); List <GastoViajeComprobante> list = new List <GastoViajeComprobante>(); Sesion session = new Sesion(); session = (Sesion)Session["Sesion" + Session.SessionID]; GastoViajeComprobante gastoViajeComprobante = new GastoViajeComprobante(); //gastoViajeComprobante.Id_Emp = session.Id_Emp; //gastoViajeComprobante.Id_Cd = session.Id_Cd_Ver; gastoViajeComprobante.Id_GV = Int32.Parse(Request.QueryString["Id"] == null ? "-1" : Request.QueryString["Id"]); gastoViajeComprobante.Id_Emp = Int32.Parse(Request.QueryString["Id_Emp"] == null ? session.Id_Emp.ToString() : Request.QueryString["Id_Emp"]); gastoViajeComprobante.Id_Cd = Int32.Parse(Request.QueryString["Id_Cd"] == null ? session.Id_Cd_Ver.ToString() : Request.QueryString["Id_Cd"]); clsGastoViajeComprobante.ConsultaGastoViajeComprobante(gastoViajeComprobante, session.Emp_Cnx, ref list); Session["Id_GV"] = gastoViajeComprobante.Id_GV; return(list); } catch (Exception ex) { throw ex; } }
public void EliminarGastoViajeComprobante(GastoViajeComprobante gastoViajeComprobante, string Conexion, ref int verificador) { try { new CD_CapGastoViajeComprobante().EliminarGastoViajeComprobante(gastoViajeComprobante, Conexion, ref verificador); } catch (Exception ex) { throw ex; } }
public void ConsultaGastoViajeComprobante(GastoViajeComprobante gastoViajeComprobante, string Conexion) { try { new CD_CapGastoViajeComprobante().ConsultaGastoViajeComprobante(gastoViajeComprobante, Conexion); } catch (Exception ex) { throw ex; } }
public void ConsultaGastoViajeComprobante(GastoViajeComprobante gastoViajeComprobante, string Conexion, ref List <GastoViajeComprobante> list) { try { SqlDataReader dr = null; CapaDatos.CD_Datos CapaDatos = new CapaDatos.CD_Datos(Conexion); string[] Parametros = { "@Id_Emp", "@Id_Cd", "@Id_GV" }; object[] Valores = { gastoViajeComprobante.Id_Emp, gastoViajeComprobante.Id_Cd, gastoViajeComprobante.Id_GV }; SqlCommand sqlcmd = CapaDatos.GenerarSqlCommand("spCapGastoViajeComprobante_Lista", ref dr, Parametros, Valores); while (dr.Read()) { gastoViajeComprobante = new GastoViajeComprobante(); gastoViajeComprobante.Id_Emp = (int)dr.GetValue(dr.GetOrdinal("Id_Emp")); gastoViajeComprobante.Id_Cd = (int)dr.GetValue(dr.GetOrdinal("Id_Cd")); gastoViajeComprobante.Id_GV = (int)dr.GetValue(dr.GetOrdinal("Id_GV")); gastoViajeComprobante.Id_GVComprobante = (int)dr.GetValue(dr.GetOrdinal("Id_GVComprobante")); gastoViajeComprobante.GVComprobante_Fecha = DateTime.Parse(dr["GVComprobante_Fecha"].ToString()); gastoViajeComprobante.Id_GVComprobanteTipo = Int32.Parse(dr["Id_GVComprobanteTipo"].ToString()); //JFCV la columna de descripción ya no se va a mostrar en el grid //gastoViajeComprobante.GVComprobanteTipo_Descripcion = dr["GVComprobanteTipo_Descripcion"].ToString(); gastoViajeComprobante.GVComprobante_ConComprobante = Boolean.Parse(dr["GVComprobante_ConComprobante"].ToString()); gastoViajeComprobante.GVComprobante_ConComprobanteDescripcion = dr["GVComprobante_ConComprobanteDescripcion"].ToString(); gastoViajeComprobante.GVComprobante_Xml = dr["GVComprobante_Xml"].ToString(); gastoViajeComprobante.GVComprobante_XmlStream = dr["GVComprobante_XmlStream"] == System.DBNull.Value ? null : (byte[])(dr["GVComprobante_XmlStream"]); gastoViajeComprobante.GVComprobante_Pdf = dr["GVComprobante_Pdf"] == System.DBNull.Value ? null : (byte[])(dr["GVComprobante_Pdf"]); gastoViajeComprobante.GVComprobante_Observaciones = dr["GVComprobante_Observaciones"].ToString(); gastoViajeComprobante.GVComprobante_Importe = decimal.Parse(dr["GVComprobante_Importe"].ToString()); gastoViajeComprobante.GVComprobante_GV_CuentaPago = dr["GV_CuentaPago"].ToString(); gastoViajeComprobante.GVComprobante_GV_Cuenta = dr["GV_Cuenta"].ToString(); gastoViajeComprobante.GVComprobante_GV_Cc = dr["GV_Cc"].ToString(); gastoViajeComprobante.GVComprobante_GV_Numero = dr["GV_Numero"].ToString(); gastoViajeComprobante.GVComprobante_GV_SubCuenta = dr["GV_SubCuenta"].ToString(); gastoViajeComprobante.GVComprobante_GV_SubSubCuenta = dr["GV_SubSubCuenta"].ToString(); gastoViajeComprobante.GVComprobante_Serie = dr["GVComprobante_Serie"].ToString(); gastoViajeComprobante.GVComprobante_Folio = dr["GVComprobante_Folio"].ToString(); list.Add(gastoViajeComprobante); } CapaDatos.LimpiarSqlcommand(ref sqlcmd); } catch (Exception ex) { throw ex; } }
private void descargarPDF(int id_GVComprobante) { GastoViajeComprobante gastoViajeComprobante = new GastoViajeComprobante(); Sesion Sesion = new Sesion(); Sesion = (Sesion)Session["Sesion" + Session.SessionID]; //gastoViajeComprobante.Id_Emp = Sesion.Id_Emp; //gastoViajeComprobante.Id_Cd = Sesion.Id_Cd_Ver; gastoViajeComprobante.Id_GV = Int32.Parse(Request.QueryString["Id"] == null ? "-1" : Request.QueryString["Id"]); gastoViajeComprobante.Id_Emp = Int32.Parse(Request.QueryString["Id_Emp"] == null ? Sesion.Id_Emp.ToString() : Request.QueryString["Id_Emp"]); gastoViajeComprobante.Id_Cd = Int32.Parse(Request.QueryString["Id_Cd"] == null ? Sesion.Id_Cd_Ver.ToString() : Request.QueryString["Id_Cd"]); gastoViajeComprobante.Id_GVComprobante = id_GVComprobante; CN_CapGastoViajeComprobante clsGastoViajeComprobante = new CN_CapGastoViajeComprobante(); clsGastoViajeComprobante.ConsultaGastoViajeComprobante(gastoViajeComprobante, Sesion.Emp_Cnx); byte[] archivoPdf = gastoViajeComprobante.GVComprobante_Pdf; if (archivoPdf != null) { if (archivoPdf.Length > 0) { string tempPDFname = string.Concat("GVComprobante_" , Sesion.Id_Emp.ToString() , "_", Sesion.Id_Cd.ToString() , "_", id_GVComprobante.ToString() , ".pdf"); string URLtempPDF = Server.MapPath(string.Concat(ConfigurationManager.AppSettings["URLtempPDF"].ToString(), tempPDFname)); string WebURLtempPDFGastos = string.Concat(ConfigurationManager.AppSettings["WebURLtempPDFGastos"].ToString(), tempPDFname); this.ByteToTempPDF(URLtempPDF, archivoPdf); // ------------------------------------------------------------------------------------------------ // Ejecuta funciós JS para abrir una nueva ventada de Explorador y visualizar el archivo PDF // ------------------------------------------------------------------------------------------------ RAM1.ResponseScripts.Add(string.Concat(@"AbrirFacturaPDF('", WebURLtempPDFGastos, "')")); } } else { Alerta("El registro no tiene un archivo PDF."); } }
public void EliminarGastoViajeComprobante(GastoViajeComprobante gastoViajeComprobante, string Conexion, ref int verificador) { try { CapaDatos.CD_Datos CapaDatos = new CapaDatos.CD_Datos(Conexion); string[] Parametros = { "@Id_Emp", "@Id_Cd", "@Id_GV", "@Id_GVComprobante" }; object[] Valores = { gastoViajeComprobante.Id_Emp, gastoViajeComprobante.Id_Cd, gastoViajeComprobante.Id_GV, gastoViajeComprobante.Id_GVComprobante }; SqlCommand sqlcmd = CapaDatos.GenerarSqlCommand("spCapGastoViajeComprobante_Eliminar", ref verificador, Parametros, Valores); CapaDatos.LimpiarSqlcommand(ref sqlcmd); } catch (Exception ex) { throw ex; } }
public void InsertarGastoViajeComprobante(GastoViajeComprobante gastoViajeComprobante, string Conexion, ref int verificador) { CapaDatos.CD_Datos CapaDatos = new CapaDatos.CD_Datos(Conexion); try { string[] Parametros = { "@Id_Emp", "@Id_Cd", "@Id_GV", "@Id_GVComprobante", "@GVComprobante_Fecha", "@Id_GVComprobanteTipo", "@GVComprobante_ConComprobante", "@GVComprobante_Xml", "@GVComprobante_XmlStream", "@GVComprobante_Pdf", "@GVComprobante_Observaciones", "@GVComprobante_Importe", "@GVSerie", "@GVFolio", "@GV_Cuenta", "@GV_Cc", "@GV_CuentaPago", "@GV_Numero", "@GV_SubCuenta", "@GV_SubSubCuenta" }; object[] Valores = { gastoViajeComprobante.Id_Emp, gastoViajeComprobante.Id_Cd, gastoViajeComprobante.Id_GV, gastoViajeComprobante.Id_GVComprobante, gastoViajeComprobante.GVComprobante_Fecha, gastoViajeComprobante.Id_GVComprobanteTipo, gastoViajeComprobante.GVComprobante_ConComprobante, gastoViajeComprobante.GVComprobante_Xml, gastoViajeComprobante.GVComprobante_XmlStream, gastoViajeComprobante.GVComprobante_Pdf, gastoViajeComprobante.GVComprobante_Observaciones, gastoViajeComprobante.GVComprobante_Importe, gastoViajeComprobante.GVComprobante_Serie, gastoViajeComprobante.GVComprobante_Folio, gastoViajeComprobante.GVComprobante_GV_Cuenta, gastoViajeComprobante.GVComprobante_GV_Cc, gastoViajeComprobante.GVComprobante_GV_CuentaPago, gastoViajeComprobante.GVComprobante_GV_Numero, gastoViajeComprobante.GVComprobante_GV_SubCuenta, gastoViajeComprobante.GVComprobante_GV_SubSubCuenta }; SqlCommand sqlcmd = CapaDatos.GenerarSqlCommand("spCapGastoViajeComprobante_Insertar", ref verificador, Parametros, Valores); CapaDatos.LimpiarSqlcommand(ref sqlcmd); } catch (Exception ex) { throw ex; } }
private void descargarXML(int id_GVComprobante) { GastoViajeComprobante gastoViajeComprobante = new GastoViajeComprobante(); Sesion Sesion = new Sesion(); Sesion = (Sesion)Session["Sesion" + Session.SessionID]; //gastoViajeComprobante.Id_Emp = Sesion.Id_Emp; //gastoViajeComprobante.Id_Cd = Sesion.Id_Cd_Ver; gastoViajeComprobante.Id_GV = Int32.Parse(Request.QueryString["Id"] == null ? "-1" : Request.QueryString["Id"]); gastoViajeComprobante.Id_Emp = Int32.Parse(Request.QueryString["Id_Emp"] == null ? Sesion.Id_Emp.ToString() : Request.QueryString["Id_Emp"]); gastoViajeComprobante.Id_Cd = Int32.Parse(Request.QueryString["Id_Cd"] == null ? Sesion.Id_Cd_Ver.ToString() : Request.QueryString["Id_Cd"]); gastoViajeComprobante.Id_GVComprobante = id_GVComprobante; CN_CapGastoViajeComprobante clsGastoViajeComprobante = new CN_CapGastoViajeComprobante(); clsGastoViajeComprobante.ConsultaGastoViajeComprobante(gastoViajeComprobante, Sesion.Emp_Cnx); //string ruta = null; //System.IO.StreamWriter sw = null; //ruta = Server.MapPath("Reportes") + "\\archivoXml" + Sesion.Id_U.ToString() + "GVComprobante" + id_GVComprobante.ToString() + ".txt"; //if (File.Exists(ruta)) // File.Delete(ruta); //if (File.Exists(Server.MapPath("Reportes") + "\\archivoXml" + Sesion.Id_U.ToString() + "GVComprobante" + id_GVComprobante.ToString() + ".xml")) // File.Delete(Server.MapPath("Reportes") + "\\archivoXml" + Sesion.Id_U.ToString() + "GVComprobante" + id_GVComprobante.ToString() + ".xml"); //sw = new System.IO.StreamWriter(ruta, false, Encoding.UTF8); //sw.WriteLine(gastoViajeComprobante.GVComprobante_Xml.ToString()); //sw.Close(); //File.Move(ruta, Server.MapPath("Reportes") + "\\archivoXml" + Sesion.Id_U.ToString() + "GVComprobante" + id_GVComprobante.ToString() + ".xml"); //RAM1.ResponseScripts.Add(string.Concat(@"abrirArchivo('Reportes\\archivoXml" + Sesion.Id_U.ToString() + "GVComprobante", id_GVComprobante.ToString(), ".xml')")); //string rutadestino = ConfigurationManager.AppSettings["URLtempPDF"].ToString(); //ruta = Server.MapPath(string.Concat(rutadestino, Sesion.Id_U.ToString() + "GV" + id_GVComprobante.ToString() + ".txt")); //if (File.Exists(ruta)) // File.Delete(ruta); //if (File.Exists(rutadestino + "\\archivoXml" + Sesion.Id_U.ToString() + "GV" + id_GVComprobante.ToString() + ".xml")) // File.Delete(rutadestino + "\\archivoXml" + Sesion.Id_U.ToString() + "GV" + id_GVComprobante.ToString() + ".xml"); //sw = new System.IO.StreamWriter(ruta, false, Encoding.UTF8); //sw.WriteLine(gastoViajeComprobante.GVComprobante_Xml.ToString()); //sw.Close(); //File.Move(ruta, rutadestino + "\\archivoXml" + Sesion.Id_U.ToString() + "GV" + id_GVComprobante.ToString() + ".xml"); //RAM1.ResponseScripts.Add(string.Concat(@"abrirArchivo('" + rutadestino + "\\archivoXml" + Sesion.Id_U.ToString() + "GV", id_GVComprobante.ToString(), ".xml')")); string ruta = null; ruta = Server.MapPath(string.Concat(ConfigurationManager.AppSettings["URLtempPDF"].ToString(), "\\archivoXml" + Sesion.Id_U.ToString() + "PagElec" + id_GVComprobante.ToString() + ".txt")); string strarchivo = Server.MapPath(string.Concat(ConfigurationManager.AppSettings["URLtempPDF"].ToString(), "\\archivoXml" + Sesion.Id_U.ToString() + "PagElec" + id_GVComprobante.ToString())); if (File.Exists(ruta)) { File.Delete(ruta); } if (File.Exists(strarchivo + ".xml")) { File.Delete(strarchivo + ".xml"); } using (FileStream fileStream = File.Create(ruta)) { MemoryStream MS = new MemoryStream(gastoViajeComprobante.GVComprobante_XmlStream); MS.CopyTo(fileStream); fileStream.Close(); } File.Move(ruta, strarchivo + ".xml"); //string jola = @"C:\Users\egdev001\Documents\Visual Studio 2010\Projects\SIANWeb - Gastos\SIANWEB\Reportes\archivoXml37PagElec15.xml"; //RAM1.ResponseScripts.Add(@"abrirArchivo('" + jola + "')"); RAM1.ResponseScripts.Add(string.Concat(@"abrirArchivo('xmlSAT\\archivoXml" + Sesion.Id_U.ToString() + "PagElec", id_GVComprobante.ToString(), ".xml')")); }