648 lines
24 KiB
C#
648 lines
24 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
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";
|
|
//public const string idDivModalSiguiendoX = "idDivModalSiguiendoX";
|
|
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();
|
|
if (GVPA_OI_UnoAUnoTableroGet.Rows.Count > 0 && TxtCFecha.Text.ToDate().ToString("yyyy/MM/dd") == DateTime.Now.ToString("yyyy/MM/dd"))
|
|
{
|
|
LnkGuardar.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
LnkGuardar.Visible = false;
|
|
}
|
|
UpContenido.Update();
|
|
}
|
|
|
|
protected void LnkGuardar_Click(object sender, EventArgs e)
|
|
{
|
|
string fecha = TxtCFecha.Text.ToDate().ToString("yyyy/MM/dd");
|
|
bool continuar = true;
|
|
using (ClsOIEventos ObjPA_O = new ClsOIEventos())
|
|
{
|
|
foreach (GridViewRow gvrow in GVPA_OI_UnoAUnoTableroGet.Rows)
|
|
{
|
|
if (continuar)
|
|
{
|
|
int CveUnoaUnoPregunta = gvrow.DataKey("CveUnoaUnoPregunta").ToEntero();
|
|
if (CveUnoaUnoPregunta > 0)
|
|
{
|
|
string Comentarios = gvrow.FCTextBox("TxtComentarios").Text;
|
|
continuar = ObjPA_O.UnoAUnoTableroAdd(UsuarioActual.CveEmpresa, fecha, UsuarioActual.CveUsuario, CveUnoaUnoPregunta, Comentarios);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
if (continuar)
|
|
{
|
|
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,UsuarioActual.CveEmpresa );
|
|
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<int> lPreguntas = new List<int>();
|
|
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, UsuarioActual.CveEmpresa );
|
|
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 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();
|
|
}
|
|
|
|
private int SeguirCveUsuario
|
|
{
|
|
get { return (ViewState["SeguirCveUsuario"] == null) ? 0 : Convert.ToInt32(ViewState["SeguirCveUsuario"]); }
|
|
set { ViewState["SeguirCveUsuario"] = value; }
|
|
}
|
|
private int SeguidoPorCve
|
|
{
|
|
get { return (ViewState["SeguidoPorCve"] == null) ? 0 : Convert.ToInt32(ViewState["SeguidoPorCve"]); }
|
|
set { ViewState["SeguidoPorCve"] = value; }
|
|
}
|
|
private string SeguirFechaback
|
|
{
|
|
get { return (ViewState["SeguirFechaback"] == null) ? "" : ViewState["SeguirFechaback"].ToString(); }
|
|
set { ViewState["SeguirFechaback"] = value; }
|
|
}
|
|
private string SeguirFechanext
|
|
{
|
|
get { return (ViewState["SeguirFechanext"] == null) ? "" : ViewState["SeguirFechanext"].ToString(); }
|
|
set { ViewState["SeguirFechanext"] = value; }
|
|
}
|
|
protected void SiguiendoAUser_Click(object sender, EventArgs e)
|
|
{
|
|
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
SeguirCveUsuario = gvRow.DataKey("CveUsuario").ToEntero();
|
|
SeguidoPorCve = UsuarioActual.CveUsuario;
|
|
string Nombre = gvRow.DataKey("Nombre");
|
|
string strFecha = gvRow.DataKey("Fecha");
|
|
LtlTitulosiguiendoA.Text = string.Format("Siguiendo A: {0}", Nombre);
|
|
DateTime Fecha;
|
|
if (strFecha.Length > 0)
|
|
{
|
|
Fecha = strFecha.ToDateTime();
|
|
strFecha = Fecha.ToString("yyyy/MM/dd");
|
|
}
|
|
cargarseguira(strFecha);
|
|
}
|
|
private void cargarseguira(string strFecha)
|
|
{
|
|
SeguirFechaback = "";
|
|
SeguirFechanext = "";
|
|
string fecha = "Sin respuestas capturadas";
|
|
gvPregResSiguiendoA.DataSource = null;
|
|
using (ClsOIEventos ObjUnoa = new ClsOIEventos())
|
|
{
|
|
if( ObjUnoa.GetUnoAUnoSiguiendoA(SeguidoPorCve, SeguirCveUsuario, UsuarioActual.CveEmpresa, strFecha) && ObjUnoa.DtResultados.Rows.Count >0)
|
|
{
|
|
SeguirFechaback = ObjUnoa.DtResultados.MAX("FechaBack").Length > 0 ? ObjUnoa.DtResultados.MAX("FechaBack").ToDateTime().ToString("yyyy/MM/dd") : "";
|
|
SeguirFechanext = ObjUnoa.DtResultados.MAX("FechaNext").Length > 0 ? ObjUnoa.DtResultados.MAX("FechaNext").ToDateTime().ToString("yyyy/MM/dd") : "";
|
|
fecha = (ObjUnoa.DtResultados.MAX("Fecha").Length >0 ? ObjUnoa.DtResultados.MAX("Fecha").ToDateTime().ToString("dd/MM/yyyy") : fecha);
|
|
}
|
|
gvPregResSiguiendoA.DataSource = ObjUnoa.DtResultados;
|
|
}
|
|
gvPregResSiguiendoA.DataBind();
|
|
RegistraScript(string.Format("$('#{0}').modal();", idDivModalSiguiendoA));
|
|
|
|
lnkAtras.Visible = (SeguirFechaback.Length > 0);
|
|
LnkAdelante.Visible = (SeguirFechanext.Length > 0);
|
|
TxtFechaSeguir.Text = fecha;
|
|
UpModalSiguiendoA.Update();
|
|
|
|
}
|
|
protected void lnkAtras_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
cargarseguira(SeguirFechaback);
|
|
}
|
|
|
|
protected void LnkAdelante_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
cargarseguira(SeguirFechanext);
|
|
}
|
|
|
|
protected void SeguidoX_Click(object sender, EventArgs e)
|
|
{
|
|
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
SeguirCveUsuario = UsuarioActual.CveUsuario;
|
|
SeguidoPorCve = gvRow.DataKey("CveUsuarioSeguidor").ToEntero();
|
|
string Nombre = gvRow.DataKey("NombreSeguidor");
|
|
LtlTitulosiguiendoA.Text = string.Format("Seguido por: {0}", Nombre);
|
|
cargarseguira("");
|
|
//string strFecha = "";
|
|
|
|
//LtlTituloSeguidox.Text = Nombre;
|
|
//gvSeguidoPorpreguntas.DataSource = null;
|
|
//using (ClsOIEventos ObjUnoa = new ClsOIEventos())
|
|
//{
|
|
// if (ObjUnoa.GetUnoAUnoSiguiendoA(SeguirCveUsuario, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, strFecha) && ObjUnoa.DtResultados.Rows.Count > 0)
|
|
// {
|
|
// }
|
|
// gvSeguidoPorpreguntas.DataSource = ObjUnoa.DtResultados;
|
|
//}
|
|
//gvSeguidoPorpreguntas.DataBind();
|
|
//RegistraScript(string.Format("$('#{0}').modal();", idDivModalSiguiendoX));
|
|
|
|
//UpModalSiguiendox.Update();
|
|
}
|
|
|
|
|
|
protected void LnkFechaSeguir_Click(object sender, EventArgs e)
|
|
{
|
|
string fechaold = TxtFechaSeguir.Text;
|
|
string strFecha =TxtFechaSeguir.Text.ToDateTime().ToString("yyyy/MM/dd");
|
|
|
|
cargarseguira(strFecha);
|
|
TxtFechaSeguir.Text = fechaold;
|
|
}
|
|
} |