Example #1
0
        private void limparCampos()
        {
            txtDataPrevista.Text    = string.Empty;
            txtDataRetirada.Text    = string.Empty;
            txtNomeEquipamento.Text = string.Empty;
            txtNomeLocador.Text     = string.Empty;
            txtNomeLocatario.Text   = string.Empty;
            txtRALocador.Text       = string.Empty;
            txtRALocatario.Text     = string.Empty;
            txtTipoEquipamento.Text = string.Empty;

            txtNomeLocatarioDevolucao.Text            = string.Empty;
            txtNomeLocatarioNovoEmprestimo.Text       = string.Empty;
            txtProntuarioDevolucao.Text               = string.Empty;
            txtProntuarioLocatarioNovoEmprestimo.Text = string.Empty;

            lstEquipamentoDevolucao.DataSource      = null;
            lstEquipamentoNovoEmprestimo.DataSource = null;



            EmprestimoAberto = new ClsEmprestimoAberto();
            NovoEmprestimo   = new ClsNovoEmprestimo();
            Devolucao        = new ClsDevolucao();
        }
Example #2
0
        private void btnSalvarNovoEmprestimo_Click(object sender, EventArgs e)
        {
            if (txtNomeLocatarioNovoEmprestimo.Text == "" || txtProntuarioLocatarioNovoEmprestimo.Text == "" || txtProntuarioLocatarioNovoEmprestimo.Text == "CV")
            {
                MessageBox.Show("Preencha corretamente os dados do Solicitante", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (lstEquipamentoNovoEmprestimo.SelectedItem == null)
            {
                MessageBox.Show("Selecione o Equipamento", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                NovoEmprestimo = new ClsNovoEmprestimo();
                NovoEmprestimo.ID_Locatario_Saida = pegarID_Locatario(txtNomeLocatarioNovoEmprestimo.Text, txtProntuarioLocatarioNovoEmprestimo.Text);
                if (NovoEmprestimo.ID_Locatario_Saida > 0)
                {
                    NovoEmprestimo.ID_Equipamento       = int.Parse(lstEquipamentoNovoEmprestimo.SelectedValue.ToString());
                    NovoEmprestimo.Dt_Retirada          = dtpRetirada.Text;
                    NovoEmprestimo.Dt_PrevistaDevolucao = dtpPrevista.Text;
                    NovoEmprestimo.ID_Locador_Saida     = ClsLogin.UserLogado.ID_Usuario;
                    result = NovoEmprestimo.Inserir();
                    if (result == "OK")
                    {
                        menssagem("Emprestimo Feito com Sucesso!");

                        log.ID_Usuario = ClsLogin.UserLogado.ID_Usuario;
                        log.Ds_Log     = "Emprestou " + lstEquipamentoNovoEmprestimo.Text + " para " + txtNomeLocatarioNovoEmprestimo.Text;
                        log.Dt_Log     = DateTime.Now;
                        log.Inserir();

                        btnCancelarNovoEmprestimo_Click(null, null);
                    }
                    else
                    {
                        falhaNoBanco(result, "Inserir Emprestimo");
                    }
                    lstTipoNovoEmprestimo.SelectedIndex = 0;
                }
            }
        }