using System; using System.Linq; using Neo.LegitimateLicences.Data.Models; using Neo.LegitimateLicences.Common; using Neo.Afx.Security; namespace Neo.LegitimateLicences.Logic.Helpers { public class UserProfileHelper { public long UserID { get; set; } public long? OfficeLocationID { get; set; } public Vw_OfficeLocationSetup UserOfficeLocation { get; set; } /// /// Overload /// /// /// public UserProfileHelper(long userID, long? officeLocationID) { UserID = userID; OfficeLocationID = officeLocationID; } /// /// Get OfficeLocation /// public Vw_OfficeLocationSetup OfficeLocation { get { if(OfficeLocationID == null) { return new Vw_OfficeLocationSetup(); } else if (UserOfficeLocation != null) { return UserOfficeLocation; } else { var db = new LegitimateDatabase(); UserOfficeLocation = db.GetOfficeLocation(OfficeLocationID.Value); return UserOfficeLocation; } } } /// /// Determine if User is part of NPTR /// public Boolean IsNPTR { get { return OfficeLocation.DivisionTypeID == (short)DivisionTypeEnum.NPTR; } } /// /// Determine if User is part of TAT /// public Boolean IsTAT { get { return OfficeLocation.DivisionTypeID == (short)DivisionTypeEnum.TAT; } } } }