Ejemplo n.º 1
0
 internal void SetEvento(Exception excepcao)
 {
     Momento = DateTime.Now;
     Tipo = TipoEvento.Excepcao;
     Mensagem = excepcao.Message ?? "";
     Outros = excepcao.StackTrace ?? "";
 }
Ejemplo n.º 2
0
 internal void SetEvento(string mensagem)
 {
     Momento = DateTime.Now;
     Tipo = TipoEvento.Mensagem;
     Mensagem = mensagem;
     Outros = "";
 }
Ejemplo n.º 3
0
 public Evento(int id, String nombre, String descripcion, float costo, Ubicacion ubicacion, TipoEvento tipoEvento, Horario horario)
 {
     this.id = id;
     this.nombre = nombre;
     this.descripcion = descripcion;
     this.costo = costo;
     this.ubicacion = ubicacion;
     this.tipoEvento = tipoEvento;
     this.horario = horario;
 }
Ejemplo n.º 4
0
 public Evento(int id, String nombre, String descripcion, float costo, Boolean estado, Ubicacion ubicacion, Categoria categoria, TipoEvento tipoEvento, Horario horario)
 {
     this.id = id;
     this.nombre = nombre;
     this.descripcion = descripcion;
     this.costo = costo;
     this.ubicacion = ubicacion;
     this.categoria = categoria;
     this.tipoEvento = tipoEvento;
     this.horario = horario;
     this.estado = estado;
 }
Ejemplo n.º 5
0
        public string GetSoapUrl(TipoEvento tipoEvento)
        {
            switch (tipoEvento)
            {
            case TipoEvento.CTeConsulta:
                return("http://www.portalfiscal.inf.br/cte/wsdl/CteConsulta");

            case TipoEvento.CTeDistribuicaoDFe:
                return("http://www.portalfiscal.inf.br/cte/wsdl/CTeDistribuicaoDFe/cteDistDFeInteresse");

            case TipoEvento.CTeRecepcaoEvento:
                return("http://www.portalfiscal.inf.br/cte/wsdl/CteRecepcaoEvento");

            case TipoEvento.CTeInutilizacao:
                return("http://www.portalfiscal.inf.br/cte/wsdl/CteInutilizacao");

            case TipoEvento.CTeRecepcao:
                return("http://www.portalfiscal.inf.br/cte/wsdl/CteRecepcao");

            case TipoEvento.CTeRetRecepcao:
                return("http://www.portalfiscal.inf.br/cte/wsdl/CteRetRecepcao");

            case TipoEvento.CTeStatusServico:
                return("http://www.portalfiscal.inf.br/cte/wsdl/CteStatusServico");

            case TipoEvento.MDFeStatusServico:
                return("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico");

            case TipoEvento.MDFeRecepcao:
                return("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeRecepcao");

            case TipoEvento.MDFeRetRecepcao:
                return("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeRetRecepcao");

            case TipoEvento.MDFeNaoEncerrado:
                return("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeConsNaoEnc");

            case TipoEvento.MDFeConsulta:
                return("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeConsulta");

            case TipoEvento.MDFeEvento:
                return("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeRecepcaoEvento");

            default:
                throw new ArgumentOutOfRangeException(nameof(tipoEvento), tipoEvento, null);
            }
        }
