Esempio n. 1
0
        public void OrdemPagamentoIncluir_SemCamposObrigatorios()
        {
            OrdemPagamento opTeste = new OrdemPagamento();
            string         Msg     = string.Empty;
            int            idOP    = 0;

            opTeste.lstItens = new List <OrdemPagamentoItem>();
            Msg = bizOrdemPagamento.IncluirOrdemPagamento(opTeste, true, out idOP);

            Assert.AreNotEqual(string.Empty, Msg);
        }
Esempio n. 2
0
        private void btGravar_Click(object sender, EventArgs e)
        {
            string msgRetorno      = string.Empty;
            string acaoSelecionada = string.Empty;
            int    idOP            = 0;

            this.Cursor = Cursors.WaitCursor;

            try
            {
                this.PopularEntidade();

                if (opSelecionada.idOrdemPagamento == 0)
                {
                    msgRetorno      = bizOP.IncluirOrdemPagamento(opSelecionada, origemConsultaOP, out idOP);
                    acaoSelecionada = "Inclusão";
                    opSelecionada.idOrdemPagamento = idOP;
                }
                else
                {
                    msgRetorno      = bizOP.AlterarOrdemPagamento(opSelecionada);
                    acaoSelecionada = "Alteração";
                }

                if (msgRetorno == string.Empty)
                {
                    if (MessageBox.Show(acaoSelecionada + " efetuada com sucesso. Deseja emitir esta Ordem de Pagamento agora?", "Sucesso", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                    {
                        this.EmitirOP();
                    }

                    opSelecionada = bizOP.PesquisarOrdemPagamento(new OrdemPagamento()
                    {
                        idOrdemPagamento = opSelecionada.idOrdemPagamento
                    })[0];
                    opSelecionada.lstItens = new List <OrdemPagamentoItem>();
                    opSelecionada.lstItens = bizOP.PesquisarOrdemPagamentoItem(new OrdemPagamentoItem()
                    {
                        idOrdemPagamento = opSelecionada.idOrdemPagamento
                    });

                    tbNumeroOP.Text = opSelecionada.numeroOP;
                    this.CarregarItens();
                    lbStatus.Text = opSelecionada.Status;
                    this.tabControl1.SelectedIndex = 0;
                }
                else
                {
                    MessageBox.Show("Atenção: " + msgRetorno, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (SqlException)
            {
                MessageBox.Show(helper.RetornarMensagemPadraoErroAcessoBD(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception)
            {
                MessageBox.Show(helper.RetornarMensagemPadraoErroGenerico(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            this.Cursor = Cursors.Default;
        }