private void frmAluguel_Load(object sender, EventArgs e) { //Parte de Alugueis CAMADAS.BLL.Clientes bllCli = new CAMADAS.BLL.Clientes(); cmbCliente.DisplayMember = "nome"; cmbCliente.ValueMember = "id"; cmbCliente.DataSource = bllCli.Select(); CAMADAS.BLL.Aluguel bllAlug = new CAMADAS.BLL.Aluguel(); dtgAluguel.DataSource = ""; dtgAluguel.DataSource = bllAlug.Select(); this.dtgAluguel.DefaultCellStyle.Font = new Font("Arial", 12); habilitaControlesAluguel(false); limpaCamposAlug(); //Parte de Itens CAMADAS.BLL.Avioes bllAviao = new CAMADAS.BLL.Avioes(); CAMADAS.BLL.ItensAluguel bllItensAluguel = new CAMADAS.BLL.ItensAluguel(); cmbAviao.DisplayMember = "modelo"; cmbAviao.ValueMember = "id"; cmbAviao.DataSource = bllAviao.Select(); limpaCamposItens(); habilitaControlesItens(false); dtgItem.DataSource = bllItensAluguel.Select(); this.dtgItem.DefaultCellStyle.Font = new Font("Arial", 12); }
private void btnDevolverItem_Click(object sender, EventArgs e) { CAMADAS.BLL.Aluguel bllAluguel = new CAMADAS.BLL.Aluguel(); string msg = "Não há aluguel para devolver"; string modBox = "Devolver"; if (lblItemID.Text != "" && lblItemID.Text != "-1") { msg = "Deseja Devolver o Aviao: " + cmbAviao.Text + " ?"; DialogResult resposta = MessageBox.Show(msg, modBox, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (resposta == DialogResult.Yes) { int id = Convert.ToInt32(lblItemID.Text); bllAluguel.Delete(id); } } else { MessageBox.Show(msg, modBox, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } limpaCamposAlug(); dtgAluguel.DataSource = ""; dtgAluguel.DataSource = bllAluguel.Select(); }
private void btnGravarAlug_Click(object sender, EventArgs e) { CAMADAS.MODEL.Aluguel aluguel = new CAMADAS.MODEL.Aluguel(); aluguel.id = Convert.ToInt32(lblAlugID.Text); aluguel.clienteID = Convert.ToInt32(txtClienteID.Text); aluguel.data = dptData.Value; CAMADAS.BLL.Aluguel bllAlug = new CAMADAS.BLL.Aluguel(); if (lblAlugID.Text == "-1") { bllAlug.Insert(aluguel); } else { bllAlug.Update(aluguel); } dtgAluguel.DataSource = bllAlug.Select(); habilitaControlesAluguel(false); }