public List <fx_Comprobante_generados_Info> Listacomprobantes_generados_AX(string conexion) { try { List <fx_Comprobante_generados_Info> lista = new List <fx_Comprobante_generados_Info>(); fx_Comprobante_generados_Info comprobamte = null; string sql = "select * from TB_EFIRM_LOAD_CARGA"; SqlConnection cn = new SqlConnection(conexion); cn.Open(); SqlCommand cmd = new SqlCommand(sql, cn); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { comprobamte = new fx_Comprobante_generados_Info(); comprobamte.IdRegistro = reader.GetString(0); comprobamte.FECHA_CARGA = reader.GetDateTime(1); comprobamte.Estado = reader.GetString(2); comprobamte.Checked = true; lista.Add(comprobamte); } reader.Close(); cn.Close(); return(lista); } catch (Exception ex) { return(new List <fx_Comprobante_generados_Info>()); } }
public void GuardarComprobantes_generados_FX(fx_Comprobante_generados_Info compro) { try { data.GuardarComprobantes_generados_FX(compro); } catch (Exception ex) { } }
public void GuardarComprobantes_generados_AX(fx_Comprobante_generados_Info compro, string conexion) { try { data.GuardarComprobantes_generados_AX(compro, conexion); } catch (Exception ex) { } }
public bool Eliminar_Comprobantes_Generados_FX(fx_Comprobante_generados_Info info) { try { using (Entity_conexion_efixed Context = new Entity_conexion_efixed()) { fa_elec_registros_generados Entity = Context.fa_elec_registros_generados.FirstOrDefault(q => q.ID_REGISTRO == info.IdRegistro); Context.fa_elec_registros_generados.Remove(Entity); Context.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public void GuardarComprobantes_generados_FX(fx_Comprobante_generados_Info info) { try { using (Entity_conexion_efixed Context = new Entity_conexion_efixed()) { fa_elec_registros_generados entity = new fa_elec_registros_generados(); entity.ID_REGISTRO = info.IdRegistro; entity.FECHA_CARGA = info.FECHA_CARGA = DateTime.Now; entity.ESTADO = "A"; Context.fa_elec_registros_generados.Add(entity); Context.SaveChanges(); } } catch (Exception ex) { } }
public bool Eliminar_Comprobantes_Generados_FX(fx_Comprobante_generados_Info info, string conexion, string Cliente) { try { bool bandera = false; if (Cliente == eCliente.EXPOGYE.ToString()) { bandera = data.Eliminar_Comprobantes_Generados_AX(info, conexion); } if (Cliente == eCliente.FIXED.ToString()) { bandera = data.Eliminar_Comprobantes_Generados_FX(info); } return(bandera); } catch (Exception) { return(false); } }
public void GuardarComprobantes_generados_AX(fx_Comprobante_generados_Info compro, string conexion) { DateTime fecha; string ff; fecha = Convert.ToDateTime(compro.FECHA_CARGA); ff = fecha.ToString("yyyy-MM-dd"); try { string sql = "insert Into TB_EFIRM_LOAD_CARGA(ID_REGISTRO,FECHA_CARGA,ESTADO)values('" + compro.IdRegistro + "','" + ff + "','" + compro.Estado + "')"; SqlConnection cone = new SqlConnection(conexion); cone.Open(); SqlCommand cmd = new SqlCommand(sql, cone); SqlDataReader reader = cmd.ExecuteReader(); reader.Close(); cone.Close(); } catch (Exception ex) { } }
public bool Eliminar_Comprobantes_Generados_AX(fx_Comprobante_generados_Info info, string Conexion) { try { using (SqlConnection ConexionEfirm = new SqlConnection(Conexion)) { ConexionEfirm.Open(); string SQL = " delete TB_EFIRM_LOAD_CARGA where ID_REGISTRO ='" + info.IdRegistro + "'"; SqlCommand cmd = new SqlCommand(SQL, ConexionEfirm); SqlDataReader reader = cmd.ExecuteReader(); reader.Close(); return(true); } } catch (Exception) { return(false); } }
public void GenerarArchivosXml() { //splashScreenManager1.ShowWaitForm(); try { foreach (var item in listado_cbtes_info) { string sIdCbteFact = ""; //item.CbteFactura.infoTributaria = new infoTributaria(); // si es factura if (item.TipoCbte == eTipoComprobante.Factura) { try { sIdCbteFact = item.CbteFactura.infoTributaria.razonSocial.Substring(0, 3) + "-" + eTipoCodComprobante.FAC + "-" + item.CbteFactura.infoTributaria.estab + "-" + item.CbteFactura.infoTributaria.ptoEmi + "-" + item.CbteFactura.infoTributaria.secuencial; XmlSerializerNamespaces NamespaceObject = new XmlSerializerNamespaces(); NamespaceObject.Add("", ""); XmlSerializer mySerializer = new XmlSerializer(typeof(factura)); myWriter = new StreamWriter(Efirm.Properties.Settings.Default.PatchXml + sIdCbteFact + ".xml"); mySerializer.Serialize(myWriter, item.CbteFactura, NamespaceObject); myWriter.Close(); // GRABAR COMP ObuscComp = new fx_Comprobantes_generados_Bus(); fx_Comprobante_generados_Info comprobante = new fx_Comprobante_generados_Info(); comprobante.IdRegistro = sIdCbteFact; comprobante.Estado = "A"; ObuscComp.GuardarComprobantes_generados_FX(comprobante); } catch (Exception ex) { } } // si es retencion else if (item.TipoCbte == eTipoComprobante.Retencion) { try { sIdCbteFact = item.cbteRet.infoTributaria.razonSocial.Substring(0, 3) + "-" + eTipoCodComprobante.RET + "-" + item.cbteRet.infoTributaria.estab + "-" + item.cbteRet.infoTributaria.ptoEmi + "-" + item.cbteRet.infoTributaria.secuencial; XmlSerializerNamespaces NamespaceObject = new XmlSerializerNamespaces(); NamespaceObject.Add("", ""); XmlSerializer mySerializer = new XmlSerializer(typeof(comprobanteRetencion)); myWriter = new StreamWriter(Efirm.Properties.Settings.Default.PatchXml + sIdCbteFact + ".xml"); mySerializer.Serialize(myWriter, item.cbteRet, NamespaceObject); myWriter.Close(); // GRABAR COMP ObuscComp = new fx_Comprobantes_generados_Bus(); fx_Comprobante_generados_Info comprobante = new fx_Comprobante_generados_Info(); comprobante.IdRegistro = sIdCbteFact; comprobante.Estado = "A"; ObuscComp.GuardarComprobantes_generados_FX(comprobante); } catch (Exception ex) { } } // si es nota de credito else if (item.TipoCbte == eTipoComprobante.NotaCred) { try { sIdCbteFact = item.cbteNC.infoTributaria.razonSocial.Substring(0, 3) + "-" + eTipoCodComprobante.NTC + "-" + item.cbteNC.infoTributaria.estab + "-" + item.cbteNC.infoTributaria.ptoEmi + "-" + item.cbteNC.infoTributaria.secuencial; XmlSerializerNamespaces NamespaceObject = new XmlSerializerNamespaces(); NamespaceObject.Add("", ""); XmlSerializer mySerializer = new XmlSerializer(typeof(notaCredito)); myWriter = new StreamWriter(Efirm.Properties.Settings.Default.PatchXml + sIdCbteFact + ".xml"); mySerializer.Serialize(myWriter, item.cbteNC, NamespaceObject); myWriter.Close(); // GRABAR COMP ObuscComp = new fx_Comprobantes_generados_Bus(); fx_Comprobante_generados_Info comprobante = new fx_Comprobante_generados_Info(); comprobante.IdRegistro = sIdCbteFact; comprobante.Estado = "A"; ObuscComp.GuardarComprobantes_generados_FX(comprobante); } catch (Exception ex) { } } // si es guia de remision else if (item.TipoCbte == eTipoComprobante.Guia) { try { sIdCbteFact = sIdCbteFact = item.cbtGR.infoTributaria.razonSocial.Substring(0, 3) + "-" + eTipoCodComprobante.GUI + "-" + item.cbtGR.infoTributaria.estab + "-" + item.cbtGR.infoTributaria.ptoEmi + "-" + item.cbtGR.infoTributaria.secuencial; XmlSerializerNamespaces NamespaceObject = new XmlSerializerNamespaces(); NamespaceObject.Add("", ""); XmlSerializer mySerializer = new XmlSerializer(typeof(guiaRemision)); myWriter = new StreamWriter(Efirm.Properties.Settings.Default.PatchXml + sIdCbteFact + ".xml"); mySerializer.Serialize(myWriter, item.cbtGR, NamespaceObject); myWriter.Close(); // GRABAR COMP ObuscComp = new fx_Comprobantes_generados_Bus(); fx_Comprobante_generados_Info comprobante = new fx_Comprobante_generados_Info(); comprobante.IdRegistro = sIdCbteFact; comprobante.Estado = "A"; ObuscComp.GuardarComprobantes_generados_FX(comprobante); } catch (Exception ex) { } } // si es nota debito else if (item.TipoCbte == eTipoComprobante.NotaDeb) { try { sIdCbteFact = sIdCbteFact = item.cbteDeb.infoTributaria.razonSocial.Substring(0, 3) + "-" + eTipoCodComprobante.NTD + "-" + item.cbteDeb.infoTributaria.estab + "-" + item.cbteDeb.infoTributaria.ptoEmi + "-" + item.cbteDeb.infoTributaria.secuencial; XmlSerializerNamespaces NamespaceObject = new XmlSerializerNamespaces(); NamespaceObject.Add("", ""); XmlSerializer mySerializer = new XmlSerializer(typeof(notaDebito)); myWriter = new StreamWriter(Efirm.Properties.Settings.Default.PatchXml + sIdCbteFact + ".xml"); mySerializer.Serialize(myWriter, item.cbteDeb, NamespaceObject); myWriter.Close(); // GRABAR COMP ObuscComp = new fx_Comprobantes_generados_Bus(); fx_Comprobante_generados_Info comprobante = new fx_Comprobante_generados_Info(); comprobante.IdRegistro = sIdCbteFact; comprobante.Estado = "A"; ObuscComp.GuardarComprobantes_generados_FX(comprobante); } catch (Exception ex) { } } } } catch (Exception ex) { } finally { } }
public void GenerarArchivosXml() { gridControlCbtes.RefreshDataSource(); //splashScreenManager1.ShowWaitForm(); try { foreach (var item in listado_cbtes_info) { string sIdCbteFact = ""; //item.CbteFactura.infoTributaria = new infoTributaria(); if (item.Checked == true) { // si es factura if (item.TipoCbte == eTipoComprobante.Factura) { try { sIdCbteFact = item.CbteFactura.infoTributaria.razonSocial.Substring(0, 3) + "-" + eTipoCodComprobante.FAC + "-" + item.CbteFactura.infoTributaria.estab + "-" + item.CbteFactura.infoTributaria.ptoEmi + "-" + item.CbteFactura.infoTributaria.secuencial; XmlSerializerNamespaces NamespaceObject = new XmlSerializerNamespaces(); NamespaceObject.Add("", ""); XmlSerializer mySerializer = new XmlSerializer(typeof(factura)); myWriter = new StreamWriter(txtRuta.Text + sIdCbteFact + ".xml"); mySerializer.Serialize(myWriter, item.CbteFactura, NamespaceObject); myWriter.Close(); // GRABAR COMP ObuscComp = new fx_Comprobantes_generados_Bus(); fx_Comprobante_generados_Info comprobante = new fx_Comprobante_generados_Info(); comprobante.IdRegistro = sIdCbteFact; comprobante.FECHA_CARGA = DateTime.Now; comprobante.Estado = "A"; ObuscComp.GuardarComprobantes_generados_AX(comprobante, ConexionDbcliente); } catch (Exception ex) { MessageBox.Show(ex.Message); } } // si es retencion else if (item.TipoCbte == eTipoComprobante.Retencion) { try { sIdCbteFact = item.cbteRet.infoTributaria.razonSocial.Substring(0, 3) + "-" + eTipoCodComprobante.RET + "-" + item.cbteRet.infoTributaria.estab + "-" + item.cbteRet.infoTributaria.ptoEmi + "-" + item.cbteRet.infoTributaria.secuencial; XmlSerializerNamespaces NamespaceObject = new XmlSerializerNamespaces(); NamespaceObject.Add("", ""); XmlSerializer mySerializer = new XmlSerializer(typeof(comprobanteRetencion)); myWriter = new StreamWriter(txtRuta.Text + sIdCbteFact + ".xml"); //StreamWriter myWriter = new StreamWriter(txtRuta.Text + sIdCbteFact + ".xml"); mySerializer.Serialize(myWriter, item.cbteRet, NamespaceObject); myWriter.Close(); // GRABAR COMP ObuscComp = new fx_Comprobantes_generados_Bus(); fx_Comprobante_generados_Info comprobante = new fx_Comprobante_generados_Info(); comprobante.IdRegistro = sIdCbteFact; comprobante.FECHA_CARGA = DateTime.Now; comprobante.Estado = "A"; ObuscComp.GuardarComprobantes_generados_AX(comprobante, ConexionDbcliente); } catch (Exception ex) { MessageBox.Show(ex.Message); } } // si es nota de credito else if (item.TipoCbte == eTipoComprobante.NotaCred) { try { sIdCbteFact = item.cbteNC.infoTributaria.razonSocial.Substring(0, 3) + "-" + eTipoCodComprobante.NTC + "-" + item.cbteNC.infoTributaria.estab + "-" + item.cbteNC.infoTributaria.ptoEmi + "-" + item.cbteNC.infoTributaria.secuencial; XmlSerializerNamespaces NamespaceObject = new XmlSerializerNamespaces(); NamespaceObject.Add("", ""); XmlSerializer mySerializer = new XmlSerializer(typeof(notaCredito)); myWriter = new StreamWriter(txtRuta.Text + sIdCbteFact + ".xml"); mySerializer.Serialize(myWriter, item.cbteNC, NamespaceObject); myWriter.Close(); // GRABAR COMP ObuscComp = new fx_Comprobantes_generados_Bus(); fx_Comprobante_generados_Info comprobante = new fx_Comprobante_generados_Info(); comprobante.IdRegistro = sIdCbteFact; comprobante.FECHA_CARGA = DateTime.Now; comprobante.Estado = "A"; ObuscComp.GuardarComprobantes_generados_AX(comprobante, ConexionDbcliente); } catch (Exception ex) { MessageBox.Show(ex.Message); } } // si es guia de remision else if (item.TipoCbte == eTipoComprobante.Guia) { try { sIdCbteFact = sIdCbteFact = item.cbtGR.infoTributaria.razonSocial.Substring(0, 3) + "-" + eTipoCodComprobante.GUI + "-" + item.cbtGR.infoTributaria.estab + "-" + item.cbtGR.infoTributaria.ptoEmi + "-" + item.cbtGR.infoTributaria.secuencial; XmlSerializerNamespaces NamespaceObject = new XmlSerializerNamespaces(); NamespaceObject.Add("", ""); XmlSerializer mySerializer = new XmlSerializer(typeof(guiaRemision)); myWriter = new StreamWriter(txtRuta.Text + sIdCbteFact + ".xml"); //StreamWriter myWriter = new StreamWriter(txtRuta.Text + sIdCbteFact + ".xml"); mySerializer.Serialize(myWriter, item.cbtGR, NamespaceObject); myWriter.Close(); // GRABAR COMP ObuscComp = new fx_Comprobantes_generados_Bus(); fx_Comprobante_generados_Info comprobante = new fx_Comprobante_generados_Info(); comprobante.IdRegistro = sIdCbteFact; comprobante.FECHA_CARGA = DateTime.Now; comprobante.Estado = "A"; ObuscComp.GuardarComprobantes_generados_AX(comprobante, ConexionDbcliente); } catch (Exception ex) { MessageBox.Show(ex.Message); } } // si es nota debito else if (item.TipoCbte == eTipoComprobante.NotaDeb) { try { sIdCbteFact = sIdCbteFact = item.cbteDeb.infoTributaria.razonSocial.Substring(0, 3) + "-" + eTipoCodComprobante.NTD + "-" + item.cbteDeb.infoTributaria.estab + "-" + item.cbteDeb.infoTributaria.ptoEmi + "-" + item.cbteDeb.infoTributaria.secuencial; XmlSerializerNamespaces NamespaceObject = new XmlSerializerNamespaces(); NamespaceObject.Add("", ""); XmlSerializer mySerializer = new XmlSerializer(typeof(notaDebito)); myWriter = new StreamWriter(txtRuta.Text + sIdCbteFact + ".xml"); //StreamWriter myWriter = new StreamWriter(txtRuta.Text + sIdCbteFact + ".xml"); mySerializer.Serialize(myWriter, item.cbteDeb, NamespaceObject); myWriter.Close(); // GRABAR COMP ObuscComp = new fx_Comprobantes_generados_Bus(); fx_Comprobante_generados_Info comprobante = new fx_Comprobante_generados_Info(); comprobante.IdRegistro = sIdCbteFact; comprobante.FECHA_CARGA = DateTime.Now; comprobante.Estado = "A"; ObuscComp.GuardarComprobantes_generados_AX(comprobante, ConexionDbcliente); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } } refresh_archivos(); } catch (Exception ex) { } finally { } }