This commit is contained in:
2023-05-30 17:34:56 +08:00
parent e728c66786
commit 9da1c4cf30
194 changed files with 10680 additions and 9060 deletions

View File

@ -583,7 +583,7 @@ namespace IronIntel.Contractor.Site.Customer
class CommentItem : CommentInfo
{
public string SubmitLocalDateStr { get { return SubmitLocalDate == null ? "" : SubmitLocalDate.ToString("M/d/yyyy h:m:s tt"); } }
public string SubmitLocalDateStr { get { return SubmitLocalDate == null ? "" : SubmitLocalDate.ToString("M/d/yyyy h:mm:ss tt"); } }
}

View File

@ -50,8 +50,8 @@ namespace IronIntel.Contractor.Site
CumulativeHours = c.CumulativeHours,
MachineTaskHourCheck = c.MachineTaskHourCheck,
DiffToService = c.DiffToService,
EstDueDate = c.ESTServiceNeededBy.ToString("MM/dd/yyyy"),
EstShipDate = c.ESTShopDate.ToString("MM/dd/yyyy"),
EstDueDate = c.ESTServiceNeededBy.ToString("M/d/yyyy"),
EstShipDate = c.ESTShopDate.ToString("M/d/yyyy"),
TaskComplete = c.TaskComplete,
UPSTrackingNumber = c.UPSTrackingNumber,
@ -107,7 +107,7 @@ namespace IronIntel.Contractor.Site
// 组织 shipdates
var shipdates = datas.Distinct(new ShipDateEqualityComparer())
.Select(m => m.ESTShopDate.ToString("MM/dd/yyyy"))
.Select(m => m.ESTShopDate.ToString("M/d/yyyy"))
.OrderBy(d => d);
var shipgroup = new FilterQGroupByShipDate
{
@ -117,7 +117,7 @@ namespace IronIntel.Contractor.Site
IEnumerable<MachineTasksNotificationInfo> dts = datas;
if (query.ShipDates != null && query.ShipDates.Length > 0)
{
dts = datas.Where(m => query.ShipDates.Contains(m.ESTShopDate.ToString("MM/dd/yyyy")));
dts = datas.Where(m => query.ShipDates.Contains(m.ESTShopDate.ToString("M/d/yyyy")));
}
else
{

View File

@ -258,7 +258,7 @@ namespace IronIntel.Contractor.Site
var sesstion = GetCurrentLoginSession();
if (sesstion != null)
{
string clientdata = Request.Params["ClientData"];
string clientdata = HttpUtility.HtmlDecode(Request.Params["ClientData"]);
string[] ps = JsonConvert.DeserializeObject<string[]>(clientdata);
bool teamintelligence = Helper.IsTrue(ps[0]);
DateTime startdate = Helper.DBMinDateTime;
@ -894,7 +894,7 @@ namespace IronIntel.Contractor.Site
var user = GetCurrentUser();
if (user != null)
{
string clientdata = Request.Params["ClientData"];
string clientdata = HttpUtility.HtmlDecode(Request.Params["ClientData"]);
string[] ps = JsonConvert.DeserializeObject<string[]>(clientdata);
bool teamintelligence = Helper.IsTrue(ps[0]);
int state = 0;
@ -2355,9 +2355,18 @@ namespace IronIntel.Contractor.Site
if (Request.Files.Count > 0)
{
var logoFile = Request.Files[0];
var logo = ConvertFile2bytes(logoFile);
layout.LOGO = FI.FIC.ResManager.MakeThumbnail(logo, 0, 180, "H");
for (int i = 0; i < Request.Files.Count; i++)
{
var logoFile = Request.Files[i];
var logo = ConvertFile2bytes(logoFile);
string key = Request.Files.AllKeys[i];
if (string.Compare("iconFile", key, true) == 0)
layout.LOGO = FI.FIC.ResManager.MakeThumbnail(logo, 0, 180, "H");
else if (string.Compare("iconCenterFile", key, true) == 0)
layout.CenterLOGO = FI.FIC.ResManager.MakeThumbnail(logo, 0, 180, "H");
else if (string.Compare("iconRightFile", key, true) == 0)
layout.RightLOGO = FI.FIC.ResManager.MakeThumbnail(logo, 0, 180, "H");
}
}
if (teamintelligence)

View File

@ -37,6 +37,21 @@
<AssemblyOriginatorKeyFile>LHBIS.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="FICBLC">
<HintPath>..\Reflib\FIC\FICBLC.dll</HintPath>
</Reference>
<Reference Include="FICIntf, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b006d6021b5c4397, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Reflib\FIC\FICIntf.dll</HintPath>
</Reference>
<Reference Include="FICIntfAdv, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b006d6021b5c4397, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Reflib\FIC\FICIntfAdv.dll</HintPath>
</Reference>
<Reference Include="FICModels, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b006d6021b5c4397, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Reflib\FIC\FICModels.dll</HintPath>
</Reference>
<Reference Include="FICore">
<HintPath>..\Reflib\FICore.dll</HintPath>
</Reference>
@ -179,22 +194,6 @@
<None Include="LHBIS.snk" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\FI\FICG5\Core\Service\FICBLC\FICBLC.csproj">
<Project>{39e2a8c6-f58f-4839-b7c1-82d44153fc3a}</Project>
<Name>FICBLC</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\FI\FICG5\Core\Service\FICIntf\FICIntfAdv\FICIntfAdv.csproj">
<Project>{3ffa4093-4325-4fbb-a874-f288bfdcf7ba}</Project>
<Name>FICIntfAdv</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\FI\FICG5\Core\Service\FICIntf\FICIntf\FICIntf.csproj">
<Project>{4963deb2-f0e3-44a3-b5e1-e13e191a8de8}</Project>
<Name>FICIntf</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\FI\FICG5\Core\Service\FICModels\FICModels.csproj">
<Project>{f47ebf77-eed3-44e2-9983-ef556372a648}</Project>
<Name>FICModels</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\ForesightServices\Service\DataModel\FleetClientBase\FleetClientBase.csproj">
<Project>{b0110465-8537-4fe7-bee6-b10faa0ba92d}</Project>
<Name>FleetClientBase</Name>

View File

@ -98,9 +98,6 @@ namespace IronIntel.Contractor.Site
case "GETJOBSITEASSETLIST":
result = GetJobsiteAssetList();
break;
case "GETMACHINESBYGROUP":
result = GetMachinesByGroup();
break;
case "GETASSETSBYGROUP":
result = GetAssetsByGroup();
break;
@ -149,9 +146,6 @@ namespace IronIntel.Contractor.Site
case "DELETERENTAL":
result = DeleteRental();
break;
case "GETSELECTMACHINESBYCOMPANY":
result = GetSelectMachinesByCompany();
break;
case "SEARCHRENTALCHANGEHISTORY":
result = SearchRentalChangeHistory();
break;
@ -676,37 +670,6 @@ namespace IronIntel.Contractor.Site
}
}
private object GetSelectMachinesByCompany()
{
try
{
var session = GetCurrentLoginSession();
if (session != null)
{
var companyid = HttpUtility.HtmlDecode(Request.Params["ClientData"]);
FISqlConnection db = null;
if (SystemParams.IsDealer)
{
string connetionstring = SystemParams.GetDbStringByCompany(companyid);
db = new FISqlConnection(connetionstring);
}
MachineItem[] machines = MachineManagement.GetMachines(session.User.UID, "", companyid);
if (machines == null)
return new MachineItem[0];
return machines.Where(m => m.Hide == false).OrderBy(m => m.DisplayName).ToArray();
}
else
return new MachineItem[0];
}
catch (Exception ex)
{
return ex.Message;
}
}
private object GetSelectMachinesByRental()
{
try
@ -1504,34 +1467,6 @@ namespace IronIntel.Contractor.Site
}
}
private object GetMachinesByGroup()
{
try
{
var session = GetCurrentLoginSession();
if (GetCurrentLoginSession() != null)
{
var clientdata = Request.Form["ClientData"];
var groupid = HttpUtility.HtmlDecode(clientdata);
var allMachines = MachineManagement.GetMachines(session.SessionID, "", "");
var machines = MachineManagement.GetMachineByGroup(groupid);
MachineGroupInfoItem mgi = new MachineGroupInfoItem();
mgi.AllMachines = allMachines.Where(m => m.Hide == false).OrderBy((m) => m.VIN).ToArray();
mgi.Machines = machines.OrderBy((m) => m.VIN).ToArray();
return mgi;
}
else
return "";
}
catch (Exception ex)
{
AddLog("ERROR", "MachineDeviceBasePage.GetMachinesByGroup", ex.Message, ex.ToString());
return ex.Message;
}
}
private object GetAssetsByGroup()
{
try
@ -3152,7 +3087,7 @@ namespace IronIntel.Contractor.Site
DeviceProvider deviceprovider = CreateClient<DeviceProvider>(deviceitem.ContractorID);
var existeddevice = deviceprovider.GetDevicesBySN(deviceitem.ContractorID, device.Source, device.SerialNumber);
if (existeddevice != null)
if (existeddevice != null && existeddevice.Id > 0)
{
device.Id = existeddevice.Id;
device.AlternativeSerialNumber = existeddevice.AlternativeSerialNumber;
@ -4026,7 +3961,7 @@ namespace IronIntel.Contractor.Site
public class AssetSummaryItem : AssetSummaryInfo
{
public string TimeZoneAbbreviation { get; set; }
public string OdometerAsofTimeLocalStr { get { return (Odometer == null || Odometer.AsofTimeLocal == null || Odometer.AsofTimeLocal == DateTime.MinValue) ? "" : Odometer.AsofTimeLocal.ToString("M/d/yyyy hh:mm:ss tt"); } }
public string OdometerAsofTimeLocalStr { get { return (Odometer == null || Odometer.AsofTimeLocal == null || Odometer.AsofTimeLocal == DateTime.MinValue) ? "" : Odometer.AsofTimeLocal.ToString("M/d/yyyy h:mm:ss tt"); } }
public bool IsOdometerRed
{
get
@ -4039,7 +3974,7 @@ namespace IronIntel.Contractor.Site
return result;
}
}
public string EngineHoursAsofTimeLocalStr { get { return (EngineHours == null || EngineHours.AsofTimeLocal == null || EngineHours.AsofTimeLocal == DateTime.MinValue) ? "" : EngineHours.AsofTimeLocal.ToString("M/d/yyyy hh:mm:ss tt"); } }
public string EngineHoursAsofTimeLocalStr { get { return (EngineHours == null || EngineHours.AsofTimeLocal == null || EngineHours.AsofTimeLocal == DateTime.MinValue) ? "" : EngineHours.AsofTimeLocal.ToString("M/d/yyyy h:mm:ss tt"); } }
public bool IsEngineHoursRed
{
get
@ -4053,7 +3988,7 @@ namespace IronIntel.Contractor.Site
}
}
public string LocationAsofTimeLocalStr { get { return (Location == null || Location.AsofTimeLocal == null || Location.AsofTimeLocal == DateTime.MinValue) ? "" : Location.AsofTimeLocal.ToString("M/d/yyyy hh:mm:ss tt"); } }
public string LocationAsofTimeLocalStr { get { return (Location == null || Location.AsofTimeLocal == null || Location.AsofTimeLocal == DateTime.MinValue) ? "" : Location.AsofTimeLocal.ToString("M/d/yyyy h:mm:ss tt"); } }
public bool IsLocationRed
{
get
@ -4087,7 +4022,7 @@ namespace IronIntel.Contractor.Site
public class AssetAlertItem : AssetAlertsInfo
{
public string AlertLocalDateStr { get { return (AlertLocalTime == null || AlertLocalTime == null || AlertLocalTime == DateTime.MinValue) ? "" : AlertLocalTime.ToString("M/d/yyyy"); } }
public string AlertLocalTimeStr { get { return (AlertLocalTime == null || AlertLocalTime == null || AlertLocalTime == DateTime.MinValue) ? "" : AlertLocalTime.ToString("hh:mm:ss tt"); } }
public string AlertLocalTimeStr { get { return (AlertLocalTime == null || AlertLocalTime == null || AlertLocalTime == DateTime.MinValue) ? "" : AlertLocalTime.ToString("h:mm:ss tt"); } }
}
public class AssetPMPlanItem : AssetPMPlanInfo

View File

@ -130,6 +130,7 @@ namespace IronIntel.Contractor.Site.Maintenance
if (!alertparam.AlertStatus.Contains("Completed") && alertparam.AlertStatus.Contains("Uncompleted"))
completed = 0;
}
alertparam.SearchText = HttpUtility.HtmlDecode(alertparam.SearchText);
AssetAlertGridViewItem[] assetalerts = null;
if (alertparam.AssetID > 0)
@ -190,6 +191,7 @@ namespace IronIntel.Contractor.Site.Maintenance
if (!alertparam.AlertStatus.Contains("Completed") && alertparam.AlertStatus.Contains("Uncompleted"))
completed = 0;
}
alertparam.SearchText = HttpUtility.HtmlDecode(alertparam.SearchText);
AssetAlertGridViewItem[] assetalerts = null;
if (alertparam.AssetID > 0)
@ -371,6 +373,7 @@ namespace IronIntel.Contractor.Site.Maintenance
if (!DateTime.TryParse(alertparam.EndDate, out endDate))
endDate = DateTime.MaxValue;
alertparam.SearchText = HttpUtility.HtmlDecode(alertparam.SearchText);
alertparam.AlertStatus = new string[0];
AcknowledgedAlertItem[] ackalerts = CreateClient<AlertProvider>().GetAcknowledgedAlerts(SystemParams.CompanyID, beginDate, endDate, alertparam.AlertTypes, alertparam.AssetGroups, alertparam.SearchText);
if (ackalerts == null || ackalerts.Length == 0)
@ -495,10 +498,18 @@ namespace IronIntel.Contractor.Site.Maintenance
if (items == null)
return new AlertItems();
return items;
return new
{
WorkOrderID = workorderid,
Data = items
};
}
else
return new AlertItems();
return new
{
WorkOrderID = -1,
Data = new AlertItems()
};
}
catch (Exception ex)
{
@ -576,10 +587,18 @@ namespace IronIntel.Contractor.Site.Maintenance
items.AllExpectedCost += recalerts.Sum(m => m.ExpectedCost);
}
}
return items;
return new
{
MachineID = machineid,
Data = items
};
}
else
return new AlertInfo[0];
return new
{
MachineID = -1,
Data = new AlertInfo[0]
};
}
catch (Exception ex)
{

View File

@ -498,7 +498,7 @@ namespace IronIntel.Contractor.Site.Maintenance
if (StartDate == null)
return "";
else
return StartDate.Value.ToString("MM/dd/yyyy");
return StartDate.Value.ToString("M/d/yyyy");
}
}
}

