private void btnEliminar_Click(object sender, EventArgs e) { if (dgvComedoresAtencion.RowCount > 0) { dgvComedoresAtencion.Rows.RemoveAt(this.dgvComedoresAtencion.SelectedRows[0].Index); if (mod == "U") { ComensalComedorBR oBRCome = new ComensalComedorBR(); oBRCome.Eliminar(oid, int.Parse(dgvComedoresAtencion.Rows[dgvComedoresAtencion.SelectedRows[0].Index].Cells[0].Value.ToString())); } } }
private void btnGrabar_Click(object sender, EventArgs e) { ComensalBE oBE = new ComensalBE(); ComensalBR oBR = new ComensalBR(); ComensalComedorBE oComeBE = new ComensalComedorBE(); ComensalComedorBR oComeBR = new ComensalComedorBR(); int oid_come_clie; /* * oBE.num_iden_come = txtNumeroIdentificacionComedor.Text; * oBE.val_num_docu_iden = txtNumDocuIden.Text; * * if (this.mod == "C") { * * } * */ oBE.num_iden_come = txtNumeroIdentificacionComedor.Text; oBE.val_num_docu_iden = txtNumDocuIden.Text; oBE.val_desc = txtDescripcion.Text; oBE.val_carg = txtCargo.Text; oBE.val_tipo_carg = txtTipoCargo.Text; DataRowView rv = cboTipoDocuIden.SelectedItem as DataRowView; oBE.tipo_cod_tipo_docu_iden = rv["Codigo"].ToString(); DataRowView rvClie = cboCliente.SelectedItem as DataRowView; oBE.clie_oid_clie = Int32.Parse(rvClie["Codigo"].ToString()); oBE.proy_oid_proy = Global.oid_proy; if (mod == "C") { oBR.Insertar(oBE); } else { oBE.oid_come = Int32.Parse(txtOid.Text); oBR.Actualizar(oBE); } oid_come_clie = oBR.ObtenerOidByDocumentoIdentidad(oBE.val_num_docu_iden); foreach (DataGridViewRow row in dgvComedoresAtencion.Rows) { if (row.Cells[0].Value != null) { oComeBE.oid_come_aten = Int32.Parse(row.Cells[0].Value.ToString()); oComeBE.oid_come_clie = oid_come_clie; oComeBE.clie_oid_clie = oBE.clie_oid_clie; oComeBE.proy_oid_proy = oBE.proy_oid_proy; oComeBR.Insertar(oComeBE); } } oFrm.CargarDGV(); this.Close(); }