Ejemplo n.º 1
0
 protected void _btnActualizar_Click(object sender, EventArgs e)
 {
     _sesion = new Sesion();
     _cookieActual = _sesion.verificarValidez(Request.Cookies["PS"]);
     if (_cookieActual == null) // Si la cookie expira redirecciona a la pantalla de Login
         Response.Redirect("../Autentificacion/Login.aspx");
     else // Volver a crear la cookie en el cliente, con el nuevo tiempo de expiración
         Response.SetCookie(_cookieActual);
     if ((!_txtDetalle.Text.Equals("")) || (!_txtDetalle.Text.Equals("")))
     {
         if (_ddlEstadoDetalle.SelectedIndex != 0)
         {
             String nuevo = _ddlEstadoDetalle.SelectedValue;
             int nuevoEstado = -1;
             switch (nuevo)
             {
                 case "Pendiente":
                     nuevoEstado = 0;
                     break;
                 case "En proceso":
                     nuevoEstado = 1;
                     break;
                 case "Resuelto":
                     nuevoEstado = 2;
                     break;
             }
             _controladorSistema = new ControladorSistema();
             Boolean resultado = _controladorSistema.modificarEntradaBitError(Convert.ToInt32(_listaErrores.ElementAt(_ltbErrores.SelectedIndex).ElementAt(0)), nuevoEstado);
             if (resultado)
             {
                 _imgMensaje.ImageUrl = "../Imagenes/ok.png";
                 _lblMensaje.Text = "Se modificó el estado del registro con éxito";
                 _imgMensaje.Visible = true;
                 _lblMensaje.Visible = true;
                 _listaErrores = _controladorSistema.obtenerEntradasBitError("", "", -1);
                 if ((_listaErrores != null) && (_listaErrores.Count != 0))
                 {
                     _ltbErrores.Items.Clear();
                     for (int i = 0; i < _listaErrores.Count; i++)
                     {
                         String texto = _listaErrores.ElementAt(i).ElementAt(1).ToString();
                         switch (Convert.ToInt32(_listaErrores.ElementAt(i).ElementAt(4)))
                         {
                             case 0:
                                 texto = texto + " - Pendiente";
                                 break;
                             case 1:
                                 texto = texto + " - En proceso";
                                 break;
                             case 2:
                                 texto = texto + " - Resuelto";
                                 break;
                         }
                         _ltbErrores.Items.Add(texto);
                     }
                 }
                 else if (_listaErrores == null)
                 {
                     _imgMensaje.ImageUrl = "../Imagenes/Error.png";
                     _lblMensaje.Text = "Hubo un error al volver a obtener los errores reportados";
                     _imgMensaje.Visible = true;
                     _lblMensaje.Visible = true;
                 }
                 else
                 {
                     _imgMensaje.ImageUrl = "../Imagenes/Advertencia.png";
                     _lblMensaje.Text = "No hay errores reportados";
                     _imgMensaje.Visible = true;
                     _lblMensaje.Visible = true;
                 }
             }
             else
             {
                 _imgMensaje.ImageUrl = "../Imagenes/Error.png";
                 _lblMensaje.Text = "Hubo un error al tratar de actualizar el estado del registro";
                 _imgMensaje.Visible = true;
                 _lblMensaje.Visible = true;
             }
         }
         else
         {
             _imgMensaje.ImageUrl = "../Imagenes/Advertencia.png";
             _lblMensaje.Text = "Debe seleccionar el nuevo estado del registro";
             _imgMensaje.Visible = true;
             _lblMensaje.Visible = true;
         }
     }
     else
     {
         _imgMensaje.ImageUrl = "../Imagenes/Advertencia.png";
         _lblMensaje.Text = "Debe seleccionar un registro de error";
         _imgMensaje.Visible = true;
         _lblMensaje.Visible = true;
     }
 }