示例#1
0
        private void frmAluguel_Load(object sender, EventArgs e)
        {
            CAMADAS.BLL.Aluguel bllAlu = new CAMADAS.BLL.Aluguel();
            dgvAluguel.DataSource = "";
            dgvAluguel.DataSource = bllAlu.Select();

            CAMADAS.DAL.Clientes dalCli = new CAMADAS.DAL.Clientes();
            cmbCliente.DisplayMember = "nome";
            cmbCliente.ValueMember   = "id";
            cmbCliente.DataSource    = dalCli.Select();

            CAMADAS.BLL.Cacambas bllCacambas = new CAMADAS.BLL.Cacambas();
            cmbCacamba.DisplayMember = "tipo";
            cmbCacamba.ValueMember   = "id";
            cmbCacamba.DataSource    = bllCacambas.Select();
        }
示例#2
0
        private void btnGravar_Click(object sender, EventArgs e)
        {
            CAMADAS.MODEL.Aluguel aluguel = new CAMADAS.MODEL.Aluguel();
            aluguel.id         = Convert.ToInt32(lblAluID.Text);
            aluguel.cliente_id = Convert.ToInt32(cmbCliente.SelectedValue.ToString());
            aluguel.date       = dtpData.Value;

            CAMADAS.BLL.Aluguel bllAlu = new CAMADAS.BLL.Aluguel();
            if (lblAluID.Text == "-1")
            {
                bllAlu.Insert(aluguel);
            }

            else
            {
                bllAlu.Update(aluguel);
            }

            List <CAMADAS.MODEL.Aluguel> lstAlu = bllAlu.Select();

            dgvAluguel.DataSource = "";
            dgvAluguel.DataSource = lstAlu;
        }