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

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


            if (mensaje.Trim().Length == 0)
            {
                BO.Historia            obj     = new BO.Historia();
                Servicios.HistoriaCtrl objCtrl = new Servicios.HistoriaCtrl();
                obj.Titulo       = txtTitulo.Text.Trim();
                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.creaHistoria(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);
            }
        }