init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
110
KretaWeb/Models/Builder/LayoutModelBuilder.cs
Normal file
110
KretaWeb/Models/Builder/LayoutModelBuilder.cs
Normal file
|
@ -0,0 +1,110 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Kreta.BusinessLogic.Classes;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Enums;
|
||||
using Kreta.Framework;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Security;
|
||||
using Kreta.Web.Utils;
|
||||
|
||||
namespace Kreta.Web.Models.Builder
|
||||
{
|
||||
public class LayoutModelBuilder
|
||||
{
|
||||
private UrlHelper url;
|
||||
public UrlHelper Url
|
||||
{
|
||||
get
|
||||
{
|
||||
if (url == null)
|
||||
{
|
||||
url = new UrlHelper(HttpContext.Current.Request.RequestContext);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetBase(string uzenetekSzama, LayoutModel model, string url)
|
||||
{
|
||||
string shortname = ClaimData.OrganizationShortName;
|
||||
model.OrganizationName = ClaimData.OrganizationCode + " - " + (string.IsNullOrWhiteSpace(shortname) ? ClaimData.OrganizationName : shortname);
|
||||
model.UserMenu = CreateUserMenu(uzenetekSzama);
|
||||
model.HomePageUrl = Url.Content(string.Format(CommonExtensions.GetDefaultPage(true)));
|
||||
}
|
||||
|
||||
public LayoutUserMenu CreateUserMenu(string uzenetekSzama)
|
||||
{
|
||||
var menu = new LayoutUserMenu();
|
||||
|
||||
menu.UserName = string.Format("{0} {1}", ClaimData.FelhasznaloNev, !string.IsNullOrWhiteSpace(ClaimData.GondviseloNeve) ? "(" + ClaimData.GondviseloNeve + ")" : "");
|
||||
menu.MessageCount = uzenetekSzama;
|
||||
menu.EventCount = GetEventCount();
|
||||
|
||||
menu.AdminHomePageUrl = "";
|
||||
var packages = ClaimData.FelhasznaloSzerepCsomagok;
|
||||
if (packages.Contains(KretaClaimPackages.Adminisztrator.ClaimValue))
|
||||
{
|
||||
var url = new UrlHelper(HttpContext.Current.Request.RequestContext);
|
||||
menu.AdminHomePageUrl = url.Content("~/Adminisztracio/RendszerHibaErtesites");
|
||||
}
|
||||
|
||||
menu.ProfilImgSrc = ProfileUtils.UserProfileImage;
|
||||
menu.UserMenuItems = new List<LayoutUserMenuItem>();
|
||||
|
||||
var fullKretaVersion = ClaimData.IsFullKretaVerzio;
|
||||
|
||||
if (ClaimManager.HasPackage(KretaClaimPackages.Ellenorzo.ClaimValue, KretaClaimPackages.Naplo.ClaimValue))
|
||||
{
|
||||
string icon = "fa-user";
|
||||
string action = "MasterLayoutHelper.popUpSajatAdatlapWindow(); return false;";
|
||||
|
||||
menu.UserMenuItems.Add(new LayoutUserMenuItem { Name = LayoutResource.SzemelyesAdatlap, Url = "javascript:void(0);", ClientAction = action, CssClass = icon });
|
||||
}
|
||||
|
||||
string tempURL = Url.Action("Index", "Profil", new { area = "Adminisztracio" });
|
||||
if (!fullKretaVersion)
|
||||
{
|
||||
tempURL = "javascript:void(0);";
|
||||
}
|
||||
|
||||
menu.UserMenuItems.Add(new LayoutUserMenuItem { Name = StringResourcesUtil.GetString(2610) /*Profil beállítások*/, Url = tempURL, ClientAction = string.Empty, CssClass = "fa-cog" + (!fullKretaVersion ? " disabledMenuItem" : "") });
|
||||
if (ClaimData.FelhasznaloSzerepkorok.Keys.Except(Constants.General.NotVisiblePermissions).Count() > 1 && (ClaimData.IsActivTanev || !ClaimData.IsAdministrator))
|
||||
{
|
||||
menu.UserMenuItems.Add(new LayoutUserMenuItem { Name = MenuResource.SzerepkorValtas, Url = Url.Action("Index", "SzerepkorValaszto", new { area = "Adminisztracio" }), ClientAction = string.Empty, CssClass = "fa-retweet" });
|
||||
}
|
||||
|
||||
if (ClaimData.FelhasznaloSzerepkor == SzerepkorTipusEnum.Adminisztrator)
|
||||
{
|
||||
menu.UserMenuItems.Add(new LayoutUserMenuItem() { Name = UgyfelszolgalatResource.KRETAUgyfelszolgalat, Url = "javascript:void(0);", ClientAction = "JiraRestHelper.popUpUgyfelSzolgalatWindow(); return false;", CssClass = "fa-ugyfelszolgalaticon" });
|
||||
}
|
||||
|
||||
menu.UserMenuItems.Add(new LayoutUserMenuItem { Name = StringResourcesUtil.GetString(2582) /*Kijelentkezés*/, Url = "javascript:void(0);", ClientAction = "MasterLayout.LogOut(); return false;", CssClass = "fa-sign-out" });
|
||||
|
||||
GetPopupAzonosito(menu);
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
private void GetPopupAzonosito(LayoutUserMenu menu)
|
||||
{
|
||||
var cookie = HttpContext.Current.Request.Cookies.Get("DisplayedPopups");
|
||||
DataSet ds = new AdminHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetNextDashboardPopupAzonosito(ClaimData.GondviseloId, cookie?.Value.Split('|'));
|
||||
if (ds != null && ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
menu.NeedPopupId = SDAConvert.ToInt32(ds.Tables[0].Rows[0]["ID"]);
|
||||
menu.NeedPopupAzonosito = SDAConvert.ToString(ds.Tables[0].Rows[0]["C_EGYEDIAZONOSITO"]);
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetEventCount()
|
||||
{
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue