コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (Request.QueryString["op"] != null && Request.QueryString["op"] == "0")
         {
             if (Request.QueryString["id"] != null)
             {
                 string       AuxID = Request.QueryString["id"].ToString();
                 EM_Preguntas Datos = new EM_Preguntas {
                     Conexion = Comun.Conexion, IDEncuesta = AuxID
                 };
                 EM_PreguntasNegocio PN = new EM_PreguntasNegocio();
                 ListaPregunta   = PN.ObtenerPreguntasXID(Datos);
                 this.IDEncuesta = AuxID;
             }
         }
         else if (Request.QueryString["op"] != null && Request.QueryString["op"] == "3")
         {
             if (Request.QueryString["id"] != null && Request.QueryString["id2"] != null)
             {
                 string AuxID  = Request.QueryString["id"];
                 string AuxID2 = Request.QueryString["id2"];
                 this.IDEncuesta = AuxID2;
                 //int.TryParse(Request.QueryString["id"], out AuxID);
                 EM_Preguntas Datos = new EM_Preguntas {
                     Conexion = Comun.Conexion, IDPreguntas = AuxID, IDEncuesta = AuxID2, IDUsuario = Comun.IDUsuario
                 };
                 EM_PreguntasNegocio CN = new EM_PreguntasNegocio();
                 CN.EliminarPreguntasXID(Datos);
                 if (Datos.Completado)
                 {
                     string ScriptError = DialogMessage.Show(TipoMensaje.Success, "Registro eliminado correctamente.", "Información", ShowMethod.FadeIn, HideMethod.FadeOut, ToastPosition.TopFullWidth, true);
                     ScriptManager.RegisterStartupScript(this, typeof(Page), "popup", ScriptError, true);
                     Response.Redirect("frmPreguntas.aspx?op=0&id=" + this.IDEncuesta.ToString(), false);
                 }
                 else
                 {
                     string ScriptError = DialogMessage.Show(TipoMensaje.Error, "Error al guardar los datos.", "Error", ShowMethod.FadeIn, HideMethod.FadeOut, ToastPosition.TopFullWidth, true);
                     ScriptManager.RegisterStartupScript(this, typeof(Page), "popup", ScriptError, true);
                 }
             }
         }
         if (!IsPostBack)
         {
         }
         else
         {
         }
         if (Request.QueryString["errorMessage"] != null)
         {
             string ScriptError = DialogMessage.Show(TipoMensaje.Error, "Error al cargar los datos. Intenté nuevamente", "Error", ShowMethod.FadeIn, HideMethod.FadeOut, ToastPosition.TopFullWidth, true);
             ScriptManager.RegisterStartupScript(this, typeof(Page), "popup", ScriptError, true);
         }
     }
     catch (Exception ex)
     {
         Response.Redirect("PageError.aspx?errorNumber=" + ex.HResult);
     }
 }