View File

@ -1,4 +1,5 @@
using FI.FIC;
using FI.FIC.Contracts.DataObjects.BLObject;
using Foresight.Fleet.Services;
using Foresight.Fleet.Services.Asset;
using Foresight.Fleet.Services.AssetHealth;
@ -16,10 +17,12 @@ using IronIntel.Contractor.Users;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Net.Mail;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using System.Web;
@ -50,8 +53,8 @@ namespace IronIntel.Contractor.Site.Maintenance
case "RESTOREDELETEWORKORDER":
result = RestoreDeleteWorkOrder();
break;
case "GETCONTACTS":
result = GetContacts();
case "GETASSETCONTACTS":
result = GetAssetContacts();
break;
case "GETMACHINES":
result = GetMachines();
@ -308,6 +311,9 @@ namespace IronIntel.Contractor.Site.Maintenance
case "UPDATEWORKORDERATTACHMENTCAPTION":
result = UpdateWorkOrderAttachmentCaption();
break;
case "RECORDDOWNLOADLOG":
result = RecordDownloadLog();
break;
case "GETWOSERVICETIMESETTING":
result = GetWOServiceTimeSetting();
break;
@ -383,6 +389,15 @@ namespace IronIntel.Contractor.Site.Maintenance
case "GETSURVEYPREVIEWURL":
result = GetSurveyPreviewUrl();
break;
case "GETWORKORDERWIDGETS":
result = GetWorkOrderWidgets();
break;
case "SAVEWORKORDERWIDGETS":
result = SaveWorkOrderWidgets();
break;
case "SAVEWORKORDERWIDGETLAYOUT":
result = SaveWorkOrderWidgetLayout();
break;
}
}
@ -1163,7 +1178,7 @@ namespace IronIntel.Contractor.Site.Maintenance
}
}
private UserInfo[] GetContacts()
private UserInfo[] GetAssetContacts()
{
var session = GetCurrentLoginSession();
UserInfo[] users = null;
@ -1627,7 +1642,11 @@ namespace IronIntel.Contractor.Site.Maintenance
WorkOrderSegmentInfo[] segments = CreateClient<WorkOrderProvider>().GetSegments(SystemParams.CompanyID, woid);
if (segments == null || segments.Length == 0)
return new SegmentInfo[0];
return new
{
WorkOrderID = woid,
Data = new SegmentInfo[0]
};
List<SegmentInfo> list = new List<SegmentInfo>();
foreach (WorkOrderSegmentInfo se in segments)
@ -1637,10 +1656,18 @@ namespace IronIntel.Contractor.Site.Maintenance
si.SegmentID = se.Id;
list.Add(si);
}
return list.ToArray();
return new
{
WorkOrderID = woid,
Data = list.ToArray()
};
}
else
return new SegmentInfo[0];
return new
{
WorkOrderID = -1,
Data = new SegmentInfo[0]
};
}
catch (Exception ex)
@ -1778,7 +1805,11 @@ namespace IronIntel.Contractor.Site.Maintenance
list.Add(item);
}
attas.InspectionAttachments = list.OrderBy(m => m.AddedOnLocal).ToArray();
return attas;
return new
{
WorkOrderID = woid,
Data = attas
};
}
else
return null;
@ -1869,6 +1900,30 @@ namespace IronIntel.Contractor.Site.Maintenance
}
}
private object RecordDownloadLog()
{
try
{
var session = GetCurrentLoginSession();
if (session != null)
{
var clientdata = HttpUtility.HtmlDecode(Request.Form["ClientData"]);
string[] ps = JsonConvert.DeserializeObject<string[]>(clientdata);
string url = ps[0];
FICHostEnvironment.WriteExportAuditTrail(session.User.UID, "Download", "", "Download", url, "", null);
return "OK";
}
else
return "Failed";
}
catch (Exception ex)
{
return ex.Message;
}
}
private object UpdateWorkOrderAttachmentCaption()
{
try
@ -2628,6 +2683,12 @@ namespace IronIntel.Contractor.Site.Maintenance
var user = GetCurrentUser();
if (user != null)
{
bool license = SystemParams.HasLicense("CustomerRecord");
bool crpermission = CheckRight(SystemParams.CompanyID, Foresight.Fleet.Services.User.Feature.CUSTOMER_RECORD);
bool AllowCustomer = license && crpermission;
bool AllowCommunicate = license && CheckRight(SystemParams.CompanyID, Foresight.Fleet.Services.User.Feature.COMMUNICATEWITHCUSTOMER);
if (!AllowCommunicate) return "";
string clientdata = HttpUtility.HtmlDecode(Request.Params["ClientData"]);
string[] ps = JsonConvert.DeserializeObject<string[]>(clientdata);
long woid = Convert.ToInt64(ps[0]);
@ -2682,7 +2743,11 @@ namespace IronIntel.Contractor.Site.Maintenance
var client = CreateClient<WorkOrderProvider>();
AssetInspectItem[] insplectitems = client.GetWOInspectItems(SystemParams.CompanyID, woid);
if (insplectitems == null || insplectitems.Length == 0)
return new AssetInspectInfo[0];
return new
{
WorkOrderID = woid,
Data = new AssetInspectItem[0]
};
List<AssetInspectInfo> list = new List<AssetInspectInfo>();
foreach (AssetInspectItem item in insplectitems)
@ -2699,11 +2764,18 @@ namespace IronIntel.Contractor.Site.Maintenance
list[0].WorkOrders = wos;
}
return list.ToArray();
return new
{
WorkOrderID = woid,
Data = list.ToArray()
};
}
else
return new AssetInspectItem[0];
return new
{
WorkOrderID = -1,
Data = new AssetInspectItem[0]
};
}
catch (Exception ex)
{
@ -2849,7 +2921,11 @@ namespace IronIntel.Contractor.Site.Maintenance
var client = CreateClient<WorkOrderProvider>();
WorkOrderEstimateInfo[] estimates = client.GetWorkOrderEstimates(SystemParams.CompanyID, woid);
if (estimates == null || estimates.Length == 0)
return new WorkOrderEstimateItem[0];
return new
{
WorkOrderID = woid,
Data = new WorkOrderEstimateItem[0]
};
List<WorkOrderEstimateItem> list = new List<WorkOrderEstimateItem>();
foreach (WorkOrderEstimateInfo es in estimates)
@ -2872,11 +2948,18 @@ namespace IronIntel.Contractor.Site.Maintenance
list.Add(item);
}
return list.ToArray();
return new
{
WorkOrderID = woid,
Data = list.ToArray()
};
}
else
return new WorkOrderEstimateItem();
return new
{
WorkOrderID = -1,
Data = new WorkOrderEstimateItem[0]
};
}
catch (Exception ex)
{
@ -3367,7 +3450,7 @@ namespace IronIntel.Contractor.Site.Maintenance
woendDate = DateTime.MaxValue;
var client = CreateClient<WorkOrderSurveyProvider>();
WorkOrderSurveyItem[] items = client.GetWorkOrderSurveyItems(SystemParams.CompanyID, status, beginDate, endDate == DateTime.MaxValue ? (DateTime?)null : endDate, ps[3], locations, advisors, tempid, wobeginDate, woendDate == DateTime.MaxValue ? (DateTime?)null : woendDate);
WorkOrderSurveyItem[] items = client.GetWorkOrderSurveyItems(SystemParams.CompanyID, status, beginDate, endDate == DateTime.MaxValue ? (DateTime?)null : endDate, HttpUtility.HtmlDecode(ps[3]), locations, advisors, tempid, wobeginDate, woendDate == DateTime.MaxValue ? (DateTime?)null : woendDate);
if (items == null || items.Length == 0)
return new WorkOrderSurveyInfo[0];
@ -3651,7 +3734,11 @@ namespace IronIntel.Contractor.Site.Maintenance
var client = CreateClient<WorkOrderProvider>();
WorkOrderInvoiceInfo[] invoices = client.GetWorkOrderInvoices(SystemParams.CompanyID, woid);
if (invoices == null || invoices.Length == 0)
return new WorkOrderInvoiceInfoItem[0];
return new
{
WorkOrderID = woid,
Data = new WorkOrderInvoiceInfoItem[0]
};
List<WorkOrderInvoiceInfoItem> list = new List<WorkOrderInvoiceInfoItem>();
foreach (WorkOrderInvoiceInfo es in invoices)
@ -3709,11 +3796,18 @@ namespace IronIntel.Contractor.Site.Maintenance
list.Add(item);
}
return list.ToArray();
return new
{
WorkOrderID = woid,
Data = list.ToArray()
};
}
else
return new WorkOrderInvoiceInfoItem();
return new
{
WorkOrderID = -1,
Data = new WorkOrderInvoiceInfoItem[0]
};
}
catch (Exception ex)
{
@ -4398,7 +4492,101 @@ namespace IronIntel.Contractor.Site.Maintenance
}
}
#endregion
#endregion
#region Widgets
private object GetWorkOrderWidgets()
{
try
{
var session = GetCurrentLoginSession();
if (session != null)
{
var client = CreateClient<Foresight.Fleet.Services.User.UserProfileProvider>();
Foresight.Fleet.Services.User.UserWidgetInfo[] items = client.GetWidgets(SystemParams.CompanyID, session.User.UID, "WorkOrder");
if (items == null || items.Length == 0)
return new Foresight.Fleet.Services.User.UserWidgetInfo[0];
bool license = SystemParams.HasLicense("CustomerRecord");
bool crpermission = CheckRight(SystemParams.CompanyID, Foresight.Fleet.Services.User.Feature.CUSTOMER_RECORD);
bool AllowCustomer = license && crpermission;
bool AllowCommunicate = license && CheckRight(SystemParams.CompanyID, Foresight.Fleet.Services.User.Feature.COMMUNICATEWITHCUSTOMER);
if (!AllowCustomer)
{
items = items.Where(i => !i.WidgetId.Equals("Estimates", StringComparison.OrdinalIgnoreCase)
&& !i.WidgetId.Equals("Invoices", StringComparison.OrdinalIgnoreCase)).ToArray();
}
if (!AllowCommunicate)
{
items = items.Where(i => !i.WidgetId.Equals("CustomerCommunication", StringComparison.OrdinalIgnoreCase)).ToArray();
}
license = SystemParams.HasLicense("Inspection");
bool AllowInspection = license && CheckRight(SystemParams.CompanyID, Foresight.Fleet.Services.User.Feature.INSPECTION_REPORTS);
if (!AllowInspection)
{
items = items.Where(i => !i.WidgetId.Equals("Inspections", StringComparison.OrdinalIgnoreCase)).ToArray();
}
return items;
}
else
return new Foresight.Fleet.Services.User.UserWidgetInfo[0];
}
catch (Exception ex)
{
AddLog("ERROR", "WorkOrderBasePage.GetWorkOrderWidgets", ex.Message, ex.ToString());
return ex.Message;
}
}
private object SaveWorkOrderWidgets()
{
try
{
var session = GetCurrentLoginSession();
if (session != null)
{
var clientdata = HttpUtility.HtmlDecode(Request.Form["ClientData"]);
var widgets = JsonConvert.DeserializeObject<Foresight.Fleet.Services.User.UserWidgetInfo[]>(clientdata);
CreateClient<Foresight.Fleet.Services.User.UserProfileProvider>().SaveWidgets(SystemParams.CompanyID, widgets);
return "OK";
}
else
return "Failed";
}
catch (Exception ex)
{
return ex.Message;
}
}
private object SaveWorkOrderWidgetLayout()
{
try
{
var session = GetCurrentLoginSession();
if (session != null)
{
var clientdata = HttpUtility.HtmlDecode(Request.Form["ClientData"]);
var widget = JsonConvert.DeserializeObject<Foresight.Fleet.Services.User.UserWidgetInfo>(clientdata);
widget.UserIID = session.User.UID;
widget.Category = "WorkOrder";
CreateClient<Foresight.Fleet.Services.User.UserProfileProvider>().SaveWidgetLayout(SystemParams.CompanyID, widget);
return "OK";
}
else
return "Failed";
}
catch (Exception ex)
{
return ex.Message;
}
}
#endregion
}

