public EventoController(IEventoRepository repo, IMapper mapper, EventoService service, AgendaService serviceAgenda) { _serviceAgenda = serviceAgenda; _service = service; _mapper = mapper; _repo = repo; }
private void btnBorrarSeleccionados_Click(object sender, EventArgs e) { try { if (eventos.Count() > 0) { try { tipoAccion = TipoAccionProcesamiento.BORRAR_SELECCIONADOS; modificarLayout(tipoAccion); botonSeleccionado(btnBorrarSeleccionados); int cant = eventosSeleccionados.Count; EventoService.borrar(eventosSeleccionados); cargarEventos(); mostrarMensaje("Registros eliminados correctamente", Color.FromArgb(128, 255, 128)); actualizarEstadisticas(); } catch (Exception) { mostrarMensaje("Error al eliminar registros", Color.FromArgb(255, 89, 89)); } } else { mostrarMensaje("No hay ningún evento", Color.FromArgb(255, 255, 0)); } } catch { mostrarMensaje("Error al eliminar los registros", Color.FromArgb(255, 89, 89)); } }
public EventoServiceTests() { var repo = new RepositorioEvento(base.GetMockUser(), new RepositorioComum <Evento>(base.GetMockUser())); _service = new EventoService(repo); }
public bool importarArchivoEnNuevoProyecto(string pathArchivo, string nombreProyecto) { try { List <string> eventos = new List <string>(); if (delimitador == "enter") { eventos = leerDelimitadorEnter(pathArchivo); } else { eventos = leerDelimitadorCaracter(pathArchivo, this.delimitador); } Origen origen = ProyectoService.nuevoProyecto(nombreProyecto); EventoService.agregarTodos(eventos, origen.Id); return(true); } catch (Exception ex) { Debug.Print(ex.Message); return(false); } }
public void Configurar() { EventoContext ctx = new EventoContext(); EventoService eventoService = new EventoService(ctx); convertidor = new Convertidor(eventoService); }
public bool importarArchivoEnProyectoExistente(string pathArchivo, int idProyecto) { bool resultado = false; try { List <string> eventos = new List <string>(); if (delimitador == "enter") { eventos = leerDelimitadorEnter(pathArchivo); } else { eventos = leerDelimitadorCaracter(pathArchivo, this.delimitador); } Origen auxOrigen = ProyectoService.obtenerProyectoPorId(idProyecto); if (auxOrigen != null) { EventoService.agregarTodos(eventos, auxOrigen.Id); resultado = true; } else { resultado = false; } } catch (Exception ex) { Debug.Print(ex.Message); resultado = false; } return(resultado); }
public bool importarArchivoEnNuevoProyecto(string pathArchivo, string nombreProyecto) { bool resultado = false; try { Origen nuevoOrigen = ProyectoService.nuevoProyecto(nombreProyecto); List <Evento> eventos = new List <Evento>(); using (var archivo = new XLWorkbook(pathArchivo)) { var hoja = archivo.Worksheet(this.hoja); int numeroFila = this.filaInicial; int columna = this.columna; while (!hoja.Cell(numeroFila, columna).IsEmpty()) { DateTime auxFecha = hoja.Cell(numeroFila, columna).GetDateTime(); eventos.Add(new Evento() { fecha = auxFecha, origen = nuevoOrigen, activo = true }); numeroFila++; } } EventoService.agregarTodos(eventos); resultado = true; } catch (Exception ex) { Debug.Write(ex.Message); resultado = false; } return(resultado); }
public HomeController(ILogger <HomeController> logger, UsuarioService usuarioService, ClienteService clienteService, EventoService eventoService, ConvidadoService convidadoService) { _logger = logger; _usuarioService = usuarioService; _clienteService = clienteService; _eventoService = eventoService; _convidadoService = convidadoService; }
public Evento BuscarPorNome(string _nome) { Evento evento = new Evento(); es = new EventoService(); evento = es.GetEventoByName(_nome); return(evento); }
public Evento BuscarPorId(string _id) { Evento evento = new Evento(); es = new EventoService(); evento = es.GetEventoById(_id); return(evento); }
public ConvidadoController(LocalService localService, ClientService clientService, SituacaoEventoService situacaoService, TipoEventoService tipoEventoService, EventoService eventoService, ConvidadoService convidadoService) { _localService = localService; _clientService = clientService; _situacaoService = situacaoService; _tipoEventoService = tipoEventoService; _eventoService = eventoService; _convidadoService = convidadoService; }
public async Task <object> AdicionarLotes(object input) { var service = new EventoService(); var data = DateTime.Now; var arquivos = input.ToStringArray(); foreach (var caminhoArquivo in arquivos) { var arquivoEncriptado = File.ReadAllBytes(caminhoArquivo); var arquivosEncriptadosBytes = new List <byte[]>(); if (arquivoEncriptado.IsZipFile()) { arquivosEncriptadosBytes.AddRange(arquivoEncriptado.UnzipAll()); } else { arquivosEncriptadosBytes.Add(arquivoEncriptado); } foreach (var arquivoEncriptadoBytes in arquivosEncriptadosBytes) { if (!CryptographyHelper.IsHeaderValid(arquivoEncriptadoBytes, Resources.HeaderEFinanceira)) { throw new ArquivoInvalidoException(); } var arquivoDecriptado = CryptographyHelper.Decrypt(arquivoEncriptadoBytes, Resources.CryptoPrivateKey); var dadosArquivo = JsonConvert.DeserializeObject <ArquivoComunicacaoEFinanceiraDto>(arquivoDecriptado.GetString()); var empresa = new Empresa { Entidade = dadosArquivo.Entidade, CNPJ = dadosArquivo.EntidadeCnpj, Nome = dadosArquivo.EntidadeNome }; var lote = new EFinanceiraLote { DataAtualizacao = data, DataUpload = data, IdLote = dadosArquivo.LoteId, StatusEvento = (int)StatusEventoEnum.Novo, TipoEvento = dadosArquivo.TipoEventoId, XmlLote = dadosArquivo.LoteXmlBase64.FromBase64String() }; service.AdicionarLote(empresa, lote); } } return(new { }); }
public InternoController(ILogger <InternoController> logger, ClienteService clienteService, TipoClienteService tipoClienteService, LocalService localService, EventoService eventoService, SituacaoEventoService situacaoEventoService, TipoEventoService tipoEventoService, ConvidadoService convidadoService, SituacaoConvidadoService situacaoConvidadoService) { _logger = logger; _clienteService = clienteService; _tipoClienteService = tipoClienteService; _localService = localService; _eventoService = eventoService; _situacaoEventoService = situacaoEventoService; _tipoEventoService = tipoEventoService; _convidadoService = convidadoService; _situacaoConvidadoService = situacaoConvidadoService; }
public void InsertarEventoMetodo_Deberia_InsertarNuevoElemento() { EventoService _EventoService = new EventoService(ctx); Evento _evento = new Evento { Nombre = "Halloween", Fecha = DateTime.Parse("31/10/2020") }; _EventoService.InsertarEvento(_evento); List <Evento> _lstEvento = _EventoService.ObtenerEventosPorNombre("Halloween"); Assert.IsTrue(_lstEvento.Any()); }
public void Adicionar(EventoInsert _evento) { _evento.DataInicio = ConverterData(_evento.DataInicio); _evento.DataFinal = ConverterData(_evento.DataFinal); _evento.DataInicioVenda = ConverterData(_evento.DataInicioVenda); _evento.DataFinalVenda = ConverterData(_evento.DataFinalVenda); _evento.HoraInicioEvento = ConverterHora(_evento.HoraInicioEvento); _evento.HoraTerminoEvento = ConverterHora(_evento.HoraTerminoEvento); es = new EventoService(); es.InserirEvento(_evento); }
public async Task GetAllByLimit_NotNull() { int limit = 10; _eventoRepositoryMock.Setup(x => x.GetAllByLimit(limit)) .ReturnsAsync(new EventoMock().GetEventos()); var eventoService = new EventoService(_eventoRepositoryMock.Object); var eventoMethod = await eventoService.GetAllByLimit(limit); var eventoResult = Assert.IsAssignableFrom <IEnumerable <Evento> >(eventoMethod); Assert.NotNull(eventoResult); }
public ConvidadoService( DataBaseContext databaseContext, SituacaoEventoService SituacaoEventoService, EventoService EventoService, SituacaoConvidadoService situacaoConvidadoService ) { _databaseContext = databaseContext; _situacaoConvidadoService = situacaoConvidadoService; _EventoService = EventoService; }
// GET: Evento public ActionResult Index() { if (Global.Global.Cliente == null || Global.Global.Cliente.Usuario != "adm") { return(Redirect("/Home/Index")); } es = new EventoService(); List <Local> locais = es.GetLocais(); List <FaixaEtaria> faixasEtarias = es.GetFaixaEtarias(); ViewBag.Locais = locais; ViewBag.FaixasEtarias = faixasEtarias; if (Global.Global.EventoPesquisado == null) { ViewBag.EventoPesquisado = e; ViewBag.Local = local; ViewBag.FaixaEtaria = faixaEtaria; ViewBag.DataInicio = ""; ViewBag.HoraInicioEvento = ""; ViewBag.DataFinal = ""; ViewBag.HoraTerminoEvento = ""; ViewBag.DataInicioVenda = ""; ViewBag.DataFinalVenda = ""; return(View()); } ViewBag.EventoPesquisado = Global.Global.EventoPesquisado; ViewBag.DataInicio = Global.Global.EventoPesquisado.DataInicio.ToString("dd/MM/yyyy"); ViewBag.HoraInicioEvento = Global.Global.EventoPesquisado.HoraInicioEvento.ToString("hh:mm"); ViewBag.DataFinal = Global.Global.EventoPesquisado.DataFinal.ToString("dd/MM/yyyy"); ViewBag.HoraTerminoEvento = Global.Global.EventoPesquisado.HoraTerminoEvento.ToString("hh:mm"); ViewBag.DataInicioVenda = Global.Global.EventoPesquisado.DataInicioVenda.ToString("dd/MM/yyyy"); ViewBag.DataFinalVenda = Global.Global.EventoPesquisado.DataFinalVenda.ToString("dd/MM/yyyy"); local = es.GetLocalById(Global.Global.EventoPesquisado.IdLocal); faixaEtaria = es.GetFaixaEtariaById(Global.Global.EventoPesquisado.IdFaixaEtaria); ViewBag.Local = local; ViewBag.FaixaEtaria = faixaEtaria; return(View()); }
public void Alterar(EventoInsert _evento) { Evento evento = new Evento(); _evento.DataInicio = ConverterData(_evento.DataInicio); _evento.DataFinal = ConverterData(_evento.DataFinal); _evento.DataInicioVenda = ConverterData(_evento.DataInicioVenda); _evento.DataFinalVenda = ConverterData(_evento.DataFinalVenda); _evento.HoraInicioEvento = ConverterHora(_evento.HoraInicioEvento); _evento.HoraTerminoEvento = ConverterHora(_evento.HoraTerminoEvento); es = new EventoService(); es.UpdateEvento(_evento); }
public ActionResult AdicionarEvento() { if (Global.Global.Cliente == null || Global.Global.Cliente.Usuario != "adm") { return(Redirect("/Home/Index")); } es = new EventoService(); List <Local> locais = es.GetLocais(); List <FaixaEtaria> faixasEtarias = es.GetFaixaEtarias(); ViewBag.Locais = locais; ViewBag.FaixasEtarias = faixasEtarias; return(View()); }
static void Main(string[] args) { EventoContext ctx = new EventoContext(); EventoService es = new EventoService(ctx); IConvertidor _Convertidor = new Convertidor(es); ILector _Lector = new Lector(_Convertidor, "../../../Resources/archivo.txt"); IEscritor _Escritor = new Escritor(); IOcurrencia _Ocurrencia = new Ocurrencia(); IManejoTiemposFactory _ManejoTiemposFactory = new ManejoTiemposFactory(_Escritor, _Ocurrencia); IProcesador _Procesador = new Procesador(_ManejoTiemposFactory, _Lector); _Procesador.ProcesarEventos(); Console.ReadLine(); }
private void btnAceptarImportacionDB_Click(object sender, EventArgs e) { try { string server = txtNombreServidor.Text; string database = txtNombreDB.Text; string nombreTabla = txtNombreTabla.Text; string nombreColumna = txtNombreColumna.Text; string user = txtUsuario.Text; string password = txtContrasenia.Text; string connString = $"Data Source = {server}; Initial Catalog = {database};"; if (chUsuarioYContrasenia.Checked) { connString = connString + $" User Id = {user}; Password = {password};"; } IImportarDesdeDB importador = new ImportarDesdeDBImpl(); List <DateTime> dates = importador.ObtenerColumnaDesdeDB(connString, database, nombreTabla, nombreColumna); if (dates != null) { EventoService.agregarTodos(dates.Select(x => { Evento aux = new Evento(); aux.activo = true; aux.fecha = x; var seleccionado = lbProyectosRecientes.SelectedItem; var proyecto = new { nombreOrigen = "", Id = 0 }; proyecto = Cast(proyecto, seleccionado); aux.idOrigen = proyecto.Id; return(aux); }).ToList()); mostrarMensaje("Se importaron los datos correctamente", Color.FromArgb(128, 255, 128)); pnlImportacionDB.Visible = false; LimpiarTxtImportacionDB(); } } catch { mostrarMensaje("No se ha podido extraer la informacion solicitada. Por favor revise los datos", Color.FromArgb(255, 89, 89)); } }
public bool importarArchivoEnProyectoExistente(string pathArchivo, int idProyecto) { bool resultado = false; try { Origen auxOrigen = ProyectoService.obtenerProyectoPorId(idProyecto); if (auxOrigen != null) { List <Evento> eventos = new List <Evento>(); using (var archivo = new XLWorkbook(pathArchivo)) { var hoja = archivo.Worksheet(this.hoja); int numeroFila = this.filaInicial; int columna = this.columna; while (!hoja.Cell(numeroFila, columna).IsEmpty()) { DateTime auxFecha = hoja.Cell(numeroFila, columna).GetDateTime(); eventos.Add(new Evento() { fecha = auxFecha, idOrigen = auxOrigen.Id, activo = true }); numeroFila++; } } EventoService.agregarTodos(eventos); resultado = true; } else { resultado = false; } } catch (Exception ex) { Debug.Write(ex.Message); resultado = false; } return(resultado); }
private void cargarEventos() { try { eventos = EventoService.cargarEventos(this.proyecto.Id); dgwEventos.DataSource = eventos; dgwEventos.Columns[1].Width = 235; dgwEventos.Columns[1].DefaultCellStyle.Format = "dd'/'MM'/'yyyy HH:mm:ss"; dgwEventos.Columns[0].Visible = false; dgwEventos.Columns[2].Visible = false; dgwEventos.Columns[3].Visible = false; dgwEventos.Columns[4].Visible = false; if (eventos != null && tipoAccion == TipoAccionProcesamiento.FILTRAR) { filtrar(); } } catch { mostrarMensaje("Error al cargar los eventos", Color.FromArgb(255, 89, 89)); } }
public async Task <object> AdicionarPacoteEventosAsync(object input) { try { var service = new EventoService(); var quantidadeEventosNovos = 0; var arquivos = input.ToStringArray(); foreach (var caminhoArquivo in arquivos) { var arquivo = JsonConvert.DeserializeObject <ArquivoEntradaDTO>(File.ReadAllText(caminhoArquivo)); if (arquivo != null) { quantidadeEventosNovos += service.AdicionarPacoteEventos(arquivo); } } return(new { status = "OK", quantidadeEventosNovos }); } catch (Exception ex) { File.WriteAllText(@"C:\\users\lndr2\desktop\log.txt", ex.Message + Environment.NewLine + ex.StackTrace); throw; } }
public async Task NotaCanceladaXmlExisteTest() { NotaFiscal notaFiscal; ConfiguracaoEntity config; int notaFiscalId = EnviarNotaTesteUnitarioUtils.EnviarNotaFiscal(out notaFiscal, out config); var notaFiscalDb = new NotaFiscalService().GetNotaFiscalByIdAsync(notaFiscalId, false).Result; var emitente = notaFiscal.Emitente; var codigoUFEnum = (CodigoUfIbge)Enum.Parse(typeof(CodigoUfIbge), emitente.Endereco.UF); await new NotaFiscalService().CancelarNotaFiscalAsync(emitente.Endereco.UF, codigoUFEnum, Ambiente.Homologacao, emitente.CNPJ, notaFiscal.Identificacao.Chave, notaFiscalDb.Protocolo, notaFiscal.Identificacao.Modelo, "Teste unitário cancelamento"); var notaTest = new NotaFiscalService().GetNotaFiscalByChave(notaFiscal.Identificacao.Chave, Ambiente.Homologacao); var evento = new EventoService().GetEventoPorNota(notaTest.Id, true); ValidadorXml.ValidarXml(evento.LoadXml(), "procEventoCancNFe_v1.00.xsd"); ValidadorXml.ValidarXml(notaTest.LoadXml(), "procNFe_v4.00.xsd"); Assert.IsTrue(notaTest.Status == (int)NFe.Repository.Status.CANCELADA); Assert.IsTrue(File.Exists(evento.XmlPath)); Assert.IsTrue(File.Exists(notaTest.XmlPath)); }
public EventoController(EventoService service) { Service = service; }
public EventosController(EventoService svc) { _svc = svc; }
// POST: api/EventoDetalle public Evento Post([FromBody] Evento value) { EventoService servicio = new EventoService(cadenaConexion); return(servicio.getDetalleEvento(value.clvEmp, value.folioEvento)); }
public LocalController(LocalService localService, EventoService eventoService) { _localService = localService; _eventoService = eventoService; }