コード例 #2
0
 private void Guardar(bool NuevoRegistro, string ID, string IDEncuesta, string Nombre, int IDTipoPRe, int orden)
 {
     try
     {
         EM_Preguntas Datos = new EM_Preguntas
         {
             NuevoRegistro  = NuevoRegistro,
             IDPreguntas    = ID,
             IDEncuesta     = IDEncuesta,
             NombrePregunta = Nombre,
             IDTipoPregunta = IDTipoPRe,
             Orden          = orden,
             Conexion       = Comun.Conexion,
             IDUsuario      = User.Identity.Name
         };
         EM_PreguntasNegocio EN = new EM_PreguntasNegocio();
         EN.ACPreguntas(Datos);
         if (Datos.Completado)
         {
             this.IDEncuesta = Datos.IDEncuesta.ToString();
             hf2.Value       = Datos.IDEncuesta.ToString();
             Response.Redirect("frmPreguntas.aspx?op=0&id=" + Datos.IDEncuesta.ToString(), false);
         }
         else
         {
             if (Datos.Resultado == 3)
             {
                 this.IDEncuesta = Datos.IDEncuesta.ToString();
                 hf2.Value       = Datos.IDEncuesta.ToString();
                 string ScriptError = DialogMessage.Show(TipoMensaje.Error, "El número de orden ya exite para esta encuestas.", "Error", ShowMethod.FadeIn, HideMethod.FadeOut, ToastPosition.TopFullWidth, true);
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "popup", ScriptError, true);
             }
             else if (Datos.Resultado == 2)
             {
                 this.IDEncuesta = Datos.IDEncuesta.ToString();
                 hf2.Value       = Datos.IDEncuesta.ToString();
                 string ScriptError = DialogMessage.Show(TipoMensaje.Error, "Verifique número de orden ya exite para esta encuestas.", "Error", ShowMethod.FadeIn, HideMethod.FadeOut, ToastPosition.TopFullWidth, true);
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "popup", ScriptError, true);
             }
             else
             {
                 this.IDEncuesta = Datos.IDEncuesta.ToString();
                 hf2.Value       = Datos.IDEncuesta.ToString();
                 string ScriptError = DialogMessage.Show(TipoMensaje.Error, "Error al guardar los datos.", "Error", ShowMethod.FadeIn, HideMethod.FadeOut, ToastPosition.TopFullWidth, true);
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "popup", ScriptError, true);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #3
0
 private void Guardar(string ID2, string ID, string Titulores, string periodoDatos, string tituloporcen, string explicacion)
 {
     try
     {
         EM_Preguntas Datos = new EM_Preguntas
         {
             IDEncuesta       = ID2,
             IDPreguntas      = ID,
             TituloRespuesta  = Titulores,
             PeriodoDatos     = periodoDatos,
             TituloPorcentaje = tituloporcen,
             Explicacion      = explicacion,
             Conexion         = Comun.Conexion,
             IDUsuario        = User.Identity.Name
         };
         EM_PreguntasNegocio EN = new EM_PreguntasNegocio();
         EN.ActualizarCamposPreguntasXID(Datos);
         if (Datos.Completado)
         {
             this.IDEncuesta = Datos.IDEncuesta;
             hf2.Value       = Datos.IDEncuesta;
             Response.Redirect("frmPreguntas.aspx?op=0&id=" + Datos.IDEncuesta, false);
         }
         else
         {
             this.IDEncuesta = Datos.IDEncuesta;
             hf2.Value       = Datos.IDEncuesta;
             string ScriptError = DialogMessage.Show(TipoMensaje.Error, "Error al guardar los datos.", "Error", ShowMethod.FadeIn, HideMethod.FadeOut, ToastPosition.TopFullWidth, true);
             ScriptManager.RegisterStartupScript(this, typeof(Page), "popup", ScriptError, true);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["op"] != null)
         {
             if (Request.QueryString["op"] == "4")
             {
                 if (Request.QueryString["id"] != null && Request.QueryString["id2"] != null)
                 {
                     string ID  = Request.QueryString["id"].ToString();
                     string ID2 = Request.QueryString["id2"].ToString();
                     this.IDEncuesta = ID2;
                     hf2.Value       = ID2.ToString();
                     if (Request.QueryString["id"].ToString() == ID)
                     {
                         //Obtener los datos y dibujarlos.
                         EM_Preguntas DatosAux = new EM_Preguntas {
                             Conexion = Comun.Conexion, IDPreguntas = ID
                         };
                         EM_PreguntasNegocio CN = new EM_PreguntasNegocio();
                         CN.ObtenerCampoMapaPreguntaXID(DatosAux);
                         if (DatosAux.Completado)
                         {
                             this.CargarDatos(DatosAux);
                         }
                         else
                         {
                             //Ocurrió un error
                             Response.Redirect("frmDatosMapa.aspx?error=" + "Error al cargar los datos&nError=1");
                         }
                     }
                     else
                     {
                         Response.Redirect("frmEncuestas.aspx");
                     }
                 }
                 else
                 {
                     Response.Redirect("frmEncuestas.aspx");
                 }
             }
             else
             {
                 Response.Redirect("frmEncuestas.aspx");
             }
         }
         else
         {
             this.IniciarDatos();
         }
     }
     else
     {
         if (Request.Form.Count == 10)
         {
             string txtTituloRespuesta  = Request.Form["ctl00$cph_MasterBody$txtTituloRespuesta"].ToString();
             string txtPeriodoDatos     = Request.Form["ctl00$cph_MasterBody$txtPeriodoDatos"].ToString();
             string txtTituloPorcentaje = Request.Form["ctl00$cph_MasterBody$txtTituloPorcentaje"].ToString();
             string txtExplicacion      = HttpUtility.HtmlDecode(this.txtExplicacion.InnerHtml);
             string IDPregunta          = "";
             string IDEn = "";
             try
             {
                 string AuxID         = Request.Form["ctl00$cph_MasterBody$hf"].ToString();
                 string AuxIDEncuesta = Request.Form["ctl00$cph_MasterBody$hf2"].ToString();
                 IDPregunta = AuxID;
                 IDEn       = AuxIDEncuesta;
                 this.Guardar(IDEn, IDPregunta, txtTituloRespuesta, txtPeriodoDatos, txtTituloPorcentaje, txtExplicacion);
             }
             catch (Exception ex)
             {
                 Response.Redirect("ErrorPage.aspx?msjError=" + ex.Message);
             }
         }
     }
 }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CargarCombo();
            if (!IsPostBack)
            {
                if (Request.QueryString["op"] != null)
                {
                    if (Request.QueryString["op"] == "2")
                    {
                        if (Request.QueryString["id"] != null)
                        {
                            string ID = Request.QueryString["id"].ToString();
                            if (Request.QueryString["id"].ToString() == ID)
                            {
                                //Obtener los datos y dibujarlos.
                                EM_Preguntas DatosAux = new EM_Preguntas {
                                    Conexion = Comun.Conexion, IDPreguntas = ID
                                };
                                EM_PreguntasNegocio CN = new EM_PreguntasNegocio();
                                CN.ObtenerDetallePreguntasXID(DatosAux);
                                if (DatosAux.Completado)
                                {
                                    this.IDEncuesta = DatosAux.IDEncuesta;
                                    this.CargarDatos(DatosAux);
                                }
                                else
                                {
                                    //Ocurrió un error
                                    Response.Redirect("frmPreguntas.aspx?error=" + "Error al cargar los datos&nError=1");
                                }
                            }
                            else
                            {
                                Response.Redirect("frmEncuestas", false);
                            }
                        }
                        else
                        {
                            Response.Redirect("frmEncuestas");
                        }
                    }
                    else if (Request.QueryString["op"] == "1")
                    {
                        if (Request.QueryString["id"] != null)
                        {
                            string ID = Request.QueryString["id"].ToString();
                            if (Request.QueryString["id"].ToString() == ID)
                            {
                                this.IDEncuesta = ID.ToString();
                                hf2.Value       = ID.ToString();
                            }
                            else
                            {
                                Response.Redirect("frmPreguntas.aspx?op=0&id=" + this.IDEncuesta.ToString(), false);
                            }
                        }
                        else
                        {
                            Response.Redirect("frmEncuestas", false);
                        }
                    }
                    else
                    {
                        Response.Redirect("frmEncuestas", false);
                    }
                }

                else
                {
                    this.IniciarDatos();
                }
            }
            else
            {
                if (Request.Form.Count == 9)
                {
                    int    IDTipoPregunta = 0, Orden = 0;
                    string txtNomb = Request.Form["ctl00$cph_MasterBody$txtPregunta"].ToString();
                    int.TryParse(Request.Form["cmb_TipoPregunta"].ToString(), out IDTipoPregunta);
                    string IDEncuestas = Request.Form["ctl00$cph_MasterBody$hf2"].ToString();
                    int.TryParse(Request.Form["ctl00$cph_MasterBody$txtOrden"].ToString(), out Orden);
                    string IDPregunta = "";
                    try
                    {
                        string AuxID = Request.Form["ctl00$cph_MasterBody$hf"].ToString();

                        IDPregunta = AuxID;
                        bool NuevoRegistro = string.IsNullOrEmpty(IDPregunta);
                        this.Guardar(NuevoRegistro, IDPregunta, IDEncuestas, txtNomb, IDTipoPregunta, Orden);
                    }
                    catch (Exception ex)
                    {
                        Response.Redirect("ErrorPage.aspx?msjError=" + ex.Message);
                    }
                }
            }
        }