Beispiel #1
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            int    evaluacion = Convert.ToInt32(Session["EvaluacionList"].ToString());
            int    categoria  = Convert.ToInt32(Session["CategoriaId"].ToString());
            string pregunta   = txtPreguntaC.Text;
            bool   existe     = OCKOPreguntas.BuscarPregunta(pregunta);

            try
            {
                if (!existe)
                {
                    tblPreguntas.PrePregunta       = pregunta;
                    tblPreguntas.CodTipoEvaluacion = evaluacion;
                    tblPreguntas.PreDescripcion    = txtDescripcionC.Text;
                    tblPreguntas.CodCategoria      = categoria;
                    preguntas.GuardarPregunta(tblPreguntas);
                    //procedimiento almacenado donde guarda las respuestas
                    spActions.GenerarRespuestas();
                    mensaje = "Pregunta ";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "confirm", "MensajeGuardado('" + mensaje + "');", true);
                    ClientScript.RegisterStartupScript(this.GetType(), "", " setTimeout('window.location.href = window.location.href', 3000);", true);
                }
                else
                {
                    mensaje = "Pregunta ya se encuentra Registrada ";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "confirm", "MensajeError('" + mensaje + "');", true);
                }
            }
            catch (Exception ex)
            {
                Session["ERROR_RRHH"] = ex;
                Response.Redirect("RRHH_ERROR.aspx");
            }
        }
Beispiel #2
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            string categoria = txtNombreCreate.Text;
            bool   existe    = OCKOPreguntas.BuscarPregunta(categoria);

            try
            {
                if (validacionesClass.ValidarCamposVacios(categoria) &&
                    validacionesClass.ValidarCamposVacios(txtDescripcionCreate.Text))
                {
                    if (!existe)
                    {
                        categoriaPre.CatNombre         = categoria;
                        categoriaPre.CatDescripcion    = txtDescripcionCreate.Text;
                        categoriaPre.CodGrupoConceptos = int.Parse(dllGrupoConcepto.SelectedValue);
                        categoriaClass.GuardarCategoria(categoriaPre);
                        mensaje = "Categoria";
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "confirm", "MensajeGuardado('" + mensaje + "');", true);
                        ClientScript.RegisterStartupScript(this.GetType(), "", " setTimeout('window.location.href = window.location.href', 3000);", true);
                    }
                    else
                    {
                        mensaje = "La Categoria Ya Existe !!";
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "confirm", "MensajeError('" + mensaje + "');", true);
                        ClientScript.RegisterStartupScript(this.GetType(), "", " setTimeout('window.location.href = window.location.href', 3000);", true);
                    }
                }
                else
                {
                    mensaje = "No se acepta campos vacios";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "confirm", "MensajeError('" + mensaje + "');", true);
                }
            }
            catch (Exception ex)
            {
                Session["ERROR_RRHH"] = ex;
                Response.Redirect("RRHH_ERROR.aspx");
            }
        }