Ejemplo n.º 6
0
        /*TipoEvento evento;
         * double asistentes;
         * double valorbase;
         * double total;*/

        public Wpf_AdminContrato()
        {
            InitializeComponent();

            ServiceReference1.Service1Client ws = new ServiceReference1.Service1Client();
            lbl_uf.Content = ws.Uf().ToString();

            //evento = new TipoEvento();
            txt_contrato.Text = DateTime.Now.ToString("yyyyMMddHHmm");
            txt_creacion.Text = DateTime.Now.ToString("yyyy/MM/dd");
            TipoEvento tpevent = new TipoEvento();

            BibliotecaClases.TipoEvento BTE = new TipoEvento();
            var bts = BTE.listar();

            cb_tipoevento.Items.Add("Seleccione");
            cb_tipoevento.SelectedIndex = 0;
            foreach (var item in bts)
            {
                ComboTipoEvento CTE = new ComboTipoEvento();
                CTE.id    = item.IdTipoEvento;
                CTE.texto = item.Descripcion;
                cb_tipoevento.Items.Add(CTE);
            }
            ModalidadServicio modsrv = new ModalidadServicio();

            BibliotecaClases.ModalidadServicio BMS = new ModalidadServicio();
            var twice = BMS.ListaMod();

            cb_ModalidadServicio.Items.Add("Seleccione");
            cb_ModalidadServicio.SelectedIndex = 0;

            /*foreach (var item in twice)
             * {
             *  ComboModalidadServicio CMS = new ComboModalidadServicio();
             *  CMS.IdModalidad = item.IdModalidad;
             *  CMS.IdTipoEvento = item.IdTipoEvento;
             *  CMS.Nombre = item.Nombre;
             *  CMS.PersonalBase = item.PersonalBase;
             *  CMS.ValorBase = item.ValorBase;
             *  cb_ModalidadServicio.Items.Add(CMS);
             * }
             * ComboTipoEvento TipoEve = new ComboTipoEvento();
             * //String ID = TipoEve.id.ToString().Trim();
             */
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            TipoEvento = await _context.TiposEventos.FindAsync(id);

            if (TipoEvento != null)
            {
                _context.TiposEventos.Remove(TipoEvento);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 8
0
        public async Task <retEventoCTe> Executar(TipoEvento tipoEvento, int sequenciaEvento, string chave, string cnpj, EventoContainer container)
        {
            var evento = FactoryEvento.CriaEvento(tipoEvento, sequenciaEvento, chave, cnpj, container);

            evento.Assina();
            evento.ValidarSchema();
            evento.SalvarXmlEmDisco();

            var webService = WsdlFactory.CriaWsdlCteEvento();
            var retornoXml = await webService.cteRecepcaoEvento(evento.CriaXmlRequestWs());

            var retorno = retEventoCTe.LoadXml(retornoXml.OuterXml, evento);

            retorno.SalvarXmlEmDisco();

            return(retorno);
        }
        public IActionResult Put(int id, TipoEvento tipoEventoAtualizado)
        {
            TipoEvento tipoEventoBuscado = _tipoEventoRepository.BuscarPorId(id);

            if (tipoEventoBuscado == null)
            {
                try
                {
                    _tipoEventoRepository.Atualizar(id, tipoEventoAtualizado);
                }
                catch (Exception erro)
                {
                    return(BadRequest(erro));
                }
            }
            return(StatusCode(404));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Arroja el nombre para vista segun el tipo de contrato ingreso como argumento
        /// </summary>
        public static string getNombreTipoEvento(TipoEvento tipo)
        {
            switch (tipo)
            {
            case TipoEvento.BANQUETE:
                return(TiposEventoNombres.BAQUETES);

            case TipoEvento.CUALQUIERA:
                return(TiposEventoNombres.CUALQUIERA);

            case TipoEvento.RESERVACION:
                return(TiposEventoNombres.RESERVACION);

            default:
                return(string.Empty);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Busca um tipo de evento por ID
        /// </summary>
        /// <param name="id">ID do tipo de evento que será buscado</param>
        /// <returns>Um tipo de evento buscado</returns>
        public TipoEvento BuscarPorId(int id)
        {
            // Busca o primeiro tipo de evento encontrado para o ID informado e armazena no objeto tipoEventoBuscado
            TipoEvento tipoEventoBuscado = ctx.TipoEvento.FirstOrDefault(te => te.IdTipoEvento == id);

            // Outra forma
            // TipoEvento tipoEventoBuscado = ctx.TipoEvento.Find(id);

            // Verifica se o tipo de evento foi encontrado
            if (tipoEventoBuscado != null)
            {
                // Retorna o tipo de evento encontrado
                return(tipoEventoBuscado);
            }

            // Caso não seja encontrado, retorna nulo
            return(null);
        }
        public ICommandResult Execute(CreateOrUpdateTipoEventoCommand command)
        {
            TipoEvento _TipoEvento = AutoMapper.Mapper.Map <CreateOrUpdateTipoEventoCommand, TipoEvento>(command);

            if (command.Id == 0)
            {
                TipoEventoRepository.Add(_TipoEvento);
            }
            else
            {
                TipoEventoRepository.Update(_TipoEvento);
            }
            unitOfWork.Commit();

            AutoMapper.Mapper.Map <TipoEvento, CreateOrUpdateTipoEventoCommand>(_TipoEvento, command);

            return(new CommandResult(true));
        }
Ejemplo n.º 13
0
 public ActionResult Edit(TipoEvento tipoEvento) //FormCollection collection)
 {
     try
     {
         if (ModelState.IsValid)
         {
             //Usuario usuario = new Usuario();
             //TryUpdateModel<Usuario>(usuario, collection.ToValueProvider());
             gerenciador.Editar(tipoEvento);
             return(RedirectToAction("Index"));
         }
     }
     catch
     {
         return(RedirectToAction("Index"));
     }
     return(View());
 }
Ejemplo n.º 14
0
 public IActionResult AtualizarTipoEvento(int id, TipoEvento TipoEvento)
 {
     try
     {
         if (Rep.Atualizar(id, TipoEvento))
         {
             return(Ok("TipoEvento atualizado com sucesso"));
         }
         else
         {
             return(BadRequest("Não foi possivel atualizar,tente novamente"));
         }
     }
     catch (Exception e)
     {
         return(BadRequest("Erro no sistema"));
     }
 }
Ejemplo n.º 15
0
        public bool Adicionar(TipoEvento TipoEventoNovo)
        {
            using (GufiContext ctx = new GufiContext())
            {
                try
                {
                    ctx.Add(TipoEventoNovo);

                    ctx.SaveChanges();

                    return(true);;
                }
                catch
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 16
0
        public void PopCbo()
        {
            TipoEvento       tipoEvento       = new TipoEvento();
            TipoAmbientacion tipoAmbientacion = new TipoAmbientacion();

            cboTipoEvento.ItemsSource       = tipoEvento.ReadAll();
            cboTipoEvento.DisplayMemberPath = "Descripcion";
            cboTipoEvento.SelectedValuePath = "IdTipoEvento";
            cboTipoEvento.SelectedIndex     = 0;

            cboAmbientacion.ItemsSource       = tipoAmbientacion.ReadAll();
            cboAmbientacion.DisplayMemberPath = "Desc";
            cboAmbientacion.SelectedValuePath = "Id";
            cboAmbientacion.SelectedIndex     = -1;

            cboLocal.ItemsSource   = Enum.GetValues(typeof(Locales));
            cboLocal.SelectedIndex = 0;
        }
Ejemplo n.º 17
0
        public HttpResponseMessage Put(short Id, string cultura, TipoEventoModel tipoevento)
        {
            try {
                if (ModelState.IsValid)
                {
                    if (cultura != Localizacion.CulturaPorDefecto)
                    {
                        TipoEvento      _tipoevento           = tipoeventoRepository.GetById(new string[] {}, (p => p.Id == Id));
                        TipoEventoModel _tipoeventoPorDefecto = new TipoEventoModel();
                        // Solo funciona el Mapper si se ha configurado el Mapper con Mapper.CreateMap<EmpresaModel, EmpresaModel>(); Se está creando en la carpeta mappers.
                        _tipoeventoPorDefecto = AutoMapper.Mapper.Map <TipoEventoModel, TipoEventoModel>(tipoevento, _tipoeventoPorDefecto);

                        _tipoeventoPorDefecto.Nombre = _tipoevento.Nombre;

                        var command = AutoMapper.Mapper.Map <TipoEventoModel, CreateOrUpdateTipoEventoCommand>(_tipoeventoPorDefecto);
                        var result  = commandBus.Submit(command);
                    }
                    else
                    {
                        var command = AutoMapper.Mapper.Map <TipoEventoModel, CreateOrUpdateTipoEventoCommand>(tipoevento);
                        var result  = commandBus.Submit(command);
                    }
                    TipoEvento_Idioma _tipoeventoIdioma = tipoevento_IdiomaRepository.GetMany(t => t.IdRegistro == tipoevento.Id && t.Cultura == cultura).FirstOrDefault();
                    var commandIdioma = AutoMapper.Mapper.Map <TipoEvento_IdiomaModel, CreateOrUpdateTipoEvento_IdiomaCommand>(new TipoEvento_IdiomaModel {
                        Id = (_tipoeventoIdioma != null ? _tipoeventoIdioma.Id : (short)0), IdRegistro = tipoevento.Id, Cultura = cultura, Nombre = tipoevento.Nombre
                    });
                    var resultIdioma = commandBus.Submit(commandIdioma);
                    return(Request.CreateResponse <TipoEventoModel>(HttpStatusCode.OK, tipoevento));
                }
                else
                {
                    var errors = new Dictionary <string, IEnumerable <string> >();
                    foreach (var keyValue in ModelState)
                    {
                        errors[keyValue.Key] = keyValue.Value.Errors.Select(e => (!string.IsNullOrWhiteSpace(e.ErrorMessage) ? e.ErrorMessage : (e.Exception != null ? e.Exception.Message : string.Empty)));
                    }
                    return(Request.CreateResponse(HttpStatusCode.BadRequest, errors));
                }
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            } catch (Exception _excepcion) {
                log.Error(_excepcion);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, _excepcion));
            }
        }
Ejemplo n.º 18
0
        public static void RegistrarInscricao <T>(TipoEvento tipo, Action <T> acao)
            where T : IEventoParametros
        {
            void acaoConvertida(IEventoParametros evento) =>
            acao((T)evento);

            if (EventosEAcoes == null)
            {
                EventosEAcoes =
                    new Dictionary <TipoEvento, List <Action <IEventoParametros> > >();
            }

            if (!EventosEAcoes.ContainsKey(tipo))
            {
                EventosEAcoes.Add(tipo, new List <Action <IEventoParametros> >());
            }

            EventosEAcoes[tipo].Add(acaoConvertida);
        }
Ejemplo n.º 19
0
    public static TipoEvento ObterTipo(int pintId)
    {
        string        strConectionString = ConfigurationManager.ConnectionStrings["BradescoRI"].ConnectionString;
        SqlConnection objConexao         = new SqlConnection(strConectionString);

        SqlCommand objComando = new SqlCommand("SPE_L_TIPO_EVENTO_ID");

        objComando.Connection  = objConexao;
        objComando.CommandType = CommandType.StoredProcedure;

        objComando.Parameters.Add("@tipoEventoId", SqlDbType.Int).Value = pintId;

        try
        {
            objConexao.Open();

            TipoEvento obj = new TipoEvento();

            IDataReader idrReader = default(IDataReader);

            idrReader = objComando.ExecuteReader();

            while ((idrReader.Read()))
            {
                obj.FromIDataReader(idrReader);
            }

            return(obj);
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            //Fecha a conexao se aberta
            if (objConexao.State != ConnectionState.Closed)
            {
                objConexao.Close();
            }
        }
    }
Ejemplo n.º 20
0
    public static int AtualizarTipo(TipoEvento pobjTipoEvento)
    {
        string        strConectionString = ConfigurationManager.ConnectionStrings["BradescoRI"].ConnectionString;
        SqlConnection objConexao         = new SqlConnection(strConectionString);

        SqlCommand objComando = new SqlCommand("SPE_U_TIPO_EVENTO");

        objComando.Connection  = objConexao;
        objComando.CommandType = CommandType.StoredProcedure;

        //Define parametros da procedure
        objComando.Parameters.Add("@tipoEventoId", SqlDbType.Int).Value       = pobjTipoEvento.IdTipoEvento;
        objComando.Parameters.Add("@idiomaId", SqlDbType.Int).Value           = pobjTipoEvento.IdIdioma;
        objComando.Parameters.Add("@descricao", SqlDbType.VarChar, 200).Value = pobjTipoEvento.Descricao;
        objComando.Parameters.Add("@cor", SqlDbType.VarChar, 50).Value        = pobjTipoEvento.Cor;

        try
        {
            //Abre conexão com o banco de dados
            objConexao.Open();

            //Declara variavel de retorno
            int intRetorno = 0;

            //Executa comando no banco de dados
            intRetorno = objComando.ExecuteNonQuery();

            return(intRetorno);
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            //Fecha a conexao se aberta
            if (objConexao.State != ConnectionState.Closed)
            {
                objConexao.Close();
            }
        }
    }
Ejemplo n.º 21
0
        public ActionResult Create(TipoEvento evento)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    //var te = new TipoEvento();
                    //te.descripcion = collection["descripcion"];
                    dc.TipoEventos.InsertOnSubmit(evento);
                    dc.SubmitChanges();

                    return RedirectToAction("Index");
                }
                catch
                {
                    return View();
                }
            }
            return View(evento);
        }
Ejemplo n.º 22
0
 public AnalisisPrevio(Tipo tipo, TipoEvento tipoDeEaE)
 {
     //logger.Info("Inicio Analisis Previo");
     try
     {
         this.InicializarColecciones();
         this.TipoDeEjercicio = tipo;
         if (tipo == AnalisisPrevio.Tipo.EaE)
         {
             this.TipoDeEaE = tipoDeEaE;
         }
         this.InicializarAnalisisPrevioPorDefecto();
         //logger.Info("Fin Analisis Previo");
     }
     catch (Exception ex)
     {
         logger.Error(ex.Source + " - " + ex.Message + ": " + ex.StackTrace);
         throw ex;
     }
 }
Ejemplo n.º 23
0
        private TipoParametroSistema ObterTipoParametro(TipoEvento tipoEvento)
        {
            switch (tipoEvento)
            {
            case TipoEvento.ConselhoDeClasse:
                return(TipoParametroSistema.QuantidadeEventosConselhoClasse);

            case TipoEvento.ReuniaoPedagogica:
                return(TipoParametroSistema.QuantidadeEventosPedagogicos);

            case TipoEvento.ReuniaoAPM:
                return(TipoParametroSistema.QuantidadeEventosAPM);

            case TipoEvento.ReuniaoConselhoEscola:
                return(TipoParametroSistema.QuantidadeEventosConselhoEscolar);

            default:
                throw new NegocioException("Tipo de Evento não mapeado para parâmetro");
            }
        }
Ejemplo n.º 24
0
 public static void Log(TipoEvento tipoEvento, string detalle)
 {
     Evento evento = new Evento();
     evento.IdUsuario = BiFactory.User.IdUsuario;
     evento.IdTipoEvento = (int)tipoEvento;
     evento.Fecha = DateTime.Now;
     string host = string.Empty;
     try
     {
         host = Dns.GetHostEntry(HttpContext.Current.Request.ServerVariables["remote_addr"]).HostName.Split(new Char[] { '.' })[0].ToString();
     }
     catch (Exception)
     {
         host = HttpContext.Current.Request.UserHostAddress;
     }
     evento.Host = host;
     evento.Detalle = detalle;
     evento.Save();
     LogToFile(tipoEvento, detalle);
 }
Ejemplo n.º 25
0
    private void CarregarObjetos(Utilitarios.TipoTransacao objTipoTransacao)
    {
        switch (objTipoTransacao)
        {
        //Novo Grupo
        case Utilitarios.TipoTransacao.Limpar:

            ddlIdioma.SelectedIndex = 0;
            txtDescricao.Text       = string.Empty;

            break;

        //Carregar Dados do Link
        case Utilitarios.TipoTransacao.Salvar:

            if (gobjTipoEvento == null)
            {
                gobjTipoEvento = new TipoEvento();
            }

            gobjTipoEvento.IdTipoEvento = codigo;
            gobjTipoEvento.IdIdioma     = Convert.ToInt32(ddlIdioma.SelectedValue);
            gobjTipoEvento.Descricao    = txtDescricao.Text;
            gobjTipoEvento.Cor          = ddlCor.SelectedValue;

            break;

        //Carregar Dados do Link
        case Utilitarios.TipoTransacao.Carregar:

            ddlIdioma.SelectedValue = gobjTipoEvento.IdIdioma.ToString();
            ddlIdioma.Enabled       = false;

            ddlCor.SelectedValue = gobjTipoEvento.Cor;
            imgCor.BackColor     = Color.FromName(gobjTipoEvento.Cor);

            txtDescricao.Text = gobjTipoEvento.Descricao;

            break;
        }
    }
Ejemplo n.º 26
0
 public bool Deletar(int id)
 {
     using (GufiContext ctx = new GufiContext())
     {
         try
         {
             TipoEvento TipoEventoBuscado = ctx.TipoEvento.Find(id);
             if (TipoEventoBuscado == null)
             {
                 return(false);
             }
             ctx.Remove(TipoEventoBuscado);
             ctx.SaveChanges();
             return(true);
         }
         catch
         {
             return(false);
         }
     }
 }
Ejemplo n.º 27
0
 public IActionResult AdicionarTipoEvento(TipoEvento TipoEvento)
 {
     try
     {
         if (TipoEvento.TituloTipoEvento == null)
         {
             return(BadRequest("Preencha todos os campos"));
         }
         if (Rep.Adicionar(TipoEvento))
         {
             return(Ok("TipoEvento cadastrado com sucesso"));
         }
         else
         {
             return(BadRequest("Não foi possivel cadastrar este TipoEvento"));
         }
     }
     catch (Exception e)
     {
         return(BadRequest("Erro no sistema"));
     }
 }
Ejemplo n.º 28
0
        /// <summary>
        /// Atualiza um tipo de evento existente
        /// </summary>
        /// <param name="id">ID do tipo de evento que será atualizado</param>
        /// <param name="tipoEventoAtualizado">Objeto com as novas informações</param>
        public void Atualizar(int id, TipoEvento tipoEventoAtualizado)
        {
            // Busca um tipo de evento através do id
            TipoEvento tipoEventoBuscado = ctx.TipoEvento.Find(id);

            // Verifica se o tipo de evento foi encontrado
            if (tipoEventoBuscado != null)
            {
                // Verifica se foi informado um título do tipo de evento
                if (tipoEventoAtualizado.TituloTipoEvento != null)
                {
                    // Atribui o novo valor ao campo
                    tipoEventoBuscado.TituloTipoEvento = tipoEventoAtualizado.TituloTipoEvento;
                }

                // Atualiza o título do tipo de evento que foi buscado
                ctx.TipoEvento.Update(tipoEventoBuscado);

                // Salva as informações para serem gravadas no banco
                ctx.SaveChanges();
            }
        }
Ejemplo n.º 29
0
 private void LlenarContratoCache(ContratoSalvar cont)
 {
     txtNumero.Text = cont.Numero;
     txtRut.Text    = cont.RutCliente;
     if (cont.IdTipoEvento == -1)
     {
         cboTipoEvento.SelectedIndex      = -1;
         cboModalidadServicio.ItemsSource = null;
     }
     else
     {
         TipoEvento te = new TipoEvento()
         {
             IdTipoEvento = cont.IdTipoEvento
         };
         te.Read();
         cboTipoEvento.Text = te.Descripcion;
         if (cont.IdModalidad.Equals("-1"))
         {
             cboModalidadServicio.SelectedIndex = -1;
         }
         else
         {
             ModalidadServicio mo = new ModalidadServicio()
             {
                 IdModalidad = cont.IdModalidad
             };
             mo.Read();
             cboModalidadServicio.Text = mo.Nombre.Trim();
         }
     }
     txtAsistentes.Text        = cont.Asistentes.ToString();
     txtPersonalAdicional.Text = cont.PersonalAdicional.ToString();
     txtObservaciones.Text     = cont.Observaciones.ToString();
     ctrFechaHoraInicio.VerFechaYHora(cont.FechaHoraInicio);
     ctrFechaHoraFin.VerFechaYHora(cont.FechaHoraTermino);
     txtFechaCreacion.Text = cont.Creacion.ToString("dd/MM/yyyy HH:mm");
     txtFechaTermino.Text  = cont.Termino.ToString("dd/MM/yyyy HH:mm");
 }
Ejemplo n.º 30
0
        private string BuscarAmbiente(XmlDocument xml, TipoEvento tipoEvento)
        {
            // Cria um XmlNamespaceManager baseado no XML selecionado
            var nsmgr = new XmlNamespaceManager(xml.NameTable);

            nsmgr.AddNamespace("Reinf", xml.DocumentElement.NamespaceURI);
            nsmgr.AddNamespace("ReinfEvento", $"http://www.reinf.esocial.gov.br/schemas/{tipoEvento.Namespace}/v1_05_01");

            // Seleciona todos os eventos do lote
            var eventos = xml.SelectNodes("//Reinf:loteEventos/Reinf:evento", nsmgr);

            if (eventos.Count <= 0)
            {
                MessageBox.Show("Não encontrou eventos no arquivo de lotes selecionado");
                return(null);
            }

            var primeiroEvento = eventos[0];
            var ambiente       = primeiroEvento.SelectSingleNode($"//ReinfEvento:{tipoEvento.Tag}/ReinfEvento:ideEvento/ReinfEvento:tpAmb", nsmgr).InnerText;

            return(ambiente);
        }
Ejemplo n.º 31
0
        public HttpResponseMessage Get([FromUri] short Id, [FromUri] string cultura, [FromUri] string[] include, [FromUri] bool indent = false)
        {
            try {
                var formatter = new MaxDepthJsonMediaTypeFormatter()
                {
                    Indent = indent
                };
                if (include.Length > 0)
                {
                    formatter.SerializerSettings.MaxDepth = 100;                     //include.Max<string>(s => s.Split('.').Length * 5);
                    formatter.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects;
                }
                else
                {
                    formatter.SerializerSettings.MaxDepth = 1;
                }
                TipoEvento _tipoevento = tipoeventoRepository.GetById(include, (p => p.Id == Id));
                if (cultura != Localizacion.CulturaPorDefecto)
                {
                    TipoEvento_Idioma _tipoeventoIdioma = tipoevento_IdiomaRepository.GetMany(p => p.IdRegistro == Id && p.Cultura == cultura).FirstOrDefault();

                    // Campos multiidioma
                    if (_tipoeventoIdioma != null)
                    {
                        _tipoevento.Nombre = _tipoeventoIdioma.Nombre;
                    }
                }

                if (_tipoevento == null)
                {
                    throw new HttpResponseException(HttpStatusCode.NotFound);
                }
                return(Request.CreateResponse <TipoEvento>(HttpStatusCode.OK, _tipoevento, formatter));
            } catch (Exception _excepcion) {
                log.Error(_excepcion);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, _excepcion));
            }
        }
