Example #1
0
        public void modificar()
        {
            string mensaje = "";

            if (txtId.Text == string.Empty)
            {
                mensaje = mensaje + "Introduce la Clave \n";
            }
            if (txtTitulo.Text == string.Empty)
            {
                mensaje = mensaje + "Introduce el titulo \n";
            }
            if (txtCategoria.Text == string.Empty)
            {
                mensaje = mensaje + "Introduce la categoria \n";
            }
            if (txtSinopsis.Text == string.Empty)
            {
                mensaje = mensaje + "Introduce la sinopsis \n";
            }
            if (txtPrologo.Text == string.Empty)
            {
                mensaje = mensaje + "Introduce el prologo \n";
            }


            if (mensaje.Trim().Length == 0)
            {
                BO.Historia            obj     = new BO.Historia();
                Servicios.HistoriaCtrl objCtrl = new Servicios.HistoriaCtrl();
                obj.Id_historia  = Convert.ToInt32(txtId.Text);
                obj.Titulo       = txtTitulo.Text;
                obj.Id_categoria = Convert.ToInt32(txtCategoria.Text);
                obj.Portada_url  = txtUrl.Text;
                obj.Id_sinopsis  = Convert.ToInt32(txtSinopsis.Text);
                obj.Id_prologo   = Convert.ToInt32(txtPrologo.Text);
                string msn = objCtrl.actualizaObj(obj);
                if (msn == "La operación se realizó de manera correcta")
                {
                    Response.Redirect("wfTablaHistoria.aspx");
                }
                else
                {
                    Mensaje(msn);
                }
            }
            else
            {
                Mensaje("Favor de ingresar los siguientes datos:\n" + mensaje);
            }
        }
Example #2
0
        public void DoOpen()
        {
            BO.Historia            oHistoria     = new BO.Historia();
            Servicios.HistoriaCtrl oHistoriaCtrl = new Servicios.HistoriaCtrl();
            //el .length sirve para que cuente cuantos caracteres hay.
            if (txtTitulo.Text.Trim().Length != 0)
            {
                oHistoria.Titulo = txtTitulo.Text.Trim();
            }
            DataTable dt = oHistoriaCtrl.devuelveObj(oHistoria);

            gvHistoria.DataSource = dt;
            gvHistoria.DataBind();
        }
Example #3
0
        public void buscar()
        {
            BO.Historia            obj     = (BO.Historia)Session["frmHistoriaBO"];
            Servicios.HistoriaCtrl objCtrl = new Servicios.HistoriaCtrl();
            DataTable dt = objCtrl.devuelveObj(obj);

            if (dt.Rows.Count != 0)
            {
                txtId.Text        = dt.Rows[0]["id_historia"].ToString();
                txtTitulo.Text    = dt.Rows[0]["titulo"].ToString();
                txtCategoria.Text = dt.Rows[0]["id_categoria"].ToString();
                txtUrl.Text       = dt.Rows[0]["portada_url"].ToString();
                txtSinopsis.Text  = dt.Rows[0]["id_sinopsis"].ToString();
                txtPrologo.Text   = dt.Rows[0]["id_prologo"].ToString();
            }
        }
Example #4
0
        public void eliminar()
        {
            BO.Historia            obj     = (BO.Historia)Session["frmHistoriaBO"];
            Servicios.HistoriaCtrl objCtrl = new Servicios.HistoriaCtrl();
            obj.Id_historia = Convert.ToInt32(txtId.Text.Trim());
            string mensaje = objCtrl.eliminaObj(obj);

            if (mensaje == "La operación se realizó de manera correcta")
            {
                Response.Redirect("wfTablaHistoria.aspx");
            }
            else
            {
                Mensaje(mensaje);
            }
        }