private void comensalesToolStripMenuItem_Click(object sender, EventArgs e) { FrmComensal oFrmComensal = new FrmComensal(); oFrmComensal.MdiParent = this; oFrmComensal.Show(); }
/* * public FrmComensalAdd(FrmComensal p_oFrm): this() * { * this.oFrm = p_oFrm; * txtOid.Visible = false; * * txtOid.ReadOnly = false; * txtDenoSoci.ReadOnly = false; * * this.mod = "C"; * } */ public FrmComensalAdd(FrmComensal p_oFrm, int p_oid, string mod) : this() { this.oFrm = p_oFrm; this.oid = p_oid; this.mod = mod; CHelper oCHelper = new CHelper(); oCHelper.FormatearFormularioMantenimientoAdd(this); txtProyecto.Text = Global.des_proy; ClienteBR oBRCliente = new ClienteBR(); DataTable dt = new DataTable(); dt = oBRCliente.ObtenerListadoPorProyecto(Global.oid_proy); cboCliente.DataSource = dt; cboCliente.DisplayMember = "Descripcion"; TipoDocumentoIdentidadBR oBRTipo = new TipoDocumentoIdentidadBR(); dt = oBRTipo.ObtenerListado(); cboTipoDocuIden.DataSource = dt; cboTipoDocuIden.DisplayMember = "Descripcion"; ComensalBR oBRComensal = new ComensalBR(); dt = oBRComensal.ObtenerComedoresAtencion(p_oid); //dgvComedoresAtencion.DataSource = dt; int i = 0; foreach (DataRow dr in dt.Rows) { DataGridViewRow rowDGV = (DataGridViewRow)dgvComedoresAtencion.Rows[0].Clone(); rowDGV.Cells[0].Value = dr.Field <int>(0); rowDGV.Cells[1].Value = dr.Field <string>(1); dgvComedoresAtencion.Rows.Add(rowDGV); i = 1 + 1; } switch (this.mod) { case "C": txtOid.Visible = true; txtOid.ReadOnly = true; txtDescripcion.ReadOnly = false; txtNumeroIdentificacionComedor.ReadOnly = false; txtCargo.ReadOnly = false; break; case "U": txtOid.Visible = true; txtOid.ReadOnly = true; txtDescripcion.ReadOnly = false; ComensalBE oBE = new ComensalBE(); ComensalBR oBR = new ComensalBR(); oBE = oBR.obtenerComensalByOid(oid); txtOid.Text = oBE.oid_come.ToString(); TipoDocumentoIdentidadBE oBETipoDocumento = new TipoDocumentoIdentidadBE(); TipoDocumentoIdentidadBR oBRTipoDocumento = new TipoDocumentoIdentidadBR(); oBETipoDocumento = oBRTipoDocumento.obtenerTipoDocumentoIdentidadByCod(oBE.tipo_cod_tipo_docu_iden); cboTipoDocuIden.SelectedIndex = cboTipoDocuIden.FindStringExact(oBETipoDocumento.val_desc); txtNumeroIdentificacionComedor.Text = oBE.num_iden_come; txtDescripcion.Text = oBE.val_desc; txtNumDocuIden.Text = oBE.val_num_docu_iden; txtCargo.Text = oBE.val_carg; txtTipoCargo.Text = oBE.val_tipo_carg; break; case "R": txtOid.Visible = true; txtOid.ReadOnly = true; txtDescripcion.ReadOnly = true; break; } }