View File

@ -37,6 +37,12 @@ namespace IronIntel.Contractor.Site.MapView
case "GetAssets":
result = GetAssets();
break;
case "GetAssetBasicInfos":
result = GetAssetBasicInfos();
break;
case "GetAssetBasicInfoByAssets":
result = GetAssetBasicInfoByAssets();
break;
case "GetAssetGroups":
result = GetAssetGroups();
break;
@ -125,6 +131,7 @@ namespace IronIntel.Contractor.Site.MapView
throw ex;
}
string json = JsonConvert.SerializeObject(result, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore });
Context.Response.ContentType = "application/json";
Context.Response.Write(json);
Context.Response.End();
}
@ -181,6 +188,47 @@ namespace IronIntel.Contractor.Site.MapView
//return assets;
}
private MapViewAssetItem[] GetAssetBasicInfos()
{//获取用户有权的机器的基础信息,缓存在前端
MapViewAssetItem[] assets = null;
if (LoginSession != null)
{
var clientdata = Context.Request.Params["ClientData"];
clientdata = HttpUtility.HtmlDecode(clientdata);
string[] ps = JsonConvert.DeserializeObject<string[]>(clientdata);
if (!SystemParams.IsDealer)
assets = AssetMapViewManagement.GetAssetBasicInfos(LoginSession.SessionID, ps[0], LoginSession.User.UID);
else
assets = AssetMapViewManagement.GetDealerAssetBasicInfos(LoginSession.SessionID, ps[0], LoginSession.User.UID);
}
else
assets = new MapViewAssetItem[0];
return assets;
}
private MapViewAssetItem[] GetAssetBasicInfoByAssets()
{//获取用户有权的机器的基础信息,缓存在前端
MapViewAssetItem[] assets = null;
if (LoginSession != null)
{
var clientdata = Context.Request.Params["ClientData"];
clientdata = HttpUtility.HtmlDecode(clientdata);
string[] ps = JsonConvert.DeserializeObject<string[]>(clientdata);
long[] assetids = JsonConvert.DeserializeObject<long[]>(ps[1]);
if (assetids.Length > 0)
assets = AssetMapViewManagement.GetAssetItemsByAssets(LoginSession.SessionID, ps[0], LoginSession.User.UID, assetids);
}
else
assets = new MapViewAssetItem[0];
return assets;
}
private AssetGroupViewItem[] GetAssetGroups()
{
AssetGroupViewItem[] groups = null;

View File

@ -33,4 +33,4 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("23.4.26")]
[assembly: AssemblyFileVersion("23.5.11")]

