add site
This commit is contained in:
166
Site/AssetView/SingleAssetView.aspx.cs
Normal file
166
Site/AssetView/SingleAssetView.aspx.cs
Normal file
@@ -0,0 +1,166 @@
|
||||
using Foresight.Fleet.Services.Styles;
|
||||
using Foresight.Fleet.Services.User;
|
||||
using IronIntel.Contractor;
|
||||
using IronIntel.Contractor.iisitebase;
|
||||
using IronIntel.Contractor.Site;
|
||||
using IronIntel.Contractor.Users;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class SingleAssetView : SingleAssetViewBasePage
|
||||
{
|
||||
public string CurrentDate = "";
|
||||
public bool IsDealer = SystemParams.IsDealer;
|
||||
protected string MenuBackgroundColor = "#D7690E";
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
string methodName = Request.Form["MethodName"];
|
||||
if (!string.IsNullOrEmpty(methodName))
|
||||
{
|
||||
ProcessRequest(methodName);
|
||||
}
|
||||
else if (!IsPostBack)
|
||||
{
|
||||
if (!CheckLoginSession())
|
||||
{
|
||||
RedirectToLoginPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Title = PageTitle;
|
||||
GetUIStyle();
|
||||
}
|
||||
}
|
||||
DateTime userlocaldate = SystemParams.ConvertToUserTimeFromUtc(GetCurrentLoginSession().User, DateTime.UtcNow);
|
||||
CurrentDate = userlocaldate.ToShortDateString();
|
||||
}
|
||||
private void GetUIStyle()
|
||||
{
|
||||
var sessionid = IronIntelBasePage.GetLoginSessionID(Request);
|
||||
var user = UserManagement.GetUserBySessionID(sessionid);
|
||||
if (user != null)
|
||||
{
|
||||
CustUIStyle style = SystemParams.GetUIStyle(user.IID);
|
||||
if (style != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(style.MenuBackgroundColor))
|
||||
{//目前Menu和Module背景色使用同一个颜色,在有设置的情况下
|
||||
MenuBackgroundColor = style.MenuBackgroundColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool ThrowIfNotAllowed
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanEditAsset
|
||||
{
|
||||
get
|
||||
{
|
||||
string canEdit = Request.Params["canedit"];
|
||||
var user = GetCurrentUser();
|
||||
bool permission = CheckRight(SystemParams.CompanyID, Feature.MANAGE_ASSETS);
|
||||
return canEdit == "1" && permission;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanViewWorkOrder
|
||||
{
|
||||
get
|
||||
{
|
||||
bool wolic = SystemParams.HasLicense("WorkOrder");
|
||||
bool permission = CheckRight(SystemParams.CompanyID, Feature.WORK_ORDER);
|
||||
return !SystemParams.IsDealer && wolic && permission;
|
||||
}
|
||||
}
|
||||
public bool CanViewMR
|
||||
{
|
||||
get
|
||||
{
|
||||
bool license = SystemParams.HasLicense("PreventativeMaintenance");
|
||||
bool mrlicense = SystemParams.HasLicense("MaintenanceRecord");
|
||||
bool permission = CheckRight(SystemParams.CompanyID, Feature.PREVENTATIVE_MAINTENANCE);
|
||||
return !SystemParams.IsDealer && license && mrlicense && permission && !CanViewWorkOrder;//10486 WorkOrder和Maintenance Record只显示一个
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanViewPM
|
||||
{
|
||||
get
|
||||
{
|
||||
bool license = SystemParams.HasLicense("PreventativeMaintenance");
|
||||
bool permission = CheckRight(SystemParams.CompanyID, Feature.PREVENTATIVE_MAINTENANCE);
|
||||
return !SystemParams.IsDealer && license && permission;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanViewAlertsManagement
|
||||
{
|
||||
get
|
||||
{
|
||||
bool lic = SystemParams.HasLicense("AlertsManagement");
|
||||
bool permission = CheckRight(SystemParams.CompanyID, Feature.ALERTS_MANAGEMENT);
|
||||
return !SystemParams.IsDealer && lic && permission;
|
||||
}
|
||||
}
|
||||
public bool CanViewFuelRecords
|
||||
{
|
||||
get
|
||||
{
|
||||
bool lic = SystemParams.HasLicense("FuelRecords");
|
||||
bool permission = CheckRight(SystemParams.CompanyID, Feature.FUEL_RECORDS);
|
||||
return !SystemParams.IsDealer && lic && permission;
|
||||
}
|
||||
}
|
||||
public bool EnableSmartWitness
|
||||
{
|
||||
get
|
||||
{
|
||||
bool lic = SystemParams.HasLicense("SmartWitness");
|
||||
return lic;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanEditPM
|
||||
{
|
||||
get
|
||||
{
|
||||
string canEdit = Request.Params["canedit"];
|
||||
var user = GetCurrentUser();
|
||||
|
||||
bool license = SystemParams.HasLicense("PreventativeMaintenance");
|
||||
bool permission = CheckRight(SystemParams.CompanyID, Feature.PREVENTATIVE_MAINTENANCE);
|
||||
return canEdit == "1" && license && permission;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSupperAdmin
|
||||
{
|
||||
get
|
||||
{
|
||||
var user = GetCurrentUser();
|
||||
return user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin;
|
||||
}
|
||||
}
|
||||
public bool CanViewInspection
|
||||
{
|
||||
get
|
||||
{
|
||||
bool lic = SystemParams.HasLicense("Inspection");
|
||||
bool permission = CheckRight(SystemParams.CompanyID, Feature.INSPECTION_TEMPLATES);
|
||||
return !SystemParams.IsDealer && lic && permission;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user