コード例 #1
0
        public void CarregarComboListTipoPagamento(ComboBox cbx)
        {
            Dictionary <string, int?> lista         = new Dictionary <string, int?>();
            TipoPagamentoCollection   TipoPagamento = new TipoPagamentoCollection();

            TipoPagamento = PesquisarTipoPagamento((int?)null, null, (bool?)null);
            foreach (TipoPagamento item in TipoPagamento)
            {
                lista.Add(item.Descricao, item.IDTipoPagamento);
            }
            cbx.ValueMember   = "Value";
            cbx.DisplayMember = "key";
            cbx.DataSource    = new BindingSource(lista, null);
            cbx.DropDownStyle = ComboBoxStyle.DropDownList;
            cbx.SelectedIndex = 0;
        }
コード例 #2
0
        public TipoPagamentoCollection PesquisarTipoPagamento(int?IDTipoPagamento, string Descricao, bool?ativo)
        {
            TipoPagamentoCollection TipoPagamentoCollection = new TipoPagamentoCollection();

            AcessoDados.LimparParametro();
            AcessoDados.AdicionarParametro("@INintIDTipoPagamento", IDTipoPagamento);
            AcessoDados.AdicionarParametro("@INvchDescricao", Descricao);
            AcessoDados.AdicionarParametro("@INbitAtivo", ativo);
            using (DataTable dtbRegistro = AcessoDados.GetDataTable("uspPesquisarTipoPagamento", CommandType.StoredProcedure))
            {
                foreach (DataRow item in dtbRegistro.Rows)
                {
                    TipoPagamentoCollection.Add(CarregarItem(item));
                }
            }
            return(TipoPagamentoCollection);
        }
コード例 #3
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            object[] args = (object[])e.Argument;

            if (args[0].Equals("ConsultarTipoPagamento"))
            {
                int resultado;
                if (int.TryParse(args[1].ToString(), out resultado))
                {
                    this.tipoPagamentoCollection = negTipoPagamento.PesquisarTipoPagamento(resultado, string.Empty, (bool?)args[2]);
                }
                else
                {
                    this.tipoPagamentoCollection = negTipoPagamento.PesquisarTipoPagamento((int?)null, args[1].ToString(), (bool?)args[2]);
                }
            }
            else if (args[0].Equals("ExcluirTipoPagamento"))
            {
                this.mensagembackgroundWor = negTipoPagamento.Excluir(args[1] as TipoPagamento);
            }
        }