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 dtgAluguel_DoubleClick(object sender, EventArgs e) { lblAlugID.Text = dtgAluguel.SelectedRows[0].Cells["id"].Value.ToString(); cmbCliente.SelectedValue = Convert.ToInt32(dtgAluguel.SelectedRows[0].Cells["clienteID"].Value.ToString()); txtClienteID.Text = dtgAluguel.SelectedRows[0].Cells["clienteID"].Value.ToString(); dptData.Value = Convert.ToDateTime(dtgAluguel.SelectedRows[0].Cells["data"].Value.ToString()); btnNovoItem.Enabled = true; CAMADAS.BLL.ItensAluguel bllItem = new CAMADAS.BLL.ItensAluguel(); dtgItem.DataSource = bllItem.SelectByAlug(Convert.ToInt32(lblAlugID.Text)); }
private void btnGravarItem_Click(object sender, EventArgs e) { CAMADAS.MODEL.ItensAluguel item = new CAMADAS.MODEL.ItensAluguel(); item.id = Convert.ToInt32(lblItemID.Text); item.aluguelID = Convert.ToInt32(lblAlugID.Text); item.aviaoID = Convert.ToInt32(txtAviaoID.Text); item.validade = Convert.ToDateTime("01/01/1900"); CAMADAS.BLL.ItensAluguel bllItens = new CAMADAS.BLL.ItensAluguel(); if (lblItemID.Text == "-1") { bllItens.Insert(item); } dtgItem.DataSource = bllItens.SelectByAlug(Convert.ToInt32(lblAlugID.Text)); }