75 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			75 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using Foresight.Fleet.Services.User;
 | |
| using IronIntel.Contractor;
 | |
| using IronIntel.Contractor.Site;
 | |
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| using System.Web;
 | |
| using System.Web.UI;
 | |
| using System.Web.UI.WebControls;
 | |
| 
 | |
| public partial class MachineDeviceManagement_MachineDeviceManagement : MachineDeviceBasePage
 | |
| {
 | |
|     protected bool ManageGPSDevicesDisplay = false;
 | |
|     protected bool ManageMachinesDisplay = false;
 | |
|     protected bool ManageModelDisplay = false;
 | |
|     protected bool MachineGroupDisplay = false;
 | |
|     protected bool ShareAssetDisplay = false;
 | |
|     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;
 | |
| 
 | |
|                 IronIntel.Contractor.Users.UserInfo user = GetCurrentUser();
 | |
|                 if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin)
 | |
|                 {
 | |
|                     ManageMachinesDisplay = true;
 | |
|                     ManageGPSDevicesDisplay = true;
 | |
|                     ManageModelDisplay = true;
 | |
|                     if (!IronIntel.Contractor.SystemParams.IsDealer)
 | |
|                         MachineGroupDisplay = true;
 | |
|                 }
 | |
|                 else if (user.UserType == IronIntel.Contractor.Users.UserTypes.Admin)
 | |
|                 {
 | |
|                     ManageMachinesDisplay = true;
 | |
|                     ManageModelDisplay = true;
 | |
|                     if (!IronIntel.Contractor.SystemParams.IsDealer)
 | |
|                         MachineGroupDisplay = true;
 | |
|                 }
 | |
| 
 | |
|                 if (user.UserType < IronIntel.Contractor.Users.UserTypes.Admin)
 | |
|                 {
 | |
|                     if (CheckRight(SystemParams.CompanyID, Feature.MANAGE_ASSETS))
 | |
|                     {
 | |
|                         ManageMachinesDisplay = true;
 | |
|                     }
 | |
|                 }
 | |
| 
 | |
|                 if (user.UserType < IronIntel.Contractor.Users.UserTypes.SupperAdmin)
 | |
|                 {
 | |
|                     if (CheckRight(SystemParams.CompanyID, Foresight.Fleet.Services.User.Feature.MANAGE_DEVICES))
 | |
|                         ManageGPSDevicesDisplay = true;
 | |
|                 }
 | |
| 
 | |
|                 bool license = SystemParams.HasLicense("ShareAsset");
 | |
|                 ShareAssetDisplay = ManageMachinesDisplay && license && !SystemParams.IsDealer;
 | |
| 
 | |
|                 if (!ManageMachinesDisplay && !ManageGPSDevicesDisplay)
 | |
|                     RedirectToEntryPage();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|     }
 | |
| } |