diff --git a/App_Code/ClsOIEventos.vb b/App_Code/ClsOIEventos.vb index 25aefb9ca..5bf90db2e 100644 --- a/App_Code/ClsOIEventos.vb +++ b/App_Code/ClsOIEventos.vb @@ -219,68 +219,253 @@ Public Class ClsOIEventos Public Property objCorreo As ObjEventosCorreo #End Region +#Region "Cuestionario" + + Public Function GetUnoaUnoCuestionario_Usuarios(cveUnoaUnoCuestionario As Integer, cveUsuario As Integer, CveSeguir As Integer) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_UnoaUnoCuestionario_UsuariosGet", CommandType.StoredProcedure) + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveUnoaUnoCuestionario", SqlDbType.Int).Value = (cveUnoaUnoCuestionario) + .Add("@CveSeguir", SqlDbType.Int).Value = (CveSeguir) + .Add("@CveUsuario", SqlDbType.Int).Value = (cveUsuario) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el cuestionario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + Public Function UpUnoaUnoCuestionario_Usuarios(cveUnoaUnoCuestionario As Integer, cveUsuario As Integer, CveSeguir As Integer, conUser As Boolean) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_UnoaUnoCuestionario_UsuarioUp", CommandType.StoredProcedure) + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveUnoaUnoCuestionario", SqlDbType.Int).Value = (cveUnoaUnoCuestionario) + .Add("@CveSeguir", SqlDbType.Int).Value = (CveSeguir) + .Add("@CveUsuario", SqlDbType.Int).Value = (cveUsuario) + .Add("@conUser", SqlDbType.Bit).Value = (conUser) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el cuestionario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + Public Function AddUnoaUnoCuestionario_Usuarios(cveUnoaUnoCuestionario As Integer, cveUsuario As Integer, CveSeguir As Integer) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_UnoaUnoCuestionario_UsuarioAdd", CommandType.StoredProcedure) + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveUnoaUnoCuestionario", SqlDbType.Int).Value = (cveUnoaUnoCuestionario) + .Add("@CveSeguir", SqlDbType.Int).Value = (CveSeguir) + .Add("@CveUsuario", SqlDbType.Int).Value = (cveUsuario) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el cuestionario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + Public Function RemoveUnoaUnoCuestionario_Usuarios(cveUsuario As Integer, CveSeguir As Integer) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_UnoaUnoCuestionario_UsuarioRemove", CommandType.StoredProcedure) + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSeguir", SqlDbType.Int).Value = (CveSeguir) + .Add("@CveUsuario", SqlDbType.Int).Value = (cveUsuario) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el cuestionario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + + + Public Function GetUnoaUnoCuestionario(cveUnoaUnoCuestionario As Int32, cveUsuario As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_UnoaUnoCuestionarioGet", CommandType.StoredProcedure) + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveUnoaUnoCuestionario", SqlDbType.Int).Value = (cveUnoaUnoCuestionario) + .Add("@CveUsuario", SqlDbType.Int).Value = (cveUsuario) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el cuestionario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + + Public Function GetUnoaUnoCuestionarioPreguntas(cveUnoaUnoCuestionario As Integer) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_UnoaUnoCuestionarioPreguntasGet", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveUnoaUnoCuestionario", SqlDbType.Int).Value = cveUnoaUnoCuestionario + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el cuestionario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + Public Function AddUnoaUnoCuestionario(Cuestionario As String, Comentario As String, CveUsuario As Integer, ListPreguntas As List(Of Integer)) As Boolean + Dim retorno As Boolean = False + + Dim xmlPreguntas As System.Xml.Linq.XDocument = Nothing + If ListPreguntas IsNot Nothing AndAlso ListPreguntas.Count > 0 Then + xmlPreguntas = New System.Xml.Linq.XDocument(New System.Xml.Linq.XElement("Preguntas", ListPreguntas.[Select](Function(x) New System.Xml.Linq.XElement("CveUnoaUnoPregunta", x)))) + End If + DataAdapter("PA_OI_UnoaUnoCuestionarioAdd", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@Cuestionario", SqlDbType.VarChar).Value = (Cuestionario) + .Add("@Comentario", SqlDbType.VarChar).Value = (Comentario) + .Add("@CveUsuario", SqlDbType.Int).Value = (CveUsuario) + .Add("@xmlPreguntas", SqlDbType.Xml).Value = If(xmlPreguntas Is Nothing, DBNull.Value, DirectCast(xmlPreguntas.ToString(), Object)) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el cuestionario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + + Public Function UpUnoaUnoCuestionario(CveUnoaUnoCuestionario As Integer, Cuestionario As String, Comentario As String, CveUsuario As Integer, ListPreguntas As List(Of Integer)) As Boolean + Dim retorno As Boolean = False + + Dim xmlPreguntas As System.Xml.Linq.XDocument = Nothing + If ListPreguntas IsNot Nothing AndAlso ListPreguntas.Count > 0 Then + xmlPreguntas = New System.Xml.Linq.XDocument(New System.Xml.Linq.XElement("Preguntas", ListPreguntas.[Select](Function(x) New System.Xml.Linq.XElement("CveUnoaUnoPregunta", x)))) + End If + DataAdapter("PA_OI_UnoaUnoCuestionarioUp", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveUnoaUnoCuestionario", SqlDbType.Int).Value = (CveUnoaUnoCuestionario) + .Add("@Cuestionario", SqlDbType.VarChar).Value = (Cuestionario) + .Add("@Comentario", SqlDbType.VarChar).Value = (Comentario) + .Add("@CveUsuario", SqlDbType.Int).Value = (CveUsuario) + .Add("@xmlPreguntas", SqlDbType.Xml).Value = If(xmlPreguntas Is Nothing, DBNull.Value, DirectCast(xmlPreguntas.ToString(), Object)) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el cuestionario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + + Public Function RemoveUnoaUnoCuestionario(CveUnoaUnoCuestionario As Integer, CveUsuario As Integer) As Boolean + Dim retorno As Boolean = False + + DataAdapter("PA_OI_UnoaUnoRemoveCuestionario", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveUnoaUnoCuestionario", SqlDbType.Int).Value = (CveUnoaUnoCuestionario) + .Add("@CveUsuario", SqlDbType.Int).Value = (CveUsuario) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el cuestionario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function +#End Region #Region "uno a uno" - Public Function GetUnoaUnoEtiqueta(cveUnoaUnoEtiqueta As Int32, cveEmpresa As Int32) As Boolean + Public Function GetUnoAUnoSiguiendoA(CveUsuario As Integer, CveUsuarioSeguidor As Integer, cveEmpresa As Integer, Optional Fechastr As String = "") As Boolean Dim retorno As Boolean = False - DataAdapter("PA_OI_GetUnoaUnoEtiqueta", CommandType.StoredProcedure) + DataAdapter("PA_OI_UnoAUnoSiguiendoA", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters - .Add("@cveUnoaUnoEtiqueta", SqlDbType.Int).Value = (cveUnoaUnoEtiqueta) + .Add("@CveUsuario", SqlDbType.Int).Value = (CveUsuario) + .Add("@CveUsuarioSeguidor", SqlDbType.Int).Value = (CveUsuarioSeguidor) + .Add("@cveEmpresa", SqlDbType.Int).Value = (cveEmpresa) + .Add("@Fechastr", SqlDbType.VarChar).Value = (Fechastr) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el UnoaUnoPregunta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + Public Function GetUnoaUnoPregunta(cveUnoaUnoPregunta As Int32, cveEmpresa As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_GetUnoaUnoPregunta", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@cveUnoaUnoPregunta", SqlDbType.Int).Value = (cveUnoaUnoPregunta) .Add("@cveEmpresa", SqlDbType.Int).Value = (cveEmpresa) End With Try SqlAdapter.Fill(Data) retorno = True Catch ex As Exception - OnError("Ocurrió un error al obtener el UnoaUnoEtiqueta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + OnError("Ocurrió un error al obtener el UnoaUnoPregunta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return retorno End Function - Public Function AddUnoaUnoEtiqueta(etiqueta As String, cveUnoaUnoEtiquetaVinculo As Int32, cveGrupo As Int32, cveEmpresa As Int32) As Boolean + Public Function AddUnoaUnoPregunta(Pregunta As String, cveUnoaUnoPreguntaVinculo As Int32, CveUsuarioIng As Int32, cveEmpresa As Int32) As Boolean Dim retorno As Boolean = False - DataAdapter("PA_OI_AddUnoaUnoEtiqueta", CommandType.StoredProcedure) + DataAdapter("PA_OI_AddUnoaUnoPregunta", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters - .Add("@etiqueta", SqlDbType.VarChar).Value = (etiqueta) - .Add("@cveUnoaUnoEtiquetaVinculo", SqlDbType.Int).Value = (cveUnoaUnoEtiquetaVinculo) - .Add("@cveGrupo", SqlDbType.Int).Value = (cveGrupo) + .Add("@Pregunta", SqlDbType.VarChar).Value = (Pregunta) + .Add("@cveUnoaUnoPreguntaVinculo", SqlDbType.Int).Value = (cveUnoaUnoPreguntaVinculo) + .Add("@CveUsuarioIng", SqlDbType.Int).Value = (CveUsuarioIng) .Add("@cveEmpresa", SqlDbType.Int).Value = (cveEmpresa) End With Try SqlAdapter.Fill(Data) retorno = True Catch ex As Exception - OnError("Ocurrió un error al agregar el UnoaUnoEtiqueta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + OnError("Ocurrió un error al agregar el UnoaUnoPregunta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return retorno End Function - Public Function UpUnoaUnoEtiqueta(cveUnoaUnoEtiqueta As Int32, etiqueta As String, cveUnoaUnoEtiquetaVinculo As Int32, cveGrupo As Int32, cveEmpresa As Int32) As Boolean + Public Function UpUnoaUnoPregunta(cveUnoaUnoPregunta As Int32, Pregunta As String, cveUnoaUnoPreguntaVinculo As Int32, CveUsuarioIng As Int32, cveEmpresa As Int32) As Boolean Dim retorno As Boolean = False - DataAdapter("PA_OI_UpUnoaUnoEtiqueta", CommandType.StoredProcedure) + DataAdapter("PA_OI_UpUnoaUnoPregunta", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters - .Add("@cveUnoaUnoEtiqueta", SqlDbType.Int).Value = (cveUnoaUnoEtiqueta) - .Add("@etiqueta", SqlDbType.VarChar).Value = (etiqueta) - .Add("@cveUnoaUnoEtiquetaVinculo", SqlDbType.Int).Value = (cveUnoaUnoEtiquetaVinculo) - .Add("@cveGrupo", SqlDbType.Int).Value = (cveGrupo) + .Add("@cveUnoaUnoPregunta", SqlDbType.Int).Value = (cveUnoaUnoPregunta) + .Add("@Pregunta", SqlDbType.VarChar).Value = (Pregunta) + .Add("@cveUnoaUnoPreguntaVinculo", SqlDbType.Int).Value = (cveUnoaUnoPreguntaVinculo) + .Add("@CveUsuarioIng", SqlDbType.Int).Value = (CveUsuarioIng) .Add("@cveEmpresa", SqlDbType.Int).Value = (cveEmpresa) End With Try SqlAdapter.Fill(Data) retorno = True Catch ex As Exception - OnError("Ocurrió un error al actualizar el UnoaUnoEtiqueta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + OnError("Ocurrió un error al actualizar el UnoaUnoPregunta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return retorno End Function - Public Function RemoveUnoaUnoEtiqueta(cveUnoaUnoEtiqueta As Int32) As Boolean + Public Function RemoveUnoaUnoPregunta(cveUnoaUnoPregunta As Integer, CveEmpresa As Integer) As Boolean Dim retorno As Boolean = False - DataAdapter("PA_OI_RemoveUnoaUnoEtiqueta", CommandType.StoredProcedure) + DataAdapter("PA_OI_RemoveUnoaUnoPregunta", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters - .Add("@cveUnoaUnoEtiqueta", SqlDbType.Int).Value = (cveUnoaUnoEtiqueta) + .Add("@cveUnoaUnoPregunta", SqlDbType.Int).Value = (cveUnoaUnoPregunta) + .Add("@cveEmpresa", SqlDbType.Int).Value = (CveEmpresa) End With Try SqlAdapter.Fill(Data) retorno = True Catch ex As Exception - OnError("Ocurrió un error al eliminar el UnoaUnoEtiqueta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + OnError("Ocurrió un error al eliminar el UnoaUnoPregunta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return retorno End Function @@ -302,13 +487,13 @@ Public Class ClsOIEventos Return retorno End Function - Public Function UnoAUnoTableroAdd(cveEmpresa As Int32, fecha As String, cveUsuario As Int32, CveUnoaUnoEtiqueta As Integer, Comentarios As String) As Boolean + Public Function UnoAUnoTableroAdd(cveEmpresa As Int32, fecha As String, cveUsuario As Int32, CveUnoaUnoPregunta As Integer, Comentarios As String) As Boolean Dim retorno As Boolean = False DataAdapter("PA_OI_UnoAUnoADD", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters .Add("@Fecha", SqlDbType.Date).Value = (fecha) .Add("@CveUsuario", SqlDbType.Int).Value = (cveUsuario) - .Add("@CveUnoaUnoEtiqueta", SqlDbType.Int).Value = (CveUnoaUnoEtiqueta) + .Add("@CveUnoaUnoPregunta", SqlDbType.Int).Value = (CveUnoaUnoPregunta) .Add("@Comentarios", SqlDbType.VarChar).Value = (Comentarios) .Add("@CveEmpresa", SqlDbType.Int).Value = (cveEmpresa) End With diff --git a/OI/UnoaUno.aspx b/OI/UnoaUno.aspx index e97d18dbe..084ef99db 100644 --- a/OI/UnoaUno.aspx +++ b/OI/UnoaUno.aspx @@ -7,13 +7,30 @@ .fecharef { margin-top: 2px; } + + th { + text-align: left; + } + + .lnkUserBlack { + text-decoration: none; + color: #060606; + font-size: 14px; + font-weight: 600; + } + + .lnkUsergray { + color:#999b9b; + font-size: 11px; + } - + - Tablero Uno a Uno - + Tablero Uno a Uno - + @@ -22,6 +39,8 @@ +
  • + Seguir
  • @@ -31,55 +50,402 @@ -
    -
    -
    - -
    -
    -
      -
    • Fecha :
    • -
    • -
      - - - - - - - - - - + +
      +
      +
      +
      +
      + + + Siguiendo A +
      +
      +
      +
      -
    • -
    +
    +
    +
    +
    + + + + +
    + + +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    + + + Seguido por +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + +
    +
    + +
    +
    +
    +
    + + + Preguntas +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    + +
    +
    +
      +
    • Fecha :
    • +
    • +
      + + + + + + + + + + +
      +
    • +
    +
    +
    +
    + + + + +

    +

    +
    + +
    +
    +
    +
    +
    +
    +
    + Guardar +
    +
    - - - - -

    -

    -
    - -
    -
    -
    -
    -
    -
    -
    - Guardar -
    + + + + diff --git a/OI/UnoaUno.aspx.cs b/OI/UnoaUno.aspx.cs index 24f90da7a..69060c408 100644 --- a/OI/UnoaUno.aspx.cs +++ b/OI/UnoaUno.aspx.cs @@ -7,26 +7,81 @@ using System.Web.UI.WebControls; using Extensiones; public partial class OI_UnoaUno : ClsPaginas { + + + #region Propiedades + public const string idDivModalSeguir = "idDivModalSeguir"; + public const string idDivModalSiguiendoA = "idDivModalSiguiendoA"; + private int CcveUnoaUnoPregunta + { + get { return (ViewState["CcveUnoaUnoPregunta"] == null) ? 0 : Convert.ToInt32(ViewState["CcveUnoaUnoPregunta"]); } + set { ViewState["CcveUnoaUnoPregunta"] = value; } + } + private System.Data.DataTable DtPreguntas + { + get { return (ViewState["DtPreguntas"] == null) ? null : (System.Data.DataTable)ViewState["DtPreguntas"]; } + set { ViewState["DtPreguntas"] = value; } + } + //private int CcveUnoaUnoCuestionario + //{ + // get { return (ViewState["CcveUnoaUnoCuestionario"] == null) ? 0 : Convert.ToInt32(ViewState["CcveUnoaUnoCuestionario"]); } + // set { ViewState["CcveUnoaUnoCuestionario"] = value; } + //} + #endregion protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { TxtCFecha.Text = DateTime.Now.ToString("dd/MM/yyyy"); LtlusuarioTitulo.Text = UsuarioActual.Nombre; + + + + GvUsuarioCuest.DataSource = get_GlobalDTUsuarios(CveEmpresa: UsuarioActual.CveEmpresa).FiltraParametros("Estatus =1 ", "Rol ASC"); + GvUsuarioCuest.DataBind(); + CargarSiguiendoA(); + CargarSeguidoPor(); BtnConsultar_Click(null, null); } } - + private void CargarSiguiendoA() + { + using (ClsOIEventos ObjUnoa = new ClsOIEventos()) + { + ObjUnoa.GetUnoAUnoSiguiendoA(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa); + GVSiguiendoA.DataSource = ObjUnoa.DtResultados;//.FiltraParametros("","",new string[] { "CveSeguir", "Usuario" }); + } + GVSiguiendoA.DataBind(); + } + private void CargarSeguidoPor() + { + using (ClsOIEventos ObjUnoa = new ClsOIEventos()) + { + ObjUnoa.GetUnoaUnoCuestionario_Usuarios(-1, -1, UsuarioActual.CveUsuario); + GVSeguidoPor.DataSource = ObjUnoa.DtResultados.FiltraParametros("", "", new string[] { "CveUsuarioSeguidor", "NombreSeguidor" }); + } + GVSeguidoPor.DataBind(); + } protected void BtnConsultar_Click(object sender, EventArgs e) { + GVPA_OI_UnoAUnoTableroGet.DataSource = new System.Data.DataTable(); using (ClsOIEventos ObjPA_O = new ClsOIEventos()) { ObjPA_O.UnoAUnoTableroGet(UsuarioActual.CveEmpresa, TxtCFecha.Text.ToDate().ToString("yyyy/MM/dd"), UsuarioActual.CveUsuario); GVPA_OI_UnoAUnoTableroGet.DataSource = ObjPA_O.DtResultados; ObjPA_O.Dispose(); - GVPA_OI_UnoAUnoTableroGet.DataBind(); } + GVPA_OI_UnoAUnoTableroGet.DataBind(); + if (GVPA_OI_UnoAUnoTableroGet.Rows.Count > 0) + { + LnkGuardar.Visible = true; + } + else + { + LnkGuardar.Visible = false; + } + UpContenido.Update(); } protected void LnkGuardar_Click(object sender, EventArgs e) @@ -39,11 +94,11 @@ public partial class OI_UnoaUno : ClsPaginas { if (continuar) { - int CveUnoaUnoEtiqueta = gvrow.DataKey("CveUnoaUnoEtiqueta").ToEntero(); - if (CveUnoaUnoEtiqueta > 0) + int CveUnoaUnoPregunta = gvrow.DataKey("CveUnoaUnoPregunta").ToEntero(); + if (CveUnoaUnoPregunta > 0) { string Comentarios = gvrow.FCTextBox("TxtComentarios").Text; - continuar = ObjPA_O.UnoAUnoTableroAdd(UsuarioActual.CveEmpresa, fecha, UsuarioActual.CveUsuario, CveUnoaUnoEtiqueta, Comentarios); + continuar = ObjPA_O.UnoAUnoTableroAdd(UsuarioActual.CveEmpresa, fecha, UsuarioActual.CveUsuario, CveUnoaUnoPregunta, Comentarios); } } @@ -52,7 +107,470 @@ public partial class OI_UnoaUno : ClsPaginas } if (continuar) { - Alert("Información Actualizada"); + Alert("Tus respuestas se han actualizado", ModExtensiones.TipoMensaje.ToastInformacion); } } + + protected void LnkSeguir_Click(object sender, EventArgs e) + { + TabContainerSeguir.ActiveTabIndex = 0; + CargarPreguntas(); + cargarCuestionario(); CargarSeguirA(); + if (GVUnoaUnoPregunta.Rows.Count > 0) + { + TabContainerSeguir.ActiveTabIndex = 1; + //if (GVCuestionario.Rows.Count > 0) + //{ + // TabContainerSeguir.ActiveTabIndex = 2; + //} + } + else + { + TabContainerSeguir.ActiveTabIndex = 0; + } + switch (TabContainerSeguir.ActiveTabIndex) + { + case 1: + TxtCuestionario.Focus(); + break; + case 2: + //TxtCuestionario.Focus(); + break; + default: + TxtPregunta.Focus(); + break; + } + RegistraScript(string.Format("$('#{0}').modal()", idDivModalSeguir)); + UpModalSeguir.Update(); + openmodalseguir(); + } + private void openmodalseguir() + { + string focustxt = "$('.TxtPregunta').focus();"; + switch (TabContainerSeguir.ActiveTabIndex) + { + case 1: + focustxt = "$('.TxtCuestionario').focus();"; + break; + default: + focustxt = "$('.TxtPregunta').focus();"; + break; + } + RegistraScript(string.Format("$('#{0}').modal();$('#{0}').on('shown.bs.modal', function (e) {{ {1} }});", idDivModalSeguir, focustxt)); + } + #region pregunta + private void CargarPreguntas() + { + + using (ClsOIEventos ObjUnoa = new ClsOIEventos()) + { + if (ObjUnoa.GetUnoaUnoPregunta(-1, UsuarioActual.CveEmpresa)) + { + GVUnoaUnoPregunta.DataSource = ObjUnoa.DtResultados; + DdlPregunta.DataSource = ObjUnoa.DtResultados; + GvPreguntasCuestionario.DataSource = ObjUnoa.DtResultados; + + } + } + GvPreguntasCuestionario.DataBind(); + GVUnoaUnoPregunta.DataBind(); + DdlPregunta.DataBind(); + //DdlPregunta.Items.Insert(0, new ListItem("", "-2")); + DdlPregunta.Items.Insert(0, new ListItem("Seleccione", "-1")); + upPreguntas.Update(); + } + + //protected void LnkAgregarPregunta_Click(object sender, EventArgs e) + //{ + // TxtPregunta.Text = ""; + // DdlPregunta.SelectedIndex = -1; + // CcveUnoaUnoPregunta = -1; + // LtlTituloPregunta.Text = "Agregar Pregunta"; + // TxtPregunta.Focus(); + + // LnkAgregarPregunta.Visible = false; + // LnkGuardarPregunta.Visible = true; + // LnkCancelarPregunta.Visible = true; + //} + protected void LnkEditarPregunta_Click(object sender, EventArgs e) + { + TxtPregunta.Text = ""; + CcveUnoaUnoPregunta = -1; + TxtPregunta.Focus(); + + + GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CcveUnoaUnoPregunta = gvRow.DataKey("CveUnoaUnoPregunta").ToEntero(); + string Pregunta = gvRow.DataKey("Pregunta"); + int cveUnoaUnoPreguntaVinculo = gvRow.DataKey("CveUnoaUnoPreguntaVinculo").ToEntero(); + + TxtPregunta.Text = Pregunta; + DdlPregunta.SelectedValue = "-1"; + DdlPregunta.SelectedValueExist(cveUnoaUnoPreguntaVinculo.ToString()); + + + LnkGuardarPregunta.Text = "Actualizar"; + LnkCancelarPregunta.Visible = true; + upPreguntas.Update(); + openmodalseguir(); + } + protected void LnkCancelarPregunta_Click(object sender, EventArgs e) + { + CcveUnoaUnoPregunta = -1; + LnkGuardarPregunta.Text = "Guardar"; + LnkCancelarPregunta.Visible = false; + upPreguntas.Update(); + openmodalseguir(); + } + protected void LnkEliminarPregunta_Click(object sender, EventArgs e) + { + GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CcveUnoaUnoPregunta = gvRow.DataKey("CveUnoaUnoPregunta").ToEntero(); + bool continuar = true; + using (ClsOIEventos ObjUnoa = new ClsOIEventos()) + { + + continuar = ObjUnoa.RemoveUnoaUnoPregunta(CcveUnoaUnoPregunta, UsuarioActual.CveEmpresa); + } + if (continuar) + { + CcveUnoaUnoPregunta = -1; + TxtPregunta.Text = ""; + CcveUnoaUnoPregunta = -1; + TxtPregunta.Focus(); + LnkGuardarPregunta.Text = "Guardar"; + LnkCancelarPregunta.Visible = false; + Alert("La pregunta se ha eliminado correctamente", ModExtensiones.TipoMensaje.ToastInformacion); + CargarPreguntas(); + } + openmodalseguir(); + } + + protected void LnkGuardarPregunta_Click(object sender, EventArgs e) + { + bool continuar = true; + + string Pregunta = TxtPregunta.Text; + int cveUnoaUnoPreguntaVinculo = DdlPregunta.SelectedValue.ToEntero(); + using (ClsOIEventos ObjUnoa = new ClsOIEventos()) + { + if (CcveUnoaUnoPregunta > 0) + { + + continuar = ObjUnoa.UpUnoaUnoPregunta(CcveUnoaUnoPregunta, Pregunta, cveUnoaUnoPreguntaVinculo, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa); + } + else + { + continuar = ObjUnoa.AddUnoaUnoPregunta(Pregunta, cveUnoaUnoPreguntaVinculo, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa); + } + } + if (continuar) + { + CargarPreguntas(); + CcveUnoaUnoPregunta = -1; + TxtPregunta.Text = ""; + CcveUnoaUnoPregunta = -1; + TxtPregunta.Focus(); + LnkGuardarPregunta.Text = "Guardar"; + LnkCancelarPregunta.Visible = false; + Alert("La pregunta se ha agregado correctamente", ModExtensiones.TipoMensaje.ToastInformacion); + } + openmodalseguir(); + } + + #endregion + #region Cuestionario + private void cargarCuestionario() + { + using (ClsOIEventos ObjUnoa = new ClsOIEventos()) + { + ObjUnoa.GetUnoaUnoCuestionario(-1, UsuarioActual.CveUsuario); + DtPreguntas = ObjUnoa.DtResultados; + DdlCuestionario.DataSource = ObjUnoa.DtResultados; + } + //GVCuestionario.DataBind(); + DdlCuestionario.DataBind(); + DdlCuestionario.Items.Insert(0, new ListItem("Seleccione", "-1")); + openmodalseguir(); + } + protected void LnkGuardarCuestionario_Click(object sender, EventArgs e) + { + + bool continuar = true; + + string Cuestionario = TxtCuestionario.Text; + string Comentario = TxtCuestComentario.Text; + int cveUnoaUnoPreguntaVinculo = DdlPregunta.SelectedValue.ToEntero(); + int CveUnoaUnoCuestionario = DdlCuestionario.SelectedValue.ToEntero(); + string msg = ""; + List lPreguntas = new List(); + foreach (GridViewRow item in GvPreguntasCuestionario.Rows) + { + CheckBox chk = item.FCCheckBox("ChkConPregunta"); + if (chk.Checked) + { + lPreguntas.Add(item.DataKey("CveUnoaUnoPregunta").ToEntero()); + } + } + using (ClsOIEventos ObjUnoa = new ClsOIEventos()) + { + if (CveUnoaUnoCuestionario > 0) + { + + continuar = ObjUnoa.UpUnoaUnoCuestionario(CveUnoaUnoCuestionario, Cuestionario, Comentario, UsuarioActual.CveUsuario, lPreguntas); + msg = "El cuestionario se ha actualizado correctamente"; + } + else + { + continuar = ObjUnoa.AddUnoaUnoCuestionario(Cuestionario, Comentario, UsuarioActual.CveUsuario, lPreguntas); + msg = "El cuestionario se ha agregado correctamente"; + } + } + if (continuar) + { + DdlCuestionario.SelectedIndex = -1; + cargarCuestionario(); + DdlCuestionario_SelectedIndexChanged(null, null); + Alert(msg, ModExtensiones.TipoMensaje.ToastInformacion); + } + openmodalseguir(); + } + + + protected void DdlCuestionario_SelectedIndexChanged(object sender, EventArgs e) + { + int CveUnoaUnoCuestionario = DdlCuestionario.SelectedValue.ToEntero(); + string Cuestionario = DdlCuestionario.SelectedItem.Text; + string Comentario = ""; + if (CveUnoaUnoCuestionario > 0) + { + System.Data.DataRow drow = DtPreguntas.FiltroPrimero(string.Format("CveUnoaUnoCuestionario={0}", CveUnoaUnoCuestionario)); + if (drow != null) + { + Comentario = drow["Comentario"].ToString(); + } + System.Data.DataTable dt = new System.Data.DataTable(); + using (ClsOIEventos ObjUnoa = new ClsOIEventos()) + { + ObjUnoa.GetUnoaUnoCuestionarioPreguntas(CveUnoaUnoCuestionario); + dt = ObjUnoa.DtResultados; + } + foreach (GridViewRow item in GvPreguntasCuestionario.Rows) + { + CheckBox ChkConPregunta = item.FCCheckBox("ChkConPregunta"); + int CveUnoaUnoPregunta = item.DataKey("CveUnoaUnoPregunta").ToEntero(); + ChkConPregunta.Checked = false; + if (dt.FiltraParametros(string.Format("CveUnoaUnoPregunta={0}", CveUnoaUnoPregunta)).Rows.Count > 0) + { + ChkConPregunta.Checked = true; + } + } + LnkGuardarCuestionario.Text = "Actualizar"; + } + else + { + Cuestionario = ""; + Comentario = ""; + foreach (GridViewRow item in GvPreguntasCuestionario.Rows) + { + CheckBox ChkConPregunta = item.FCCheckBox("ChkConPregunta"); + ChkConPregunta.Checked = false; + } + LnkGuardarCuestionario.Text = "Guardar"; + } + TxtCuestionario.Text = Cuestionario; + TxtCuestComentario.Text = Comentario; + UpCuestionario.Update(); + CargarSeguirA(); + UpSeguirA.Update(); + openmodalseguir(); + } + //protected void LnkCancelarCuestionario_Click(object sender, EventArgs e) + //{ + + // CcveUnoaUnoCuestionario = -1; + // LnkGuardarCuestionario.Text = "Guardar"; + // LnkCancelarCuestionario.Visible = false; + // UpCuestionario.Update(); + // openmodalseguir(); + //} + + //protected void LnkEditarCuestionario_Click(object sender, EventArgs e) + //{ + // TxtCuestionario.Text = ""; + // CcveUnoaUnoPregunta = -1; + // TxtPregunta.Focus(); + + // GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + // CcveUnoaUnoCuestionario = gvRow.DataKey("CveUnoaUnoCuestionario").ToEntero(); + // string Cuestionario = gvRow.DataKey("Cuestionario"); + // TxtCuestionario.Text = Cuestionario; + // System.Data.DataTable dt = new System.Data.DataTable(); + // using (ClsOIEventos ObjUnoa = new ClsOIEventos()) + // { + // ObjUnoa.GetUnoaUnoCuestionarioPreguntas(CcveUnoaUnoCuestionario); + // dt = ObjUnoa.DtResultados; + // } + // foreach (GridViewRow item in GvPreguntasCuestionario.Rows) + // { + // CheckBox ChkConPregunta=item.FCCheckBox("ChkConPregunta"); + // int CveUnoaUnoPregunta = item.DataKey("CveUnoaUnoPregunta").ToEntero(); + // ChkConPregunta.Checked = false; + // if(dt.FiltraParametros(string.Format("CveUnoaUnoPregunta={0}", CveUnoaUnoPregunta)).Rows.Count > 0) + // { + // ChkConPregunta.Checked = true; + // } + + // } + // LnkGuardarCuestionario.Text = "Actualizar"; + // LnkCancelarCuestionario.Visible = true; + // UpCuestionario.Update(); + // openmodalseguir(); + //} + + //protected void LnkEliminarCuestionario_Click(object sender, EventArgs e) + //{ + + // GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + // CcveUnoaUnoCuestionario = gvRow.DataKey("CveUnoaUnoCuestionario").ToEntero(); + // bool continuar = true; + // using (ClsOIEventos ObjUnoa = new ClsOIEventos()) + // { + // continuar = ObjUnoa.RemoveUnoaUnoCuestionario(CcveUnoaUnoPregunta, UsuarioActual.CveUsuario); + // } + // if (continuar) + // { + // CcveUnoaUnoCuestionario = -1; + // Alert("El cuestionario se ha eliminado correctamente", ModExtensiones.TipoMensaje.ToastInformacion); + // cargarCuestionario(); + // } + // openmodalseguir(); + //} + #endregion + + private void CargarSeguirA() + { + System.Data.DataTable dt = null; + int cveUnoaUnoCuestionario = DdlCuestionario.SelectedValue.ToEntero(); + using (ClsOIEventos ObjUnoa = new ClsOIEventos()) + { + ObjUnoa.GetUnoaUnoCuestionario_Usuarios(cveUnoaUnoCuestionario, UsuarioActual.CveUsuario, -1); + dt = ObjUnoa.DtResultados; + } + bool isdtok = (dt != null && dt.Rows.Count > 0); + foreach (GridViewRow item in GvUsuarioCuest.Rows) + { + CheckBox ChkConPregunta = item.FCCheckBox("ChkConPregunta"); + int CveSeguir = item.DataKey("CveUsuario").ToEntero(); + if (isdtok && dt.FiltraParametros(string.Format("CveSeguir={0}", CveSeguir)).Rows.Count > 0) + { + ChkConPregunta.Checked = true; + } + else + { + ChkConPregunta.Checked = false; + } + } + CargarSiguiendoA(); + UpContenido.Update(); + UpSeguirA.Update(); + } + protected void LnkGuardarSeguirA_Click(object sender, EventArgs e) + { + + bool continuar = true; + string msg = ""; + int cveUnoaUnoCuestionario = DdlCuestionario.SelectedValue.ToEntero(); + //int CveSeguir = DdlUsuario.SelectedValue.ToEntero(); + using (ClsOIEventos ObjUnoa = new ClsOIEventos()) + { + ObjUnoa.IniciaTransacSQL(); + + foreach (GridViewRow item in GvUsuarioCuest.Rows) + { + CheckBox ChkConPregunta = item.FCCheckBox("ChkConPregunta"); + int CveSeguir = item.DataKey("CveUsuario").ToEntero(); + if (continuar) + { + continuar = ObjUnoa.UpUnoaUnoCuestionario_Usuarios(cveUnoaUnoCuestionario, UsuarioActual.CveUsuario, CveSeguir, ChkConPregunta.Checked); + + } + } + if (continuar) + { + msg = "El cuestionario se ha actualizado correctamente"; + ObjUnoa.Commit(); + } + else + { + ObjUnoa.RollBack(); + } + } + if (continuar) + { + //CcveUnoaUnoCuestionario = -1; + Alert(msg, ModExtensiones.TipoMensaje.ToastInformacion); + CargarSeguirA(); + RegistraScript(string.Format("$('#{0}').modal('hide');", idDivModalSeguir)); + } + openmodalseguir(); + } + + //protected void LnkEliminarCuestionarioUser_Click(object sender, EventArgs e) + //{ + + + // bool continuar = true; + // int cveUnoaUnoCuestionario = DdlCuestionario.SelectedValue.ToEntero(); + // int CveSeguir = DdlUsuario.SelectedValue.ToEntero(); + // using (ClsOIEventos ObjUnoa = new ClsOIEventos()) + // { + // continuar = ObjUnoa.AddUnoaUnoCuestionario_Usuarios(cveUnoaUnoCuestionario, UsuarioActual.CveUsuario, CveSeguir); + // } + // if (continuar) + // { + // //CcveUnoaUnoCuestionario = -1; + // Alert("El cuestionario se ha eliminado correctamente", ModExtensiones.TipoMensaje.ToastInformacion); + // CargarSeguirA(); + // } + // openmodalseguir(); + //} + + + protected void TabContainerSeguir_ActiveTabChanged(object sender, EventArgs e) + { + LnkGuardarSeguirA.Visible = false; + if (TabContainerSeguir.ActiveTab == TabUsuarios) + { + if (DdlCuestionario.SelectedValue.ToEntero() <= 0) + { + TabContainerSeguir.ActiveTab = TabCuestionario; + Alert("debe Seleccionar un cuestioniario", ModExtensiones.TipoMensaje.MsgAdvertencia); + } + else + { + LnkGuardarSeguirA.Visible = true; + } + } + openmodalseguir(); + UpSeguirA.Update(); + } + + + protected void SiguiendoAUser_Click(object sender, EventArgs e) + { + GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + int CveUsuario = gvRow.DataKey("CveUsuario").ToEntero(); + string Nombre = gvRow.DataKey("Nombre"); + LtlTitulosiguiendoA.Text = Nombre; + gvPregResSiguiendoA.DataSource = null; + using (ClsOIEventos ObjUnoa = new ClsOIEventos()) + { + ObjUnoa.GetUnoAUnoSiguiendoA(UsuarioActual.CveUsuario, CveUsuario, UsuarioActual.CveEmpresa); + gvPregResSiguiendoA.DataSource = ObjUnoa.DtResultados; + } + gvPregResSiguiendoA.DataBind(); + RegistraScript(string.Format("$('#{0}').modal();", idDivModalSiguiendoA)); + UpModalSiguiendoA.Update(); + } } \ No newline at end of file diff --git a/packages.config b/packages.config index 0878a2900..40443914d 100644 --- a/packages.config +++ b/packages.config @@ -28,7 +28,6 @@ - diff --git a/vwd.webinfo b/vwd.webinfo index 71c73829a..8dd65e0da 100644 --- a/vwd.webinfo +++ b/vwd.webinfo @@ -58,6 +58,8 @@ + +