public void AtualizarObjeto(GerenciadorFinanceiro.Dominio.FormaPagamento objeto)
        {
            string sSqlUpdate = "update TB_Forma_Pagamento set Descricao = @Descricao where IdFormaPagamento = @Id";

            try
            {
                Conection.AbrirConexao();
                Conection.Execute(sSqlUpdate, objeto.Descricao, objeto.Id);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível atualizar a Forma de pagamento solicitada.", ex);
            }
            finally
            {
                Conection.FecharConexao();
            }
        }
        public void SalvarObjeto(GerenciadorFinanceiro.Dominio.FormaPagamento objeto)
        {
            string sSqlInsert = "insert into TB_Forma_Pagamento (Descricao) values (@descr)";

            try
            {
                Conection.AbrirConexao();
                Conection.Execute(sSqlInsert, objeto.Descricao);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível inserir a Forma de pagamento solicitada.", ex);
            }
            finally
            {
                Conection.FecharConexao();
            }
        }
        public void DeletarObjeto(GerenciadorFinanceiro.Dominio.FormaPagamento objeto)
        {
            string sSqlUpdate = "update TB_Forma_Pagamento set Ativo = 0 where IdFormaPagamento = @id";

            try
            {
                Conection.AbrirConexao();
                Conection.Execute(sSqlUpdate, objeto.Id);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível excluir a Forma de pagamento solicitada.", ex);
            }
            finally
            {
                Conection.FecharConexao();
            }
        }
Exemple #4
0
        public void DeletarObjeto(GerenciadorFinanceiro.Dominio.TipoVeiculo objeto)
        {
            string sSqlDelete = "update TB_Tipo_Veiculo set Ativo = 0 where IdTipoVeiculo = @IdTipoVeiculo";

            try
            {
                Conection.AbrirConexao();
                Conection.Execute(sSqlDelete, objeto.IdTipoVeiculo);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível deletar o Tipo de Veículo.", ex);
            }
            finally
            {
                Conection.FecharConexao();
            }
        }
Exemple #5
0
        public void AtualizarObjeto(GerenciadorFinanceiro.Dominio.Estado objeto)
        {
            string sSqlUpdate = "update TB_Estado set NomeEstado = @NomeEstado, Sigla = @Sigla where IdEstado = @IdEstado";

            try
            {
                Conection.AbrirConexao();
                Conection.Execute(sSqlUpdate, objeto.NomeEstado, objeto.SiglaEstado, objeto.IdEstado);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível atualizar o estado.", ex);
            }
            finally
            {
                Conection.FecharConexao();
            }
        }
Exemple #6
0
        public void AtualizarObjeto(GerenciadorFinanceiro.Dominio.ModeloVeiculo objeto)
        {
            string sSqlUpdate = "update TB_Modelo_Veiculo set Descricao = @Descricao, IdFabricanteVeiculo = @IdFabricante where IdModeloVeiculo = @IdModeloVeiculo";

            try
            {
                Conection.AbrirConexao();
                Conection.Execute(sSqlUpdate, objeto.Descricao, objeto.Fabricante.IdFabricanteVeiculo, objeto.IdModeloVeiculo);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível atualizar o Modelo de Veículo.", ex);
            }
            finally
            {
                Conection.FecharConexao();
            }
        }
Exemple #7
0
        public void SalvarObjeto(GerenciadorFinanceiro.Dominio.TipoVeiculo objeto)
        {
            string sSqlInsert = "insert into TB_Tipo_Veiculo (Descricao) values (@Descricao)";

            try
            {
                Conection.AbrirConexao();
                Conection.Execute(sSqlInsert, objeto.Descricao);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível inserir o Tipo de Veículo.", ex);
            }
            finally
            {
                Conection.FecharConexao();
            }
        }
Exemple #8
0
        public void DeletarObjeto(GerenciadorFinanceiro.Dominio.DespesaCombustivel objeto)
        {
            string sqlDelete = "delete from TB_Despesa_Combustivel where IdDespesaCombustivel=@id";

            try
            {
                Conection.AbrirConexao();
                Conection.Execute(sqlDelete, objeto.IdDespesaCombustivel);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível deletar a Despesa de combustivel.", ex);
            }
            finally
            {
                Conection.FecharConexao();
            }
        }
