using System; using System.Collections.Generic; using System.Data; using System.Web.UI.WebControls; using System.Runtime; using AyABL.APL; using AyABL.BIT; using AyAEM.ExceptionManagement.Exceptions; using System.Diagnostics; /// /// Descripción breve de General /// public partial class General : System.Web.UI.Page { #region Variables ItemMenuBL objItemMenuBL; RolItemMenuComandoBL objRolItemMenuComandoBL; #endregion #region Metodos /// /// 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; } } /// /// Carga el rol de acceso de la pagina /// /// public DataSet getComandos() { DataSet dsComandosMenu = new DataSet(); string strURL = string.Empty; objItemMenuBL = new ItemMenuBL(); ViewState["PUEDEMODIFICAR"] = false; if (Session["PKROL"] != null) { strURL = Request.Url.AbsoluteUri.Replace("http://" + Request.Url.Authority + Request.ApplicationPath.ToString(), "~/").ToString().Replace("//", "/"); objItemMenuBL.objItemMenuEL.URL = strURL.Substring(0, strURL.Length - 54);// +".aspx"; dsComandosMenu = objItemMenuBL.obtenerItemMenuRol(Convert.ToInt32(Session["PKROL"])); if (dsComandosMenu.Tables[0].Rows.Count != 0) { ViewState["PkItemMenu"] = dsComandosMenu.Tables[0].Rows[0]["PKITEMMENU"]; } } return dsComandosMenu; } BitacoraBL objBitacora = null; /// /// Registrar el evento en bitacora /// /// /// /// public void GuardarEventoBitacora(string p_strLogin, string p_strAccion, string p_strRegistro, string p_strNombrePagina, int p_intPkApp) { 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.objBitacoraEL.Aplicacion = p_intPkApp; objBitacora.objBitacoraEL.DireccionIP = Request.UserHostAddress.ToString(); objBitacora.insertarBitacora(); } /// /// 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); System.Web.UI.ScriptManager.RegisterStartupScript( this, typeof(General), ClientID, "toastr.error('" + p_strMensaje + ". No se realizó la transacción. Error: " + ex.Message.ToString() + "

', 'Error : ',toastr.options ={timeOut: 0, extendedTimeOut: 0,closeButton: true})", true); } else { System.Web.UI.ScriptManager.RegisterStartupScript( this, typeof(General), ClientID, "toastr.error('" + p_strMensaje + ". No se realizó la transacción.

', 'Error : ',toastr.options ={timeOut: 0, extendedTimeOut: 0,closeButton: true})", true); } } catch (Exception exm) { throw exm; } } /// /// muestra un mensaje de informacion en la ventana /// /// public void MensajeInformativo(string p_strMensaje) { try { System.Web.UI.ScriptManager.RegisterStartupScript( this, typeof(General), ClientID, "toastr.success('" + p_strMensaje + "', 'Información',toastr.options ={closeButton: true})", true); } catch (Exception ex) { throw ex; } } /// /// 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 MensajeAlerta(string p_strMensaje) { try { System.Web.UI.ScriptManager.RegisterStartupScript( this, typeof(General), ClientID, "toastr.warning('" + p_strMensaje + "', 'Información',toastr.options ={closeButton: true})", true); } 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 EjecutarScript(string p_strScript) { try { System.Web.UI.ScriptManager.RegisterStartupScript( this, typeof(General), ClientID, p_strScript , true); } catch (Exception exm) { throw exm; } } #endregion }