View File

@ -91,7 +91,7 @@ namespace IronIntel.Contractor.Site.Security
contractors[i] = HttpUtility.UrlDecode(contractors[i]);
}
UserManagement.AddUserToContractor(iid, contractors);
Response.Write(JsonConvert.SerializeObject("Save contractors info successfully."));
Response.Write("Save contractors info successfully.");
Response.End();
}
}

View File

@ -418,7 +418,7 @@ namespace IronIntel.Contractor.Site
var session = GetCurrentLoginSession();
if (session != null)
{
return SystemParams.ConvertToUserTimeFromUtc(session.User, DateTime.UtcNow).ToString("M/d/yyyy h:m:s tt");
return SystemParams.ConvertToUserTimeFromUtc(session.User, DateTime.UtcNow).ToString("M/d/yyyy h:mm:ss tt");
}
return "";
}

View File

@ -559,10 +559,14 @@ namespace IronIntel.Contractor.Site.SystemSettings
var client = CreateClient<Foresight.Fleet.Services.User.UserFilterProvider>();
string useriid = session.User.UID;
bool accessallassets = false;
Foresight.Fleet.Services.User.UserAdditionalAttribute attrs = CreateClient<Foresight.Fleet.Services.User.UserQueryClient>(SystemParams.CompanyID).GetUserAdditionalAttribute(useriid);
if (attrs != null)
accessallassets = attrs.AccessAllAssets;
bool accessallassets = session.User.UserType >= Foresight.Fleet.Services.User.UserTypes.Admin;
if (!accessallassets)
{
Foresight.Fleet.Services.User.UserAdditionalAttribute attrs = CreateClient<Foresight.Fleet.Services.User.UserQueryClient>(SystemParams.CompanyID).GetUserAdditionalAttribute(useriid);
if (attrs != null)
accessallassets = attrs.AccessAllAssets;
}
UserFilterTemplateItem filter = new UserFilterTemplateItem();

View File

@ -2210,14 +2210,18 @@ namespace IronIntel.Contractor.Site
int filterid = Convert.ToInt32(filteridstr);
string useriid = HttpUtility.HtmlDecode(clientdata[1]);
if (GetCurrentLoginSession() != null)
var session = GetCurrentLoginSession();
if (session != null)
{
var client = CreateClient<Foresight.Fleet.Services.User.UserFilterProvider>();
bool accessallassets = false;
Foresight.Fleet.Services.User.UserAdditionalAttribute attrs = CreateClient<Foresight.Fleet.Services.User.UserQueryClient>(SystemParams.CompanyID).GetUserAdditionalAttribute(useriid);
if (attrs != null)
accessallassets = attrs.AccessAllAssets;
bool accessallassets = session.User.UserType >= Foresight.Fleet.Services.User.UserTypes.Admin;
if (!accessallassets)
{
Foresight.Fleet.Services.User.UserAdditionalAttribute attrs = CreateClient<Foresight.Fleet.Services.User.UserQueryClient>(SystemParams.CompanyID).GetUserAdditionalAttribute(useriid);
if (attrs != null)
accessallassets = attrs.AccessAllAssets;
}
UserFilterTemplateItem filter = new UserFilterTemplateItem();