using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Foresight.Fleet.Services.User; using IronIntel.Contractor; using IronIntel.Contractor.Site; public partial class TeamIntelligence : InspectionBasePage { public bool ShowTemplate = false; public bool TemplateReadonly = false; public bool ShowReport = false; public bool ShowExportPackage = false; public bool ReportReadonly = false; public string BeginDate = ""; public string EndDate = ""; protected void Page_Load(object sender, EventArgs e) { if (!CheckLoginSession()) { RedirectToLoginPage(); } else { string methodName = Request.Form["MethodName"]; if (!string.IsNullOrEmpty(methodName)) { ProcessRequest(methodName); } else if (!IsPostBack) { this.Title = PageTitle; bool teamintelligence = SystemParams.HasLicense("TeamIntelligence"); if (!teamintelligence) RedirectToLoginPage(); bool inspectionpkg = SystemParams.HasLicense("ExportInspectionPackage"); var user = GetCurrentUser(); ShowExportPackage = inspectionpkg && user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin; if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin || user.UserType == IronIntel.Contractor.Users.UserTypes.Admin) { if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin) {//T#12046-Team Intelligence Access ShowTemplate = true; ShowReport = true; } } else if (user.UserType == IronIntel.Contractor.Users.UserTypes.Common) { //var client = FleetServiceClientHelper.CreateClient(); //Tuple[] pmss = client.GetUserPermissions(SystemParams.CompanyID, user.IID); //if (pmss.Length > 0) //{ // Tuple temppms = pmss.FirstOrDefault(m => m.Item1.Id == Feature.TEAM_TEMPLATES); // Tuple reportpms = pmss.FirstOrDefault(m => m.Item1.Id == Feature.TEAM_REPORTS); // if (temppms != null) // { // ShowTemplate = true; // if (temppms.Item2 == Permissions.ReadOnly) // TemplateReadonly = true; // } // if (reportpms != null) // { // ShowReport = true; // if (reportpms.Item2 == Permissions.ReadOnly) // ReportReadonly = true; // } //} if (ShowTemplate == false && ShowReport == false) RedirectToEntryPage(); } } DateTime userlocaldate = SystemParams.ConvertToUserTimeFromUtc(GetCurrentLoginSession().User, DateTime.UtcNow); BeginDate = userlocaldate.AddDays(-13).ToShortDateString(); EndDate = userlocaldate.ToShortDateString(); } } public bool IsForesight { get { var user = GetCurrentUser(); if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin) return true; else return false; } } public bool IsAdmin { get { var user = GetCurrentUser(); if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin || user.UserType == IronIntel.Contractor.Users.UserTypes.Admin) return true; else return false; } } public bool IsSupperAdmin { get { var user = GetCurrentUser(); if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin) return true; else return false; } } }