Exemplo n.º 1
0
        private bool VisualizarItensDevolvidos()
        {
            bool existsDate = false;

            SqlConnection conexao = new SqlConnection(stringConn);

            if (FormaPagamento.ToUpper() == "PARCIAL")
            {
                _sql = "Select * from HistoricoDevolucao where Id_PagamentoParcial = @IdPagamento";
            }
            else if (FormaPagamento.ToUpper() == "MISTO")
            {
                _sql = "Select * from HistoricoDevolucao where Id_PagamentoMisto = @IdPagamento";
            }
            else
            {
                return(false);
            }


            SqlCommand comando = new SqlCommand(_sql, conexao);

            comando.Parameters.AddWithValue("@IdPagamento", idPagamento);

            try
            {
                conexao.Open();
                SqlDataReader dr = comando.ExecuteReader();
                if (dr.Read())
                {
                    existsDate = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Caixa Fácil", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conexao.Close();
            }

            return(existsDate);
        }
Exemplo n.º 2
0
        private DataTable ListaItensDevolvidos()
        {
            SqlConnection conexao = new SqlConnection(stringConn);

            if (FormaPagamento.ToUpper() == "PARCIAL")
            {
                _sql = "Select " + FilterRows() + " Produto.Id_Produto, Produto.Descricao, HistoricoDevolucao.ValorProduto, HistoricoDevolucao.qtdItens, HistoricoDevolucao.DataDevolucao from HistoricoDevolucao inner join Produto on Produto.Id_Produto = HistoricoDevolucao.Id_Produto where HistoricoDevolucao.Id_PagamentoParcial = @IdPagamento";
            }
            else if (FormaPagamento.ToUpper() == "MISTO")
            {
                _sql = "Select " + FilterRows() + " Produto.Id_Produto, Produto.Descricao, HistoricoDevolucao.ValorProduto, HistoricoDevolucao.qtdItens, HistoricoDevolucao.DataDevolucao from HistoricoDevolucao inner join Produto on Produto.Id_Produto = HistoricoDevolucao.Id_Produto where HistoricoDevolucao.Id_PagamentoMisto = @IdPagamento";
            }

            SqlDataAdapter adapter = new SqlDataAdapter(_sql, conexao);

            adapter.SelectCommand.Parameters.AddWithValue("@IdPagamento", IdPagamento);
            DataTable Tabela = new DataTable();

            adapter.Fill(Tabela);
            return(Tabela);
        }