public static void Ejecutar(eFact_Entidades.Lote Lote, CedEntidades.Evento Evento, string Handler, eFact_Entidades.Aplicacion Aplicacion, CedEntidades.Sesion Sesion) { string handlerEvento = ""; //VerificarAssemblyVersion(); eFact_DB.Lote lote = new eFact_DB.Lote(Sesion); string nombreArchivoProcesado = ""; switch (Lote.WF.IdFlow) { case "eFact": switch (Evento.Id) { case "EnvBandSalida": if (Lote.NumeroEnvio > 1) { eFact_Entidades.Lote l = new eFact_Entidades.Lote(); l.CuitVendedor = Lote.CuitVendedor; l.PuntoVenta = Lote.PuntoVenta; l.NumeroLote = Lote.NumeroLote; l.NumeroEnvio = Lote.NumeroEnvio - 1; eFact_RN.Lote.Leer(l, Sesion); //Busca el evento automático, para anular el envio anterior. CedEntidades.Evento evento = l.WF.EventosPosibles.Find((delegate(CedEntidades.Evento e1) { return e1.Automatico == true && (e1.Id == "AnularRechIF" || e1.Id == "AnularCancel"); })); handlerEvento = Cedeira.SV.WF.EjecutarEvento(l.WF, evento, true); handlerEvento += " end "; } handlerEvento += Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, true); lote.Insertar(Lote, handlerEvento, Handler); break; case "EnvBandSalidaV": handlerEvento += Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, true); lote.Insertar(Lote, handlerEvento, Handler); break; case "EnviarAIF": handlerEvento += Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, true); lote.ActualizarFechaEnvio(Lote, handlerEvento); break; case "RegAceptAFIP": case "RegActAFIP": handlerEvento = Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, true); lote.ActualizarDatosCAE(Lote, handlerEvento); if (Aplicacion.TipoItfAut == "XML") { GuardarItfXML(out nombreArchivoProcesado, Lote, "ROK", Aplicacion.ArchPathItfAut, true, false); } else if (Aplicacion.TipoItfAut == "TXT") { GuardarItfTXT(out nombreArchivoProcesado, Lote, "ROK", Aplicacion.ArchPathItfAut, true); } break; case "RegAceptAFIPO": case "RegActAFIPO": handlerEvento = Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, true); lote.ActualizarDatosCAE(Lote, handlerEvento); if (Aplicacion.TipoItfAut == "XML") { GuardarItfXML(out nombreArchivoProcesado, Lote, "ROO", Aplicacion.ArchPathItfAut, true, false); } else if (Aplicacion.TipoItfAut == "TXT") { GuardarItfTXT(out nombreArchivoProcesado, Lote, "ROO", Aplicacion.ArchPathItfAut, true); } break; case "RegAceptAFIPP": case "RegActAFIPP": handlerEvento = Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, true); lote.ActualizarDatosCAE(Lote, handlerEvento); if (Aplicacion.TipoItfAut == "XML") { GuardarItfXML(out nombreArchivoProcesado, Lote, "ROP", Aplicacion.ArchPathItfAut, true, false); } else if (Aplicacion.TipoItfAut == "TXT") { GuardarItfTXT(out nombreArchivoProcesado, Lote, "ROP", Aplicacion.ArchPathItfAut, true); } break; case "RegContAFIP": case "RegContAFIPO": case "RegContAFIPP": handlerEvento = Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, true); DataTable dt = lote.Insertar(Lote, handlerEvento, ""); Lote.IdLote = Convert.ToInt32(dt.Rows[0][0].ToString()); Leer(Lote, Sesion); CedEntidades.Evento eventoAct = new CedEntidades.Evento(); eventoAct = Lote.WF.EventosPosibles[0]; handlerEvento = Cedeira.SV.WF.EjecutarEvento(Lote.WF, eventoAct, true); lote.ActualizarDatosCAE(Lote, handlerEvento); if (Aplicacion.TipoItfAut == "XML") { GuardarItfXML(out nombreArchivoProcesado, Lote, "ROK", Aplicacion.ArchPathItfAut, true, false); } else if (Aplicacion.TipoItfAut == "TXT") { GuardarItfTXT(out nombreArchivoProcesado, Lote, "ROK", Aplicacion.ArchPathItfAut, true); } break; case "RegRechAFIP": handlerEvento = Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, true); lote.ActualizarDatosError(Lote, handlerEvento); if (Aplicacion.TipoItfAut == "XML") { GuardarItfXML(out nombreArchivoProcesado, Lote, "RAF", Aplicacion.ArchPathItfAut, true, false); } else if (Aplicacion.TipoItfAut == "TXT") { GuardarItfTXTlr(out nombreArchivoProcesado, Lote, "RAF", Aplicacion.ArchPathItfAut, true); } break; case "RegRechIF": handlerEvento = Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, true); lote.ActualizarDatosError(Lote, handlerEvento); if (Aplicacion.TipoItfAut == "XML") { GuardarItfXML(out nombreArchivoProcesado, Lote, "RIF", Aplicacion.ArchPathItfAut, true, false); } else if (Aplicacion.TipoItfAut == "TXT") { GuardarItfTXTlr(out nombreArchivoProcesado, Lote, "RIF", Aplicacion.ArchPathItfAut, true); } break; default: Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, false); break; } break; } }