using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using AyABL.SEG;
using AyAEM.ExceptionManagement.Exceptions;
using System.Diagnostics;
///
/// Descripción breve de General
///
public partial class General : System.Web.UI.Page
{
#region Variables
BitacoraBL objBitacora;
RolMenuComandoBL objRolMenuComandoBL;
MenuBL objMenuBL;
#endregion
#region Metodos
///
/// Carga el rol de acceso de la pagina
///
///
public DataSet getComandos()
{
DataSet dsComandosMenu = new DataSet();
string strURL = string.Empty;
objMenuBL = new MenuBL();
objRolMenuComandoBL = new RolMenuComandoBL();
ViewState["PUEDEMODIFICAR"] = false;
if (Session["PKROL"] != null)
{
//strURL = Request.Url.AbsoluteUri.Replace("http://" + Request.Url.Authority + Request.ApplicationPath.ToString(), "~/").ToString().Replace("//", "/");
strURL = "~" + Request.Url.AbsolutePath;
//objMenuBL.objMenuEL.URL = strURL; //.Substring(0, strURL.Length - 54) + ".aspx";
dsComandosMenu = objRolMenuComandoBL.cargarComandosxRol(Convert.ToInt32(Session["PKROL"].ToString()), strURL);
if (dsComandosMenu.Tables[0].Rows.Count != 0 || dsComandosMenu.Tables[0] != null)
{
ViewState["PkMenu"] = dsComandosMenu.Tables[0].Rows[0]["PKMENU"];
}
}
return dsComandosMenu;
}
///
/// Registrar el evento en bitacora
///
///
///
///
public void GuardarEventoBitacora(string p_strLogin, string p_strAccion,string p_strRegistro, string p_strNombrePagina)
{
objBitacora = new BitacoraBL();
objBitacora.objBitacoraEL.Login = p_strLogin;
objBitacora.objBitacoraEL.Fecha = DateTime.Now;
objBitacora.objBitacoraEL.Accion = p_strAccion;
objBitacora.objBitacoraEL.Registro = p_strRegistro;
objBitacora.objBitacoraEL.Pagina = p_strNombrePagina;
objBitacora.insertarBitacora();
}
///
/// Muestra la cantidad de datos que tiene el gridview asi como cuales son los datos que estoy visualizando en este. Ej: 11 al 20 de 20 datos
///
///
///
///
public static void detalleGridView(DataSet p_dsDatos, GridView p_grvGridView, object p_objLabel)
{
try
{
p_grvGridView.ShowHeader = true;
p_grvGridView.DataSource = p_dsDatos;
p_grvGridView.DataBind();
string mensaje = "0 Registros encontrados";
if (p_dsDatos != null)
{
if (p_dsDatos.Tables[0].Rows.Count > 0)
{
mensaje = "Viendo datos del " + ((p_grvGridView.PageIndex * p_grvGridView.PageSize) + 1) + " al " + (p_grvGridView.Rows.Count +
(p_grvGridView.PageIndex * p_grvGridView.PageSize)) + " de " + p_dsDatos.Tables[0].Rows.Count;
}
}
if (p_objLabel != null)
{
Label label = (Label)p_objLabel;
label.Text = mensaje;
}
}
catch (Exception ex)
{
throw ex;
}
}
public static void detalleGRVDatos(DataSet p_dsDatos, GridView p_grvGridView)
{
try
{
p_grvGridView.ShowHeader = true;
p_grvGridView.DataSource = p_dsDatos;
p_grvGridView.DataBind();
}
catch (Exception ex)
{
throw ex;
}
}
public static void ddlListaProyectos(DataSet p_dsDatos, DropDownList p_ddlListado)
{
try
{
p_ddlListado.DataSource = p_dsDatos;
p_ddlListado.DataTextField = p_dsDatos.Tables[0].Columns["NOMBREPROYECTO2"].ColumnName;
p_ddlListado.DataValueField = p_dsDatos.Tables[0].Columns["PKPROYECTO"].ColumnName;
p_ddlListado.DataBind();
p_ddlListado.Items.Insert(0, new ListItem("Seleccione un Proyecto", "-1"));
}
catch (Exception ex)
{
throw ex;
}
}
///
/// muestra un mensaje de error en la ventana y en caso de que se presente un error
/// guardar el mismo en el archivo de ErrorLog.txt
///
///
///
public void MensajeError(string p_strMensaje,Exception ex)
{
try
{
if (ex != null)
{
AyAException.Publish(ex, p_strMensaje);
}
//ClientScript.RegisterStartupScript(this.GetType(), "alert", "MostrarMensaje();", true);
System.Web.UI.ScriptManager.RegisterStartupScript(
this,
typeof(General),
ClientID,
"toastr.error('" + p_strMensaje + "
', 'Error', toastr.options ={timeOut: 0, extendedTimeOut: 0,closeButton: false})",
true);
}
catch (Exception exm)
{
throw exm;
}
}
///
/// muestra un mensaje de informacion en la ventana y en caso de que se desee mostrar un mensaje del sistema
/// guardar el mismo en el archivo de ErrorLog.txt
///
///
public void MensajeInformativo(string p_strMensaje)
{
try
{
System.Web.UI.ScriptManager.RegisterStartupScript(
this,
typeof(General),
ClientID,
"toastr.success('" + p_strMensaje + "