Exemple #9
0
        public void DeletarObjeto(GerenciadorFinanceiro.Dominio.Servico objeto)
        {
            string sSqlDelete = "update TB_Servico set Ativo = 0 where IdServico = @IdServico";

            try
            {
                Conection.AbrirConexao();
                Conection.Execute(sSqlDelete, objeto.IdServico);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível deletar o Serviço.", ex);
            }
            finally
            {
                Conection.FecharConexao();
            }
        }
 /// <summary>
 /// Tenta a conexão com o banco
 /// </summary>
 private static void TryConect()
 {
     try
     {
         if (Conection.Open())
         {
             Console.WriteLine("Conexão estabelecida.");
         }
         else
         {
             Console.WriteLine("Falha na conexão com o banco.");
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }
Exemple #11
0
        public void SalvarObjeto(GerenciadorFinanceiro.Dominio.Estado objeto)
        {
            string sSqlInsert = "insert into TB_Estado (NomeEstado, Sigla) values (@NomeEstado, @Sigla)";

            try
            {
                Conection.AbrirConexao();
                Conection.Execute(sSqlInsert, objeto.NomeEstado, objeto.SiglaEstado);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível inserir o estado.", ex);
            }
            finally
            {
                Conection.FecharConexao();
            }
        }
Exemple #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Conection obj = new Conection();

            obj.set_ConexionString(ConfigurationManager.ConnectionStrings["MyConexion"].ConnectionString);
            if (Session["usuario"] != null)
            {
                Usuario         usuario  = (Usuario)Session["usuario"];
                TipoUsuario     tipo     = new TipoUsuario();
                PermisosModulos permisos = new PermisosModulos();
                tipo.Descripcion = usuario.Tipo_usuario;
                tipo.Read();
                permisos.ID_tipo_usuario = tipo.ID;
                permisos.Read();
                lblUsuario.InnerHtml = "Hola, " + usuario.Nombre + " " + usuario.Apellido;
                DisponibilidadModulos(permisos.Modulos);
            }
        }
Exemple #13
0
        public void DeletarObjeto(GerenciadorFinanceiro.Dominio.Aluno objeto)
        {
            string sSqlDelete = "Update TB_Aluno set Ativo = 0 where IdAluno = @IdAluno";

            try
            {
                Conection.AbrirConexao();
                Conection.Execute(sSqlDelete, objeto.IdAluno);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível excluir o Aluno.", ex);
            }
            finally
            {
                Conection.FecharConexao();
            }
        }
Exemple #14
0
        public static string ValidMatricExistt(string IdentificadorDOC)
        {
            Boolean PesqPastaAluno = Convert.ToBoolean(ConfigurationManager.AppSettings["PesqPastaAluno"]);

            if (PesqPastaAluno == true)
            {
                try
                {
                    SEClient SeachDoc1 = Conection.GetConnection();

                    searchDocumentReturn searchDocumentReturnT1 = new searchDocumentReturn();
                    searchDocumentFilter searchDocumentFilterT1 = new searchDocumentFilter {
                        IDDOCUMENT = IdentificadorDOC
                    };
                    searchDocumentReturnT1 = SeachDoc1.searchDocument(searchDocumentFilterT1, "", null);
                    Pesq2 = 1;

                    if (searchDocumentReturnT1.RESULTS.Count() > 0)
                    {
                        return("yes");
                    }
                    else
                    {
                        return("NoExist");
                    }
                }
                catch (Exception ex)
                {
                    while (Pesq2 <= 2)
                    {
                        Pesq2++;
                        File.AppendAllText(logpath + @"\" + "log_erro.txt", "\r\n" + DateTime.Now + @" | ValidMatricExistt | " + @" Valida Matricula: " + IdentificadorDOC + @" - " + ex.Message.ToString() + @";");
                        Thread.Sleep(Convert.ToInt32(IntervalReturn));
                        return(ValidMatricExistt(IdentificadorDOC));
                    }
                    //File.AppendAllText(logpath + @"\" + "log_erro.txt", "\r\n" + DateTime.Now + @" | SeachDoc " + ex.Message.ToString() + @";");
                    return("NoConect");
                }
            }
            else
            {
                return("yes");
            }
        }
Exemple #15
0
        public List <GerenciadorFinanceiro.Dominio.Instrutor> BuscarTodos()
        {
            string sSqlSelect = "select * from TB_Instrutor where Ativo = 1 order by Nome";
            List <Dominio.Instrutor> listaInstrutor = new List <GerenciadorFinanceiro.Dominio.Instrutor>();

            try
            {
                Conection.AbrirConexao();
                var reader = Conection.ExecuteReader(sSqlSelect);
                Dominio.Instrutor instrutor;
                while (reader.Read())
                {
                    instrutor                     = new Dominio.Instrutor();
                    instrutor.IdInstrutor         = (int)reader["IdInstrutor"];
                    instrutor.Nome                = (string)reader["Nome"];
                    instrutor.TelefoneResidencial = (string)reader["TelefoneResidencial"];
                    instrutor.TelefoneCelular     = (string)reader["TelefoneCelular"];
                    instrutor.RG                  = (string)reader["RG"];
                    instrutor.CPF                 = (string)reader["CPF"];
                    Dominio.Endereco endereco = new Dominio.Endereco();
                    endereco.Rua         = (string)reader["Rua"];
                    endereco.Numero      = (int)reader["Numero"];
                    endereco.Complemento = (string)reader["Complemento"];
                    endereco.Bairro      = (string)reader["Bairro"];
                    endereco.CEP         = (string)reader["CEP"];
                    endereco.Cidade      = new Repositorio.RepositorioCidade().BuscarObjetoPorId((int)reader["IdCidade"]);
                    instrutor.Endereco   = endereco;
                    instrutor.PathFoto   = (string)reader["PathFoto"];
                    instrutor.Observacao = (string)reader["Observacao"];
                    endereco             = null;
                    listaInstrutor.Add(instrutor);
                    instrutor = null;
                }
                return(listaInstrutor);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível buscar os instrutores.", ex);
            }
            finally
            {
                Conection.FecharConexao();
            }
        }
Exemple #16
0
    public void subePuntosExcedente(int idAsociado, int idCompra, int puntos)
    {
        SubePuntosModel model     = new SubePuntosModel();
        int             status    = 0;
        Conection       con       = new Conection();
        MySqlConnection mySqlConn = con.conectBDPackage();

        try
        {
            List <string> datosPadre = ConsultaPadre(idAsociado);
            model.IdPadre = Convert.ToInt32(datosPadre[0]);
            model.Lado    = datosPadre[1];
            status        = ConsultaStatusPadre(model.IdPadre);

            if (status.Equals(1))
            {
                string strQuery = "INSERT INTO PUNTOSASOCIADOS(ASOCIADO, COMPRA, LADO, PUNTOS, STATUS, PORPAGAR, CORTE, PORPAGARANTERIOR) "
                                  + "VALUES(" + model.IdPadre + ", " + idCompra + ", '" + model.Lado + "', " + puntos + ", 0, " + puntos + ", 0, 0)";
                MySqlCommand queryEx = new MySqlCommand(strQuery, mySqlConn);
                mySqlConn.Open();
                queryEx.ExecuteNonQuery();
                mySqlConn.Dispose();
                mySqlConn.Close();
            }
            if (!(idAsociado.Equals(11)))
            {
                if (!(model.IdPadre.Equals(11)))
                {
                    subePuntosExcedente(model.IdPadre, idCompra, puntos);
                }
            }
        }
        catch (Exception ex)
        {
            _LOGGER.Error("Error al subePuntosExcedente: " + ex.Message);
            throw new Exception("Error SubePuntosAction: " + ex.Message);
        }
        finally
        {
            mySqlConn.Dispose();
            mySqlConn.Close();
            con.closeConection();
        }
    }
        public void SalvarObjeto(GerenciadorFinanceiro.Dominio.Usuario objeto)
        {
            string sSqlInsert = "insert into TB_Usuario (Nome, Email, Telefone, Celular, Username, Senha)" +
                                " values (@Nome, @Email, @Telefone, @Celular, @Username, @Senha)";

            try
            {
                Conection.AbrirConexao();
                Conection.Execute(sSqlInsert, objeto.Nome, objeto.Email, objeto.Telefone, objeto.Celular, objeto.UserName, objeto.Senha);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível Salvar o Usuário.", ex);
            }
            finally
            {
                Conection.FecharConexao();
            }
        }
Exemple #18
0
        public void SalvarObjeto(GerenciadorFinanceiro.Dominio.Banco objeto)
        {
            string sSqlInsert = "insert into TB_Banco (CodigoBanco, Descricao) " +
                                "values (@CodigoBanco, @Descricao)";

            try
            {
                Conection.AbrirConexao();
                Conection.Execute(sSqlInsert, objeto.CodigoBanco, objeto.Descricao);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível Salvar o Banco.", ex);
            }
            finally
            {
                Conection.FecharConexao();
            }
        }
Exemple #19
0
    public List <int> ConsultaDatos(int referencia)
    {
        List <int>      datos     = new List <int>();
        Conection       con       = new Conection();
        MySqlConnection mySqlConn = con.conectBDPackage();

        try
        {
            string strQuery = "SELECT ID, ASOCIADO, INSCRIPCION, PUNTOS "
                              + "FROM COMPRAS WHERE REFERENCIA=" + referencia;

            MySqlCommand queryEx = new MySqlCommand(strQuery, mySqlConn);
            mySqlConn.Open();
            MySqlDataReader reader = queryEx.ExecuteReader();
            while (reader.Read())
            {
                datos.Add(Convert.ToInt32(reader["ID"].ToString()));
                datos.Add(Convert.ToInt32(reader["ASOCIADO"].ToString()));
                if (reader["INSCRIPCION"] != DBNull.Value)
                {
                    datos.Add(Convert.ToInt32(reader["INSCRIPCION"].ToString()));
                }
                else
                {
                    datos.Add(0);
                }
                datos.Add(Convert.ToInt32(reader["PUNTOS"].ToString()));
            }
            reader.Close();
        }
        catch (Exception ex)
        {
            _LOGGER.Error("Error al ConsultaDatos: " + ex.Message);
            throw new Exception("Error ValidaComprasAction: " + ex.Message);
        }
        finally
        {
            mySqlConn.Dispose();
            mySqlConn.Close();
            con.closeConection();
        }
        return(datos);
    }
Exemple #20
0
        public void AtualizarObjeto(GerenciadorFinanceiro.Dominio.Servico objeto)
        {
            string sSqlUpdate = "update TB_Servico set Descricao = @Descricao, Valor = @Valor, " +
                                "Observacao = @Observacao where IdServico = @IdServico";

            try
            {
                Conection.AbrirConexao();
                Conection.Execute(sSqlUpdate, objeto.Descricao, objeto.Valor, objeto.Observacao, objeto.IdServico);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível atualizar o serviço.", ex);
            }
            finally
            {
                Conection.FecharConexao();
            }
        }
Exemple #21
0
        private bool SarchPrimalKey(int id)
        {
            var connection = Conection.ConnectDB();
            var cmd        = new MySqlCommand("select * from enemy;", connection);
            var reader     = cmd.ExecuteReader();
            int enemyId;

            for (var i = 0; reader.Read(); i++)
            {
                enemyId = Convert.ToInt32(reader.GetString("Id"));
                if (id == enemyId)
                {
                    connection.Close();
                    return(true);
                }
            }
            connection.Close();
            return(false);
        }
        public static void Run()
        {
            Conection_Information.Load();
            List <Customer> customers = new List <Customer>();

            Conection_Information.Load();
            Console.WriteLine("Collecting informations from CUSTOMER");
            Console.WriteLine("Conection state: " + Conection.Open());

            MySqlCommand command = new MySqlCommand("select distinct idcustomer, tecnical_visits, forms_answereds from customer", Conection.Connection);

            using (MySqlDataReader data = command.ExecuteReader())
            {
                while (data.Read())
                {
                    customers.Add(new Customer(int.Parse(data["idcustomer"].ToString()),
                                               int.Parse(data["tecnical_visits"].ToString()), int.Parse(data["forms_answereds"].ToString())));
                }
            }

            Console.WriteLine("Coletado " + customers.Count + " suarios");
            foreach (Customer customer in customers)
            {
                Console.WriteLine("Atualizando informações do cliente: " + customer.Id);
                Console.WriteLine("Visitas técnicas: " + customer.Visitas);
                Console.WriteLine("Formulários respondidos: " + customer.Forms_respondidos);
                Console.WriteLine("Média: " + customer.CalculateMedia());
                Console.WriteLine("");

                if (customer.Id == 0)
                {
                    command.CommandText = "update customer set tecnical_visits = 1 where v11_id = " + customer.Id;
                }
                else
                {
                    command.CommandText = "update customer set effectiviness = " + customer.CalculateMedia() + " where idcustomer = " + customer.Id;
                }

                command.Connection = Conection.Connection;
                command.ExecuteNonQuery();
            }
            Console.WriteLine("Atualização finalizada.");
        }
Exemple #23
0
        public static void UpdateTitulo(string IDCATEGORY, string IdDocumento, string titulo)
        {
            try
            {
                SEClient EditDoc    = Conection.GetConnection();
                string   resEditDoc = EditDoc.editDocument(IDCATEGORY, IdDocumento, "", "", titulo, "");
                UpdateTit = 1;
            }
            catch (Exception ex)
            {
                while (UpdateTit <= 2)
                {
                    UpdateTit++;

                    File.AppendAllText(logCriarPastaFuncionario + @"\" + "log_erro_CriarPastaFuncionario.txt", "\r\n" + DateTime.Now + @" | " + ex.Message);
                }
                MessageBox.Show(ex.Message, ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemple #24
0
        public static void UpdateAtributos(string IDDoc, string idattribute, string vlattribute)
        {
            try
            {
                SEClient UpdateAtrib    = Conection.GetConnection();
                string   resUpdateAtrib = UpdateAtrib.setAttributeValue(IDDoc, "", idattribute, vlattribute);

                UpdateAtr = 1;
            }
            catch (Exception ex)
            {
                while (UpdateAtr <= 2)
                {
                    UpdateAtr++;
                    File.AppendAllText(logCriarPastaFuncionario + @"\" + "log_erro_CriarPastaFuncionario.txt", "\r\n" + DateTime.Now + @" |  UpdateAtributos " + ex.Message);
                    MessageBox.Show("UpdateAtributos" + ex.Message, ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Exemple #25
0
 private void KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Delete)
     {
         var con     = Conection.ConnectDB();
         var command = new StringBuilder();
         foreach (DataGridViewRow row in DataGridViewEnemy.SelectedRows)
         {
             command.Append("delete from enemy where ");
             command.Append($"id ={list[row.Index].Id}");
             MySqlCommand cmd =
                 new MySqlCommand(command.ToString(), con);
             cmd.ExecuteNonQuery();
             command.Clear();
         }
         //MessageBox.Show("delete", "");
         con.Close();
     }
 }
Exemple #26
0
        public void SalvarObjeto(GerenciadorFinanceiro.Dominio.Servico objeto)
        {
            string sSqlInsert = "insert into TB_Servico (Descricao, Valor, Observacao, IdTipoServico)" +
                                " values (@Descricao, @Valor, @Observacao, @idTipoServico)";

            try
            {
                Conection.AbrirConexao();
                Conection.Execute(sSqlInsert, objeto.Descricao, objeto.Valor, objeto.Observacao, objeto.Tipo.IdTipoServico);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível salvar o serviço.", ex);
            }
            finally
            {
                Conection.FecharConexao();
            }
        }
        public void SalvarObjeto(GerenciadorFinanceiro.Dominio.Veiculo objeto)
        {
            string sSqlInsert = "insert into TB_Veiculo (Placa, Renavam, Chassi, Ano, Modelo, Cor, Observacao, IdTipoVeiculo, IdModeloVeiculo, PathFoto, Combustivel)" +
                                " values (@Placa, @Renavam, @Chassi, @Ano, @Modelo, @Cor, @Observacao, @IdTipoVeiculo, @IdModeloVeiculo, @PathFoto, @Combustivel)";

            try
            {
                Conection.AbrirConexao();
                Conection.Execute(sSqlInsert, objeto.Placa, objeto.Renavam, objeto.Chassi, objeto.Ano, objeto.Modelo, objeto.Cor, objeto.Observacao, objeto.TipoVeiculo.IdTipoVeiculo, objeto.ModeloVeiculo.IdModeloVeiculo, objeto.PathFoto, objeto.Combustivel);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível inserir o Veículo.", ex);
            }
            finally
            {
                Conection.FecharConexao();
            }
        }
Exemple #28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Conection obj = new Conection();

            obj.set_ConexionString(ConfigurationManager.ConnectionStrings["MyConexion"].ConnectionString);
            if (Session["usuario"] != null)
            {
                Response.Redirect("Inicio.aspx", false);
                Context.ApplicationInstance.CompleteRequest();
            }
            else
            {
                if (Request.QueryString["mensaje"] != null)
                {
                    string mensaje = QueryStringModule.Decrypt(Request.QueryString["mensaje"]);
                    ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + mensaje.Replace(".", "").Replace("%20", " ") + "');", true);
                }
            }
        }
Exemple #29
0
        public void SalvarObjeto(GerenciadorFinanceiro.Dominio.TipoServico objeto)
        {
            string sqlInsert = "insert into TB_TipoServico (Descricao) values (@descricao)";

            try
            {
                Conection.AbrirConexao();
                Conection.Execute(sqlInsert, objeto.Descricao);
                objeto.IdTipoServico = Convert.ToInt32(Conection.ExecuteScalar("Select @@Identity"));
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível salvar o Tipo de serviço solicitado.", ex);
            }
            finally
            {
                Conection.FecharConexao();
            }
        }
Exemple #30
0
    public List <CancelaCompraModel> buscaCompra(string referencia)
    {
        List <CancelaCompraModel> lista = new List <CancelaCompraModel>();

        Conection       con       = new Conection();
        MySqlConnection mySqlConn = con.conectBDPackage();

        try
        {
            string strQuery = "SELECT COMPRAS.ID, COMPRAS.REFERENCIA, ASOCIADOS.ID AS IDASOCIADO, ASOCIADOS.NOMBRE, ASOCIADOS.APPATERNO, ASOCIADOS.APMATERNO, "
                              + "COMPRAS.FECHAORDEN, COMPRAS.TOTAL, COMPRAS.STATUSPAGO, COMPRAS.STATUSENTREGA FROM COMPRAS, ASOCIADOS "
                              + "WHERE COMPRAS.ASOCIADO=ASOCIADOS.ID AND REFERENCIA=" + referencia + " "
                              + "ORDER BY COMPRAS.ID DESC";
            MySqlCommand queryEx = new MySqlCommand(strQuery, mySqlConn);
            mySqlConn.Open();
            MySqlDataReader reader = queryEx.ExecuteReader();
            while (reader.Read())
            {
                CancelaCompraModel model = new CancelaCompraModel();
                model.IdCompra      = reader["ID"].ToString();
                model.Referencia    = reader["REFERENCIA"].ToString();
                model.Asociado      = reader["IDASOCIADO"].ToString() + " " + reader["NOMBRE"].ToString() + " " + reader["APPATERNO"].ToString() + " " + reader["APMATERNO"].ToString();
                model.FechaOrden    = Convert.ToDateTime(reader["FECHAORDEN"].ToString()).ToString("dd/MMMM/yyyy").ToUpper();
                model.Monto         = Convert.ToDouble(reader["TOTAL"].ToString()).ToString("c2");
                model.StatusPago    = reader["STATUSPAGO"].ToString();
                model.StatusEntrega = reader["STATUSENTREGA"].ToString();
                lista.Add(model);
            }
            reader.Close();
        }
        catch (Exception ex)
        {
            _LOGGER.Error("Error al BuscaCompra: " + ex.Message);
            throw new Exception("Error CancelaCompraAction: " + ex.Message);
        }
        finally
        {
            mySqlConn.Dispose();
            mySqlConn.Close();
            con.closeConection();
        }
        return(lista);
    }