Ejemplo n.º 32
0
        public async Task <HttpResponseMessage> PostEventosGuiaInspeccion(TipoEventosModel tipoEventos)
        {
            using (db = new DBConnection())
            {
                try
                {
                    TipoEvento tipo = new TipoEvento();
                    tipo.IdArea       = tipoEventos.IdArea;
                    tipo.Drescripcion = tipoEventos.Drescripcion;
                    db.TipoEvento.Add(tipo);
                    await db.SaveChangesAsync();

                    return(new HttpResponseMessage(HttpStatusCode.OK));
                }
                catch (Exception ex)
                {
                    return(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                    {
                        Content = new StringContent(ex.Message)
                    });
                }
            }
        }
Ejemplo n.º 33
0
        public IActionResult GetById(int id)
        {
            try
            {
                // Faz a chamada para o método e armazena em um objeto tipoEventoBuscado
                TipoEvento tipoEventoBuscado = _tipoEventoRepository.BuscarPorId(id);

                // Verifica se o tipo de evento foi encontrado
                if (tipoEventoBuscado != null)
                {
                    // Retora a resposta da requisição 200 - OK e o tipo de evento que foi encontrado
                    return(Ok(tipoEventoBuscado));
                }

                // Retorna a resposta da requisição 404 - Not Found com uma mensagem
                return(NotFound("Nenhum tipo de evento encontrado para o ID informado"));
            }
            catch (Exception error)
            {
                // Retorna a resposta da requisição 400 - Bad Request e o erro ocorrido
                return(BadRequest(error));
            }
        }
