.
This commit is contained in:
@ -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)
|
||||
{
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user