/*Crear un nuevo atributo*/ private void btn_Aceptar_Click(object sender, EventArgs e) { if (tb_Nombre != null || tb_Nombre.Text != "") { if (cb_TipoDato.Text != "") { atributo = new Atributo(tb_Nombre.Text, Convert.ToChar(cb_TipoDato.Text), Convert.ToInt16(tb_Longitud.Text), Convert.ToInt16(cb_Indice.Text)); entidades.ElementAt(pos).agregarAtributo(atributo); //Agregamos la entidad seleccionada. //MessageBox.Show(entidades.ElementAt(pos).atributos.Count.ToString()); if (fa.agregaAtributoArchivo(nombreArchivo, pos, entidades)) { llenaDataG(); } else { MessageBox.Show("Ocurrio un error"); } } else { MessageBox.Show("Verifica si los campos estan completos."); } } else { MessageBox.Show("Verifica si los campos estan completos."); } tb_Nombre.Text = ""; tb_Longitud.Text = ""; cb_Indice.Text = ""; cb_TipoDato.Text = ""; }
/*Crear un nuevo atributo*/ private void btn_Aceptar_Click(object sender, EventArgs e) { if (nombreRepetido(tb_Nombre.Text)) { MessageBox.Show("El nombre esta repetido, no se agregara."); return; } if (atributoForanea != null) { if (atributoForanea.string_Nombre == "ERR") { MessageBox.Show("ERR atributo"); return; } } if (Convert.ToInt16(cb_Indice.Text) == 8) { atributo = new Atributo(tb_Nombre.Text, atributoForanea.tipo_Dato, atributoForanea.longitud_Tipo, Convert.ToInt16(cb_Indice.Text)); fa.dirIndiceForanea = entidades[posForanea].direccion_Entidad; entidades.ElementAt(pos).agregarAtributo(atributo); //Agregamos la entidad seleccionada. //MessageBox.Show(entidades.ElementAt(pos).atributos.Count.ToString()); if (fa.agregaAtributoArchivo(nombreArchivo, pos, entidades)) { llenaDataG(); } else { MessageBox.Show("Ocurrio un error"); } } else if (tb_Nombre != null || tb_Nombre.Text != "") { if (cb_TipoDato.Text != "") { atributo = new Atributo(tb_Nombre.Text, Convert.ToChar(cb_TipoDato.Text), Convert.ToInt16(tb_Longitud.Text), Convert.ToInt16(cb_Indice.Text)); entidades.ElementAt(pos).agregarAtributo(atributo); //Agregamos la entidad seleccionada. //MessageBox.Show(entidades.ElementAt(pos).atributos.Count.ToString()); if (fa.agregaAtributoArchivo(nombreArchivo, pos, entidades)) { llenaDataG(); } else { MessageBox.Show("Ocurrio un error"); } } else { MessageBox.Show("Verifica si los campos estan completos."); } } else { MessageBox.Show("Verifica si los campos estan completos."); } botonesVisibles(true); tb_Nombre.Text = ""; tb_Longitud.Text = ""; cb_Indice.Text = ""; cb_TipoDato.Text = ""; }