Example #1
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            if (this.txtNombre.Text == "")
            {
                MessageBox.Show("Ingrese el nombre");
                return;
            }

            if (this.operacion == "actualizar")
            {
                this.carrera.nombre = this.txtNombre.Text;

                string tabla = "carreras";

                Dictionary<string, string[]> datos = new Dictionary<string, string[]>();
                datos.Add("nombre", new string[] { "=", string.Format("'{0}'", this.carrera.nombre), "" });

                Dictionary<string, string[]> llaves = new Dictionary<string, string[]>();
                llaves.Add("ID", new string[] { "=", this.carrera.id, "" });

                if (controller.actualizar(tabla, datos, llaves))
                {
                    this.Close();
                }
                return;
            }

            Modelos.IModelo carrera = new Modelos.Carrera(this.txtNombre.Text);

            if (controller.registrar(carrera))
            {
                this.Close();
            }
        }
Example #2
0
 public Registrar(string operacion, Dictionary<string, string> carrera)
 {
     InitializeComponent();
     this.controller = new Controladores.Carrera();
     this.operacion = operacion;
     this.carrera = carrera != null ? new Modelos.Carrera(carrera["ID"], carrera["nombre"]) : null;
 }