Ejemplo n.º 34
0
        public static TipoEvento BuscarEvento(int id)
        {
            TipoEvento    lis = new TipoEvento();
            SqlConnection cn  = new SqlConnection(Conexion.cn);

            try
            {
                DynamicParameters dypa = new DynamicParameters();
                dypa.Add("@IdTipoEvento", id);
                lis = cn.Query <TipoEvento>("itData.SP_S_ID_TipoEvento", dypa, commandType: CommandType.StoredProcedure).First();
            }
            catch (Exception e)
            {
                lis = null;
                var rpt = "Excepción ocurrida: " + e.Message;
            }
            finally
            {
                cn.Close();
                cn.Dispose();
            }
            return(lis);
        }
Ejemplo n.º 35
0
        public static List <Evento> CrearEvento(List <Evento> listaEventos)
        {
            Console.WriteLine("Ingrese el dia");
            for (int i = 0; i <= 6; i++)
            {
                Console.WriteLine(i + 1 + ". " + Enum.GetName(typeof(DayOfWeek), i));
            }
            int       opcion = Program.ChequearOpcion(1, 7);
            DayOfWeek dia    = (DayOfWeek)opcion;

            Console.WriteLine("Ingrese el tipo de evento!");
            for (int i = 0; i <= 5; i++)
            {
                Console.WriteLine(i + 1 + ". " + Enum.GetName(typeof(TipoEvento), i));
            }
            opcion = Program.ChequearOpcion(1, 6);
            TipoEvento tipoEvento = (TipoEvento)opcion;

            Console.Write("Ingrese la sala:> ");
            string sala  = Console.ReadLine();
            int    deseo = 1;

            do
            {
                Console.WriteLine("Ingrese bloque de horario!");
                for (int i = 0; i <= 13; i++)
                {
                    Console.WriteLine(i + 1 + ". " + Program.ConvertirFormato(Enum.GetName(typeof(BloquesHorarios), i)));
                }
                opcion = Program.ChequearOpcion(1, 14);
                listaEventos.Add(new Evento("wiwi", "8:20", "fechq", "b-23", tipoEvento));
                Console.WriteLine("¿Desea agregar otro bloque?\n1. Si\n2. No");
                deseo = Program.ChequearOpcion(1, 2);
            } while (deseo == 1);
            Program.ImprimirPositivo("Evento Agregado");
            return(listaEventos);
        }
        public static string GerarMensagemTipoLog(UsuarioADE usuario, T entity, TipoEvento Acao)
        {
            try
            {
                string verbo = "";
                switch (Acao)
                {
                case Criacao:
                    verbo = "CRIOU";
                    break;

                case Alteracao:
                    verbo = "ALTEROU";
                    break;

                case Delecao:
                    verbo = "DELETOU";
                    break;

                default:
                    throw new InvalidOperationException("Ação invalida realizada");
                }
                if (usuario != null)
                {
                    return($"{usuario.UserName} (ID: {usuario.Id}) {verbo} {entity.GetType().Name} {entity.ToString()}");
                }
                else
                {
                    return($"{verbo} {entity.GetType().Name} {entity.ToString()}");
                }
            }
            catch (NullReferenceException)
            {
                return($"Erro ao gerar mensagem de log");
            }
        }
