public void ExecutarDevolucao() { string messagem = "Tem Certeza que deseja Executar essa Devolução ?" + dataGridViewLista.CurrentRow.Cells["Nome_Livro"].Value.ToString();; string captionn = "Alerta"; MessageBoxButtons buttonss = MessageBoxButtons.YesNo; DialogResult resultt; resultt = MessageBox.Show(messagem, captionn, buttonss); if (resultt == System.Windows.Forms.DialogResult.Yes) { EmprestimoAluno objetoCT = new EmprestimoAluno { IdEmprestimo = Convert.ToInt32(dataGridViewLista.CurrentRow.Cells["IdEmprestimo"].Value), //pega o valor do id emp IdLivro = Convert.ToInt32(dataGridViewLista.CurrentRow.Cells["Id_Livro"].Value), //pega o valor do id livro Id_Aluno = Convert.ToInt32(dataGridViewLista.CurrentRow.Cells["IdAluno"].Value), }; CN_EmprestimoAluno objetoCN = new CN_EmprestimoAluno(); objetoCN.Devolucao(objetoCT); ExibirConsultaAluno(); MostrarEmprestimoUnico(); checkBox1.Checked = false; MessageBox.Show("Devolução efetuada com sucesso"); } }
public void ExecutarRenovacao() { CN_EmprestimoAluno objeto = new CN_EmprestimoAluno(); dataGridViewLista.DataSource = objeto.ExecutarRenovacao(idEmprestimo); MostrarEmprestimoUnico(); }
private void buttonDevolver_Click(object sender, EventArgs e) { string messagem = "Tem Certeza que deseja Executar essa Devolução ?" + dataGridViewLista.CurrentRow.Cells["Nome_Livro"].Value.ToString();; string captionn = "Alerta"; MessageBoxButtons buttonss = MessageBoxButtons.YesNo; DialogResult resultt; resultt = MessageBox.Show(messagem, captionn, buttonss); if (resultt == System.Windows.Forms.DialogResult.Yes) { int contagem = dataGridViewLista.Rows.Count; for (int i = 0; i < contagem; i++) { if (Convert.ToBoolean(dataGridViewLista.Rows[i].Cells["Column1"].Value) == true) { EmprestimoAluno objetoCT = new EmprestimoAluno { IdEmprestimo = Convert.ToInt32(dataGridViewLista.Rows[i].Cells["IdEmprestimo"].Value), //pega o valor do id emp IdLivro = Convert.ToInt32(dataGridViewLista.Rows[i].Cells["Id_Livro"].Value), //pega o valor do id livro Id_Aluno = Convert.ToInt32(dataGridViewLista.Rows[i].Cells["IdAluno"].Value), }; CN_EmprestimoAluno objetoCN = new CN_EmprestimoAluno(); objetoCN.Devolucao(objetoCT); } } ExibirConsultaAluno(); MostrarEmprestimoUnico(); checkBox1.Checked = false; MessageBox.Show("Devolução efetuada com sucesso"); } }
/* private void timer1_Tick(object sender, EventArgs e) * { * * for (int i = 0; i < dataGridView1.Rows.Count; i++) * { * if (Convert.ToString( dataGridView1.Rows[i].Cells["Descricao"].Value) == "Em Andamento" && (Convert.ToDateTime(dataGridView1.Rows[i].Cells["Column4"].Value) < Convert.ToDateTime(DateTime.Now.ToString("dd/MM/yyyy")))) * { * * * EmprestimoAluno objetoCT = new EmprestimoAluno * { * IdEmprestimo = Convert.ToInt32(dataGridView1.Rows[i].Cells["IdEmprestimo"].Value),//pega o valor do id emp * * }; * * CN_EmprestimoAluno objetoCN = new CN_EmprestimoAluno(); * objetoCN.AtualizaDataVencimento(objetoCT); * * * } * } * //timer1.Enabled = false; * //MostrarEmprestimos(); * }*/ public void Atualizatudo() { MostrarEmprestimos(); for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (Convert.ToString(dataGridView1.Rows[i].Cells["Descricao"].Value) == "Em Andamento" && (Convert.ToDateTime(dataGridView1.Rows[i].Cells["DataSaida"].Value) < Convert.ToDateTime(DateTime.Now.ToString("dd/MM/yyyy")))) { EmprestimoAluno objetoCT = new EmprestimoAluno { IdEmprestimo = Convert.ToInt32(dataGridView1.Rows[i].Cells["idEmprestimo"].Value),//pega o valor do id emp }; CN_EmprestimoAluno objetoCN = new CN_EmprestimoAluno(); objetoCN.AtualizaDataVencimento(objetoCT); } } }
//exibe os dados dos emprestimos do usuario selecionado public void MostrarEmprestimoUnico() { CN_EmprestimoAluno objeto = new CN_EmprestimoAluno(); dataGridViewLista.DataSource = objeto.MostrarEmprestimoUnico(idAlunos); }
//exibir nomes que estao com emprestimos pendentes public void ExibirConsultaAluno() { CN_EmprestimoAluno objeto = new CN_EmprestimoAluno(); dataGridViewAluno.DataSource = objeto.ConsultaralunosDevolu(); }
//Cadastrar Registro private void btnEnviar_Click(object sender, EventArgs e) { if (dataGridView1.Rows.Count > 0) { string retorno = null; var dataRowView = this.comboBox1.SelectedItem as DataRowView; //combobox usuario var dataRowViewLivros = this.comboBox2.SelectedItem as DataRowView; //combo box livros string messagem = "Tem Certeza que deseja Executar esse empréstimo?" + dataRowViewLivros.Row.ItemArray[1]; string captionn = "Alerta"; MessageBoxButtons buttonss = MessageBoxButtons.YesNo; DialogResult resultt; resultt = MessageBox.Show(messagem, captionn, buttonss); if (resultt == System.Windows.Forms.DialogResult.Yes) { for (int i = 0; i < dataGridView1.Rows.Count; i++) { Conexao.LimparParametros(); try { EmprestimoAluno objetoCT = new EmprestimoAluno { Id_Aluno = Convert.ToInt32(dataRowView.Row.ItemArray[0]),//pegar id do usuario IdOperacao = 1, IdSituacao = 1, IdEmprestimo = 0, IdLivro = Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value.ToString()), Id_FuncionarioCadastro = UserLoginCache.Id_Funcionario, // DataAtual = DateTime.ParseExact(dateTimePicker1.Text, "dd/MM/yyyy", null), DataAtual = Convert.ToDateTime(dateTimePicker1.Text), DataSaida = Convert.ToDateTime(dateTimePicker2.Text), }; CN_EmprestimoAluno objetoCN = new CN_EmprestimoAluno(); retorno = objetoCN.InserirEmprestimoAluno(objetoCT); } catch (Exception) { MessageBox.Show("Codigo ou Usuario Indisponivel. "); } } try { int IdProfessor = Convert.ToInt32(retorno); if (retorno != null) { MessageBox.Show($"Empréstimo efetuado com sucesso"); } //atualiza os forms dataGridView1.Rows.Clear(); ComboAluno(); ComboLivro(); // this.Close(); } catch (FormatException) { //condição para verificar os emprestimos pendentes string message = retorno; string caption = "Alerta"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result; result = MessageBox.Show(message, caption, buttons); if (result == System.Windows.Forms.DialogResult.Yes) { new EmprestimosPendentes().ShowDialog(); } //MessageBox.Show(retorno); //throw; } } } else { MessageBox.Show("Selecione no minimo um item para inserir o empréstimo"); } }
public void MostrarEmprestimos() { CN_EmprestimoAluno objeto = new CN_EmprestimoAluno(); dataGridView1.DataSource = objeto.MostrarEmprestimosOrdem(0); }