コード例 #1
0
        /// <summary>
        /// Modifica atributo al darle doble click en el datagrid de atributos
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgAtributos_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            Entidad ent = null;

            for (int i = 0; i < ddd.EntidadesOrden.Count && (ent = ddd.EntidadesOrden[i]).sNombre != lblEntidad.Text; i++)
            {
                ;
            }
            if (ent != null)
            {
                Atributo aMod = ent.Atrib[e.RowIndex];
                using (NuevoAtributo n = new NuevoAtributo(aMod.sNombre, aMod.Tipo, aMod.Longitud, aMod.TipoIndice, ent))
                {
                    if (n.ShowDialog() == DialogResult.OK)
                    {
                        string nomb = n.Nombre_atributo;
                        if (nomb != "")
                        {
                            while (nomb.Length < 30)
                            {
                                nomb += ' ';
                            }
                            aMod.Nombre = nomb.ToCharArray(0, 30);
                        }
                        aMod.Tipo       = (n.Tipo == 0) ? 'C' : 'E';
                        aMod.Longitud   = n.Long;
                        aMod.TipoIndice = n.TipoIndex;
                        ddd.sobreescribAtributo(aMod);
                        AtribEnt(ent);
                    }
                }
            }
        }
コード例 #2
0
        private void nuevoAtributoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NuevoAtributo nuevo = new NuevoAtributo(ddd.EntidadesOrden);

            if (nuevo.ShowDialog() == DialogResult.OK)
            {
                Entidad ent = ddd.nuevoAtributo(nuevo.Nombre_atributo, nuevo.Tipo, nuevo.Long, nuevo.Index, nuevo.TipoIndex);
                AtribEnt(ent);
                lblEntidad.Text = ent.sNombre;
                actualizaEnt();
            }
        }