Initial commit
This commit is contained in:
9
SIG.Web/AppCode/Session/IMenuProvider.cs
Normal file
9
SIG.Web/AppCode/Session/IMenuProvider.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SIG.Web.AppCode.Session
|
||||
{
|
||||
public interface IMenuProvider
|
||||
{
|
||||
IReadOnlyList<MenuItemModel> GetMenu(UserSessionModel user);
|
||||
}
|
||||
}
|
||||
10
SIG.Web/AppCode/Session/ISessionContext.cs
Normal file
10
SIG.Web/AppCode/Session/ISessionContext.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace SIG.Web.AppCode.Session
|
||||
{
|
||||
public interface ISessionContext
|
||||
{
|
||||
T Get<T>(string key) where T : class;
|
||||
void Set<T>(string key, T value) where T : class;
|
||||
void Remove(string key);
|
||||
void Clear();
|
||||
}
|
||||
}
|
||||
19
SIG.Web/AppCode/Session/MenuItemModel.cs
Normal file
19
SIG.Web/AppCode/Session/MenuItemModel.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SIG.Web.AppCode.Session
|
||||
{
|
||||
[Serializable]
|
||||
public sealed class MenuItemModel
|
||||
{
|
||||
public int CveModulo { get; set; }
|
||||
public int? CveModuloPadre { get; set; }
|
||||
public string NombreModulo { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string ClaseCssIcono { get; set; }
|
||||
public string ClaseCssEstilo { get; set; }
|
||||
public int OrdenVisualizacion { get; set; }
|
||||
public bool Visible { get; set; } = true;
|
||||
public List<MenuItemModel> Hijos { get; set; } = new List<MenuItemModel>();
|
||||
}
|
||||
}
|
||||
8
SIG.Web/AppCode/Session/SessionKeys.cs
Normal file
8
SIG.Web/AppCode/Session/SessionKeys.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace SIG.Web.AppCode.Session
|
||||
{
|
||||
public static class SessionKeys
|
||||
{
|
||||
public const string CurrentUser = "SIG_CurrentUser";
|
||||
public const string TokenSesion = "SIG_SessionToken";
|
||||
}
|
||||
}
|
||||
16
SIG.Web/AppCode/Session/UserSessionModel.cs
Normal file
16
SIG.Web/AppCode/Session/UserSessionModel.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace SIG.Web.AppCode.Session
|
||||
{
|
||||
public sealed class UserSessionModel
|
||||
{
|
||||
public int CveUsuario { get; set; }
|
||||
public int CveRol { get; set; }
|
||||
public int CveEmpresa { get; set; }
|
||||
public string NombreUsuario { get; set; }
|
||||
public string Nombre { get; set; }
|
||||
public string CorreoElectronico { get; set; }
|
||||
public string NombreRol { get; set; }
|
||||
public string NombreDominio { get; set; }
|
||||
public string TokenSesion { get; set; }
|
||||
public bool DebeCambiarContrasena { get; set; }
|
||||
}
|
||||
}
|
||||
28
SIG.Web/AppCode/Session/WebFormsSessionContext.cs
Normal file
28
SIG.Web/AppCode/Session/WebFormsSessionContext.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Web;
|
||||
|
||||
namespace SIG.Web.AppCode.Session
|
||||
{
|
||||
public sealed class WebFormsSessionContext : ISessionContext
|
||||
{
|
||||
public T Get<T>(string key) where T : class
|
||||
{
|
||||
return HttpContext.Current?.Session?[key] as T;
|
||||
}
|
||||
|
||||
public void Set<T>(string key, T value) where T : class
|
||||
{
|
||||
if (HttpContext.Current?.Session == null) return;
|
||||
HttpContext.Current.Session[key] = value;
|
||||
}
|
||||
|
||||
public void Remove(string key)
|
||||
{
|
||||
HttpContext.Current?.Session?.Remove(key);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
HttpContext.Current?.Session?.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user