Ejemplo n.º 37
0
 public static void Log(TipoEvento tipoEvento)
 {
     Log(tipoEvento, null);
 }
Ejemplo n.º 38
0
    private static void LogToFile(TipoEvento tipoEvento, string detalle)
    {
        StreamWriter st;
        if (!Directory.Exists(HttpContext.Current.Server.MapPath ( "~/Logs")))
        {
            Directory.CreateDirectory(HttpContext.Current.Server.MapPath ( "~/Logs"));
        }

        string unPath = HttpContext.Current.Server.MapPath ( "~/Logs/Log_" + DateTime.Today.ToString("yyyyMMdd") + ".log");

        if (!File.Exists(unPath ))
            {
                File.CreateText(unPath).Close();

            }

        st = File.AppendText(unPath);

        if (detalle == null)
        {
            detalle = string.Empty;
        }
        st.WriteLine( DateTime.Now.ToString() + " - [" + TipoEvento.Login.ToString() + "] - " + BiFactory.User.LoginName + " - " + detalle);
        st.Close();
    }
Ejemplo n.º 39
0
        /// <summary>
        /// Loga uma mensagem de erro no banco.
        /// </summary>
        /// <param name="ipAddress">Endereço de IP</param>
        /// <param name="tipoEvento">Tipo de evento</param>
        /// <param name="message">Mensagem para identificação</param>
        public static void Log(IPAddress ipAddress, TipoEvento tipoEvento, string message)
        {
            using(IServerLog log = new ServerLog())
            {
                log.IP = Unimake.Convert.ToString(ipAddress);
                log.NomeMaquina = Settings.MachineName;
                log.DataHoraEvento = DateTime.Today;
                log.TipoEvento = tipoEvento;
                log.Evento = message;

                log.Save();
            };

            Debug.Log(message);
        }
Ejemplo n.º 40
0
 /// <summary>
 /// Loga uma mensagem de erro no banco.
 /// </summary>
 /// <param name="ipAddress">Endereço de IP</param>
 /// <param name="tipoEvento">Tipo de evento</param>
 /// <param name="message">Mensagem para identificação</param>
 public static void Log(IPAddress ipAddress, TipoEvento tipoEvento)
 {
     ServerLog.Log(Settings.Server.IPAddress, TipoEvento.ClientOnDisconnect, tipoEvento.GetDescription());
 }