protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SP_INICIO_SESION_Result sesion = (SP_INICIO_SESION_Result)Session["sesion"]; if (sesion.ID_ROL == 11) //El 11 corresponde a administrador { hlParametrizaciones.Visible = true; hlSolicitud.Visible = true; hlOrden.Visible = true; hlLiquidacion.Visible = true; hlReportes.Visible = true; hlRegistro.Visible = true; } if (sesion.ID_ROL == 10) //El 10 corresponde a jefatura { hlParametrizaciones.Visible = true; hlOrden.Visible = true; hlReportes.Visible = true; } if (sesion.ID_ROL == 9) //El 9 corresponde a funcionario { hlSolicitud.Visible = true; hlLiquidacion.Visible = true; hlReportes.Visible = true; } } }
protected void Page_Load(object sender, EventArgs e) { sesion = (SP_INICIO_SESION_Result)Session["sesion"]; if (!IsPostBack) { ReadOnlyFields(); LlenarGridConsulta(CargarDatosConsulta()); LlenarGridActualizar(CargarSolicitudesActualizar()); CargarLocalidad(); CargarRutas(); CargarPersonas(); CargarGridVerificar(); BtnAgregarPersona_Click(null, null); } }
protected void BtnRecuperar_Click(object sender, EventArgs e) { TBL_USUARIO obj = new TBL_USUARIO(); obj.NOMBREUSUARIO = this.TbxNombreCompleto.Text; obj.EMAIL = this.TbxCorreo.Text; WCFServicio.Service1Client serv = new WCFServicio.Service1Client(); SP_INICIO_SESION_Result sesion = serv.InicioSesion(obj); if (sesion == null) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Error al iniciar sesion')", true); } else { Main(Convert.ToString(obj.EMAIL), Convert.ToString(obj.CLAVEACCESO)); } }
protected void BtnIngresar_Click(object sender, EventArgs e) { TBL_USUARIO obj = new TBL_USUARIO(); obj.NOMBREUSUARIO = this.TbxUsuario.Text; obj.CLAVEACCESO = cifrarPass(this.TbxPassword.Text); WCFServicio.Service1Client serv = new WCFServicio.Service1Client(); SP_INICIO_SESION_Result sesion = serv.InicioSesion(obj); if (sesion == null) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Error al iniciar sesion')", true); } else { Session["sesion"] = sesion; Response.Redirect("Default.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { SP_INICIO_SESION_Result sesion = (SP_INICIO_SESION_Result)Session["sesion"]; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Sesion Iniciada: " + sesion.NOMBRE + "')", true); }
private void CompletarConsulta(int consulta) { //Obtiene la instancia de la sesion, para utilizarla en el reporte SP_INICIO_SESION_Result sesion = (SP_INICIO_SESION_Result)Session["sesion"]; //Se crea un objeto que se llena para indicar los filtros de busqueda de la consulta ReporteXFecha obj = new ReporteXFecha(); obj.FechaInicio = Convert.ToDateTime(txtFechaInicial.Text); obj.FechaFinal = Convert.ToDateTime(txtFechaFinal.Text); obj.Estado = Convert.ToInt16(ddlEstados.SelectedValue); if (sesion.ID_ROL == 9) { //Si se trata de funcionario, entonces solo podran ser accesibles los reportes con su identificacion obj.IDPersona = sesion.ID_PERSONA; obj.NomUsuario = sesion.NOMBREUSUARIO; } else { //Sin identificacion para jefatura o administracion, revisa solicitudes de todos los funcionarios. obj.NomUsuario = ""; obj.IDPersona = ""; } //Verifica el inicio y fin de las fechas, y muestra un mensaje en caso de ser incorrectas if (Convert.ToDateTime(txtFechaFinal.Text) > DateTime.Now || Convert.ToDateTime(txtFechaInicial.Text) > DateTime.Now) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('La fecha final no puede ser mayor a hoy.')", true); } else if (Convert.ToDateTime(txtFechaFinal.Text) < Convert.ToDateTime(txtFechaInicial.Text)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('La fecha final no puede ser mayor a la fecha inicial.')", true); } else { //Limpia el origen de datos del gridview gvViaticos.DataSource = null; gvViaticos.DataBind(); //asigna a la fuente de datos del gridview la lista corrrespondiente a la consulta que se está realizando. switch (consulta) { case 1: gvViaticos.DataSource = this.ObtenerListaOrden(obj); break; case 2: gvViaticos.DataSource = this.ObtenerListaSolicitud(obj); break; case 3: gvViaticos.DataSource = this.ObtenerListaLiquidacion(obj); break; default: gvViaticos.DataSource = null; break; } if (gvViaticos.DataSource == null) { //Muestra un mensaje en caso de que la consulta no traiga valores. ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('No se han encontrado datos con estos criterios.')", true); } } gvViaticos.DataBind(); gvViaticos.Visible = true; }