Exemplo n.º 1
0
        public CommandResponse AdicionarExecucao(AgendamentoExecucao obj)
        {
            try
            {
                using (_contexto.Connection)
                {
                    _contexto.GetConnection();

                    var param = new DynamicParameters();
                    param.Add(name: "IdExecucao", value: obj.IdExecucao, direction: System.Data.ParameterDirection.Input);
                    param.Add(name: "IdProcesso", value: obj.IdProcesso, direction: System.Data.ParameterDirection.Input);
                    param.Add(name: "MensagemStatus", value: obj.MensagemStatus, direction: System.Data.ParameterDirection.Input);
                    param.Add(name: "Inicio", value: obj.Inicio, direction: System.Data.ParameterDirection.Input);
                    param.Add(name: "Fim", value: obj.Fim, direction: System.Data.ParameterDirection.Input);
                    param.Add(name: "Status", value: obj.Status, direction: System.Data.ParameterDirection.Input);

                    _contexto.Connection.Execute(AgentamentoExecucoesQueries.InsertExecucao(), param);

                    return(new CommandResponse(true, $"Execucao adicionada com sucesso"));
                }
            }
            catch (SQLiteException ex)
            {
                return(new CommandResponse(false, $"Erro : {ex.Message}"));
            }
        }
Exemplo n.º 2
0
        public AgendamentoInfo ObterAgendamento(string Id)
        {
            try
            {
                using (_contexto.Connection)
                {
                    _contexto.GetConnection();


                    var agendamento = _contexto
                                      .Connection
                                      .Query <AgendamentoInfo>(AgendamentoInfoQueries.SelectAgendamentoInfoPorId(Id.ToString()), new { Id = Id }).FirstOrDefault();

                    agendamento.AtualizaEmail(_contexto
                                              .Connection
                                              .Query <EmailInfo>(EmailInfoQueries.SelectEmailInfoPorId(Id.ToString()), new { Id = Id }).FirstOrDefault());

                    return(agendamento);
                }
            }
            catch (SQLiteException ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        public CommandResponse AdicionarRegra(RegrasForunsBrasil regra)
        {
            try
            {
                using (_context.Connection)
                {
                    _context.GetConnection();

                    var param = new DynamicParameters();
                    param.Add(name: "IdEstado", value: regra.IdEstado, direction: System.Data.ParameterDirection.Input);
                    param.Add(name: "IdComarca", value: regra.IdComarca, direction: System.Data.ParameterDirection.Input);

                    if (regra.IdCidade == 0)
                    {
                        param.Add(name: "IdCidade", value: null, direction: System.Data.ParameterDirection.Input);
                    }
                    else
                    {
                        param.Add(name: "IdCidade", value: regra.IdCidade, direction: System.Data.ParameterDirection.Input);
                    }

                    param.Add(name: "Regra", value: regra.Regra, direction: System.Data.ParameterDirection.Input);
                    param.Add(name: "Status", value: regra.Status, direction: System.Data.ParameterDirection.Input);

                    var t = _context.Connection.Execute(RegrasForunsQueries.InsertRegra(), param);

                    return(new CommandResponse(true, $"{regra.Regra} adicionada com sucesso"));
                }
            }
            catch (SQLiteException ex)
            {
                return(new CommandResponse(false, $"Erro : {ex.Message}"));
            }
        }
Exemplo n.º 4
0
        public UsuarioAplicacao ObterUsuario(UsuarioAplicacao usr)
        {
            string query = string.Format("Select * from Usuario where NomeUsuario = '{0}' and SenhaUsuario = '{1}'", usr.NomeUsuario, usr.SenhaUsuario);

            try
            {
                using (_context.Connection)
                {
                    _context.GetConnection();

                    return(_context
                           .Connection
                           .Query <UsuarioAplicacao>(query, new { }).FirstOrDefault());
                };
            }
            catch (SQLiteException ex)
            {
                throw ex;
            }
        }
Exemplo n.º 5
0
        public CommandResponse AdicionarCusta(EstadosVsCustas custa)
        {
            try
            {
                using (_context.Connection)
                {
                    _context.GetConnection();

                    var param = new DynamicParameters();
                    param.Add(name: "IdEstado", value: custa.IdEstado, direction: System.Data.ParameterDirection.Input);
                    param.Add(name: "De", value: custa.De, direction: System.Data.ParameterDirection.Input);
                    param.Add(name: "Ate", value: custa.Ate, direction: System.Data.ParameterDirection.Input);

                    _context.Connection.Execute(CustasQueries.InsertCustas(), param);

                    return(new CommandResponse(true, $"Custa adicionada com sucesso"));
                }
            }
            catch (SQLiteException ex)
            {
                return(new CommandResponse(false, $"Erro : {ex.Message}"));
            }
        }
Exemplo n.º 6
0
        public IEnumerable <T> ObterTodos <T>(string nomeTabela) where T : EntidadeBase <T>
        {
            try
            {
                var query = RegrasForunsQueries.SelectGeneric(nomeTabela);

                using (_context.Connection)
                {
                    _context.GetConnection();
                    return(_context
                           .Connection
                           .Query <T>(query, new { }));
                }
            }
            catch (SQLiteException ex)
            {
                throw ex;
            }
        }