Esempio n. 1
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                FacadeAspirante fa = new FacadeAspirante(this);
                if (IsValid)
                {
                    if (btnGuardar.Text == "GUARDAR")
                    {
                        fa.InsertAlumCom(alu_ID);
                        fa.InsertAlumno();
                        enc.Insert(1, alu_ID);

                        Response.Redirect("DatosGenerales.aspx");
                    }
                    else if (btnGuardar.Text == "ACTUALIZAR")
                    {
                        fa.LlamarUpdate(alu_ID);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            if (validar())
            {
                UControl        c  = new UControl();
                FacadeAspirante fa = new FacadeAspirante(this);
                if (btnGuardar.Text == "GUARDAR")
                {
                    Session["alu_ID"] = fa.InsertAlumno();//inserta y al mismo tiempo recupera el id
                    int id = (int)Session["alu_ID"];
                    fa.InsertAlumCom(id);
                    for (int i = 0; i < 7; i++)//cambia el 3 por el SelectedItem.text del comobox que tengas
                    {
                        fa.InsertDatosFamiliares(llenarDatosFamiliares(i), id);
                    }
                    fa.DeleteDatosFamiliaresR(id);
                    c.RegistrarFormulario(1, id);
                }
                else
                {
                    int id = (int)Session["alu_ID"];
                    fa.DeleteDatosFamiliares(id);
                    for (int i = 0; i < 7; i++)//cambia el 3 por el SelectedItem.text del comobox que tengas
                    {
                        fa.InsertDatosFamiliares(llenarDatosFamiliares(i), id);
                    }
                    fa.LlamarUpdate(id);
                }

                Server.Transfer("formulario_1.aspx", true);
            }
            else
            { //Response.Write("<script>alert('Asegurece de haber seleccionado una opcion de todos las listas desplegables') </script>");
            }
        }