protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); }
/// <summary> /// Logic that builds all the navigation menu of the site /// </summary> /// <param name="user">The username</param> /// <param name="companyId">The id of the company the user is related to</param> /// <returns>Return the MenuModel list that the view should parse to display the navigation menu bar</returns> public static List <MenuDashboardDTO> GetMenuModel() { List <MenuDashboardDTO> menuModelList = new List <MenuDashboardDTO>(); using (ArtexConnection dorantesContext = new ArtexConnection()) { AspNetUsers userEntity = UsuarioDAO.GetUserLogged(dorantesContext); /* * if (userEntity != null) * { * var coockie = HttpContext.Current.Response.Cookies.Get("userName"); * if (coockie != null && HttpContext.Current.Response.Cookies.AllKeys.Contains("userName") && coockie.Value != userEntity.UserName) * { * DIRECCION direction = userEntity.PERSONAL.PERSONA.DIRECCION; * HttpContext.Current.Response.Cookies["userDirection"].Value = direction.ESTADO1.DESCRIPCION + ", " + direction.PAIS1.DESCRIPCION; * HttpContext.Current.Response.Cookies["userDirection"].Expires = DateTime.Now.AddYears(4); * * } * * HttpContext.Current.Response.Cookies["userName"].Value = userEntity.UserName; * HttpContext.Current.Response.Cookies["userName"].Expires = DateTime.Now.AddYears(4); * * * HttpContext.Current.Response.Cookies["userImage"].Value = userEntity.UserImage; * HttpContext.Current.Response.Cookies["userImage"].Expires = DateTime.Now.AddYears(4); * * } * else * { * var coockie = HttpContext.Current.Response.Cookies.Get("userName"); * if (coockie == null) * { * HttpContext.Current.Response.Cookies["userDirection"].Value = ""; * HttpContext.Current.Response.Cookies["userName"].Value = ""; * HttpContext.Current.Response.Cookies["userImage"].Value = ""; * } * } * */ // Get user rol and build modules access with the rol if (userEntity != null && userEntity.rol != null) { rol role = userEntity.rol; menuModelList = GetMenuModelByRol(role); } dorantesContext.Dispose(); } return(menuModelList); }