Exemplo n.º 1
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            /*
             * if(Page.IsPostBack)
             * {
             *  ServicioEquipoComputoNegocio servicioequiponeg = new ServicioEquipoComputoNegocio();
             *  ServicioEquipoComputo servicioequipo = new ServicioEquipoComputo();
             *  servicioequipo.iIdServicioEquipoComputo = Convert.ToInt32(lblID.Text);
             *  servicioequipo.iIdServicio = Convert.ToInt32(dropListServicio.SelectedValue.ToString());
             *  servicioequipo.tDescripcion = txtObservaciones.Text;
             *  servicioequiponeg.modificaServicioEC(servicioequipo);
             *  Response.Redirect(Page.ResolveUrl("~/GestionEquipos/Servicios/VerServiciosEquipo.aspx"));
             * }
             */

            CarreraNegocio carrera    = new CarreraNegocio();
            Carrera        objCarrera = new Carrera();

            List <Carrera> lstCarreras = new List <Carrera>();

            Boolean bInsertar = true;

            objCarrera.Nombre   = txtcNombre.Text;
            objCarrera.idInstit = Convert.ToInt32(ddlInstitucion.SelectedValue.ToString());

            lstCarreras = carrera.obtenerCarrera();

            foreach (Carrera nombrecarrera in lstCarreras)
            {
                try {
                    if (nombrecarrera.Nombre == objCarrera.Nombre)
                    {
                        bInsertar = false;
                        throw new Exception("Ya existe una carrera con ese nombre.");
                    }
                }
                catch (Exception ex)
                {
                    /*Response.Write("<script LANGUAGE='JavaScript' >alert('Login Successful')</script>");*/
                    /*this.Page.Response.Write("<script language='JavaScript'>window.alert('" + ex.Message + "');</script>");*/

                    /* Console.WriteLine(ex.Message); */
                }
            }

            if (bInsertar == true)
            {
                carrera.insertarCarrera(objCarrera);
            }



            Response.Redirect("WebCarrera.aspx");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CarreraNegocio carreraNegocio = new CarreraNegocio();

                try
                {
                    GridViewCarrera.DataSource = carreraNegocio.obtenerCarrera();
                    GridViewCarrera.DataBind();
                }
                catch (Exception ex)
                {
                    throw new Exception("error de la consulta" + ex.Message);
                }
            }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                CarreraNegocio carrera = new CarreraNegocio();

                Carrera objCarrera = new Carrera();

                objCarrera.idCarrera = Convert.ToInt32(lblID.Text);
                objCarrera.Nombre    = txtcNombre.Text;
                objCarrera.idInstit  = Convert.ToInt32(ddlInstitucion.SelectedValue.ToString());

                carrera.eliminaCarrera(objCarrera);

                Response.Redirect("WebCarrera.aspx");
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            InstitucionNegocio _objneg    = new InstitucionNegocio();
            CarreraNegocio     carreraNeg = new CarreraNegocio();
            Carrera            objCarrera = new Carrera();

            if (!Page.IsPostBack)
            {
                ddlInstitucion.DataSource     = _objneg.obtenerInstitucion();
                ddlInstitucion.DataValueField = "idInstitucion";
                ddlInstitucion.DataTextField  = "NombreInstitucion";
                ddlInstitucion.DataBind();
                GridViewRow datos = (GridViewRow)Session["gvr"];
                lblID.Text      = datos.Cells[0].Text;
                txtcNombre.Text = datos.Cells[1].Text;
                ddlInstitucion.Items.FindByValue(datos.Cells[2].Text.ToString()).Selected = true;

                objCarrera = carreraNeg.buscaCarrera(Convert.ToInt32(datos.Cells[0].Text), Convert.ToInt32(datos.Cells[2].Text));
                if (objCarrera.cancelado == true)
                {
                    chbCancelado.Checked = true;
                }
                else
                {
                    chbCancelado.Checked = false;
                }

                if (objCarrera.lValid == true)
                {
                    chbValido.Checked = true;
                }
                else
                {
                    chbValido.Checked = false;
                }
            }
        }
Exemplo n.º 5
0
        protected void btnAceptar_Click(object sender, EventArgs e)
        {
            //Antes de agregar al docente, verifica las validaciones
            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }
            Carrera        carrera = new Carrera();
            CarreraNegocio negocio = new CarreraNegocio();

            carrera.Nombre = txtNombre.Text;

            if (negocio.AltaCarrera(carrera))
            {
                Session.Add("Exito", "Carrera agregada con Exito!");
                Response.Redirect("PaginaExito.aspx");
            }
            else
            {
                Session.Add("Error", "Hubo un error cargando la Carrera");
                Response.Redirect("PaginaError.aspx");
            }
        }
Exemplo n.º 6
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            /*if (Page.IsPostBack)
             * {
             *
             *  InstitucionNegocio institucionNegocio = new InstitucionNegocio();
             *  Institucion objInstitucion = new Institucion();
             *
             *
             *  objInstitucion.idInstitucion = Convert.ToInt32(lblID.Text);
             *  objInstitucion.NombreInstitucion = txtcNombre.Text;
             *  objInstitucion.Direccion = txtcDireccion.Text;
             *  institucionNegocio.modificaInstitucion(objInstitucion);
             *
             *  Response.Redirect("WebCarrera.aspx");
             * }*/
            CarreraNegocio carrera = new CarreraNegocio();

            Carrera objCarrera = new Carrera();

            List <Carrera> lstCarreras = new List <Carrera>();
            Boolean        bInsertar   = true;

            objCarrera.idCarrera = Convert.ToInt32(lblID.Text);
            objCarrera.Nombre    = txtcNombre.Text;
            objCarrera.idInstit  = Convert.ToInt32(ddlInstitucion.SelectedValue.ToString());
            if (chbCancelado.Checked)
            {
                objCarrera.cancelado = true;
            }
            else
            {
                objCarrera.cancelado = false;
            }

            if (chbValido.Checked)
            {
                objCarrera.lValid = true;
            }
            else
            {
                objCarrera.lValid = false;
            }

            foreach (Carrera nombrecarrera in lstCarreras)
            {
                try
                {
                    if ((nombrecarrera.Nombre == objCarrera.Nombre) && (objCarrera.idCarrera != nombrecarrera.idCarrera))
                    {
                        bInsertar = false;
                        throw new Exception("Ya existe una carrera con ese nombre.");
                    }
                }
                catch (Exception ex)
                {
                    /*Response.Write("<script LANGUAGE='JavaScript' >alert('Login Successful')</script>");*/
                    /*this.Page.Response.Write("<script language='JavaScript'>window.alert('" + ex.Message + "');</script>");*/

                    /* Console.WriteLine(ex.Message); */
                }
            }

            if (bInsertar == true)
            {
                carrera.insertarCarrera(objCarrera);
            }

            /* carrera.insertaCarrera(objCarrera); */
            Response.Redirect("WebCarrera.aspx");
        }