using Foresight.Fleet.Services.User; using IronIntel.Contractor; using IronIntel.Contractor.Site.JobSite; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class JobSiteManage : JobSitesBasePage { protected bool CanConfig = false; protected void Page_Load(object sender, EventArgs e) { string methodName = Request.Form["MethodName"]; if (!string.IsNullOrEmpty(methodName)) { ProcessRequest(); } else if (!IsPostBack) { Title = PageTitle; if (CheckLoginSession()) { bool license = SystemParams.HasLicense("JobSites"); bool permission = CheckRight(SystemParams.CompanyID, Feature.JOB_SITES); if (!license || !permission) RedirectToEntryPage(); bool autoCreate = SystemParams.HasLicense("AutoCreationConfig"); var user = GetCurrentUser(); if (autoCreate) { if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin) { CanConfig = true; } else { var client = FleetServiceClientHelper.CreateClient(); Tuple[] pmss = client.GetUserPermissions(SystemParams.CompanyID, user.IID); if (pmss.Length > 0) { Tuple autojobsitespms = pmss.FirstOrDefault(m => m.Item1.Id == Feature.JOB_SITES_AUTOCREATE); if (autojobsitespms != null) { CanConfig = true; } } } } } } } protected override int FeatureID { get { return Foresight.Fleet.Services.User.Feature.JOB_SITES; } } 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; } } }