Compare commits
16 Commits
cde8e39af2
...
master
Author | SHA1 | Date | |
---|---|---|---|
0855ae42cd | |||
634e8b71ab | |||
9da1c4cf30 | |||
e728c66786 | |||
d831a707ae | |||
c9723008af | |||
88e0a25ecd | |||
156d145a48 | |||
246c726a10 | |||
3a1348ee6d | |||
befc93960b | |||
cbef4076c4 | |||
d69325d2da | |||
0756b7d523 | |||
1a01cb36c4 | |||
50ed28d05c |
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
||||
[submodule "Site"]
|
||||
path = Site
|
||||
url = ssh://git@file.tsanie.us:9022/tsanie/fleet-contractor-site.git
|
12
BlazorApp1/App.razor
Normal file
12
BlazorApp1/App.razor
Normal file
@ -0,0 +1,12 @@
|
||||
<Router AppAssembly="@typeof(App).Assembly">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<PageTitle>Not found</PageTitle>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p role="alert">Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
14
BlazorApp1/BlazorApp1.csproj
Normal file
14
BlazorApp1/BlazorApp1.csproj
Normal file
@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.5" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.5" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
18
BlazorApp1/Pages/Counter.razor
Normal file
18
BlazorApp1/Pages/Counter.razor
Normal file
@ -0,0 +1,18 @@
|
||||
@page "/counter"
|
||||
|
||||
<PageTitle>Counter</PageTitle>
|
||||
|
||||
<h1>Counter</h1>
|
||||
|
||||
<p role="status">Current count: @currentCount</p>
|
||||
|
||||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
|
||||
|
||||
@code {
|
||||
private int currentCount = 0;
|
||||
|
||||
private void IncrementCount()
|
||||
{
|
||||
currentCount++;
|
||||
}
|
||||
}
|
57
BlazorApp1/Pages/FetchData.razor
Normal file
57
BlazorApp1/Pages/FetchData.razor
Normal file
@ -0,0 +1,57 @@
|
||||
@page "/fetchdata"
|
||||
@inject HttpClient Http
|
||||
|
||||
<PageTitle>Weather forecast</PageTitle>
|
||||
|
||||
<h1>Weather forecast</h1>
|
||||
|
||||
<p>This component demonstrates fetching data from the server.</p>
|
||||
|
||||
@if (forecasts == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Temp. (C)</th>
|
||||
<th>Temp. (F)</th>
|
||||
<th>Summary</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var forecast in forecasts)
|
||||
{
|
||||
<tr>
|
||||
<td>@forecast.Date.ToShortDateString()</td>
|
||||
<td>@forecast.TemperatureC</td>
|
||||
<td>@forecast.TemperatureF</td>
|
||||
<td>@forecast.Summary</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
@code {
|
||||
private WeatherForecast[]? forecasts;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");
|
||||
}
|
||||
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public string? Summary { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
}
|
||||
}
|
9
BlazorApp1/Pages/Index.razor
Normal file
9
BlazorApp1/Pages/Index.razor
Normal file
@ -0,0 +1,9 @@
|
||||
@page "/"
|
||||
|
||||
<PageTitle>Index</PageTitle>
|
||||
|
||||
<h1>Hello, world!</h1>
|
||||
|
||||
Welcome to your new app.
|
||||
|
||||
<SurveyPrompt Title="How is Blazor working for you?" />
|
11
BlazorApp1/Program.cs
Normal file
11
BlazorApp1/Program.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using BlazorApp1;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
|
||||
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
builder.RootComponents.Add<App>("#app");
|
||||
builder.RootComponents.Add<HeadOutlet>("head::after");
|
||||
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
|
||||
|
||||
await builder.Build().RunAsync();
|
23
BlazorApp1/Properties/PublishProfiles/FolderProfile.pubxml
Normal file
23
BlazorApp1/Properties/PublishProfiles/FolderProfile.pubxml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<DeleteExistingFiles>true</DeleteExistingFiles>
|
||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<PublishProvider>FileSystem</PublishProvider>
|
||||
<PublishUrl>bin\Release\net7.0\browser-wasm\publish\</PublishUrl>
|
||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
<SiteUrlToLaunchAfterPublish />
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
|
||||
<RunAOTCompilation>true</RunAOTCompilation>
|
||||
<ProjectGuid>96100c88-5479-465c-bb57-afb1f8ed8bfd</ProjectGuid>
|
||||
<SelfContained>true</SelfContained>
|
||||
</PropertyGroup>
|
||||
</Project>
|
30
BlazorApp1/Properties/launchSettings.json
Normal file
30
BlazorApp1/Properties/launchSettings.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:22316",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
||||
"applicationUrl": "http://localhost:5042",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
17
BlazorApp1/Shared/MainLayout.razor
Normal file
17
BlazorApp1/Shared/MainLayout.razor
Normal file
@ -0,0 +1,17 @@
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
<div class="page">
|
||||
<div class="sidebar">
|
||||
<NavMenu />
|
||||
</div>
|
||||
|
||||
<main>
|
||||
<div class="top-row px-4">
|
||||
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
|
||||
</div>
|
||||
|
||||
<article class="content px-4">
|
||||
@Body
|
||||
</article>
|
||||
</main>
|
||||
</div>
|
81
BlazorApp1/Shared/MainLayout.razor.css
Normal file
81
BlazorApp1/Shared/MainLayout.razor.css
Normal file
@ -0,0 +1,81 @@
|
||||
.page {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
main {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
|
||||
}
|
||||
|
||||
.top-row {
|
||||
background-color: #f7f7f7;
|
||||
border-bottom: 1px solid #d6d5d5;
|
||||
justify-content: flex-end;
|
||||
height: 3.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.top-row ::deep a, .top-row ::deep .btn-link {
|
||||
white-space: nowrap;
|
||||
margin-left: 1.5rem;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.top-row ::deep a:first-child {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
@media (max-width: 640.98px) {
|
||||
.top-row:not(.auth) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.top-row.auth {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.top-row ::deep a, .top-row ::deep .btn-link {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 641px) {
|
||||
.page {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 250px;
|
||||
height: 100vh;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.top-row {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.top-row.auth ::deep a:first-child {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.top-row, article {
|
||||
padding-left: 2rem !important;
|
||||
padding-right: 1.5rem !important;
|
||||
}
|
||||
}
|
39
BlazorApp1/Shared/NavMenu.razor
Normal file
39
BlazorApp1/Shared/NavMenu.razor
Normal file
@ -0,0 +1,39 @@
|
||||
<div class="top-row ps-3 navbar navbar-dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="">BlazorApp1</a>
|
||||
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
|
||||
<nav class="flex-column">
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
|
||||
<span class="oi oi-home" aria-hidden="true"></span> Home
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="counter">
|
||||
<span class="oi oi-plus" aria-hidden="true"></span> Counter
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="fetchdata">
|
||||
<span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data
|
||||
</NavLink>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private bool collapseNavMenu = true;
|
||||
|
||||
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
|
||||
|
||||
private void ToggleNavMenu()
|
||||
{
|
||||
collapseNavMenu = !collapseNavMenu;
|
||||
}
|
||||
}
|
68
BlazorApp1/Shared/NavMenu.razor.css
Normal file
68
BlazorApp1/Shared/NavMenu.razor.css
Normal file
@ -0,0 +1,68 @@
|
||||
.navbar-toggler {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.top-row {
|
||||
height: 3.5rem;
|
||||
background-color: rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
.navbar-brand {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.oi {
|
||||
width: 2rem;
|
||||
font-size: 1.1rem;
|
||||
vertical-align: text-top;
|
||||
top: -2px;
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
font-size: 0.9rem;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.nav-item:first-of-type {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
.nav-item:last-of-type {
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
.nav-item ::deep a {
|
||||
color: #d7d7d7;
|
||||
border-radius: 4px;
|
||||
height: 3rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: 3rem;
|
||||
}
|
||||
|
||||
.nav-item ::deep a.active {
|
||||
background-color: rgba(255,255,255,0.25);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.nav-item ::deep a:hover {
|
||||
background-color: rgba(255,255,255,0.1);
|
||||
color: white;
|
||||
}
|
||||
|
||||
@media (min-width: 641px) {
|
||||
.navbar-toggler {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.collapse {
|
||||
/* Never collapse the sidebar for wide screens */
|
||||
display: block;
|
||||
}
|
||||
|
||||
.nav-scrollable {
|
||||
/* Allow sidebar to scroll for tall menus */
|
||||
height: calc(100vh - 3.5rem);
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
16
BlazorApp1/Shared/SurveyPrompt.razor
Normal file
16
BlazorApp1/Shared/SurveyPrompt.razor
Normal file
@ -0,0 +1,16 @@
|
||||
<div class="alert alert-secondary mt-4">
|
||||
<span class="oi oi-pencil me-2" aria-hidden="true"></span>
|
||||
<strong>@Title</strong>
|
||||
|
||||
<span class="text-nowrap">
|
||||
Please take our
|
||||
<a target="_blank" class="font-weight-bold link-dark" href="https://go.microsoft.com/fwlink/?linkid=2186157">brief survey</a>
|
||||
</span>
|
||||
and tell us what you think.
|
||||
</div>
|
||||
|
||||
@code {
|
||||
// Demonstrates how a parent component can supply parameters
|
||||
[Parameter]
|
||||
public string? Title { get; set; }
|
||||
}
|
10
BlazorApp1/_Imports.razor
Normal file
10
BlazorApp1/_Imports.razor
Normal file
@ -0,0 +1,10 @@
|
||||
@using System.Net.Http
|
||||
@using System.Net.Http.Json
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||
@using Microsoft.AspNetCore.Components.WebAssembly.Http
|
||||
@using Microsoft.JSInterop
|
||||
@using BlazorApp1
|
||||
@using BlazorApp1.Shared
|
101
BlazorApp1/wwwroot/css/app.css
Normal file
101
BlazorApp1/wwwroot/css/app.css
Normal file
@ -0,0 +1,101 @@
|
||||
@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');
|
||||
|
||||
html, body {
|
||||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
h1:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
a, .btn-link {
|
||||
color: #0071c1;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
|
||||
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-top: 1.1rem;
|
||||
}
|
||||
|
||||
.valid.modified:not([type=checkbox]) {
|
||||
outline: 1px solid #26b050;
|
||||
}
|
||||
|
||||
.invalid {
|
||||
outline: 1px solid red;
|
||||
}
|
||||
|
||||
.validation-message {
|
||||
color: red;
|
||||
}
|
||||
|
||||
#blazor-error-ui {
|
||||
background: lightyellow;
|
||||
bottom: 0;
|
||||
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
|
||||
display: none;
|
||||
left: 0;
|
||||
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
#blazor-error-ui .dismiss {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
right: 0.75rem;
|
||||
top: 0.5rem;
|
||||
}
|
||||
|
||||
.blazor-error-boundary {
|
||||
background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
|
||||
padding: 1rem 1rem 1rem 3.7rem;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.blazor-error-boundary::after {
|
||||
content: "An error has occurred."
|
||||
}
|
||||
|
||||
.loading-progress {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 8rem;
|
||||
height: 8rem;
|
||||
margin: 20vh auto 1rem auto;
|
||||
}
|
||||
|
||||
.loading-progress circle {
|
||||
fill: none;
|
||||
stroke: #e0e0e0;
|
||||
stroke-width: 0.6rem;
|
||||
transform-origin: 50% 50%;
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
.loading-progress circle:last-child {
|
||||
stroke: #1b6ec2;
|
||||
stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
|
||||
transition: stroke-dasharray 0.05s ease-in-out;
|
||||
}
|
||||
|
||||
.loading-progress-text {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
|
||||
}
|
||||
|
||||
.loading-progress-text:after {
|
||||
content: var(--blazor-load-percentage-text, "Loading");
|
||||
}
|
7
BlazorApp1/wwwroot/css/bootstrap/bootstrap.min.css
vendored
Normal file
7
BlazorApp1/wwwroot/css/bootstrap/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
BlazorApp1/wwwroot/css/bootstrap/bootstrap.min.css.map
Normal file
1
BlazorApp1/wwwroot/css/bootstrap/bootstrap.min.css.map
Normal file
File diff suppressed because one or more lines are too long
86
BlazorApp1/wwwroot/css/open-iconic/FONT-LICENSE
Normal file
86
BlazorApp1/wwwroot/css/open-iconic/FONT-LICENSE
Normal file
@ -0,0 +1,86 @@
|
||||
SIL OPEN FONT LICENSE Version 1.1
|
||||
|
||||
Copyright (c) 2014 Waybury
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
21
BlazorApp1/wwwroot/css/open-iconic/ICON-LICENSE
Normal file
21
BlazorApp1/wwwroot/css/open-iconic/ICON-LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Waybury
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
114
BlazorApp1/wwwroot/css/open-iconic/README.md
Normal file
114
BlazorApp1/wwwroot/css/open-iconic/README.md
Normal file
@ -0,0 +1,114 @@
|
||||
[Open Iconic v1.1.1](https://github.com/iconic/open-iconic)
|
||||
===========
|
||||
|
||||
### Open Iconic is the open source sibling of [Iconic](https://github.com/iconic/open-iconic). It is a hyper-legible collection of 223 icons with a tiny footprint—ready to use with Bootstrap and Foundation. [View the collection](https://github.com/iconic/open-iconic)
|
||||
|
||||
|
||||
|
||||
## What's in Open Iconic?
|
||||
|
||||
* 223 icons designed to be legible down to 8 pixels
|
||||
* Super-light SVG files - 61.8 for the entire set
|
||||
* SVG sprite—the modern replacement for icon fonts
|
||||
* Webfont (EOT, OTF, SVG, TTF, WOFF), PNG and WebP formats
|
||||
* Webfont stylesheets (including versions for Bootstrap and Foundation) in CSS, LESS, SCSS and Stylus formats
|
||||
* PNG and WebP raster images in 8px, 16px, 24px, 32px, 48px and 64px.
|
||||
|
||||
|
||||
## Getting Started
|
||||
|
||||
#### For code samples and everything else you need to get started with Open Iconic, check out our [Icons](https://github.com/iconic/open-iconic) and [Reference](https://github.com/iconic/open-iconic) sections.
|
||||
|
||||
### General Usage
|
||||
|
||||
#### Using Open Iconic's SVGs
|
||||
|
||||
We like SVGs and we think they're the way to display icons on the web. Since Open Iconic are just basic SVGs, we suggest you display them like you would any other image (don't forget the `alt` attribute).
|
||||
|
||||
```
|
||||
<img src="/open-iconic/svg/icon-name.svg" alt="icon name">
|
||||
```
|
||||
|
||||
#### Using Open Iconic's SVG Sprite
|
||||
|
||||
Open Iconic also comes in a SVG sprite which allows you to display all the icons in the set with a single request. It's like an icon font, without being a hack.
|
||||
|
||||
Adding an icon from an SVG sprite is a little different than what you're used to, but it's still a piece of cake. *Tip: To make your icons easily style able, we suggest adding a general class to the* `<svg>` *tag and a unique class name for each different icon in the* `<use>` *tag.*
|
||||
|
||||
```
|
||||
<svg class="icon">
|
||||
<use xlink:href="open-iconic.svg#account-login" class="icon-account-login"></use>
|
||||
</svg>
|
||||
```
|
||||
|
||||
Sizing icons only needs basic CSS. All the icons are in a square format, so just set the `<svg>` tag with equal width and height dimensions.
|
||||
|
||||
```
|
||||
.icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
```
|
||||
|
||||
Coloring icons is even easier. All you need to do is set the `fill` rule on the `<use>` tag.
|
||||
|
||||
```
|
||||
.icon-account-login {
|
||||
fill: #f00;
|
||||
}
|
||||
```
|
||||
|
||||
To learn more about SVG Sprites, read [Chris Coyier's guide](http://css-tricks.com/svg-sprites-use-better-icon-fonts/).
|
||||
|
||||
#### Using Open Iconic's Icon Font...
|
||||
|
||||
|
||||
##### …with Bootstrap
|
||||
|
||||
You can find our Bootstrap stylesheets in `font/css/open-iconic-bootstrap.{css, less, scss, styl}`
|
||||
|
||||
|
||||
```
|
||||
<link href="/open-iconic/font/css/open-iconic-bootstrap.css" rel="stylesheet">
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
<span class="oi oi-icon-name" title="icon name" aria-hidden="true"></span>
|
||||
```
|
||||
|
||||
##### …with Foundation
|
||||
|
||||
You can find our Foundation stylesheets in `font/css/open-iconic-foundation.{css, less, scss, styl}`
|
||||
|
||||
```
|
||||
<link href="/open-iconic/font/css/open-iconic-foundation.css" rel="stylesheet">
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
<span class="fi-icon-name" title="icon name" aria-hidden="true"></span>
|
||||
```
|
||||
|
||||
##### …on its own
|
||||
|
||||
You can find our default stylesheets in `font/css/open-iconic.{css, less, scss, styl}`
|
||||
|
||||
```
|
||||
<link href="/open-iconic/font/css/open-iconic.css" rel="stylesheet">
|
||||
```
|
||||
|
||||
```
|
||||
<span class="oi" data-glyph="icon-name" title="icon name" aria-hidden="true"></span>
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
### Icons
|
||||
|
||||
All code (including SVG markup) is under the [MIT License](http://opensource.org/licenses/MIT).
|
||||
|
||||
### Fonts
|
||||
|
||||
All fonts are under the [SIL Licensed](http://scripts.sil.org/cms/scripts/page.php?item_id=OFL_web).
|
1
BlazorApp1/wwwroot/css/open-iconic/font/css/open-iconic-bootstrap.min.css
vendored
Normal file
1
BlazorApp1/wwwroot/css/open-iconic/font/css/open-iconic-bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
BlazorApp1/wwwroot/css/open-iconic/font/fonts/open-iconic.eot
Normal file
BIN
BlazorApp1/wwwroot/css/open-iconic/font/fonts/open-iconic.eot
Normal file
Binary file not shown.
BIN
BlazorApp1/wwwroot/css/open-iconic/font/fonts/open-iconic.otf
Normal file
BIN
BlazorApp1/wwwroot/css/open-iconic/font/fonts/open-iconic.otf
Normal file
Binary file not shown.
543
BlazorApp1/wwwroot/css/open-iconic/font/fonts/open-iconic.svg
Normal file
543
BlazorApp1/wwwroot/css/open-iconic/font/fonts/open-iconic.svg
Normal file
@ -0,0 +1,543 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||
<!--
|
||||
2014-7-1: Created.
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata>
|
||||
Created by FontForge 20120731 at Tue Jul 1 20:39:22 2014
|
||||
By P.J. Onori
|
||||
Created by P.J. Onori with FontForge 2.0 (http://fontforge.sf.net)
|
||||
</metadata>
|
||||
<defs>
|
||||
<font id="open-iconic" horiz-adv-x="800" >
|
||||
<font-face
|
||||
font-family="Icons"
|
||||
font-weight="400"
|
||||
font-stretch="normal"
|
||||
units-per-em="800"
|
||||
panose-1="2 0 5 3 0 0 0 0 0 0"
|
||||
ascent="800"
|
||||
descent="0"
|
||||
bbox="-0.5 -101 802 800.126"
|
||||
underline-thickness="50"
|
||||
underline-position="-100"
|
||||
unicode-range="U+E000-E0DE"
|
||||
/>
|
||||
<missing-glyph />
|
||||
<glyph glyph-name="" unicode=""
|
||||
d="M300 700h500v-700h-500v100h400v500h-400v100zM400 500l200 -150l-200 -150v100h-400v100h400v100z" />
|
||||
<glyph glyph-name="1" unicode=""
|
||||
d="M300 700h500v-700h-500v100h400v500h-400v100zM200 500v-100h400v-100h-400v-100l-200 150z" />
|
||||
<glyph glyph-name="2" unicode=""
|
||||
d="M350 700c193 0 350 -157 350 -350v-50h100l-200 -200l-200 200h100v50c0 138 -112 250 -250 250s-250 -112 -250 -250c0 193 157 350 350 350z" />
|
||||
<glyph glyph-name="3" unicode=""
|
||||
d="M450 700c193 0 350 -157 350 -350c0 138 -112 250 -250 250s-250 -112 -250 -250v-50h100l-200 -200l-200 200h100v50c0 193 157 350 350 350z" />
|
||||
<glyph glyph-name="4" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM100 500h600v-100h-600v100zM0 300h800v-100h-800v100zM100 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="5" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM0 500h600v-100h-600v100zM0 300h800v-100h-800v100zM0 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="6" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM200 500h600v-100h-600v100zM0 300h800v-100h-800v100zM200 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="7" unicode=""
|
||||
d="M400 700c75 0 146 -23 206 -59l-75 -225l-322 234c57 31 122 50 191 50zM125 588l191 -138l-310 -222c-4 24 -6 47 -6 72c0 114 49 215 125 288zM688 575c69 -72 112 -168 112 -275c0 -35 -8 -68 -16 -100h-218zM216 253l112 -347c-128 23 -232 109 -287 222zM372 100
|
||||
h372c-64 -109 -177 -185 -310 -197z" />
|
||||
<glyph glyph-name="8" unicode="" horiz-adv-x="600"
|
||||
d="M200 800h100v-500h200l-247 -300l-253 300h200v500z" />
|
||||
<glyph glyph-name="9" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM300 700v-300h-200l300 -300l300 300h-200v300h-200z" />
|
||||
<glyph glyph-name="a" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700l-300 -300l300 -300v200h300v200h-300v200z" />
|
||||
<glyph glyph-name="b" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700v-200h-300v-200h300v-200l300 300z" />
|
||||
<glyph glyph-name="c" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700l-300 -300h200v-300h200v300h200z" />
|
||||
<glyph glyph-name="d" unicode=""
|
||||
d="M300 600v-200h500v-100h-500v-200l-300 247z" />
|
||||
<glyph glyph-name="e" unicode=""
|
||||
d="M500 600l300 -247l-300 -253v200h-500v100h500v200z" />
|
||||
<glyph glyph-name="f" unicode="" horiz-adv-x="600"
|
||||
d="M200 800h200v-500h200l-297 -300l-303 300h200v500z" />
|
||||
<glyph glyph-name="10" unicode=""
|
||||
d="M300 700v-200h500v-200h-500v-200l-300 297z" />
|
||||
<glyph glyph-name="11" unicode=""
|
||||
d="M500 700l300 -297l-300 -303v200h-500v200h500v200z" />
|
||||
<glyph glyph-name="12" unicode="" horiz-adv-x="600"
|
||||
d="M297 800l303 -300h-200v-500h-200v500h-200z" />
|
||||
<glyph glyph-name="13" unicode="" horiz-adv-x="600"
|
||||
d="M247 800l253 -300h-200v-500h-100v500h-200z" />
|
||||
<glyph glyph-name="14" unicode=""
|
||||
d="M400 800h100v-800h-100v800zM200 700h100v-600h-100v600zM600 600h100v-400h-100v400zM0 500h100v-200h-100v200z" />
|
||||
<glyph glyph-name="15" unicode=""
|
||||
d="M116 600l72 -72c-54 -54 -88 -126 -88 -209s34 -159 88 -213l-72 -72c-72 72 -116 175 -116 285s44 209 116 281zM684 600c72 -72 116 -171 116 -281s-44 -213 -116 -285l-72 72c54 54 88 130 88 213s-34 155 -88 209zM259 460l69 -72c-18 -18 -28 -41 -28 -69
|
||||
s10 -54 28 -72l-69 -72c-36 36 -59 89 -59 144s23 105 59 141zM541 459c36 -36 59 -85 59 -140s-23 -108 -59 -144l-69 72c18 18 28 44 28 72s-10 51 -28 69z" />
|
||||
<glyph glyph-name="16" unicode="" horiz-adv-x="400"
|
||||
d="M200 800c110 0 200 -90 200 -200s-90 -200 -200 -200s-200 90 -200 200s90 200 200 200zM100 319c31 -11 65 -19 100 -19s68 8 100 19v-319l-100 100l-100 -100v319z" />
|
||||
<glyph glyph-name="17" unicode=""
|
||||
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300c0 -66 21 -126 56 -175l419 419c-49 35 -109 56 -175 56zM644 575l-419 -419c49 -35 109 -56 175 -56c166 0 300 134 300 300
|
||||
c0 66 -21 126 -56 175z" />
|
||||
<glyph glyph-name="18" unicode=""
|
||||
d="M0 700h100v-600h700v-100h-800v700zM500 700h200v-500h-200v500zM200 500h200v-300h-200v300z" />
|
||||
<glyph glyph-name="19" unicode=""
|
||||
d="M397 800c13 1 23 -4 34 -13c2 -2 214 -254 241 -287h128v-100h-100v-366c0 -18 -16 -34 -34 -34h-532c-18 0 -34 16 -34 34v366h-100v100h128l234 281c9 11 22 18 35 19zM400 672l-144 -172h288zM250 300c-28 0 -50 -22 -50 -50v-100c0 -28 22 -50 50 -50s50 22 50 50
|
||||
v100c0 28 -22 50 -50 50zM550 300c-28 0 -50 -22 -50 -50v-100c0 -28 22 -50 50 -50s50 22 50 50v100c0 28 -22 50 -50 50z" />
|
||||
<glyph glyph-name="1a" unicode=""
|
||||
d="M9 700h682c6 0 9 -4 9 -10v-190h100v-200h-100v-191c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v582c0 6 3 9 9 9zM100 600v-400h500v400h-500z" />
|
||||
<glyph glyph-name="1b" unicode=""
|
||||
d="M9 700h682c6 0 9 -4 9 -10v-190h100v-200h-100v-191c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v582c0 6 3 9 9 9z" />
|
||||
<glyph glyph-name="1c" unicode=""
|
||||
d="M92 650c0 23 19 50 45 50h3h5h5h500c28 0 50 -22 50 -50s-22 -50 -50 -50h-50v-141c9 -17 120 -231 166 -309c16 -26 34 -61 34 -106c0 -39 -15 -77 -41 -103h-3c-26 -25 -62 -41 -100 -41h-512c-39 0 -77 15 -103 41s-41 64 -41 103c0 46 18 80 34 106
|
||||
c46 78 157 292 166 309v141h-50c-2 0 -6 -1 -8 -1c-28 0 -50 23 -50 51zM500 600h-200v-162l-6 -10s-63 -123 -119 -228h450c-56 105 -119 228 -119 228l-6 10v162z" />
|
||||
<glyph glyph-name="1d" unicode=""
|
||||
d="M400 800c110 0 200 -90 200 -200c0 -104 52 -198 134 -266c41 -34 66 -82 66 -134h-800c0 52 25 100 66 134c82 68 134 162 134 266c0 110 90 200 200 200zM300 100h200c0 -55 -45 -100 -100 -100s-100 45 -100 100z" />
|
||||
<glyph glyph-name="1e" unicode="" horiz-adv-x="600"
|
||||
d="M150 800h50l350 -250l-225 -147l225 -153l-350 -250h-50v250l-75 -75l-75 75l150 150l-150 150l75 75l75 -75v250zM250 650v-200l150 100zM250 350v-200l150 100z" />
|
||||
<glyph glyph-name="1f" unicode=""
|
||||
d="M0 800h500c110 0 200 -90 200 -200c0 -47 -17 -91 -44 -125c85 -40 144 -125 144 -225c0 -138 -112 -250 -250 -250h-550v100c55 0 100 45 100 100v400c0 55 -45 100 -100 100v100zM300 700v-200h100c55 0 100 45 100 100s-45 100 -100 100h-100zM300 400v-300h150
|
||||
c83 0 150 67 150 150s-67 150 -150 150h-150z" />
|
||||
<glyph glyph-name="20" unicode="" horiz-adv-x="600"
|
||||
d="M300 800v-300h200l-300 -500v300h-200z" />
|
||||
<glyph glyph-name="21" unicode=""
|
||||
d="M100 800h300v-300l100 100l100 -100v300h50c28 0 50 -22 50 -50v-550h-550c-28 0 -50 -22 -50 -50s22 -50 50 -50h550v-100h-550c-83 0 -150 67 -150 150v550l3 19c8 39 39 70 78 78z" />
|
||||
<glyph glyph-name="22" unicode="" horiz-adv-x="400"
|
||||
d="M0 800h400v-800l-200 200l-200 -200v800z" />
|
||||
<glyph glyph-name="23" unicode=""
|
||||
d="M0 800h800v-100h-800v100zM0 600h300v-103h203v103h297v-591c0 -6 -3 -9 -9 -9h-782c-6 0 -9 3 -9 9v591z" />
|
||||
<glyph glyph-name="24" unicode=""
|
||||
d="M300 800h200c55 0 100 -45 100 -100v-100h191c6 0 9 -3 9 -9v-241c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v241c0 6 3 9 9 9h191v100c0 55 45 100 100 100zM300 700v-100h200v100h-200zM0 209c16 -6 32 -9 50 -9h700c18 0 34 3 50 9v-200c0 -6 -3 -9 -9 -9h-782
|
||||
c-6 0 -9 3 -9 9v200z" />
|
||||
<glyph glyph-name="25" unicode="" horiz-adv-x="600"
|
||||
d="M300 800c58 0 110 -16 147 -53s53 -89 53 -147h-100c0 39 -11 61 -25 75s-36 25 -75 25c-35 0 -55 -10 -72 -31s-28 -55 -28 -94c0 -51 20 -107 28 -175h172v-100h-178c-14 -60 -49 -127 -113 -200h491v-100h-600v122l16 12c69 69 95 121 106 166h-122v100h125
|
||||
c-8 50 -25 106 -25 175c0 58 16 114 50 156c34 43 88 69 150 69z" />
|
||||
<glyph glyph-name="26" unicode=""
|
||||
d="M34 700h4h3h4h5h700c28 0 50 -22 50 -50v-700c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v700v2c0 20 15 42 34 48zM150 600c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50zM350 600c-28 0 -50 -22 -50 -50s22 -50 50 -50h300c28 0 50 22 50 50
|
||||
s-22 50 -50 50h-300zM100 400v-400h600v400h-600z" />
|
||||
<glyph glyph-name="27" unicode=""
|
||||
d="M744 797l6 -3l44 -44c4 -4 3 -8 0 -12l-266 -375l-15 -13l-25 -12c-23 72 -78 127 -150 150l12 25l13 15l375 266zM266 400c74 0 134 -60 134 -134c0 -147 -119 -266 -266 -266c-48 0 -95 12 -134 34c80 46 134 133 134 232c0 74 58 134 132 134z" />
|
||||
<glyph glyph-name="28" unicode=""
|
||||
d="M9 451c0 23 19 50 46 50c8 0 19 -3 26 -7l131 -66l29 22c-79 81 -1 250 118 250s197 -167 119 -250l28 -22l131 66c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-115 -56c9 -16 19 -33 25 -50h68c28 0 50 -22 50 -50s-22 -50 -50 -50h-50
|
||||
c0 -23 -2 -45 -6 -66l78 -40c21 -5 37 -28 37 -49c0 -28 -22 -50 -50 -50c-10 0 -23 5 -31 11l-65 35c-24 -46 -62 -86 -103 -110c-35 19 -60 45 -60 72v135v4v5v6v5v5v87c0 28 -22 50 -50 50c-24 0 -45 -17 -50 -40c1 -3 1 -8 1 -11s0 -8 -1 -11v-82v-4v-5v-144
|
||||
c0 -28 -24 -53 -59 -72c-41 25 -79 64 -103 110l-66 -35c-8 -6 -21 -11 -31 -11c-28 0 -50 22 -50 50c0 21 16 44 37 49l78 40c-4 21 -6 43 -6 66h-50h-5c-28 0 -50 22 -50 50c0 26 22 50 50 50h5h69c6 17 16 34 25 50l-116 56c-16 7 -28 27 -28 45z" />
|
||||
<glyph glyph-name="29" unicode=""
|
||||
d="M600 700h91c6 0 9 -3 9 -9v-582c0 -6 -3 -9 -9 -9h-91v600zM210 503l290 147v-500l-250 125v-3c-15 0 -25 -8 -28 -22l75 -178c11 -25 0 -58 -25 -69s-58 0 -69 25l-103 272h-91c-6 0 -9 3 -9 9v182c0 6 3 9 9 9h182z" />
|
||||
<glyph glyph-name="2a" unicode=""
|
||||
d="M9 800h682c6 0 9 -3 9 -9v-782c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v782c0 6 3 9 9 9zM100 700v-200h500v200h-500zM100 400v-100h100v100h-100zM300 400v-100h100v100h-100zM500 400v-300h100v300h-100zM100 200v-100h100v100h-100zM300 200v-100h100v100h-100z" />
|
||||
<glyph glyph-name="2b" unicode=""
|
||||
d="M0 800h700v-200h-700v200zM0 500h700v-491c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v491zM100 400v-100h100v100h-100zM300 400v-100h100v100h-100zM500 400v-100h100v100h-100zM100 200v-100h100v100h-100zM300 200v-100h100v100h-100z" />
|
||||
<glyph glyph-name="2c" unicode=""
|
||||
d="M409 800h182c6 0 10 -4 12 -9l94 -182c2 -5 6 -9 12 -9h82c6 0 9 -3 9 -9v-582c0 -6 -3 -9 -9 -9h-782c-6 0 -9 3 -9 9v441c0 83 67 150 150 150h141c6 0 10 4 12 9l94 182c2 5 6 9 12 9zM150 500c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z
|
||||
M500 500c-110 0 -200 -90 -200 -200s90 -200 200 -200s200 90 200 200s-90 200 -200 200zM500 400c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100s45 100 100 100z" />
|
||||
<glyph glyph-name="2d" unicode=""
|
||||
d="M0 600h800l-400 -400z" />
|
||||
<glyph glyph-name="2e" unicode="" horiz-adv-x="400"
|
||||
d="M400 800v-800l-400 400z" />
|
||||
<glyph glyph-name="2f" unicode="" horiz-adv-x="400"
|
||||
d="M0 800l400 -400l-400 -400v800z" />
|
||||
<glyph glyph-name="30" unicode=""
|
||||
d="M400 600l400 -400h-800z" />
|
||||
<glyph glyph-name="31" unicode=""
|
||||
d="M0 550c0 23 20 50 46 50h3h5h4h200c17 0 37 -13 44 -28l38 -72h444c14 0 19 -12 15 -25l-81 -250c-4 -13 -21 -25 -35 -25h-350c-14 0 -30 12 -34 25c-27 83 -54 167 -81 250l-10 25h-150c-2 0 -5 -1 -7 -1c-28 0 -51 23 -51 51zM358 100c28 0 50 -22 50 -50
|
||||
s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM658 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
|
||||
<glyph glyph-name="32" unicode=""
|
||||
d="M0 700h500v-100h-300v-300h-100l-100 -100v500zM300 500h500v-500l-100 100h-400v400z" />
|
||||
<glyph glyph-name="33" unicode=""
|
||||
d="M641 700l143 -141l-493 -493c-71 76 -146 148 -219 222l-72 71l141 141c50 -51 101 -101 153 -150c116 117 234 231 347 350z" />
|
||||
<glyph glyph-name="34" unicode=""
|
||||
d="M150 600l250 -250l250 250l150 -150l-400 -400l-400 400z" />
|
||||
<glyph glyph-name="35" unicode="" horiz-adv-x="600"
|
||||
d="M400 800l150 -150l-250 -250l250 -250l-150 -150l-400 400z" />
|
||||
<glyph glyph-name="36" unicode="" horiz-adv-x="600"
|
||||
d="M150 800l400 -400l-400 -400l-150 150l250 250l-250 250z" />
|
||||
<glyph glyph-name="37" unicode=""
|
||||
d="M400 600l400 -400l-150 -150l-250 250l-250 -250l-150 150z" />
|
||||
<glyph glyph-name="38" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM600 622l-250 -250l-100 100l-72 -72l172 -172l322 322z" />
|
||||
<glyph glyph-name="39" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM250 622l-72 -72l150 -150l-150 -150l72 -72l150 150l150 -150l72 72l-150 150l150 150l-72 72l-150 -150z" />
|
||||
<glyph glyph-name="3a" unicode=""
|
||||
d="M350 800c28 0 50 -22 50 -50v-50h75c14 0 25 -11 25 -25v-75h-300v75c0 14 11 25 25 25h75v50c0 28 22 50 50 50zM25 700h75v-200h500v200h75c14 0 25 -11 25 -25v-650c0 -14 -11 -25 -25 -25h-650c-14 0 -25 11 -25 25v650c0 14 11 25 25 25z" />
|
||||
<glyph glyph-name="3b" unicode=""
|
||||
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM350 600h100v-181c23 -24 47 -47 72 -69l-72 -72c-27 30 -55 59 -84 88l-16 12
|
||||
v222z" />
|
||||
<glyph glyph-name="3c" unicode=""
|
||||
d="M450 800c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -18 -3 -34 -9 -50h-191v50c0 83 -67 150 -150 150s-150 -67 -150 -150v-50h-272c-17 30 -28 63 -28 100c0 110 90 200 200 200c23 114 129 200 250 200zM434 400h3h4c3 0 6 1 9 1c28 0 50 -22 50 -50v-1
|
||||
v-150h150l-200 -200l-200 200h150v150v2c0 20 15 42 34 48z" />
|
||||
<glyph glyph-name="3d" unicode=""
|
||||
d="M450 800c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -18 -3 -34 -9 -50h-141l-200 200l-200 -200h-222c-17 30 -28 63 -28 100c0 110 90 200 200 200c23 114 129 200 250 200zM450 350l250 -250h-200v-50c0 -28 -22 -50 -50 -50s-50 22 -50 50v50h-200z" />
|
||||
<glyph glyph-name="3e" unicode=""
|
||||
d="M450 700c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -83 -67 -150 -150 -150h-450c-110 0 -200 90 -200 200s90 200 200 200c23 114 129 200 250 200z" />
|
||||
<glyph glyph-name="3f" unicode=""
|
||||
d="M250 800c82 0 154 -40 200 -100c-143 0 -270 -85 -325 -209c-36 -10 -70 -25 -100 -47c-16 33 -25 67 -25 106c0 138 112 250 250 250zM450 600c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -83 -67 -150 -150 -150h-450c-110 0 -200 90 -200 200
|
||||
s90 200 200 200c23 114 129 200 250 200z" />
|
||||
<glyph glyph-name="40" unicode=""
|
||||
d="M500 700h100l-300 -600h-100zM100 600h100l-100 -200l100 -200h-100l-100 200zM600 600h100l100 -200l-100 -200h-100l100 200z" />
|
||||
<glyph glyph-name="41" unicode=""
|
||||
d="M350 800h100l50 -119l28 -12l119 50l72 -72l-50 -119l12 -28l119 -50v-100l-119 -50l-12 -28l50 -119l-72 -72l-119 50l-28 -12l-50 -119h-100l-50 119l-28 12l-119 -50l-72 72l50 119l-12 28l-119 50v100l119 50l12 28l-50 119l72 72l119 -50l28 12zM400 550
|
||||
c-83 0 -150 -67 -150 -150s67 -150 150 -150s150 67 150 150s-67 150 -150 150z" />
|
||||
<glyph glyph-name="42" unicode=""
|
||||
d="M0 800h800v-200h-800v200zM200 500h400l-200 -200zM0 100h800v-100h-800v100z" />
|
||||
<glyph glyph-name="43" unicode=""
|
||||
d="M0 800h100v-800h-100v800zM600 800h200v-800h-200v800zM500 600v-400l-200 200z" />
|
||||
<glyph glyph-name="44" unicode=""
|
||||
d="M0 800h200v-800h-200v800zM700 800h100v-800h-100v800zM300 600l200 -200l-200 -200v400z" />
|
||||
<glyph glyph-name="45" unicode=""
|
||||
d="M0 800h800v-100h-800v100zM400 500l200 -200h-400zM0 200h800v-200h-800v200z" />
|
||||
<glyph glyph-name="46" unicode=""
|
||||
d="M150 700c83 0 150 -67 150 -150v-50h100v50c0 83 67 150 150 150s150 -67 150 -150s-67 -150 -150 -150h-50v-100h50c83 0 150 -67 150 -150s-67 -150 -150 -150s-150 67 -150 150v50h-100v-50c0 -83 -67 -150 -150 -150s-150 67 -150 150s67 150 150 150h50v100h-50
|
||||
c-83 0 -150 67 -150 150s67 150 150 150zM150 600c-28 0 -50 -22 -50 -50s22 -50 50 -50h50v50c0 28 -22 50 -50 50zM550 600c-28 0 -50 -22 -50 -50v-50h50c28 0 50 22 50 50s-22 50 -50 50zM300 400v-100h100v100h-100zM150 200c-28 0 -50 -22 -50 -50s22 -50 50 -50
|
||||
s50 22 50 50v50h-50zM500 200v-50c0 -28 22 -50 50 -50s50 22 50 50s-22 50 -50 50h-50z" />
|
||||
<glyph glyph-name="47" unicode=""
|
||||
d="M0 791c0 5 4 9 9 9h782c6 0 9 -4 9 -10v-790l-200 200h-591c-6 0 -9 3 -9 9v582z" />
|
||||
<glyph glyph-name="48" unicode=""
|
||||
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM600 600l-100 -300l-300 -100l100 300zM400 450c-28 0 -50 -22 -50 -50
|
||||
s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
|
||||
<glyph glyph-name="49" unicode=""
|
||||
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700v-600c166 0 300 134 300 300s-134 300 -300 300z" />
|
||||
<glyph glyph-name="4a" unicode=""
|
||||
d="M0 800h800v-100h-800v100zM0 600h500v-100h-500v100zM0 300h800v-100h-800v100zM0 100h600v-100h-600v100zM750 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
|
||||
<glyph glyph-name="4b" unicode=""
|
||||
d="M25 700h750c14 0 25 -11 25 -25v-75h-800v75c0 14 11 25 25 25zM0 500h800v-375c0 -14 -11 -25 -25 -25h-750c-14 0 -25 11 -25 25v375zM100 300v-100h100v100h-100zM300 300v-100h100v100h-100z" />
|
||||
<glyph glyph-name="4c" unicode=""
|
||||
d="M100 800h100v-100h450l100 100l50 -50l-100 -100v-450h100v-100h-100v-100h-100v100h-500v500h-100v100h100v100zM200 600v-350l350 350h-350zM600 550l-350 -350h350v350z" />
|
||||
<glyph glyph-name="4d" unicode=""
|
||||
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM400 600c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z
|
||||
M200 452c0 20 15 42 34 48h3h3h8c12 0 28 -7 36 -16l91 -90l25 6c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100l6 25l-90 91c-9 8 -16 24 -16 36zM550 500c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
|
||||
<glyph glyph-name="4e" unicode=""
|
||||
d="M300 800h200v-300h200l-300 -300l-300 300h200v300zM0 100h800v-100h-800v100z" />
|
||||
<glyph glyph-name="4f" unicode=""
|
||||
d="M0 800h800v-100h-800v100zM400 600l300 -300h-200v-300h-200v300h-200z" />
|
||||
<glyph glyph-name="50" unicode=""
|
||||
d="M200 700h600v-600h-600l-200 300zM350 622l-72 -72l150 -150l-150 -150l72 -72l150 150l150 -150l72 72l-150 150l150 150l-72 72l-150 -150z" />
|
||||
<glyph glyph-name="51" unicode=""
|
||||
d="M400 700c220 0 400 -180 400 -400h-100c0 166 -134 300 -300 300s-300 -134 -300 -300h-100c0 220 180 400 400 400zM341 491l59 -88l59 88c81 -25 141 -101 141 -191c0 -110 -90 -200 -200 -200s-200 90 -200 200c0 90 60 166 141 191z" />
|
||||
<glyph glyph-name="52" unicode=""
|
||||
d="M0 800h300v-400h400v-400h-700v800zM400 800l300 -300h-300v300zM100 600v-100h100v100h-100zM100 400v-100h100v100h-100zM100 200v-100h400v100h-400z" />
|
||||
<glyph glyph-name="53" unicode="" horiz-adv-x="600"
|
||||
d="M200 700h100v-100h75c30 0 58 -6 81 -22s44 -44 44 -78v-100h-100v94c-4 3 -13 6 -25 6h-250c-14 0 -25 -11 -25 -25v-50c0 -15 20 -40 34 -44l257 -65c66 -16 109 -73 109 -141v-50c0 -68 -57 -125 -125 -125h-75v-100h-100v100h-75c-30 0 -58 6 -81 22s-44 44 -44 78
|
||||
v100h100v-94c4 -3 13 -6 25 -6h250c14 0 25 11 25 25v50c0 15 -20 40 -34 44l-257 65c-66 16 -109 73 -109 141v50c0 68 57 125 125 125h75v100z" />
|
||||
<glyph glyph-name="54" unicode=""
|
||||
d="M0 700h300v-300l-300 -300v600zM500 700h300v-300l-300 -300v600z" />
|
||||
<glyph glyph-name="55" unicode=""
|
||||
d="M300 700v-600h-300v300zM800 700v-600h-300v300z" />
|
||||
<glyph glyph-name="56" unicode=""
|
||||
d="M300 700v-100c-111 0 -200 -89 -200 -200h200v-300h-300v300c0 165 135 300 300 300zM800 700v-100c-111 0 -200 -89 -200 -200h200v-300h-300v300c0 165 135 300 300 300z" />
|
||||
<glyph glyph-name="57" unicode=""
|
||||
d="M0 700h300v-300c0 -165 -135 -300 -300 -300v100c111 0 200 89 200 200h-200v300zM500 700h300v-300c0 -165 -135 -300 -300 -300v100c111 0 200 89 200 200h-200v300z" />
|
||||
<glyph glyph-name="58" unicode="" horiz-adv-x="600"
|
||||
d="M300 800l34 -34c11 -11 266 -270 266 -488c0 -165 -135 -300 -300 -300s-300 135 -300 300c0 218 255 477 266 488zM150 328c-28 0 -50 -22 -50 -50c0 -110 90 -200 200 -200c28 0 50 22 50 50s-22 50 -50 50c-55 0 -100 45 -100 100c0 28 -22 50 -50 50z" />
|
||||
<glyph glyph-name="59" unicode=""
|
||||
d="M400 800l400 -500h-800zM0 200h800v-200h-800v200z" />
|
||||
<glyph glyph-name="5a" unicode="" horiz-adv-x="600"
|
||||
d="M300 800l300 -300h-600zM0 300h600l-300 -300z" />
|
||||
<glyph glyph-name="5b" unicode=""
|
||||
d="M0 500h200v-200h-200v200zM300 500h200v-200h-200v200zM600 500h200v-200h-200v200z" />
|
||||
<glyph glyph-name="5c" unicode=""
|
||||
d="M0 700h800v-100l-400 -200l-400 200v100zM0 500l400 -200l400 200v-400h-800v400z" />
|
||||
<glyph glyph-name="5d" unicode=""
|
||||
d="M400 800l400 -200v-600h-800v600zM400 688l-300 -150v-188l300 -150l300 150v188zM200 500h400v-100l-200 -100l-200 100v100z" />
|
||||
<glyph glyph-name="5e" unicode=""
|
||||
d="M600 700c69 0 134 -19 191 -50l-16 -106c-49 35 -109 56 -175 56c-131 0 -240 -84 -281 -200h331l-16 -100h-334c0 -36 8 -68 19 -100h297l-16 -100h-222c55 -61 133 -100 222 -100c78 0 147 30 200 78v-122c-59 -35 -127 -56 -200 -56c-147 0 -274 82 -344 200h-256
|
||||
l19 100h197c-8 32 -16 66 -16 100h-200l25 100h191c45 172 198 300 384 300z" />
|
||||
<glyph glyph-name="5f" unicode=""
|
||||
d="M0 700h700v-100h-700v100zM0 500h500v-100h-500v100zM0 300h800v-100h-800v100zM0 100h100v-100h-100v100zM200 100h100v-100h-100v100zM400 100h100v-100h-100v100z" />
|
||||
<glyph glyph-name="60" unicode=""
|
||||
d="M0 800h800v-100h-800v100zM200 600h400l-200 -200zM0 200h800v-200h-800v200z" />
|
||||
<glyph glyph-name="61" unicode=""
|
||||
d="M0 800h100v-800h-100v800zM600 800h200v-800h-200v800zM200 600l200 -200l-200 -200v400z" />
|
||||
<glyph glyph-name="62" unicode=""
|
||||
d="M0 800h200v-800h-200v800zM700 800h100v-800h-100v800zM600 600v-400l-200 200z" />
|
||||
<glyph glyph-name="63" unicode=""
|
||||
d="M0 800h800v-200h-800v200zM400 400l200 -200h-400zM0 100h800v-100h-800v100z" />
|
||||
<glyph glyph-name="64" unicode=""
|
||||
d="M0 800h200v-100h-100v-600h600v100h100v-200h-800v800zM400 800h400v-400l-150 150l-250 -250l-100 100l250 250z" />
|
||||
<glyph glyph-name="65" unicode=""
|
||||
d="M403 700c247 0 397 -300 397 -300s-150 -300 -397 -300c-253 0 -403 300 -403 300s150 300 403 300zM400 600c-110 0 -200 -90 -200 -200s90 -200 200 -200s200 90 200 200s-90 200 -200 200zM400 500c10 0 19 -3 28 -6c-16 -8 -28 -24 -28 -44c0 -28 22 -50 50 -50
|
||||
c20 0 36 12 44 28c3 -9 6 -18 6 -28c0 -55 -45 -100 -100 -100s-100 45 -100 100s45 100 100 100z" />
|
||||
<glyph glyph-name="66" unicode="" horiz-adv-x="900"
|
||||
d="M331 700h3h3c3 1 7 1 10 1c12 0 29 -8 37 -17l94 -93l66 65c57 57 155 57 212 0c58 -58 58 -154 0 -212l-65 -66l93 -94c10 -8 18 -25 18 -38c0 -28 -22 -50 -50 -50c-13 0 -32 9 -40 20l-62 65l-381 -381h-269v272l375 381l-63 63c-9 8 -16 24 -16 36c0 20 16 42 35 48z
|
||||
M447 481l-313 -315l128 -132l316 316z" />
|
||||
<glyph glyph-name="67" unicode=""
|
||||
d="M0 800h300v-400h400v-400h-700v800zM400 800l300 -300h-300v300z" />
|
||||
<glyph glyph-name="68" unicode=""
|
||||
d="M200 800c0 0 200 -100 200 -300s-298 -302 -200 -500c0 0 -200 100 -200 300s300 300 200 500zM500 500c0 0 200 -100 200 -300c0 -150 -60 -200 -100 -200h-300c0 200 300 300 200 500z" />
|
||||
<glyph glyph-name="69" unicode=""
|
||||
d="M0 800h100v-800h-100v800zM200 800h300v-100h300l-200 -203l200 -197h-400v100h-200v400z" />
|
||||
<glyph glyph-name="6a" unicode="" horiz-adv-x="400"
|
||||
d="M150 800h150l-100 -200h200l-150 -300h150l-300 -300l-100 300h134l66 200h-200z" />
|
||||
<glyph glyph-name="6b" unicode=""
|
||||
d="M0 800h300v-100h500v-100h-800v200zM0 500h800v-450c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v450z" />
|
||||
<glyph glyph-name="6c" unicode=""
|
||||
d="M150 800c83 0 150 -67 150 -150c0 -66 -41 -121 -100 -141v-118c15 5 33 9 50 9h200c28 0 50 22 50 50v59c-59 20 -100 75 -100 141c0 83 67 150 150 150s150 -67 150 -150c0 -66 -41 -121 -100 -141v-59c0 -82 -68 -150 -150 -150h-200c-14 0 -25 -7 -34 -16
|
||||
c50 -24 84 -74 84 -134c0 -83 -67 -150 -150 -150s-150 67 -150 150c0 66 41 121 100 141v218c-59 20 -100 75 -100 141c0 83 67 150 150 150z" />
|
||||
<glyph glyph-name="6d" unicode=""
|
||||
d="M0 800h400l-150 -150l150 -150l-100 -100l-150 150l-150 -150v400zM500 400l150 -150l150 150v-400h-400l150 150l-150 150z" />
|
||||
<glyph glyph-name="6e" unicode=""
|
||||
d="M100 800l150 -150l150 150v-400h-400l150 150l-150 150zM400 400h400l-150 -150l150 -150l-100 -100l-150 150l-150 -150v400z" />
|
||||
<glyph glyph-name="6f" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700c-56 0 -108 -17 -153 -44l22 -19c33 -18 13 -48 -13 -59c-30 -13 -77 10 -65 -41c13 -55 -27 -3 -47 -15c-42 -26 49 -152 31 -156l-59 34c-8 0 -13 -5 -16 -10
|
||||
c1 -30 10 -57 19 -84c28 -11 77 -2 100 -25c47 -28 97 -115 75 -159c34 -13 68 -22 106 -22c101 0 193 48 247 125c3 24 -8 44 -50 44c-69 0 -156 13 -153 97c2 46 101 108 66 143c-30 30 12 39 12 66c0 37 -65 32 -69 50s20 36 41 56c-30 10 -60 19 -94 19zM631 591
|
||||
c-38 -11 -94 -35 -87 -53c6 -15 52 -1 65 -13c11 -10 16 -59 44 -31l22 22v3c-11 26 -26 50 -44 72z" />
|
||||
<glyph glyph-name="70" unicode=""
|
||||
d="M703 800l97 -100l-400 -400l-100 100l-200 -203l-100 100l300 303l100 -100zM0 100h800v-100h-800v100z" />
|
||||
<glyph glyph-name="71" unicode=""
|
||||
d="M0 700h100v-100h-100v100zM200 700h100v-100h-100v100zM400 700h100v-100h-100v100zM600 700h100v-100h-100v100zM0 500h100v-100h-100v100zM200 500h100v-100h-100v100zM400 500h100v-100h-100v100zM600 500h100v-100h-100v100zM0 300h100v-100h-100v100zM200 300h100
|
||||
v-100h-100v100zM400 300h100v-100h-100v100zM600 300h100v-100h-100v100zM0 100h100v-100h-100v100zM200 100h100v-100h-100v100zM400 100h100v-100h-100v100zM600 100h100v-100h-100v100z" />
|
||||
<glyph glyph-name="72" unicode=""
|
||||
d="M0 800h200v-200h-200v200zM300 800h200v-200h-200v200zM600 800h200v-200h-200v200zM0 500h200v-200h-200v200zM300 500h200v-200h-200v200zM600 500h200v-200h-200v200zM0 200h200v-200h-200v200zM300 200h200v-200h-200v200zM600 200h200v-200h-200v200z" />
|
||||
<glyph glyph-name="73" unicode=""
|
||||
d="M0 800h300v-300h-300v300zM500 800h300v-300h-300v300zM0 300h300v-300h-300v300zM500 300h300v-300h-300v300z" />
|
||||
<glyph glyph-name="74" unicode=""
|
||||
d="M19 800h662c11 0 19 -8 19 -19v-331c0 -28 -22 -50 -50 -50h-600c-28 0 -50 22 -50 50v331c0 11 8 19 19 19zM0 309c16 -6 32 -9 50 -9h600c18 0 34 3 50 9v-290c0 -11 -8 -19 -19 -19h-662c-11 0 -19 8 -19 19v290zM550 200c-28 0 -50 -22 -50 -50s22 -50 50 -50
|
||||
s50 22 50 50s-22 50 -50 50z" />
|
||||
<glyph glyph-name="75" unicode=""
|
||||
d="M0 700h300v-100h-50c-28 0 -50 -22 -50 -50v-150h300v150c0 28 -22 50 -50 50h-50v100h300v-100h-50c-28 0 -50 -22 -50 -50v-400c0 -28 22 -50 50 -50h50v-100h-300v100h50c28 0 50 22 50 50v150h-300v-150c0 -28 22 -50 50 -50h50v-100h-300v100h50c28 0 50 22 50 50
|
||||
v400c0 28 -22 50 -50 50h-50v100z" />
|
||||
<glyph glyph-name="76" unicode=""
|
||||
d="M400 700c165 0 300 -135 300 -300v-100h50c28 0 50 -22 50 -50v-200c0 -28 -22 -50 -50 -50h-100c-28 0 -50 22 -50 50v350c0 111 -89 200 -200 200s-200 -89 -200 -200v-350c0 -28 -22 -50 -50 -50h-100c-28 0 -50 22 -50 50v200c0 28 22 50 50 50h50v100
|
||||
c0 165 135 300 300 300z" />
|
||||
<glyph glyph-name="77" unicode=""
|
||||
d="M0 500c0 109 91 200 200 200s200 -91 200 -200c0 109 91 200 200 200s200 -91 200 -200c0 -55 -23 -105 -59 -141l-341 -340l-341 340c-36 36 -59 86 -59 141z" />
|
||||
<glyph glyph-name="78" unicode=""
|
||||
d="M400 700l400 -300l-100 3v-403h-200v200h-200v-200h-200v400h-100z" />
|
||||
<glyph glyph-name="79" unicode=""
|
||||
d="M0 800h800v-800h-800v800zM100 700v-300l100 100l400 -400h100v100l-200 200l100 100l100 -100v300h-600z" />
|
||||
<glyph glyph-name="7a" unicode=""
|
||||
d="M19 800h762c11 0 19 -8 19 -19v-762c0 -11 -8 -19 -19 -19h-762c-11 0 -19 8 -19 19v762c0 11 8 19 19 19zM100 600v-300h100l100 -100h200l100 100h100v300h-600z" />
|
||||
<glyph glyph-name="7b" unicode=""
|
||||
d="M200 600c80 0 142 -56 200 -122c58 66 119 122 200 122c131 0 200 -101 200 -200s-69 -200 -200 -200c-81 0 -142 56 -200 122c-58 -66 -121 -122 -200 -122c-131 0 -200 101 -200 200s69 200 200 200zM200 500c-74 0 -100 -54 -100 -100s26 -100 100 -100
|
||||
c42 0 88 47 134 100c-46 53 -92 100 -134 100zM600 500c-43 0 -88 -47 -134 -100c46 -53 91 -100 134 -100c74 0 100 54 100 100s-26 100 -100 100z" />
|
||||
<glyph glyph-name="7c" unicode="" horiz-adv-x="400"
|
||||
d="M300 800c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100s45 100 100 100zM150 550c83 0 150 -69 150 -150c0 -66 -100 -214 -100 -250c0 -28 22 -50 50 -50s50 22 50 50h100c0 -83 -67 -150 -150 -150s-150 64 -150 150s100 222 100 250s-22 50 -50 50
|
||||
s-50 -22 -50 -50h-100c0 83 67 150 150 150z" />
|
||||
<glyph glyph-name="7d" unicode=""
|
||||
d="M200 800h500v-100h-122c-77 -197 -156 -392 -234 -588l-6 -12h162v-100h-500v100h122c77 197 156 392 234 588l7 12h-163v100z" />
|
||||
<glyph glyph-name="7e" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM0 500h800v-100h-800v100zM0 300h800v-100h-800v100zM100 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="7f" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM0 500h800v-100h-800v100zM0 300h800v-100h-800v100zM0 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="80" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM0 500h800v-100h-800v100zM0 300h800v-100h-800v100zM200 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="81" unicode=""
|
||||
d="M550 800c138 0 250 -112 250 -250s-112 -250 -250 -250c-16 0 -32 0 -47 3l-3 -3v-100h-200v-200h-300v200l303 303c-3 15 -3 31 -3 47c0 138 112 250 250 250zM600 700c-55 0 -100 -45 -100 -100s45 -100 100 -100s100 45 100 100s-45 100 -100 100z" />
|
||||
<glyph glyph-name="82" unicode=""
|
||||
d="M134 600h3h4h4h5h500c28 0 50 -22 50 -50v-350h100v-150c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v150h100v350v2c0 20 15 42 34 48zM200 500v-300h100v-100h200v100h100v300h-400z" />
|
||||
<glyph glyph-name="83" unicode=""
|
||||
d="M0 800h400v-400h-400v400zM500 600h100v-400h-400v100h300v300zM700 400h100v-400h-400v100h300v300z" />
|
||||
<glyph glyph-name="84" unicode="" horiz-adv-x="600"
|
||||
d="M337 694c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-300 -150c-8 -6 -21 -11 -31 -11c-28 0 -50 22 -50 50c0 21 16 44 37 49zM437 544c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-400 -200c-8 -6 -21 -11 -31 -11c-28 0 -50 22 -50 50
|
||||
c0 21 16 44 37 49zM437 344c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-106 -56c24 -4 43 -26 43 -50c0 -28 -23 -51 -51 -51c-2 0 -6 1 -8 1h-200c-26 1 -48 24 -48 50c0 16 12 36 26 44zM151 -50c0 23 20 50 46 50h3h4h5h100c28 0 50 -22 50 -50
|
||||
s-22 -50 -50 -50h-100c-2 0 -6 -1 -8 -1c-28 0 -50 23 -50 51z" />
|
||||
<glyph glyph-name="85" unicode=""
|
||||
d="M199 800h100v-200h-200v100h100v100zM586 797h1c18 1 38 1 56 -3c36 -8 69 -26 97 -54c78 -78 78 -203 0 -281l-150 -150c-8 -13 -28 -24 -43 -24c-28 0 -50 22 -50 50c0 15 11 35 24 43l150 150c40 40 39 105 0 144c-41 41 -110 34 -144 0l-44 -44
|
||||
c-8 -13 -27 -24 -42 -24c-28 0 -50 22 -50 50c0 15 11 35 24 43l43 44c32 33 72 53 128 56zM208 490c4 5 14 16 22 16h3c2 0 6 1 8 1c28 0 50 -22 50 -50c0 -11 -6 -27 -14 -35l-150 -150c-40 -40 -39 -105 0 -144c41 -41 110 -34 144 0l44 44c8 13 27 24 42 24
|
||||
c28 0 50 -22 50 -50c0 -15 -11 -35 -24 -43l-43 -44c-22 -22 -48 -37 -75 -47c-70 -25 -151 -9 -207 47c-78 78 -78 203 0 281zM499 200h200v-100h-100v-100h-100v200z" />
|
||||
<glyph glyph-name="86" unicode=""
|
||||
d="M586 797c18 1 39 1 57 -3c36 -8 69 -26 97 -54c78 -78 78 -203 0 -281l-150 -150c-62 -62 -132 -81 -182 -78s-69 17 -84 25s-26 27 -26 44c0 28 22 51 50 51c8 0 19 -3 26 -7c0 0 15 -11 41 -13s62 3 106 47l150 150c40 40 39 105 0 144c-41 41 -110 34 -144 0
|
||||
c-8 -13 -28 -24 -43 -24c-28 0 -50 22 -50 50c0 15 11 35 24 43c32 33 72 53 128 56zM386 566c50 -2 64 -17 85 -22s37 -28 37 -49c0 -28 -22 -50 -50 -50c-10 0 -23 5 -31 11c0 0 -19 9 -47 10s-63 -4 -103 -44l-150 -150c-40 -40 -39 -105 0 -144c41 -41 110 -34 144 0
|
||||
c8 13 27 24 42 24c28 0 50 -22 50 -50c0 -15 -10 -35 -23 -43c-22 -22 -48 -37 -75 -47c-70 -25 -151 -9 -207 47c-78 78 -78 203 0 281l150 150c60 60 128 78 178 76z" />
|
||||
<glyph glyph-name="87" unicode=""
|
||||
d="M0 700h300v-300h-300v300zM400 700h400v-100h-400v100zM400 500h300v-100h-300v100zM0 300h300v-300h-300v300zM400 300h400v-100h-400v100zM400 100h300v-100h-300v100z" />
|
||||
<glyph glyph-name="88" unicode=""
|
||||
d="M50 700c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM200 700h600v-100h-600v100zM50 500c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM200 500h600v-100h-600v100zM50 300c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50
|
||||
s22 50 50 50zM200 300h600v-100h-600v100zM50 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM200 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="89" unicode=""
|
||||
d="M800 800l-400 -800l-100 300l-300 100z" />
|
||||
<glyph glyph-name="8a" unicode="" horiz-adv-x="600"
|
||||
d="M300 700c110 0 200 -90 200 -200v-100h100v-400h-600v400h100v100c0 110 90 200 200 200zM300 600c-56 0 -100 -44 -100 -100v-100h200v100c0 56 -44 100 -100 100z" />
|
||||
<glyph glyph-name="8b" unicode="" horiz-adv-x="600"
|
||||
d="M300 800c110 0 200 -90 200 -200v-200h100v-400h-600v400h400v200c0 56 -44 100 -100 100s-100 -44 -100 -100h-100c0 110 90 200 200 200z" />
|
||||
<glyph glyph-name="8c" unicode=""
|
||||
d="M400 700v-100c-111 0 -200 -89 -200 -200h100l-150 -200l-150 200h100c0 165 135 300 300 300zM650 600l150 -200h-100c0 -165 -135 -300 -300 -300v100c111 0 200 89 200 200h-100z" />
|
||||
<glyph glyph-name="8d" unicode=""
|
||||
d="M100 800h600v-300h100l-150 -250l-150 250h100v200h-400v-100h-100v200zM150 550l150 -250h-100v-200h400v100h100v-200h-600v300h-100z" />
|
||||
<glyph glyph-name="8e" unicode=""
|
||||
d="M600 700l200 -150l-200 -150v100h-500v-100h-100v100c0 55 45 100 100 100h500v100zM200 300v-100h500v100h100v-100c0 -55 -45 -100 -100 -100h-500v-100l-200 150z" />
|
||||
<glyph glyph-name="8f" unicode="" horiz-adv-x="900"
|
||||
d="M350 800c193 0 350 -157 350 -350c0 -60 -17 -117 -44 -166c5 -3 12 -8 16 -12l100 -100c16 -16 30 -49 30 -72c0 -56 -46 -102 -102 -102c-23 0 -56 14 -72 30l-100 100c-4 3 -9 9 -12 13c-49 -26 -107 -41 -166 -41c-193 0 -350 157 -350 350s157 350 350 350zM350 200
|
||||
c142 0 250 108 250 250c0 139 -111 250 -250 250s-250 -111 -250 -250s111 -250 250 -250z" />
|
||||
<glyph glyph-name="90" unicode="" horiz-adv-x="600"
|
||||
d="M300 800c166 0 300 -134 300 -300c0 -200 -300 -500 -300 -500s-300 300 -300 500c0 166 134 300 300 300zM300 700c-110 0 -200 -90 -200 -200s90 -200 200 -200s200 90 200 200s-90 200 -200 200z" />
|
||||
<glyph glyph-name="91" unicode="" horiz-adv-x="900"
|
||||
d="M0 800h800v-541c1 -3 1 -8 1 -11s0 -7 -1 -10v-238h-800v800zM495 250c0 26 22 50 50 50h5h150v400h-600v-600h600v100h-150h-5c-28 0 -50 22 -50 50zM350 600c83 0 150 -67 150 -150c0 -100 -150 -250 -150 -250s-150 150 -150 250c0 83 67 150 150 150zM350 500
|
||||
c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
|
||||
<glyph glyph-name="92" unicode="" horiz-adv-x="600"
|
||||
d="M0 700h200v-600h-200v600zM400 700h200v-600h-200v600z" />
|
||||
<glyph glyph-name="93" unicode="" horiz-adv-x="600"
|
||||
d="M0 700l600 -300l-600 -300v600z" />
|
||||
<glyph glyph-name="94" unicode="" horiz-adv-x="600"
|
||||
d="M300 700c166 0 300 -134 300 -300s-134 -300 -300 -300s-300 134 -300 300s134 300 300 300z" />
|
||||
<glyph glyph-name="95" unicode=""
|
||||
d="M400 700v-600l-400 300zM400 400l400 300v-600z" />
|
||||
<glyph glyph-name="96" unicode=""
|
||||
d="M0 700l400 -300l-400 -300v600zM400 100v600l400 -300z" />
|
||||
<glyph glyph-name="97" unicode=""
|
||||
d="M0 700h200v-600h-200v600zM200 400l500 300v-600z" />
|
||||
<glyph glyph-name="98" unicode=""
|
||||
d="M0 700l500 -300l-500 -300v600zM500 100v600h200v-600h-200z" />
|
||||
<glyph glyph-name="99" unicode="" horiz-adv-x="600"
|
||||
d="M0 700h600v-600h-600v600z" />
|
||||
<glyph glyph-name="9a" unicode=""
|
||||
d="M200 800h400v-200h200v-400h-200v-200h-400v200h-200v400h200v200z" />
|
||||
<glyph glyph-name="9b" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM0 403h800v-100h-800v100zM0 103h800v-100h-800v100z" />
|
||||
<glyph glyph-name="9c" unicode="" horiz-adv-x="600"
|
||||
d="M278 700c7 2 13 4 22 4c55 0 100 -45 100 -100v-4v-200c0 -55 -45 -100 -100 -100s-100 45 -100 100v200v2c0 44 35 88 78 98zM34 500h4h3c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-50c0 -111 89 -200 200 -200s200 89 200 200v50c0 28 22 50 50 50s50 -22 50 -50v-50
|
||||
c0 -148 -109 -270 -250 -294v-106h50c55 0 100 -45 100 -100h-400c0 55 45 100 100 100h50v106c-141 24 -250 146 -250 294v50v2c0 20 15 42 34 48z" />
|
||||
<glyph glyph-name="9d" unicode=""
|
||||
d="M0 500h800v-200h-800v200z" />
|
||||
<glyph glyph-name="9e" unicode=""
|
||||
d="M34 700h4h3h4h5h700c28 0 50 -22 50 -50v-500c0 -28 -22 -50 -50 -50h-250v-100h100c55 0 100 -45 100 -100h-600c0 55 45 100 100 100h100v100h-250c-28 0 -50 22 -50 50v500v2c0 20 15 42 34 48zM100 600v-400h600v400h-600z" />
|
||||
<glyph glyph-name="9f" unicode=""
|
||||
d="M272 700c-14 -40 -22 -83 -22 -128c0 -221 179 -400 400 -400c45 0 88 8 128 22c-53 -158 -202 -272 -378 -272c-221 0 -400 179 -400 400c0 176 114 325 272 378z" />
|
||||
<glyph glyph-name="a0" unicode=""
|
||||
d="M350 700l150 -150h-100v-150h150v100l150 -150l-150 -150v100h-150v-150h100l-150 -150l-150 150h100v150h-150v-100l-150 150l150 150v-100h150v150h-100z" />
|
||||
<glyph glyph-name="a1" unicode=""
|
||||
d="M800 800v-550c0 -83 -67 -150 -150 -150s-150 67 -150 150s67 150 150 150c17 0 35 -4 50 -9v206c-201 -6 -327 -27 -400 -50v-397c0 -83 -67 -150 -150 -150s-150 67 -150 150s67 150 150 150c17 0 35 -4 50 -9v409s100 100 600 100z" />
|
||||
<glyph glyph-name="a2" unicode="" horiz-adv-x="700"
|
||||
d="M499 700c51 0 102 -20 141 -59c78 -78 78 -203 0 -281l-250 -244c-48 -48 -127 -48 -175 0s-48 127 0 175l96 97l69 -69l-90 -94l-7 -3c-10 -10 -10 -28 0 -38s28 -10 38 0l250 247c37 40 39 102 0 141s-104 40 -144 0l-278 -275c-66 -69 -68 -179 0 -247
|
||||
c69 -69 181 -69 250 0l9 12l116 113l69 -69l-125 -125c-107 -107 -281 -107 -388 0s-107 281 0 388l278 272c39 39 90 59 141 59z" />
|
||||
<glyph glyph-name="a3" unicode=""
|
||||
d="M600 800l200 -200l-100 -100l-200 200zM400 600l200 -200l-400 -400h-200v200z" />
|
||||
<glyph glyph-name="a4" unicode=""
|
||||
d="M550 800c83 0 150 -90 150 -200s-67 -200 -150 -200c-22 0 -40 8 -59 19c6 26 9 52 9 81c0 84 -27 158 -72 212c27 52 71 88 122 88zM250 700c83 0 150 -90 150 -200s-67 -200 -150 -200s-150 90 -150 200s67 200 150 200zM725 384c44 -22 75 -66 75 -118v-166h-200v66
|
||||
c0 50 -17 96 -44 134c66 2 126 33 169 84zM75 284c45 -53 106 -84 175 -84s130 31 175 84c44 -22 75 -66 75 -118v-166h-500v166c0 52 31 96 75 118z" />
|
||||
<glyph glyph-name="a5" unicode=""
|
||||
d="M400 800c110 0 200 -112 200 -250s-90 -250 -200 -250s-200 112 -200 250s90 250 200 250zM191 300c54 -61 128 -100 209 -100s155 39 209 100c106 -5 191 -92 191 -200v-100h-800v100c0 108 85 195 191 200z" />
|
||||
<glyph glyph-name="a6" unicode="" horiz-adv-x="600"
|
||||
d="M19 800h462c11 0 19 -8 19 -19v-762c0 -11 -8 -19 -19 -19h-462c-11 0 -19 8 -19 19v762c0 11 8 19 19 19zM100 700v-500h300v500h-300zM250 150c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
|
||||
<glyph glyph-name="a7" unicode=""
|
||||
d="M350 800c17 0 34 -1 50 -3v-397l-297 297c63 64 150 103 247 103zM500 694c169 -25 300 -168 300 -344c0 -193 -157 -350 -350 -350c-85 0 -161 31 -222 81l272 272v341zM91 562l237 -234l-212 -212c-70 55 -116 138 -116 234c0 84 35 158 91 212z" />
|
||||
<glyph glyph-name="a8" unicode=""
|
||||
d="M92 650c0 23 20 50 46 50h3h4h5h400c28 0 50 -22 50 -50s-22 -50 -50 -50h-50v-200h100c55 0 100 -45 100 -100h-300v-300l-56 -100l-44 100v300h-300c0 55 45 100 100 100h100v200h-50c-2 0 -6 -1 -8 -1c-28 0 -50 23 -50 51z" />
|
||||
<glyph glyph-name="a9" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM300 600v-400l300 200z" />
|
||||
<glyph glyph-name="aa" unicode=""
|
||||
d="M300 800h200v-300h300v-200h-300v-300h-200v300h-300v200h300v300z" />
|
||||
<glyph glyph-name="ab" unicode=""
|
||||
d="M300 800h100v-400h-100v400zM172 656l62 -78l-40 -31c-58 -46 -94 -117 -94 -197c0 -139 111 -250 250 -250s250 111 250 250c0 80 -39 151 -97 197l-37 31l62 78l38 -31c82 -64 134 -164 134 -275c0 -193 -157 -350 -350 -350s-350 157 -350 350c0 111 53 211 134 275z
|
||||
" />
|
||||
<glyph glyph-name="ac" unicode=""
|
||||
d="M200 800h400v-200h-400v200zM9 500h782c6 0 9 -3 9 -9v-282c0 -6 -3 -9 -9 -9h-91v200h-600v-200h-91c-6 0 -9 3 -9 9v282c0 6 3 9 9 9zM200 300h400v-300h-400v300z" />
|
||||
<glyph glyph-name="ad" unicode=""
|
||||
d="M0 700h100v-700h-100v700zM700 700h100v-700h-100v700zM200 600h200v-100h-200v100zM300 400h200v-100h-200v100zM400 200h200v-100h-200v100z" />
|
||||
<glyph glyph-name="ae" unicode=""
|
||||
d="M325 700c42 -141 87 -280 131 -419c29 74 59 148 88 222c30 -57 58 -114 87 -172h169v-100h-231l-13 28c-37 -92 -74 -184 -112 -275c-38 129 -79 257 -119 385c-42 -133 -83 -267 -125 -400c-28 88 -56 175 -84 262h-116v100h188l9 -34l3 -6c42 137 83 273 125 409z" />
|
||||
<glyph glyph-name="af" unicode=""
|
||||
d="M200 600c0 57 43 100 100 100s100 -43 100 -100c0 -28 -18 -48 -28 -72c-3 -6 -3 -16 -3 -28h231v-231c12 0 22 0 28 3c24 10 44 28 72 28c57 0 100 -43 100 -100s-43 -100 -100 -100c-28 0 -48 18 -72 28c-6 3 -16 3 -28 3v-231h-231c0 12 0 22 3 28c10 24 28 44 28 72
|
||||
c0 57 -43 100 -100 100s-100 -43 -100 -100c0 -28 18 -48 28 -72c3 -6 3 -16 3 -28h-231v600h231c0 12 0 22 -3 28c-10 24 -28 44 -28 72z" />
|
||||
<glyph glyph-name="b0" unicode="" horiz-adv-x="500"
|
||||
d="M247 700c84 0 148 -20 191 -59s59 -93 59 -141c0 -117 -69 -181 -119 -225s-81 -67 -81 -150v-25h-100v25c0 117 65 181 115 225s85 67 85 150c0 25 -8 48 -28 66s-56 34 -122 34s-97 -18 -116 -37s-27 -43 -31 -69l-100 12c5 38 19 88 59 128s103 66 188 66zM197 0h100
|
||||
v-100h-100v100z" />
|
||||
<glyph glyph-name="b1" unicode=""
|
||||
d="M450 800c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -69 -48 -127 -112 -144c-22 55 -75 94 -138 94c-20 0 -39 -5 -56 -12c-17 64 -75 112 -144 112s-127 -48 -144 -112c-17 7 -36 12 -56 12c-37 0 -71 -12 -97 -34c-33 36 -53 82 -53 134
|
||||
c0 110 90 200 200 200c23 114 129 200 250 200zM334 300h4h3c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-200c0 -28 -22 -50 -50 -50s-50 22 -50 50v200v2c0 20 15 42 34 48zM134 200h4h3c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-100c0 -28 -22 -50 -50 -50s-50 22 -50 50v100v2
|
||||
c0 20 15 42 34 48zM534 200h3h4c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-100c0 -28 -22 -50 -50 -50s-50 22 -50 50v100v2c0 20 15 42 34 48z" />
|
||||
<glyph glyph-name="b2" unicode=""
|
||||
d="M600 800l200 -150l-200 -150v100h-50l-153 -191l175 -206l6 -3h22v100l200 -150l-200 -150v100h-25c-35 0 -56 12 -78 38l-166 190l-153 -190c-22 -27 -43 -38 -78 -38h-100v100h100l166 206l-163 191l-3 3h-100v100h100c34 0 56 -12 78 -38l153 -178l141 178
|
||||
c22 27 43 38 78 38h50v100z" />
|
||||
<glyph glyph-name="b3" unicode=""
|
||||
d="M400 800c110 0 209 -47 281 -119l119 119v-300h-300l109 109c-54 55 -126 91 -209 91c-166 0 -300 -134 -300 -300s134 -300 300 -300c83 0 158 34 212 88l72 -72c-72 -72 -174 -116 -284 -116c-220 0 -400 180 -400 400s180 400 400 400z" />
|
||||
<glyph glyph-name="b4" unicode=""
|
||||
d="M400 800h400v-400l-166 166l-400 -400l166 -166h-400v400l166 -166l400 400z" />
|
||||
<glyph glyph-name="b5" unicode="" horiz-adv-x="600"
|
||||
d="M250 800l250 -300h-200v-200h200l-250 -300l-250 300h200v200h-200z" />
|
||||
<glyph glyph-name="b6" unicode=""
|
||||
d="M300 600v-200h200v200l300 -250l-300 -250v200h-200v-200l-300 250z" />
|
||||
<glyph glyph-name="b7" unicode=""
|
||||
d="M0 800c441 0 800 -359 800 -800h-200c0 333 -267 600 -600 600v200zM0 500c275 0 500 -225 500 -500h-200c0 167 -133 300 -300 300v200zM0 200c110 0 200 -90 200 -200h-200v200z" />
|
||||
<glyph glyph-name="b8" unicode=""
|
||||
d="M100 800c386 0 700 -314 700 -700h-100c0 332 -268 600 -600 600v100zM100 600c276 0 500 -224 500 -500h-100c0 222 -178 400 -400 400v100zM100 400c165 0 300 -135 300 -300h-100c0 111 -89 200 -200 200v100zM100 200c55 0 100 -45 100 -100s-45 -100 -100 -100
|
||||
s-100 45 -100 100s45 100 100 100z" />
|
||||
<glyph glyph-name="b9" unicode=""
|
||||
d="M300 800h400c55 0 100 -45 100 -100v-200h-400v150c0 28 -22 50 -50 50s-50 -22 -50 -50v-250h400v-300c0 -55 -45 -100 -100 -100h-500c-55 0 -100 45 -100 100v200h100v-150c0 -28 22 -50 50 -50s50 22 50 50v550c0 55 45 100 100 100z" />
|
||||
<glyph glyph-name="ba" unicode=""
|
||||
d="M75 700h225v-100h-200v-500h400v100h100v-125c0 -41 -34 -75 -75 -75h-450c-41 0 -75 34 -75 75v550c0 41 34 75 75 75zM600 700l200 -200l-200 -200v100h-200c-94 0 -173 -65 -194 -153c23 199 189 353 394 353v100z" />
|
||||
<glyph glyph-name="bb" unicode=""
|
||||
d="M500 700l300 -284l-300 -316v200h-100c-200 0 -348 -102 -400 -300c0 295 100 500 500 500v200z" />
|
||||
<glyph glyph-name="bc" unicode=""
|
||||
d="M381 791l19 9l19 -9c127 -53 253 -108 381 -160v-31c0 -166 -67 -313 -147 -419c-40 -53 -83 -97 -125 -128s-82 -53 -128 -53s-86 22 -128 53s-85 75 -125 128c-80 107 -147 253 -147 419v31c128 52 254 107 381 160zM400 100v591l-294 -122c8 -126 58 -243 122 -328
|
||||
c35 -46 73 -86 106 -110s62 -31 66 -31z" />
|
||||
<glyph glyph-name="bd" unicode=""
|
||||
d="M600 800h100v-800h-100v800zM400 700h100v-700h-100v700zM200 500h100v-500h-100v500zM0 300h100v-300h-100v300z" />
|
||||
<glyph glyph-name="be" unicode=""
|
||||
d="M300 800h100v-200h200l100 -100l-100 -100h-200v-400h-100v500h-200l-100 100l100 100h200v100z" />
|
||||
<glyph glyph-name="bf" unicode=""
|
||||
d="M200 800h100v-600h200l-250 -200l-250 200h200v600zM400 800h200v-100h-200v100zM400 600h300v-100h-300v100zM400 400h400v-100h-400v100z" />
|
||||
<glyph glyph-name="c0" unicode=""
|
||||
d="M200 800h100v-600h200l-250 -200l-250 200h200v600zM400 800h400v-100h-400v100zM400 600h300v-100h-300v100zM400 400h200v-100h-200v100z" />
|
||||
<glyph glyph-name="c1" unicode=""
|
||||
d="M75 700h650c41 0 75 -34 75 -75v-550c0 -41 -34 -75 -75 -75h-650c-41 0 -75 34 -75 75v550c0 41 34 75 75 75zM100 600v-100h100v100h-100zM300 600v-100h400v100h-400zM100 400v-100h100v100h-100zM300 400v-100h400v100h-400zM100 200v-100h100v100h-100zM300 200
|
||||
v-100h400v100h-400z" />
|
||||
<glyph glyph-name="c2" unicode=""
|
||||
d="M400 800l100 -300h300l-250 -200l100 -300l-250 200l-250 -200l100 300l-250 200h300z" />
|
||||
<glyph glyph-name="c3" unicode=""
|
||||
d="M400 800c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM150 700c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM650 700c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM400 600c110 0 200 -90 200 -200
|
||||
s-90 -200 -200 -200s-200 90 -200 200s90 200 200 200zM50 450c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM750 450c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM150 200c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50
|
||||
s22 50 50 50zM650 200c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM400 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
|
||||
<glyph glyph-name="c4" unicode=""
|
||||
d="M34 800h632c18 0 34 -16 34 -34v-732c0 -18 -16 -34 -34 -34h-632c-18 0 -34 16 -34 34v732c0 18 16 34 34 34zM100 700v-500h500v500h-500zM350 150c-38 0 -63 -42 -44 -75s69 -33 88 0s-6 75 -44 75z" />
|
||||
<glyph glyph-name="c5" unicode=""
|
||||
d="M0 800h300l500 -500l-300 -300l-500 500v300zM200 700c-55 0 -100 -45 -100 -100s45 -100 100 -100s100 45 100 100s-45 100 -100 100z" />
|
||||
<glyph glyph-name="c6" unicode=""
|
||||
d="M0 600h200l300 -300l-200 -200l-300 300v200zM340 600h160l300 -300l-200 -200l-78 78l119 122zM150 500c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
|
||||
<glyph glyph-name="c7" unicode=""
|
||||
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM400 600c110 0 200 -90 200 -200s-90 -200 -200 -200s-200 90 -200 200
|
||||
s90 200 200 200zM400 500c-56 0 -100 -44 -100 -100s44 -100 100 -100s100 44 100 100s-44 100 -100 100z" />
|
||||
<glyph glyph-name="c8" unicode=""
|
||||
d="M0 700h559l-100 -100h-359v-500h500v159l100 100v-359h-700v700zM700 700l100 -100l-400 -400l-200 200l100 100l100 -100z" />
|
||||
<glyph glyph-name="c9" unicode=""
|
||||
d="M9 800h782c6 0 9 -3 9 -9v-782c0 -6 -3 -9 -9 -9h-782c-6 0 -9 3 -9 9v782c0 6 3 9 9 9zM150 722l-72 -72l100 -100l-100 -100l72 -72l172 172zM400 500v-100h300v100h-300z" />
|
||||
<glyph glyph-name="ca" unicode=""
|
||||
d="M0 800h800v-200h-50c0 55 -45 100 -100 100h-150v-550c0 -28 22 -50 50 -50h50v-100h-400v100h50c28 0 50 22 50 50v550h-150c-55 0 -100 -45 -100 -100h-50v200z" />
|
||||
<glyph glyph-name="cb" unicode=""
|
||||
d="M0 700h100v-400h-100v400zM200 700h350c21 0 39 -13 47 -31c0 0 103 -291 103 -319s-22 -50 -50 -50h-150c-28 0 -50 -25 -50 -50s39 -158 47 -184s-5 -55 -31 -63s-52 5 -66 31s-109 219 -128 238s-44 28 -72 28v400z" />
|
||||
<glyph glyph-name="cc" unicode=""
|
||||
d="M400 666c10 19 28 32 47 34l19 -3c26 -8 39 -37 31 -63s-47 -159 -47 -184s22 -50 50 -50h150c28 0 50 -22 50 -50s-103 -319 -103 -319c-8 -18 -26 -31 -47 -31h-350v400c28 0 53 9 72 28s114 212 128 238zM0 400h100v-400h-100v400z" />
|
||||
<glyph glyph-name="cd" unicode=""
|
||||
d="M200 700h300v-100h-100v-6c25 -4 50 -8 72 -16l-34 -94c-28 11 -58 16 -88 16c-139 0 -250 -111 -250 -250s111 -250 250 -250s250 111 250 250c0 31 -5 60 -16 88l91 37c14 -38 25 -81 25 -125c0 -193 -157 -350 -350 -350s-350 157 -350 350c0 176 130 323 300 347v3
|
||||
h-100v100zM700 584c0 0 -296 -348 -316 -368s-48 -20 -68 0s-20 48 0 68s384 300 384 300z" />
|
||||
<glyph glyph-name="ce" unicode=""
|
||||
d="M600 700l200 -150l-200 -150v100h-600v100h600v100zM200 300v-100h600v-100h-600v-100l-200 150z" />
|
||||
<glyph glyph-name="cf" unicode=""
|
||||
d="M300 800h100c55 0 100 -45 100 -100h100c55 0 100 -45 100 -100h-700c0 55 45 100 100 100h100c0 55 45 100 100 100zM100 500h100v-350c0 -28 22 -50 50 -50s50 22 50 50v350h100v-350c0 -28 22 -50 50 -50s50 22 50 50v350h100v-481c0 -11 -8 -19 -19 -19h-462
|
||||
c-11 0 -19 8 -19 19v481z" />
|
||||
<glyph glyph-name="d0" unicode=""
|
||||
d="M100 800h200v-400c0 -55 45 -100 100 -100s100 45 100 100v400h100v-400c0 -110 -90 -200 -200 -200h-50c-138 0 -250 90 -250 200v400zM0 100h700v-100h-700v100z" />
|
||||
<glyph glyph-name="d1" unicode=""
|
||||
d="M9 700h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v482c0 6 3 9 9 9zM609 700h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v482c0 6 3 9 9 9zM309 500h182c6 0 9 -3 9 -9v-282c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v282
|
||||
c0 6 3 9 9 9zM0 100h800v-100h-800v100z" />
|
||||
<glyph glyph-name="d2" unicode=""
|
||||
d="M10 700h181c6 0 9 -3 9 -9v-191h-200v191c0 6 4 9 10 9zM610 700h181c6 0 9 -3 9 -9v-191h-200v191c0 6 5 9 10 9zM310 600h181c6 0 9 -3 9 -9v-91h-200v91c0 6 4 9 10 9zM0 400h800v-100h-800v100zM0 200h200v-191c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v191zM300 200
|
||||
h200v-91c0 -6 -3 -9 -9 -9h-181c-6 0 -10 3 -10 9v91zM600 200h200v-191c0 -6 -3 -9 -9 -9h-181c-6 0 -10 3 -10 9v191z" />
|
||||
<glyph glyph-name="d3" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM9 500h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v482c0 6 3 9 9 9zM309 500h182c6 0 9 -3 9 -9v-282c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v282c0 6 3 9 9 9zM609 500h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182
|
||||
c-6 0 -9 3 -9 9v482c0 6 3 9 9 9z" />
|
||||
<glyph glyph-name="d4" unicode=""
|
||||
d="M50 600h500c28 0 50 -22 50 -50v-150l100 100h100v-300h-100l-100 100v-150c0 -28 -22 -50 -50 -50h-500c-28 0 -50 22 -50 50v400c0 28 22 50 50 50z" />
|
||||
<glyph glyph-name="d5" unicode=""
|
||||
d="M334 800h66v-800h-66l-134 200h-200v400h200zM500 600v100c26 0 52 -4 75 -10c130 -33 225 -150 225 -290s-95 -258 -225 -291h-3c-23 -6 -47 -9 -72 -9v100c17 0 34 2 50 6c86 22 150 100 150 194s-64 172 -150 194c-16 4 -33 6 -50 6zM500 500l25 -3
|
||||
c44 -11 75 -51 75 -97s-32 -86 -75 -97l-25 -3v200z" />
|
||||
<glyph glyph-name="d6" unicode="" horiz-adv-x="600"
|
||||
d="M334 800h66v-800h-66l-134 200h-200v400h200zM500 500l25 -3c44 -11 75 -51 75 -97s-32 -86 -75 -97l-25 -3v200z" />
|
||||
<glyph glyph-name="d7" unicode="" horiz-adv-x="400"
|
||||
d="M334 800h66v-800h-66l-134 200h-200v400h200z" />
|
||||
<glyph glyph-name="d8" unicode=""
|
||||
d="M309 800h82c6 0 10 -4 12 -9l294 -682l3 -19v-81c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v81l3 19l294 682c2 5 6 9 12 9zM300 500v-200h100v200h-100zM300 200v-100h100v100h-100z" />
|
||||
<glyph glyph-name="d9" unicode=""
|
||||
d="M375 800c138 0 269 -39 378 -109l-53 -82c-93 60 -205 91 -325 91c-119 0 -229 -32 -322 -91l-53 82c109 70 237 109 375 109zM375 500c78 0 154 -23 216 -62l-53 -85c-46 30 -104 47 -163 47c-60 0 -112 -17 -159 -47l-54 85c62 40 134 62 213 62zM375 200
|
||||
c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100s45 100 100 100z" />
|
||||
<glyph glyph-name="da" unicode="" horiz-adv-x="900"
|
||||
d="M551 800c16 0 32 0 47 -3l-97 -97v-200h200l97 97c3 -15 3 -31 3 -47c0 -138 -112 -250 -250 -250c-32 0 -62 8 -90 19l-288 -291c-20 -20 -46 -28 -72 -28s-52 8 -72 28c-39 39 -39 105 0 144l291 287c-11 28 -19 59 -19 91c0 138 112 250 250 250zM101 150
|
||||
c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
|
||||
<glyph glyph-name="db" unicode=""
|
||||
d="M141 700c84 -84 169 -167 253 -250c82 83 167 165 247 250l143 -141l-253 -253c84 -82 167 -166 253 -247l-143 -143c-81 86 -165 169 -247 253l-253 -253l-141 143c85 80 167 164 250 247c-83 84 -166 169 -250 253z" />
|
||||
<glyph glyph-name="dc" unicode=""
|
||||
d="M0 800h100l231 -300h38l231 300h100l-225 -300h225v-100h-300v-100h300v-100h-300v-200h-100v200h-300v100h300v100h-300v100h225z" />
|
||||
<glyph glyph-name="dd" unicode="" horiz-adv-x="900"
|
||||
d="M350 800c193 0 350 -157 350 -350c0 -61 -17 -119 -44 -169c4 -2 10 -6 13 -9l103 -100c16 -16 30 -49 30 -72c0 -56 -46 -102 -102 -102c-23 0 -56 14 -72 30l-100 103c-3 3 -7 9 -9 13c-50 -28 -108 -44 -169 -44c-193 0 -350 157 -350 350s157 350 350 350zM350 700
|
||||
c-139 0 -250 -111 -250 -250s111 -250 250 -250c62 0 119 23 163 60c7 11 19 25 31 31l3 3c34 43 53 97 53 156c0 139 -111 250 -250 250zM300 600h100v-100h100v-100h-100v-100h-100v100h-100v100h100v100z" />
|
||||
<glyph glyph-name="de" unicode="" horiz-adv-x="900"
|
||||
d="M350 800c193 0 350 -157 350 -350c0 -61 -17 -119 -44 -169c4 -2 10 -6 13 -9l103 -100c16 -16 30 -49 30 -72c0 -56 -46 -102 -102 -102c-23 0 -56 14 -72 30l-100 103c-3 3 -7 9 -9 13c-50 -28 -108 -44 -169 -44c-193 0 -350 157 -350 350s157 350 350 350zM350 700
|
||||
c-139 0 -250 -111 -250 -250s111 -250 250 -250c62 0 119 23 163 60c7 11 19 25 31 31l3 3c34 43 53 97 53 156c0 139 -111 250 -250 250zM200 500h300v-100h-300v100z" />
|
||||
</font>
|
||||
</defs></svg>
|
After Width: | Height: | Size: 54 KiB |
BIN
BlazorApp1/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf
Normal file
BIN
BlazorApp1/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf
Normal file
Binary file not shown.
BIN
BlazorApp1/wwwroot/css/open-iconic/font/fonts/open-iconic.woff
Normal file
BIN
BlazorApp1/wwwroot/css/open-iconic/font/fonts/open-iconic.woff
Normal file
Binary file not shown.
BIN
BlazorApp1/wwwroot/favicon.png
Normal file
BIN
BlazorApp1/wwwroot/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
BlazorApp1/wwwroot/icon-192.png
Normal file
BIN
BlazorApp1/wwwroot/icon-192.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
32
BlazorApp1/wwwroot/index.html
Normal file
32
BlazorApp1/wwwroot/index.html
Normal file
@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<title>BlazorApp1</title>
|
||||
<base href="/" />
|
||||
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="css/app.css" rel="stylesheet" />
|
||||
<link rel="icon" type="image/png" href="favicon.png" />
|
||||
<link href="BlazorApp1.styles.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app">
|
||||
<svg class="loading-progress">
|
||||
<circle r="40%" cx="50%" cy="50%" />
|
||||
<circle r="40%" cx="50%" cy="50%" />
|
||||
</svg>
|
||||
<div class="loading-progress-text"></div>
|
||||
</div>
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
An unhandled error has occurred.
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
<script src="_framework/blazor.webassembly.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
27
BlazorApp1/wwwroot/sample-data/weather.json
Normal file
27
BlazorApp1/wwwroot/sample-data/weather.json
Normal file
@ -0,0 +1,27 @@
|
||||
[
|
||||
{
|
||||
"date": "2022-01-06",
|
||||
"temperatureC": 1,
|
||||
"summary": "Freezing"
|
||||
},
|
||||
{
|
||||
"date": "2022-01-07",
|
||||
"temperatureC": 14,
|
||||
"summary": "Bracing"
|
||||
},
|
||||
{
|
||||
"date": "2022-01-08",
|
||||
"temperatureC": -13,
|
||||
"summary": "Freezing"
|
||||
},
|
||||
{
|
||||
"date": "2022-01-09",
|
||||
"temperatureC": -16,
|
||||
"summary": "Balmy"
|
||||
},
|
||||
{
|
||||
"date": "2022-01-10",
|
||||
"temperatureC": -2,
|
||||
"summary": "Chilly"
|
||||
}
|
||||
]
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
|
||||
</startup>
|
||||
<appSettings>
|
||||
<add key="DbConntionString" value="Data Source=192.168.25.215\IRONINTEL;Initial Catalog=IRONINTEL_IRONDEV;Integrated Security=false;User ID=fi;Password=database"/>
|
||||
@ -11,4 +11,32 @@
|
||||
<add key="AppVersion" value="1.16.12.15"/>
|
||||
<add key="LastUpdateTime" value="10/17/2016 10:36:26.229"/>
|
||||
</appSettings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Data.SqlClient" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.6.1.1" newVersion="4.6.1.1"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
@ -9,9 +9,24 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ConsoleApplication1</RootNamespace>
|
||||
<AssemblyName>ConsoleApplication1</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@ -34,21 +49,24 @@
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FICBLC">
|
||||
<HintPath>..\Reflib\FIC\FICBLC.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FICIntf">
|
||||
<HintPath>..\Reflib\FIC\FICIntf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FICIntfAdv">
|
||||
<HintPath>..\Reflib\FIC\FICIntfAdv.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FICModels">
|
||||
<HintPath>..\Reflib\FIC\FICModels.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FICore">
|
||||
<HintPath>..\Reflib\FICore.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FIWinLib">
|
||||
<HintPath>..\Reflib\FIWinLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ForesightServicesClient">
|
||||
<HintPath>..\Reflib\ForesightServicesClient.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="iisitebase">
|
||||
<HintPath>..\Reflib\iisitebase.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="iisyslib">
|
||||
<HintPath>..\Reflib\iisyslib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\Reflib\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
@ -63,7 +81,6 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="IronIntelDebugHost.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
@ -80,6 +97,18 @@
|
||||
<Name>IronIntelContractorSiteLib</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 和 x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
@ -5,57 +5,9 @@ using System.Configuration;
|
||||
using System.Net.Mail;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using IronIntel.DataModel;
|
||||
using IronIntel.DataModel.Admin.Customers;
|
||||
using IronIntel.DataModel.Admin.Users;
|
||||
using Foresight.Services.Log;
|
||||
|
||||
namespace ConsoleApplication1
|
||||
{
|
||||
class IronIntelDebugHost : IIronIntelHost
|
||||
{
|
||||
public CustomerInfo GetCustomerInfo(string custid)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public CustomerManager GetCustomerManager()
|
||||
{
|
||||
return new CustomerManager(ConfigurationManager.AppSettings["MasterDb"]);
|
||||
}
|
||||
|
||||
public string GetIronIntelDbConnectionString(string custid)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public LoginManager GetLoginManager()
|
||||
{
|
||||
return new LoginManager(ConfigurationManager.AppSettings["MasterDb"]);
|
||||
}
|
||||
|
||||
public int SendEmail(string customerid, MailMessage msg)
|
||||
{
|
||||
var mail = new Foresight.Services.Mail.MailSender(@"net.tcp://192.168.25.210:20100/fisvcs/systemsvc");
|
||||
mail.AppName = "fleet_dev";
|
||||
return (int)mail.SendMail("fleet_dev", customerid, "", msg);
|
||||
}
|
||||
|
||||
public void WriteLog(string logtype, string source, string message, string detail, string extmsg)
|
||||
{
|
||||
LogWriter log = new LogWriter(@"net.tcp://192.168.25.210:20100/fisvcs/systemsvc");
|
||||
log.WriteLog("fleet_dev", "Foresight", "hq-pc", "SystemService", logtype, source, message, detail, extmsg);
|
||||
}
|
||||
|
||||
public void WriteLog(string customerid, string logtype, string source, string message, string detail, string extmsg)
|
||||
{
|
||||
LogWriter log = new LogWriter(@"net.tcp://192.168.25.210:20100/fisvcs/systemsvc");
|
||||
log.WriteLog("fleet_dev", customerid, "hq-pc", "SystemService", logtype, source, message, detail, extmsg);
|
||||
}
|
||||
|
||||
long IIronIntelHost.SendEmail(string customerid, MailMessage msg)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,14 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using IronIntel.Contractor.MapView;
|
||||
using IronIntel.Contractor.Users;
|
||||
using IronIntel.Contractor.Machines;
|
||||
using IronIntel.Contractor;
|
||||
using IronIntel.DataModel;
|
||||
using IronIntel.DataModel.Admin.Customers;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace ConsoleApplication1
|
||||
{
|
||||
@ -16,42 +10,112 @@ namespace ConsoleApplication1
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// IronIntelHostEnvironment.InitHost(new IronIntelDebugHost());
|
||||
//string fn = "IronIntel.Contractor.FICExtDataTable.AssetTripsDataTable,iicontractorbl";
|
||||
|
||||
// Test1();
|
||||
//Type intftype = typeof(IExtDataTable);
|
||||
//Type tp = Type.GetType(fn);
|
||||
//if (!tp.IsAbstract && tp.IsClass &&tp.IsPublic&& tp.GetInterface(intftype.FullName) != null)
|
||||
//{
|
||||
|
||||
Guid gd = new Guid("10000000-0000-0000-0000-100000000001");
|
||||
//}
|
||||
|
||||
ContractorHost.Init();
|
||||
|
||||
testdemo();
|
||||
Console.ReadLine();
|
||||
//IExtDataTable ext = Activator.CreateInstance(tp) as IExtDataTable;
|
||||
|
||||
//Console.WriteLine(ext.ID);
|
||||
|
||||
//Guid gd = new Guid("10000000-0000-0000-0000-100000000001");
|
||||
|
||||
//for (var a = 9; a >= 0; a--)
|
||||
//{
|
||||
// for (var b = 9; b >= 0; b--)
|
||||
// {
|
||||
// for (var c = 9; c >= 0; c--)
|
||||
// {
|
||||
// if ((2000 + a * 100 + b * 10 + c) % 13 == 0)
|
||||
// {
|
||||
// Console.WriteLine($"number is 2{a}{b}{c}");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//const string file = @"C:\Users\cl\Desktop\languages.csv";
|
||||
//var lines = File.ReadAllLines(file);
|
||||
//var xml = new XDocument();
|
||||
//var root = new XElement("Category");
|
||||
//root.Add(new XAttribute("desc", "Communication"));
|
||||
//xml.Add(root);
|
||||
//foreach (var line in lines)
|
||||
//{
|
||||
// var index = line.IndexOf(',');
|
||||
// var key = line.Substring(0, index);
|
||||
// var value = line.Substring(index + 1).Replace("\\n", "\n");
|
||||
// var xe = new XElement(key);
|
||||
// xe.Add(new XElement("en", value));
|
||||
// xe.Add(new XElement("fr", string.Empty));
|
||||
// xe.Add(new XElement("zh", string.Empty));
|
||||
// root.Add(xe);
|
||||
//}
|
||||
//Console.WriteLine(xml.ToString());
|
||||
|
||||
//var random = new Random();
|
||||
//var data = new byte[12];
|
||||
//for (var i = 0; i < 20; i++)
|
||||
//{
|
||||
// for (var j = 0; j < 12; j++)
|
||||
// {
|
||||
// data[j] = (byte)random.Next('0', '9');
|
||||
// }
|
||||
// Console.WriteLine(Convert.ToBase64String(data));
|
||||
//}
|
||||
|
||||
//var path = @"D:\IronIntel\Mobile\FleetViewMobile\FleetViewClientLib\FleetResources\TextResource.xml";
|
||||
//var pt = @"C:\Users\cl\Desktop\pt_langs.txt";
|
||||
//var dict = new Dictionary<string, string>();
|
||||
//foreach (var l in File.ReadAllLines(pt))
|
||||
//{
|
||||
// var arr = l.Split('\t');
|
||||
// if (dict.TryGetValue(arr[0], out var val))
|
||||
// {
|
||||
// Console.WriteLine($"duplicated item: {arr[0]}({val}), new value: {arr[1]}");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// dict.Add(arr[0], arr[1]);
|
||||
// }
|
||||
//}
|
||||
//var ofile = @"C:\Users\cl\Downloads\TextResource.xml";
|
||||
//var doc = XDocument.Load(path);
|
||||
//var newDoc = new XDocument();
|
||||
//var newRoot = new XElement("root");
|
||||
//newDoc.Add(newRoot);
|
||||
//foreach (var node in doc.Root.Elements())
|
||||
//{
|
||||
// var key = node.Name.LocalName;
|
||||
// if (dict.TryGetValue(key, out string ptl))
|
||||
// {
|
||||
// node.Add(new XElement("pt", ptl));
|
||||
// var ele = newRoot.Element(key);
|
||||
// if (ele == null)
|
||||
// {
|
||||
// newRoot.Add(node);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Console.WriteLine($"duplicate child node: {ele}, new node: {node}");
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Console.WriteLine($"cannot find language id: {key}");
|
||||
// }
|
||||
//}
|
||||
//newDoc.Save(ofile);
|
||||
|
||||
Console.Write("done.");
|
||||
Console.ReadKey(true);
|
||||
}
|
||||
|
||||
private static void Test1()
|
||||
{
|
||||
var cm = IronIntelHostEnvironment.GetCustomerManager();
|
||||
var db= cm.GetCustomerDatabaseInfo("Foresight", "IRONINTEL_ADMINDB");
|
||||
Console.WriteLine(db.ToString());
|
||||
//var loc = cm.GetLocationManager("IRONDEV");
|
||||
|
||||
//var locs = loc.GetCustomerLocations();
|
||||
//Console.WriteLine(locs.ToString());
|
||||
}
|
||||
|
||||
private static void testlogin()
|
||||
{
|
||||
var lm = IronIntelHostEnvironment.GetLoginManager();
|
||||
|
||||
lm.DeleteUser("6D3A02C7-FC25-47C0-A7A4-97D470EA4CC5", true);
|
||||
|
||||
// Console.WriteLine(r.ToString());
|
||||
}
|
||||
|
||||
private static void testdemo()
|
||||
{
|
||||
var usermanager = ContractorHost.Instance.GetContractorManager<IronIntel.DataModel.Contractor.Users.UserManager>();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
Contractor.7z
Normal file
BIN
Contractor.7z
Normal file
Binary file not shown.
106
Contractor.sln
106
Contractor.sln
@ -1,11 +1,12 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.2003
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.1.32421.90
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Site", "Site\", "{C2BC3E5B-B059-4B6C-8563-07FEAE54AF6B}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.7.2"
|
||||
ProjectReferences = "{9d398985-9424-4fc7-a637-6b5b204d8f7c}|iicontractorsitelib.dll;{515fb61f-f032-4a48-8f32-93b59b9d37f8}|iicontractorbl.dll;{39E2A8C6-F58F-4839-B7C1-82D44153FC3A}|FICBLC.dll;{DDDA41C4-099D-4614-8925-B11F70459886}|EqpQueryIntfLibForPC.dll;{E4DB03B6-8D79-4B54-BBAE-3F916FED4398}|FICExport.dll;{4963DEB2-F0E3-44A3-B5E1-E13E191A8DE8}|FICIntf.dll;{3FFA4093-4325-4FBB-A874-F288BFDCF7BA}|FICIntfAdv.dll;{F47EBF77-EED3-44E2-9983-EF556372A648}|FICModels.dll;{A2948428-15E6-4BBC-B46D-3EFDA3D5F34C}|FRPTExtIntf.dll;{c181bd0e-4b98-4adc-ba92-bb389550d1f6}|FIChartLib.dll;{b0110465-8537-4fe7-bee6-b10faa0ba92d}|FleetClientBase.dll;{a872b915-d7f0-4e7f-81e7-742dbb4dbbba}|FleetServiceClient.dll;"
|
||||
Debug.AspNetCompiler.VirtualPath = "/localhost_5246"
|
||||
Debug.AspNetCompiler.PhysicalPath = "Site\"
|
||||
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_5246\"
|
||||
@ -34,6 +35,38 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication1", "Cons
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronIntelSiteServiceHost", "IronIntelSiteServiceHost\IronIntelSiteServiceHost.csproj", "{B5E29343-DF46-47DE-A8E8-69BCF58C0697}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LanguageExtractTool", "LanguageExtractTool\LanguageExtractTool.csproj", "{BE465497-20E8-4C29-B98F-3AF19996F1CB}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FIC", "FIC", "{A29EDD95-7564-4A09-AD02-4FF284082DA9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FICBLC", "..\..\..\FI\FICG5\Core\Service\FICBLC\FICBLC.csproj", "{39E2A8C6-F58F-4839-B7C1-82D44153FC3A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EqpQueryIntfLibForPC", "..\..\..\Projects\Apps\EquipQueryApp\Interface\EqpQueryIntfLibForPC\EqpQueryIntfLibForPC.csproj", "{DDDA41C4-099D-4614-8925-B11F70459886}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FRPTExtIntf", "..\..\..\FI\FICG5\Core\Service\ExtAppIntf\FRPTExtIntf.csproj", "{A2948428-15E6-4BBC-B46D-3EFDA3D5F34C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FICIntf", "..\..\..\FI\FICG5\Core\Service\FICIntf\FICIntf\FICIntf.csproj", "{4963DEB2-F0E3-44A3-B5E1-E13E191A8DE8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FICIntfAdv", "..\..\..\FI\FICG5\Core\Service\FICIntf\FICIntfAdv\FICIntfAdv.csproj", "{3FFA4093-4325-4FBB-A874-F288BFDCF7BA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FICModels", "..\..\..\FI\FICG5\Core\Service\FICModels\FICModels.csproj", "{F47EBF77-EED3-44E2-9983-EF556372A648}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FICExport", "..\..\..\FI\FICG5\Core\Service\FICExport\FICExport.csproj", "{E4DB03B6-8D79-4B54-BBAE-3F916FED4398}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FICEmailSubscribe", "..\..\..\FI\FICG5\Core\Service\FICEmailSubscribe\FICEmailSubscribe.csproj", "{8650F244-1D1A-4627-8B15-8FFA4B34932F}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DataModel", "DataModel", "{B7B7275E-2530-4E8D-9AE3-C49B4BADCF67}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FleetClientBase", "..\..\..\ForesightServices\Service\DataModel\FleetClientBase\FleetClientBase.csproj", "{B0110465-8537-4FE7-BEE6-B10FAA0BA92D}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FleetServiceClient", "..\..\..\ForesightServices\Service\DataModel\FleetServiceClient\FleetServiceClient.csproj", "{A872B915-D7F0-4E7F-81E7-742DBB4DBBBA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FIChartLib", "..\..\..\FI\FICore\FIChartLib\FIChartLib.csproj", "{E5090CF1-A38C-42A3-8F55-636FE6A84C75}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorApp1", "BlazorApp1\BlazorApp1.csproj", "{96100C88-5479-465C-BB57-AFB1F8ED8BFD}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp1", "C:\Users\cl\source\repos\ConsoleApp1\ConsoleApp1.csproj", "{38577D80-8721-4532-9B9B-98B2106F350E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -60,10 +93,79 @@ Global
|
||||
{B5E29343-DF46-47DE-A8E8-69BCF58C0697}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B5E29343-DF46-47DE-A8E8-69BCF58C0697}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B5E29343-DF46-47DE-A8E8-69BCF58C0697}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BE465497-20E8-4C29-B98F-3AF19996F1CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BE465497-20E8-4C29-B98F-3AF19996F1CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BE465497-20E8-4C29-B98F-3AF19996F1CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BE465497-20E8-4C29-B98F-3AF19996F1CB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{39E2A8C6-F58F-4839-B7C1-82D44153FC3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{39E2A8C6-F58F-4839-B7C1-82D44153FC3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{39E2A8C6-F58F-4839-B7C1-82D44153FC3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{39E2A8C6-F58F-4839-B7C1-82D44153FC3A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DDDA41C4-099D-4614-8925-B11F70459886}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DDDA41C4-099D-4614-8925-B11F70459886}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DDDA41C4-099D-4614-8925-B11F70459886}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DDDA41C4-099D-4614-8925-B11F70459886}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A2948428-15E6-4BBC-B46D-3EFDA3D5F34C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A2948428-15E6-4BBC-B46D-3EFDA3D5F34C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A2948428-15E6-4BBC-B46D-3EFDA3D5F34C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A2948428-15E6-4BBC-B46D-3EFDA3D5F34C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4963DEB2-F0E3-44A3-B5E1-E13E191A8DE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4963DEB2-F0E3-44A3-B5E1-E13E191A8DE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4963DEB2-F0E3-44A3-B5E1-E13E191A8DE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4963DEB2-F0E3-44A3-B5E1-E13E191A8DE8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3FFA4093-4325-4FBB-A874-F288BFDCF7BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3FFA4093-4325-4FBB-A874-F288BFDCF7BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3FFA4093-4325-4FBB-A874-F288BFDCF7BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3FFA4093-4325-4FBB-A874-F288BFDCF7BA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F47EBF77-EED3-44E2-9983-EF556372A648}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F47EBF77-EED3-44E2-9983-EF556372A648}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F47EBF77-EED3-44E2-9983-EF556372A648}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F47EBF77-EED3-44E2-9983-EF556372A648}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E4DB03B6-8D79-4B54-BBAE-3F916FED4398}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E4DB03B6-8D79-4B54-BBAE-3F916FED4398}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E4DB03B6-8D79-4B54-BBAE-3F916FED4398}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E4DB03B6-8D79-4B54-BBAE-3F916FED4398}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8650F244-1D1A-4627-8B15-8FFA4B34932F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8650F244-1D1A-4627-8B15-8FFA4B34932F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8650F244-1D1A-4627-8B15-8FFA4B34932F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8650F244-1D1A-4627-8B15-8FFA4B34932F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B0110465-8537-4FE7-BEE6-B10FAA0BA92D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B0110465-8537-4FE7-BEE6-B10FAA0BA92D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B0110465-8537-4FE7-BEE6-B10FAA0BA92D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B0110465-8537-4FE7-BEE6-B10FAA0BA92D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A872B915-D7F0-4E7F-81E7-742DBB4DBBBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A872B915-D7F0-4E7F-81E7-742DBB4DBBBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A872B915-D7F0-4E7F-81E7-742DBB4DBBBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A872B915-D7F0-4E7F-81E7-742DBB4DBBBA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E5090CF1-A38C-42A3-8F55-636FE6A84C75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E5090CF1-A38C-42A3-8F55-636FE6A84C75}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E5090CF1-A38C-42A3-8F55-636FE6A84C75}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E5090CF1-A38C-42A3-8F55-636FE6A84C75}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{96100C88-5479-465C-BB57-AFB1F8ED8BFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{96100C88-5479-465C-BB57-AFB1F8ED8BFD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{96100C88-5479-465C-BB57-AFB1F8ED8BFD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{96100C88-5479-465C-BB57-AFB1F8ED8BFD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{38577D80-8721-4532-9B9B-98B2106F350E}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{38577D80-8721-4532-9B9B-98B2106F350E}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||
{38577D80-8721-4532-9B9B-98B2106F350E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{38577D80-8721-4532-9B9B-98B2106F350E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{39E2A8C6-F58F-4839-B7C1-82D44153FC3A} = {A29EDD95-7564-4A09-AD02-4FF284082DA9}
|
||||
{DDDA41C4-099D-4614-8925-B11F70459886} = {A29EDD95-7564-4A09-AD02-4FF284082DA9}
|
||||
{A2948428-15E6-4BBC-B46D-3EFDA3D5F34C} = {A29EDD95-7564-4A09-AD02-4FF284082DA9}
|
||||
{4963DEB2-F0E3-44A3-B5E1-E13E191A8DE8} = {A29EDD95-7564-4A09-AD02-4FF284082DA9}
|
||||
{3FFA4093-4325-4FBB-A874-F288BFDCF7BA} = {A29EDD95-7564-4A09-AD02-4FF284082DA9}
|
||||
{F47EBF77-EED3-44E2-9983-EF556372A648} = {A29EDD95-7564-4A09-AD02-4FF284082DA9}
|
||||
{E4DB03B6-8D79-4B54-BBAE-3F916FED4398} = {A29EDD95-7564-4A09-AD02-4FF284082DA9}
|
||||
{8650F244-1D1A-4627-8B15-8FFA4B34932F} = {A29EDD95-7564-4A09-AD02-4FF284082DA9}
|
||||
{B0110465-8537-4FE7-BEE6-B10FAA0BA92D} = {B7B7275E-2530-4E8D-9AE3-C49B4BADCF67}
|
||||
{A872B915-D7F0-4E7F-81E7-742DBB4DBBBA} = {B7B7275E-2530-4E8D-9AE3-C49B4BADCF67}
|
||||
{E5090CF1-A38C-42A3-8F55-636FE6A84C75} = {A29EDD95-7564-4A09-AD02-4FF284082DA9}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {BAE453CC-00EC-4D9C-902A-AF8F249C8653}
|
||||
EndGlobalSection
|
||||
|
@ -6,7 +6,7 @@
|
||||
<add key="ClientSettingsProvider.ServiceUri" value=""/>
|
||||
</appSettings>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||
</startup>
|
||||
<system.web>
|
||||
<membership defaultProvider="ClientAuthenticationMembershipProvider">
|
||||
@ -20,4 +20,28 @@
|
||||
</providers>
|
||||
</roleManager>
|
||||
</system.web>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Data.SqlClient" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.6.1.1" newVersion="4.6.1.1"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IronIntel.Contractor.Attachment
|
||||
{
|
||||
public class AttachmentItem
|
||||
{
|
||||
public long ID { get; set; }
|
||||
public string StringID { get; set; }//为了兼容旧数据库中的ATTACHES.ATTACHID字段,旧数据库中的表由Workorder和MaintanceLog在使用
|
||||
public string FileName { get; set; }
|
||||
public string Source { get; set; }
|
||||
public string SourceID { get; set; }
|
||||
public string AddedByUserIID { get; set; }
|
||||
public string AddedByUserName { get; set; }
|
||||
public string Notes { get; set; }
|
||||
public DateTime AddedOn { get; set; }
|
||||
public string AddedOnStr { get { return AddedOn.ToString(); } }
|
||||
public byte[] FileData { get; set; }
|
||||
}
|
||||
}
|
@ -8,8 +8,7 @@ using Foresight.ServiceModel;
|
||||
using Newtonsoft.Json;
|
||||
using Foresight.Data;
|
||||
using IronIntel.Contractor.Users;
|
||||
using IronIntel.Contractor.Attachment;
|
||||
using Foresight.Fleet.Services.Attachment;
|
||||
using Foresight.Fleet.Services;
|
||||
|
||||
namespace IronIntel.Contractor
|
||||
{
|
||||
@ -152,24 +151,12 @@ namespace IronIntel.Contractor
|
||||
db.ExecSQL(sql);
|
||||
}
|
||||
|
||||
public static AttachmentItem GetAttachment(string sessionid, string custid, long attid)
|
||||
public static Tuple<string, byte[]> GetAttachment(string sessionid, string custid, long attid)
|
||||
{
|
||||
if (string.IsNullOrEmpty(custid))
|
||||
custid = SystemParams.CompanyID;
|
||||
Foresight.Fleet.Services.Attachment.AttachmentInfo att = FleetServiceClientHelper.CreateClient<AttachmentClient>(custid, sessionid).GetAttachment(custid, attid);
|
||||
AttachmentItem item = new AttachmentItem();
|
||||
Helper.CloneProperty(item, att);
|
||||
return item;
|
||||
}
|
||||
|
||||
public static AttachmentItem GetAttachmentLegacy(string sessionid, string custid, string attid)
|
||||
{
|
||||
if (string.IsNullOrEmpty(custid))
|
||||
custid = SystemParams.CompanyID;
|
||||
Foresight.Fleet.Services.Attachment.AttachmentInfo att = FleetServiceClientHelper.CreateClient<AttachmentClient>(custid, sessionid).GetAttachmentLegacy(custid, attid);
|
||||
AttachmentItem item = new AttachmentItem();
|
||||
Helper.CloneProperty(item, att);
|
||||
return item;
|
||||
Tuple<string, byte[]> attr = FleetServiceClientHelper.CreateClient<AttachmentProvider>(custid, sessionid).GetAttachmentData(custid, attid);
|
||||
return attr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,159 +3,91 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Foresight.Cache;
|
||||
using Foresight.Cache.AspNet;
|
||||
using Foresight.Cache.Redis;
|
||||
using Foresight.Fleet.Services.SystemOption;
|
||||
using Foresight.Fleet.Services;
|
||||
using Foresight.Fleet.Services.Customer;
|
||||
|
||||
namespace IronIntel.Contractor
|
||||
{
|
||||
public static class CacheManager
|
||||
{
|
||||
public static void Dispose()
|
||||
private static string CacheRegion
|
||||
{
|
||||
if (_Client != null)
|
||||
{
|
||||
_Client.Dispose();
|
||||
_Client = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static CacheClient _Client = null;
|
||||
private static object _sycobj = new object();
|
||||
|
||||
private static FIRedisCacheClient CreateRedisClient()
|
||||
{
|
||||
string[] servers = FleetServiceClientHelper.CreateClient<Foresight.Fleet.Services.SystemUtil>().GetRedisServers();
|
||||
if ((servers == null) || (servers.Length == 0))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<RedisNode> ls = new List<RedisNode>();
|
||||
foreach (string srv in servers)
|
||||
{
|
||||
try
|
||||
{
|
||||
RedisNode node = CreateRedisNode(srv);
|
||||
ls.Add(node);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemParams.WriteLog("Error", typeof(CacheManager).FullName + ".CreateRedisClient", "Create RedisNode failed: " + srv, ex.ToString());
|
||||
}
|
||||
}
|
||||
if (ls.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new FIRedisCacheClient("IRONINTEL_" + SystemParams.CompanyID.ToUpper(), ls);
|
||||
}
|
||||
}
|
||||
|
||||
private static RedisNode CreateRedisNode(string server)
|
||||
{
|
||||
string[] address = server.Split(new char[] { ':' });
|
||||
int port = -1;
|
||||
if (!int.TryParse(address[1], out port))
|
||||
{
|
||||
port = -1;
|
||||
}
|
||||
int weight = 100;
|
||||
if (!int.TryParse(address[2], out weight))
|
||||
{
|
||||
weight = 100;
|
||||
}
|
||||
RedisNode node = new RedisNode(address[0], port, weight);
|
||||
return node;
|
||||
}
|
||||
|
||||
private static void InitCacheClient()
|
||||
{
|
||||
FIRedisCacheClient fc = null;
|
||||
try
|
||||
{
|
||||
fc = CreateRedisClient();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemParams.WriteLog("Error", typeof(CacheManager).FullName + ".InitCacheClient", "Create Redis client failed", ex.ToString());
|
||||
}
|
||||
if (fc != null)
|
||||
{
|
||||
_Client = fc;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
_Client = new AspNetCacheManager("IRONINTEL_" + SystemParams.CompanyID.ToUpper());
|
||||
}
|
||||
}
|
||||
|
||||
private static CacheClient Client
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Client == null)
|
||||
{
|
||||
lock (_sycobj)
|
||||
{
|
||||
if (_Client == null)
|
||||
{
|
||||
InitCacheClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
return _Client;
|
||||
}
|
||||
get { return "FLEET_" + SystemParams.CompanyID.ToUpper(); }
|
||||
}
|
||||
|
||||
public static void Remove(string key)
|
||||
{
|
||||
if (Client != null)
|
||||
var client = FleetServiceClientHelper.CreateClient<SystemUtil>();
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
Client.Remove(key);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
client.RemoveCache(CacheRegion, key);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
public static void SetValue(string key, byte[] buffer, TimeSpan expire)
|
||||
{
|
||||
if (buffer == null)
|
||||
var client = FleetServiceClientHelper.CreateClient<SystemUtil>();
|
||||
try
|
||||
{
|
||||
Remove(key);
|
||||
}
|
||||
else if (Client != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
Client.SetValue(key, buffer, expire);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
client.SetCache(CacheRegion, key, buffer, (int)expire.TotalSeconds);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
public static byte[] GetValue(string key)
|
||||
{
|
||||
if (Client != null)
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
return Client.GetValue(key);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var client = FleetServiceClientHelper.CreateClient<SystemUtil>();
|
||||
return client.GetCache(CacheRegion, key);
|
||||
}
|
||||
else
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void RemoveCustomerCache(string key)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<CustomerProvider>();
|
||||
try
|
||||
{
|
||||
client.RemoveCustomerCacheData(SystemParams.CompanyID, key);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
public static void SetCustomerCacheData(string key, byte[] buffer, TimeSpan expire)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<CustomerProvider>();
|
||||
try
|
||||
{
|
||||
client.SetCustomerCacheData(SystemParams.CompanyID, key, buffer);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
public static byte[] GetCustomerCacheData(string key)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<CustomerProvider>();
|
||||
return client.GetCustomerCacheData(SystemParams.CompanyID, key);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
using Foresight.Data;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using Foresight.ServiceModel;
|
||||
using IronIntel.Contractor.Machines;
|
||||
using IronIntel.Contractor.Maintenance;
|
||||
using IronIntel.Contractor.MapView;
|
||||
using IronIntel.Contractor.Users;
|
||||
using IronIntel.Services.Business.Admin;
|
||||
using IronIntel.Services.Customers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@ -84,9 +83,9 @@ namespace IronIntel.Contractor.Contact
|
||||
return new MaintenanceMachineInfo[0];
|
||||
}
|
||||
MachineManagement.RefreshBaseData();
|
||||
MachineMake[] makes = MachineManagement.GetMachineMakes();
|
||||
MachineModel[] models = MachineManagement.GetMachineModels();
|
||||
MachineType[] types = MachineManagement.GetMachineTypes();
|
||||
AssetMake[] makes = MachineManagement.GetMachineMakes();
|
||||
AssetModel[] models = MachineManagement.GetMachineModels();
|
||||
AssetType[] types = MachineManagement.GetMachineTypes();
|
||||
List<MaintenanceMachineInfo> ls = new List<MaintenanceMachineInfo>();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
@ -113,23 +112,6 @@ namespace IronIntel.Contractor.Contact
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveMachineContacts(FISqlConnection db, string machineid, string contractorid, string[] contactids)
|
||||
{
|
||||
const string SQL_R = "update RELATIONSHIP set REMOVEDON=GETUTCDATE(),REMOVED=1 where RELATIONSHIPTYPEID='MachineContact' and REMOVED<>1 and RELATEDID={0}";
|
||||
const string SQL = @"if exists(select 1 from RELATIONSHIP where RELATIONSHIPTYPEID='MachineContact' and RELATEDID={0} and PRIMARYID={1}) update RELATIONSHIP
|
||||
set REMOVEDON=null,REMOVED=0 where RELATIONSHIPTYPEID='MachineContact' and RELATEDID={0} and PRIMARYID={1} else insert into RELATIONSHIP
|
||||
(RELATIONSHIPID,RELATIONSHIPTYPEID,CONTRACTORID,RELATEDID,PRIMARYID,ADDEDON) values({3},'MachineContact',{2},{0},{1},GETUTCDATE())";
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
db.ExecSQL(SQL_R, machineid);
|
||||
|
||||
foreach (var cid in contactids)
|
||||
{
|
||||
db.ExecSQL(SQL, machineid, cid, contractorid, Guid.NewGuid().ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static ContactInfo ConvertToContactInfo(DataRow dr)
|
||||
{
|
||||
ContactInfo ci = new ContactInfo();
|
||||
@ -143,8 +125,6 @@ namespace IronIntel.Contractor.Contact
|
||||
return ci;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static JobSiteViewItem[] GetContactJobsitesByID(string contactid)
|
||||
{
|
||||
const string SQL = @"select a.RELATEDID as JOBSITEID,JOBSITENAME,LATITUDE,LONGITUDE,RADIUS,RADUIS_UOM,b.CONTRACTORID,COLOR,NOTES,STARTDATE,ENDDATE,POLYGON,BASEONMACHINEID from RELATIONSHIP a,JOBSITES b
|
||||
@ -211,82 +191,5 @@ namespace IronIntel.Contractor.Contact
|
||||
js.BaseOnMachineID = FIDbAccess.GetFieldInt(dr["BASEONMACHINEID"], 0);
|
||||
return js;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取机器Contact和机器的对应关系
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Dictionary<int, List<string>> GetContactMachines(FISqlConnection db)
|
||||
{
|
||||
const string SQL_C = "select PRIMARYID,RELATEDID from RELATIONSHIP where RELATIONSHIPTYPEID='MachineContact' and REMOVED<>1";
|
||||
|
||||
Dictionary<int, List<string>> result = new Dictionary<int, List<string>>();
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
DataTable tb = db.GetDataTableBySQL(SQL_C);
|
||||
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
int machineid = FIDbAccess.GetFieldInt(dr["RELATEDID"], 0);
|
||||
string contactid = FIDbAccess.GetFieldString(dr["PRIMARYID"], "");
|
||||
if (!result.ContainsKey(machineid))
|
||||
result[machineid] = new List<string>();
|
||||
result[machineid].Add(contactid);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取机器对应的ContactID
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string[] GetContactByMachineID(FISqlConnection db, long machineid)
|
||||
{
|
||||
const string SQL_C = "select PRIMARYID from RELATIONSHIP where RELATIONSHIPTYPEID='MachineContact' and REMOVED<>1 and RELATEDID={0}";
|
||||
|
||||
Dictionary<int, List<string>> result = new Dictionary<int, List<string>>();
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
DataTable tb = db.GetDataTableBySQL(SQL_C, machineid);
|
||||
if (tb.Rows.Count <= 0)
|
||||
return new string[0];
|
||||
|
||||
List<string> list = new List<string>();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
string contactid = FIDbAccess.GetFieldString(dr["PRIMARYID"], "");
|
||||
list.Add(contactid);
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
|
||||
public static ContactInfo[] GetContactByAssetID(long assetid, string companyid)
|
||||
{
|
||||
const string SQL = @"select CONTACTID,CONTACTNAME,USERIID,NOTES,CONTACTTYPE,EMAILADDRESS,TEXTADDRESS from CONTACT where
|
||||
CONTACTID in(select PRIMARYID from RELATIONSHIP where RELATIONSHIPTYPEID='MachineContact' and REMOVED<>1 and RELATEDID={0} union all
|
||||
select rs.PRIMARYID from RELATIONSHIP rs left join JOBSITEMACHINES jm on rs.RELATEDID=jm.JOBSITEID where rs.RELATIONSHIPTYPEID='ContactJobsite' and rs.REMOVED<>1 and jm.MACHINEID={0})";
|
||||
|
||||
FISqlConnection db = null;
|
||||
if (string.IsNullOrWhiteSpace(companyid))
|
||||
db = SystemParams.GetDbInstance();
|
||||
else
|
||||
{
|
||||
string connetionstring = SystemParams.GetDbStringByCompany(companyid);
|
||||
db = new FISqlConnection(connetionstring);
|
||||
}
|
||||
|
||||
List<ContactInfo> list = new List<ContactInfo>();
|
||||
DataTable dt = db.GetDataTableBySQL(SQL, assetid);
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
ContactInfo ci = ConvertToContactInfo(dr);
|
||||
list.Add(ci);
|
||||
}
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,29 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IronIntel.Contractor.Device
|
||||
{
|
||||
public class GpsDeviceItem
|
||||
{
|
||||
public long ID { get; set; }
|
||||
public string SN { get; set; }
|
||||
public string Source { get; set; }
|
||||
public string SourceName { get; set; }
|
||||
public string DeviceType { get; set; }
|
||||
public int Status { get; set; }
|
||||
public bool Active { get; set; }
|
||||
public string ContractorID { get; set; }
|
||||
public string Contractor { get; set; }
|
||||
public string InvoiceNumber { get; set; }
|
||||
public DateTime AddDate { get; set; }
|
||||
public string AddDateStr { get { return AddDate == DateTime.MinValue ? "" : AddDate.ToShortDateString(); } }
|
||||
public DateTime? InvoiceDate { get; set; }
|
||||
public string InvoiceDateStr { get { return InvoiceDate == null ? "" : InvoiceDate.Value.ToShortDateString(); } }
|
||||
public DateTime? ServiceStartDate { get; set; }
|
||||
public string ServiceStartDateStr { get { return ServiceStartDate == null ? "" : ServiceStartDate.Value.ToShortDateString(); } }
|
||||
public string Notes { get; set; }
|
||||
}
|
||||
}
|
@ -97,7 +97,7 @@ namespace IronIntel.Contractor
|
||||
}
|
||||
else if (DataType == CellDataType.Date)
|
||||
{
|
||||
ft = "MM-dd-yyyy";
|
||||
ft = "M-d-yyyy";
|
||||
}
|
||||
else if (DataType == CellDataType.Bool)
|
||||
{
|
||||
|
@ -83,8 +83,11 @@ namespace IronIntel.Contractor
|
||||
{
|
||||
if (s == null) return null;
|
||||
if (s.GetType() != typeof(string)) return s;
|
||||
//const string invalidCharsMatch =
|
||||
// "(?ims)[\x0\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf" +
|
||||
// "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f]";
|
||||
const string invalidCharsMatch =
|
||||
"(?ims)[\x0\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf" +
|
||||
"(?ims)[\x0\x1\x2\x3\x4\x5\x6\x7\x8\x9\xb\xc\xe\xf" +
|
||||
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f]";
|
||||
|
||||
//取代其中無效字元, 通通換成空字串
|
||||
@ -94,7 +97,7 @@ namespace IronIntel.Contractor
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
private COpenXmlExcelSheet ConvertToOpenXmlObject(DataTable data, string caption, double[] columnWidths, string[] MergeTitles)
|
||||
{
|
||||
try
|
||||
@ -247,7 +250,7 @@ namespace IronIntel.Contractor
|
||||
cellData.FormatCode = "";
|
||||
}
|
||||
|
||||
cellData.Value = rdc.ColumnName;
|
||||
cellData.Value = rdc.Caption;
|
||||
|
||||
rowData.Add(cellData);
|
||||
}
|
||||
@ -269,31 +272,53 @@ namespace IronIntel.Contractor
|
||||
rdc = data.Columns[q];
|
||||
|
||||
string format = "";
|
||||
//if (rdc != null)
|
||||
//{
|
||||
//if (rdc.Attributes != null && rdc.Attributes.ContainsKey("DataFormat"))
|
||||
//{
|
||||
// format = (rdc.Attributes["DataFormat"] == null
|
||||
// ? ""
|
||||
// : rdc.Attributes["DataFormat"].ToString());
|
||||
//}
|
||||
//}
|
||||
if (rdc != null)
|
||||
{
|
||||
if (rdc.ExtendedProperties != null && rdc.ExtendedProperties.ContainsKey("DataFormat"))
|
||||
{
|
||||
format = (rdc.ExtendedProperties["DataFormat"] == null
|
||||
? ""
|
||||
: rdc.ExtendedProperties["DataFormat"].ToString());
|
||||
}
|
||||
}
|
||||
|
||||
cellData = new ChartFormatedData();
|
||||
|
||||
//将特殊格式值处理成字符串显示。
|
||||
CExcelCellValue cExcelValue = null;
|
||||
if (rdr != null)
|
||||
{
|
||||
bool isProcessed = false;
|
||||
object cValue = rdr[q];
|
||||
if (cValue is CExcelCellValue)
|
||||
{
|
||||
cExcelValue = (cValue as CExcelCellValue);
|
||||
cValue = cExcelValue.Value;
|
||||
}
|
||||
cellData.Value =
|
||||
ConvertIvalidChars(
|
||||
ProcessSpecialFormat(rdr[q], format, ref isProcessed));
|
||||
ProcessSpecialFormat(cValue, format, ref isProcessed));
|
||||
if (isProcessed) format = "";
|
||||
}
|
||||
cellData.FormatCode = ProcessFormat(format);
|
||||
cellData.DataType =
|
||||
GetDataType((cellData.Value == null ? typeof(string) : cellData.Value.GetType()));
|
||||
|
||||
//cellData.FormatCode = ProcessFormat(format, cellData.DataType, cellData.Value);
|
||||
//if ((cellData.DataType == CellDataType.Integer || cellData.DataType == CellDataType.Float) && cellData.FormatCode == "{0}")
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// var d = decimal.Parse(cellData.Value.ToString());
|
||||
// var pad = (decimal.GetBits(d)[3] >> 16) & 0x7fff;
|
||||
// if (pad > 0)
|
||||
// {
|
||||
// cellData.FormatCode = "{0:0." + new string('0', pad) + "}";
|
||||
// }
|
||||
// }
|
||||
// catch { }
|
||||
//}
|
||||
|
||||
string alignment = "";
|
||||
if (rdc != null)
|
||||
{
|
||||
@ -304,6 +329,14 @@ namespace IronIntel.Contractor
|
||||
cellData.CAlignment = new CellAlignment();
|
||||
cellData.CAlignment.Align = GetAlignment(alignment);
|
||||
}
|
||||
if (cExcelValue != null)
|
||||
{
|
||||
if (cExcelValue.BackgroundColor != null)
|
||||
{
|
||||
cellData.CFill = new CellFill();
|
||||
cellData.CFill.FillColor = cExcelValue.BackgroundColor.Value;
|
||||
}
|
||||
}
|
||||
|
||||
//如果是合计行则以浅灰色显示。
|
||||
//if (hasTotalRow && k == dataFromClient.Rows.Count - 1)
|
||||
@ -345,6 +378,37 @@ namespace IronIntel.Contractor
|
||||
}
|
||||
}
|
||||
|
||||
private string ProcessFormat(string format, CellDataType cellDataType, object value)
|
||||
{
|
||||
string resultFormat = format;
|
||||
if (string.IsNullOrEmpty(resultFormat)) return resultFormat;
|
||||
if (format.IndexOf("*") >= 0)
|
||||
{
|
||||
resultFormat = resultFormat.Replace("*", "\"*\"");
|
||||
}
|
||||
if (format.IndexOf("@") >= 0)
|
||||
{
|
||||
resultFormat = resultFormat.Replace("@", "\"@\"");
|
||||
}
|
||||
if (cellDataType == CellDataType.Integer && Regex.IsMatch(resultFormat, @"[.][#]+"))
|
||||
{
|
||||
resultFormat = Regex.Replace(resultFormat, @"[.][#]+", "");
|
||||
}
|
||||
else if (cellDataType == CellDataType.Float)
|
||||
{
|
||||
try
|
||||
{
|
||||
var s = string.Format(resultFormat, value);
|
||||
if (s.IndexOf('.') < 0)
|
||||
{
|
||||
resultFormat = Regex.Replace(resultFormat, @"[.][0#]*(.*)[}]", "$1}");
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
return resultFormat;
|
||||
}
|
||||
|
||||
private string ConvertColNumber(int colnum)
|
||||
{
|
||||
string zzz = "Z+";
|
||||
@ -477,6 +541,10 @@ namespace IronIntel.Contractor
|
||||
{
|
||||
resultFormat = resultFormat.Replace("@", "\"@\"");
|
||||
}
|
||||
if (format.IndexOf("\n") >= 0)
|
||||
{
|
||||
resultFormat = resultFormat.Replace("@", "\"@\"");
|
||||
}
|
||||
return resultFormat;
|
||||
}
|
||||
}
|
||||
|
304
IronIntelContractorBusiness/ExportExcel/ImportFromExcel.cs
Normal file
304
IronIntelContractorBusiness/ExportExcel/ImportFromExcel.cs
Normal file
@ -0,0 +1,304 @@
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using Foresight.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IronIntel.Contractor.ExportExcel
|
||||
{
|
||||
/// <summary>
|
||||
/// Excel 导入。提供对xlsx文件的解析
|
||||
/// </summary>
|
||||
public class ImportFromExcel
|
||||
{
|
||||
/// <summary>
|
||||
/// 解析excel数据
|
||||
/// </summary>
|
||||
/// <param name="excelBytes">Excel Data</param>
|
||||
/// <returns></returns>
|
||||
public DataTable LoadExcelData(byte[] excelBytes, int headerrowindex = 1)
|
||||
{
|
||||
return LoadExcelData(excelBytes, "", headerrowindex);
|
||||
}
|
||||
|
||||
public DataTable[] LoadAllExcelData(byte[] excelBytes)
|
||||
{
|
||||
MemoryStream stream = null;
|
||||
List<DataTable> list = new List<DataTable>();
|
||||
try
|
||||
{
|
||||
stream = new MemoryStream(excelBytes);
|
||||
using (SpreadsheetDocument sdoc = SpreadsheetDocument.Open(stream, false))
|
||||
{
|
||||
foreach (Sheet sheet in sdoc.WorkbookPart.Workbook.Descendants<Sheet>())
|
||||
{
|
||||
if (sheet != null)
|
||||
{
|
||||
WorksheetPart wsp = (WorksheetPart)sdoc.WorkbookPart.GetPartById(sheet.Id);
|
||||
Worksheet ws = wsp.Worksheet;
|
||||
//取Cell值的时候使用
|
||||
SharedStringTablePart tablePart = sdoc.WorkbookPart.SharedStringTablePart;
|
||||
//得到第一个工作表的所有行
|
||||
IEnumerable<Row> rows = ws.Descendants<Row>();
|
||||
//第一行是标题,标题作为表的列名
|
||||
Row headerRow = rows.First();
|
||||
DataTable excelData = new DataTable(sheet.Name);
|
||||
string columnName = "";
|
||||
foreach (Cell hc in headerRow)
|
||||
{
|
||||
columnName = GetCellValue(hc, tablePart);
|
||||
excelData.Columns.Add(columnName, GetCellDataType(hc));
|
||||
}
|
||||
//装载数据到DataTable里面
|
||||
foreach (Row row in rows)
|
||||
{
|
||||
if (row.RowIndex == 1) continue;
|
||||
DataRow excelRow = excelData.NewRow();
|
||||
int i = 0;
|
||||
foreach (Cell cell in row)
|
||||
{
|
||||
excelRow[i] = GetCellValue(cell, tablePart);
|
||||
i++;
|
||||
}
|
||||
excelData.Rows.Add(excelRow);
|
||||
}
|
||||
list.Add(excelData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
//解析过程中出错误了,TODO
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (stream != null) stream.Close();
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public DataTable LoadExcelDataByClient(byte[] excelBytes)
|
||||
{
|
||||
DataTable[] dts = ExcelClient.GetTables(excelBytes, true, true);
|
||||
|
||||
if(dts != null && dts.Length > 0)
|
||||
{
|
||||
return dts[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解析excel数据
|
||||
/// </summary>
|
||||
/// <param name="excelBytes">Excel Data</param>
|
||||
/// <param name="sheetName">Sheet Name</param>
|
||||
/// <returns></returns>
|
||||
public DataTable LoadExcelData(byte[] excelBytes, string sheetName, int headerrowindex)
|
||||
{
|
||||
MemoryStream stream = null;
|
||||
try
|
||||
{
|
||||
stream = new MemoryStream(excelBytes);
|
||||
using (SpreadsheetDocument sdoc = SpreadsheetDocument.Open(stream, false))
|
||||
{
|
||||
Sheet sheet = null;
|
||||
if (string.IsNullOrEmpty(sheetName))//没有特定的sheetname的时候,取第一个sheet
|
||||
sheet = sdoc.WorkbookPart.Workbook.Descendants<Sheet>().FirstOrDefault();
|
||||
else//根据sheetname取特定sheet
|
||||
sheet = sdoc.WorkbookPart.Workbook.Descendants<Sheet>().Where((s) => s.Name == sheetName).First();
|
||||
if (sheet != null)
|
||||
{
|
||||
WorksheetPart wsp = (WorksheetPart)sdoc.WorkbookPart.GetPartById(sheet.Id);
|
||||
WorkbookStylesPart stylepart = sdoc.WorkbookPart.GetPartsOfType<WorkbookStylesPart>().FirstOrDefault();
|
||||
Worksheet ws = wsp.Worksheet;
|
||||
//取Cell值的时候使用
|
||||
SharedStringTablePart tablePart = sdoc.WorkbookPart.SharedStringTablePart;
|
||||
//得到第一个工作表的所有行
|
||||
IEnumerable<Row> rows = ws.Descendants<Row>();
|
||||
//第一行是标题,标题作为表的列名
|
||||
Row headerRow = rows.ElementAt(headerrowindex - 1);//.First();
|
||||
DataTable excelData = new DataTable(sheet.Name);
|
||||
string columnName = "";
|
||||
foreach (Cell hc in headerRow)
|
||||
{
|
||||
columnName = GetCellValue(hc, tablePart);
|
||||
excelData.Columns.Add(columnName, GetCellDataType(hc));
|
||||
if (hc.CellReference != null)
|
||||
{
|
||||
var colref = System.Text.RegularExpressions.Regex.Replace(hc.CellReference.Value, @"\d", "");//C30->C
|
||||
excelData.Columns[excelData.Columns.Count - 1].Caption = colref;
|
||||
}
|
||||
}
|
||||
|
||||
//装载数据到DataTable里面
|
||||
foreach (Row row in rows)
|
||||
{
|
||||
if (row.RowIndex <= headerrowindex) continue;
|
||||
DataRow excelRow = excelData.NewRow();
|
||||
int i = 0;
|
||||
foreach (Cell cell in row)
|
||||
{
|
||||
if (cell.CellReference != null)//row不包含未输入的单元
|
||||
{
|
||||
var colref = System.Text.RegularExpressions.Regex.Replace(cell.CellReference.Value, @"\d", "");//C30->C
|
||||
int j = i;
|
||||
while (j < excelData.Columns.Count && excelData.Columns[j].Caption != colref)
|
||||
{
|
||||
j++;
|
||||
}
|
||||
if (excelData.Columns[j].Caption == colref)
|
||||
{
|
||||
excelRow[j] = GetCellValue(cell, tablePart, stylepart);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
excelRow[i] = GetCellValue(cell, tablePart, stylepart);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
excelData.Rows.Add(excelRow);
|
||||
}
|
||||
return excelData;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//解析过程中出错误了,TODO
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (stream != null) stream.Close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/// <summary>
|
||||
/// 得到Excel 中 Cell的值
|
||||
/// </summary>
|
||||
/// <param name="c">Cell</param>
|
||||
/// <param name="stp"></param>
|
||||
/// <returns></returns>
|
||||
private string GetCellValue(Cell cell, SharedStringTablePart stringTablePart, WorkbookStylesPart stylepart = null)
|
||||
{
|
||||
if (cell.ChildElements.Count == 0) return "";
|
||||
string value = cell.CellValue.InnerText;
|
||||
if (cell.DataType != null && cell.DataType == CellValues.SharedString)
|
||||
{
|
||||
value = stringTablePart.SharedStringTable.ChildElements[int.Parse(value)].InnerText;
|
||||
}
|
||||
else if (cell.StyleIndex != null && cell.StyleIndex > 0 && stylepart != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
//int formatStyleIndex = Convert.ToInt32(cell.StyleIndex.Value);
|
||||
//CellFormat cf = (CellFormat)stylepart.Stylesheet.CellFormats.ElementAt(formatStyleIndex);
|
||||
|
||||
//if (cf.NumberFormatId != null)
|
||||
//{
|
||||
// var numberFormatId = cf.NumberFormatId.Value;
|
||||
// if (stylepart.Stylesheet.NumberingFormats != null)
|
||||
// {
|
||||
// var numberingFormat = stylepart.Stylesheet.NumberingFormats.Cast<NumberingFormat>().Single(f => f.NumberFormatId.Value == numberFormatId);
|
||||
// if(numberingFormat != null)
|
||||
// {
|
||||
// double dd = 0;
|
||||
// if (double.TryParse(value, out dd))
|
||||
// {
|
||||
// return dd.ToString(numberingFormat.FormatCode.Value);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// value = cell.InnerText;
|
||||
//}
|
||||
double d = 0;
|
||||
if (double.TryParse(value, out d))
|
||||
{
|
||||
value = d.ToString();
|
||||
CellFormat cf = (CellFormat)stylepart.Stylesheet.CellFormats.ElementAt((int)cell.StyleIndex.Value);
|
||||
if (cf.NumberFormatId >= 14 && cf.NumberFormatId <= 22)//Date
|
||||
{
|
||||
value = DateTime.FromOADate(d).ToString("M/d/yyyy");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
return value;
|
||||
}
|
||||
/// <summary>
|
||||
/// 得到单元格类型
|
||||
/// </summary>
|
||||
/// <param name="cell">Cell</param>
|
||||
/// <returns></returns>
|
||||
private Type GetCellDataType(Cell cell)
|
||||
{
|
||||
if (cell.DataType == null) return typeof(string);
|
||||
if (cell.DataType == CellValues.Date)
|
||||
return typeof(DateTime);
|
||||
if (cell.DataType == CellValues.Number)
|
||||
return typeof(decimal);
|
||||
return typeof(string);
|
||||
}
|
||||
public string[] LoadExcelColumnHead(byte[] excelBytes, int headerrowindex = 1)
|
||||
{
|
||||
return LoadExcelColumnHead(excelBytes, "", headerrowindex);
|
||||
}
|
||||
|
||||
public string[] LoadExcelColumnHead(byte[] excelBytes, string sheetName, int headerrowindex)
|
||||
{
|
||||
MemoryStream stream = null;
|
||||
try
|
||||
{
|
||||
stream = new MemoryStream(excelBytes);
|
||||
using (SpreadsheetDocument sdoc = SpreadsheetDocument.Open(stream, false))
|
||||
{
|
||||
Sheet sheet = null;
|
||||
if (string.IsNullOrEmpty(sheetName))//没有特定的sheetname的时候,取第一个sheet
|
||||
sheet = sdoc.WorkbookPart.Workbook.Descendants<Sheet>().FirstOrDefault();
|
||||
else//根据sheetname取特定sheet
|
||||
sheet = sdoc.WorkbookPart.Workbook.Descendants<Sheet>().Where((s) => s.Name == sheetName).First();
|
||||
if (sheet != null)
|
||||
{
|
||||
WorksheetPart wsp = (WorksheetPart)sdoc.WorkbookPart.GetPartById(sheet.Id);
|
||||
Worksheet ws = wsp.Worksheet;
|
||||
//取Cell值的时候使用
|
||||
SharedStringTablePart tablePart = sdoc.WorkbookPart.SharedStringTablePart;
|
||||
//得到第一个工作表的所有行
|
||||
IEnumerable<Row> rows = ws.Descendants<Row>();
|
||||
//第一行是标题,标题作为表的列名
|
||||
Row headerRow = rows.ElementAt(headerrowindex - 1);//.First();
|
||||
List<string> ls = new List<string>();
|
||||
foreach (Cell hc in headerRow)
|
||||
{
|
||||
string columnName = "";
|
||||
columnName = GetCellValue(hc, tablePart);
|
||||
ls.Add(columnName);
|
||||
}
|
||||
|
||||
return ls.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//解析过程中出错误了,TODO
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (stream != null) stream.Close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -70,4 +70,10 @@ namespace IronIntel.Contractor
|
||||
get { return _RowHeightList; }
|
||||
}
|
||||
}
|
||||
|
||||
public class CExcelCellValue
|
||||
{
|
||||
public object Value { get; set; }
|
||||
public System.Drawing.Color? BackgroundColor { get; set; }
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,223 @@
|
||||
using FI.FIC.Extention;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IronIntel.Contractor.FICExtDataTable
|
||||
{
|
||||
public class AssetTripsDataTable : FleetExtDataTable
|
||||
{
|
||||
public override string ID
|
||||
{
|
||||
get
|
||||
{
|
||||
return "32F84217-7F99-438E-9F06-6F238DDA3202";
|
||||
}
|
||||
}
|
||||
|
||||
public override string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Asset Trips DataTable";
|
||||
}
|
||||
}
|
||||
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Asset Trips DataTable";
|
||||
}
|
||||
}
|
||||
|
||||
public override string Version
|
||||
{
|
||||
get
|
||||
{
|
||||
return "1.0.0.0";
|
||||
}
|
||||
}
|
||||
|
||||
private static ExtDataTableParameter[] Params = new ExtDataTableParameter[] {
|
||||
new ExtDataTableParameter(){ID="C854AF5C-2928-43E1-B600-30F0318006FA",
|
||||
Name ="AssetId",DataType=DataTypes.Integer,DefaultValue=0 },
|
||||
new ExtDataTableParameter(){ ID="8573483C-3FD3-42E0-8C80-5DE543183140",
|
||||
Name ="StartDate",DataType=DataTypes.DateTime,DefaultValue=DateTime.Today.ToShortDateString()},
|
||||
new ExtDataTableParameter(){ ID="2C82E11F-2D97-426B-9925-FFB9BA3AF8D0",
|
||||
Name ="EndDate",DataType=DataTypes.DateTime,DefaultValue=DateTime.Today.ToShortDateString()},
|
||||
};
|
||||
|
||||
public override ExtDataTableParameter[] AvailableParameters
|
||||
{
|
||||
get
|
||||
{
|
||||
return Params;
|
||||
}
|
||||
}
|
||||
|
||||
public override DataTable GetData(int maxrows, KeyValuePair<string, object>[] parameters)
|
||||
{
|
||||
DataTable result = GetSchemaTable();
|
||||
string companyid = SystemParams.CompanyID;
|
||||
string assetidStr = "";
|
||||
string dtFromStr = "";
|
||||
string dtToStr = "";
|
||||
|
||||
if (parameters != null)
|
||||
{
|
||||
foreach (var kv in parameters)
|
||||
{
|
||||
if (kv.Key.Equals("AssetId", StringComparison.OrdinalIgnoreCase))
|
||||
assetidStr = kv.Value == null ? "" : kv.Value.ToString();
|
||||
else if (kv.Key.Equals("StartDate", StringComparison.OrdinalIgnoreCase))
|
||||
dtFromStr = kv.Value == null ? "" : kv.Value.ToString();
|
||||
else if (kv.Key.Equals("EndDate", StringComparison.OrdinalIgnoreCase))
|
||||
dtToStr = kv.Value == null ? "" : kv.Value.ToString();
|
||||
}
|
||||
}
|
||||
var user = GetCurrentUser();
|
||||
if (user == null || !user.Active)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
long assetid = 0;
|
||||
if (string.IsNullOrEmpty(assetidStr) || !long.TryParse(assetidStr, out assetid))
|
||||
return result;
|
||||
if (assetid <= 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
DateTime dtFrom = DateTime.Today;
|
||||
DateTime dtTo = DateTime.Now;
|
||||
if (!DateTime.TryParse(dtFromStr, out dtFrom) || !DateTime.TryParse(dtToStr, out dtTo))
|
||||
return result;
|
||||
dtTo = dtTo.Date.AddDays(1).AddSeconds(-1);
|
||||
|
||||
try
|
||||
{
|
||||
var aclient = FleetServiceClientHelper.CreateClient<AssetQueryClient>(companyid, string.Empty);
|
||||
var asset = aclient.GetAssetBasicInfoByID(companyid, assetid);
|
||||
if (asset == null)
|
||||
return result;
|
||||
|
||||
var client = FleetServiceClientHelper.CreateClient<AssetLocationQueryClient>(companyid, string.Empty);
|
||||
AssetTripInfo[] trips = client.GetAssetTripLins(companyid, assetid, dtFrom.Date, dtTo);
|
||||
foreach (AssetTripInfo trip in trips)
|
||||
{
|
||||
DataRow dr = result.NewRow();
|
||||
result.Rows.Add(dr);
|
||||
FillRowData(dr, trip, asset);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLog(GetType().FullName + ".GetData", ex.Message, ex.ToString());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override DataTable GetSchemaTable()
|
||||
{
|
||||
DataTable result = new DataTable();
|
||||
result.Columns.Add("MachineID", typeof(long));
|
||||
result.Columns.Add("Name", typeof(string));
|
||||
result.Columns.Add("Name2", typeof(string));
|
||||
result.Columns.Add("VIN", typeof(string));
|
||||
result.Columns.Add("MakeID", typeof(int));
|
||||
result.Columns.Add("Make", typeof(string));
|
||||
result.Columns.Add("ModelID", typeof(int));
|
||||
result.Columns.Add("Model", typeof(string));
|
||||
result.Columns.Add("TypeID", typeof(int));
|
||||
result.Columns.Add("Type", typeof(string));
|
||||
|
||||
result.Columns.Add("TripOnLogId", typeof(long));
|
||||
result.Columns.Add("TripOnAsofTime", typeof(DateTime));
|
||||
result.Columns.Add("TripOnLocalAsofTime", typeof(DateTime));
|
||||
result.Columns.Add("TripOnLatitude", typeof(double));
|
||||
result.Columns.Add("TripOnLongitude", typeof(double));
|
||||
result.Columns.Add("TripOnOdometer", typeof(double));
|
||||
result.Columns.Add("TripOnOdometerUnit", typeof(string));
|
||||
result.Columns.Add("TripOnCity", typeof(string));
|
||||
result.Columns.Add("TripOnStreet", typeof(string));
|
||||
result.Columns.Add("TripOnState", typeof(string));
|
||||
|
||||
result.Columns.Add("TripOffLogId", typeof(long));
|
||||
result.Columns.Add("TripOffAsofTime", typeof(DateTime));
|
||||
result.Columns.Add("TripOffLocalAsofTime", typeof(DateTime));
|
||||
result.Columns.Add("TripOffLatitude", typeof(double));
|
||||
result.Columns.Add("TripOffLongitude", typeof(double));
|
||||
result.Columns.Add("TripOffOdometer", typeof(double));
|
||||
result.Columns.Add("TripOffOdometerUnit", typeof(string));
|
||||
result.Columns.Add("TripOffCity", typeof(string));
|
||||
result.Columns.Add("TripOffStreet", typeof(string));
|
||||
result.Columns.Add("TripOffState", typeof(string));
|
||||
|
||||
result.Columns.Add("TripOff", typeof(DateTime));
|
||||
result.Columns.Add("TripTime", typeof(TimeSpan));
|
||||
result.Columns.Add("TripDistance", typeof(double));
|
||||
result.Columns.Add("TripDistanceUnit", typeof(string));
|
||||
|
||||
result.TableName = "AssetTrips";
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void FillRowData(DataRow dr, AssetTripInfo trip, AssetBasicInfo asset)
|
||||
{
|
||||
dr["MachineID"] = asset.ID;
|
||||
dr["Name"] = asset.Name;
|
||||
dr["Name2"] = asset.Name2;
|
||||
dr["VIN"] = asset.VIN;
|
||||
dr["MakeID"] = asset.MakeID;
|
||||
dr["Make"] = asset.MakeName;
|
||||
dr["ModelID"] = asset.ModelID;
|
||||
dr["Model"] = asset.ModelName;
|
||||
dr["TypeID"] = asset.TypeID;
|
||||
dr["Type"] = asset.TypeName;
|
||||
if (trip.TripOn != null)
|
||||
{
|
||||
dr["TripOnLogId"] = trip.TripOn.LogId;
|
||||
dr["TripOnAsofTime"] = trip.TripOn.AsofTime;
|
||||
dr["TripOnLocalAsofTime"] = trip.TripOn.LocalAsofTime;
|
||||
dr["TripOnLatitude"] = trip.TripOn.Latitude;
|
||||
dr["TripOnLongitude"] = trip.TripOn.Longitude;
|
||||
if (trip.TripOn.Odometer != null)
|
||||
{
|
||||
dr["TripOnOdometer"] = trip.TripOn.Odometer;
|
||||
dr["TripOnOdometerUnit"] = trip.TripOn.OdometerUnit;
|
||||
}
|
||||
dr["TripOnCity"] = trip.TripOn.City;
|
||||
dr["TripOnStreet"] = trip.TripOn.Street;
|
||||
dr["TripOnState"] = trip.TripOn.State;
|
||||
}
|
||||
if (trip.TripOff != null)
|
||||
{
|
||||
dr["TripOffLogId"] = trip.TripOff.LogId;
|
||||
dr["TripOffAsofTime"] = trip.TripOff.AsofTime;
|
||||
dr["TripOffLocalAsofTime"] = trip.TripOff.LocalAsofTime;
|
||||
dr["TripOffLatitude"] = trip.TripOff.Latitude;
|
||||
dr["TripOffLongitude"] = trip.TripOff.Longitude;
|
||||
if (trip.TripOff.Odometer != null)
|
||||
{
|
||||
dr["TripOffOdometer"] = trip.TripOff.Odometer;
|
||||
dr["TripOffOdometerUnit"] = trip.TripOff.OdometerUnit;
|
||||
}
|
||||
dr["TripOffCity"] = trip.TripOff.City;
|
||||
dr["TripOffStreet"] = trip.TripOff.Street;
|
||||
dr["TripOffState"] = trip.TripOff.State;
|
||||
}
|
||||
if (trip.TripTime != null)
|
||||
dr["TripTime"] = trip.TripTime;
|
||||
if (trip.TripDistance != null)
|
||||
dr["TripDistance"] = trip.TripDistance;
|
||||
dr["TripDistanceUnit"] = trip.TripDistanceUnit;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FI.FIC.Extention;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using Foresight.Fleet.Services.User;
|
||||
|
||||
namespace IronIntel.Contractor.FICExtDataTable
|
||||
{
|
||||
public abstract class FleetExtDataTable : IExtDataTable
|
||||
{
|
||||
protected FICContext Context { get; private set; }
|
||||
|
||||
protected string UserIID
|
||||
{
|
||||
get
|
||||
{
|
||||
return Context == null ? string.Empty : Context.UserIID;
|
||||
}
|
||||
}
|
||||
|
||||
public FleetExtDataTable()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public abstract string ID { get; }
|
||||
public abstract string Name { get; }
|
||||
public abstract string Description { get; }
|
||||
public abstract string Version { get; }
|
||||
public abstract ExtDataTableParameter[] AvailableParameters { get; }
|
||||
|
||||
public abstract DataTable GetData(int maxrows, KeyValuePair<string, object>[] parameters);
|
||||
public abstract DataTable GetSchemaTable();
|
||||
|
||||
public void Init(FICContext context)
|
||||
{
|
||||
Context = context;
|
||||
}
|
||||
|
||||
protected void WriteLog(string source, string message, string detail)
|
||||
{
|
||||
SystemParams.WriteLog("Error", "FleetExtDt", source, message, detail);
|
||||
}
|
||||
|
||||
protected UserInfo GetCurrentUser()
|
||||
{
|
||||
if (Context == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
try
|
||||
{
|
||||
UserQueryClient ic = FleetServiceClientHelper.CreateClient<UserQueryClient>();
|
||||
return ic.GetUserByIID(UserIID);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLog(GetType().FullName + ".GetLoginSession()", "extdt=" + ID + ";useriid=" + UserIID, ex.ToString());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
121
IronIntelContractorBusiness/FICSpecialGolbalFilterManager.cs
Normal file
121
IronIntelContractorBusiness/FICSpecialGolbalFilterManager.cs
Normal file
@ -0,0 +1,121 @@
|
||||
using FI.FIC;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using Foresight.Fleet.Services.JobSite;
|
||||
using Foresight.Fleet.Services.User;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IronIntel.Contractor
|
||||
{
|
||||
public class FICSpecialGolbalFilterManager
|
||||
{
|
||||
const string ASSETID = "00000000-0000-0000-0000-000000000001";
|
||||
const string JOBSITEID = "00000000-0000-0000-0000-000000000002";
|
||||
|
||||
public static readonly SpecialGlobalFilterInfo[] GlobalFilters = new SpecialGlobalFilterInfo[] {
|
||||
new SpecialGlobalFilterInfo(){IID=ASSETID,DisplayName="Available Assets",Description="Available Assets",DataType=FilterDataType.dtInteger},
|
||||
new SpecialGlobalFilterInfo(){IID=JOBSITEID,DisplayName="Available Jobsites",Description="Available Jobsites",DataType=FilterDataType.dtInteger}
|
||||
};
|
||||
|
||||
private static bool IsValidId(string id)
|
||||
{
|
||||
foreach (var f in GlobalFilters)
|
||||
{
|
||||
if (string.Equals(id, f.IID, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static object[] GetSpecialGlobalFilterValuesByUser(string useriid, string filterid)
|
||||
{
|
||||
if (!IsValidId(filterid))
|
||||
{
|
||||
return new object[0];
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(useriid))
|
||||
{
|
||||
return new object[0];
|
||||
}
|
||||
|
||||
if (string.Equals(filterid, ASSETID, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return GetAvailableAssets(useriid);
|
||||
}
|
||||
else if (string.Equals(filterid, JOBSITEID, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return GetAvailableJobSites(useriid);
|
||||
}
|
||||
|
||||
return new object[0];
|
||||
}
|
||||
|
||||
private static object[] GetAvailableAssets(string useriid)
|
||||
{
|
||||
//DateTime dt = DateTime.Now;
|
||||
AssetQueryClient client = FleetServiceClientHelper.CreateClient<AssetQueryClient>();
|
||||
long[] assetids = client.GetAvailableAssetsForUsers(SystemParams.CompanyID, useriid);
|
||||
object[] result = new object[assetids.Length];
|
||||
for (int i = 0; i < assetids.Length; i++)
|
||||
{
|
||||
result[i] = assetids[i];
|
||||
}
|
||||
//TimeSpan sp = DateTime.Now - dt;
|
||||
//SystemParams.WriteLog("DEBUG", "FICSpecialGolbalFilterManager", string.Format("Assets: {0}, {1}",result.Length,sp.ToString()), useriid);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static object[] GetAvailableJobSites(string useriid)
|
||||
{
|
||||
//DateTime dt = DateTime.Now;
|
||||
JobSiteProvider client = FleetServiceClientHelper.CreateClient<JobSiteProvider>();
|
||||
var jobsites = client.GetUserJobsites(SystemParams.CompanyID, useriid);
|
||||
object[] results = new object[jobsites.Length];
|
||||
for (int i = 0; i < jobsites.Length; i++)
|
||||
{
|
||||
results[i] = jobsites[i].ID;
|
||||
}
|
||||
//TimeSpan sp = DateTime.Now - dt;
|
||||
//SystemParams.WriteLog("DEBUG", "FICSpecialGolbalFilterManager", string.Format("Jobsites: {0}, {1}", results.Length, sp.ToString()), useriid);
|
||||
return results;
|
||||
}
|
||||
|
||||
public static FilterTemplateInfo[] GetFilterTemplates(string useriid)
|
||||
{
|
||||
UserFilterProvider f = FleetServiceClientHelper.CreateClient<UserFilterProvider>();
|
||||
var items = f.GetFilterTemplates(SystemParams.CompanyID, useriid);
|
||||
List<FilterTemplateInfo> filters = new List<FilterTemplateInfo>();
|
||||
foreach (var item in items)
|
||||
{
|
||||
FilterTemplateInfo t = new FilterTemplateInfo();
|
||||
t.IID = item.Key;
|
||||
t.DisplayName = item.Value;
|
||||
t.DataType = FilterDataType.dtInteger;
|
||||
filters.Add(t);
|
||||
}
|
||||
|
||||
return filters.ToArray();
|
||||
}
|
||||
|
||||
public static object[] GetFilterValues(string useriid, int filterid)
|
||||
{
|
||||
UserFilterProvider f = FleetServiceClientHelper.CreateClient<UserFilterProvider>();
|
||||
long[] assets = f.GetFilteredAssets(SystemParams.CompanyID, filterid, useriid);
|
||||
if (assets == null || assets.Length == 0)
|
||||
{
|
||||
return new object[0];
|
||||
}
|
||||
object[] results = new object[assets.Length];
|
||||
for (int i = 0; i < assets.Length; i++)
|
||||
{
|
||||
results[i] = assets[i];
|
||||
}
|
||||
return results;
|
||||
}
|
||||
}
|
||||
}
|
@ -5,8 +5,6 @@ using System.Text;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using Foresight.Data;
|
||||
using IronIntel.Services;
|
||||
using IronIntel.Services.Customers;
|
||||
|
||||
namespace IronIntel.Contractor.FilterQ
|
||||
{
|
||||
|
@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Configuration;
|
||||
using Foresight.Fleet.Services;
|
||||
using Foresight.Standard;
|
||||
|
||||
namespace IronIntel.Contractor
|
||||
{
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
@ -11,6 +13,33 @@ namespace IronIntel.Contractor
|
||||
{
|
||||
public static readonly DateTime DBMinDateTime = new DateTime(1900, 01, 01);
|
||||
|
||||
static Helper()
|
||||
{
|
||||
FileTypes.Add(".jfif", "image/jpeg");
|
||||
FileTypes.Add(".jpg", "image/jpeg");
|
||||
FileTypes.Add(".jpeg", "image/jpeg");
|
||||
FileTypes.Add(".bmp", "image/jpeg");
|
||||
FileTypes.Add(".gif", "image/jpeg");
|
||||
FileTypes.Add(".png", "image/png");
|
||||
FileTypes.Add(".tiff", "image/tiff");
|
||||
|
||||
FileTypes.Add(".mp4", "video/mp4");
|
||||
FileTypes.Add(".mp3", "audio/mpeg");
|
||||
FileTypes.Add(".mp2", "audio/mp2");
|
||||
|
||||
FileTypes.Add(".m4e", "video/mp4");
|
||||
FileTypes.Add(".mpeg", "video/mpg");
|
||||
FileTypes.Add(".avi", "video/avi");
|
||||
FileTypes.Add(".mov", "video/quicktime");
|
||||
|
||||
FileTypes.Add(".pdf", "application/pdf");
|
||||
}
|
||||
|
||||
public static bool IsNullDateTime(DateTime? dt)
|
||||
{
|
||||
return dt == null || dt.Value < DBMinDateTime;
|
||||
}
|
||||
|
||||
public static bool IsTrue(string s)
|
||||
{
|
||||
const string YES = "Yes";
|
||||
@ -88,5 +117,184 @@ namespace IronIntel.Contractor
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
public static string GetDefaultOdoUnitString()
|
||||
{
|
||||
if (SystemParams.CustomerDetail.OdometerUnit == Foresight.Standard.Units.DistanceUnits.Kilometres)
|
||||
return "Kilometre";
|
||||
else //if (SystemParams.CustomerDetail.OdometerUnit == Foresight.Fleet.Units.DistanceUnits.Miles)
|
||||
return "Mile";
|
||||
}
|
||||
|
||||
public static System.Drawing.Color ConvertHtmlColor(string color, System.Drawing.Color def)
|
||||
{
|
||||
System.Drawing.Color c = def;
|
||||
if (System.Text.RegularExpressions.Regex.IsMatch(color, "#([0-9a-fA-F]{6})"))
|
||||
{
|
||||
try
|
||||
{
|
||||
c = System.Drawing.ColorTranslator.FromHtml(color);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
return c;
|
||||
}
|
||||
public static byte[] GetThumbImg(byte[] buff, int width = 300, int height = 300)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream(buff))
|
||||
{
|
||||
ms.Position = 0;
|
||||
System.Drawing.Image img = RotateImage(ms);
|
||||
var tp = Scale(img.Width, img.Height, width, height);
|
||||
System.Drawing.Image img1 = new System.Drawing.Bitmap(img, tp.Item1, tp.Item2);
|
||||
using (MemoryStream ms1 = new MemoryStream())
|
||||
{
|
||||
img1.Save(ms1, System.Drawing.Imaging.ImageFormat.Png);
|
||||
ms1.Position = 0;
|
||||
return ms1.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return buff;
|
||||
}
|
||||
}
|
||||
|
||||
private static Tuple<int, int> Scale(int src_width, int src_height, int dest_width, int dest_height)
|
||||
{
|
||||
double srcratio = (double)src_width / (double)src_height;
|
||||
double w = dest_width;
|
||||
double h = (w / srcratio);
|
||||
if (h > dest_height)
|
||||
{
|
||||
h = dest_height;
|
||||
w = h * srcratio;
|
||||
}
|
||||
return new Tuple<int, int>((int)w, (int)h);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据图片exif调整方向
|
||||
/// </summary>
|
||||
/// <param name="sm"></param>
|
||||
/// <returns></returns>
|
||||
private static Bitmap RotateImage(Stream sm)
|
||||
{
|
||||
System.Drawing.Image img = System.Drawing.Image.FromStream(sm);
|
||||
var exif = img.PropertyItems;
|
||||
byte orien = 0;
|
||||
var item = exif.Where(m => m.Id == 274).ToArray();
|
||||
if (item.Length > 0 && item[0].Value != null && item[0].Value.Length > 0)
|
||||
orien = item[0].Value[0];
|
||||
switch (orien)
|
||||
{
|
||||
case 2:
|
||||
img.RotateFlip(RotateFlipType.RotateNoneFlipX);//horizontal flip
|
||||
break;
|
||||
case 3:
|
||||
img.RotateFlip(RotateFlipType.Rotate180FlipNone);//right-top
|
||||
break;
|
||||
case 4:
|
||||
img.RotateFlip(RotateFlipType.RotateNoneFlipY);//vertical flip
|
||||
break;
|
||||
case 5:
|
||||
img.RotateFlip(RotateFlipType.Rotate90FlipX);
|
||||
break;
|
||||
case 6:
|
||||
img.RotateFlip(RotateFlipType.Rotate90FlipNone);//right-top
|
||||
break;
|
||||
case 7:
|
||||
img.RotateFlip(RotateFlipType.Rotate270FlipX);
|
||||
break;
|
||||
case 8:
|
||||
img.RotateFlip(RotateFlipType.Rotate270FlipNone);//left-bottom
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return (Bitmap)img;
|
||||
}
|
||||
public static bool IsEmail(string email)
|
||||
{
|
||||
//string s = @"^(([^<>()[\]\\.,;:\s@{qm}]+(\.[^<>()[\]\\.,;:\s@{qm}]+)*)|({qm}.+{qm}))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$";
|
||||
//s = s.Replace("{qm}", "\\\"");
|
||||
string s = @"^\w[-\w.+]*@\w+([-.]\w+)*\.\w+([-.]\w+)*$";
|
||||
|
||||
return new System.Text.RegularExpressions.Regex(s).IsMatch(email);
|
||||
}
|
||||
public static bool IsNumber(string str)
|
||||
{
|
||||
string s = @"^\d+$";
|
||||
return new System.Text.RegularExpressions.Regex(s).IsMatch(str);
|
||||
}
|
||||
public static readonly Dictionary<string, string> FileTypes = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public static readonly string[] ImageTypes = new string[] { ".jfif", ".jpg", ".jpeg", ".bmp", ".png", ".tiff", ".gif" };
|
||||
|
||||
|
||||
public static string GetFileExtention(string filename)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(filename))
|
||||
{
|
||||
return ".jpg";
|
||||
}
|
||||
int idx = filename.LastIndexOf('.');
|
||||
if (idx > 0 && idx < (filename.Length - 1))
|
||||
{
|
||||
return filename.Substring(idx);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ".jpg";
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsImage(string filetype)
|
||||
{
|
||||
foreach (var s in ImageTypes)
|
||||
{
|
||||
if (string.Equals(s, filetype, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static double? ConvertToDouble(string d, double? def = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(d))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
double t;
|
||||
if (double.TryParse(d, out t))
|
||||
{
|
||||
return t;
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
public static int ConvertToInt32(string d, int def = 0)
|
||||
{
|
||||
int t;
|
||||
if (int.TryParse(d, out t))
|
||||
{
|
||||
return t;
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
public static readonly string[] DevAccounts = new string[] {
|
||||
"dchu@foresightintelligence.com",
|
||||
"qhong@foresightintelligence.com",
|
||||
"lwang@foresightintelligence.com",
|
||||
"ljzeng@foresightintelligence.com",
|
||||
"llj@foresightintelligence.com"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using IronIntel.Contractor.iisitebase;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
@ -21,7 +22,7 @@ namespace IronIntel.Contractor
|
||||
{
|
||||
if (_LoginSessionCookieName == null)
|
||||
{
|
||||
_LoginSessionCookieName = Site.IronIntelBasePage.LOGINSESSION_COOKIENAME;
|
||||
_LoginSessionCookieName = IronIntelBasePage.LOGINSESSION_COOKIENAME;
|
||||
}
|
||||
return _LoginSessionCookieName;
|
||||
}
|
||||
@ -34,7 +35,7 @@ namespace IronIntel.Contractor
|
||||
{
|
||||
if (_LanguageCookieName == null)
|
||||
{
|
||||
_LanguageCookieName = LoginSessionCookieName + "language";
|
||||
_LanguageCookieName = IronIntelBasePage.LANGUAGE_COOKIENAME;
|
||||
}
|
||||
return _LanguageCookieName;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ namespace IronIntel.Contractor
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemParams.WriteLog("ERROR", "DeleteUserGroup", ex.Message, ex.ToString());
|
||||
throw new Exception(ResManager.GetLanguage("LHBIS_EXCEPTION_E0X6502704C")); // "Failed to delete the user group."
|
||||
throw new Exception(ResManager.GetLanguage(ClientLanguage, "LHBIS_EXCEPTION_E0X6502704C")); // "Failed to delete the user group."
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -176,7 +176,7 @@ namespace IronIntel.Contractor
|
||||
if (flag)
|
||||
{
|
||||
SystemParams.WriteLog("ERROR", "SaveUser", "user try to edit user with illegal permission.", string.Format("current user: {0}, {1}", CurrentUserIID, CurrentUserName));
|
||||
return ResManager.GetLanguage("ERROR_LHBIS_FIC_BLC_BLWORKSPACE_A0034"); // "The user does not have the required access rights.";
|
||||
return ResManager.GetLanguage(ClientLanguage, "ERROR_LHBIS_FIC_BLC_BLWORKSPACE_A0034"); // "The user does not have the required access rights.";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -217,19 +217,19 @@ namespace IronIntel.Contractor
|
||||
|
||||
if (string.IsNullOrWhiteSpace(user.ID))
|
||||
{
|
||||
return ResManager.GetLanguage("LHBIS_FIC_CLIENT_MODULES_USERMANAGERCTRL_A023"); // "User ID cannot be empty.";
|
||||
return ResManager.GetLanguage(ClientLanguage, "LHBIS_FIC_CLIENT_MODULES_USERMANAGERCTRL_A023"); // "User ID cannot be empty.";
|
||||
}
|
||||
if (!reg_email.Match(user.ID).Success && !reg_userid.Match(user.ID).Success)
|
||||
{
|
||||
return ResManager.GetLanguage("LHBIS_FIC_CLIENT_MODULES_USERMANAGERCTRL_A056"); // "The user ID must contain only letters, numbers, underlines, minus signs or an email address.";
|
||||
return ResManager.GetLanguage(ClientLanguage, "LHBIS_FIC_CLIENT_MODULES_USERMANAGERCTRL_A056"); // "The user ID must contain only letters, numbers, underlines, minus signs or an email address.";
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(user.DisplayName))
|
||||
{
|
||||
return ResManager.GetLanguage("LHBIS_FIC_CLIENT_MODULES_USERMANAGERCTRL_A024"); // "User name cannot be empty.";
|
||||
return ResManager.GetLanguage(ClientLanguage, "LHBIS_FIC_CLIENT_MODULES_USERMANAGERCTRL_A024"); // "User name cannot be empty.";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(user.Email) && !reg_email.Match(user.Email).Success)
|
||||
{
|
||||
return ResManager.GetLanguage("LHBIS_FIC_CLIENT_MODULES_USERMANAGERCTRL_A066"); // "Email address is invalid.";
|
||||
return ResManager.GetLanguage(ClientLanguage, "LHBIS_FIC_CLIENT_MODULES_USERMANAGERCTRL_A066"); // "Email address is invalid.";
|
||||
}
|
||||
user.ID = user.ID.Trim();
|
||||
if (user.ID.Length > 100)
|
||||
@ -400,7 +400,7 @@ namespace IronIntel.Contractor
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(group.Name))
|
||||
{
|
||||
return ResManager.GetLanguage("LHBIS_FIC_CLIENT_MODULES_USERADDDIALOG_A004"); // "Group name cannot be empty.";
|
||||
return ResManager.GetLanguage(ClientLanguage, "LHBIS_FIC_CLIENT_MODULES_USERADDDIALOG_A004"); // "Group name cannot be empty.";
|
||||
}
|
||||
|
||||
// users
|
||||
@ -511,7 +511,7 @@ namespace IronIntel.Contractor
|
||||
|
||||
public UserPermissionData[] GetUserOrGroupPermission(string UserOrGroup, string objIID)
|
||||
{
|
||||
return UserManagement.GetUserOrGroupPermission(UserOrGroup, objIID, CurrentUserIID);
|
||||
return UserManagement.GetUserOrGroupPermission(UserOrGroup, objIID, CurrentUserIID, ClientLanguage);
|
||||
}
|
||||
|
||||
#region - System Options -
|
||||
|
27
IronIntelContractorBusiness/InspectionManager.cs
Normal file
27
IronIntelContractorBusiness/InspectionManager.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using Foresight.Fleet.Services.Inspection.Package;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IronIntel.Contractor
|
||||
{
|
||||
public class InspectionManager
|
||||
{
|
||||
public static byte[] GetInspectionPackage(string sessionid, string custid, string pkgid, out string name)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<InspectPackageProvider>();
|
||||
client.SessionID = sessionid;
|
||||
byte[] buffer = client._GetPackageContent(custid, pkgid);
|
||||
if (buffer != null)
|
||||
{
|
||||
var pkg = InspectPackage.FromBuffer(buffer);
|
||||
name = pkg.PackageName + ".ins";
|
||||
return buffer;
|
||||
}
|
||||
name = "";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>IronIntel.Contractor</RootNamespace>
|
||||
<AssemblyName>iicontractorbl</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
@ -31,7 +31,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>LHBIS.snk</AssemblyOriginatorKeyFile>
|
||||
@ -40,21 +40,15 @@
|
||||
<Reference Include="DocumentFormat.OpenXml">
|
||||
<HintPath>..\Reflib\DocumentFormat.OpenXml.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FIASPNETCache">
|
||||
<HintPath>..\Reflib\FIASPNETCache.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FICacheManager.Redis">
|
||||
<HintPath>..\Reflib\FICacheManager.Redis.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FICachManager">
|
||||
<HintPath>..\Reflib\FICachManager.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FICBLC">
|
||||
<HintPath>..\Reflib\FIC\FICBLC.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FICIntf">
|
||||
<HintPath>..\Reflib\FIC\FICIntf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FIChartLib">
|
||||
<HintPath>..\Reflib\FIC\FIChartLib.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>
|
||||
@ -75,49 +69,28 @@
|
||||
<Reference Include="FIWinLib">
|
||||
<HintPath>..\Reflib\FIWinLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FleetClientBase">
|
||||
<HintPath>..\Reflib\FleetClientBase.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FleetServiceClient">
|
||||
<HintPath>..\Reflib\FleetServiceClient.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Foresight.ServiceModel">
|
||||
<HintPath>..\Reflib\Foresight.ServiceModel.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="iisitebase">
|
||||
<HintPath>..\Reflib\iisitebase.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="iisyslib">
|
||||
<HintPath>..\Reflib\iisyslib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ironcontractorwinlib">
|
||||
<HintPath>..\Site\Bin\ironcontractorwinlib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="irondbobjlib">
|
||||
<HintPath>..\Reflib\irondbobjlib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="IronIntel.ServiceModel.Client">
|
||||
<HintPath>..\Reflib\IronIntel.ServiceModel.Client.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="IronIntel.Services.Contractor">
|
||||
<HintPath>..\Site\Bin\IronIntel.Services.Contractor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="IronIntelServiceModel">
|
||||
<HintPath>..\Reflib\IronIntelServiceModel.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="IronIntelSysClient">
|
||||
<HintPath>..\Reflib\IronIntelSysClient.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\Reflib\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.SqlClient, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Data.SqlClient.4.6.0\lib\net461\System.Data.SqlClient.dll</HintPath>
|
||||
<Reference Include="System.Data.SqlClient, Version=4.6.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Data.SqlClient.4.8.1\lib\net461\System.Data.SqlClient.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.IO.Compression.FileSystem" />
|
||||
<Reference Include="System.IO.Compression.ZipFile, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Compression.ZipFile.4.3.0\lib\net46\System.IO.Compression.ZipFile.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
@ -130,16 +103,19 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AttachmentsManagement.cs" />
|
||||
<Compile Include="Attachment\AttachmentItem.cs" />
|
||||
<Compile Include="BusinessBase.cs" />
|
||||
<Compile Include="CacheManager.cs" />
|
||||
<Compile Include="Device\GpsDeviceItem.cs" />
|
||||
<Compile Include="ExportExcel\ImportFromExcel.cs" />
|
||||
<Compile Include="FICSpecialGolbalFilterManager.cs" />
|
||||
<Compile Include="InspectionManager.cs" />
|
||||
<Compile Include="ExportExcelManager.cs" />
|
||||
<Compile Include="ExportExcel\ConvertFormat.cs" />
|
||||
<Compile Include="ExportExcel\ExcelXlsx.cs" />
|
||||
<Compile Include="ExportExcel\ExportToExcel.cs" />
|
||||
<Compile Include="ExportExcel\IOpenXmlExcelStyleAndData.cs" />
|
||||
<Compile Include="ExportExcel\XlsxObj.cs" />
|
||||
<Compile Include="FICExtDataTable\AssetTripsDataTable.cs" />
|
||||
<Compile Include="FICExtDataTable\FleetExtDataTable.cs" />
|
||||
<Compile Include="FITracker\FITrackerManagement.cs" />
|
||||
<Compile Include="FleetServiceClientHelper.cs" />
|
||||
<Compile Include="Host\ClientModels.cs" />
|
||||
@ -149,6 +125,10 @@
|
||||
<Compile Include="Helper.cs" />
|
||||
<Compile Include="Host\HostRequesEntry.cs" />
|
||||
<Compile Include="Host\HostService.cs" />
|
||||
<Compile Include="iisitebase\IronIntelBasePage.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="iisitebase\IronIntelHttpHandlerBase.cs" />
|
||||
<Compile Include="MachineDetailWorkspace.cs" />
|
||||
<Compile Include="Machines\FuelusedInfo.cs" />
|
||||
<Compile Include="Machines\IdlehoursInfo.cs" />
|
||||
@ -160,6 +140,7 @@
|
||||
<Compile Include="Machines\OdometerInfo.cs" />
|
||||
<Compile Include="Maintenance\AlertInfo.cs" />
|
||||
<Compile Include="Maintenance\AlertManager.cs" />
|
||||
<Compile Include="Maintenance\AlertQueryParams.cs" />
|
||||
<Compile Include="Maintenance\FuelRecordInfo.cs" />
|
||||
<Compile Include="Maintenance\IATCAlertsSyncService.cs" />
|
||||
<Compile Include="Maintenance\MaintenanceInfo.cs" />
|
||||
@ -172,8 +153,6 @@
|
||||
<Compile Include="OTRConfig\HarshDrivingItem.cs" />
|
||||
<Compile Include="OTRConfig\HarshDrivingManagement.cs" />
|
||||
<Compile Include="OTRConfig\SpeedingItem.cs" />
|
||||
<Compile Include="Security\CurfewInfo.cs" />
|
||||
<Compile Include="Security\CurfewManagement.cs" />
|
||||
<Compile Include="Security\CurfewMovementToleranceInfo.cs" />
|
||||
<Compile Include="Security\JobsiteLimitInfo.cs" />
|
||||
<Compile Include="Security\JobsiteLimitManagement.cs" />
|
||||
@ -186,10 +165,7 @@
|
||||
<Compile Include="IIColor.cs" />
|
||||
<Compile Include="IronintelHost.cs" />
|
||||
<Compile Include="JobSites\JobSitesManagement.cs" />
|
||||
<Compile Include="MapView\JobManagement.cs" />
|
||||
<Compile Include="MapView\LocationManagement.cs" />
|
||||
<Compile Include="MapView\MachineStateInfo.cs" />
|
||||
<Compile Include="MapView\MachinesMapViewerManagement.cs" />
|
||||
<Compile Include="MapView\MapViewer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SystemParams.cs" />
|
||||
@ -209,6 +185,16 @@
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Connected Services\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\ForesightServices\Service\DataModel\FleetClientBase\FleetClientBase.csproj">
|
||||
<Project>{b0110465-8537-4fe7-bee6-b10faa0ba92d}</Project>
|
||||
<Name>FleetClientBase</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\ForesightServices\Service\DataModel\FleetServiceClient\FleetServiceClient.csproj">
|
||||
<Project>{a872b915-d7f0-4e7f-81e7-742dbb4dbbba}</Project>
|
||||
<Name>FleetServiceClient</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy "$(TargetFileName)" "$(ProjectDir)\..\Site\Bin\$(TargetFileName)"</PostBuildEvent>
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -15,6 +16,12 @@ using IronIntel.Contractor.Users;
|
||||
using FI.FIC.Contracts.DataObjects.Enumeration;
|
||||
using System.Web;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using Foresight.Fleet.Services.Styles;
|
||||
using IronIntel.Contractor.iisitebase;
|
||||
using Foresight.Standard.Units;
|
||||
using Foresight.Standard.Data;
|
||||
using Foresight.Fleet.Services;
|
||||
using FleetUser = Foresight.Fleet.Services.User;
|
||||
|
||||
namespace IronIntel.Contractor
|
||||
{
|
||||
@ -60,10 +67,12 @@ namespace IronIntel.Contractor
|
||||
FICHostEnvironment.SetHost(new IronIntelHost());
|
||||
}
|
||||
|
||||
private ConcurrentDictionary<string, Tuple<FICUserInfo, DateTime>> _Users = new ConcurrentDictionary<string, Tuple<FICUserInfo, DateTime>>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public byte[] GetCacheData(string key, bool ignoreExpired, ref DateTime createTime)
|
||||
{
|
||||
byte[] buffer = CacheManager.GetValue(key);
|
||||
if (buffer == null)
|
||||
if (buffer == null || buffer.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@ -81,10 +90,18 @@ namespace IronIntel.Contractor
|
||||
{
|
||||
return null;
|
||||
}
|
||||
//FIDataTable tb = new FIDataTable();
|
||||
//tb.FillFromBuffer(buffer);
|
||||
//return FIDbAccess.ConvertDataTable(tb);
|
||||
return Deserialize(buffer) as DataTable;
|
||||
using (MemoryStream ms = new MemoryStream(buffer, false))
|
||||
{
|
||||
try
|
||||
{
|
||||
TableReader tr = new TableReader(ms);
|
||||
return tr.Read();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FICCompanyInfo GetCompanyInfo()
|
||||
@ -99,7 +116,7 @@ namespace IronIntel.Contractor
|
||||
|
||||
public CompanyLic GetLicense()
|
||||
{
|
||||
IronIntel.Services.LicenseInfo lic = SystemParams.GetLicense();
|
||||
Foresight.Fleet.Services.Customer.LicenseInfo lic = SystemParams.GetLicense();
|
||||
if (lic == null)
|
||||
{
|
||||
return null;
|
||||
@ -108,7 +125,7 @@ namespace IronIntel.Contractor
|
||||
ci.CompanyID = SystemParams.CompanyID;
|
||||
ci.CompanyName = SystemParams.CustomerDetail.Name;
|
||||
|
||||
Foresight.Security.License.LicenseInfo li = new LicenseInfo();
|
||||
LicenseInfo li = new LicenseInfo();
|
||||
ci.Licenses.Add(li);
|
||||
li.CompanyID = ci.CompanyID;
|
||||
li.CompanyName = ci.CompanyName;
|
||||
@ -131,7 +148,7 @@ namespace IronIntel.Contractor
|
||||
return ci;
|
||||
}
|
||||
|
||||
private LicenseAddtionalPropertyObj ConvertLicenseItem(Services.LicenseItem item)
|
||||
private LicenseAddtionalPropertyObj ConvertLicenseItem(Foresight.Fleet.Services.Customer.LicenseItem item)
|
||||
{
|
||||
if (item == null)
|
||||
return null;
|
||||
@ -184,6 +201,8 @@ namespace IronIntel.Contractor
|
||||
//Mobile = ui.Mobile,
|
||||
Mobile = ui.TextAddress,
|
||||
BusinessPhone = ui.BusinessPhone,
|
||||
UserLanguage = ui.PreferredLanguage,
|
||||
UserTimeZone = ui.TimeZone
|
||||
};
|
||||
switch (ui.UserType)
|
||||
{
|
||||
@ -206,14 +225,29 @@ namespace IronIntel.Contractor
|
||||
return user;
|
||||
}
|
||||
|
||||
const int EXPIRESECONDS = 600;
|
||||
|
||||
public FICUserInfo GetUserByIID(string useriid)
|
||||
{
|
||||
Tuple<FICUserInfo, DateTime> tp = null;
|
||||
_Users.TryGetValue(useriid, out tp);
|
||||
if (tp != null)
|
||||
{
|
||||
TimeSpan sp = DateTime.Now - tp.Item2;
|
||||
if (sp.TotalSeconds < EXPIRESECONDS)
|
||||
{
|
||||
return tp.Item1;
|
||||
}
|
||||
}
|
||||
|
||||
UserInfo ui = UserManagement.GetUserByIID(useriid);
|
||||
if (ui == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return ConvertToFICUserInfo(ui);
|
||||
FICUserInfo u = ConvertToFICUserInfo(ui);
|
||||
_Users[u.IID] = new Tuple<FICUserInfo, DateTime>(u, DateTime.Now);
|
||||
return u;
|
||||
}
|
||||
|
||||
public FICUserInfo GetUserByLoginSessionID(string sessionid)
|
||||
@ -223,41 +257,116 @@ namespace IronIntel.Contractor
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return ConvertToFICUserInfo(ui);
|
||||
|
||||
FICUserInfo u = ConvertToFICUserInfo(ui);
|
||||
_Users[u.IID] = new Tuple<FICUserInfo, DateTime>(u, DateTime.Now);
|
||||
return u;
|
||||
}
|
||||
|
||||
public FICUserInfo GetUserByUserID(string userId)
|
||||
{
|
||||
Tuple<FICUserInfo, DateTime>[] users = _Users.Values.ToArray();
|
||||
Tuple<FICUserInfo, DateTime> tp = null;
|
||||
foreach (var user in users)
|
||||
{
|
||||
if (string.Equals(userId, user.Item1.ID, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
tp = user;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tp != null)
|
||||
{
|
||||
TimeSpan sp = DateTime.Now - tp.Item2;
|
||||
if (sp.TotalSeconds < EXPIRESECONDS)
|
||||
{
|
||||
return tp.Item1;
|
||||
}
|
||||
}
|
||||
|
||||
UserInfo ui = UserManagement.GetUserByID(userId);
|
||||
if (ui == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return ConvertToFICUserInfo(ui);
|
||||
FICUserInfo u = ConvertToFICUserInfo(ui);
|
||||
_Users[u.IID] = new Tuple<FICUserInfo, DateTime>(u, DateTime.Now);
|
||||
return u;
|
||||
}
|
||||
|
||||
ConcurrentDictionary<string, FICUserInfo> _ForesightUsers = new ConcurrentDictionary<string, FICUserInfo>(StringComparer.OrdinalIgnoreCase);
|
||||
DateTime _LastRefreshForesightUsers = DateTime.MinValue;
|
||||
DateTime _LastGetAllUsersTime = DateTime.MinValue;
|
||||
|
||||
public FICUserInfo[] GetUsers()
|
||||
{
|
||||
UserInfo[] users = UserManagement.GetUsers();
|
||||
List<FICUserInfo> ls = new List<FICUserInfo>(users.Length);
|
||||
foreach (UserInfo ui in users)
|
||||
TimeSpan sp = DateTime.Now - _LastGetAllUsersTime;
|
||||
if (sp.TotalSeconds >= EXPIRESECONDS)
|
||||
{
|
||||
ls.Add(ConvertToFICUserInfo(ui));
|
||||
UserInfo[] users = UserManagement.GetUsers();
|
||||
foreach (UserInfo ui in users)
|
||||
{
|
||||
FICUserInfo u = ConvertToFICUserInfo(ui);
|
||||
_Users[u.IID] = new Tuple<FICUserInfo, DateTime>(u, DateTime.Now);
|
||||
}
|
||||
_LastGetAllUsersTime = DateTime.Now;
|
||||
}
|
||||
|
||||
var items = _Users.Values.ToArray();
|
||||
List<FICUserInfo> ls = new List<FICUserInfo>();
|
||||
foreach (var u in items)
|
||||
{
|
||||
ls.Add(u.Item1);
|
||||
}
|
||||
return ls.ToArray();
|
||||
}
|
||||
|
||||
private FICUserInfo[] GetForesightUsers()
|
||||
{
|
||||
TimeSpan sp = DateTime.Now - _LastRefreshForesightUsers;
|
||||
if (sp.TotalSeconds >= EXPIRESECONDS)
|
||||
{
|
||||
UserInfo[] foresightusers = UserManagement.GetForesightUsers();
|
||||
_ForesightUsers.Clear();
|
||||
TimeZoneInfo timezone = SystemParams.GetTimeZoneInfo("Foresight");
|
||||
foreach (var u in foresightusers)
|
||||
{
|
||||
FICUserInfo fu = ConvertToFICUserInfo(u);
|
||||
if (string.IsNullOrWhiteSpace(fu.UserTimeZone))
|
||||
{
|
||||
fu.UserTimeZone = timezone.Id;
|
||||
}
|
||||
_ForesightUsers[fu.IID] = fu;
|
||||
}
|
||||
_LastRefreshForesightUsers = DateTime.Now;
|
||||
}
|
||||
return _ForesightUsers.Values.ToArray();
|
||||
}
|
||||
|
||||
public FICUserInfo[] GetUsers(bool hasAdmin)
|
||||
{
|
||||
if (!hasAdmin)
|
||||
{
|
||||
return GetUsers();
|
||||
}
|
||||
|
||||
FICUserInfo[] localusers = GetUsers();
|
||||
FICUserInfo[] foresightusers = GetForesightUsers();
|
||||
List<FICUserInfo> ls = new List<FICUserInfo>();
|
||||
ls.AddRange(localusers);
|
||||
ls.AddRange(foresightusers);
|
||||
return ls.ToArray();
|
||||
}
|
||||
|
||||
public FICUserInfo[] GetSimpleUsers(bool hasAdmin)
|
||||
{
|
||||
return GetUsers(hasAdmin);
|
||||
}
|
||||
|
||||
public string GetUserEmail(string useriid)
|
||||
{
|
||||
UserInfo ui = UserManagement.GetUserByIID(useriid);
|
||||
if (ui == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ui.ID;
|
||||
}
|
||||
FICUserInfo u = GetUserByIID(useriid);
|
||||
return u == null ? null : u.ID;
|
||||
}
|
||||
|
||||
public void PostMessage(int category, string msg)
|
||||
@ -302,7 +411,7 @@ namespace IronIntel.Contractor
|
||||
CacheManager.SetValue(key, tmp, TimeSpan.FromSeconds(expirationsecond));
|
||||
}
|
||||
|
||||
public void SetCacheDataTable(string key, DataTable dt, int expirationsecond, bool slidingExpiration, DateTime createTime)
|
||||
public void SetCacheDataTable(string key, string datatableIID, DataTable dt, int expirationsecond, bool slidingExpiration, DateTime createTime)
|
||||
{
|
||||
if (dt == null)
|
||||
{
|
||||
@ -310,9 +419,18 @@ namespace IronIntel.Contractor
|
||||
}
|
||||
else
|
||||
{
|
||||
//FIDataTable tb = FIDbAccess.ConvertDataTable(dt, -1);
|
||||
byte[] buffer = Serialize(dt, createTime);
|
||||
SetCacheData(key, buffer, expirationsecond, slidingExpiration, createTime);
|
||||
if (dt.Rows.Count > 1000000)
|
||||
{
|
||||
return;
|
||||
}
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
TableWriter tw = TableWriter.Create(dt);
|
||||
tw.Write(ms);
|
||||
ms.Position = 0;
|
||||
byte[] buffer = ms.ToArray();
|
||||
SetCacheData(key, buffer, expirationsecond, slidingExpiration, createTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -323,7 +441,7 @@ namespace IronIntel.Contractor
|
||||
|
||||
public void WriteLog(string logType, string category, string source, string message, string detail)
|
||||
{
|
||||
SystemParams.WriteLog(logType, category, source, message, detail);
|
||||
SystemParams.WriteLog(logType, "FIC", source, message, detail);
|
||||
}
|
||||
|
||||
public List<string> GetUserGroupIDByUserIID(string userIID)
|
||||
@ -331,30 +449,12 @@ namespace IronIntel.Contractor
|
||||
return UserManagement.GetUserGroupIDByUserIID(userIID);
|
||||
}
|
||||
|
||||
public FICUserInfo[] GetUsers(bool hasAdmin)
|
||||
{
|
||||
if (!hasAdmin)
|
||||
{
|
||||
return GetUsers();
|
||||
}
|
||||
|
||||
UserInfo[] localusers = UserManagement.GetUsers();
|
||||
UserInfo[] foresightusers = UserManagement.GetForesightUsers();
|
||||
UserInfo[] users = localusers.Union(foresightusers).ToArray();
|
||||
List<FICUserInfo> ls = new List<FICUserInfo>(users.Length);
|
||||
foreach (UserInfo ui in users)
|
||||
{
|
||||
//if (ui.UserType == UserTypes.Admin)
|
||||
//{
|
||||
ls.Add(ConvertToFICUserInfo(ui));
|
||||
//}
|
||||
}
|
||||
return ls.ToArray();
|
||||
}
|
||||
|
||||
|
||||
public LoginContext GetCurrentLoginContext(HttpContext context)
|
||||
{
|
||||
string session = Site.IronIntelBasePage.GetLoginSessionID(context.Request);
|
||||
string session = IronIntelBasePage.GetLoginSessionID(context.Request);
|
||||
if (string.IsNullOrWhiteSpace(session))
|
||||
{
|
||||
return null;
|
||||
@ -415,6 +515,28 @@ namespace IronIntel.Contractor
|
||||
get { return string.Empty; }
|
||||
}
|
||||
|
||||
public PlatForms HostPlatForm
|
||||
{
|
||||
get { return PlatForms.Fleet; }
|
||||
}
|
||||
|
||||
public string DefaultLanguageId
|
||||
{
|
||||
get
|
||||
{
|
||||
string lg = SystemParams.CustomerDetail.LanguageId;
|
||||
return string.IsNullOrWhiteSpace(lg) ? "en-us" : lg;
|
||||
}
|
||||
}
|
||||
|
||||
public KeyValuePair<string, string>[] SupportedLanguages
|
||||
{
|
||||
get
|
||||
{
|
||||
return Foresight.Fleet.Services.CountryAndRegionCode.SupportedLanguages;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetStyleDefines(string useriid)
|
||||
{
|
||||
//StringBuilder s = new StringBuilder();
|
||||
@ -425,7 +547,7 @@ namespace IronIntel.Contractor
|
||||
//s.Append("<Board><Title><Background>#666666</Background><Foreground>#777777</Foreground></Title></Board>");
|
||||
//s.Append("</root>");
|
||||
//return s.ToString();
|
||||
Services.CustUIStyle uistyle = SystemParams.GetUIStyle(useriid);
|
||||
CustUIStyle uistyle = SystemParams.GetUIStyle(useriid);
|
||||
|
||||
StringBuilder s = new StringBuilder();
|
||||
s.Append(@"<?xml version=""1.0"" encoding=""UTF-8""?>");
|
||||
@ -441,20 +563,7 @@ namespace IronIntel.Contractor
|
||||
return SystemParams.GetAdditionalParameter();
|
||||
}
|
||||
|
||||
public FICUserInfo[] GetSimpleUsers(bool hasAdmin)
|
||||
{
|
||||
var users = GetUsers(hasAdmin);
|
||||
List<FICUserInfo> ls = new List<FICUserInfo>();
|
||||
foreach (var user in users)
|
||||
{
|
||||
var us = new FICUserInfo();
|
||||
us.IID = user.IID;
|
||||
us.ID = user.ID;
|
||||
us.DisplayName = user.DisplayName;
|
||||
ls.Add(us);
|
||||
}
|
||||
return ls.ToArray();
|
||||
}
|
||||
|
||||
|
||||
public SpecialDatabaseConnectionInfo[] GetSpecialDatabaseConnections()
|
||||
{
|
||||
@ -542,6 +651,170 @@ namespace IronIntel.Contractor
|
||||
return SystemParams.GetCompanyLOGO(SystemParams.CompanyID);
|
||||
}
|
||||
|
||||
public AreaUnits GetAreaUnit()
|
||||
{
|
||||
var cust = SystemParams.CustomerDetail;
|
||||
if (cust != null)
|
||||
{
|
||||
return cust.AreaUnit;
|
||||
}
|
||||
else
|
||||
{
|
||||
return AreaUnits.Acre;
|
||||
}
|
||||
}
|
||||
|
||||
public DistanceUnits GetDistanceUnit()
|
||||
{
|
||||
var cust = SystemParams.CustomerDetail;
|
||||
if (cust != null)
|
||||
{
|
||||
return cust.OdometerUnit;
|
||||
}
|
||||
else
|
||||
{
|
||||
return DistanceUnits.Kilometres;
|
||||
}
|
||||
}
|
||||
|
||||
public SpeedUnits GetSpeedUnit()
|
||||
{
|
||||
DistanceUnits du = GetDistanceUnit();
|
||||
switch (du)
|
||||
{
|
||||
case DistanceUnits.Kilometres: return SpeedUnits.KPH;
|
||||
case DistanceUnits.Metres: return SpeedUnits.MetersPerSecond;
|
||||
case DistanceUnits.Miles: return SpeedUnits.MPH;
|
||||
default:
|
||||
return SpeedUnits.KPH;
|
||||
}
|
||||
}
|
||||
|
||||
public VolumnUnits GetVolumnUnit()
|
||||
{
|
||||
var cust = SystemParams.CustomerDetail;
|
||||
if (cust != null)
|
||||
{
|
||||
return cust.VolumnUnit;
|
||||
}
|
||||
else
|
||||
{
|
||||
return VolumnUnits.Litre;
|
||||
}
|
||||
}
|
||||
|
||||
public WeightUnits GetWeightUnit()
|
||||
{
|
||||
var cust = SystemParams.CustomerDetail;
|
||||
if (cust != null)
|
||||
{
|
||||
return cust.WeightUnit;
|
||||
}
|
||||
else
|
||||
{
|
||||
return WeightUnits.Kilogram;
|
||||
}
|
||||
}
|
||||
|
||||
public SpecialGlobalFilterInfo[] GetSpecialGlobalFilters()
|
||||
{
|
||||
return FICSpecialGolbalFilterManager.GlobalFilters;
|
||||
}
|
||||
|
||||
public object[] GetSpecialGlobalFilterValuesByUser(string useriid, string filterid)
|
||||
{
|
||||
return FICSpecialGolbalFilterManager.GetSpecialGlobalFilterValuesByUser(useriid, filterid);
|
||||
}
|
||||
|
||||
public FilterTemplateInfo[] GetFilterTemplates(string useriid)
|
||||
{
|
||||
return FICSpecialGolbalFilterManager.GetFilterTemplates(useriid);
|
||||
}
|
||||
|
||||
public object[] GetFilterValues(string useriid, int filterid)
|
||||
{
|
||||
return FICSpecialGolbalFilterManager.GetFilterValues(useriid, filterid);
|
||||
}
|
||||
|
||||
public bool CanExportToFile(string useriid)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<FleetUser.UserQueryClient>();
|
||||
var user = client.GetUserByIID(useriid);
|
||||
if (user.UserType < FleetUser.UserTypes.Admin)
|
||||
{
|
||||
var atta = client.GetUserAdditionalAttribute(useriid);
|
||||
if (atta != null)
|
||||
return atta.ExcelExports;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void WriteExportAuditTrail(string useriid, string doctype, string docid, string notes, string filename, string filetype, byte[] filedata)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<DocCommentProvider>();
|
||||
client.DocumentExportAuditTrail(SystemParams.CompanyID, useriid, doctype, docid, notes, filename, filetype, filedata);
|
||||
}
|
||||
|
||||
private static bool IsValidPhoneNumber(string number)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(number))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string s1 = number.Replace(" ", string.Empty)
|
||||
.Replace("(", string.Empty)
|
||||
.Replace(")", string.Empty)
|
||||
.Replace("-", string.Empty);
|
||||
|
||||
if(string.IsNullOrWhiteSpace(s1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (char c in s1)
|
||||
{
|
||||
if (c < '0' || c > '9')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public long SendSMS(string source, string sourceid, string sendingnumber, string receiverphonenumber, string message, string sender)
|
||||
{
|
||||
if(!IsValidPhoneNumber(sendingnumber))
|
||||
{
|
||||
throw new Exception("Invalid phone number: " + sendingnumber);
|
||||
}
|
||||
if(!IsValidPhoneNumber(receiverphonenumber))
|
||||
{
|
||||
throw new Exception("Invalid phone number: " + receiverphonenumber);
|
||||
}
|
||||
var client = FleetServiceClientHelper.CreateClient<SystemUtil>();
|
||||
return client.SendSMS(SystemParams.CompanyID, source, sourceid, sendingnumber, receiverphonenumber, message, sender);
|
||||
}
|
||||
|
||||
public int GetSMSStatus(long smsid)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<SystemUtil>();
|
||||
return client.GetSMSStatus(SystemParams.CompanyID, smsid);
|
||||
}
|
||||
|
||||
public long SendEMail(MailMessage message)
|
||||
{
|
||||
return SystemParams.SendMail(message);
|
||||
}
|
||||
|
||||
public int GetEmailStatus(long mailid)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<SystemUtil>();
|
||||
return client.GetEmailStatus(SystemParams.CompanyID, mailid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
@ -6,7 +6,6 @@ using Foresight.ServiceModel;
|
||||
using IronIntel.Contractor.Machines;
|
||||
using IronIntel.Contractor.MapView;
|
||||
using IronIntel.Contractor.Shape;
|
||||
using IronIntel.Services.Business.Admin;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@ -21,32 +20,7 @@ namespace IronIntel.Contractor.JobSites
|
||||
{
|
||||
private const string MachineFields = "{0}MACHINEID,{0}MACHINENAME,{0}MAKEID,{0}MODELID,{0}TYPEID,{0}MACHINEICONID,{0}DEVICEID,{0}VIN,{0}MAKEYEAR,{0}NOTES,{0}STATUS,{0}CONTRACTORID,{0}DEALERID,{0}UID,{0}ADDEDON,{0}CUR_LONGITUDE,{0}CUR_LATITUDE,{0}LOCDATE_UTC,{0}ENGINEHOURS,{0}HOURSDATE_UTC,{0}DATASOURCE,{0}HIDE,{0}FUEL_CONSUMED,{0}FUEL_UNITS,{0}FUEL_DATE,{0}ODOMETER,{0}ODODATE_UTC,{0}ODOMETERUOM,{0}FUELCOST,{0}FUELCOSTUOM,{0}MACHINERATE,{0}WORKTYPE,{0}RETIREMENTHOURS,{0}RETIREMENTODO,{0}ALTITUDE,{0}ALTITUDEUNITS,{0}IDLEHOURSUTC,{0}IDLEHOURS,{0}LOADCOUNTUTC,{0}LOADCOUNT,{0}PAYLOADTOTALUTC,{0}PAYLOADTOTAL,{0}PAYLOADTOTALUNITS,{0}DEFREMAININGUTC,{0}DEFREMAINING,{0}FUELREMAININGUTC,{0}FUELREMAININGPERCENT,{0}MACHINENAME2,{0}ONROAD,{0}LEASESTART,{0}LEASEEND,{0}LEASEHOURS,{0}UNDERCARRIAGEHOURS,{0}ODOSTART2,{0}ISDELETED,{0}DELETEDDATE,{0}ODOSTART2DATASOURCE,{0}LOCDATASOURCE,{0}HOURSDATASOURCE,{0}FUELDATASOURCE,{0}AQUISITIONTYPE,{0}ICONFILENAME,{0}STARTINGENGINEHOURS,{0}DISTANCECALCBY,{0}TELEMATICSENABLED,{0}COSTCENTER,{0}EQCLASS,{0}DESCRIPTION";
|
||||
|
||||
|
||||
public static JobSiteViewItem GetJobSiteByID(string jobsiteid)
|
||||
{
|
||||
const string sql = @"select JOBSITEID,JOBSITENAME,LATITUDE,LONGITUDE,RADIUS,RADUIS_UOM,CONTRACTORID,COLOR,NOTES,STARTDATE,ENDDATE,POLYGON,BASEONMACHINEID,ISDELETED from JOBSITES where JOBSITEID={0}";
|
||||
|
||||
FISqlConnection db = SystemParams.GetDbInstance();
|
||||
DataTable dt = db.GetDataTableBySQL(sql, jobsiteid);
|
||||
|
||||
JobSiteViewItem result = null;
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
result = ConvertToJobSiteViewItem(dt.Rows[0]);
|
||||
MachineViewItem[] msiary = GetJobSiteMachines(Convert.ToInt64(jobsiteid));
|
||||
if (msiary.Count() > 0)
|
||||
{
|
||||
result.Machines = msiary.OrderBy((m) => m.VIN).ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Machines = null;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void RefreshJobsiteAssets(string sessionid, long jobsiteid)
|
||||
{
|
||||
System.Threading.ThreadPool.QueueUserWorkItem((object state) =>
|
||||
@ -59,17 +33,6 @@ namespace IronIntel.Contractor.JobSites
|
||||
}, null);
|
||||
}
|
||||
|
||||
public static void DeleteJobSites(long jobsiteid)
|
||||
{
|
||||
const string SQL = "delete from JOBSITES where JOBSITEID={0}"
|
||||
+ " delete from JOBSITETYPE where JOBSITEID={0}"
|
||||
+ " delete from JOBSITEMACHINES where JOBSITEID={0}"
|
||||
+ " delete from RELATIONSHIP where RELATIONSHIPTYPEID='ContactJobsite' and RELATEDID={0}";
|
||||
FIDbAccess db = SystemParams.GetDbInstance();
|
||||
db.ExecSQL(SQL, jobsiteid);
|
||||
}
|
||||
|
||||
|
||||
public static void AddMachinesToJobSite(JobSiteViewItem jobsite)
|
||||
{
|
||||
if (jobsite != null)
|
||||
@ -82,7 +45,7 @@ namespace IronIntel.Contractor.JobSites
|
||||
string ad = string.Empty;
|
||||
if (jobsite.Machines != null && jobsite.Machines.Length > 0)
|
||||
{
|
||||
string machineids = string.Join(",", jobsite.Machines.Select(m => m.ID));
|
||||
string machineids = string.Join(",", jobsite.Machines.Select(m => m.AssetId));
|
||||
ad = " and MACHINEID not in(" + machineids + ")";
|
||||
}
|
||||
|
||||
@ -97,14 +60,14 @@ namespace IronIntel.Contractor.JobSites
|
||||
|
||||
if (jobsite.Machines != null && jobsite.Machines.Length > 0)
|
||||
{
|
||||
foreach (MachineViewItem mac in jobsite.Machines)
|
||||
foreach (var mac in jobsite.Machines)
|
||||
{
|
||||
if (mac.OnSite)
|
||||
{
|
||||
tran.ExecSQL(SQL_upt, jobsite.ID, mac.ID);
|
||||
tran.ExecSQL(SQL_upt, jobsite.ID, mac.AssetId);
|
||||
}
|
||||
|
||||
tran.ExecSQL(SQL_t, jobsite.ID, mac.ID, mac.VIN, mac.OnSite ? 1 : 0);
|
||||
tran.ExecSQL(SQL_t, jobsite.ID, mac.AssetId, mac.VIN, mac.OnSite ? 1 : 0);
|
||||
}
|
||||
}
|
||||
tran.Commit();
|
||||
@ -113,22 +76,6 @@ namespace IronIntel.Contractor.JobSites
|
||||
|
||||
}
|
||||
|
||||
public static void AddMachineOnSiteToJobSite(FISqlConnection db, long machineid, string vin, int jobsiteid)
|
||||
{
|
||||
const string SQL_t = @"if exists(select 1 from JOBSITEMACHINES where JOBSITEID={0} and MACHINEID={1}) update JOBSITEMACHINES set ONSITE={3}
|
||||
where JOBSITEID={0} and MACHINEID = {1} else insert into JOBSITEMACHINES(JOBSITEID,MACHINEID,VIN,ADDEDON,ONSITE) values({0},{1},{2},getutcdate(),{3})";
|
||||
const string SQL_upt = "update JOBSITEMACHINES set ONSITE=0 where JOBSITEID!={0} and MACHINEID={1}";
|
||||
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
|
||||
db.ExecSQL(SQL_upt, jobsiteid, machineid);
|
||||
if (jobsiteid > 0)
|
||||
db.ExecSQL(SQL_t, jobsiteid, machineid, vin, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static JobSiteViewItem ConvertToJobSiteViewItem(DataRow dr)
|
||||
{
|
||||
JobSiteViewItem js = new JobSiteViewItem();
|
||||
@ -183,356 +130,10 @@ namespace IronIntel.Contractor.JobSites
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
private static string ConvertPointItemToPolygon(PostionItem[] points)
|
||||
{
|
||||
string polygon = string.Empty;
|
||||
if (points == null || points.Length < 0)
|
||||
{
|
||||
return polygon;
|
||||
}
|
||||
foreach (var pi in points)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(polygon))
|
||||
polygon += pi.Latitude + "," + pi.Longitude;
|
||||
else
|
||||
polygon += ";" + pi.Latitude + "," + pi.Longitude;
|
||||
}
|
||||
return polygon;
|
||||
}
|
||||
|
||||
|
||||
private static MachineViewItem[] GetJobSiteMachines(long JobSiteId)
|
||||
{
|
||||
const string sql_j = @"select jm.MACHINEID,ISNULL(ONSITE,0) ONSITE,m.VIN,m.MACHINENAME,m.MACHINENAME2,m.TYPEID from JOBSITEMACHINES jm left join machines m on jm.MACHINEID=m.MACHINEID where JOBSITEID={0}";
|
||||
FISqlConnection db = SystemParams.GetDbInstance();
|
||||
DataTable dt = null;
|
||||
dt = db.GetDataTableBySQL(sql_j, JobSiteId);
|
||||
|
||||
if (dt.Rows.Count == 0)
|
||||
{
|
||||
return new MachineViewItem[0];
|
||||
}
|
||||
List<MachineViewItem> list = new List<MachineViewItem>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
MachineViewItem mi = new MachineViewItem();
|
||||
mi.ID = FIDbAccess.GetFieldInt64(dr["MACHINEID"], 0);
|
||||
mi.OnSite = FIDbAccess.GetFieldInt(dr["ONSITE"], 0) == 1;
|
||||
mi.Name = FIDbAccess.GetFieldString(dr["MACHINENAME"], string.Empty);
|
||||
mi.Name2 = FIDbAccess.GetFieldString(dr["MACHINENAME2"], string.Empty);
|
||||
mi.VIN = FIDbAccess.GetFieldString(dr["VIN"], string.Empty); ;
|
||||
mi.TypeID = FIDbAccess.GetFieldInt(dr["TYPEID"], 0);
|
||||
list.Add(mi);
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取机器OnSite状态的JobSite
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Dictionary<int, int> GetOnSiteMahcines(FISqlConnection db)
|
||||
{
|
||||
const string SQL_J = "select JOBSITEID,MACHINEID from JOBSITEMACHINES where ONSITE=1";
|
||||
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
DataTable tb = db.GetDataTableBySQL(SQL_J);
|
||||
Dictionary<int, int> result = new Dictionary<int, int>();
|
||||
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
int machineid = FIDbAccess.GetFieldInt(dr["MACHINEID"], 0);
|
||||
int jobsiteid = FIDbAccess.GetFieldInt(dr["JOBSITEID"], 0);
|
||||
result[machineid] = jobsiteid;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取机器OnSite状态的JobSite
|
||||
/// </summary>
|
||||
/// <param name="db"></param>
|
||||
/// <param name="machineid"></param>
|
||||
/// <returns></returns>
|
||||
public static int GetOnSiteByMachineID(FISqlConnection db, long machineid)
|
||||
{
|
||||
const string SQL_J = "select JOBSITEID from JOBSITEMACHINES where ONSITE=1 and MACHINEID={0}";
|
||||
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
DataTable tb = db.GetDataTableBySQL(SQL_J, machineid);
|
||||
int jobsiteid = 0;
|
||||
if (tb.Rows.Count > 0)
|
||||
jobsiteid = FIDbAccess.GetFieldInt(tb.Rows[0]["JOBSITEID"], 0);
|
||||
|
||||
return jobsiteid;
|
||||
}
|
||||
|
||||
#region Machines
|
||||
|
||||
public static AvailableMachines GetMachineViewItemByType(string sessionid, string jobsiteid, string typeid, string searchText, string useriid)
|
||||
{
|
||||
AvailableMachines result = new AvailableMachines();
|
||||
string SQL_J = @"select m.*,js.JOBSITEID,js.JOBSITENAME,js.LATITUDE,js.LONGITUDE,jsm.ADDEDON as JSMADDEDON,ONSITE from MACHINES m
|
||||
left join JOBSITEMACHINES as jsm on m.MACHINEID = jsm.MACHINEID and jsm.ONSITE=1
|
||||
left join JOBSITES as js on js.JOBSITEID= jsm.JOBSITEID";
|
||||
|
||||
const string SQL_L = @"select AssetId as MACHINEID,LATITUDE,LONGITUDE,AsofTime as ASOFTIME_UTC,MOVESTATUS,HEADING, Speed,SpeedUnits,PostedSpeedLimit,SpeedLimitUnits,Street from AssetLocation where IsPrimary=1";
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(typeid))
|
||||
{
|
||||
Regex r = new Regex(@"[a-zA-Z]");
|
||||
if (r.IsMatch(typeid))
|
||||
return result;
|
||||
SQL_J += " and m.TYPEID=" + typeid + "";
|
||||
}
|
||||
|
||||
FIDbAccess db = SystemParams.GetDbInstance();
|
||||
DataTable tb = db.GetDataTableBySQL(SQL_J);
|
||||
if (tb.Rows.Count == 0)
|
||||
{
|
||||
result.Assigned = new MachineViewItem[0];
|
||||
result.Unassigned = new MachineViewItem[0];
|
||||
return result;
|
||||
}
|
||||
|
||||
double timeadjust = SystemParams.GetHoursOffset();
|
||||
DataTable tbl = null;
|
||||
string dbString2 = SystemParams.GetIronIntelReportDataDbString();
|
||||
if (!string.IsNullOrWhiteSpace(dbString2))
|
||||
{
|
||||
var db2 = new FISqlConnection(dbString2);
|
||||
tbl = db2.GetDataTableBySQL(SQL_L);
|
||||
}
|
||||
|
||||
Dictionary<long, LocationViewItem> machineLocations = new Dictionary<long, LocationViewItem>();
|
||||
if (tbl != null && tbl.Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow dr in tbl.Rows)
|
||||
{
|
||||
long mID = FIDbAccess.GetFieldInt64(dr["MACHINEID"], 0);
|
||||
var l = new LocationViewItem();
|
||||
l.Latitude = FIDbAccess.GetFieldDouble(dr["LATITUDE"], 0);
|
||||
l.Longitude = FIDbAccess.GetFieldDouble(dr["LONGITUDE"], 0);
|
||||
l.LocationTime = FIDbAccess.GetFieldDateTime(dr["ASOFTIME_UTC"], DateTime.MinValue);
|
||||
if (l.LocationTime != DateTime.MinValue)
|
||||
l.LocationTime = l.LocationTime.AddHours(timeadjust);
|
||||
|
||||
machineLocations[mID] = l;
|
||||
}
|
||||
}
|
||||
|
||||
long[] availableAssetsids = null;
|
||||
var user = Users.UserManagement.GetUserByIID(useriid);
|
||||
if (user.UserType < Users.UserTypes.Admin)
|
||||
availableAssetsids = FleetServiceClientHelper.CreateClient<AssetQueryClient>(sessionid).GetAvailableAssetsForUsers(SystemParams.CompanyID, useriid);
|
||||
|
||||
MachineManagement.RefreshBaseData();
|
||||
MachineMake[] makes = MachineManagement.GetMachineMakes();
|
||||
MachineModel[] models = MachineManagement.GetMachineModels();
|
||||
MachineType[] types = MachineManagement.GetMachineTypes();
|
||||
|
||||
List<MachineViewItem> assigned = new List<MachineViewItem>();
|
||||
List<MachineViewItem> unassigned = new List<MachineViewItem>();
|
||||
JobSiteViewItem jobsite = GetJobSiteByID(jobsiteid);
|
||||
if (tb.Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
long mid = Convert.ToInt64(dr["MACHINEID"]);
|
||||
if (user.UserType < Users.UserTypes.Admin && !availableAssetsids.Contains(mid))
|
||||
continue;
|
||||
MachineViewItem mi = ConvertToMachineViewItem(dr, makes, models, types, timeadjust);
|
||||
if (machineLocations.ContainsKey(mi.ID))
|
||||
mi.Location = machineLocations[mi.ID];
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchText))
|
||||
{
|
||||
if (!Helper.Contains(mi.VIN, searchText)
|
||||
&& !Helper.Contains(mi.ID.ToString(), searchText)
|
||||
&& !Helper.Contains(mi.Name, searchText)
|
||||
&& !Helper.Contains(mi.Name2, searchText)
|
||||
&& !Helper.Contains(mi.Make, searchText)
|
||||
&& !Helper.Contains(mi.MachineType, searchText)
|
||||
&& !Helper.Contains(mi.Model, searchText))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
mi.JobSiteName = FIDbAccess.GetFieldString(dr["JOBSITENAME"], string.Empty);
|
||||
Postion mPoint = new Postion(mi.Location.Latitude, mi.Location.Longitude);
|
||||
Postion jsPoint = new Postion(jobsite.Latitude, jobsite.Longitude);
|
||||
mi.DistanceFromSite = Foresight.Haversine.GetDistanceKilometers(mPoint, jsPoint);
|
||||
|
||||
if (jobsite.Polygon != null && jobsite.Polygon.Length > 3)//多边形,计算机器是否在Jobsite内
|
||||
mi.WithinSite = Haversine.IsInSide(new Postion(mi.Location.Latitude, mi.Location.Longitude), ConvertToPosition(jobsite.Polygon));//由于FICore.dll中Postion的Longtitude存在拼写错误,在前端容易引起混淆,使用加了PostionItem
|
||||
|
||||
|
||||
if (string.Compare(jobsite.Radius_UOM, "Kilometre", true) != 0)//转换
|
||||
mi.DistanceFromSite = mi.DistanceFromSite * 0.6213712;
|
||||
mi.DistanceFromSite = Math.Round(mi.DistanceFromSite, 2);
|
||||
|
||||
bool hide = FIDbAccess.GetFieldInt(dr["HIDE"], 0) == 1;
|
||||
if (!hide && (dr["JOBSITEID"] is DBNull || string.IsNullOrWhiteSpace(dr["JOBSITEID"].ToString())))
|
||||
unassigned.Add(mi);
|
||||
else
|
||||
assigned.Add(mi);
|
||||
}
|
||||
}
|
||||
if (jobsite.Radius > 0)
|
||||
{
|
||||
result.Assigned = assigned.OrderBy((m) => m.DistanceFromSite).ToArray();
|
||||
result.Unassigned = unassigned.OrderBy((m) => m.DistanceFromSite).ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Assigned = assigned.OrderBy((m) => !m.WithinSite).ThenBy((m) => m.DistanceFromSite).ToArray();
|
||||
result.Unassigned = unassigned.OrderBy((m) => !m.WithinSite).ThenBy((m) => m.DistanceFromSite).ToArray();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取可用于Jobsite 绑定的机器,Calamp和FI Tracker
|
||||
/// </summary>
|
||||
/// <param name="useriid"></param>
|
||||
/// <returns></returns>
|
||||
public static MachineViewItem[] GetBindingMachines(string sessionid, string useriid)
|
||||
{
|
||||
List<MachineViewItem> result = new List<MachineViewItem>();
|
||||
string SQL = @"select " + string.Format(MachineFields, "m.") + @" from MACHINES m order by m.MACHINENAME";
|
||||
|
||||
const string SQL_L = @"select AssetId as MACHINEID,LATITUDE,LONGITUDE,AsofTime as ASOFTIME_UTC,MOVESTATUS,HEADING,Speed,SpeedUnits,PostedSpeedLimit,SpeedLimitUnits,Street from AssetLocation where IsPrimary=1 and Datasource in ('Calamp','FITRACKER')";
|
||||
|
||||
FIDbAccess db = SystemParams.GetDbInstance();
|
||||
DataTable tb = db.GetDataTableBySQL(SQL, useriid);
|
||||
if (tb.Rows.Count == 0)
|
||||
{
|
||||
return new MachineViewItem[0];
|
||||
}
|
||||
|
||||
double timeadjust = SystemParams.GetHoursOffset();
|
||||
DataTable tbl = null;
|
||||
string dbString2 = SystemParams.GetIronIntelReportDataDbString();
|
||||
if (!string.IsNullOrWhiteSpace(dbString2))
|
||||
{
|
||||
var db2 = new FISqlConnection(dbString2);
|
||||
tbl = db2.GetDataTableBySQL(SQL_L);
|
||||
}
|
||||
|
||||
Dictionary<long, LocationViewItem> machineLocations = new Dictionary<long, LocationViewItem>();
|
||||
if (tbl != null && tbl.Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow dr in tbl.Rows)
|
||||
{
|
||||
long mID = FIDbAccess.GetFieldInt64(dr["MACHINEID"], 0);
|
||||
var l = new LocationViewItem();
|
||||
l.Latitude = FIDbAccess.GetFieldDouble(dr["LATITUDE"], 0);
|
||||
l.Longitude = FIDbAccess.GetFieldDouble(dr["LONGITUDE"], 0);
|
||||
l.LocationTime = FIDbAccess.GetFieldDateTime(dr["ASOFTIME_UTC"], DateTime.MinValue);
|
||||
if (l.LocationTime != DateTime.MinValue)
|
||||
l.LocationTime = l.LocationTime.AddHours(timeadjust);
|
||||
|
||||
machineLocations[mID] = l;
|
||||
}
|
||||
}
|
||||
|
||||
long[] availableAssetsids = null;
|
||||
var user = Users.UserManagement.GetUserByIID(useriid);
|
||||
if (user.UserType < Users.UserTypes.Admin)
|
||||
availableAssetsids = FleetServiceClientHelper.CreateClient<AssetQueryClient>(sessionid).GetAvailableAssetsForUsers(SystemParams.CompanyID, useriid);
|
||||
|
||||
MachineManagement.RefreshBaseData();
|
||||
MachineMake[] makes = MachineManagement.GetMachineMakes();
|
||||
MachineModel[] models = MachineManagement.GetMachineModels();
|
||||
MachineType[] types = MachineManagement.GetMachineTypes();
|
||||
|
||||
if (tb.Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
long mid = FIDbAccess.GetFieldInt64(dr["MACHINEID"], 0);
|
||||
if (user.UserType < Users.UserTypes.Admin && !availableAssetsids.Contains(mid))
|
||||
continue;
|
||||
MachineViewItem mi = ConvertToMachineViewItem(dr, makes, models, types, timeadjust);
|
||||
if (machineLocations.ContainsKey(mi.ID))
|
||||
{
|
||||
mi.Location = machineLocations[mi.ID];
|
||||
result.Add(mi);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
private static MachineViewItem ConvertToMachineViewItem(DataRow dr, MachineMake[] makes, MachineModel[] models, MachineType[] types, double timeadjust)
|
||||
{
|
||||
MachineViewItem mi = new MachineViewItem();
|
||||
mi.ID = FIDbAccess.GetFieldInt64(dr["MACHINEID"], 0);
|
||||
mi.Name = FIDbAccess.GetFieldString(dr["MACHINENAME"], string.Empty);
|
||||
mi.Name2 = FIDbAccess.GetFieldString(dr["MACHINENAME2"], string.Empty);
|
||||
mi.VIN = FIDbAccess.GetFieldString(dr["VIN"], string.Empty);
|
||||
mi.MakeYear = FIDbAccess.GetFieldInt(dr["MAKEYEAR"], 0);
|
||||
mi.EngineHours = FIDbAccess.GetFieldDouble(dr["ENGINEHOURS"], 0);
|
||||
mi.EngineHoursDate = FIDbAccess.GetFieldDateTime(dr["HOURSDATE_UTC"], DateTime.MinValue);
|
||||
if (mi.EngineHoursDate != DateTime.MinValue)
|
||||
mi.EngineHoursDate = mi.EngineHoursDate.AddHours(timeadjust);
|
||||
|
||||
mi.Location = new LocationViewItem();
|
||||
mi.Location.Latitude = FIDbAccess.GetFieldDouble(dr["CUR_LATITUDE"], 0);
|
||||
mi.Location.Longitude = FIDbAccess.GetFieldDouble(dr["CUR_LONGITUDE"], 0);
|
||||
mi.Location.LocationTime = FIDbAccess.GetFieldDateTime(dr["LOCDATE_UTC"], DateTime.MinValue);
|
||||
if (mi.Location.LocationTime != DateTime.MinValue)
|
||||
mi.Location.LocationTime = mi.Location.LocationTime.AddHours(timeadjust);
|
||||
|
||||
mi.Odometer = FIDbAccess.GetFieldDouble(dr["ODOMETER"], 0);
|
||||
mi.OdometerUOM = FIDbAccess.GetFieldString(dr["ODOMETERUOM"], string.Empty);
|
||||
|
||||
int makeid = FIDbAccess.GetFieldInt(dr["MAKEID"], 0);
|
||||
MachineMake make = MachineManagement.GetMachineMake(makes, makeid);
|
||||
mi.Make = make == null ? string.Empty : make.Name;
|
||||
|
||||
int modelid = FIDbAccess.GetFieldInt(dr["MODELID"], 0);
|
||||
MachineModel model = MachineManagement.GetMachineModel(models, modelid);
|
||||
mi.Model = model == null ? string.Empty : model.Name;
|
||||
|
||||
int typeid = FIDbAccess.GetFieldInt(dr["TYPEID"], 0);
|
||||
mi.TypeID = typeid;
|
||||
MachineType mtype = MachineManagement.GetMachineType(types, typeid);
|
||||
if (mtype != null)
|
||||
{
|
||||
mi.MachineType = mtype.Name;
|
||||
mi.IconUrl = mtype.IconUrl;
|
||||
}
|
||||
else
|
||||
{
|
||||
mi.MachineType = string.Empty;
|
||||
mi.IconUrl = MachineManagement.DefaultMachineTypeIconUrl;
|
||||
}
|
||||
return mi;
|
||||
}
|
||||
|
||||
private static Foresight.Postion[] ConvertToPosition(PostionItem[] polygon)
|
||||
{
|
||||
if ((polygon == null) || (polygon.Length == 0))
|
||||
{
|
||||
return new Foresight.Postion[0];
|
||||
}
|
||||
List<Foresight.Postion> ls = new List<Postion>(polygon.Length);
|
||||
foreach (var p in polygon)
|
||||
{
|
||||
ls.Add(new Postion(p.Latitude, p.Longitude));
|
||||
}
|
||||
return ls.ToArray();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static MachineTypeItem[] GetMachineTypes()
|
||||
{
|
||||
List<MachineTypeItem> mTypes = new List<MachineTypeItem>();
|
||||
MachineType[] types = MachineManagement.GetMachineTypes();
|
||||
AssetType[] types = MachineManagement.GetMachineTypes();
|
||||
if (types != null)
|
||||
{
|
||||
foreach (var t in types)
|
||||
@ -543,64 +144,6 @@ namespace IronIntel.Contractor.JobSites
|
||||
return mTypes.ToArray();
|
||||
}
|
||||
|
||||
private static Dictionary<long, List<string>> GetJobSiteTypes(FISqlConnection db)
|
||||
{
|
||||
|
||||
const string SQL = "select JOBSITEID,JOBSITETYPE from JOBSITETYPE";
|
||||
|
||||
Dictionary<long, List<string>> result = new Dictionary<long, List<string>>();
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
DataTable tb = db.GetDataTableBySQL(SQL);
|
||||
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
long jobsiteid = FIDbAccess.GetFieldInt64(dr["JOBSITEID"], 0);
|
||||
string type = FIDbAccess.GetFieldString(dr["JOBSITETYPE"], string.Empty);
|
||||
if (!result.ContainsKey(jobsiteid))
|
||||
result[jobsiteid] = new List<string>();
|
||||
result[jobsiteid].Add(type);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void SaveJobSiteTypes(FIDbAccess db, long jobsiteid, string[] types)
|
||||
{
|
||||
const string SQL = "insert into JOBSITETYPE(JOBSITEID,JOBSITETYPE) values({0},{1})";
|
||||
const string SQL_DEL = "delete from JOBSITETYPE where JOBSITEID={0}";
|
||||
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
|
||||
db.ExecSQL(SQL_DEL, jobsiteid);
|
||||
if (types != null)
|
||||
{
|
||||
foreach (string type in types)
|
||||
{
|
||||
db.ExecSQL(SQL, jobsiteid, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static JobSiteViewItem[] GetUserJobsites(string uid)
|
||||
{
|
||||
const string SQL = @"select a.JOBSITEID,JOBSITENAME,LATITUDE,LONGITUDE,RADIUS,RADUIS_UOM,b.CONTRACTORID,COLOR,NOTES,STARTDATE,ENDDATE,POLYGON, BASEONMACHINEID,ISDELETED from USERJOBSITEMAP a,JOBSITES b where a.JOBSITEID=b.JOBSITEID and a.USERIID={0}";
|
||||
|
||||
FISqlConnection db = SystemParams.GetDbInstance();
|
||||
DataTable tb = db.GetDataTableBySQL(SQL, uid);
|
||||
if (tb.Rows.Count == 0)
|
||||
{
|
||||
return new JobSiteViewItem[0];
|
||||
}
|
||||
List<JobSiteViewItem> ls = new List<JobSiteViewItem>();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
JobSiteViewItem js = ConvertToJobSiteViewItem(dr);
|
||||
ls.Add(js);
|
||||
}
|
||||
return ls.ToArray();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从Shape文件导入Jobsite范围
|
||||
/// </summary>
|
||||
@ -610,7 +153,12 @@ namespace IronIntel.Contractor.JobSites
|
||||
public static MapPoint[] ImportJobsitePolygon(string filename, byte[] buffer)
|
||||
{
|
||||
Shape.Shape shape = new Shape.Shape();
|
||||
ShapeFileParser.ParseFromShapeFile(buffer, shape);
|
||||
if (filename.EndsWith(".shp", StringComparison.OrdinalIgnoreCase))
|
||||
ShapeFileParser.ParseFromShapeFile(buffer, shape);
|
||||
else if (filename.EndsWith(".kml", StringComparison.OrdinalIgnoreCase))
|
||||
ShapeFileParser.ParseFromKMLFile(buffer, shape);
|
||||
else if (filename.EndsWith(".kmz", StringComparison.OrdinalIgnoreCase))
|
||||
ShapeFileParser.ParseFromKMZFile(buffer, shape);
|
||||
if (shape.Polygons.Count > 0 && shape.Polygons[0].Rings.Count > 0)
|
||||
{
|
||||
return shape.Polygons[0].Rings[0].Points.ToArray();
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -65,6 +66,8 @@ namespace IronIntel.Contractor.Machines
|
||||
/// 前端选择的时区的分钟偏移
|
||||
/// </summary>
|
||||
public int OffsetMinute { get; set; }
|
||||
public string TimeZone { get; set; }
|
||||
public string DataSource { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@ -82,15 +85,15 @@ namespace IronIntel.Contractor.Machines
|
||||
{
|
||||
get
|
||||
{
|
||||
return AsofTime.ToString("MM/dd/yyyy HH:mm");
|
||||
return AsofTime.ToString("M/d/yyyy h:mm tt");
|
||||
}
|
||||
}
|
||||
public DateTime AsofTime_Local { get; set; }
|
||||
public DateTime AsofTimeLocal { get; set; }
|
||||
public string EventTimeLocalText
|
||||
{
|
||||
get
|
||||
{
|
||||
return AsofTime_Local.ToString("MM/dd/yyyy HH:mm");
|
||||
return AsofTimeLocal.ToString("M/d/yyyy h:mm tt");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -108,15 +111,39 @@ namespace IronIntel.Contractor.Machines
|
||||
{
|
||||
get
|
||||
{
|
||||
return AsofTime.ToString("MM/dd/yyyy HH:mm");
|
||||
return AsofTime.ToString("M/d/yyyy h:mm tt");
|
||||
}
|
||||
}
|
||||
public DateTime AsofTime_Local { get; set; }
|
||||
public DateTime AsofTimeLocal { get; set; }
|
||||
public string EventTimeLocalText
|
||||
{
|
||||
get
|
||||
{
|
||||
return AsofTime_Local.ToString("MM/dd/yyyy HH:mm");
|
||||
return AsofTimeLocal.ToString("M/d/yyyy h:mm tt");
|
||||
}
|
||||
}
|
||||
}
|
||||
public class OEMDD2EngineHoursInfo
|
||||
{
|
||||
public long AssetId { get; set; }
|
||||
public string SN { get; set; }
|
||||
public DateTime AsofTime { get; set; }
|
||||
public string UOM { get; set; }
|
||||
public double Raw { get; set; }
|
||||
public double Calculated { get; set; }
|
||||
public string EventTimeText
|
||||
{
|
||||
get
|
||||
{
|
||||
return AsofTime.ToString("M/d/yyyy h:mm tt");
|
||||
}
|
||||
}
|
||||
public DateTime AsofTimeLocal { get; set; }
|
||||
public string EventTimeLocalText
|
||||
{
|
||||
get
|
||||
{
|
||||
return AsofTimeLocal.ToString("M/d/yyyy h:mm tt");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -125,14 +152,16 @@ namespace IronIntel.Contractor.Machines
|
||||
{
|
||||
public long LogId { get; set; }
|
||||
public long AssetId { get; set; }
|
||||
public string DisplayName { get; set; }//Asset Name
|
||||
public string VIN { get; set; }
|
||||
public DateTime AdjustmentTime { get; set; }
|
||||
public string AdjustmentTimeText { get { return AdjustmentTime.ToString("MM/dd/yyyy HH:mm"); } }
|
||||
public string AdjustmentTimeText { get { return AdjustmentTime.ToString("M/d/yyyy h:mm tt"); } }
|
||||
public DateTime EngineHoursTime { get; set; }
|
||||
public string EngineHoursTimeText { get { return EngineHoursTime.ToString("MM/dd/yyyy HH:mm"); } }
|
||||
public string EngineHoursTimeText { get { return EngineHoursTime.ToString("M/d/yyyy h:mm tt"); } }
|
||||
public DateTime AdjustmentLocalTime { get; set; }
|
||||
public string AdjustmentLocalTimeText { get { return AdjustmentLocalTime.ToString("MM/dd/yyyy HH:mm"); } }
|
||||
public string AdjustmentLocalTimeText { get { return AdjustmentLocalTime.ToString("M/d/yyyy h:mm tt"); } }
|
||||
public DateTime EngineHoursLocalTime { get; set; }
|
||||
public string EngineHoursLocalTimeText { get { return EngineHoursLocalTime.ToString("MM/dd/yyyy HH:mm"); } }
|
||||
public string EngineHoursLocalTimeText { get { return EngineHoursLocalTime.ToString("M/d/yyyy h:mm tt"); } }
|
||||
|
||||
private double _EngineHours;
|
||||
public double EngineHours
|
||||
|
@ -20,6 +20,7 @@ namespace IronIntel.Contractor.Machines
|
||||
public double Amount { get; set; }
|
||||
public double Percent { get; set; }
|
||||
public string UOM { get; set; }
|
||||
public string PercentText { get; set; }
|
||||
public string ReceivedDateStr
|
||||
{
|
||||
get
|
||||
|
@ -1,6 +1,6 @@
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using DocumentFormat.OpenXml.Office2010.CustomUI;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using Foresight.ServiceModel;
|
||||
using IronIntel.Services.Business.Admin;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -9,60 +9,24 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace IronIntel.Contractor.Machines
|
||||
{
|
||||
public class AssetBasicItem
|
||||
public class AssetBasicItem : AssetBasicInfo
|
||||
{
|
||||
public long ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Name2 { get; set; }
|
||||
public string MakeName { get; set; }
|
||||
public string ModelName { get; set; }
|
||||
|
||||
private double _EngineHours;
|
||||
public double EngineHours
|
||||
private const char SPLITCHAR = (char)175;
|
||||
public string AddedTimeStr { get { return (AddedLocalTime == null || AddedLocalTime.Value <= Helper.DBMinDateTime) ? "" : AddedLocalTime.Value.ToShortDateString(); } }
|
||||
public string EngineHoursDateStr { get { return (EngineHoursDate == null || EngineHoursDate.Value <= Helper.DBMinDateTime) ? "" : EngineHoursDate.Value.ToShortDateString(); } }
|
||||
public string EngineHoursDateTimeStr { get { return (EngineHoursDate == null || EngineHoursDate.Value <= Helper.DBMinDateTime) ? "" : EngineHoursDate.Value.ToString(); } }
|
||||
public string OdometerDateStr { get { return (OdometerDate == null || OdometerDate.Value <= Helper.DBMinDateTime) ? "" : OdometerDate.Value.ToShortDateString(); } }
|
||||
public override string ToString()
|
||||
{
|
||||
get
|
||||
{
|
||||
return _EngineHours;
|
||||
}
|
||||
set
|
||||
{
|
||||
value = value > 0 ? value : 0;
|
||||
_EngineHours = Math.Round(value, 2);
|
||||
}
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(base.ToString());
|
||||
sb.Append(SPLITCHAR + AddedTimeStr);
|
||||
sb.Append(SPLITCHAR + EngineHoursDateStr);
|
||||
sb.Append(SPLITCHAR + EngineHoursDateTimeStr);
|
||||
sb.Append(SPLITCHAR + OdometerDateStr);
|
||||
|
||||
public string CalampDeviceAirID { get; set; }
|
||||
public bool TelematicsEnabled { get; set; }
|
||||
public bool Hide { get; set; }
|
||||
public bool OnRoad { get; set; }
|
||||
public int MakeYear { get; set; }
|
||||
public string DealerID { get; set; }
|
||||
public string Dealer { get; set; }
|
||||
public string ContractorID { get; set; }
|
||||
public string Contractor { get; set; }
|
||||
public string TypeName { get; set; }
|
||||
public int ModelID { get; set; }
|
||||
public int TypeID { get; set; }
|
||||
public int MakeID { get; set; }
|
||||
public string VIN { get; set; }
|
||||
public DateTime? EngineHoursDate { get; set; }
|
||||
public string DisplayName
|
||||
{
|
||||
get
|
||||
{
|
||||
//DisplayName取值顺序为Name2,Name,VIN,ID用于前端显示
|
||||
string name = Name2;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
name = Name;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
name = VIN;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
name = ID.ToString();
|
||||
return name;
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
public string EngineHoursDateStr { get { return EngineHoursDate == null ? "" : EngineHoursDate.Value.ToShortDateString(); } }
|
||||
public string EngineHoursDateTimeStr { get { return EngineHoursDate == null ? "" : EngineHoursDate.Value.ToString(); } }
|
||||
}
|
||||
|
||||
|
||||
@ -123,6 +87,9 @@ namespace IronIntel.Contractor.Machines
|
||||
public bool TelematicsEnabled { get; set; }
|
||||
public bool Hidden { get; set; }
|
||||
public bool OnRoad { get; set; }
|
||||
public bool Attachment { get; set; }
|
||||
|
||||
public bool Preloaded { get; set; }
|
||||
public string EQClass { get; set; }
|
||||
public string CostCenter { get; set; }
|
||||
public string AquisitionType { get; set; }
|
||||
@ -133,25 +100,29 @@ namespace IronIntel.Contractor.Machines
|
||||
|
||||
public string ContractorID { get; set; }
|
||||
|
||||
public long OnSiteJobsiteID { get; set; }
|
||||
public string[] OnSiteJobsiteIDs { get; set; }
|
||||
public List<AssetJobsiteInfo> JobSites { get; set; }
|
||||
public string[] ContactIDs { get; set; }
|
||||
public string[] MachineGroupIDs { get; set; }
|
||||
public MachineRentalInfo MachineRental { get; set; }
|
||||
public MachineAttributeClient[] MachineAttributes { get; set; }
|
||||
public StringKeyValue[] VisibleOnWorkOrders { get; set; }
|
||||
public AttachmentAttributeInfo AttachmentInfo { get; set; }
|
||||
public AssetShareStatus ShareStatus { get; set; }
|
||||
public AssetCustomStatus CustomStatus { get; set; }
|
||||
|
||||
|
||||
public string AddedOnStr
|
||||
{
|
||||
get { return AddedLocalTime == null ? "" : AddedLocalTime.Value.ToString("MM/dd/yyyy"); }
|
||||
get { return AddedLocalTime == null ? "" : AddedLocalTime.Value.ToString("M/d/yyyy"); }
|
||||
}
|
||||
public string EngineHoursDateTimeStr
|
||||
{
|
||||
get { return EngineHoursLocalTime == null ? "" : EngineHoursLocalTime.Value.ToString("MM/dd/yyyy"); }
|
||||
get { return EngineHoursLocalTime == null ? "" : EngineHoursLocalTime.Value.ToString("M/d/yyyy"); }
|
||||
}
|
||||
public string OdometerDateTimeStr
|
||||
{
|
||||
get { return OdometerLocalTime == null ? "" : OdometerLocalTime.Value.ToString("MM/dd/yyyy"); }
|
||||
get { return OdometerLocalTime == null ? "" : OdometerLocalTime.Value.ToString("M/d/yyyy"); }
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,7 +218,7 @@ namespace IronIntel.Contractor.Machines
|
||||
public string AddedOnStr { get { return AddedOn == DateTime.MinValue ? "" : AddedOn.ToShortDateString(); } }
|
||||
public string AddedBy { get; set; }
|
||||
public string AddedByName { get; set; }
|
||||
public string ShowName
|
||||
public string DisplayName
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -264,14 +235,6 @@ namespace IronIntel.Contractor.Machines
|
||||
}//由于地图显示及排序的名称
|
||||
}
|
||||
|
||||
public class MachineOffsetItem
|
||||
{
|
||||
public Int64 MachineID { get; set; }
|
||||
public double Value { get; set; }
|
||||
public double Offset { get; set; }
|
||||
public string Notes { get; set; }
|
||||
public OffsetTypes Type { get; set; }
|
||||
}
|
||||
|
||||
public class DeviceItem
|
||||
{
|
||||
@ -294,9 +257,16 @@ namespace IronIntel.Contractor.Machines
|
||||
public long Id { get; set; }
|
||||
public bool Active { get; }
|
||||
public long DeviceID { get; set; }
|
||||
public bool FIInstalltion { get; set; }
|
||||
public string Installer { get; set; }
|
||||
public bool Tamper { get; set; }
|
||||
public bool Utilization { get; set; }
|
||||
public string SalesOrderNumber { get; set; }
|
||||
public string AddDateStr { get { return AddLocalDate == null ? "" : AddLocalDate.Value.ToShortDateString(); } }
|
||||
public string AddDateStr1 { get { return AddLocalDate == null ? "" : AddLocalDate.Value.ToString("M/D/yyyy"); } }
|
||||
public string InvoiceDateStr { get { return InvoiceDate == null ? "" : InvoiceDate.Value.ToShortDateString(); } }
|
||||
public string ServiceStartDateStr { get { return ServiceStartDate == null ? "" : ServiceStartDate.Value.ToShortDateString(); } }
|
||||
public string ServiceStartDateStr1 { get { return ServiceStartDate == null ? "" : ServiceStartDate.Value.ToString("M/D/yyyy"); } }
|
||||
}
|
||||
|
||||
public class PairedAssetItem
|
||||
@ -311,15 +281,30 @@ namespace IronIntel.Contractor.Machines
|
||||
public double? EngineHours { get; set; }
|
||||
public DateTime? EngineHoursDate { get; set; }
|
||||
public DateTime? EngineHoursLocalDate { get; set; }
|
||||
public string EngineHoursDateStr { get { return EngineHoursLocalDate == null ? "" : EngineHoursLocalDate.Value.ToShortDateString(); } }
|
||||
public string EngineHoursDateStr { get { return EngineHoursLocalDate == null ? "" : EngineHoursLocalDate.Value.ToString("M/d/yyyy"); } }
|
||||
}
|
||||
public class CommentItem
|
||||
|
||||
public class CommentItem : Foresight.Fleet.Services.CommentInfo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime SubmitLocalDate { get; set; }
|
||||
public string UserName { get; set; }
|
||||
public string Comment { get; set; }
|
||||
public string SubmitDateStr { get { return SubmitLocalDate == DateTime.MinValue ? "" : SubmitLocalDate.ToString(); } }
|
||||
public string SubmitDateStr { get { return SubmitLocalDate == DateTime.MinValue ? "" : SubmitLocalDate.ToString("M/d/yyyy h:mm tt"); } }
|
||||
|
||||
public void FormatFollowUp()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(FollowUp))
|
||||
{
|
||||
string[] fus = FollowUp.Split(';');
|
||||
for (int i = 0; i < fus.Length; i++)
|
||||
{
|
||||
if (!Helper.IsEmail(fus[i]))
|
||||
fus[i] = Foresight.Standard.PhoneNumber.FormatPhoneNumber(fus[i]);
|
||||
}
|
||||
FollowUp = string.Join(";", fus);
|
||||
}
|
||||
}
|
||||
}
|
||||
public class InstallNotesItemC : Foresight.Fleet.Services.Device.InstallNotesItem
|
||||
{
|
||||
public string InstallTimeLocalStr { get { return InstallTimeLocal == DateTime.MinValue ? "" : InstallTimeLocal.ToString("M/d/yyyy h:mm:ss tt"); } }
|
||||
}
|
||||
|
||||
public class MachineGroup
|
||||
@ -398,15 +383,16 @@ namespace IronIntel.Contractor.Machines
|
||||
|
||||
public class AssetAttachmentItem
|
||||
{
|
||||
public long ID { get; set; }
|
||||
public long AssetId { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public string AddedByUserIID { get; set; }
|
||||
public string AddedByUserName { get; set; }
|
||||
public string Notes { get; set; }
|
||||
public bool VisibleOnWorkOrder { get; set; }
|
||||
public long Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string FileType { get; set; }
|
||||
public DateTime AddedOn { get; set; }
|
||||
public string AddedOnStr { get { return AddedOn.ToString(); } }
|
||||
public byte[] FileData { get; set; }
|
||||
public DateTime AddedOnLocal { get; set; }
|
||||
public string AddedOnLocalStr { get { return AddedOnLocal.ToString(); } }
|
||||
public string AddedBy { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string Description { get; set; }
|
||||
public bool VisibleOnWorkOrder { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -5,9 +5,6 @@ using System.Text;
|
||||
using System.Data;
|
||||
using Foresight.Data;
|
||||
using Foresight.ServiceModel;
|
||||
using IronIntel.Services.Business.Admin;
|
||||
using IronIntel.Services.MapView;
|
||||
using IronIntel.Services.Customers;
|
||||
using IronIntel.Contractor.Maintenance;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
|
||||
@ -15,13 +12,13 @@ namespace IronIntel.Contractor.Machines
|
||||
{
|
||||
public class MachineManagement
|
||||
{
|
||||
private static List<MachineMake> _Makes = new List<MachineMake>();
|
||||
private static List<AssetMake> _Makes = new List<AssetMake>();
|
||||
private static object _sycmakes = new object();
|
||||
|
||||
private static List<MachineType> _MachineTypes = new List<MachineType>();
|
||||
private static List<AssetType> _MachineTypes = new List<AssetType>();
|
||||
private static object _syctypes = new object();
|
||||
|
||||
private static List<MachineModel> _MachineModels = new List<MachineModel>();
|
||||
private static List<AssetModel> _MachineModels = new List<AssetModel>();
|
||||
private static object _sycmodels = new object();
|
||||
|
||||
private const string MachineFields = "{0}MACHINEID,{0}MACHINENAME,{0}MAKEID,{0}MODELID,{0}TYPEID,{0}MACHINEICONID,{0}DEVICEID,{0}VIN,{0}MAKEYEAR,{0}NOTES,{0}STATUS,{0}CONTRACTORID,{0}DEALERID,{0}UID,{0}ADDEDON,{0}CUR_LONGITUDE,{0}CUR_LATITUDE,{0}LOCDATE_UTC,{0}ENGINEHOURS,{0}HOURSDATE_UTC,{0}DATASOURCE,{0}HIDE,{0}FUEL_CONSUMED,{0}FUEL_UNITS,{0}FUEL_DATE,{0}ODOMETER,{0}ODODATE_UTC,{0}ODOMETERUOM,{0}FUELCOST,{0}FUELCOSTUOM,{0}MACHINERATE,{0}WORKTYPE,{0}RETIREMENTHOURS,{0}RETIREMENTODO,{0}ALTITUDE,{0}ALTITUDEUNITS,{0}IDLEHOURSUTC,{0}IDLEHOURS,{0}LOADCOUNTUTC,{0}LOADCOUNT,{0}PAYLOADTOTALUTC,{0}PAYLOADTOTAL,{0}PAYLOADTOTALUNITS,{0}DEFREMAININGUTC,{0}DEFREMAINING,{0}FUELREMAININGUTC,{0}FUELREMAININGPERCENT,{0}MACHINENAME2,{0}ONROAD,{0}LEASESTART,{0}LEASEEND,{0}LEASEHOURS,{0}UNDERCARRIAGEHOURS,{0}ODOSTART2,{0}ISDELETED,{0}DELETEDDATE,{0}ODOSTART2DATASOURCE,{0}LOCDATASOURCE,{0}HOURSDATASOURCE,{0}FUELDATASOURCE,{0}AQUISITIONTYPE,{0}ICONFILENAME,{0}STARTINGENGINEHOURS,{0}DISTANCECALCBY,{0}TELEMATICSENABLED,{0}COSTCENTER,{0}EQCLASS,{0}DESCRIPTION,{0}ADDEDBY";
|
||||
@ -40,11 +37,11 @@ namespace IronIntel.Contractor.Machines
|
||||
|
||||
public static void RefreshMakes()
|
||||
{
|
||||
MachineMake[] mks = null;
|
||||
MachineServiceClient2 mc = SystemParams.GetMachineServiceClient();
|
||||
AssetMake[] mks = null;
|
||||
var acp = FleetServiceClientHelper.CreateClient<AssetClassProvider>();
|
||||
try
|
||||
{
|
||||
mks = mc.GetMachineMakes();
|
||||
mks = acp.GetAssetMakes(string.Empty);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -61,11 +58,12 @@ namespace IronIntel.Contractor.Machines
|
||||
|
||||
public static void RefreshMachineTypes()
|
||||
{
|
||||
MachineType[] mks = null;
|
||||
MachineServiceClient2 mc = SystemParams.GetMachineServiceClient();
|
||||
AssetType[] mks = null;
|
||||
|
||||
var acp = FleetServiceClientHelper.CreateClient<AssetClassProvider>();
|
||||
try
|
||||
{
|
||||
mks = mc.GetMachineTypes();
|
||||
mks = acp.GetAssetTypes(string.Empty);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -82,11 +80,11 @@ namespace IronIntel.Contractor.Machines
|
||||
|
||||
public static void RefreshModels()
|
||||
{
|
||||
MachineModel[] mks = null;
|
||||
MachineServiceClient2 mc = SystemParams.GetMachineServiceClient();
|
||||
AssetModel[] mks = null;
|
||||
var acp = FleetServiceClientHelper.CreateClient<AssetClassProvider>();
|
||||
try
|
||||
{
|
||||
mks = mc.GetMachineModels();
|
||||
mks = acp.GetAssetModels(-1, string.Empty);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -101,7 +99,7 @@ namespace IronIntel.Contractor.Machines
|
||||
}
|
||||
}
|
||||
|
||||
public static MachineMake[] GetMachineMakes()
|
||||
public static AssetMake[] GetMachineMakes()
|
||||
{
|
||||
lock (_sycmakes)
|
||||
{
|
||||
@ -109,7 +107,7 @@ namespace IronIntel.Contractor.Machines
|
||||
}
|
||||
}
|
||||
|
||||
public static MachineType[] GetMachineTypes()
|
||||
public static AssetType[] GetMachineTypes()
|
||||
{
|
||||
lock (_syctypes)
|
||||
{
|
||||
@ -117,7 +115,7 @@ namespace IronIntel.Contractor.Machines
|
||||
}
|
||||
}
|
||||
|
||||
public static MachineModel[] GetMachineModels()
|
||||
public static AssetModel[] GetMachineModels()
|
||||
{
|
||||
lock (_sycmodels)
|
||||
{
|
||||
@ -125,7 +123,7 @@ namespace IronIntel.Contractor.Machines
|
||||
}
|
||||
}
|
||||
|
||||
public static MachineMake GetMachineMake(int makeid)
|
||||
public static AssetMake GetMachineMake(int makeid)
|
||||
{
|
||||
var makes = GetMachineMakes();
|
||||
foreach (var make in makes)
|
||||
@ -153,7 +151,7 @@ namespace IronIntel.Contractor.Machines
|
||||
return make == null ? string.Empty : make.Name;
|
||||
}
|
||||
|
||||
public static MachineModel GetMachineModel(int modelid)
|
||||
public static AssetModel GetMachineModel(int modelid)
|
||||
{
|
||||
var models = GetMachineModels();
|
||||
foreach (var model in models)
|
||||
@ -181,7 +179,7 @@ namespace IronIntel.Contractor.Machines
|
||||
return model == null ? string.Empty : model.Name;
|
||||
}
|
||||
|
||||
public static MachineType GetMachineType(int typeid)
|
||||
public static AssetType GetMachineType(int typeid)
|
||||
{
|
||||
var types = GetMachineTypes();
|
||||
foreach (var mtype in types)
|
||||
@ -209,9 +207,9 @@ namespace IronIntel.Contractor.Machines
|
||||
return mtype == null ? string.Empty : mtype.Name;
|
||||
}
|
||||
|
||||
public static MachineMake GetMachineMake(IEnumerable<MachineMake> makes, int id)
|
||||
public static AssetMake GetMachineMake(IEnumerable<AssetMake> makes, int id)
|
||||
{
|
||||
foreach (MachineMake mk in makes)
|
||||
foreach (AssetMake mk in makes)
|
||||
{
|
||||
if (id == mk.ID)
|
||||
{
|
||||
@ -221,9 +219,9 @@ namespace IronIntel.Contractor.Machines
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MachineType GetMachineType(IEnumerable<MachineType> types, int id)
|
||||
public static AssetType GetMachineType(IEnumerable<AssetType> types, int id)
|
||||
{
|
||||
foreach (MachineType mk in types)
|
||||
foreach (AssetType mk in types)
|
||||
{
|
||||
if (id == mk.ID)
|
||||
{
|
||||
@ -233,9 +231,9 @@ namespace IronIntel.Contractor.Machines
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MachineModel GetMachineModel(IEnumerable<MachineModel> models, int id)
|
||||
public static AssetModel GetMachineModel(IEnumerable<AssetModel> models, int id)
|
||||
{
|
||||
foreach (MachineModel mk in models)
|
||||
foreach (AssetModel mk in models)
|
||||
{
|
||||
if (id == mk.ID)
|
||||
{
|
||||
@ -257,8 +255,8 @@ namespace IronIntel.Contractor.Machines
|
||||
{
|
||||
try
|
||||
{
|
||||
MachineServiceClient2 mc = SystemParams.GetMachineServiceClient();
|
||||
_DefaultMachineTypeIconUrl = mc.GetDefaultMachineTypeIconUrl();
|
||||
var acp = FleetServiceClientHelper.CreateClient<AssetClassProvider>();
|
||||
_DefaultMachineTypeIconUrl = acp.GetDefaultMachineTypeIconUrl();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
@ -267,13 +265,6 @@ namespace IronIntel.Contractor.Machines
|
||||
}
|
||||
}
|
||||
|
||||
public static MachineAlertViewClient GetMachineAlertViewClient()
|
||||
{
|
||||
string[] address = SystemParams.SystemServiceAddresses;
|
||||
MachineAlertViewClient ic = new MachineAlertViewClient(address[0]);
|
||||
return ic;
|
||||
}
|
||||
|
||||
public static bool Contains(string text, string val)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(text))
|
||||
@ -286,117 +277,6 @@ namespace IronIntel.Contractor.Machines
|
||||
}
|
||||
}
|
||||
|
||||
public static void UpdateMachineHideStatus(IEnumerable<Tuple<long, bool>> machines)
|
||||
{
|
||||
const string SQL = "update MACHINES set HIDE={1} where MACHINEID={0}";
|
||||
FISqlConnection db = SystemParams.GetDbInstance();
|
||||
foreach (Tuple<long, bool> mac in machines)
|
||||
{
|
||||
db.ExecSQL(SQL, mac.Item1, mac.Item2 ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static MachineItem GetMachineByID(string sessionid, long machineid, FIDbAccess db = null)
|
||||
{
|
||||
string SQL = "select " + string.Format(MachineFields, "") + " from MACHINES where MACHINEID={0}";
|
||||
|
||||
if (db == null)
|
||||
{
|
||||
db = SystemParams.GetDbInstance();
|
||||
}
|
||||
DataTable tb = db.GetDataTableBySQL(SQL, machineid);
|
||||
if (tb.Rows.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
MachineManagement.RefreshBaseData();
|
||||
MachineMake[] makes = MachineManagement.GetMachineMakes();
|
||||
MachineModel[] models = MachineManagement.GetMachineModels();
|
||||
MachineType[] types = MachineManagement.GetMachineTypes();
|
||||
|
||||
MachineItem mi = null;
|
||||
if (tb.Rows.Count > 0)
|
||||
{
|
||||
mi = ConvertToMachineItem(tb.Rows[0], makes, models, types);
|
||||
mi.AddedOn = FIDbAccess.GetFieldDateTime(tb.Rows[0]["ADDEDON"], DateTime.MinValue).AddHours(SystemParams.GetHoursOffset());
|
||||
mi.AddedBy = FIDbAccess.GetFieldString(tb.Rows[0]["ADDEDBY"], string.Empty);
|
||||
if (!string.IsNullOrEmpty(mi.AddedBy))
|
||||
{
|
||||
var user = Users.UserManagement.GetUserByIID(mi.AddedBy);
|
||||
mi.AddedByName = user == null ? mi.AddedBy : user.DisplayName;
|
||||
}
|
||||
}
|
||||
return mi;
|
||||
}
|
||||
|
||||
public static MachineItem[] GetMachines(string sessionid, string useriid, string searchtxt, string companyid = null)
|
||||
{
|
||||
string SQL = "select " + string.Format(MachineFields, "") + " from MACHINES order by MACHINENAME";
|
||||
|
||||
FIDbAccess db = null;
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
{
|
||||
companyid = SystemParams.CompanyID;
|
||||
db = SystemParams.GetDbInstance();
|
||||
}
|
||||
else
|
||||
{
|
||||
string connetionstring = SystemParams.GetDbStringByCompany(companyid);
|
||||
db = new FISqlConnection(connetionstring);
|
||||
}
|
||||
|
||||
DataTable tb = db.GetDataTableBySQL(SQL);
|
||||
if (tb.Rows.Count == 0)
|
||||
{
|
||||
return new MachineItem[0];
|
||||
}
|
||||
long[] availableAssetsids = null;
|
||||
IronIntel.Contractor.Users.UserInfo user = null;
|
||||
if (!string.IsNullOrWhiteSpace(useriid))
|
||||
{
|
||||
user = Users.UserManagement.GetUserByIID(useriid);
|
||||
if (user.UserType < Users.UserTypes.Admin)
|
||||
availableAssetsids = FleetServiceClientHelper.CreateClient<AssetQueryClient>(companyid, sessionid).GetAvailableAssetsForUsers(companyid, useriid);
|
||||
}
|
||||
|
||||
MachineManagement.RefreshBaseData();
|
||||
MachineMake[] makes = MachineManagement.GetMachineMakes();
|
||||
MachineModel[] models = MachineManagement.GetMachineModels();
|
||||
MachineType[] types = MachineManagement.GetMachineTypes();
|
||||
|
||||
List<MachineItem> ls = new List<MachineItem>();
|
||||
if (tb.Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
long mid = FIDbAccess.GetFieldInt64(dr["MACHINEID"], 0);
|
||||
if (!string.IsNullOrWhiteSpace(useriid) && user.UserType < Users.UserTypes.Admin && !availableAssetsids.Contains(mid))
|
||||
continue;
|
||||
|
||||
MachineItem mi = ConvertToMachineItem(dr, makes, models, types);
|
||||
if (!string.IsNullOrWhiteSpace(searchtxt))
|
||||
{
|
||||
if (Helper.Contains(mi.VIN, searchtxt)
|
||||
|| Helper.Contains(mi.MachineID.ToString(), searchtxt)
|
||||
|| Helper.Contains(mi.Name, searchtxt)
|
||||
|| Helper.Contains(mi.Name2, searchtxt)
|
||||
|| Helper.Contains(mi.Make, searchtxt)
|
||||
|| Helper.Contains(mi.MachineType, searchtxt)
|
||||
|| Helper.Contains(mi.Model, searchtxt))
|
||||
{
|
||||
ls.Add(mi);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ls.Add(mi);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ls.ToArray();
|
||||
}
|
||||
|
||||
|
||||
public static MachineItem[] GetSelectMachinesByRental(string sessionid, string useriid, string searchtxt, string companyid = null)
|
||||
{
|
||||
@ -425,10 +305,10 @@ namespace IronIntel.Contractor.Machines
|
||||
if (user.UserType < Users.UserTypes.Admin)
|
||||
availableAssetsids = FleetServiceClientHelper.CreateClient<AssetQueryClient>(companyid, sessionid).GetAvailableAssetsForUsers(companyid, useriid);
|
||||
|
||||
MachineManagement.RefreshBaseData();
|
||||
MachineMake[] makes = MachineManagement.GetMachineMakes();
|
||||
MachineModel[] models = MachineManagement.GetMachineModels();
|
||||
MachineType[] types = MachineManagement.GetMachineTypes();
|
||||
RefreshBaseData();
|
||||
AssetMake[] makes = GetMachineMakes();
|
||||
AssetModel[] models = GetMachineModels();
|
||||
AssetType[] types = GetMachineTypes();
|
||||
|
||||
List<MachineItem> ls = new List<MachineItem>();
|
||||
if (tb.Rows.Count > 0)
|
||||
@ -461,7 +341,7 @@ namespace IronIntel.Contractor.Machines
|
||||
return ls.ToArray();
|
||||
}
|
||||
|
||||
private static MachineItem ConvertToMachineItem(DataRow dr, MachineMake[] makes, MachineModel[] models, MachineType[] types)
|
||||
private static MachineItem ConvertToMachineItem(DataRow dr, AssetMake[] makes, AssetModel[] models, AssetType[] types)
|
||||
{
|
||||
MachineItem mi = new MachineItem();
|
||||
mi.MachineID = FIDbAccess.GetFieldInt(dr["MACHINEID"], 0);
|
||||
@ -489,15 +369,15 @@ namespace IronIntel.Contractor.Machines
|
||||
mi.RetirementOdo = FIDbAccess.GetFieldDouble(dr["RETIREMENTODO"], 0);
|
||||
|
||||
mi.MakeID = FIDbAccess.GetFieldInt(dr["MAKEID"], 0);
|
||||
MachineMake make = MachineManagement.GetMachineMake(makes, mi.MakeID);
|
||||
AssetMake make = GetMachineMake(makes, mi.MakeID);
|
||||
mi.Make = make == null ? string.Empty : make.Name;
|
||||
|
||||
mi.ModelID = FIDbAccess.GetFieldInt(dr["MODELID"], 0);
|
||||
MachineModel model = MachineManagement.GetMachineModel(models, mi.ModelID);
|
||||
AssetModel model = GetMachineModel(models, mi.ModelID);
|
||||
mi.Model = model == null ? string.Empty : model.Name;
|
||||
|
||||
mi.TypeID = FIDbAccess.GetFieldInt(dr["TYPEID"], 0);
|
||||
MachineType mtype = MachineManagement.GetMachineType(types, mi.TypeID);
|
||||
AssetType mtype = GetMachineType(types, mi.TypeID);
|
||||
mi.MachineType = mtype == null ? string.Empty : mtype.Name;
|
||||
mi.OnRoad = FIDbAccess.GetFieldInt(dr["ONROAD"], 0) == 1;
|
||||
mi.LeaseStart = FIDbAccess.GetFieldDateTime(dr["LEASESTART"], DateTime.MinValue);
|
||||
@ -554,23 +434,6 @@ namespace IronIntel.Contractor.Machines
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void SaveMachineToMachineGroups(FISqlConnection db, long machineid, string[] groupids)
|
||||
{
|
||||
const string SQL = "insert into MACHINEGROUPMAP(MACHINEID,GROUPID) values({0},{1})";
|
||||
const string SQL_DEL = "delete from MACHINEGROUPMAP where MACHINEID={0}";
|
||||
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
db.ExecSQL(SQL_DEL, machineid);
|
||||
if (groupids != null && groupids.Length > 0)
|
||||
{
|
||||
foreach (var groupid in groupids)
|
||||
{
|
||||
db.ExecSQL(SQL, machineid, groupid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int DeleteMachineGroup(string groupID)
|
||||
{
|
||||
const string SQL_Delete = "delete from MACHINEGROUPS where GROUPID={0} delete from MACHINEGROUPMAP where GROUPID={0} ";
|
||||
@ -631,7 +494,7 @@ namespace IronIntel.Contractor.Machines
|
||||
|
||||
public static MachineItem[] GetMachineByGroup(string groupid)
|
||||
{
|
||||
string SQL = "select " + string.Format(MachineFields, "b.") + " from MACHINEGROUPMAP a left join MACHINES b on a.MACHINEID=b.MACHINEID where a.GROUPID={0} order by MACHINENAME";
|
||||
string SQL = "select " + string.Format(MachineFields, "b.") + " from MACHINEGROUPMAP a with(nolock) left join MACHINES b with(nolock) on a.MACHINEID=b.MACHINEID where a.GROUPID={0} order by MACHINENAME";
|
||||
|
||||
FIDbAccess db = SystemParams.GetDbInstance();
|
||||
if (db == null)
|
||||
@ -645,10 +508,10 @@ namespace IronIntel.Contractor.Machines
|
||||
return new MachineItem[0];
|
||||
}
|
||||
|
||||
MachineManagement.RefreshBaseData();
|
||||
MachineMake[] makes = MachineManagement.GetMachineMakes();
|
||||
MachineModel[] models = MachineManagement.GetMachineModels();
|
||||
MachineType[] types = MachineManagement.GetMachineTypes();
|
||||
RefreshBaseData();
|
||||
AssetMake[] makes = GetMachineMakes();
|
||||
AssetModel[] models = GetMachineModels();
|
||||
AssetType[] types = GetMachineTypes();
|
||||
|
||||
List<MachineItem> ls = new List<MachineItem>();
|
||||
if (tb.Rows.Count > 0)
|
||||
@ -664,7 +527,7 @@ namespace IronIntel.Contractor.Machines
|
||||
|
||||
public static MachineGroup[] GetMachineGroupByUser(string useriid, FISqlConnection db = null)
|
||||
{
|
||||
const string SQL = "select b.* from USERMACHINEGROUPMAP a left join MACHINEGROUPS b on a.GROUPID=b.GROUPID where a.USERIID={0} order by GROUPNAME";
|
||||
const string SQL = "select b.* from USERMACHINEGROUPMAP a with(nolock) left join MACHINEGROUPS b with(nolock) on a.GROUPID=b.GROUPID where a.USERIID={0} order by GROUPNAME";
|
||||
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
@ -682,64 +545,23 @@ namespace IronIntel.Contractor.Machines
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
public static void SaveUserMachineGroup(string useriid, string[] groupids)
|
||||
public static AssetType[] GetMachineTypesByUser(string useriid, FISqlConnection db = null)
|
||||
{
|
||||
const string SQL_DeleteDetail = "delete USERMACHINEGROUPMAP where USERIID={0}";
|
||||
const string SQL_InsertDetail = "insert USERMACHINEGROUPMAP(USERIID,GROUPID) values({0},{1})";
|
||||
FISqlConnection db = SystemParams.GetDbInstance();
|
||||
const string SQL = "select b.* from USERMACHINETYPEMAP a with(nolock) left join MACHINE_TYPE b with(nolock) on a.TYPEID=b.TYPEID where a.USERIID={0} order by TYPENAME";
|
||||
|
||||
db.ExecSQL(SQL_DeleteDetail, useriid);
|
||||
if (groupids != null && groupids.Length > 0)
|
||||
{
|
||||
foreach (string gid in groupids)
|
||||
db.ExecSQL(SQL_InsertDetail, useriid, gid);
|
||||
}
|
||||
}
|
||||
|
||||
public static Dictionary<int, List<StringKeyValue>> GetGroupsAssets(FISqlConnection db = null)
|
||||
{
|
||||
const string SQL_C = "select mgm.MACHINEID,mgm.GROUPID,mg.GROUPNAME from MACHINEGROUPMAP mgm left join MACHINEGROUPS mg on mgm.GROUPID=mg.GROUPID";
|
||||
|
||||
Dictionary<int, List<StringKeyValue>> result = new Dictionary<int, List<StringKeyValue>>();
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
DataTable tb = db.GetDataTableBySQL(SQL_C);
|
||||
DataTable dt = db.GetDataTableBySQL(SQL, useriid);
|
||||
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
List<AssetType> result = new List<AssetType>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
int machineid = FIDbAccess.GetFieldInt(dr["MACHINEID"], -1);
|
||||
StringKeyValue kv = new StringKeyValue();
|
||||
kv.Key = FIDbAccess.GetFieldString(dr["GROUPID"], "");
|
||||
kv.Value = FIDbAccess.GetFieldString(dr["GROUPNAME"], ""); ;
|
||||
if (!result.ContainsKey(machineid))
|
||||
result[machineid] = new List<StringKeyValue>();
|
||||
result[machineid].Add(kv);
|
||||
AssetType mg = new AssetType();
|
||||
mg.ID = FIDbAccess.GetFieldInt(dr["TYPEID"], 0);
|
||||
mg.Name = FIDbAccess.GetFieldString(dr["TYPENAME"], "");
|
||||
result.Add(mg);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取机器组和机器的对应关系
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Dictionary<int, List<string>> GetGroupMachines(FISqlConnection db = null)
|
||||
{
|
||||
const string SQL_C = "select MACHINEID,GROUPID from MACHINEGROUPMAP";
|
||||
|
||||
Dictionary<int, List<string>> result = new Dictionary<int, List<string>>();
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
DataTable tb = db.GetDataTableBySQL(SQL_C);
|
||||
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
int machineid = FIDbAccess.GetFieldInt(dr["MACHINEID"], -1);
|
||||
string groupid = FIDbAccess.GetFieldString(dr["GROUPID"], "");
|
||||
if (!result.ContainsKey(machineid))
|
||||
result[machineid] = new List<string>();
|
||||
result[machineid].Add(groupid);
|
||||
}
|
||||
return result;
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -748,7 +570,7 @@ namespace IronIntel.Contractor.Machines
|
||||
/// <returns></returns>
|
||||
public static long[] GetGroupMachines(string[] groupids, FISqlConnection db = null)
|
||||
{
|
||||
const string SQL_C = "select distinct MACHINEID from MACHINEGROUPMAP where GROUPID in ({0})";
|
||||
const string SQL_C = "select distinct MACHINEID from MACHINEGROUPMAP with(nolock) where GROUPID in ({0})";
|
||||
|
||||
List<long> result = new List<long>();
|
||||
if (db == null)
|
||||
@ -763,30 +585,6 @@ namespace IronIntel.Contractor.Machines
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取机器组
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string[] GetGroupByMachineID(FISqlConnection db, long machineid)
|
||||
{
|
||||
const string SQL_C = "select GROUPID from MACHINEGROUPMAP where MACHINEID={0}";
|
||||
|
||||
Dictionary<int, List<string>> result = new Dictionary<int, List<string>>();
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
DataTable tb = db.GetDataTableBySQL(SQL_C, machineid);
|
||||
if (tb.Rows.Count == 0)
|
||||
return new string[0];
|
||||
|
||||
List<string> list = new List<string>();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
string groupid = FIDbAccess.GetFieldString(dr["GROUPID"], "");
|
||||
list.Add(groupid);
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static void ChangeMachineIconFile(long machineid, string filename, byte[] filebyte, FISqlConnection db = null)
|
||||
{
|
||||
const string SQL_NULL = "update MACHINES set ICONFILENAME=null,ICONDATA=null where MACHINEID={0}";
|
||||
@ -800,37 +598,10 @@ namespace IronIntel.Contractor.Machines
|
||||
db.ExecSQL(SQL_ICON, machineid, filename, filebyte);
|
||||
}
|
||||
|
||||
public static byte[] GetMachineIconFile(string companyid, long machineid)
|
||||
{
|
||||
const string SQL = "select ICONDATA from MACHINES where MACHINEID={0}";
|
||||
FISqlConnection db = null;
|
||||
if (SystemParams.IsDealer)
|
||||
{
|
||||
string connetionstring = SystemParams.GetDbStringByCompany(companyid);
|
||||
db = new FISqlConnection(connetionstring);
|
||||
}
|
||||
else
|
||||
db = SystemParams.GetDbInstance();
|
||||
|
||||
object obj = db.GetRC1BySQL(SQL, machineid);
|
||||
return FIDbAccess.GetFieldBytes(obj);
|
||||
}
|
||||
|
||||
public static MachineInfo2 GetMachineByVIN(string vin)
|
||||
{
|
||||
MachineServiceClient2 mc = SystemParams.GetMachineServiceClient();
|
||||
return mc.GetMachineInfoByVIN(vin);
|
||||
}
|
||||
|
||||
public static MachineInfo2 GetMachineByID(long machineid)
|
||||
{
|
||||
MachineServiceClient2 mc = SystemParams.GetMachineServiceClient();
|
||||
return mc.GetMachineInfoByMachineID(machineid);
|
||||
}
|
||||
|
||||
public static string GetMachineIDByVIN(string vin)
|
||||
{
|
||||
const string SQL = "select MACHINEID from MACHINES where VIN={0} and isnull(HIDE,0)=0";
|
||||
const string SQL = "select MACHINEID from MACHINES with(nolock) where VIN={0} and (HIDE is null or HIDE=0)";
|
||||
FISqlConnection db = SystemParams.GetDbInstance();
|
||||
|
||||
object obj = db.GetRC1BySQL(SQL, vin);
|
||||
@ -840,7 +611,7 @@ namespace IronIntel.Contractor.Machines
|
||||
public static MaintenanceMachineInfo[] GetContactMachinesByID(string contactid)
|
||||
{
|
||||
const string SQL = @"select a.MACHINEID,b.MACHINENAME,b.MACHINENAME2,b.VIN,b.MAKEID,b.MODELID,b.TYPEID,b.HIDE,ISNULL(b.ENGINEHOURS,0) as ENGINEHOURS,
|
||||
ISNULL(b.ODOMETER,0) as ODOMETER,ISNULL(b.ODOMETERUOM,'Mile') AS ODOMETERUOM from USERMACHINEMAP a,MACHINES b
|
||||
ISNULL(b.ODOMETER,0) as ODOMETER,ISNULL(b.ODOMETERUOM,'Mile') AS ODOMETERUOM from USERMACHINEMAP a with(nolock),MACHINES b with(nolock)
|
||||
where a.MACHINEID=b.MACHINEID and a.USERIID={0}";
|
||||
|
||||
FISqlConnection db = SystemParams.GetDbInstance();
|
||||
@ -849,10 +620,10 @@ namespace IronIntel.Contractor.Machines
|
||||
{
|
||||
return new MaintenanceMachineInfo[0];
|
||||
}
|
||||
MachineManagement.RefreshBaseData();
|
||||
MachineMake[] makes = MachineManagement.GetMachineMakes();
|
||||
MachineModel[] models = MachineManagement.GetMachineModels();
|
||||
MachineType[] types = MachineManagement.GetMachineTypes();
|
||||
RefreshBaseData();
|
||||
AssetMake[] makes = GetMachineMakes();
|
||||
AssetModel[] models = GetMachineModels();
|
||||
AssetType[] types = GetMachineTypes();
|
||||
List<MaintenanceMachineInfo> ls = new List<MaintenanceMachineInfo>();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
|
@ -30,14 +30,16 @@ namespace IronIntel.Contractor.Machines
|
||||
public string ReturnDateStr { get { return ReturnDate == null ? "" : ReturnDate.Value.ToShortDateString(); } }
|
||||
public string PONumber { get; set; }
|
||||
public string Comments { get; set; }
|
||||
public double InsuredValue { get; set; }
|
||||
|
||||
public DateTime? RentalTermBillingDate { get; set; }
|
||||
public string RentalTermBillingDateStr { get { return RentalTermBillingDate == null ? "" : RentalTermBillingDate.Value.ToShortDateString(); } }
|
||||
public int BillingCycleDays { get; set; }
|
||||
|
||||
public bool Selected { get; set; }
|
||||
public bool Hide { get; set; }
|
||||
|
||||
public string ShowName
|
||||
public string DisplayName
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -83,7 +85,7 @@ namespace IronIntel.Contractor.Machines
|
||||
public string LastUpdateUserName { get; set; }
|
||||
public string LastUpdatedBy { get; set; }
|
||||
public DateTime? LastUpdateDate { get; set; }
|
||||
public string LastUpdateDateStr { get { return LastUpdateDate == null ? "" : LastUpdateDate.Value.ToShortDateString(); } }
|
||||
public string LastUpdateDateStr { get { return LastUpdateDate == null ? "" : LastUpdateDate.Value.ToString("M/d/yyyy h:mm tt"); } }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -80,6 +80,8 @@ namespace IronIntel.Contractor.Machines
|
||||
/// 前端选择的时区的分钟偏移
|
||||
/// </summary>
|
||||
public int OffsetMinute { get; set; }
|
||||
public string TimeZone { get; set; }
|
||||
public string DataSource { get; set; }
|
||||
}
|
||||
public class CalampOdometerInfo
|
||||
{
|
||||
@ -95,15 +97,15 @@ namespace IronIntel.Contractor.Machines
|
||||
{
|
||||
get
|
||||
{
|
||||
return AsofTime.ToString("MM/dd/yyyy HH:mm");
|
||||
return AsofTime.ToString("M/d/yyyy h:mm tt");
|
||||
}
|
||||
}
|
||||
public DateTime AsofTime_Local { get; set; }
|
||||
public DateTime AsofTimeLocal { get; set; }
|
||||
public string EventTimeLocalText
|
||||
{
|
||||
get
|
||||
{
|
||||
return AsofTime_Local.ToString("MM/dd/yyyy HH:mm");
|
||||
return AsofTimeLocal.ToString("M/d/yyyy h:mm tt");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -123,15 +125,41 @@ namespace IronIntel.Contractor.Machines
|
||||
{
|
||||
get
|
||||
{
|
||||
return AsofTime.ToString("MM/dd/yyyy HH:mm");
|
||||
return AsofTime.ToString("M/d/yyyy h:mm tt");
|
||||
}
|
||||
}
|
||||
public DateTime AsofTime_Local { get; set; }
|
||||
public DateTime AsofTimeLocal { get; set; }
|
||||
public string EventTimeLocalText
|
||||
{
|
||||
get
|
||||
{
|
||||
return AsofTime_Local.ToString("MM/dd/yyyy HH:mm");
|
||||
return AsofTimeLocal.ToString("M/d/yyyy h:mm tt");
|
||||
}
|
||||
}
|
||||
}
|
||||
public class SmartWitnessOdometerInfo
|
||||
{
|
||||
public long AssetId { get; set; }
|
||||
public string DeviceSN { get; set; }
|
||||
public DateTime AsofTime { get; set; }
|
||||
public string UOM { get; set; }
|
||||
public double Gps { get; set; }
|
||||
public double Gps_Calc { get; set; }
|
||||
//public double VBUS { get; set; }
|
||||
//public double VBUS_Calc { get; set; }
|
||||
public string EventTimeText
|
||||
{
|
||||
get
|
||||
{
|
||||
return AsofTime.ToString("M/d/yyyy h:mm tt");
|
||||
}
|
||||
}
|
||||
public DateTime AsofTimeLocal { get; set; }
|
||||
public string EventTimeLocalText
|
||||
{
|
||||
get
|
||||
{
|
||||
return AsofTimeLocal.ToString("M/d/yyyy h:mm tt");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -150,14 +178,16 @@ namespace IronIntel.Contractor.Machines
|
||||
{
|
||||
public long LogId { get; set; }
|
||||
public long AssetId { get; set; }
|
||||
public string DisplayName { get; set; }//Asset Name
|
||||
public string VIN { get; set; }
|
||||
public DateTime AdjustmentTime { get; set; }
|
||||
public string AdjustmentTimeText { get { return AdjustmentTime.ToString("MM/dd/yyyy HH:mm"); } }
|
||||
public string AdjustmentTimeText { get { return AdjustmentTime.ToString("M/d/yyyy h:mm tt"); } }
|
||||
public DateTime OdometerTime { get; set; }
|
||||
public string OdometerTimeText { get { return OdometerTime.ToString("MM/dd/yyyy HH:mm"); } }
|
||||
public string OdometerTimeText { get { return OdometerTime.ToString("M/d/yyyy h:mm tt"); } }
|
||||
public DateTime AdjustmentLocalTime { get; set; }
|
||||
public string AdjustmentLocalTimeText { get { return AdjustmentLocalTime.ToString("MM/dd/yyyy HH:mm"); } }
|
||||
public string AdjustmentLocalTimeText { get { return AdjustmentLocalTime.ToString("M/d/yyyy h:mm tt"); } }
|
||||
public DateTime OdometerLocalTime { get; set; }
|
||||
public string OdometerLocalTimeText { get { return OdometerLocalTime.ToString("MM/dd/yyyy HH:mm"); } }
|
||||
public string OdometerLocalTimeText { get { return OdometerLocalTime.ToString("M/d/yyyy h:mm tt"); } }
|
||||
|
||||
private double _Odometer;
|
||||
public double Odometer
|
||||
|
@ -1,6 +1,8 @@
|
||||
using Foresight.Fleet.Services.AssetHealth;
|
||||
using Foresight.Standard;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -9,12 +11,17 @@ namespace IronIntel.Contractor.Maintenance
|
||||
{
|
||||
public class AlertInfo
|
||||
{
|
||||
private const char SPLITCHAR = (char)175;
|
||||
private const char SPLITCHAR1 = (char)181;
|
||||
public long AlertID { get; set; }
|
||||
public long WorkOrderID { get; set; }
|
||||
public string WorkOrderNumber { get; set; }
|
||||
public string WorkOrderStatus { get; set; }
|
||||
public string AlertType { get; set; }
|
||||
public DateTime AlertTime_UTC { get; set; }
|
||||
public string AlertTime_UTCStr { get { return AlertTime_UTC == DateTime.MinValue ? "" : AlertTime_UTC.ToString(); } }
|
||||
public DateTime AlertLocalTime { get; set; }
|
||||
public string AlertLocalTimeStr { get { return AlertLocalTime == DateTime.MinValue ? "" : AlertLocalTime.ToString(); } }
|
||||
public bool Completed { get; set; }
|
||||
public long MachineID { get; set; }
|
||||
public int ModelID { get; set; }
|
||||
@ -51,7 +58,23 @@ namespace IronIntel.Contractor.Maintenance
|
||||
}
|
||||
}
|
||||
public string Description { get; set; }
|
||||
public string ServiceDescription { get; set; }
|
||||
public string FormatDescription(string desc)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(desc))
|
||||
{
|
||||
if (desc.IndexOf("\r\n") > 0)
|
||||
desc = desc.Substring(0, desc.IndexOf("\r\n"));
|
||||
if (desc.IndexOf("\n") > 0)
|
||||
desc = desc.Substring(0, desc.IndexOf("\n"));
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
public string ServiceDescription { get; set; } = "";
|
||||
public string ScheduleID { get; set; }
|
||||
public string IntervalID { get; set; }
|
||||
public bool Recurring { get; set; }
|
||||
public int Priority { get; set; }
|
||||
public double ExpectedCost { get; set; }
|
||||
public int AlertCount { get; set; }
|
||||
public List<long> RepeatedAlerts { get; set; }
|
||||
public int OpenWorkOrderCount { get; set; }//针对Alert对应的机器
|
||||
@ -60,11 +83,68 @@ namespace IronIntel.Contractor.Maintenance
|
||||
public string AcknowledgedByName { get; set; }
|
||||
public DateTime AcknowledgedTime_UTC { get; set; }
|
||||
public string AcknowledgedTime_UTCStr { get { return AcknowledgedTime_UTC == DateTime.MinValue ? "" : AcknowledgedTime_UTC.ToString(); } }
|
||||
public DateTime AcknowledgedTime_Local { get; set; }
|
||||
public string AcknowledgedTime_LocalStr { get { return AcknowledgedTime_Local == DateTime.MinValue ? "" : AcknowledgedTime_Local.ToString(); } }
|
||||
|
||||
public string AcknowledgedComment { get; set; }
|
||||
public string Comment { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
TextableDTO.Append(sb, AlertID);
|
||||
TextableDTO.Append(sb, SPLITCHAR, WorkOrderID);
|
||||
TextableDTO.Append(sb, SPLITCHAR, WorkOrderStatus);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AlertType);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AlertTime_UTC);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AlertTime_UTCStr);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AlertLocalTime);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AlertLocalTimeStr);
|
||||
TextableDTO.Append(sb, SPLITCHAR, Completed ? "1" : "0");
|
||||
TextableDTO.Append(sb, SPLITCHAR, MachineID);
|
||||
TextableDTO.Append(sb, SPLITCHAR, ModelID);
|
||||
TextableDTO.Append(sb, SPLITCHAR, Model);
|
||||
TextableDTO.Append(sb, SPLITCHAR, MakeID);
|
||||
TextableDTO.Append(sb, SPLITCHAR, Make);
|
||||
TextableDTO.Append(sb, SPLITCHAR, VIN);
|
||||
TextableDTO.Append(sb, SPLITCHAR, MachineName);
|
||||
TextableDTO.Append(sb, SPLITCHAR, EngineHours);
|
||||
TextableDTO.Append(sb, SPLITCHAR, CurrentHours);
|
||||
TextableDTO.Append(sb, SPLITCHAR, Description);
|
||||
TextableDTO.Append(sb, SPLITCHAR, ServiceDescription);
|
||||
TextableDTO.Append(sb, SPLITCHAR, ScheduleID);
|
||||
TextableDTO.Append(sb, SPLITCHAR, IntervalID);
|
||||
TextableDTO.Append(sb, SPLITCHAR, Recurring ? "1" : "0");
|
||||
TextableDTO.Append(sb, SPLITCHAR, Priority);
|
||||
TextableDTO.Append(sb, SPLITCHAR, ExpectedCost);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AlertCount);
|
||||
if (RepeatedAlerts != null && RepeatedAlerts.Count > 0)
|
||||
{
|
||||
string repeatedalertsstr = string.Join(SPLITCHAR1.ToString(), RepeatedAlerts);
|
||||
TextableDTO.Append(sb, SPLITCHAR, repeatedalertsstr);
|
||||
}
|
||||
else
|
||||
TextableDTO.Append(sb, SPLITCHAR, "");
|
||||
TextableDTO.Append(sb, SPLITCHAR, OpenWorkOrderCount);
|
||||
TextableDTO.Append(sb, SPLITCHAR, PMType);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AcknowledgedBy);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AcknowledgedByName);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AcknowledgedTime_UTC);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AcknowledgedTime_UTCStr);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AcknowledgedTime_Local);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AcknowledgedTime_LocalStr);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AcknowledgedComment);
|
||||
TextableDTO.Append(sb, SPLITCHAR, WorkOrderNumber);
|
||||
TextableDTO.Append(sb, SPLITCHAR, Comment);
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public class MachineInfoForAlert
|
||||
{
|
||||
private const char SPLITCHAR = (char)182;
|
||||
private const char SPLITCHAR1 = (char)180;
|
||||
public long MachineID { get; set; }
|
||||
public string VIN { get; set; }
|
||||
public string MachineName { get; set; }
|
||||
@ -92,6 +172,39 @@ namespace IronIntel.Contractor.Maintenance
|
||||
public string LatestAlertDateTimeStr { get { return LatestAlertDateTime == DateTime.MinValue ? "" : LatestAlertDateTime.ToString(); } }
|
||||
|
||||
public List<AlertInfo> Alerts { get; } = new List<AlertInfo>();
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
TextableDTO.Append(sb, MachineID);
|
||||
TextableDTO.Append(sb, SPLITCHAR, VIN);
|
||||
TextableDTO.Append(sb, SPLITCHAR, MachineName);
|
||||
TextableDTO.Append(sb, SPLITCHAR, Make);
|
||||
TextableDTO.Append(sb, SPLITCHAR, Model);
|
||||
TextableDTO.Append(sb, SPLITCHAR, EngineHours);
|
||||
TextableDTO.Append(sb, SPLITCHAR, DTCAlertCount);
|
||||
TextableDTO.Append(sb, SPLITCHAR, PMAlertCount);
|
||||
TextableDTO.Append(sb, SPLITCHAR, InspectAlertCount);
|
||||
TextableDTO.Append(sb, SPLITCHAR, OpenWorkOrders);
|
||||
TextableDTO.Append(sb, SPLITCHAR, LatestAlertDateTime);
|
||||
TextableDTO.Append(sb, SPLITCHAR, LatestAlertDateTimeStr);
|
||||
if (Alerts != null && Alerts.Count > 0)
|
||||
{
|
||||
StringBuilder sb1 = new StringBuilder();
|
||||
foreach (AlertInfo ai in Alerts)
|
||||
{
|
||||
if (sb1.Length > 0)
|
||||
sb1.Append(SPLITCHAR1 + ai.ToString());
|
||||
else
|
||||
sb1.Append(ai.ToString());
|
||||
}
|
||||
TextableDTO.Append(sb, SPLITCHAR, sb1.ToString());
|
||||
}
|
||||
else
|
||||
TextableDTO.Append(sb, SPLITCHAR, "");
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public class AssetAlertInfo
|
||||
@ -99,9 +212,22 @@ namespace IronIntel.Contractor.Maintenance
|
||||
public long ID { get; set; }
|
||||
public DateTime AlertTime { get; set; }
|
||||
public string AlertTimeStr { get { return AlertTime == DateTime.MinValue ? "" : AlertTime.ToString(); } }
|
||||
public DateTime AlertLocalTime { get; set; }
|
||||
public string AlertLocalTimeStr { get { return AlertLocalTime == DateTime.MinValue ? "" : AlertLocalTime.ToString(); } }
|
||||
public string AlertType { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string FormatDescription(string desc)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(desc))
|
||||
{
|
||||
if (desc.IndexOf("\r\n") > 0)
|
||||
desc = desc.Substring(0, desc.IndexOf("\r\n"));
|
||||
if (desc.IndexOf("\n") > 0)
|
||||
desc = desc.Substring(0, desc.IndexOf("\n"));
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
public long AssetID { get; set; }
|
||||
public string VIN { get; set; }
|
||||
public string AssetName { get; set; }
|
||||
@ -127,5 +253,6 @@ namespace IronIntel.Contractor.Maintenance
|
||||
public string CompletedDateStr { get { return CompletedDate == null ? "" : CompletedDate.ToString(); } }
|
||||
|
||||
public AssetAlertCategory Category { get; set; }
|
||||
public string ServiceDescription { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -2,14 +2,12 @@
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using Foresight.ServiceModel;
|
||||
using IronIntel.Contractor.Users;
|
||||
using IronIntel.Services.Business.Admin;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static IronIntel.Contractor.MapView.MachinesMapViewerManagement;
|
||||
|
||||
namespace IronIntel.Contractor.Maintenance
|
||||
{
|
||||
@ -19,319 +17,11 @@ namespace IronIntel.Contractor.Maintenance
|
||||
{
|
||||
}
|
||||
|
||||
const string SEL_ALERT = "select ALERTID,ALERTTYPE,ALERTTIME_UTC,COMPLETED,MACHINEID,VIN,MACHINENAME,ENGINGHOURS,ALERTDESC,PMTYPE from ALERTS";
|
||||
|
||||
public MachineInfoForAlert[] SearchMachineAlerts(string sessionid, string filtertext, string[] alertstatus, string[] alerttypes, string[] assetgroups, DateTime beginDate, DateTime endDate, string useriid)
|
||||
{
|
||||
string SQL = @"select a.ALERTID,w.WORKORDERID,wo.STATUS,ALERTTYPE,a.ALERTTIME_UTC,ISNULL(COMPLETED,0) COMPLETED,a.MACHINEID,a.VIN,a.MACHINENAME,a.ENGINGHOURS,m.ENGINEHOURS as CENGINGHOURS,ALERTDESC,m.MACHINENAME2
|
||||
,a.MAKEID,a.MODELID,pit.SERVICEDESCRIPTION
|
||||
,(select count(1) from WORKORDER wo1 where wo1.MACHINEID=a.MACHINEID and wo1.STATUS<>'Completed') as OpenWorkOrderCount,m.ONROAD,a.PMTYPE from ALERTS a with (nolock)
|
||||
left join WORKORDER_ALERTS w with (nolock) on a.ALERTID=w.ALERTID
|
||||
left join WORKORDER wo with (nolock) on w.WORKORDERID=wo.WORKORDERID
|
||||
left join MACHINES m with (nolock) on a.MACHINEID=m.MACHINEID
|
||||
left join PM_ALERTS pa with (nolock) on a.ALERTID=pa.ALERTID
|
||||
left join PM_INTERAVLS pit with (nolock) on pa.PMINTERVALID=pit.PMINTERVALID
|
||||
where m.MACHINEID is not null and (m.HIDE=0 or m.HIDE is null) and ISNULL(ACKNOWLEDGED,0)<>1 and a.ALERTTIME_UTC>={0} and a.ALERTTIME_UTC<={1} ";
|
||||
|
||||
if (Array.IndexOf(alertstatus, "Completed") >= 0 && Array.IndexOf(alertstatus, "Uncompleted") < 0)
|
||||
SQL = SQL + " and ISNULL(COMPLETED,0)=1 ";
|
||||
if (Array.IndexOf(alertstatus, "Completed") < 0 && Array.IndexOf(alertstatus, "Uncompleted") >= 0)
|
||||
SQL = SQL + " and ISNULL(COMPLETED,0)=0 ";
|
||||
if (Array.IndexOf(alertstatus, "Assigned") >= 0 && Array.IndexOf(alertstatus, "Unassigned") < 0)
|
||||
SQL = SQL + " and w.WORKORDERID is not null ";
|
||||
else if (Array.IndexOf(alertstatus, "Assigned") < 0 && Array.IndexOf(alertstatus, "Unassigned") >= 0)
|
||||
SQL = SQL + " and w.WORKORDERID is null ";
|
||||
|
||||
if (assetgroups.Length > 0)//asset group
|
||||
{
|
||||
SQL = SQL + string.Format(" and exists(select 1 from MACHINEGROUPMAP mg where mg.MACHINEID=m.MACHINEID and GROUPID in ('{0}'))", string.Join("','", assetgroups));
|
||||
}
|
||||
|
||||
string SQL_FILTER = SQL + " and (ALERTTYPE like {0} or a.MACHINEID like {0} or a.VIN like {0} or a.MACHINENAME like {0} or m.MACHINENAME2 like {0} or ALERTDESC like {0} or SERVICEDESCRIPTION like {0})";
|
||||
|
||||
string ORDER_BY = " order by ALERTID";
|
||||
|
||||
double timeadjust = SystemParams.GetHoursOffset();
|
||||
if (beginDate != Helper.DBMinDateTime)
|
||||
beginDate = beginDate.AddHours(-timeadjust);
|
||||
if (endDate != DateTime.MaxValue)
|
||||
endDate = endDate.AddHours(-timeadjust);
|
||||
|
||||
DataTable dt = GetDataTableBySQL(SQL + ORDER_BY, beginDate, endDate);
|
||||
if (dt.Rows.Count == 0)
|
||||
{
|
||||
return new MachineInfoForAlert[0];
|
||||
}
|
||||
|
||||
long[] availableAssetsids = null;
|
||||
var user = Users.UserManagement.GetUserByIID(useriid);
|
||||
if (user.UserType < Users.UserTypes.Admin)
|
||||
availableAssetsids = FleetServiceClientHelper.CreateClient<AssetQueryClient>(sessionid).GetAvailableAssetsForUsers(SystemParams.CompanyID, useriid);
|
||||
|
||||
MachineServiceClient2 mc = SystemParams.GetMachineServiceClient();
|
||||
MachineMake[] _makes = mc.GetMachineMakes();
|
||||
MachineModel[] _models = mc.GetMachineModels();
|
||||
|
||||
List<MachineInfoForAlert> results = new List<MachineInfoForAlert>(dt.Rows.Count);
|
||||
Dictionary<string, AssetEngineHour> machineEngineHours = GetAssetEngineHour();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
long mid = FIDbAccess.GetFieldInt64(dr["MACHINEID"], 0);
|
||||
if (user.UserType < Users.UserTypes.Admin && !availableAssetsids.Contains(mid))
|
||||
continue;
|
||||
string alerttype = FIDbAccess.GetFieldString(dr["ALERTTYPE"], string.Empty).Trim();
|
||||
if (alerttypes.Length > 0 && !alerttypes.Contains(alerttype))//alerttype
|
||||
continue;
|
||||
|
||||
AlertInfo ai = ConvertToAlertInfo(dr, timeadjust);
|
||||
|
||||
ai.ServiceDescription = FIDbAccess.GetFieldString(dr["SERVICEDESCRIPTION"], string.Empty);
|
||||
ai.WorkOrderID = FIDbAccess.GetFieldInt(dr["WORKORDERID"], 0);
|
||||
ai.WorkOrderStatus = FIDbAccess.GetFieldString(dr["STATUS"], string.Empty);
|
||||
ai.MakeID = FIDbAccess.GetFieldInt(dr["MAKEID"], 0);
|
||||
ai.ModelID = FIDbAccess.GetFieldInt(dr["MODELID"], 0);
|
||||
string name2 = FIDbAccess.GetFieldString(dr["MACHINENAME2"], string.Empty);
|
||||
string showname = name2;
|
||||
if (string.IsNullOrWhiteSpace(showname))
|
||||
showname = ai.MachineName;
|
||||
if (string.IsNullOrWhiteSpace(showname))
|
||||
showname = ai.VIN;
|
||||
if (string.IsNullOrWhiteSpace(showname))
|
||||
showname = ai.MachineID.ToString();
|
||||
ai.MachineName = showname;
|
||||
|
||||
MachineMake mk = _makes.FirstOrDefault(m => m.ID == ai.MakeID);
|
||||
if (mk != null)
|
||||
ai.Make = mk.Name;
|
||||
MachineModel md = _models.FirstOrDefault(m => m.ID == ai.ModelID);
|
||||
if (md != null)
|
||||
ai.Model = md.Name;
|
||||
|
||||
MachineInfoForAlert mi = results.FirstOrDefault((i) => i.MachineID == ai.MachineID);
|
||||
if (mi == null)
|
||||
{
|
||||
mi = new MachineInfoForAlert();
|
||||
mi.MachineID = ai.MachineID;
|
||||
mi.MachineName = ai.MachineName;
|
||||
mi.VIN = ai.VIN;
|
||||
mi.Make = ai.Make;
|
||||
mi.Model = ai.Model;
|
||||
mi.EngineHours = FIDbAccess.GetFieldDouble(dr["CENGINGHOURS"], 0);// ai.EngineHours;
|
||||
if (machineEngineHours.ContainsKey(mi.MachineID.ToString()))
|
||||
{
|
||||
var meh = machineEngineHours[mi.MachineID.ToString()];
|
||||
mi.EngineHours = meh.EngineHours;
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(filtertext))
|
||||
{
|
||||
if (Helper.Contains(ai.AlertType, filtertext)
|
||||
|| Helper.Contains(ai.MachineID.ToString(), filtertext)
|
||||
|| Helper.Contains(ai.VIN, filtertext)
|
||||
|| Helper.Contains(ai.MachineName, filtertext)
|
||||
|| Helper.Contains(ai.Description, filtertext)
|
||||
//|| Helper.Contains(ai.ServiceDescription, filtertext)
|
||||
|| Helper.Contains(mi.Make, filtertext)
|
||||
|| Helper.Contains(mi.Model, filtertext))
|
||||
results.Add(mi);
|
||||
}
|
||||
else
|
||||
results.Add(mi);
|
||||
}
|
||||
|
||||
if (ai.PMType == "PM_ALERT" || ai.PMType == "TBM_ALERT" || ai.PMType == "HM_ALERT"
|
||||
|| ai.PMType == "RDM_ALERT" || ai.PMType == "ADM_ALERT")
|
||||
mi.PMAlertCount++;
|
||||
else if (ai.AlertType == "Red-Inspect" || ai.AlertType == "Yellow-Inspect" || ai.AlertType == "Info-Inspect")
|
||||
mi.InspectAlertCount++;
|
||||
else
|
||||
mi.DTCAlertCount++;
|
||||
|
||||
AlertInfo oildai = mi.Alerts.FirstOrDefault(m => m.Description == ai.Description && m.MachineID == ai.MachineID);
|
||||
if (oildai == null)
|
||||
{
|
||||
ai.AlertCount = 1;
|
||||
mi.Alerts.Add(ai);
|
||||
}
|
||||
else
|
||||
{
|
||||
ai.AlertCount = oildai.AlertCount;
|
||||
int index = mi.Alerts.IndexOf(oildai);
|
||||
if (ai.AlertTime_UTC > oildai.AlertTime_UTC)
|
||||
{
|
||||
ai.AlertCount++;
|
||||
mi.Alerts[index] = ai;
|
||||
}
|
||||
else
|
||||
mi.Alerts[index].AlertCount++;
|
||||
}
|
||||
mi.OpenWorkOrders = FIDbAccess.GetFieldInt(dr["OpenWorkOrderCount"], 0);
|
||||
//mi.OpenWorkOrders = mi.Alerts.Where(m => m.WorkOrderID != 0 && m.WorkOrderStatus != "Completed").Select(m => m.WorkOrderID).Distinct().Count();
|
||||
var timealerts = mi.Alerts.OrderByDescending(m => m.AlertTime_UTC).ToArray();
|
||||
mi.LatestAlertDateTime = timealerts == null ? DateTime.MinValue : timealerts[0].AlertTime_UTC;
|
||||
}
|
||||
return results.ToArray();
|
||||
}
|
||||
|
||||
public AlertInfo[] SearchAcknowledgedAlerts(string sessionid, string filtertext, string[] alertstatus, string[] alerttypes, string[] assetgroups, DateTime beginDate, DateTime endDate, string useriid)
|
||||
{
|
||||
string SQL = @"select a.ALERTID,w.WORKORDERID,wo.STATUS,ALERTTYPE,a.ALERTTIME_UTC,COMPLETED,a.MACHINEID,a.VIN,a.MACHINENAME, ENGINGHOURS,ALERTDESC,m.MACHINENAME2
|
||||
,a.MAKEID,a.MODELID,pit.SERVICEDESCRIPTION,a.PMTYPE
|
||||
,(select count(1) from WORKORDER wo1 where wo1.MACHINEID=a.MACHINEID and wo1.STATUS<>'Completed') as OpenWorkOrderCount
|
||||
,a.ACKNOWLEDGEDBY,a.ACKNOWLEDGEDDATE_UTC,a.ACKNOWLEDGMENTCOMMENT
|
||||
from ALERTS a with (nolock)
|
||||
left join WORKORDER_ALERTS w with (nolock) on a.ALERTID=w.ALERTID
|
||||
left join WORKORDER wo with (nolock) on w.WORKORDERID=wo.WORKORDERID
|
||||
left join MACHINES m with (nolock) on a.MACHINEID=m.MACHINEID
|
||||
left join PM_ALERTS pa with (nolock) on a.ALERTID=pa.ALERTID
|
||||
left join PM_INTERAVLS pit with (nolock) on pa.PMINTERVALID=pit.PMINTERVALID
|
||||
where m.MACHINEID is not null and (m.HIDE=0 or m.HIDE is null) and ISNULL(ACKNOWLEDGED,0)=1 and a.ALERTTIME_UTC>={0} and a.ALERTTIME_UTC<={1} ";
|
||||
|
||||
if (assetgroups.Length > 0)//asset group
|
||||
{
|
||||
SQL = SQL + string.Format(" and exists(select 1 from MACHINEGROUPMAP mg where mg.MACHINEID=m.MACHINEID and GROUPID in ('{0}'))", string.Join("','", assetgroups));
|
||||
}
|
||||
|
||||
const string ORDER_BY = " order by ALERTID";
|
||||
|
||||
double timeadjust = SystemParams.GetHoursOffset();
|
||||
if (beginDate != Helper.DBMinDateTime)
|
||||
beginDate = beginDate.AddHours(-timeadjust);
|
||||
if (endDate != DateTime.MaxValue)
|
||||
endDate = endDate.AddHours(-timeadjust);
|
||||
|
||||
DataTable dt = GetDataTableBySQL(SQL + ORDER_BY, beginDate, endDate);
|
||||
if (dt.Rows.Count == 0)
|
||||
{
|
||||
return new AlertInfo[0];
|
||||
}
|
||||
|
||||
long[] availableAssetsids = null;
|
||||
var user = Users.UserManagement.GetUserByIID(useriid);
|
||||
if (user.UserType < Users.UserTypes.Admin)
|
||||
availableAssetsids = FleetServiceClientHelper.CreateClient<AssetQueryClient>(sessionid).GetAvailableAssetsForUsers(SystemParams.CompanyID, useriid);
|
||||
|
||||
MachineServiceClient2 mc = SystemParams.GetMachineServiceClient();
|
||||
MachineMake[] _makes = mc.GetMachineMakes();
|
||||
MachineModel[] _models = mc.GetMachineModels();
|
||||
UserInfo[] _users = UserManagement.GetAllAvailableUsers();
|
||||
|
||||
List<AlertInfo> result = new List<AlertInfo>(dt.Rows.Count);
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
long mid = FIDbAccess.GetFieldInt64(dr["MACHINEID"], 0);
|
||||
if (user.UserType < Users.UserTypes.Admin && !availableAssetsids.Contains(mid))
|
||||
continue;
|
||||
string alerttype = FIDbAccess.GetFieldString(dr["ALERTTYPE"], string.Empty).Trim();
|
||||
if (alerttypes.Length > 0 && !alerttypes.Contains(alerttype))//alerttype
|
||||
continue;
|
||||
AlertInfo ai = ConvertToAlertInfo(dr, timeadjust);
|
||||
|
||||
ai.ServiceDescription = FIDbAccess.GetFieldString(dr["SERVICEDESCRIPTION"], string.Empty);
|
||||
ai.WorkOrderID = FIDbAccess.GetFieldInt(dr["WORKORDERID"], 0);
|
||||
ai.WorkOrderStatus = FIDbAccess.GetFieldString(dr["STATUS"], string.Empty);
|
||||
ai.MakeID = FIDbAccess.GetFieldInt(dr["MAKEID"], 0);
|
||||
ai.ModelID = FIDbAccess.GetFieldInt(dr["MODELID"], 0);
|
||||
string name2 = FIDbAccess.GetFieldString(dr["MACHINENAME2"], string.Empty);
|
||||
string showname = name2;
|
||||
if (string.IsNullOrWhiteSpace(showname))
|
||||
showname = ai.MachineName;
|
||||
if (string.IsNullOrWhiteSpace(showname))
|
||||
showname = ai.VIN;
|
||||
if (string.IsNullOrWhiteSpace(showname))
|
||||
showname = ai.MachineID.ToString();
|
||||
ai.MachineName = showname;
|
||||
|
||||
MachineMake mk = _makes.FirstOrDefault(m => m.ID == ai.MakeID);
|
||||
if (mk != null)
|
||||
ai.Make = mk.Name;
|
||||
MachineModel md = _models.FirstOrDefault(m => m.ID == ai.ModelID);
|
||||
if (md != null)
|
||||
ai.Model = md.Name;
|
||||
|
||||
ai.AcknowledgedBy = FIDbAccess.GetFieldString(dr["ACKNOWLEDGEDBY"], string.Empty);
|
||||
ai.AcknowledgedTime_UTC = FIDbAccess.GetFieldDateTime(dr["ACKNOWLEDGEDDATE_UTC"], DateTime.MinValue);
|
||||
if (ai.AcknowledgedTime_UTC != DateTime.MinValue)
|
||||
ai.AcknowledgedTime_UTC = ai.AcknowledgedTime_UTC.AddHours(timeadjust);
|
||||
ai.AcknowledgedComment = FIDbAccess.GetFieldString(dr["ACKNOWLEDGMENTCOMMENT"], string.Empty);
|
||||
if (!string.IsNullOrWhiteSpace(ai.AcknowledgedBy))
|
||||
{
|
||||
UserInfo ui = _users.FirstOrDefault(m => m.IID == ai.AcknowledgedBy);
|
||||
if (ui != null)
|
||||
ai.AcknowledgedByName = ui.DisplayName;
|
||||
}
|
||||
|
||||
ai.OpenWorkOrderCount = FIDbAccess.GetFieldInt(dr["OpenWorkOrderCount"], 0);
|
||||
|
||||
AlertInfo existAlert = result.FirstOrDefault(m => m.Description == ai.Description && m.MachineID == ai.MachineID && m.AcknowledgedComment == ai.AcknowledgedComment);
|
||||
if (existAlert == null)
|
||||
{
|
||||
ai.AlertCount = 1;
|
||||
if (!string.IsNullOrWhiteSpace(filtertext))
|
||||
{
|
||||
if (Helper.Contains(ai.AlertType, filtertext)
|
||||
|| Helper.Contains(ai.MachineID.ToString(), filtertext)
|
||||
|| Helper.Contains(ai.VIN, filtertext)
|
||||
|| Helper.Contains(ai.MachineName, filtertext)
|
||||
|| Helper.Contains(ai.Description, filtertext)
|
||||
//|| Helper.Contains(ai.ServiceDescription, filtertext)
|
||||
|| Helper.Contains(ai.Make, filtertext)
|
||||
|| Helper.Contains(ai.Model, filtertext))
|
||||
result.Add(ai);
|
||||
}
|
||||
else
|
||||
result.Add(ai);
|
||||
}
|
||||
else
|
||||
{
|
||||
existAlert.AlertCount++;
|
||||
if (ai.AlertTime_UTC > existAlert.AlertTime_UTC)
|
||||
existAlert.AlertTime_UTC = ai.AlertTime_UTC;
|
||||
}
|
||||
}
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
|
||||
public StringKeyValue[] GetAlertTypes()
|
||||
{
|
||||
const string SQL = "select distinct ltrim(rtrim(ALERTTYPE)) as ALERTTYPE from ALERTS where ISNULL(ALERTTYPE,'')<>'' order by ALERTTYPE";
|
||||
DataTable tb = GetDataTableBySQL(SQL);
|
||||
if (tb.Rows.Count == 0)
|
||||
{
|
||||
return new StringKeyValue[0];
|
||||
}
|
||||
List<StringKeyValue> list = new List<StringKeyValue>();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
string type = FIDbAccess.GetFieldString(dr["ALERTTYPE"], string.Empty);
|
||||
StringKeyValue kv = new StringKeyValue();
|
||||
kv.Key = type;
|
||||
kv.Value = type;
|
||||
list.Add(kv);
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public AlertInfo[] GetAlertByID(long[] alertid)
|
||||
{
|
||||
if (alertid == null || alertid.Length == 0)
|
||||
return new AlertInfo[0];
|
||||
string SQL = SEL_ALERT + string.Format(" where ALERTID in ({0})", string.Join(",", alertid));
|
||||
DataTable tb = GetDataTableBySQL(SQL);
|
||||
if (tb.Rows.Count == 0)
|
||||
{
|
||||
return new AlertInfo[0];
|
||||
}
|
||||
List<AlertInfo> ls = new List<AlertInfo>(tb.Rows.Count);
|
||||
double timeadjust = SystemParams.GetHoursOffset();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
ls.Add(ConvertToAlertInfo(dr, timeadjust));
|
||||
}
|
||||
return ls.ToArray();
|
||||
}
|
||||
|
||||
public AlertInfo[] GetAlertsByWorkOrder(long workorderid)
|
||||
/// <summary>
|
||||
/// 根据WorkorderId获取Alert列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public AlertInfo[] GetAlertsByWorkOrder(long workorderid, Foresight.Fleet.Services.User.UserInfo user)
|
||||
{
|
||||
const string SQL = @"select a.ALERTID,ALERTTYPE,a.ALERTTIME_UTC,COMPLETED,a.MACHINEID,a.VIN,a.MACHINENAME,a.ENGINGHOURS,a.ALERTDESC,pit.SERVICEDESCRIPTION,a.PMTYPE from ALERTS a
|
||||
left join PM_ALERTS pa on a.ALERTID=pa.ALERTID left join PM_INTERAVLS pit on pa.PMINTERVALID=pit.PMINTERVALID
|
||||
@ -342,77 +32,19 @@ namespace IronIntel.Contractor.Maintenance
|
||||
return new AlertInfo[0];
|
||||
}
|
||||
List<AlertInfo> ls = new List<AlertInfo>(tb.Rows.Count);
|
||||
double timeadjust = SystemParams.GetHoursOffset();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
AlertInfo ai = ConvertToAlertInfo(dr, timeadjust);
|
||||
AlertInfo ai = ConvertToAlertInfo(dr, user);
|
||||
ai.ServiceDescription = FIDbAccess.GetFieldString(dr["SERVICEDESCRIPTION"], string.Empty);
|
||||
ls.Add(ai);
|
||||
}
|
||||
return ls.ToArray();
|
||||
}
|
||||
|
||||
public AlertInfo[] GetAlertsByAlerts(long[] alertids)
|
||||
{
|
||||
const string SQL = SEL_ALERT + " where ALERTID in ({ALERTIDS}) order by ALERTID";
|
||||
|
||||
string gids = "'" + string.Join("','", alertids) + "'";
|
||||
DataTable tb = GetDataTableBySQL(SQL.Replace("{ALERTIDS}", gids));
|
||||
if (tb.Rows.Count == 0)
|
||||
{
|
||||
return new AlertInfo[0];
|
||||
}
|
||||
List<AlertInfo> ls = new List<AlertInfo>(tb.Rows.Count);
|
||||
double timeadjust = SystemParams.GetHoursOffset();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
ls.Add(ConvertToAlertInfo(dr, timeadjust));
|
||||
}
|
||||
return ls.ToArray();
|
||||
}
|
||||
|
||||
public AlertInfo[] GetAlertsByMachineID(long machineid)
|
||||
{
|
||||
const string SQL = SEL_ALERT + " where MACHINEID={0} and ISNULL(COMPLETED,0)=0 and ALERTID not in(select ALERTID from WORKORDER_ALERTS)";
|
||||
|
||||
DataTable tb = GetDataTableBySQL(SQL, machineid);
|
||||
if (tb.Rows.Count == 0)
|
||||
{
|
||||
return new AlertInfo[0];
|
||||
}
|
||||
List<AlertInfo> ls = new List<AlertInfo>(tb.Rows.Count);
|
||||
double timeadjust = SystemParams.GetHoursOffset();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
AlertInfo ai = ConvertToAlertInfo(dr, timeadjust);
|
||||
|
||||
AlertInfo oildai = ls.FirstOrDefault(m => m.Description == ai.Description);
|
||||
if (oildai == null)
|
||||
{
|
||||
ai.AlertCount = 1;
|
||||
ls.Add(ai);
|
||||
}
|
||||
else
|
||||
{
|
||||
ai.AlertCount = oildai.AlertCount;
|
||||
int index = ls.IndexOf(oildai);
|
||||
if (ai.AlertTime_UTC > oildai.AlertTime_UTC)
|
||||
{
|
||||
ai.AlertCount++;
|
||||
ls[index] = ai;
|
||||
}
|
||||
else
|
||||
ls[index].AlertCount++;
|
||||
}
|
||||
}
|
||||
|
||||
return ls.ToArray();
|
||||
}
|
||||
|
||||
public void AcknowledgeAlert(string useriid, long[] alertids, string acknowledgmentcomment)
|
||||
{
|
||||
const string SQL = "update ALERTS set ACKNOWLEDGED=1,ACKNOWLEDGEDBY={1},ACKNOWLEDGMENTCOMMENT={2},ACKNOWLEDGEDDATE_UTC=GETUTCDATE() where ALERTID={0}";
|
||||
const string SQL_S = "select ALERTID from ALERTS where ISNULL(ACKNOWLEDGED,0)<>1 and ISNULL(COMPLETED,0)<>1 and MACHINEID=(select MACHINEID from ALERTS where ALERTID={0}) and ALERTDESC=(select ALERTDESC from ALERTS where ALERTID={0}) ";
|
||||
const string SQL_S = "select ALERTID from ALERTS a where ISNULL(ACKNOWLEDGED,0)<>1 and ISNULL(COMPLETED,0)<>1 and MACHINEID=(select MACHINEID from ALERTS where ALERTID={0}) and ALERTDESC=(select ALERTDESC from ALERTS where ALERTID={0}) and not exists(select 1 from WORKORDER_ALERTS woa where woa.ALERTID=a.ALERTID) ";
|
||||
|
||||
if (alertids != null && alertids.Length > 0)
|
||||
{
|
||||
@ -446,121 +78,24 @@ namespace IronIntel.Contractor.Maintenance
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddMaintenanceLog(AlertInfo alert, List<Tuple<long, double, double, string>> machines, string useriid, FISqlConnection db)
|
||||
{
|
||||
const string SQL_MR = @" insert into MAINTENANCELOG(MAINTENANCEID,MACHINEID,MAINTENANCEDATE,MAINTENANCEHOURS,NOTES,ADDEDBY,ADDEDON,LASTUPDATEDBY,LASTUPDATEDON,
|
||||
ALERTID,ODOMETER,ODOMETERUOM,LOGTYPE,COMPLETEDBY,COMPLETED,COMPLETEDDATE_UTC) values({0},{1},getdate(),{2},{3},{4},GETUTCDATE(),{4},GETUTCDATE(),{5},{6},{7},{8},{4},1,GETUTCDATE())";
|
||||
|
||||
string logtype = "";
|
||||
double enginehours = 0;
|
||||
double odometer = 0;
|
||||
string odometeruom = "";
|
||||
var machine = machines.FirstOrDefault(m => m.Item1 == alert.MachineID);
|
||||
if (machine != null)
|
||||
{
|
||||
if (string.Compare(alert.PMType, "HM_ALERT", true) == 0
|
||||
|| string.Compare(alert.PMType, "PM_ALERT", true) == 0
|
||||
|| string.Compare(alert.PMType, "TBM_ALERT", true) == 0)
|
||||
{
|
||||
logtype = "Hours";
|
||||
enginehours = machine.Item2;
|
||||
enginehours = enginehours > 0 ? enginehours : 0;
|
||||
}
|
||||
else if (string.Compare(alert.PMType, "ADM_ALERT", true) == 0
|
||||
|| string.Compare(alert.PMType, "RDM_ALERT", true) == 0)
|
||||
{
|
||||
logtype = "Distance";
|
||||
odometer = machine.Item3;
|
||||
odometer = odometer > 0 ? odometer : 0;
|
||||
odometeruom = machine.Item4;
|
||||
}
|
||||
}
|
||||
db.ExecSQL(SQL_MR, Guid.NewGuid().ToString().ToUpper(), alert.MachineID, enginehours, alert.Description, useriid,
|
||||
alert.AlertID, odometer, odometeruom, logtype);
|
||||
}
|
||||
|
||||
private static List<Tuple<long, double, double, string>> GetMachines(FISqlConnection db)
|
||||
{
|
||||
const string SQL = "select MACHINEID,ENGINEHOURS,ODOMETER,ODOMETERUOM from MACHINES";
|
||||
List<Tuple<long, double, double, string>> list = new List<Tuple<long, double, double, string>>();
|
||||
DataTable dt = db.GetDataTableBySQL(SQL);
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
long machineid = FIDbAccess.GetFieldInt(dr["MACHINEID"], 0);
|
||||
double enginhours = FIDbAccess.GetFieldDouble(dr["ENGINEHOURS"], 0);
|
||||
double odometer = FIDbAccess.GetFieldDouble(dr["ODOMETER"], 0);
|
||||
string odometeruom = FIDbAccess.GetFieldString(dr["ODOMETERUOM"], string.Empty);
|
||||
Tuple<long, double, double, string> t = new Tuple<long, double, double, string>(machineid, enginhours, odometer, odometeruom);
|
||||
list.Add(t);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
private static StringKeyValue[] GetMachineJobSites(FISqlConnection db)
|
||||
{
|
||||
const string SQL = "select jm.MACHINEID,j.JOBSITENAME from JOBSITEMACHINES jm left join JOBSITES j on jm.JOBSITEID=j.JOBSITEID";
|
||||
List<StringKeyValue> list = new List<StringKeyValue>();
|
||||
DataTable dt = db.GetDataTableBySQL(SQL);
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
StringKeyValue kv = new StringKeyValue();
|
||||
kv.Key = FIDbAccess.GetFieldInt(dr["MACHINEID"], 0).ToString();
|
||||
kv.Value = FIDbAccess.GetFieldString(dr["JOBSITENAME"], string.Empty);
|
||||
list.Add(kv);
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
private static AlertInfo ConvertToAlertInfo(DataRow dr, double timeadjust)
|
||||
private static AlertInfo ConvertToAlertInfo(DataRow dr, Foresight.Fleet.Services.User.UserInfo user)
|
||||
{
|
||||
AlertInfo ai = new AlertInfo();
|
||||
ai.AlertID = FIDbAccess.GetFieldInt(dr["ALERTID"], 0);
|
||||
ai.AlertType = FIDbAccess.GetFieldString(dr["ALERTTYPE"], string.Empty);
|
||||
ai.AlertTime_UTC = FIDbAccess.GetFieldDateTime(dr["ALERTTIME_UTC"], DateTime.MinValue);
|
||||
if (ai.AlertTime_UTC != DateTime.MinValue)
|
||||
ai.AlertTime_UTC = ai.AlertTime_UTC.AddHours(timeadjust);
|
||||
ai.AlertLocalTime = SystemParams.ConvertToUserTimeFromUtc(user, ai.AlertTime_UTC);
|
||||
ai.Completed = FIDbAccess.GetFieldInt(dr["COMPLETED"], 0) == 1;
|
||||
ai.MachineID = FIDbAccess.GetFieldInt(dr["MACHINEID"], 0);
|
||||
ai.VIN = FIDbAccess.GetFieldString(dr["VIN"], string.Empty);
|
||||
ai.MachineName = FIDbAccess.GetFieldString(dr["MACHINENAME"], string.Empty);
|
||||
ai.EngineHours = FIDbAccess.GetFieldDouble(dr["ENGINGHOURS"], 0);
|
||||
ai.Description = FIDbAccess.GetFieldString(dr["ALERTDESC"], string.Empty);
|
||||
ai.Description = ai.FormatDescription(ai.Description);
|
||||
ai.PMType = FIDbAccess.GetFieldString(dr["PMTYPE"], string.Empty);
|
||||
return ai;
|
||||
}
|
||||
|
||||
private static Dictionary<string, AssetEngineHour> GetAssetEngineHour()
|
||||
{
|
||||
const string SQL_EH = @"select * from(select AssetId as MACHINEID,AsofTime as ASOFTIME_UTC,Amount,UOM,ROW_NUMBER() over(partition by AssetId order by AsofTime desc) as RowIndex from AssetEngineHours where Datasource<>'Calamp') t where RowIndex=1";
|
||||
|
||||
DataTable tbeh = null;
|
||||
string dbString2 = SystemParams.GetIronIntelReportDataDbString(SystemParams.CompanyID);
|
||||
if (!string.IsNullOrWhiteSpace(dbString2))
|
||||
{
|
||||
var db2 = new FISqlConnection(dbString2);
|
||||
tbeh = db2.GetDataTableBySQL(SQL_EH);
|
||||
}
|
||||
|
||||
Dictionary<string, AssetEngineHour> machineEngineHours = new Dictionary<string, AssetEngineHour>();
|
||||
if (tbeh != null && tbeh.Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow dr in tbeh.Rows)
|
||||
{
|
||||
string mID = FIDbAccess.GetFieldString(dr["MACHINEID"], string.Empty);
|
||||
var meh = new AssetEngineHour();
|
||||
meh.EngineHours = FIDbAccess.GetFieldDouble(dr["Amount"], -1);
|
||||
string uom = FIDbAccess.GetFieldString(dr["UOM"], string.Empty);
|
||||
if (uom.ToLower() == "s")
|
||||
meh.EngineHours = meh.EngineHours / 3600;
|
||||
meh.EngineHoursDate = FIDbAccess.GetFieldDateTime(dr["ASOFTIME_UTC"], DateTime.MinValue);
|
||||
if (meh.EngineHoursDate != DateTime.MinValue)
|
||||
meh.EngineHoursDate = meh.EngineHoursDate.AddHours(SystemParams.GetHoursOffset());
|
||||
|
||||
machineEngineHours[mID] = meh;
|
||||
}
|
||||
}
|
||||
|
||||
return machineEngineHours;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
29
IronIntelContractorBusiness/Maintenance/AlertQueryParams.cs
Normal file
29
IronIntelContractorBusiness/Maintenance/AlertQueryParams.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using Foresight.Fleet.Services.AssetHealth;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IronIntel.Contractor.Maintenance
|
||||
{
|
||||
public class AlertQueryParams
|
||||
{
|
||||
public long AssetID { get; set; }
|
||||
public string SearchText { get; set; }
|
||||
public string[] AlertStatus { get; set; }
|
||||
public string[] AssetGroups { get; set; }
|
||||
public string[] AlertTypes { get; set; }
|
||||
public string[] JobSites { get; set; }
|
||||
public string BeginDate { get; set; }
|
||||
public string EndDate { get; set; }
|
||||
public bool IncludeunCompleted { get; set; }
|
||||
public string[] Category { get; set; }
|
||||
}
|
||||
|
||||
public class AutoAcknowledgeInfo : AutoAcknowledgeItem
|
||||
{
|
||||
public DateTime LocalUpdatedOn { get; set; }
|
||||
public string LocalUpdatedOnStr { get { return LocalUpdatedOn.ToString(); } }
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
public string FuelTypeName { get; set; }
|
||||
public string FuelType { get; set; }
|
||||
public double Odomerter { get; set; }
|
||||
public string OdometerUnits { get; set; }
|
||||
public string RetailerZip { get; set; }
|
||||
public string RetailerState { get; set; }
|
||||
public string RetailerCity { get; set; }
|
||||
@ -25,7 +26,9 @@ namespace IronIntel.Contractor.Maintenance
|
||||
public string DriverName { get; set; }
|
||||
public string TicketNumber { get; set; }
|
||||
public DateTime TransactionDate { get; set; }
|
||||
public string TransactionDateStr { get { return TransactionDate == DateTime.MinValue ? "" : TransactionDate.ToString("MM/dd/yyyy HH:mm"); } }
|
||||
public string TransactionDateStr { get { return TransactionDate == DateTime.MinValue ? "" : TransactionDate.ToString("M/d/yyyy h:mm tt"); } }
|
||||
public DateTime TransactionLocalDate { get; set; }
|
||||
public string TransactionLocalDateStr { get { return TransactionLocalDate == DateTime.MinValue ? "" : TransactionLocalDate.ToString("M/d/yyyy h:mm tt"); } }
|
||||
public string AssetModel { get; set; }
|
||||
public string AssetMake { get; set; }
|
||||
public string AssetType { get; set; }
|
||||
@ -35,6 +38,9 @@ namespace IronIntel.Contractor.Maintenance
|
||||
public long FuelID { get; set; }
|
||||
public string DataSource { get; set; }
|
||||
public string BrandName { get; set; }
|
||||
public int DistributedBy { get; set; }//0:Fueling Station 1:Fueling Asset
|
||||
public long FuelingAsset { get; set; }
|
||||
public string FuelingAssetName { get; set; }
|
||||
}
|
||||
|
||||
public class FuelRecordAuditItem : FuelRecordInfo
|
||||
@ -46,9 +52,14 @@ namespace IronIntel.Contractor.Maintenance
|
||||
public string LasetUpdatedBy { get; set; }
|
||||
public string LasetUpdatedByName { get; set; }
|
||||
public DateTime AddedOn { get; set; }
|
||||
public string AddedOnStr { get { return AddedOn == DateTime.MinValue ? "" : AddedOn.ToString("MM/dd/yyyy HH:mm:ss"); } }
|
||||
public string AddedOnStr { get { return AddedOn == DateTime.MinValue ? "" : AddedOn.ToString("M/d/yyyy h:mm:ss tt"); } }
|
||||
public DateTime LastUpdatedOn { get; set; }
|
||||
public string LastUpdatedOnStr { get { return LastUpdatedOn == DateTime.MinValue ? "" : LastUpdatedOn.ToString("MM/dd/yyyy HH:mm:ss"); } }
|
||||
public string LastUpdatedOnStr { get { return LastUpdatedOn == DateTime.MinValue ? "" : LastUpdatedOn.ToString("M/d/yyyy h:mm:ss tt"); } }
|
||||
|
||||
public DateTime AddedOn_Local { get; set; }
|
||||
public string AddedOn_LocalStr { get { return AddedOn_Local == DateTime.MinValue ? "" : AddedOn_Local.ToString("M/d/yyyy h:mm:ss tt"); } }
|
||||
public DateTime LastUpdatedOn_Local { get; set; }
|
||||
public string LastUpdatedOn_LocalStr { get { return LastUpdatedOn_Local == DateTime.MinValue ? "" : LastUpdatedOn_Local.ToString("M/d/yyyy h:mm:ss tt"); } }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,9 @@ using IronIntel.Contractor.Machines;
|
||||
|
||||
namespace IronIntel.Contractor.Maintenance
|
||||
{
|
||||
/// <summary>
|
||||
/// 已移到CurfewWinService服务中执行
|
||||
/// </summary>
|
||||
public class IATCAlertsSyncService
|
||||
{
|
||||
private static bool isrunning = false;
|
||||
@ -81,9 +84,9 @@ namespace IronIntel.Contractor.Maintenance
|
||||
|
||||
private Dictionary<long, machinedata> _Machines = new Dictionary<long, machinedata>();
|
||||
|
||||
private machinedata GetMachinedata(long id)
|
||||
private machinedata GetMachinedata(FISqlConnection db, long id)
|
||||
{
|
||||
const string SQL = "select MACHINEID,VIN,MACHINENAME,MACHINENAME2,MAKEID,MODELID,TYPEID from MACHINES where MACHINEID={0}";
|
||||
const string SQL = "select MACHINEID,VIN,MACHINENAME,MACHINENAME2,MAKEID,MODELID,TYPEID from MACHINES with(nolock) where MACHINEID={0}";
|
||||
|
||||
machinedata m = null;
|
||||
if (_Machines.TryGetValue(id, out m))
|
||||
@ -91,7 +94,6 @@ namespace IronIntel.Contractor.Maintenance
|
||||
return m;
|
||||
}
|
||||
|
||||
FISqlConnection db = SystemParams.GetDbInstance();
|
||||
DataTable tb = db.GetDataTableBySQL(SQL, id);
|
||||
if (tb.Rows.Count == 0)
|
||||
{
|
||||
@ -117,7 +119,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
|
||||
public void SyncAlerts()
|
||||
{
|
||||
const string SQL = "select top 100 * from IATCALERTS where ALERTID>(select isnull(max(IATCALERTID),-1) from ALERTS where SRC='LOCALTABLE_IATCALERTS') order by ALERTID";//process most 100 alerts each time
|
||||
const string SQL = "select top 100 * from IATCALERTS with(nolock) where ALERTID>(select isnull(max(IATCALERTID),-1) from ALERTS where SRC='LOCALTABLE_IATCALERTS') order by ALERTID";//process most 100 alerts each time
|
||||
|
||||
FISqlConnection db = SystemParams.GetDbInstance();
|
||||
DataTable tb = db.GetDataTableBySQL(SQL);
|
||||
@ -137,13 +139,13 @@ namespace IronIntel.Contractor.Maintenance
|
||||
|
||||
private void InsertData(FISqlConnection db, DataRow dr)
|
||||
{
|
||||
const string SQL = "if not exists(select 1 from ALERTS where SRC='LOCALTABLE_IATCALERTS' and IATCALERTID={0}) "
|
||||
const string SQL = "if not exists(select 1 from ALERTS with(nolock) where SRC='LOCALTABLE_IATCALERTS' and IATCALERTID={0}) "
|
||||
+ "insert into ALERTS(ALERTTIME_UTC,ALERTTYPE,ALERTTITLE,ALERTDESC,MACHINEID,VIN,MACHINENAME,MODELID,MODELNAME,"
|
||||
+ "MAKEID,MAKENAME,TYPEID,TYPENAME,ENGINGHOURS,LATITUDE,LONGITUDE,LOCDATE_UTC,SRC,INSERTTIME,REFID,IATCALERTID) "
|
||||
+ " values({1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},'LOCALTABLE_IATCALERTS',getdate(),{0},{0})";
|
||||
+ "MAKEID,MAKENAME,TYPEID,TYPENAME,ENGINGHOURS,LATITUDE,LONGITUDE,LOCDATE_UTC,SRC,INSERTTIME,REFID,IATCALERTID,ACKNOWLEDGED,ACKNOWLEDGEDDATE_UTC) "
|
||||
+ " values({1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},'LOCALTABLE_IATCALERTS',getdate(),{0},{0},{18},(case {18} when 1 then GETUTCDATE() else null end))";
|
||||
|
||||
long machineid = Convert.IsDBNull(dr["MACHINEID"]) ? -1 : Convert.ToInt64(dr["MACHINEID"]);
|
||||
machinedata m = GetMachinedata(machineid);
|
||||
machinedata m = GetMachinedata(db, machineid);
|
||||
if (m == null)
|
||||
{
|
||||
m = new machinedata();
|
||||
@ -166,7 +168,11 @@ namespace IronIntel.Contractor.Maintenance
|
||||
alerttype = DetermineAlertType(alerttype.Trim());
|
||||
if (alerttype == null)
|
||||
return;
|
||||
db.ExecSQL(SQL, alertid, alerttime, alerttype, title, desc, m.ID, m.VIN, m.CustName, m.ModelID, m.ModelName, m.MakeID, m.MakeName, m.TypeID, m.TypeName, hours, lat, lon, locdate);
|
||||
if (string.IsNullOrWhiteSpace(alerttype))
|
||||
alerttype = "";
|
||||
object obj = db.GetRC1BySQL("select isnull((select top 1 1 from AUTOACKNOWLEDGEALERTTYPES where ALERTTYPE={0}),0)", alerttype);
|
||||
bool autoAcknowledge = obj.ToString() == "1";
|
||||
db.ExecSQL(SQL, alertid, alerttime, alerttype, title, desc, m.ID, m.VIN, m.CustName, m.ModelID, m.ModelName, m.MakeID, m.MakeName, m.TypeID, m.TypeName, hours, lat, lon, locdate, autoAcknowledge ? 1 : 0);
|
||||
}
|
||||
|
||||
private string DetermineAlertType(string alerttype)
|
||||
|
@ -14,10 +14,29 @@ namespace IronIntel.Contractor.Maintenance
|
||||
public string PmScheduleUom { get; set; }
|
||||
|
||||
public string PmScheduleType { get; set; } //PM,TBM,HM
|
||||
public string PmScheduleTypeStr
|
||||
{
|
||||
get
|
||||
{
|
||||
var rst = "";
|
||||
if (PmScheduleType == "PM")
|
||||
rst = "Absolute Hours";
|
||||
else if (PmScheduleType == "TBM")
|
||||
rst = "Relative Time";
|
||||
else if (PmScheduleType == "HM")
|
||||
rst = "Relative Hours";
|
||||
else if (PmScheduleType == "ADM")
|
||||
rst = "Absolute Distance";
|
||||
else if (PmScheduleType == "RDM")
|
||||
rst = "Relative Distance";
|
||||
return rst;
|
||||
}
|
||||
}
|
||||
public string Notes { get; set; }
|
||||
|
||||
public PmIntervalItem[] Intervals { get; set; }
|
||||
public int[] AllIntervals { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
}
|
||||
|
||||
public class PmIntervalItem
|
||||
@ -29,6 +48,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
|
||||
public string ServiceName { get; set; }
|
||||
public bool Recurring { get; set; }
|
||||
public double ExpectedCost { get; set; }
|
||||
public int Priority { get; set; }
|
||||
|
||||
public string ServiceDescription { get; set; }
|
||||
@ -91,7 +111,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
{
|
||||
if (AlertTime != DateTime.MinValue)
|
||||
{
|
||||
return AlertTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
return AlertTime.ToString("M/d/yyyy h:mm:ss tt");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@ -104,7 +124,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
public bool HasAttachment { get; set; }
|
||||
|
||||
public string[] AttachmentIDs { get; set; }//用于保存
|
||||
public string ShowName
|
||||
public string DisplayName
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -158,7 +178,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
return StartDate.ToShortDateString();
|
||||
}
|
||||
}
|
||||
public string ShowName
|
||||
public string DisplayName
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -230,7 +250,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
if (StartDate == null)
|
||||
return "";
|
||||
else
|
||||
return StartDate.Value.ToString("MM/dd/yyyy");
|
||||
return StartDate.Value.ToString("M/d/yyyy");
|
||||
}
|
||||
}
|
||||
public string LastAlertTimeString
|
||||
@ -240,7 +260,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
if (LastAlertTime == null)
|
||||
return "";
|
||||
else
|
||||
return LastAlertTime.Value.ToString("MM/dd/yyyy");
|
||||
return LastAlertTime.Value.ToString("M/d/yyyy");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
using Foresight.Data;
|
||||
using DocumentFormat.OpenXml.Office2010.CustomUI;
|
||||
using Foresight.Data;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using Foresight.Fleet.Services.AssetHealth;
|
||||
using Foresight.Fleet.Services.User;
|
||||
using IronIntel.Contractor.Machines;
|
||||
using IronIntel.Services;
|
||||
using IronIntel.Services.Business.Admin;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@ -19,11 +19,17 @@ namespace IronIntel.Contractor.Maintenance
|
||||
|
||||
#region PM SCHEDULES
|
||||
|
||||
public static PmScheduleInfo[] GetPmSchedule(string sessionid, string pmtype)
|
||||
/// <summary>
|
||||
/// 根据PM类型、PMId获取PM计划列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static PmScheduleInfo[] GetPmSchedule(string sessionid, string pmtype, string pmid, string filter)
|
||||
{
|
||||
var items = FleetServiceClientHelper.CreateClient<PMClient>(sessionid).GetPMScheduleItems(SystemParams.CompanyID, pmtype, string.Empty, true);
|
||||
var items = FleetServiceClientHelper.CreateClient<PMClient>(sessionid).GetPMScheduleItems(SystemParams.CompanyID, pmtype, filter, true);
|
||||
if (items == null || items.Length == 0)
|
||||
return new PmScheduleInfo[0];
|
||||
if (!string.IsNullOrEmpty(pmid))
|
||||
items = items.Where(m => m.Id == pmid).ToArray();
|
||||
List<PmScheduleInfo> list = new List<PmScheduleInfo>();
|
||||
foreach (var item in items)
|
||||
{
|
||||
@ -33,6 +39,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
pm.PmScheduleUom = item.UOM;
|
||||
pm.PmScheduleType = item.ScheduleType;
|
||||
pm.Notes = item.Notes;
|
||||
pm.Enabled = item.Enabled;
|
||||
if (item.Intervals != null || item.Intervals.Count > 0)
|
||||
{
|
||||
List<PmIntervalItem> lsinterval = new List<PmIntervalItem>();
|
||||
@ -55,6 +62,10 @@ namespace IronIntel.Contractor.Maintenance
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据PM计划ID获取计划信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static PmScheduleInfo GetPMScheduleByID(string sessionid, string scheduleid)
|
||||
{
|
||||
var item = FleetServiceClientHelper.CreateClient<PMClient>(sessionid).GetPMScheduleItem(SystemParams.CompanyID, scheduleid, true);
|
||||
@ -64,6 +75,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
pm.PmScheduleUom = item.UOM;
|
||||
pm.PmScheduleType = item.ScheduleType;
|
||||
pm.Notes = item.Notes;
|
||||
pm.Enabled = item.Enabled;
|
||||
if (item.Intervals != null || item.Intervals.Count > 0)
|
||||
{
|
||||
List<PmIntervalItem> lsinterval = new List<PmIntervalItem>();
|
||||
@ -85,48 +97,6 @@ namespace IronIntel.Contractor.Maintenance
|
||||
|
||||
return pm;
|
||||
}
|
||||
//private static int[] GetAllIntervals(PMScheduleItem sc)
|
||||
//{
|
||||
// Dictionary<int, List<PMIntervalItem>> result = new Dictionary<int, List<PMIntervalItem>>();
|
||||
|
||||
// var intervals = sc.Intervals.Where(i => i.Recurring).OrderBy(i => i.Interval).ThenByDescending(i => i.Priority).ToList();
|
||||
// if (intervals.Count == 0)
|
||||
// return new int[0];
|
||||
|
||||
// int maxInterval = intervals[intervals.Count() - 1].Interval;
|
||||
// for (int i = intervals.Count - 1; i >= 0; i--)
|
||||
// {//从最大的Interval开始
|
||||
// PMIntervalItem ia = intervals[i];
|
||||
|
||||
// int tempInterval = ia.Interval;
|
||||
// var existIntervals = result.OrderBy(kv => kv.Key).Select(kv => kv.Key).ToList();
|
||||
|
||||
// if (!result.ContainsKey(tempInterval))//加入自己
|
||||
// {
|
||||
// result[tempInterval] = new List<PMIntervalItem>();
|
||||
// }
|
||||
// result[tempInterval].Add(ia);
|
||||
|
||||
// tempInterval += ia.Interval;
|
||||
// foreach (var ti in existIntervals)
|
||||
// {//result排序后找第一个比tempInterval大的值
|
||||
// while (tempInterval < ti)
|
||||
// {
|
||||
// if (!result.ContainsKey(tempInterval))
|
||||
// {
|
||||
// result[tempInterval] = new List<PMIntervalItem>();
|
||||
// }
|
||||
// result[tempInterval].Add(ia);
|
||||
// tempInterval += ia.Interval;
|
||||
// }
|
||||
|
||||
// tempInterval = ti;
|
||||
// tempInterval += ia.Interval;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return result.Select(r => r.Key).OrderBy(r => r).ToArray();
|
||||
//}
|
||||
|
||||
private static int[] GetAllIntervals(PMScheduleItem sc)
|
||||
{
|
||||
@ -140,11 +110,13 @@ namespace IronIntel.Contractor.Maintenance
|
||||
for (int i = 0; i < intervals.Count; i++)
|
||||
{
|
||||
PMIntervalItem ia = intervals[i];
|
||||
if (maxInterval == 0)
|
||||
if (maxInterval <= 0)
|
||||
maxInterval = ia.Interval;
|
||||
else
|
||||
maxInterval = GetMinCommonMultiple(maxInterval, ia.Interval);
|
||||
}
|
||||
if (maxInterval < 0 || maxInterval > 10240000)//溢出或数据过大
|
||||
maxInterval = intervals.LastOrDefault().Interval;
|
||||
for (int i = 0; i < intervals.Count; i++)
|
||||
{
|
||||
PMIntervalItem ia = intervals[i];
|
||||
@ -198,12 +170,18 @@ namespace IronIntel.Contractor.Maintenance
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static PMAssetAlertInfo[] GetPmScheduleByAsset(string sessionid, long assetid)
|
||||
/// <summary>
|
||||
/// 根据机器id获取PM计划列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static PMAssetAlertInfo[] GetPmScheduleByAsset(string sessionid, long assetid, bool includeinterval)
|
||||
{
|
||||
List<PMAssetAlertInfo> result = new List<PMAssetAlertInfo>();
|
||||
var client = FleetServiceClientHelper.CreateClient<PMClient>(sessionid);
|
||||
var sches = client.GetPMScheduleItems(SystemParams.CompanyID, "", string.Empty, true);
|
||||
var aas = client.GetPMAssetAlertItems(SystemParams.CompanyID, assetid);
|
||||
PMAssetAlertItem[] aas = null;
|
||||
if (includeinterval)
|
||||
aas = client.GetPMAssetAlertItems(SystemParams.CompanyID, assetid);
|
||||
foreach (var item in sches)
|
||||
{
|
||||
PMAssetAlertInfo pm = new PMAssetAlertInfo();
|
||||
@ -212,7 +190,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
pm.PmScheduleUom = item.UOM;
|
||||
pm.PmScheduleType = item.ScheduleType;
|
||||
pm.Notes = item.Notes;
|
||||
if (item.Intervals != null || item.Intervals.Count > 0)
|
||||
if (includeinterval && item.Intervals != null || item.Intervals.Count > 0)
|
||||
{
|
||||
List<PmIntervalItem> lsinterval = new List<PmIntervalItem>();
|
||||
foreach (var pi in item.Intervals)
|
||||
@ -230,7 +208,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
else
|
||||
pm.Intervals = new PmIntervalItem[0];
|
||||
|
||||
if (aas != null)
|
||||
if (includeinterval && aas != null)
|
||||
{
|
||||
var aa = aas.FirstOrDefault(a => a.PMScheduleId.Equals(pm.PmScheduleID, StringComparison.OrdinalIgnoreCase));
|
||||
if (aa != null)
|
||||
@ -254,20 +232,6 @@ namespace IronIntel.Contractor.Maintenance
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
public static PmScheduleInfo GetPmScheduleByID(string sessionid, string scheduleid)
|
||||
{
|
||||
const string SQL = @"select PMSCHEDULEID,SCHEDULENAME,SCHEDULETYPE,NOTES,SCHEDULEUOM from PM_SCHEDULES where PMSCHEDULEID={0}";
|
||||
FISqlConnection db = SystemParams.GetDbInstance();
|
||||
DataTable dt = db.GetDataTableBySQL(SQL, scheduleid);
|
||||
if (dt.Rows.Count == 0)
|
||||
{
|
||||
return new PmScheduleInfo();
|
||||
}
|
||||
PmScheduleInfo si = ConvertPmScheduleInfo(dt.Rows[0]);
|
||||
si.Intervals = GetPmInterval(sessionid, si.PmScheduleID);
|
||||
return si;
|
||||
}
|
||||
|
||||
public static void UpdatePmSchedule(string sessionid, PmScheduleInfo si, string useriid)
|
||||
{
|
||||
PMScheduleItem pm = new PMScheduleItem();
|
||||
@ -276,6 +240,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
pm.UOM = si.PmScheduleUom;
|
||||
pm.ScheduleType = si.PmScheduleType;
|
||||
pm.Notes = si.Notes;
|
||||
pm.Enabled = si.Enabled;
|
||||
if (si.Intervals != null && si.Intervals.Length > 0)
|
||||
{
|
||||
List<PMIntervalItem> list = new List<PMIntervalItem>();
|
||||
@ -300,103 +265,23 @@ namespace IronIntel.Contractor.Maintenance
|
||||
FleetServiceClientHelper.CreateClient<PMClient>(sessionid).UpdatePMInterval(SystemParams.CompanyID, interval, useriid);
|
||||
}
|
||||
|
||||
public static MaintenanceMachineInfo[] GetPmMachinesByScheduleId(string scheduleid)
|
||||
{
|
||||
const string SQL = @"select a.MACHINEID,a.STARTDATE,a.STARTHOURS,a.STARTOTOMETER,b.MACHINENAME,b.MACHINENAME2,b.VIN,b.MAKEID,b.MODELID,b.TYPEID,b.HIDE,
|
||||
ISNULL(b.ENGINEHOURS,0) as ENGINEHOURS,ISNULL(b.ODOMETER,0) as ODOMETER,ISNULL(b.ODOMETERUOM,'Mile') AS ODOMETERUOM
|
||||
from PM_MACHINES a,MACHINES b where a.MACHINEID=b.MACHINEID and a.PMSCHEDULEID={0}";
|
||||
|
||||
FISqlConnection db = SystemParams.GetDbInstance();
|
||||
DataTable tb = db.GetDataTableBySQL(SQL, scheduleid);
|
||||
if (tb.Rows.Count == 0)
|
||||
{
|
||||
return new MaintenanceMachineInfo[0];
|
||||
}
|
||||
MachineManagement.RefreshBaseData();
|
||||
MachineMake[] makes = MachineManagement.GetMachineMakes();
|
||||
MachineModel[] models = MachineManagement.GetMachineModels();
|
||||
MachineType[] types = MachineManagement.GetMachineTypes();
|
||||
List<MaintenanceMachineInfo> ls = new List<MaintenanceMachineInfo>();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
MaintenanceMachineInfo mi = ConvertToMaintenanceMachineInfo(dr, makes, models, types);
|
||||
ls.Add(mi);
|
||||
}
|
||||
return ls.ToArray();
|
||||
}
|
||||
|
||||
|
||||
private static object GetValueOrNull(DateTime v)
|
||||
{
|
||||
if (v == DateTime.MinValue || v == new DateTime(1900, 1, 1))
|
||||
return null;
|
||||
else
|
||||
return v;
|
||||
}
|
||||
|
||||
public static void DeletePmMachine(string scheduleid, string machineid)
|
||||
{
|
||||
const string SQL = "delete from PM_MACHINES where PMSCHEDULEID={0} and MACHINEID={1}";
|
||||
FISqlConnection db = SystemParams.GetDbInstance();
|
||||
db.ExecSQL(SQL, scheduleid, machineid);
|
||||
}
|
||||
|
||||
private static bool CheckPmScheduleNameRepeat(string scheduleid, string schedulename)
|
||||
{
|
||||
const string SQL = "select COUNT(1) from PM_SCHEDULES where PMSCHEDULEID!={0} and SCHEDULENAME={1}";
|
||||
FIDbAccess db = SystemParams.GetDbInstance();
|
||||
object obj = db.GetRC1BySQL(SQL, scheduleid, schedulename);
|
||||
if (Convert.ToInt32(obj) > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static bool CheckPmScheduleHasMachine(string scheduleid)
|
||||
{
|
||||
const string SQL_M = "select COUNT(1) from PM_MACHINES where PMSCHEDULEID={0}";
|
||||
FIDbAccess db = SystemParams.GetDbInstance();
|
||||
object objm = db.GetRC1BySQL(SQL_M, scheduleid);
|
||||
if (Convert.ToInt32(objm) > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private static PmScheduleInfo ConvertPmScheduleInfo(DataRow dr)
|
||||
{
|
||||
PmScheduleInfo si = new PmScheduleInfo();
|
||||
si.PmScheduleID = FIDbAccess.GetFieldString(dr["PMSCHEDULEID"], string.Empty);
|
||||
si.PmScheduleName = FIDbAccess.GetFieldString(dr["SCHEDULENAME"], string.Empty);
|
||||
si.PmScheduleType = FIDbAccess.GetFieldString(dr["SCHEDULETYPE"], string.Empty);
|
||||
si.Notes = FIDbAccess.GetFieldString(dr["NOTES"], string.Empty);
|
||||
si.PmScheduleUom = FIDbAccess.GetFieldString(dr["SCHEDULEUOM"], string.Empty);
|
||||
return si;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Maintenance Log
|
||||
|
||||
public static MaintenanceLogInfo[] GetMaintenanceLog(string sessionid, long assetid, string maintenancetype, int machinetype, string searchtxt, string useriid)
|
||||
public static MaintenanceLogInfo[] GetMaintenanceLog(string sessionid, long assetid, string maintenancetype, int machinetype, string searchtxt, DateTime starttime, DateTime endtime, string useriid)
|
||||
{
|
||||
const string SQL = @"select a.MAINTENANCEID,a.MACHINEID,a.MAINTENANCEDATE,a.MAINTENANCEHOURS,a.NOTES,a.ALERTID,b.MACHINENAME,b.MACHINENAME2, b.VIN,b.MAKEID, b.MODELID,b.TYPEID,ISNULL(b.ENGINEHOURS,0) as ENGINEHOURS,
|
||||
t.ALERTTYPE,t.ALERTTITLE,t.ALERTTIME_UTC,ISNULL(a.ODOMETER,0) AS ODOMETER,ISNULL(a.ODOMETERUOM,'Hour') AS ODOMETERUOM, isnull(LOGTYPE,'Hours') AS LOGTYPE ,a.COST,a.INVOICENUMBER,a.COMPLETEDBY,a.COMPLETEDBYUSERNAME,
|
||||
(select top 1 ATTACHID from ATTACHES where SOURCE='MaintenanceLog' and REFID=a.MAINTENANCEID and isnull(DELETED,0)=0) ATTACHID
|
||||
from MAINTENANCELOG a left join ALERTS t on a.ALERTID=t.ALERTID,MACHINES b
|
||||
where a.MACHINEID = b.MACHINEID and ISNULL(b.HIDE,0)<>1";
|
||||
(select top 1 ATTACHID from ATTACHES with(nolock) where SOURCE='MaintenanceLog' and REFID=a.MAINTENANCEID and isnull(DELETED,0)=0) ATTACHID
|
||||
from MAINTENANCELOG a with(nolock) left join ALERTS t with(nolock) on a.ALERTID=t.ALERTID,MACHINES b
|
||||
where a.MACHINEID = b.MACHINEID and ISNULL(b.HIDE,0)<>1 and a.MAINTENANCEDATE>={0} and a.MAINTENANCEDATE<={1} ";
|
||||
const string ORDER_BY = " ORDER BY a.ADDEDON DESC";
|
||||
|
||||
DateTime sttime = new DateTime(starttime.Year, starttime.Month, starttime.Day, 0, 0, 0);
|
||||
DateTime ettime = new DateTime(endtime.Year, endtime.Month, endtime.Day, 23, 59, 59);
|
||||
|
||||
string sql = SQL;
|
||||
//if (string.Compare("Distance", maintenancetype, true) == 0)
|
||||
//{
|
||||
// sql = SQL + " and a.LOGTYPE='" + maintenancetype + "'";
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// sql = SQL + " and a.LOGTYPE='" + maintenancetype + "'";
|
||||
// sql = SQL + " and (a.LOGTYPE='" + maintenancetype + "' or a.LOGTYPE is null)";
|
||||
//}
|
||||
if (assetid > 0)
|
||||
{
|
||||
sql = sql + " and a.MACHINEID=" + assetid;
|
||||
@ -411,7 +296,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
}
|
||||
|
||||
FISqlConnection db = SystemParams.GetDbInstance();
|
||||
DataTable dt = db.GetDataTableBySQL(sql, useriid);
|
||||
DataTable dt = db.GetDataTableBySQL(sql, sttime, ettime);
|
||||
if (dt.Rows.Count == 0)
|
||||
{
|
||||
return new MaintenanceLogInfo[0];
|
||||
@ -423,9 +308,9 @@ namespace IronIntel.Contractor.Maintenance
|
||||
availableAssetsids = FleetServiceClientHelper.CreateClient<AssetQueryClient>(sessionid).GetAvailableAssetsForUsers(SystemParams.CompanyID, useriid);
|
||||
|
||||
MachineManagement.RefreshBaseData();
|
||||
MachineMake[] makes = MachineManagement.GetMachineMakes();
|
||||
MachineModel[] models = MachineManagement.GetMachineModels();
|
||||
MachineType[] types = MachineManagement.GetMachineTypes();
|
||||
AssetMake[] makes = MachineManagement.GetMachineMakes();
|
||||
AssetModel[] models = MachineManagement.GetMachineModels();
|
||||
AssetType[] types = MachineManagement.GetMachineTypes();
|
||||
|
||||
List<MaintenanceLogInfo> list = new List<MaintenanceLogInfo>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
@ -478,9 +363,9 @@ namespace IronIntel.Contractor.Maintenance
|
||||
}
|
||||
|
||||
MachineManagement.RefreshBaseData();
|
||||
MachineMake[] makes = MachineManagement.GetMachineMakes();
|
||||
MachineModel[] models = MachineManagement.GetMachineModels();
|
||||
MachineType[] types = MachineManagement.GetMachineTypes();
|
||||
AssetMake[] makes = MachineManagement.GetMachineMakes();
|
||||
AssetModel[] models = MachineManagement.GetMachineModels();
|
||||
AssetType[] types = MachineManagement.GetMachineTypes();
|
||||
|
||||
MaintenanceLogInfo ml = ConvertToMaintenanceLogInfo(dt.Rows[0], makes, models, types);
|
||||
return ml;
|
||||
@ -501,9 +386,9 @@ namespace IronIntel.Contractor.Maintenance
|
||||
}
|
||||
|
||||
MachineManagement.RefreshBaseData();
|
||||
MachineMake[] makes = MachineManagement.GetMachineMakes();
|
||||
MachineModel[] models = MachineManagement.GetMachineModels();
|
||||
MachineType[] types = MachineManagement.GetMachineTypes();
|
||||
AssetMake[] makes = MachineManagement.GetMachineMakes();
|
||||
AssetModel[] models = MachineManagement.GetMachineModels();
|
||||
AssetType[] types = MachineManagement.GetMachineTypes();
|
||||
|
||||
List<MaintenanceLogInfo> list = new List<MaintenanceLogInfo>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
@ -527,9 +412,9 @@ namespace IronIntel.Contractor.Maintenance
|
||||
return new MaintenanceLogInfo();
|
||||
}
|
||||
MachineManagement.RefreshBaseData();
|
||||
MachineMake[] makes = MachineManagement.GetMachineMakes();
|
||||
MachineModel[] models = MachineManagement.GetMachineModels();
|
||||
MachineType[] types = MachineManagement.GetMachineTypes();
|
||||
AssetMake[] makes = MachineManagement.GetMachineMakes();
|
||||
AssetModel[] models = MachineManagement.GetMachineModels();
|
||||
AssetType[] types = MachineManagement.GetMachineTypes();
|
||||
|
||||
MaintenanceLogInfo ml = ConvertToMaintenanceLogInfo(dt.Rows[0], makes, models, types);
|
||||
return ml;
|
||||
@ -538,10 +423,10 @@ namespace IronIntel.Contractor.Maintenance
|
||||
public static void UpdateMaintenanceLog(MaintenanceLogInfo ml, string addedby)
|
||||
{
|
||||
const string SQL = @"if exists(select 1 from MAINTENANCELOG where MAINTENANCEID={0}) update MAINTENANCELOG set MACHINEID ={1},MAINTENANCEDATE ={2},
|
||||
MAINTENANCEHOURS={3},NOTES={4},LASTUPDATEDBY={5},LASTUPDATEDON=GETUTCDATE(),ALERTID={6},ODOMETER={7},ODOMETERUOM={8},LOGTYPE={9},COST={10},INVOICENUMBER={11},COMPLETEDBYUSERNAME={12},COMPLETED={13},COMPLETEDDATE_UTC= (case {13} when 1 then GETUTCDATE() else null end) where MAINTENANCEID={0} else insert into MAINTENANCELOG(MAINTENANCEID,
|
||||
MACHINEID,MAINTENANCEDATE,MAINTENANCEHOURS,NOTES,ADDEDBY,ADDEDON,LASTUPDATEDBY,LASTUPDATEDON,ALERTID,ODOMETER,ODOMETERUOM,LOGTYPE,COST,INVOICENUMBER,COMPLETEDBYUSERNAME,COMPLETED,COMPLETEDDATE_UTC) values({0},{1},{2},{3},{4},{5},GETUTCDATE(),{5},GETUTCDATE(),{6},{7},{8},{9},{10},{11},{12},{13},(case {13} when 1 then GETUTCDATE() else null end))";
|
||||
MAINTENANCEHOURS={3},NOTES={4},LASTUPDATEDBY={5},LASTUPDATEDON=GETUTCDATE(),ALERTID={6},ODOMETER={7},ODOMETERUOM={8},LOGTYPE={9},COST={10},INVOICENUMBER={11},COMPLETEDBYUSERNAME={12},COMPLETED={13},COMPLETEDDATE_UTC= (case {13} when 1 then GETDATE() else null end) where MAINTENANCEID={0} else insert into MAINTENANCELOG(MAINTENANCEID,
|
||||
MACHINEID,MAINTENANCEDATE,MAINTENANCEHOURS,NOTES,ADDEDBY,ADDEDON,LASTUPDATEDBY,LASTUPDATEDON,ALERTID,ODOMETER,ODOMETERUOM,LOGTYPE,COST,INVOICENUMBER,COMPLETEDBYUSERNAME,COMPLETED,COMPLETEDDATE_UTC) values({0},{1},{2},{3},{4},{5},GETUTCDATE(),{5},GETUTCDATE(),{6},{7},{8},{9},{10},{11},{12},{13},(case {13} when 1 then GETDATE() else null end))";
|
||||
FISqlConnection db = SystemParams.GetDbInstance();
|
||||
db.ExecSQL(SQL, ml.MaintenanceID, ml.MachineID, ml.MaintenanceDate, ml.MaintenanceHours, ml.Notes, addedby, ml.AlertID, ml.ODOMeter, ml.ODOMemterUOM, ml.LogType, ml.Cost, ml.InvoiceNumber, ml.CompletedByName, ml.Completed ? 1 : 0);
|
||||
db.ExecSQL(SQL, ml.MaintenanceID, ml.MachineID, ml.MaintenanceDate, ml.MaintenanceHours, ml.Notes, addedby, ml.AlertID, ml.ODOMeter, ml.ODOMemterUOM, ml.LogType, ml.Cost, ml.InvoiceNumber, ml.CompletedByName, ml.Completed ? 1 : 0);//COMPLETEDDATE_UTC保存的GETDATE(),与WorkOrder里面的录入的实际保存一致
|
||||
}
|
||||
|
||||
public static void DeleteMaintenanceLog(string maintencelogid)
|
||||
@ -551,13 +436,6 @@ namespace IronIntel.Contractor.Maintenance
|
||||
db.ExecSQL(SQL, maintencelogid);
|
||||
}
|
||||
|
||||
public static bool HasMaintenanceLog(long machineid)
|
||||
{
|
||||
const string SQL = "SELECT count([MAINTENANCEDATE]) FROM [MAINTENANCELOG] where MACHINEID={0}";
|
||||
var db = SystemParams.GetDbInstance();
|
||||
return (int?)db.GetRC1BySQL(SQL, machineid) > 0;
|
||||
}
|
||||
|
||||
public static PMAlert[] GetUnCompletedPMAlerts(long machineid, string maintencelogid)
|
||||
{
|
||||
List<PMAlert> alerts = new List<PMAlert>();
|
||||
@ -572,7 +450,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
alert.AlertTitle = FIDbAccess.GetFieldString(dr["ALERTTITLE"], string.Empty);
|
||||
DateTime at = FIDbAccess.GetFieldDateTime(dr["ALERTTIME_UTC"], DateTime.MinValue);
|
||||
if (at != DateTime.MinValue)
|
||||
alert.AlertTime = at.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
alert.AlertTime = at.ToString("M/d/yyyy h:mm:ss tt");
|
||||
alerts.Add(alert);
|
||||
}
|
||||
return alerts.ToArray();
|
||||
@ -585,7 +463,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
db.ExecSQL(SQL, completed ? 1 : 0, alertID, completedby);
|
||||
}
|
||||
|
||||
private static MaintenanceLogInfo ConvertToMaintenanceLogInfo(DataRow dr, MachineMake[] makes, MachineModel[] models, MachineType[] types)
|
||||
private static MaintenanceLogInfo ConvertToMaintenanceLogInfo(DataRow dr, AssetMake[] makes, AssetModel[] models, AssetType[] types)
|
||||
{
|
||||
MaintenanceLogInfo ml = new MaintenanceLogInfo();
|
||||
ml.MaintenanceID = FIDbAccess.GetFieldString(dr["MAINTENANCEID"], string.Empty);
|
||||
@ -606,40 +484,40 @@ namespace IronIntel.Contractor.Maintenance
|
||||
ml.CompletedByName = FIDbAccess.GetFieldString(dr["COMPLETEDBYUSERNAME"], "");
|
||||
|
||||
int makeid = FIDbAccess.GetFieldInt(dr["MAKEID"], 0);
|
||||
MachineMake make = MachineManagement.GetMachineMake(makes, makeid);
|
||||
AssetMake make = MachineManagement.GetMachineMake(makes, makeid);
|
||||
ml.MachineMake = make == null ? string.Empty : make.Name;
|
||||
|
||||
int modelid = FIDbAccess.GetFieldInt(dr["MODELID"], 0);
|
||||
MachineModel model = MachineManagement.GetMachineModel(models, modelid);
|
||||
AssetModel model = MachineManagement.GetMachineModel(models, modelid);
|
||||
ml.MachineModel = model == null ? string.Empty : model.Name;
|
||||
|
||||
int typeid = FIDbAccess.GetFieldInt(dr["TYPEID"], 0);
|
||||
MachineType mtype = MachineManagement.GetMachineType(types, typeid);
|
||||
AssetType mtype = MachineManagement.GetMachineType(types, typeid);
|
||||
ml.MachineType = mtype == null ? string.Empty : mtype.Name;
|
||||
|
||||
return ml;
|
||||
}
|
||||
|
||||
public static WorkOrderInfo[] GetMaintenanceWorkOrders(string sessionid, string custid, string[] assignedusers, string[] asseitgroups, string filter, string useriid)
|
||||
public static WorkOrderListItemClient[] GetMaintenanceWorkOrders(string sessionid, string custid, string[] assignedusers, string[] asseitgroups, string filter, string useriid)
|
||||
{
|
||||
const string SQL = @"select m.MAINTENANCEID,m.COMPLETEDBY,(select USERNAME from USERS where USERS.USERIID=m.COMPLETEDBY) as ASSIGNEDTONAME,m.NOTES,m.MAINTENANCEDATE
|
||||
,b.MACHINEID,b.VIN,b.MACHINENAME,b.MACHINENAME2 from MAINTENANCELOG m left join MACHINES b on b.MACHINEID=m.MACHINEID
|
||||
where m.ALERTID not in (select ALERTID from WORKORDER_ALERTS) and m.MACHINEID = b.MACHINEID and ISNULL(b.HIDE,0)<>1 ";
|
||||
const string SQL = @"select m.MAINTENANCEID,m.COMPLETEDBY,(select USERNAME from USERS with(nolock) where USERS.USERIID=m.COMPLETEDBY) as ASSIGNEDTONAME,m.NOTES,m.MAINTENANCEDATE
|
||||
,b.MACHINEID,b.VIN,b.MACHINENAME,b.MACHINENAME2,b.MAKENAME,b.MODELNAME,b.JOBSITES,m.COMPLETED from MAINTENANCELOG m with(nolock) left join V_WORKORDER_MACHINES b with(nolock) on b.MACHINEID=m.MACHINEID left join WORKORDER_ALERTS woa on woa.ALERTID=m.ALERTID
|
||||
where woa.ALERTID is null and m.MACHINEID = b.MACHINEID";
|
||||
const string SQL_FILTER = " and (m.NOTES like {0} or b.MACHINEID like {0} or b.VIN like {0} or b.MACHINENAME like {0} or b.MACHINENAME2 like {0}) ";
|
||||
const string SQL_ORDERBY = " order by m.MAINTENANCEID";
|
||||
|
||||
var user = FleetServiceClientHelper.CreateClient<UserQueryClient>(custid, sessionid).GetUserByIID(useriid);
|
||||
if (user == null || (!user.Active))
|
||||
{
|
||||
return new WorkOrderInfo[0];
|
||||
return new WorkOrderListItemClient[0];
|
||||
}
|
||||
if (user == null || (!user.Active))
|
||||
{
|
||||
return new WorkOrderInfo[0];
|
||||
return new WorkOrderListItemClient[0];
|
||||
}
|
||||
if (string.Compare(user.CompanyID, SystemParams.CompanyID, true) != 0 && (!user.IsForesightUser))
|
||||
{
|
||||
return new WorkOrderInfo[0];
|
||||
return new WorkOrderListItemClient[0];
|
||||
}
|
||||
|
||||
string sql = SQL;
|
||||
@ -666,12 +544,12 @@ namespace IronIntel.Contractor.Maintenance
|
||||
dt = db.GetDataTableBySQL(sql + SQL_FILTER + SQL_ORDERBY, "%" + filter + "%");
|
||||
|
||||
if (dt.Rows.Count == 0)
|
||||
return new WorkOrderInfo[0];
|
||||
return new WorkOrderListItemClient[0];
|
||||
|
||||
List<WorkOrderInfo> list = new List<WorkOrderInfo>();
|
||||
List<WorkOrderListItemClient> list = new List<WorkOrderListItemClient>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
WorkOrderInfo wo = new WorkOrderInfo();
|
||||
WorkOrderListItemClient wo = new WorkOrderListItemClient();
|
||||
|
||||
long assetid = FIDbAccess.GetFieldInt64(dr["MACHINEID"], 0);
|
||||
if (assets != null && assets.Length > 0)
|
||||
@ -681,14 +559,30 @@ namespace IronIntel.Contractor.Maintenance
|
||||
continue;
|
||||
}
|
||||
}
|
||||
wo.AssetID = assetid;
|
||||
wo.AssignedTo = FIDbAccess.GetFieldString(dr["COMPLETEDBY"], string.Empty);
|
||||
wo.AssetId = assetid;
|
||||
wo.MaintenanceID = FIDbAccess.GetFieldString(dr["MAINTENANCEID"], string.Empty);
|
||||
wo.Description = FIDbAccess.GetFieldString(dr["NOTES"], string.Empty);
|
||||
wo.CompleteDate = FIDbAccess.GetFieldDateTime(dr["MAINTENANCEDATE"], DateTime.MinValue);
|
||||
wo.Make = FIDbAccess.GetFieldString(dr["MAKENAME"], string.Empty);
|
||||
wo.Model = FIDbAccess.GetFieldString(dr["MODELNAME"], string.Empty);
|
||||
wo.CurrentJobsites = FIDbAccess.GetFieldString(dr["JOBSITES"], string.Empty);
|
||||
wo.VIN = FIDbAccess.GetFieldString(dr["VIN"], string.Empty);
|
||||
wo.AssetName = FIDbAccess.GetFieldString(dr["MACHINENAME"], string.Empty);
|
||||
wo.AssignedToName = FIDbAccess.GetFieldString(dr["ASSIGNEDTONAME"], wo.AssignedTo);
|
||||
wo.AssetName = FIDbAccess.GetFieldString(dr["MACHINENAME2"], string.Empty);
|
||||
if (string.IsNullOrWhiteSpace(wo.AssetName))
|
||||
{
|
||||
wo.AssetName = FIDbAccess.GetFieldString(dr["MACHINENAME"], string.Empty);
|
||||
if (string.IsNullOrWhiteSpace(wo.AssetName))
|
||||
{
|
||||
wo.AssetName = wo.VIN;
|
||||
}
|
||||
}
|
||||
//var assignedTo = FIDbAccess.GetFieldString(dr["COMPLETEDBY"], string.Empty);
|
||||
//wo.AssignedToName = FIDbAccess.GetFieldString(dr["ASSIGNEDTONAME"], assignedTo);
|
||||
|
||||
wo.WorkOrderNumber = "";
|
||||
wo.Status = FIDbAccess.GetFieldInt(dr["COMPLETED"], 0) == 1 ? 100 : -1;
|
||||
if (!wo.Completed)
|
||||
wo.CompleteDate = null;
|
||||
|
||||
list.Add(wo);
|
||||
}
|
||||
@ -717,7 +611,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
#region Machines
|
||||
|
||||
|
||||
public static MaintenanceMachineInfo[] GetMaintenanceMachines1(string sessionid, int machinetype, string searchtxt, string useriid, string companyid = null)
|
||||
public static MaintenanceMachineInfo[] GetMaintenanceMachines(string sessionid, int machinetype, string searchtxt, string useriid, string companyid = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -727,7 +621,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
var client = FleetServiceClientHelper.CreateClient<AssetQueryClient>(companyid, sessionid);
|
||||
if (user.UserType < Users.UserTypes.Admin)
|
||||
availableAssetsids = client.GetAvailableAssetsForUsers(companyid, useriid);
|
||||
AssetBasicInfo[] assets = client.GetAssetBasicInfo(companyid, searchtxt, availableAssetsids);
|
||||
AssetBasicInfo[] assets = client.GetAssetBasicInfo(companyid, searchtxt, availableAssetsids, 0);
|
||||
if (assets != null && machinetype != -1)
|
||||
assets = assets.Where(m => m.TypeID == machinetype).ToArray();
|
||||
long[] mids = null;
|
||||
@ -749,7 +643,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
mi.TypeID = a.TypeID;
|
||||
mi.MachineType = a.TypeName;
|
||||
mi.Hide = a.Hide;
|
||||
mi.EngineHours = a.EngineHours;
|
||||
mi.EngineHours = a.EngineHours == null ? 0 : a.EngineHours.Value;
|
||||
if (odos != null && odos.Length > 0)
|
||||
{
|
||||
var odo = odos.FirstOrDefault((o) => o.AssetID == mi.MachineID);
|
||||
@ -763,104 +657,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static MaintenanceMachineInfo[] GetMaintenanceMachines(string sessionid, int machinetype, string searchtxt, string useriid, string companyid = null)
|
||||
{
|
||||
const string SQL = @"select m.MACHINEID,m.MACHINENAME2,m.MACHINENAME,m.MAKEID,m.MODELID,m.TYPEID,m.VIN,ISNULL(m.ENGINEHOURS,0) as ENGINEHOURS,
|
||||
ISNULL(m.ODOMETER,0) as ODOMETER,ISNULL(m.ODOMETERUOM,'Mile') AS ODOMETERUOM,m.HIDE from MACHINES m
|
||||
where 1=1";
|
||||
const string ORDER_BY = " order by MACHINEID";
|
||||
|
||||
string sql = string.Empty;
|
||||
if (machinetype >= 0)
|
||||
{
|
||||
sql = SQL + " and TYPEID=" + machinetype.ToString() + ORDER_BY;
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = SQL + ORDER_BY;
|
||||
}
|
||||
|
||||
FIDbAccess db = null;
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
{
|
||||
companyid = SystemParams.CompanyID;
|
||||
db = SystemParams.GetDbInstance();
|
||||
}
|
||||
else
|
||||
{
|
||||
string connetionstring = SystemParams.GetDbStringByCompany(companyid);
|
||||
db = new FISqlConnection(connetionstring);
|
||||
}
|
||||
|
||||
DataTable tb = db.GetDataTableBySQL(sql);
|
||||
if (tb.Rows.Count == 0)
|
||||
{
|
||||
return new MaintenanceMachineInfo[0];
|
||||
}
|
||||
|
||||
long[] availableAssetsids = null;
|
||||
var user = Users.UserManagement.GetUserByIID(useriid);
|
||||
if (user.UserType < Users.UserTypes.Admin)
|
||||
availableAssetsids = FleetServiceClientHelper.CreateClient<AssetQueryClient>(companyid, sessionid).GetAvailableAssetsForUsers(companyid, useriid);
|
||||
|
||||
MachineManagement.RefreshBaseData();
|
||||
MachineMake[] makes = MachineManagement.GetMachineMakes();
|
||||
MachineModel[] models = MachineManagement.GetMachineModels();
|
||||
MachineType[] types = MachineManagement.GetMachineTypes();
|
||||
List<MaintenanceMachineInfo> ls = new List<MaintenanceMachineInfo>();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
long mid = Convert.ToInt64(dr["MACHINEID"]);
|
||||
if (user.UserType < Users.UserTypes.Admin && !availableAssetsids.Contains(mid))
|
||||
continue;
|
||||
MaintenanceMachineInfo mi = ConvertToMaintenanceMachineInfo(dr, makes, models, types);
|
||||
mi.Hide = FIDbAccess.GetFieldInt(dr["HIDE"], 0) == 1;
|
||||
if (mi.Hide) continue;
|
||||
if (!string.IsNullOrWhiteSpace(searchtxt))
|
||||
{
|
||||
if (Helper.Contains(mi.VIN, searchtxt)
|
||||
|| Helper.Contains(mi.MachineID.ToString(), searchtxt)
|
||||
|| Helper.Contains(mi.MachineName, searchtxt)
|
||||
|| Helper.Contains(mi.MachineName2, searchtxt)
|
||||
|| Helper.Contains(mi.Make, searchtxt)
|
||||
|| Helper.Contains(mi.MachineType, searchtxt)
|
||||
|| Helper.Contains(mi.Model, searchtxt))
|
||||
{
|
||||
ls.Add(mi);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ls.Add(mi);
|
||||
}
|
||||
}
|
||||
return ls.ToArray();
|
||||
}
|
||||
|
||||
public static MaintenanceMachineInfo GetmachineByMachineID(long machineid)
|
||||
{
|
||||
string SQL = @"select MACHINEID,MACHINENAME,MACHINENAME2,MAKEID,MODELID,TYPEID,VIN,ISNULL(ENGINEHOURS,0) as ENGINEHOURS,
|
||||
ISNULL(ODOMETER,0) as ODOMETER,ISNULL(ODOMETERUOM,'Mile') AS ODOMETERUOM from MACHINES where MACHINEID={0}";
|
||||
FISqlConnection db = SystemParams.GetDbInstance();
|
||||
DataTable tb = db.GetDataTableBySQL(SQL, machineid);
|
||||
MaintenanceMachineInfo mi = new MaintenanceMachineInfo();
|
||||
if (tb.Rows.Count == 0)
|
||||
{
|
||||
mi.MachineID = -1;
|
||||
return mi;
|
||||
}
|
||||
MachineManagement.RefreshBaseData();
|
||||
MachineMake[] makes = MachineManagement.GetMachineMakes();
|
||||
MachineModel[] models = MachineManagement.GetMachineModels();
|
||||
MachineType[] types = MachineManagement.GetMachineTypes();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
mi = ConvertToMaintenanceMachineInfo(dr, makes, models, types);
|
||||
}
|
||||
return mi;
|
||||
}
|
||||
|
||||
public static MaintenanceMachineInfo ConvertToMaintenanceMachineInfo(DataRow dr, MachineMake[] makes, MachineModel[] models, MachineType[] types)
|
||||
public static MaintenanceMachineInfo ConvertToMaintenanceMachineInfo(DataRow dr, AssetMake[] makes, AssetModel[] models, AssetType[] types)
|
||||
{
|
||||
MaintenanceMachineInfo mi = new MaintenanceMachineInfo();
|
||||
mi.MachineID = Convert.ToInt64(dr["MACHINEID"]);
|
||||
@ -871,15 +668,15 @@ namespace IronIntel.Contractor.Maintenance
|
||||
mi.Odometer = FIDbAccess.GetFieldDouble(dr["ODOMETER"], 0);
|
||||
|
||||
int makeid = FIDbAccess.GetFieldInt(dr["MAKEID"], 0);
|
||||
MachineMake make = MachineManagement.GetMachineMake(makes, makeid);
|
||||
AssetMake make = MachineManagement.GetMachineMake(makes, makeid);
|
||||
mi.Make = make == null ? string.Empty : make.Name;
|
||||
|
||||
int modelid = FIDbAccess.GetFieldInt(dr["MODELID"], 0);
|
||||
MachineModel model = MachineManagement.GetMachineModel(models, modelid);
|
||||
AssetModel model = MachineManagement.GetMachineModel(models, modelid);
|
||||
mi.Model = model == null ? string.Empty : model.Name;
|
||||
|
||||
int typeid = FIDbAccess.GetFieldInt(dr["TYPEID"], 0);
|
||||
MachineType mtype = MachineManagement.GetMachineType(types, typeid);
|
||||
AssetType mtype = MachineManagement.GetMachineType(types, typeid);
|
||||
mi.TypeID = mtype == null ? 0 : mtype.ID;
|
||||
mi.MachineType = mtype == null ? string.Empty : mtype.Name;
|
||||
|
||||
@ -902,38 +699,5 @@ namespace IronIntel.Contractor.Maintenance
|
||||
|
||||
#endregion
|
||||
|
||||
public static string[] GetPMDescriptionByAssetID(string companyid, long assetid)
|
||||
{
|
||||
const string SQL_1 = @"select * from usvMaintenanceAlertsMapLayer ml with (nolock) right join
|
||||
(select cast(MachineID as nvarchar) + cast(max(MaintenanceDate) as nvarchar) as MaintenanceID from usvMaintenanceAlertsMapLayer with (nolock) where PMStatus = 'Complete'
|
||||
group by MachineID) a on ml.MaintenanceID = a.MaintenanceID where PMStatus = 'Complete' and MachineID={0}";
|
||||
const string SQL_2 = "select * from usvMaintenanceAlertsMapLayer with (nolock) where PMStatus = 'Overdue' and MachineID={0}";
|
||||
const string SQL_3 = "select * from usvMaintenanceAlertsMapLayer with (nolock) where PMStatus = 'Upcoming' and MachineID={0}";
|
||||
|
||||
|
||||
string connetionstring = SystemParams.DataDbConnectionString;
|
||||
if (SystemParams.IsDealer)
|
||||
connetionstring = SystemParams.GetDbStringByCompany(companyid);
|
||||
|
||||
FISqlConnection db = new FISqlConnection(connetionstring);
|
||||
DataTable dt = db.GetDataTableBySQL(SQL_1, assetid);
|
||||
if (dt == null || dt.Rows.Count == 0)
|
||||
dt = db.GetDataTableBySQL(SQL_2, assetid);
|
||||
if (dt == null || dt.Rows.Count == 0)
|
||||
dt = db.GetDataTableBySQL(SQL_3, assetid);
|
||||
|
||||
if (dt == null || dt.Rows.Count == 0)
|
||||
return new string[0];
|
||||
|
||||
List<string> list = new List<string>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
string desc = FIDbAccess.GetFieldString(dr["DESCRIPTION"], string.Empty);
|
||||
list.Add(desc);
|
||||
}
|
||||
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -22,5 +22,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
public DateTime? CompletedDate { get; set; }
|
||||
public string CompletedDateStr { get { return CompletedDate == null ? "" : CompletedDate.Value.ToShortDateString(); } }
|
||||
public string Component { get; set; }
|
||||
public bool Billable { get; set; }
|
||||
public string SegmentType { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,9 @@
|
||||
using System;
|
||||
using Foresight.Fleet.Services.AssetHealth.WorkOrder;
|
||||
using Foresight.Fleet.Services.Customer;
|
||||
using Foresight.ServiceModel;
|
||||
using IronIntel.Contractor.Machines;
|
||||
using IronIntel.Contractor.Users;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -6,52 +11,228 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace IronIntel.Contractor.Maintenance
|
||||
{
|
||||
public class WorkOrderInfo
|
||||
public class WorkOrderInfoClient : WorkOrderInfo
|
||||
{
|
||||
public long ID { get; set; }
|
||||
public string MaintenanceID { get; set; }
|
||||
public string WorkOrderType { get; set; }
|
||||
public string AssignedTo { get; set; }
|
||||
public string AssignedToName { get; set; }
|
||||
public string Status { get; set; }
|
||||
public long AssetID { get; set; }
|
||||
public string AssetName { get; set; }
|
||||
public string VIN { get; set; }
|
||||
public string Description { get; set; }
|
||||
public DateTime? DueDate { get; set; }
|
||||
public string MakeName { get; set; }
|
||||
public string ModelName { get; set; }
|
||||
public string TypeName { get; set; }
|
||||
public string DueDateStr { get { return DueDate == null ? "" : DueDate.Value.ToShortDateString(); } }
|
||||
public DateTime? CompleteDate { get; set; }
|
||||
public string CompleteDateStr { get { return CompleteDate == null ? "" : CompleteDate.Value.ToShortDateString(); } }
|
||||
public string InvoiceNumber { get; set; }
|
||||
public string NextFollowUpDateStr { get { return NextFollowUpDate == null ? "" : NextFollowUpDate.Value.ToShortDateString(); } }
|
||||
public string PartsExpectedDateStr { get { return PartsExpectedDate == null ? "" : PartsExpectedDate.Value.ToShortDateString(); } }
|
||||
public string LastLaborDateStr { get { return LastLaborDate == null ? "" : LastLaborDate.Value.ToShortDateString(); } }
|
||||
public ContactInfoClient[] ContactsClient { get; set; }
|
||||
public WorkOrderFollowerInfo[] Followers { get; set; }
|
||||
}
|
||||
|
||||
public class WorkOrderDetailInfo : WorkOrderInfo
|
||||
public class ContactInfoClient : ContactInfo
|
||||
{
|
||||
public string MeterType { get; set; }
|
||||
public double HourMeter { get; set; }
|
||||
public string ContactPreferenceStr { get; set; }
|
||||
public int SaveToCustomer { get; set; }
|
||||
}
|
||||
|
||||
private double _Odometer;
|
||||
public double Odometer
|
||||
public class WorkOrderListItemClient : WorkOrderListItem
|
||||
{
|
||||
const char SPLITCHAR = (char)170;
|
||||
const char SPLIT_CHAR182 = (char)182;
|
||||
const char SPLIT_CHAR183 = (char)183;
|
||||
public string DueDateStr { get { return DueDate == null ? "" : DueDate.Value.ToShortDateString(); } }
|
||||
public string CompleteDateStr { get { return CompleteDate == null ? "" : CompleteDate.Value.ToShortDateString(); } }
|
||||
public string NextFollowUpDateStr { get { return NextFollowUpDate == null ? "" : NextFollowUpDate.Value.ToShortDateString(); } }
|
||||
public string CreateDateStr { get { return CreateDate == null ? "" : CreateDate.Value.ToShortDateString(); } }
|
||||
public string CreationDateStr { get { return CreationDate == null ? "" : CreationDate.Value.ToShortDateString(); } }
|
||||
public string LastCommunicationDateStr { get { return (LastCommunicationDate == null || LastCommunicationDate == DateTime.MinValue) ? "" : LastCommunicationDate.Value.ToShortDateString(); } }
|
||||
public string LastInternalCommunicationDateStr { get { return (LastInternalCommunicationDate == null || LastInternalCommunicationDate == DateTime.MinValue) ? "" : LastInternalCommunicationDate.Value.ToShortDateString(); } }
|
||||
public string PartsExpectedDateStr { get { return PartsExpectedDate == null ? "" : PartsExpectedDate.Value.ToShortDateString(); } }
|
||||
public string LastLaborDateStr { get { return LastLaborDate == null ? "" : LastLaborDate.Value.ToShortDateString(); } }
|
||||
|
||||
public string MaintenanceID { get; set; }
|
||||
public WorkOrderStatus[] WorkOrderStatus { get; set; }
|
||||
public UserInfo[] AssignedToUsers { get; set; }
|
||||
public DepartmentInfo[] Departments { get; set; }
|
||||
public CustomerLocation[] Locations { get; set; }
|
||||
public StringKeyValue[] Salespersons { get; set; }
|
||||
public string ContactsStr
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Odometer;
|
||||
}
|
||||
set
|
||||
{
|
||||
value = value > 0 ? value : 0;
|
||||
_Odometer = Math.Round(value, 2);
|
||||
var rst = "";
|
||||
if (Contacts != null && Contacts.Count > 0)
|
||||
{
|
||||
for (var i = 0; i < Contacts.Count; i++)
|
||||
{
|
||||
var contact = Contacts[i];
|
||||
var ptext = contact.Name;
|
||||
if ((int)contact.ContactPreference == 0)
|
||||
{
|
||||
ptext += " – T";
|
||||
if (contact.MobilePhoneDisplayText != "")
|
||||
ptext += " – " + contact.MobilePhoneDisplayText;
|
||||
}
|
||||
else if ((int)contact.ContactPreference == 1)
|
||||
{
|
||||
if (contact.Email != "")
|
||||
ptext += " - " + contact.Email;
|
||||
}
|
||||
else if ((int)contact.ContactPreference == 2)
|
||||
{
|
||||
ptext += " – P";
|
||||
if (contact.MobilePhoneDisplayText != "")
|
||||
ptext += " – " + contact.MobilePhoneDisplayText;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(rst))
|
||||
rst += ptext;
|
||||
else
|
||||
rst += ("\n" + ptext);
|
||||
}
|
||||
}
|
||||
return rst;
|
||||
}
|
||||
}
|
||||
public string OdometerUnits { get; set; }
|
||||
public decimal WorkOrderTotalCost { get; set; }
|
||||
public decimal HoursToComplete { get; set; }
|
||||
public string InternalID { get; set; }
|
||||
public string Notes { get; set; }
|
||||
public decimal PartsCost { get; set; }
|
||||
public decimal TravelTimeCost { get; set; }
|
||||
public decimal LaborCost { get; set; }
|
||||
public decimal HourlyRate { get; set; }
|
||||
public decimal OtherCost { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(base.ToString());
|
||||
sb.Append(SPLITCHAR + DueDateStr);
|
||||
sb.Append(SPLITCHAR + CompleteDateStr);
|
||||
sb.Append(SPLITCHAR + NextFollowUpDateStr);
|
||||
sb.Append(SPLITCHAR + CreateDateStr);
|
||||
sb.Append(SPLITCHAR + CreationDateStr);
|
||||
sb.Append(SPLITCHAR + LastCommunicationDateStr);
|
||||
sb.Append(SPLITCHAR + LastInternalCommunicationDateStr);
|
||||
sb.Append(SPLITCHAR + PartsExpectedDateStr);
|
||||
sb.Append(SPLITCHAR + LastLaborDateStr);
|
||||
sb.Append(SPLITCHAR + MaintenanceID);
|
||||
sb.Append(SPLITCHAR + ((WorkOrderStatus != null && WorkOrderStatus.Length > 0) ? WorkOrderStatus[0].ToString() : ""));
|
||||
if (AssignedToUsers != null && AssignedToUsers.Length > 0)
|
||||
{
|
||||
StringBuilder sb1 = new StringBuilder();
|
||||
foreach (UserInfo user in AssignedToUsers)
|
||||
{
|
||||
string str = user.IID + SPLIT_CHAR183 + user.DisplayName;
|
||||
if (sb1.Length == 0)
|
||||
sb1.Append(str);
|
||||
else
|
||||
sb1.Append(SPLIT_CHAR182 + str);
|
||||
}
|
||||
sb.Append(SPLITCHAR + sb1.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(SPLITCHAR + "");
|
||||
}
|
||||
|
||||
if (Departments != null && Departments.Length > 0)
|
||||
{
|
||||
StringBuilder sb1 = new StringBuilder();
|
||||
foreach (DepartmentInfo dept in Departments)
|
||||
{
|
||||
string str = dept.Id.ToString() + SPLIT_CHAR183 + dept.Name;
|
||||
if (sb1.Length == 0)
|
||||
sb1.Append(str);
|
||||
else
|
||||
sb1.Append(SPLIT_CHAR182 + str);
|
||||
}
|
||||
sb.Append(SPLITCHAR + sb1.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(SPLITCHAR + "");
|
||||
}
|
||||
|
||||
if (Locations != null && Locations.Length > 0)
|
||||
{
|
||||
StringBuilder sb1 = new StringBuilder();
|
||||
foreach (CustomerLocation loc in Locations)
|
||||
{
|
||||
string str = loc.ID.ToString() + SPLIT_CHAR183 + loc.Name;
|
||||
if (sb1.Length == 0)
|
||||
sb1.Append(str);
|
||||
else
|
||||
sb1.Append(SPLIT_CHAR182 + str);
|
||||
}
|
||||
sb.Append(SPLITCHAR + sb1.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(SPLITCHAR + "");
|
||||
}
|
||||
|
||||
if (Salespersons != null && Salespersons.Length > 0)
|
||||
{
|
||||
StringBuilder sb1 = new StringBuilder();
|
||||
foreach (StringKeyValue sale in Salespersons)
|
||||
{
|
||||
string str = sale.Key + SPLIT_CHAR183 + sale.Value;
|
||||
if (sb1.Length == 0)
|
||||
sb1.Append(str);
|
||||
else
|
||||
sb1.Append(SPLIT_CHAR182 + str);
|
||||
}
|
||||
sb.Append(SPLITCHAR + sb1.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(SPLITCHAR + "");
|
||||
}
|
||||
sb.Append(SPLITCHAR + ContactsStr);
|
||||
sb.Append(SPLITCHAR + (Completed ? "1" : "0"));
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public class TextMessageClient : TextMessage
|
||||
{
|
||||
public bool StatusIncorrect
|
||||
{//6219, 2022-09-20 17:50:00 以前的状态可能存在问题,界面上不显示状态
|
||||
get
|
||||
{
|
||||
return SystemParams.CustomerDetail.CustomerTimeToUtc(Time) < DateTime.Parse("2022-09-20 17:50:00");
|
||||
}
|
||||
}
|
||||
|
||||
public string FormatSender
|
||||
{
|
||||
get
|
||||
{
|
||||
var rst = "";
|
||||
if (IsReply)
|
||||
{
|
||||
if (Helper.IsEmail(Sender) || !Helper.IsNumber(Sender))
|
||||
rst = Sender;
|
||||
else
|
||||
rst = Foresight.Standard.PhoneNumber.FormatPhoneNumber(Sender);
|
||||
}
|
||||
return rst;
|
||||
}
|
||||
}
|
||||
|
||||
public string[] OriPhoneNumbers
|
||||
{
|
||||
get
|
||||
{
|
||||
List<string> ls = new List<string>();
|
||||
if (Participator != null && Participator.Count > 0)
|
||||
{
|
||||
foreach (var p in Participator)
|
||||
{
|
||||
if (Helper.IsEmail(p.CustomerNumber))
|
||||
ls.Add(p.CustomerNumber);
|
||||
else
|
||||
{
|
||||
p.CustomerNumber = Foresight.Standard.PhoneNumber.FormatPhoneNumber(p.CustomerNumber);
|
||||
ls.Add(Foresight.Standard.PhoneNumber.PreparePhonenumber(p.CustomerNumber));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ls.ToArray();
|
||||
}
|
||||
}
|
||||
public string TimeStr { get { return Time == DateTime.MinValue ? "" : Time.ToString("M/d/yyyy h:mm tt"); } }
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,13 @@ using Foresight.Data;
|
||||
using System.Web;
|
||||
using Foresight.Fleet.Services.AssetHealth;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using Foresight.Fleet.Services.AssetHealth.WorkOrder;
|
||||
using Foresight.Fleet.Services.Inspection;
|
||||
using Foresight.Chart.Drawer;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using Foresight.Chart.Drawer.Contracts;
|
||||
using System.Net.Mail;
|
||||
|
||||
namespace IronIntel.Contractor.Maintenance
|
||||
{
|
||||
@ -47,8 +54,8 @@ namespace IronIntel.Contractor.Maintenance
|
||||
Int64.TryParse(mid, out assetid);
|
||||
else
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<WorkOrderClient>(sessionid);
|
||||
var workorder = client.GetWorkOrderDetail(SystemParams.CompanyID, Convert.ToInt64(woid));
|
||||
var client = FleetServiceClientHelper.CreateClient<WorkOrderProvider>(sessionid);
|
||||
var workorder = client.GetWorkOrderInfo(SystemParams.CompanyID, Convert.ToInt64(woid));
|
||||
assetid = workorder.AssetID;
|
||||
}
|
||||
long[] availableAssetsids = FleetServiceClientHelper.CreateClient<AssetQueryClient>(sessionid).GetAvailableAssetsForUsers(SystemParams.CompanyID, useriid);
|
||||
@ -77,113 +84,757 @@ namespace IronIntel.Contractor.Maintenance
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static string GenerateWorkOrderPrintHtml(string sessionid, string companyid, long woid)
|
||||
public string[] GetLocations()
|
||||
{
|
||||
const string SQL = @"select distinct LOCATION from WORKORDER where ISNULL(LOCATION,'')<>''";
|
||||
|
||||
DataTable dt = GetDataTableBySQL(SQL);
|
||||
if (dt.Rows.Count == 0)
|
||||
return new string[0];
|
||||
|
||||
List<string> list = new List<string>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
string num = FIDbAccess.GetFieldString(dr["LOCATION"], string.Empty);
|
||||
if (!string.IsNullOrEmpty(num))
|
||||
list.Add(num);
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public string[] GetDepartments()
|
||||
{
|
||||
const string SQL = @"select distinct DEPARTMENT from WORKORDER where ISNULL(DEPARTMENT,'')<>''";
|
||||
|
||||
DataTable dt = GetDataTableBySQL(SQL);
|
||||
if (dt.Rows.Count == 0)
|
||||
return new string[0];
|
||||
|
||||
List<string> list = new List<string>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
string num = FIDbAccess.GetFieldString(dr["DEPARTMENT"], string.Empty);
|
||||
if (!string.IsNullOrEmpty(num))
|
||||
list.Add(num);
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
|
||||
public string[] GetAdvisors()
|
||||
{
|
||||
const string SQL = @"select distinct ADVISOR from WORKORDER where ISNULL(ADVISOR,'')<>''";
|
||||
|
||||
DataTable dt = GetDataTableBySQL(SQL);
|
||||
if (dt.Rows.Count == 0)
|
||||
return new string[0];
|
||||
|
||||
List<string> list = new List<string>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
string num = FIDbAccess.GetFieldString(dr["ADVISOR"], string.Empty);
|
||||
if (!string.IsNullOrEmpty(num))
|
||||
list.Add(num);
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
public static string GenerateWorkOrderPrintHtml(string sessionid, string companyid, long woid, string lang)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<WorkOrderProvider>(companyid, sessionid);
|
||||
WorkOrderInfo wo = client.GetWorkOrderInfo(companyid, woid);
|
||||
|
||||
StringBuilder str = new StringBuilder();
|
||||
str.AppendLine("<H1 style='text-align:center;'>Work Order</H1>");
|
||||
str.AppendFormat("<div style='font-weight:bold;'>Details for work order <{0}> are listed below:</div>", woid);
|
||||
str.AppendLine("<H1 style='text-align:center;'>" + SystemParams.GetTextByKey(lang, "P_WORKORDER", "Work Order") + "</H1>");
|
||||
string detailstr = SystemParams.GetTextByKey(lang, "P_WO_DETAILFORWORKORDERARELISTEDBELOW", "Details for work order <{0}> are listed below:").Replace("<", "<").Replace(">", ">");
|
||||
str.AppendFormat("<div style='font-weight:bold;padding-bottom:5px;'>" + detailstr + "</div>", wo.WorkOrderNumber);
|
||||
str.AppendLine("");
|
||||
//str.AppendLine("<div class='label' style='text-align:left;'>Work Order Information:</div>");
|
||||
str.AppendLine("<div style='padding-left:30px;margin-bottom:36px;'>");
|
||||
|
||||
var client = FleetServiceClientHelper.CreateClient<WorkOrderClient>(companyid, sessionid);
|
||||
WorkOrderDetail wo = client.GetWorkOrderDetail(companyid, woid);
|
||||
str.Append(GenerateWorkOrderInfoHtml(wo));
|
||||
var aclient = FleetServiceClientHelper.CreateClient<AssetQueryClient>(companyid, sessionid);
|
||||
var asset = aclient.GetAssetDetailInfo(companyid, wo.AssetID);
|
||||
str.Append(GenerateWorkOrderInfoHtml(asset, wo, lang));
|
||||
str.AppendLine("</div>");
|
||||
//str.AppendLine("<div class='label' style='text-align:left;'>Segments:</div>");
|
||||
|
||||
WorkOrderSegmentItem[] segments = client.GetSegments(companyid, woid);
|
||||
WorkOrderSegmentInfo[] segments = client.GetSegments(companyid, woid);
|
||||
|
||||
if (segments != null && segments.Length > 0)
|
||||
{
|
||||
for (int i = 0; i < segments.Length; i++)
|
||||
{
|
||||
var se = segments[i];
|
||||
str.Append(GenerateSegmentHtml(se, i + 1));
|
||||
str.Append(GenerateSegmentHtml(se, i + 1, lang));
|
||||
}
|
||||
}
|
||||
|
||||
str.Append("<div style='margin-bottom:36px;margin-left:30px;'>");
|
||||
str.Append(WorkorderAlertsFormart(woid, lang, sessionid));
|
||||
|
||||
AssetInspectItem[] insplectitems = client.GetWOInspectItems(SystemParams.CompanyID, woid);
|
||||
if (insplectitems != null && insplectitems.Length > 0)
|
||||
{
|
||||
foreach (AssetInspectItem isp in insplectitems)
|
||||
{
|
||||
var report = FleetServiceClientHelper.CreateClient<AssetInspectClient>(sessionid).GetInspection(SystemParams.CompanyID, isp.Id);
|
||||
str.Append(GenerateInspectionHtml(report, lang));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
str.Append("</div>");
|
||||
|
||||
return str.ToString();
|
||||
}
|
||||
|
||||
private static string GenerateWorkOrderInfoHtml(WorkOrderDetail wo)
|
||||
private static string GenerateWorkOrderInfoHtml(AssetDetailInfo asset, WorkOrderInfo wo, string lang)
|
||||
{
|
||||
StringBuilder str = new StringBuilder();
|
||||
str.Append("<table>");
|
||||
str.AppendFormat("<tr><td class='label' style='width:170px;'>Work Order Type</td><td>{0}</td></tr>", wo.WorkOrderType);
|
||||
str.AppendFormat("<tr><td class='label' style='width:170px;'>" + SystemParams.GetTextByKey(lang, "P_WO_ASSETNAME", "Asset Name") + "</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(asset.Name));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Assigned To</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(wo.AssignedToName));
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_ASSETNAMECUSTOM", "Asset Name (Custom)") + "</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(asset.Name2));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Status</td><td>{0}</td></tr>", wo.Status);
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_VIN", "VIN/SN") + "</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(asset.VIN));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Due Date</td><td>{0}</td></tr>", wo.DueDate == null ? "" : wo.DueDate.Value.ToShortDateString());
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_MAKE", "Make") + "</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(asset.MakeName));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Description</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(wo.Description).Replace("\n", "<br>"));
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_MODEL", "Model") + "</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(asset.ModelName));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Meter Type</td><td>{0}</td></tr>", wo.MeterType);
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_ASSETTYPE", "Asset Type") + "</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(asset.TypeName));
|
||||
str.AppendLine("");
|
||||
if (string.Compare(wo.MeterType, "HourMeter", true) == 0
|
||||
|| string.Compare(wo.MeterType, "Both", true) == 0)
|
||||
str.AppendFormat("<tr><td class='label'>Hour Meter</td><td>{0}</td></tr>", wo.HourMeter);
|
||||
if (string.Compare(wo.MeterType, "Odometer", true) == 0
|
||||
|| string.Compare(wo.MeterType, "Both", true) == 0)
|
||||
str.AppendFormat("<tr><td class='label'>Odometer</td><td>{0} {1}</td></tr>", wo.Odometer, wo.OdometerUnits);
|
||||
str.AppendFormat("<tr><td class='label'>Work Order Total Costs ($)</td><td>{0}</td></tr>", wo.WorkOrderTotalCost);
|
||||
if (asset.OnRoad)
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_CURRENTODOMETER", "Current Odometer") + "</td><td>{0}</td></tr>", asset.CurrentOdometer == null ? "" : asset.CurrentOdometer.Corrected.ToString("#,##0"));
|
||||
else
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_CURRENTHOURS", "Current Hours") + "</td><td>{0}</td></tr>", asset.CurrentHours == null ? "" : asset.CurrentHours.Corrected.ToString("#,##0"));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Other Cost ($)</td><td>{0}</td></tr>", wo.OtherCost);
|
||||
str.AppendFormat("<tr><td class='label' style='width:170px;'>" + SystemParams.GetTextByKey(lang, "P_WO_CURRJOBSITE", "Current Jobsite") + " </td><td>{0}</td></tr>", HttpUtility.HtmlEncode(asset.CurrentJobSiteNames));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Parts Cost ($)</td><td>{0}</td></tr>", wo.PartsCost);
|
||||
str.AppendFormat("<tr><td class='label' style='width:170px;'>" + SystemParams.GetTextByKey(lang, "P_WO_CURRLOCATION", "Current Location") + " </td><td>{0}</td></tr>", asset.CurrentLocation == null ? "" : HttpUtility.HtmlEncode(asset.CurrentLocation.Address));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Travel Time Cost ($)</td><td>{0}</td></tr>", wo.TravelTimeCost);
|
||||
str.AppendFormat("<tr><td class='label' style='width:170px;'>" + SystemParams.GetTextByKey(lang, "P_WO_WORKORDERTYPE", "Work Order Type") + "</td><td>{0}</td></tr>", wo.WorkOrderType);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Labor Cost ($)</td><td>{0}</td></tr>", wo.LaborCost);
|
||||
str.AppendFormat("<tr><td class='label' style='width:170px;'>" + SystemParams.GetTextByKey(lang, "P_WO_COMPONENT", "Work Order Type") + "</td><td>{0}</td></tr>", wo.Completed);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Hourly Rate</td><td>{0}</td></tr>", wo.HourlyRate);
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_ASSIGNEDTO", "Assigned To") + "</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(wo.AssignedToName));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Time To Complete(Hrs)</td><td>{0}</td></tr>", wo.HoursToComplete);
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_STATUS", "Status") + "</td><td>{0}</td></tr>", wo.StatusName);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Completed Date</td><td>{0}</td></tr>", wo.CompleteDate == null ? "" : wo.CompleteDate.Value.ToShortDateString());
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_DUEDATE", "Due Date") + "</td><td>{0}</td></tr>", wo.DueDate == null ? "" : wo.DueDate.Value.ToShortDateString());
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Internal ID</td><td>{0}</td></tr>", wo.InternalID);
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_NEXTFOLLOWUPDATE", "Next Follow Up Date") + "</td><td>{0}</td></tr>", wo.NextFollowUpDate == null ? "" : wo.NextFollowUpDate.Value.ToShortDateString());
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Invoice Number</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(wo.InvoiceNumber));
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_DESCRIPTION", "Description") + "</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(wo.Description).Replace("\n", "<br>"));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Notes</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(wo.Notes).Replace("\n", "<br>"));
|
||||
if (wo.Completed)
|
||||
{
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_METERTYPE", "Meter Type") + "</td><td>{0}</td></tr>", wo.MeterType);
|
||||
str.AppendLine("");
|
||||
if (string.Compare(wo.MeterType, "HourMeter", true) == 0
|
||||
|| string.Compare(wo.MeterType, "Both", true) == 0)
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_HOURMETER", "Hour Meter") + "</td><td>{0}</td></tr>", wo.HourMeter);
|
||||
if (string.Compare(wo.MeterType, "Odometer", true) == 0
|
||||
|| string.Compare(wo.MeterType, "Both", true) == 0)
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_ODOMETER", "Odometer") + "</td><td>{0} {1}</td></tr>", wo.Odometer, wo.OdometerUnits);
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_WORKORDERTOTALCOST", "Work Order Total Costs ($)") + "</td><td>{0}</td></tr>", wo.WorkOrderTotalCost);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_OTHERCOST", "Other Cost ($)") + "</td><td>{0}</td></tr>", wo.OtherCost);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_PARTSCOST", "Parts Cost ($)") + "</td><td>{0}</td></tr>", wo.PartsCost);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_TRAVELTIMECOST", "Travel Time Cost ($)") + "</td><td>{0}</td></tr>", wo.TravelTimeCost);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_LABORCOST", "Labor Cost ($)") + "</td><td>{0}</td></tr>", wo.LaborCost);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_HOURLYRATE", "Hourly Rate") + "</td><td>{0}</td></tr>", wo.HourlyRate);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_TIMETOCOMPLATEHOURS", "Labor Hours") + "</td><td>{0}</td></tr>", wo.HoursToComplete);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_COMPLETEDDATE", "Completed Date") + "</td><td>{0}</td></tr>", wo.CompleteDate == null ? "" : wo.CompleteDate.Value.ToShortDateString());
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_INTERNALID", "Internal ID") + "</td><td>{0}</td></tr>", wo.InternalID);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_INVOICENUMBER", "Invoice Number") + "</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(wo.InvoiceNumber));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + "Billable" + "</td><td>{0}</td></tr>", wo.Billable ? SystemParams.GetTextByKey(lang, "P_UTILITY_YES", "Yes") : SystemParams.GetTextByKey(lang, "P_UTILITY_NO", "No"));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + "Bill To Job" + "</td><td>{0}</td></tr>", wo.BillToJobName);
|
||||
str.AppendLine("");
|
||||
}
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_NOTES", "Notes") + "</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(wo.Notes).Replace("\n", "<br>"));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("</table>");
|
||||
|
||||
return str.ToString();
|
||||
}
|
||||
|
||||
private static string GenerateSegmentHtml(WorkOrderSegmentItem se, int index)
|
||||
private static string GenerateSegmentHtml(WorkOrderSegmentInfo se, int index, string lang)
|
||||
{
|
||||
StringBuilder str = new StringBuilder();
|
||||
//str.AppendFormat("<div style='margin-bottom:36px;margin-left:30px;{0}'>", (index - 2) % 4 == 0 ? "page-break-after: always;" : "");
|
||||
//str.AppendLine("");
|
||||
str.AppendLine("<div style='margin-bottom:36px;margin-left:30px;'>");
|
||||
str.AppendLine("<table>");
|
||||
str.AppendFormat("<tr><td class='label' colspan='2' style='text-align:left;'>Segment {0}</td></tr>", index);
|
||||
str.AppendFormat("<tr><td class='label' colspan='2' style='text-align:left;'>" + SystemParams.GetTextByKey(lang, "P_WO_SEGMENT", "Segment") + " {0}</td></tr>", index);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label' style='width:170px;'>User</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(se.UserName));
|
||||
str.AppendFormat("<tr><td class='label' style='width:170px;'>" + SystemParams.GetTextByKey(lang, "P_WO_USER", "User") + "</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(se.UserName));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Hours</td><td>{0}</td></tr>", se.Hours);
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_HOURS", "Hours") + "</td><td>{0}</td></tr>", se.Hours);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Job Site</td><td>{0}</td></tr>", se.JobsiteName);
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_JOBSITE", "Jobsite") + "</td><td>{0}</td></tr>", se.JobsiteName);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Cost</td><td>{0}</td></tr>", se.Cost);
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_COST", "Cost") + "</td><td>{0}</td></tr>", se.Cost);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Component</td><td>{0}</td></tr>", se.Component);
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_COMPONENT", "Component") + "</td><td>{0}</td></tr>", se.Component);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Completed</td><td>{0}</td></tr>", se.Completed ? "Yes" : "No");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_COMPLETED", "Completed") + "</td><td>{0}</td></tr>", se.Completed ? SystemParams.GetTextByKey(lang, "P_UTILITY_YES", "Yes") : SystemParams.GetTextByKey(lang, "P_UTILITY_NO", "No"));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Completed Date</td><td>{0}</td></tr>", se.CompletedDate == null ? "" : se.CompletedDate.Value.ToShortDateString());
|
||||
str.AppendFormat("<tr><td class='label'>Description</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(se.Description));
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_COMPLETEDDATE", "Completed Date") + "</td><td>{0}</td></tr>", se.CompletedDate == null ? "" : se.CompletedDate.Value.ToShortDateString());
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_SEGMENTTYPE", "Segment Type") + "</td><td>{0}</td></tr>", se.SegmentType);
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_BILLABLE", "Billable") + "</td><td>{0}</td></tr>", se.Billable ? SystemParams.GetTextByKey(lang, "P_UTILITY_YES", "Yes") : SystemParams.GetTextByKey(lang, "P_UTILITY_NO", "No"));
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_DESCRIPTION", "Description") + "</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(se.Description));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>Notes</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(se.Notes).Replace("\n", "<br>"));
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_NOTES", "Notes") + "</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(se.Notes).Replace("\n", "<br>"));
|
||||
str.AppendLine("");
|
||||
str.AppendLine("</table>");
|
||||
str.AppendLine("</div>");
|
||||
return str.ToString();
|
||||
}
|
||||
|
||||
private static string GenerateInspectionHtml(InspectReportInfo report, string lang)
|
||||
{
|
||||
StringBuilder str = new StringBuilder();
|
||||
str.AppendLine("<div style='margin-bottom:36px;'>");
|
||||
str.AppendLine("<table>");
|
||||
str.AppendFormat("<tr><td class='label' colspan='2' style='text-align:left;'>" + report.Template.Name + " <span style='margin-left:30px;'>" + (report.CommitTimeLocal == DateTime.MinValue ? "" : report.CommitTimeLocal.ToString("M/d/yyyy h:mm tt")) + "</span></td></tr>");
|
||||
str.AppendLine("");
|
||||
foreach (var page in report.Template.Pages)
|
||||
{
|
||||
foreach (var section in page.Sections)
|
||||
{
|
||||
foreach (var q in section.Questions)
|
||||
{
|
||||
//if (q.VisibleToCustomer)
|
||||
//{
|
||||
str.AppendLine("<tr><td class='label' style='width:170px;'>" + q.DisplayText + "</td>");
|
||||
var span_level = "<span style='float:right;padding-right:3px;'>" + ShowSeverityLevel(lang, (int)q.SeverityLevel) + "</span>";
|
||||
InspectResultItem[] anwers = report.Answers.Where(m => m.QuestionId.ToLower() == q.Id.ToLower()).ToArray();
|
||||
if (anwers != null && anwers.Length > 0)
|
||||
{
|
||||
foreach (var a in anwers)
|
||||
{
|
||||
int[] ids = new int[] { 5, 8, 9, 10, 14, 15 };
|
||||
if (!ids.Contains((int)q.QuestionType) || ((int)q.QuestionType == 15 && q.SubType != 15))
|
||||
{
|
||||
var result = a.Result;
|
||||
if (result == null)
|
||||
result = "";
|
||||
|
||||
if ((int)q.QuestionType == 6 && result.IndexOf(' ') >= 0)//Date do not show time
|
||||
result = result.Split(' ')[0];
|
||||
if ((int)q.QuestionType == 11//Odometer
|
||||
|| (int)q.QuestionType == 18 //FuelUsed
|
||||
|| ((int)q.QuestionType == 15 && q.SubType == 8)//FuelRecords Odometer
|
||||
|| ((int)q.QuestionType == 15 && q.SubType == 10))//FuelRecords Quantity
|
||||
result += " " + ConvertUnits(a.Units);
|
||||
|
||||
if ((int)q.QuestionType == 17 && q.TextToCompare != null && result.ToLower() != q.TextToCompare.ToLower()) // BarCodeValidate
|
||||
str.AppendLine("<td><span style='color:red'>" + result + "<span><span style='margin-left:6px'>(" + q.TextToCompare + ")<span>");
|
||||
else
|
||||
str.AppendLine("<td>" + result);
|
||||
|
||||
str.AppendLine(span_level + "</td>");
|
||||
break;
|
||||
}
|
||||
else if ((int)q.QuestionType == 5)//YesOrNo
|
||||
{
|
||||
if (a.SelectedItems != null && a.SelectedItems.Count > 0)
|
||||
{
|
||||
span_level = "<span style='float:right;padding-right:3px;'>" + ShowSeverityLevel(lang, (int)a.SelectedItems[0].SeverityLevel) + "</span>";
|
||||
var label = "<label style='margin-left:5px; '>" + a.SelectedItems[0].Text + "</lable>";
|
||||
var div_circle = "<div style=' width: 12px; height: 12px; border-radius: 6px; display: inline-block;'></div>";
|
||||
if (!string.IsNullOrEmpty(a.SelectedItems[0].BackgroundColor))
|
||||
{
|
||||
div_circle = "<div style=' width: 12px; height: 12px; border-radius: 6px; display: inline-block;background-color:" + a.SelectedItems[0].BackgroundColor + "'></div>";
|
||||
}
|
||||
|
||||
str.AppendLine("<td>" + div_circle + label + span_level + "</td>");
|
||||
}
|
||||
}
|
||||
else if ((int)q.QuestionType == 8 || (int)q.QuestionType == 9 || ((int)q.QuestionType == 15 && q.SubType == 6) || ((int)q.QuestionType == 15 && q.SubType == 9))//DropDown、List
|
||||
{
|
||||
if (q.MultipleSelect)
|
||||
{
|
||||
if (a.SelectedItems != null && a.SelectedItems.Count > 0)
|
||||
{
|
||||
StringBuilder str1 = new StringBuilder();
|
||||
str1.AppendLine("<table class='inptable'>");
|
||||
for (var j = 0; j < a.SelectedItems.Count; j++)
|
||||
{
|
||||
str1.AppendLine("<tr>");
|
||||
span_level = "<span style='float:right;padding-right:3px;'>" + ShowSeverityLevel(lang, (int)a.SelectedItems[j].SeverityLevel) + "</span>";
|
||||
var label = "<label style='margin-left:5px; '>" + (j + 1) + ". " + a.SelectedItems[j].Text + "</lable>";
|
||||
|
||||
var div_circle = "<div style=' width: 12px; height: 12px; border-radius: 6px; display: inline-block;'></div>";
|
||||
if (!string.IsNullOrEmpty(a.SelectedItems[j].BackgroundColor))
|
||||
{
|
||||
div_circle = "<div style=' width: 12px; height: 12px; border-radius: 6px; display: inline-block;background-color:" + a.SelectedItems[j].BackgroundColor + "'></div>";
|
||||
}
|
||||
str1.AppendLine("<td>" + div_circle + label + span_level + "</td>");
|
||||
str1.AppendLine("</tr>");
|
||||
}
|
||||
|
||||
str1.AppendLine("</table>");
|
||||
str.AppendLine("<td>" + str1.ToString() + "</td>");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (a.SelectedItems != null && a.SelectedItems.Count > 0)
|
||||
{
|
||||
span_level = "<span style='float:right;padding-right:3px;'>" + ShowSeverityLevel(lang, (int)a.SelectedItems[0].SeverityLevel) + "</span>";
|
||||
var label = "<label style='margin-left:5px; '>" + a.SelectedItems[0].Text + "</lable>";
|
||||
|
||||
var div_circle = "<div style=' width: 12px; height: 12px; border-radius: 6px; display: inline-block;'></div>";
|
||||
if (!string.IsNullOrEmpty(a.SelectedItems[0].BackgroundColor))
|
||||
{
|
||||
div_circle = "<div style=' width: 12px; height: 12px; border-radius: 6px; display: inline-block;background-color:" + a.SelectedItems[0].BackgroundColor + "'></div>";
|
||||
}
|
||||
|
||||
str.AppendLine("<td>" + div_circle + label + span_level + "</td>");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((int)q.QuestionType == 14)//Email (Drop Down)
|
||||
{
|
||||
if (a.SelectedItems != null && a.SelectedItems.Count > 0)
|
||||
{
|
||||
StringBuilder str1 = new StringBuilder();
|
||||
str1.AppendLine("<table class='inptable'>");
|
||||
for (var j = 0; j < a.SelectedItems.Count; j++)
|
||||
{
|
||||
str1.AppendLine("<tr>");
|
||||
var label = "<label>" + (j + 1) + ". " + a.SelectedItems[j].Text + "<" + a.SelectedItems[j].Value + "</lable>"; ;
|
||||
str1.AppendLine("<td>" + label + "</td>");
|
||||
str1.AppendLine("</tr>");
|
||||
}
|
||||
str1.AppendLine("</table>");
|
||||
str.AppendLine("<td>" + str1.ToString() + "</td>");
|
||||
}
|
||||
}
|
||||
else if ((int)q.QuestionType == 10 || ((int)q.QuestionType == 15 && q.SubType == 15))//Picture
|
||||
{
|
||||
StringBuilder str1 = new StringBuilder();
|
||||
str1.AppendLine("<div style='min-height:80px;overflow:auto;'>");
|
||||
if (report.Medias != null && report.Medias.Count > 0)
|
||||
{
|
||||
for (var j = 0; j < report.Medias.Count; j++)
|
||||
{
|
||||
var m = report.Medias[j];
|
||||
if (m.AnswerId.ToLower() == a.Id.ToLower())
|
||||
{
|
||||
string[] pictypes = new string[] { ".mp4", ".mov" };
|
||||
if (pictypes.Contains(m.FileType.ToLower()))
|
||||
{
|
||||
str1.AppendLine("<div class='media'><span class='video'></span></div>");
|
||||
}
|
||||
else
|
||||
{
|
||||
str1.AppendLine("<img class='media' src='" + m.ThumbnailUrl + "'></img>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
str1.AppendLine("</div>");
|
||||
|
||||
str.AppendLine("<td>" + str1.ToString() + "</td>");
|
||||
}
|
||||
else
|
||||
str.AppendLine("<td></td>");
|
||||
}
|
||||
str.AppendLine("</tr>");
|
||||
str.AppendLine("");
|
||||
}
|
||||
else
|
||||
{
|
||||
str.AppendLine("<td></td>");
|
||||
str.AppendLine("</tr>");
|
||||
str.AppendLine("");
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
str.AppendLine("</table>");
|
||||
str.AppendLine("</div>");
|
||||
return str.ToString();
|
||||
}
|
||||
|
||||
private static string ConvertUnits(string u)
|
||||
{
|
||||
switch (u.ToLower())
|
||||
{
|
||||
case "mile":
|
||||
return "Mile(s)";
|
||||
case "kilometre":
|
||||
case "kilometer":
|
||||
return "Kilometer";
|
||||
case "percent":
|
||||
return "Percent";
|
||||
case "gallon":
|
||||
case "gal":
|
||||
return "Gallon";
|
||||
case "litre":
|
||||
return "Litre";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return u;
|
||||
}
|
||||
|
||||
private static string ShowSeverityLevel(string lang, int level)
|
||||
{
|
||||
var levertext = SystemParams.GetTextByKey(lang, "P_IPT_SEVERITYLEVEL_COLON", "Severity Level: ");
|
||||
if (level == 0)
|
||||
levertext = "";
|
||||
if (level == 1)
|
||||
levertext += SystemParams.GetTextByKey(lang, "P_IPT_SL_LOW", "Low");
|
||||
else if (level == 2)
|
||||
levertext += SystemParams.GetTextByKey(lang, "P_IPT_SL_MEDIUM", "Medium");
|
||||
else if (level == 3)
|
||||
levertext += SystemParams.GetTextByKey(lang, "P_IPT_SL_HIGH", "High");
|
||||
return levertext;
|
||||
}
|
||||
|
||||
public static string WorkorderAlertsFormart(long woid, string lang, string sessionid)
|
||||
{
|
||||
AlertItems items = GetWorkOrderAlerts(woid, sessionid);
|
||||
string EmailFormat = string.Empty;
|
||||
if (items != null)
|
||||
{
|
||||
if (items.DTCAlerts != null && items.DTCAlerts.Length > 0)
|
||||
EmailFormat += AlertsFormat(items.DTCAlerts, SystemParams.GetTextByKey(lang, "P_WO_DTCALERTS", "DTC Alerts"), lang);
|
||||
if (items.PMAlerts != null && items.PMAlerts.Length > 0)
|
||||
EmailFormat += AlertsFormat(items.PMAlerts, SystemParams.GetTextByKey(lang, "P_WO_PMALERTS", "PM Alerts"), lang);
|
||||
if (items.InspectAlerts != null && items.InspectAlerts.Length > 0)
|
||||
EmailFormat += AlertsFormat(items.InspectAlerts, SystemParams.GetTextByKey(lang, "P_WO_INSPECTALERTS", "Inspect Alerts"), lang);
|
||||
if (items.OilAlerts != null && items.OilAlerts.Length > 0)
|
||||
EmailFormat += AlertsFormat(items.OilAlerts, SystemParams.GetTextByKey(lang, "P_WO_OILALERTS", "Oil Alerts"), lang);
|
||||
}
|
||||
return EmailFormat;
|
||||
}
|
||||
|
||||
public static string AlertsFormat(AlertInfo[] alerts, string type, string lang)
|
||||
{
|
||||
string AlertsFormat = "<table style=\"border:solid 1px #e1dbdb;border-collapse: collapse;margin-bottom:36px;\"><tr>";
|
||||
AlertsFormat += "<td colspan=\"6\"><span style=\"font-weight:700;\">{0}</span></td></tr>";
|
||||
|
||||
AlertsFormat += "<tr style=\"height:30px; background-color:#f1f1f1;\">";
|
||||
AlertsFormat += "<td style=\"border:1px solid #e1dbdb;\">" + SystemParams.GetTextByKey(lang, "P_WO_HOURS", "Hours") + "</td>";
|
||||
AlertsFormat += "<td style=\"border:1px solid #e1dbdb;\">" + SystemParams.GetTextByKey(lang, "P_WO_ALERTTYPE", "Alert Type") + "</td>";
|
||||
AlertsFormat += "<td style=\"border:1px solid #e1dbdb;\">" + SystemParams.GetTextByKey(lang, "P_WO_DESCRIPTION", "Description") + "</td>";
|
||||
if (string.Compare(type, "PM Alerts", true) == 0)
|
||||
AlertsFormat += "<td style=\"border:1px solid #e1dbdb;\">" + SystemParams.GetTextByKey(lang, "P_WO_SERVICEDESCRIPTION", "Service Description") + "</td>";
|
||||
AlertsFormat += "<td style=\"border:1px solid #e1dbdb;\">" + SystemParams.GetTextByKey(lang, "P_WO_COUNT", "Count") + "</td>";
|
||||
AlertsFormat += "<td style=\"border:1px solid #e1dbdb;\">" + SystemParams.GetTextByKey(lang, "P_WO_LATESTDATETIME", "Latest DateTime") + "</td>";
|
||||
AlertsFormat += "</tr>";
|
||||
AlertsFormat += "{1}";//Alert Information
|
||||
AlertsFormat += "</table>";
|
||||
|
||||
if (alerts != null)
|
||||
{
|
||||
string tr_data = string.Empty;
|
||||
foreach (AlertInfo item in alerts)
|
||||
{
|
||||
tr_data += "<tr>";
|
||||
tr_data += "<td style=\"border:1px solid #e1dbdb;\">" + item.EngineHours + "</td>";
|
||||
tr_data += "<td style=\"border:1px solid #e1dbdb;\">" + item.AlertType + "</td>";
|
||||
tr_data += "<td style=\"border:1px solid #e1dbdb;\">" + item.Description + "</td>";
|
||||
if (string.Compare(type, "PM Alerts", true) == 0)
|
||||
tr_data += "<td style=\"border:1px solid #e1dbdb;\">" + item.ServiceDescription + "</td>";
|
||||
tr_data += "<td style=\"border:1px solid #e1dbdb;\">" + item.AlertCount + "</td>";
|
||||
tr_data += "<td style=\"border:1px solid #e1dbdb;\">" + item.AlertLocalTimeStr + "</td>";
|
||||
tr_data += "</tr>";
|
||||
}
|
||||
|
||||
return string.Format(AlertsFormat, type, tr_data);
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public static AlertItems GetWorkOrderAlerts(long workorderid, string sessionid)
|
||||
{
|
||||
AssetAlertItem[] alerts = FleetServiceClientHelper.CreateClient<WorkOrderProvider>(sessionid).GetWorkOrderAlerts(SystemParams.CompanyID, workorderid);
|
||||
|
||||
if (alerts != null)
|
||||
{
|
||||
AlertItems items = new AlertItems();
|
||||
var dtcalerts = new List<AlertInfo>();
|
||||
var pmaalerts = new List<AlertInfo>();
|
||||
var inspectalerts = new List<AlertInfo>();
|
||||
var oilalerts = new List<AlertInfo>();
|
||||
Dictionary<string, List<AlertInfo>> pmalertdic = new Dictionary<string, List<AlertInfo>>();
|
||||
foreach (AssetAlertItem alertitem in alerts.OrderByDescending(ai => ai.AlertTime))
|
||||
{
|
||||
List<AlertInfo> tempList = null;
|
||||
if (alertitem.Category == AssetAlertCategory.PMAlert)
|
||||
tempList = pmaalerts;
|
||||
else if (alertitem.Category == AssetAlertCategory.InspectAlert)
|
||||
tempList = inspectalerts;
|
||||
else if (alertitem.Category == AssetAlertCategory.OilSampleAlert)
|
||||
tempList = oilalerts;
|
||||
else
|
||||
tempList = dtcalerts;
|
||||
|
||||
var existalert = tempList.FirstOrDefault((ai) => ai.Description == alertitem.Description);
|
||||
if (existalert != null)
|
||||
{
|
||||
existalert.AlertCount++;
|
||||
if (existalert.RepeatedAlerts == null)
|
||||
existalert.RepeatedAlerts = new List<long>();
|
||||
existalert.RepeatedAlerts.Add(alertitem.ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
var a = ConvertAlert(alertitem);
|
||||
a.AlertCount = 1;
|
||||
tempList.Add(a);
|
||||
|
||||
if (alertitem.Category == AssetAlertCategory.PMAlert)
|
||||
{
|
||||
if (!pmalertdic.ContainsKey(a.ScheduleID))
|
||||
pmalertdic[a.ScheduleID] = new List<AlertInfo>();
|
||||
pmalertdic[a.ScheduleID].Add(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
items.DTCAlerts = dtcalerts.ToArray();
|
||||
items.PMAlerts = pmaalerts.ToArray();
|
||||
items.InspectAlerts = inspectalerts.ToArray();
|
||||
items.OilAlerts = oilalerts.ToArray();
|
||||
items.AllExpectedCost = 0;
|
||||
|
||||
foreach (var dic in pmalertdic)
|
||||
{
|
||||
items.AllExpectedCost += dic.Value.Where(m => !m.Recurring).Sum(m => m.ExpectedCost);
|
||||
|
||||
int minPriority = dic.Value.Select(m => m.Priority).Min();
|
||||
var recalerts = dic.Value.Where(m => m.Priority == minPriority && m.Recurring && m.ExpectedCost > 0);
|
||||
if (recalerts != null && recalerts.Count() > 0)
|
||||
items.AllExpectedCost += recalerts.Sum(m => m.ExpectedCost);
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private static AlertInfo ConvertAlert(AssetAlertItem alertitem)
|
||||
{
|
||||
AlertInfo ai = new AlertInfo();
|
||||
ai.AlertID = alertitem.ID;
|
||||
ai.MachineID = alertitem.AssetID;
|
||||
ai.AlertType = alertitem.AlertType;
|
||||
ai.Description = alertitem.Description;
|
||||
ai.Description = ai.FormatDescription(ai.Description);
|
||||
ai.AlertTime_UTC = alertitem.AlertTime;
|
||||
ai.AlertLocalTime = alertitem.AlertLocalTime;
|
||||
ai.EngineHours = alertitem.EngineHours;
|
||||
ai.ServiceDescription = alertitem.ServiceDescription;
|
||||
ai.ScheduleID = alertitem.ScheduleID;
|
||||
ai.IntervalID = alertitem.IntervalID;
|
||||
ai.Recurring = alertitem.Recurring;
|
||||
ai.Priority = alertitem.Priority;
|
||||
ai.ExpectedCost = alertitem.ExpectedCost;
|
||||
ai.Comment = alertitem.Comment;
|
||||
|
||||
return ai;
|
||||
}
|
||||
|
||||
public static (string body, KeyValuePair<string, byte[]>[]) GetSurveyReportEmail(SurveyReportInfo report)
|
||||
{
|
||||
var list = new List<KeyValuePair<string, byte[]>>();
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine("<div>");
|
||||
sb.AppendLine($"<div style=\"font-size: 24px; font-weight: bold; text-align: center\">{HttpUtility.HtmlEncode(report.TemplateName)}</div>");
|
||||
sb.AppendLine($"<div style=\"font-size: 16px; font-weight: bold; text-align: center\">There are {report.SurveyCount} survey(s) in total.</div>");
|
||||
sb.AppendLine("<br/><br/>");
|
||||
int count = 0;
|
||||
foreach (var q in report.Questions)
|
||||
{
|
||||
string imgid;
|
||||
if (q.QuestionType == SurveyQuestionTypes.Choose)
|
||||
{
|
||||
sb.AppendLine($"<div style=\"font-size: 24px; font-weight: bold; padding-left: 10px\">{HttpUtility.HtmlEncode(q.Title)}</div>");
|
||||
imgid = "img" + (++count).ToString("000");
|
||||
sb.AppendLine($"<img src=\"cid:{imgid}\"/>");
|
||||
var chooseBarDrawer = new ColumnChartDrawer
|
||||
{
|
||||
Data = new ChartData
|
||||
{
|
||||
XAxis = q.Values.Select(v => new XValue { Label = v.DisplayText }).ToArray(),
|
||||
XInclinedValue = -45,
|
||||
Series = new[]
|
||||
{
|
||||
new DataSeries
|
||||
{
|
||||
SeriesType = SeriesType.Column,
|
||||
Color = Color.FromArgb(0x43, 0x86, 0xd8),
|
||||
DataPoints = q.Values.Select(v => new DataPoint { Y = v.Count }).ToArray()
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
var bitmap = new Bitmap(800, 300);
|
||||
var result = chooseBarDrawer.DrawChart(bitmap);
|
||||
var ms = new MemoryStream();
|
||||
bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
|
||||
ms.Flush();
|
||||
list.Add(new KeyValuePair<string, byte[]>(imgid, ms.ToArray()));
|
||||
|
||||
imgid = "img" + (++count).ToString("000");
|
||||
sb.AppendLine($"<img src=\"cid:{imgid}\"/>");
|
||||
var pieDrawer = new PieChartDrawer
|
||||
{
|
||||
Data = new ChartData
|
||||
{
|
||||
Series = new[]
|
||||
{
|
||||
new DataSeries
|
||||
{
|
||||
SeriesType = SeriesType.Pie,
|
||||
DataPoints = q.Values.Select(v => new DataPoint { Name = v.DisplayText, Y = v.Count, DisplayValue = v.Count.ToString() }).ToArray()
|
||||
}
|
||||
},
|
||||
ShowLegend = true
|
||||
}
|
||||
};
|
||||
bitmap = new Bitmap(800, 300);
|
||||
result = pieDrawer.DrawChart(bitmap);
|
||||
ms = new MemoryStream();
|
||||
bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
|
||||
ms.Flush();
|
||||
list.Add(new KeyValuePair<string, byte[]>(imgid, ms.ToArray()));
|
||||
}
|
||||
else if (q.QuestionType == SurveyQuestionTypes.YesOrNo)
|
||||
{
|
||||
sb.AppendLine($"<div style=\"font-size: 24px; font-weight: bold; padding-left: 10px\">{HttpUtility.HtmlEncode(q.Title)}</div>");
|
||||
imgid = "img" + (++count).ToString("000");
|
||||
sb.AppendLine($"<img src=\"cid:{imgid}\"/>");
|
||||
var barDrawer = new BarChartDrawer
|
||||
{
|
||||
Data = new ChartData
|
||||
{
|
||||
XAxis = new[]
|
||||
{
|
||||
new XValue
|
||||
{
|
||||
Label = string.Empty
|
||||
}
|
||||
},
|
||||
Series = new[]
|
||||
{
|
||||
new DataSeries
|
||||
{
|
||||
Name = q.Values[0].DisplayText,
|
||||
SeriesType = SeriesType.Bar,
|
||||
DataPoints = new[]
|
||||
{
|
||||
new DataPoint { Y = q.Values[0].Count }
|
||||
}
|
||||
},
|
||||
new DataSeries
|
||||
{
|
||||
Name = q.Values[1].DisplayText,
|
||||
SeriesType = SeriesType.Bar,
|
||||
DataPoints = new[]
|
||||
{
|
||||
new DataPoint { Y = q.Values[1].Count }
|
||||
}
|
||||
}
|
||||
},
|
||||
ShowLegend = true
|
||||
}
|
||||
};
|
||||
var bitmap = new Bitmap(700, 220);
|
||||
var result = barDrawer.DrawChart(bitmap);
|
||||
var ms = new MemoryStream();
|
||||
bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
|
||||
ms.Flush();
|
||||
list.Add(new KeyValuePair<string, byte[]>(imgid, ms.ToArray()));
|
||||
}
|
||||
else if (q.QuestionType == SurveyQuestionTypes.Score)
|
||||
{
|
||||
sb.AppendLine($"<div style=\"font-size: 24px; font-weight: bold; padding-left: 10px\">{HttpUtility.HtmlEncode(q.Title)}</div>");
|
||||
imgid = "img" + (++count).ToString("000");
|
||||
sb.AppendLine($"<img src=\"cid:{imgid}\"/>");
|
||||
var chooseBarDrawer = new ColumnChartDrawer
|
||||
{
|
||||
Data = new ChartData
|
||||
{
|
||||
XAxis = q.Values.Select(v => new XValue { Label = v.DisplayText }).ToArray(),
|
||||
XInclinedValue = -45,
|
||||
Series = new[]
|
||||
{
|
||||
new DataSeries
|
||||
{
|
||||
SeriesType = SeriesType.Column,
|
||||
Color = Color.FromArgb(0x43, 0x86, 0xd8),
|
||||
DataPoints = q.Values.Select(v => new DataPoint { Y = v.Count }).ToArray()
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
var bitmap = new Bitmap(800, 300);
|
||||
var result = chooseBarDrawer.DrawChart(bitmap);
|
||||
var ms = new MemoryStream();
|
||||
bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
|
||||
ms.Flush();
|
||||
list.Add(new KeyValuePair<string, byte[]>(imgid, ms.ToArray()));
|
||||
|
||||
imgid = "img" + (++count).ToString("000");
|
||||
sb.AppendLine($"<img src=\"cid:{imgid}\"/>");
|
||||
var pieDrawer = new PieChartDrawer
|
||||
{
|
||||
Data = new ChartData
|
||||
{
|
||||
Series = new[]
|
||||
{
|
||||
new DataSeries
|
||||
{
|
||||
SeriesType = SeriesType.Pie,
|
||||
DataPoints = q.Values.Select(v => new DataPoint { Name = v.DisplayText, Y = v.Count, DisplayValue = v.Count.ToString() }).ToArray()
|
||||
}
|
||||
},
|
||||
ShowLegend = true
|
||||
}
|
||||
};
|
||||
bitmap = new Bitmap(800, 300);
|
||||
result = pieDrawer.DrawChart(bitmap);
|
||||
ms = new MemoryStream();
|
||||
bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
|
||||
ms.Flush();
|
||||
list.Add(new KeyValuePair<string, byte[]>(imgid, ms.ToArray()));
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
sb.AppendLine("<br/><br/>");
|
||||
}
|
||||
sb.AppendLine("</div>");
|
||||
|
||||
return (sb.ToString(), list.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
public class AlertItems
|
||||
{
|
||||
public AlertInfo[] DTCAlerts { get; set; }
|
||||
public AlertInfo[] PMAlerts { get; set; }
|
||||
public AlertInfo[] InspectAlerts { get; set; }
|
||||
public AlertInfo[] OilAlerts { get; set; }
|
||||
public double AllExpectedCost { get; set; }
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -9,41 +9,11 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace IronIntel.Contractor.MapView
|
||||
{
|
||||
public class AssetViewItem
|
||||
{
|
||||
public long ID { get; set; }
|
||||
public string VIN { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Name2 { get; set; }
|
||||
public string Make { get; set; }
|
||||
public string Model { get; set; }
|
||||
public int Priority { get; set; }
|
||||
public string AssetType { get; set; }
|
||||
public double Latitude { get; set; }
|
||||
public double Longitude { get; set; }
|
||||
public string IconUrl { get; set; }
|
||||
public string AlertTips { get; set; }
|
||||
public List<string> AssetGroups { get; set; }
|
||||
public List<long> JobSites { get; set; }
|
||||
public string ShowName
|
||||
{
|
||||
get
|
||||
{
|
||||
//Name取值顺序为Name2,Name,VIN,ID用于前端显示
|
||||
string name = Name2;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
name = Name;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
name = VIN;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
name = ID.ToString();
|
||||
return name;
|
||||
}
|
||||
}//由于地图显示及排序的名称
|
||||
|
||||
}
|
||||
public class AssetDetailViewItem
|
||||
{
|
||||
public string CompanyID { get; set; } = "";
|
||||
public string CompanyName { get; set; } = "";
|
||||
|
||||
private double _EngineHours;
|
||||
public double EngineHours
|
||||
{
|
||||
@ -84,6 +54,7 @@ namespace IronIntel.Contractor.MapView
|
||||
public long ID { get; set; }
|
||||
public string IconUrl { get; set; }
|
||||
public string AssetIconUrl { get; set; }
|
||||
public string Description { get; set; }
|
||||
public LocationViewItem Location { get; set; }
|
||||
public string EngineHoursDateText
|
||||
{
|
||||
@ -96,11 +67,12 @@ namespace IronIntel.Contractor.MapView
|
||||
return "";
|
||||
}
|
||||
}
|
||||
public string DisplayName { get; set; }
|
||||
}
|
||||
|
||||
public class AssetLocationHistoryViewItem
|
||||
{
|
||||
public AssetViewItem Machine { get; set; }
|
||||
public AssetBasicInfo Machine { get; set; }
|
||||
public LocationViewItem[] Locations { get; set; }
|
||||
}
|
||||
|
||||
@ -119,5 +91,7 @@ namespace IronIntel.Contractor.MapView
|
||||
public bool IsAllAllowed { get; set; }
|
||||
public bool MutipleSelect { get; set; }
|
||||
public bool IsCriteriaSQL { get; set; }
|
||||
public List<KeyValuePair<string, string>> LocalCaptions { get; private set; } = new List<KeyValuePair<string, string>>();//不同language下的Title
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,125 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Foresight.Data;
|
||||
|
||||
namespace IronIntel.Contractor.MapView
|
||||
{
|
||||
public class JobManagement
|
||||
{
|
||||
public static JobSiteViewItem[] GetJobSite(string searchtext, int onroad, string companyid)
|
||||
{
|
||||
const string sql_1 = @"select JOBSITEID,JOBSITENAME,LATITUDE,LONGITUDE ,RADIUS,RADUIS_UOM,CONTRACTORID,COLOR,NOTES,STARTDATE,ENDDATE,POLYGON from JOBSITES where ENDDATE is null or ENDDATE>getdate() order by JOBSITENAME";
|
||||
const string sql_2 = @"select JOBSITEID,JOBSITENAME,LATITUDE,LONGITUDE ,RADIUS,RADUIS_UOM,CONTRACTORID,COLOR,NOTES,STARTDATE,ENDDATE,POLYGON from JOBSITES where (ENDDATE is null or ENDDATE>getdate()) and JOBSITENAME like {0} order by JOBSITENAME";
|
||||
|
||||
FISqlConnection db = SystemParams.GetCompanyDbConnection(companyid);
|
||||
if (db == null)
|
||||
{
|
||||
return new JobSiteViewItem[0];
|
||||
}
|
||||
DataTable dt = null;
|
||||
if (string.IsNullOrWhiteSpace(searchtext))
|
||||
{
|
||||
dt = db.GetDataTableBySQL(sql_1);
|
||||
}
|
||||
else
|
||||
{
|
||||
dt = db.GetDataTableBySQL(sql_2, "%" + searchtext + "%");
|
||||
}
|
||||
List<JobSiteViewItem> list = new List<JobSiteViewItem>();
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
JobSiteViewItem js = new JobSiteViewItem();
|
||||
long JobSiteId = FIDbAccess.GetFieldInt(dr["JOBSITEID"], 0);
|
||||
js.ID = FIDbAccess.GetFieldInt(dr["JOBSITEID"], 0);
|
||||
js.Name = FIDbAccess.GetFieldString(dr["JOBSITENAME"], string.Empty);
|
||||
js.Latitude = FIDbAccess.GetFieldDouble(dr["LATITUDE"], 0);
|
||||
js.Longitude = FIDbAccess.GetFieldDouble(dr["LONGITUDE"], 0);
|
||||
js.Radius = FIDbAccess.GetFieldDouble(dr["RADIUS"], 0);
|
||||
js.Radius_UOM = FIDbAccess.GetFieldString(dr["RADUIS_UOM"], string.Empty);
|
||||
if (string.IsNullOrWhiteSpace(js.Radius_UOM))
|
||||
js.Radius_UOM = "Mile";
|
||||
js.ContractorID = FIDbAccess.GetFieldString(dr["CONTRACTORID"], string.Empty);
|
||||
js.ColorString = FIDbAccess.GetFieldString(dr["COLOR"], string.Empty);
|
||||
System.Drawing.Color color = System.Drawing.Color.Orange;
|
||||
try
|
||||
{
|
||||
color = System.Drawing.ColorTranslator.FromHtml(js.ColorString);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
js.Color = new IIColor() { Alpha = color.A, Red = color.R, Green = color.G, Blue = color.B };
|
||||
|
||||
js.Notes = FIDbAccess.GetFieldString(dr["NOTES"], string.Empty);
|
||||
js.StartDate = FIDbAccess.GetFieldDateTime(dr["STARTDATE"], DateTime.MinValue);
|
||||
js.EndDate = FIDbAccess.GetFieldDateTime(dr["ENDDATE"], DateTime.MinValue);
|
||||
string polygon = FIDbAccess.GetFieldString(dr["POLYGON"], string.Empty);
|
||||
js.Polygon = ConvertPolygonToPointItem(polygon);
|
||||
MachineViewItem[] msiary = GetJobSiteMachines(JobSiteId, onroad, db);
|
||||
if (msiary.Count() > 0)
|
||||
{
|
||||
js.Machines = msiary.OrderBy((m) => m.VIN).ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
js.Machines = null;
|
||||
}
|
||||
list.Add(js);
|
||||
}
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
private static MachineViewItem[] GetJobSiteMachines(long jobsiteid, int onroad, FISqlConnection db = null)
|
||||
{
|
||||
const string sql_m = @"select a.MACHINEID,b.VIN,b.MACHINENAME,b.MACHINENAME2,ONROAD from JOBSITEMACHINES a,MACHINES b where a.MACHINEID=b.MACHINEID and ISNULL(b.HIDE,0)=0 and a.JOBSITEID={0}";
|
||||
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
DataTable dt = null;
|
||||
dt = db.GetDataTableBySQL(sql_m, jobsiteid);
|
||||
|
||||
if (dt.Rows.Count == 0)
|
||||
{
|
||||
return new MachineViewItem[0];
|
||||
}
|
||||
List<MachineViewItem> list = new List<MachineViewItem>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
MachineViewItem mi = new MachineViewItem();
|
||||
mi.ID = FIDbAccess.GetFieldInt64(dr["MACHINEID"], 0);
|
||||
mi.Name = FIDbAccess.GetFieldString(dr["MACHINENAME"], string.Empty);
|
||||
mi.Name2 = FIDbAccess.GetFieldString(dr["MACHINENAME2"], string.Empty);
|
||||
mi.VIN = FIDbAccess.GetFieldString(dr["VIN"], string.Empty);
|
||||
mi.Onroad = FIDbAccess.GetFieldInt(dr["ONROAD"], 0);
|
||||
if (onroad < 0 || onroad == mi.Onroad)
|
||||
list.Add(mi);
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
private static PostionItem[] ConvertPolygonToPointItem(string polygon)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(polygon))
|
||||
return null;
|
||||
|
||||
List<PostionItem> list = new List<PostionItem>();
|
||||
var polygons = polygon.Split(';');
|
||||
foreach (var py in polygons)
|
||||
{
|
||||
PostionItem pi = new PostionItem();
|
||||
var sap = py.Split(',');
|
||||
pi.Latitude = Convert.ToDouble(sap[0]);
|
||||
pi.Longitude = Convert.ToDouble(sap[1]);
|
||||
list.Add(pi);
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Foresight.Fleet.Services.Customer;
|
||||
using IronIntel.Services;
|
||||
using IronIntel.Services.Business.Admin;
|
||||
|
||||
namespace IronIntel.Contractor.MapView
|
||||
{
|
||||
public class LocationManagement
|
||||
{
|
||||
public static CompanyLocationViewItem[] GetCompanyLocations(string companyid)
|
||||
{
|
||||
List<CompanyLocationViewItem> ls = new List<CompanyLocationViewItem>();
|
||||
if (string.IsNullOrWhiteSpace(companyid) || string.Compare(companyid, SystemParams.CompanyID, true) == 0)
|
||||
{
|
||||
GetCompanyLocations(SystemParams.CompanyID, ls);
|
||||
if (!SystemParams.IsDealer)
|
||||
{
|
||||
Services.Customers.CustomerInfo dealer = SystemParams.GetFirstDealerInfo();
|
||||
if (dealer != null)
|
||||
{
|
||||
GetCompanyLocations(dealer.ID, ls);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ls.ToArray();
|
||||
}
|
||||
|
||||
private static void GetCompanyLocations(string companyid, List<CompanyLocationViewItem> ls)
|
||||
{
|
||||
CustomerLocation[] locations = FleetServiceClientHelper.CreateClient<CustomerProvider>(companyid, string.Empty).GetCustomerLocations(companyid);
|
||||
|
||||
foreach (CustomerLocation loc in locations)
|
||||
{
|
||||
ls.Add(ConvertToViewItem(loc, companyid));
|
||||
}
|
||||
}
|
||||
|
||||
private static CompanyLocationViewItem ConvertToViewItem(CustomerLocation loc, string companyid)
|
||||
{
|
||||
CompanyLocationViewItem li = new CompanyLocationViewItem();
|
||||
li.CompanyID = companyid;
|
||||
li.ID = loc.ID;
|
||||
li.LocationName = loc.Name;
|
||||
li.Latitude = loc.Latitude;
|
||||
li.Longitude = loc.Longitude;
|
||||
li.Notes = loc.Notes;
|
||||
|
||||
return li;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
using Foresight;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using IronIntel.Services.Common;
|
||||
using IronIntel.Services.MapView;
|
||||
using Foresight.Fleet.Services.JobSite;
|
||||
using Foresight.Fleet.Services.MapView;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -10,93 +10,11 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace IronIntel.Contractor.MapView
|
||||
{
|
||||
public class MachineViewItem
|
||||
{
|
||||
public string VIN { get; set; }
|
||||
public long ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Name2 { get; set; }
|
||||
public string IconUrl { get; set; }
|
||||
public string EmptyIconUrl { get; set; }//不包含机器图标
|
||||
public string MachineType { get; set; }
|
||||
public string Make { get; set; }
|
||||
public string Model { get; set; }
|
||||
public int MakeYear { get; set; }
|
||||
|
||||
private double _EngineHours;
|
||||
public double EngineHours
|
||||
{
|
||||
get
|
||||
{
|
||||
return _EngineHours;
|
||||
}
|
||||
set
|
||||
{
|
||||
value = value > 0 ? value : 0;
|
||||
_EngineHours = Math.Round(value, 2);
|
||||
}
|
||||
}
|
||||
public DateTime EngineHoursDate { get; set; }
|
||||
public int TypeID { get; set; }
|
||||
public string AlertTip { get; set; }
|
||||
public bool OnSite { get; set; }
|
||||
public string JobSiteName { get; set; }//当前所在的JobSiteName
|
||||
public double DistanceFromSite { get; set; }//机器与Jobsite之间的距离
|
||||
public bool WithinSite { get; set; }//机器是否在JobSite多边形范围内
|
||||
public LocationViewItem Location { get; set; }
|
||||
|
||||
private double _Odometer;
|
||||
public double Odometer
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Odometer;
|
||||
}
|
||||
set
|
||||
{
|
||||
value = value > 0 ? value : 0;
|
||||
_Odometer = Math.Round(value, 2);
|
||||
}
|
||||
}
|
||||
public string OdometerUOM { get; set; }
|
||||
public int Onroad { get; set; }
|
||||
public string IconFileName { get; set; }
|
||||
public string MoveStatus { get; set; }
|
||||
public int Directionalheading { get; set; }
|
||||
public int MapAlertLayerPriority { get; set; }
|
||||
public Int64 GpsDeviceID { get; set; } //空 -1
|
||||
public string AssetGroupNames { get; set; }
|
||||
public string ShowName
|
||||
{
|
||||
get
|
||||
{
|
||||
//Name取值顺序为Name2,Name,VIN,ID用于前端显示
|
||||
string name = Name2;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
name = Name;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
name = VIN;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
name = ID.ToString();
|
||||
return name;
|
||||
}
|
||||
}//由于地图显示及排序的名称
|
||||
|
||||
public string EngineHoursDateText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (EngineHoursDate != DateTime.MinValue)
|
||||
{
|
||||
return EngineHoursDate.ToString();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class JobSiteViewItem
|
||||
{
|
||||
public string CompanyID { get; set; } = "";
|
||||
public string CompanyName { get; set; } = "";
|
||||
|
||||
public Int64 ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string[] Types { get; set; }
|
||||
@ -109,14 +27,30 @@ namespace IronIntel.Contractor.MapView
|
||||
public IIColor Color { get; set; }
|
||||
public string Notes { get; set; }
|
||||
public DateTime StartDate { get; set; }
|
||||
public DateTime ProjectedEndDate { get; set; }
|
||||
public DateTime EndDate { get; set; }
|
||||
public PostionItem[] Polygon { get; set; }
|
||||
public Int64 BaseOnMachineID { get; set; }
|
||||
public string BaseonMachineName { get; set; }
|
||||
public string Code { get; set; }
|
||||
public long[] Assets { get; set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
public int RegionId { get; set; }
|
||||
public string Region { get; set; }
|
||||
public string Number { get; set; }
|
||||
public string Foreman { get; set; }
|
||||
public string Manager { get; set; }
|
||||
public string Phone { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string Group { get; set; }
|
||||
public string Address1 { get; set; }
|
||||
public string Address2 { get; set; }
|
||||
public string City { get; set; }
|
||||
public string State { get; set; }
|
||||
public string Zip { get; set; }
|
||||
public string County { get; set; }
|
||||
|
||||
public string strStartDate
|
||||
public string StartDateStr
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -133,7 +67,7 @@ namespace IronIntel.Contractor.MapView
|
||||
|
||||
|
||||
|
||||
public string strEndDate
|
||||
public string EndDateStr
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -147,12 +81,50 @@ namespace IronIntel.Contractor.MapView
|
||||
}
|
||||
}
|
||||
}
|
||||
public string ProjectedEndDateStr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ProjectedEndDate == DateTime.MinValue)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
return ProjectedEndDate.ToShortDateString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MachineViewItem[] Machines { get; set; }
|
||||
public string RadiusStr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Radius > 0)
|
||||
{
|
||||
return Radius + " " + Radius_UOM + "(s)";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public JobSiteAssetItem[] Machines { get; set; }
|
||||
}
|
||||
|
||||
public class AssetMapViewPinItemClient : AssetMapViewPinItem
|
||||
{
|
||||
public string CompanyID { get; set; } = "";
|
||||
|
||||
public string CompanyName { get; set; } = "";
|
||||
}
|
||||
|
||||
public class AssetGroupViewItem
|
||||
{
|
||||
public string CompanyID { get; set; } = "";
|
||||
public string CompanyName { get; set; } = "";
|
||||
public string ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public long[] Assets { get; set; }
|
||||
@ -161,7 +133,7 @@ namespace IronIntel.Contractor.MapView
|
||||
public class CompanyLocationViewItem
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string CompanyID { get; set; }
|
||||
public string CompanyID { get; set; } = "";
|
||||
public double Latitude { get; set; }
|
||||
public double Longitude { get; set; }
|
||||
public string LocationName { get; set; }
|
||||
@ -173,8 +145,10 @@ namespace IronIntel.Contractor.MapView
|
||||
{
|
||||
public string ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public List<KeyValuePair<string, string>> LocalNames { get; private set; } = new List<KeyValuePair<string, string>>();
|
||||
|
||||
public MapAlertLayerDefinitionItem[] Layers { get; set; }
|
||||
public List<LookupDataSourceDataItem> LookupDataSources { get; set; }
|
||||
public List<LookupDataSourceDataItem> LookupDataSources { get; set; } = new List<LookupDataSourceDataItem>();
|
||||
}
|
||||
|
||||
public class LookupDataSourceDataItem
|
||||
@ -200,6 +174,8 @@ namespace IronIntel.Contractor.MapView
|
||||
public string IconColor { get; set; }
|
||||
public string AlertLayerType { get; set; }//Primary/Secondary
|
||||
public string LegendUrl { get; set; }
|
||||
public List<KeyValuePair<string, string>> LocalTitles { get; private set; } = new List<KeyValuePair<string, string>>();//不同language下的Title
|
||||
|
||||
public DbQueryParameterItem[] CriteriaSQLParameters { get; set; }
|
||||
public DbQueryParameterItem[] AlertSQLParameters { get; set; }
|
||||
public AlertLayerPivotViewItem[] Pivots { get; set; }
|
||||
@ -221,6 +197,8 @@ namespace IronIntel.Contractor.MapView
|
||||
public bool IsField { get; set; }//表明该参数名是一个数据库参数或是结果集的字段,如果是结果集的字段,则该定义必须要与lookupdatasource关联。
|
||||
public bool IsAllAllowed { get; set; }
|
||||
public bool MutipleSelect { get; set; }
|
||||
public List<KeyValuePair<string, string>> LocalCaptions { get; private set; } = new List<KeyValuePair<string, string>>();//不同language下的Title
|
||||
|
||||
}
|
||||
|
||||
public class QueryParameterSource
|
||||
@ -231,6 +209,7 @@ namespace IronIntel.Contractor.MapView
|
||||
|
||||
public class LocationViewItem
|
||||
{
|
||||
public long LogId { get; set; }
|
||||
public double Latitude { get; set; }
|
||||
public double Longitude { get; set; }
|
||||
public DateTime LocationTime { get; set; }
|
||||
@ -245,23 +224,29 @@ namespace IronIntel.Contractor.MapView
|
||||
return "";
|
||||
}
|
||||
}
|
||||
public string DataSource { get; set; }
|
||||
public string SubSource { get; set; }
|
||||
public string EventType { get; set; } = string.Empty;
|
||||
public string MsgUID { get; set; } = string.Empty;
|
||||
|
||||
public double Speed { get; set; } = -1;
|
||||
public string SpeedUnit { get; set; }
|
||||
public double PostedSpeed { get; set; } = -1;
|
||||
public string PostedSpeedUnit { get; set; }
|
||||
public string Street { get; set; } = string.Empty;
|
||||
public string IconURL { get; set; } = string.Empty;
|
||||
public int Heading { get; set; } = 0;
|
||||
public int MoveStatus { get; set; } = 0;
|
||||
public bool Abnormal { get; set; }//是否是异常驾驶
|
||||
public List<KeyValuePair<string, string>> SmartWitnessVideoUrl { get; set; }
|
||||
public SpeedingBehaviors SpeedingBehavior { get; set; }
|
||||
public HarshDrivingEvents HarshDringEvent { get; set; }
|
||||
}
|
||||
public bool FromSmartWitness { get; set; }
|
||||
|
||||
public class MachineLocationHistoryViewItem
|
||||
{
|
||||
public MachineViewItem Machine { get; set; }
|
||||
public LocationViewItem[] Locations { get; set; }
|
||||
}
|
||||
public SeatBeltStatus SeatBelt { get; set; }
|
||||
|
||||
public DriverInsights DriverInsight { get; set; }
|
||||
}
|
||||
|
||||
public class MachineTypeItem
|
||||
{
|
||||
@ -269,14 +254,6 @@ namespace IronIntel.Contractor.MapView
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 供JobSite选中的Mahcine
|
||||
/// </summary>
|
||||
public class AvailableMachines
|
||||
{
|
||||
public MachineViewItem[] Assigned { get; set; }
|
||||
public MachineViewItem[] Unassigned { get; set; }
|
||||
}
|
||||
public struct PostionItem
|
||||
{
|
||||
public double Latitude;
|
||||
@ -291,8 +268,11 @@ namespace IronIntel.Contractor.MapView
|
||||
|
||||
public class ShapeFileItem
|
||||
{
|
||||
public string CompanyID { get; set; } = "";
|
||||
public string CompanyName { get; set; } = "";
|
||||
public long ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Notes { get; set; }
|
||||
public string FileName { get; set; }
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -4,8 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using IronIntel.Services;
|
||||
using IronIntel.Contractor.Users;
|
||||
using IronIntel.Services.MapView;
|
||||
using IronIntel.Services.Customers;
|
||||
using Foresight.Fleet.Services.Customer;
|
||||
|
||||
namespace IronIntel.Contractor.MapView
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ namespace IronIntel.Contractor.OTRConfig
|
||||
|
||||
public HarshDrivingEvents HarshDringEvent { get; set; }
|
||||
public SpeedingBehaviors SpeedingBehavior { get; set; }
|
||||
public string ShowName
|
||||
public string DisplayName
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -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("2.20.429")]
|
||||
[assembly: AssemblyFileVersion("24.3.19")]
|
||||
|
@ -1,25 +0,0 @@
|
||||
using Foresight.ServiceModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IronIntel.Contractor.Security
|
||||
{
|
||||
public class CurfewInfo
|
||||
{
|
||||
public string CurfewID { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Day { get; set; }
|
||||
public string StartTime { get; set; }
|
||||
public string EndTime { get; set; }
|
||||
public int IsEnabled { get; set; }
|
||||
public DateTime DateAdded { get; set; }
|
||||
public string AddBy { get; set; }
|
||||
public DateTime DateUpdated { get; set; }
|
||||
public string UpdatedBy { get; set; }
|
||||
public string TimePeriod { get; set; }
|
||||
public StringKeyValue[] TimePeriods { get; set; }
|
||||
}
|
||||
}
|
@ -1,281 +0,0 @@
|
||||
using Foresight.Data;
|
||||
using Foresight.ServiceModel;
|
||||
using IronIntel.Contractor.Machines;
|
||||
using IronIntel.Contractor.Maintenance;
|
||||
using IronIntel.Contractor.MapView;
|
||||
using IronIntel.Contractor.Users;
|
||||
using IronIntel.Services.Business.Admin;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IronIntel.Contractor.Security
|
||||
{
|
||||
public class CurfewManagement
|
||||
{
|
||||
public static CurfewInfo[] GetCurfews(string sessionid, string searchtext, FISqlConnection db = null)
|
||||
{
|
||||
const string SQL = "select CURFEWID,TITLE,DAY,STARTTIME,ENDTIME,ISENABLED,DATEADDED_UTC,ADDBY,DATEUPDATED_UTC,UPDATEDBY,TIMEPERIOD from CURFEW where ISENABLED=1";
|
||||
|
||||
List<CurfewInfo> list = new List<CurfewInfo>();
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
DataTable dt = db.GetDataTableBySQL(SQL);
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
UserInfo[] users = UserManagement.GetUsers();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
CurfewInfo ci = ConvertToCurfewInfo(dr);
|
||||
if (string.IsNullOrWhiteSpace(searchtext)
|
||||
|| Helper.Contains(ci.Title, searchtext))
|
||||
list.Add(ci);
|
||||
}
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static CurfewInfo GetCurfewInfo(string curfewid, FISqlConnection db = null)
|
||||
{
|
||||
const string SQL = "select CURFEWID,TITLE,DAY,STARTTIME,ENDTIME,ISENABLED,DATEADDED_UTC,ADDBY,DATEUPDATED_UTC,UPDATEDBY,TIMEPERIOD from CURFEW where ISENABLED=1 and CURFEWID={0}";
|
||||
|
||||
List<CurfewInfo> list = new List<CurfewInfo>();
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
DataTable dt = db.GetDataTableBySQL(SQL, curfewid);
|
||||
CurfewInfo ci = new CurfewInfo();
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
ci = ConvertToCurfewInfo(dt.Rows[0]);
|
||||
}
|
||||
return ci;
|
||||
}
|
||||
|
||||
|
||||
public static void SaveCurfew(CurfewInfo ci, string useriid, FISqlConnection db = null)
|
||||
{
|
||||
const string SQL = @"if exists(select 1 from CURFEW where CURFEWID={0}) update CURFEW set TITLE={1},DAY={2},STARTTIME={3},ENDTIME={4},DATEUPDATED_UTC=GETUTCDATE(),UPDATEDBY={5},TIMEPERIOD={6} where CURFEWID={0}
|
||||
else insert CURFEW(CURFEWID,TITLE,DAY,STARTTIME,ENDTIME,ISENABLED,DATEADDED_UTC,ADDBY,DATEUPDATED_UTC,UPDATEDBY,TIMEPERIOD) values({0},{1},{2},{3},{4},1,GETUTCDATE(),{5},GETUTCDATE(),{5},{6})";
|
||||
|
||||
const string SQL_C = "select COUNT(1) from CURFEW where CURFEWID!={0} and TITLE={1} and ISENABLED=1";
|
||||
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
object obj = db.GetRC1BySQL(SQL_C, ci.CurfewID, ci.Title);
|
||||
if (Convert.ToInt32(obj) > 0)
|
||||
{
|
||||
throw new Exception("The curfew title must be unique.");
|
||||
}
|
||||
|
||||
string timeperiodStr = "";
|
||||
if (ci.TimePeriods == null || ci.TimePeriods.Length <= 0)
|
||||
throw new Exception("Period cannot be empty.");
|
||||
|
||||
foreach (StringKeyValue item in ci.TimePeriods)
|
||||
{
|
||||
int st = Convert.ToInt32(item.Tag1 + item.Tag2);
|
||||
int et = Convert.ToInt32(item.Tag3 + item.Tag4);
|
||||
if (st >= et)
|
||||
throw new Exception("End Time must be later than Start Time.");
|
||||
|
||||
string str = item.Tag1 + ":" + item.Tag2 + "-" + item.Tag3 + ":" + item.Tag4;
|
||||
if (string.IsNullOrWhiteSpace(timeperiodStr))
|
||||
timeperiodStr = str;
|
||||
else
|
||||
timeperiodStr = timeperiodStr + "," + str;
|
||||
}
|
||||
|
||||
|
||||
db.ExecSQL(SQL, ci.CurfewID, ci.Title, ci.Day, ci.StartTime, ci.EndTime, useriid, timeperiodStr);
|
||||
|
||||
}
|
||||
|
||||
public static void DeleteCurfew(string curfewid, FISqlConnection db = null)
|
||||
{
|
||||
const string SQL = @"update CURFEW set ISENABLED=0 where CURFEWID={0}";
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
db.ExecSQL(SQL, curfewid);
|
||||
}
|
||||
|
||||
public static MaintenanceMachineInfo[] GetCurfewMachinesByID(string curfewid, FISqlConnection db = null)
|
||||
{
|
||||
const string SQL = @"select a.RELATEDID as MACHINEID,b.MACHINENAME,b.MACHINENAME2,b.VIN,b.MAKEID,b.MODELID,b.TYPEID,b.HIDE,ISNULL(b.ENGINEHOURS,0) as ENGINEHOURS,
|
||||
ISNULL(b.ODOMETER,0) as ODOMETER,ISNULL(b.ODOMETERUOM,'Mile') AS ODOMETERUOM from RELATIONSHIP a,MACHINES b
|
||||
where a.RELATEDID=b.MACHINEID and a.RELATIONSHIPTYPEID='CurfewToMachine' and a.REMOVED<>1 and a.PRIMARYID={0}";
|
||||
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
DataTable tb = db.GetDataTableBySQL(SQL, curfewid);
|
||||
if (tb.Rows.Count == 0)
|
||||
{
|
||||
return new MaintenanceMachineInfo[0];
|
||||
}
|
||||
MachineManagement.RefreshBaseData();
|
||||
MachineMake[] makes = MachineManagement.GetMachineMakes();
|
||||
MachineModel[] models = MachineManagement.GetMachineModels();
|
||||
MachineType[] types = MachineManagement.GetMachineTypes();
|
||||
List<MaintenanceMachineInfo> ls = new List<MaintenanceMachineInfo>();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
MaintenanceMachineInfo mi = MaintenanceManagement.ConvertToMaintenanceMachineInfo(dr, makes, models, types);
|
||||
ls.Add(mi);
|
||||
}
|
||||
return ls.ToArray();
|
||||
|
||||
}
|
||||
|
||||
public static void SaveCurfewMachines(string curfewid, string contractorid, string[] machineids, FISqlConnection db)
|
||||
{
|
||||
const string SQL_R = "update RELATIONSHIP set REMOVEDON=GETUTCDATE(),REMOVED=1 where RELATIONSHIPTYPEID='CurfewToMachine' and REMOVED<>1 and PRIMARYID={0}";
|
||||
const string SQL = @"if exists(select 1 from RELATIONSHIP where RELATIONSHIPTYPEID='CurfewToMachine' and PRIMARYID={0} and RELATEDID={1}) update RELATIONSHIP
|
||||
set REMOVEDON=null,REMOVED=0 where RELATIONSHIPTYPEID='CurfewToMachine' and PRIMARYID={0} and RELATEDID={1} else insert into RELATIONSHIP
|
||||
(RELATIONSHIPID,RELATIONSHIPTYPEID,CONTRACTORID,PRIMARYID,RELATEDID,ADDEDON) values({3},'CurfewToMachine',{2},{0},{1},GETUTCDATE())";
|
||||
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
db.ExecSQL(SQL_R, curfewid);
|
||||
|
||||
foreach (var mid in machineids)
|
||||
{
|
||||
db.ExecSQL(SQL, curfewid, mid, contractorid, Guid.NewGuid().ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private static CurfewInfo ConvertToCurfewInfo(DataRow dr)
|
||||
{
|
||||
CurfewInfo ci = new CurfewInfo();
|
||||
ci.CurfewID = FIDbAccess.GetFieldString(dr["CURFEWID"], string.Empty);
|
||||
ci.Title = FIDbAccess.GetFieldString(dr["TITLE"], string.Empty);
|
||||
ci.Day = FIDbAccess.GetFieldString(dr["DAY"], string.Empty);
|
||||
ci.StartTime = FIDbAccess.GetFieldString(dr["STARTTIME"], string.Empty);
|
||||
ci.EndTime = FIDbAccess.GetFieldString(dr["ENDTIME"], string.Empty);
|
||||
ci.IsEnabled = FIDbAccess.GetFieldInt(dr["ISENABLED"], 0);
|
||||
ci.DateAdded = FIDbAccess.GetFieldDateTime(dr["DATEADDED_UTC"], DateTime.MinValue);
|
||||
ci.DateAdded = ci.DateAdded.AddHours(SystemParams.GetHoursOffset());
|
||||
ci.AddBy = FIDbAccess.GetFieldString(dr["ADDBY"], string.Empty);
|
||||
ci.DateUpdated = FIDbAccess.GetFieldDateTime(dr["DATEUPDATED_UTC"], DateTime.MinValue);
|
||||
ci.DateUpdated = ci.DateUpdated.AddHours(SystemParams.GetHoursOffset());
|
||||
ci.UpdatedBy = FIDbAccess.GetFieldString(dr["UPDATEDBY"], string.Empty);
|
||||
ci.TimePeriod = FIDbAccess.GetFieldString(dr["TIMEPERIOD"], string.Empty);
|
||||
if (!string.IsNullOrWhiteSpace(ci.TimePeriod))
|
||||
{
|
||||
List<StringKeyValue> list = new List<StringKeyValue>();
|
||||
string[] periods = ci.TimePeriod.Split(',');
|
||||
foreach (string pd in periods)
|
||||
{
|
||||
StringKeyValue kv = new StringKeyValue();
|
||||
string[] time = pd.Split('-');
|
||||
string[] starttime = time[0].Split(':');
|
||||
string[] endtime = time[1].Split(':');
|
||||
kv.Tag1 = starttime[0];
|
||||
kv.Tag2 = starttime[1];
|
||||
kv.Tag3 = endtime[0];
|
||||
kv.Tag4 = endtime[1];
|
||||
list.Add(kv);
|
||||
}
|
||||
ci.TimePeriods = list.ToArray();
|
||||
}
|
||||
else
|
||||
ci.TimePeriods = new StringKeyValue[0];
|
||||
return ci;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static JobSiteViewItem[] GetCurfewJobsitesByID(string curfewid, FISqlConnection db = null)
|
||||
{
|
||||
const string SQL = @"select a.RELATEDID as JOBSITEID,JOBSITENAME,LATITUDE,LONGITUDE ,RADIUS,RADUIS_UOM,b.CONTRACTORID,COLOR,NOTES,STARTDATE,ENDDATE,POLYGON from RELATIONSHIP a,JOBSITES b
|
||||
where a.RELATIONSHIPTYPEID='CurfewToJobsite' and a.REMOVED<>1 and a.RELATEDID=b.JOBSITEID and a.PRIMARYID={0}";
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
DataTable tb = db.GetDataTableBySQL(SQL, curfewid);
|
||||
if (tb.Rows.Count == 0)
|
||||
{
|
||||
return new JobSiteViewItem[0];
|
||||
}
|
||||
List<JobSiteViewItem> ls = new List<JobSiteViewItem>();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
JobSiteViewItem js = ConvertToJobSiteViewItem(dr);
|
||||
ls.Add(js);
|
||||
}
|
||||
return ls.ToArray();
|
||||
|
||||
}
|
||||
|
||||
public static void SaveCurfewJobsites(string curfewid, string contractorid, string[] jobsiteids, FISqlConnection db = null)
|
||||
{
|
||||
const string SQL_R = "update RELATIONSHIP set REMOVEDON=GETUTCDATE(),REMOVED=1 where RELATIONSHIPTYPEID='CurfewToJobsite' and REMOVED<>1 and PRIMARYID={0}";
|
||||
const string SQL = @"if exists(select 1 from RELATIONSHIP where RELATIONSHIPTYPEID='CurfewToJobsite' and PRIMARYID={0} and RELATEDID={1}) update RELATIONSHIP
|
||||
set REMOVEDON=null,REMOVED=0 where RELATIONSHIPTYPEID='CurfewToJobsite' and PRIMARYID={0} and RELATEDID={1} else insert into RELATIONSHIP
|
||||
(RELATIONSHIPID,RELATIONSHIPTYPEID,CONTRACTORID,PRIMARYID,RELATEDID,ADDEDON) values({3},'CurfewToJobsite',{2},{0},{1},GETUTCDATE())";
|
||||
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
db.ExecSQL(SQL_R, curfewid);
|
||||
|
||||
foreach (var mid in jobsiteids)
|
||||
{
|
||||
db.ExecSQL(SQL, curfewid, mid, contractorid, Guid.NewGuid().ToString());
|
||||
}
|
||||
}
|
||||
private static JobSiteViewItem ConvertToJobSiteViewItem(DataRow dr)
|
||||
{
|
||||
JobSiteViewItem js = new JobSiteViewItem();
|
||||
long JobSiteId = FIDbAccess.GetFieldInt(dr["JOBSITEID"], 0);
|
||||
js.ID = FIDbAccess.GetFieldInt(dr["JOBSITEID"], 0);
|
||||
js.Name = FIDbAccess.GetFieldString(dr["JOBSITENAME"], string.Empty);
|
||||
js.Latitude = FIDbAccess.GetFieldDouble(dr["LATITUDE"], 0);
|
||||
js.Longitude = FIDbAccess.GetFieldDouble(dr["LONGITUDE"], 0);
|
||||
js.Radius = FIDbAccess.GetFieldDouble(dr["RADIUS"], 0);
|
||||
js.Radius_UOM = FIDbAccess.GetFieldString(dr["RADUIS_UOM"], string.Empty);
|
||||
if (string.IsNullOrWhiteSpace(js.Radius_UOM))
|
||||
js.Radius_UOM = "Mile";
|
||||
js.ContractorID = FIDbAccess.GetFieldString(dr["CONTRACTORID"], string.Empty);
|
||||
//js.ColorString = FIDbAccess.GetFieldString(dr["COLOR"], string.Empty);
|
||||
//System.Drawing.Color color = System.Drawing.Color.Orange;
|
||||
//try
|
||||
//{
|
||||
// color = System.Drawing.ColorTranslator.FromHtml(js.ColorString);
|
||||
//}
|
||||
//catch
|
||||
//{
|
||||
//}
|
||||
//js.Color = new IIColor() { Alpha = color.A, Red = color.R, Green = color.G, Blue = color.B };
|
||||
|
||||
js.Notes = FIDbAccess.GetFieldString(dr["NOTES"], string.Empty);
|
||||
js.StartDate = FIDbAccess.GetFieldDateTime(dr["STARTDATE"], DateTime.MinValue);
|
||||
js.EndDate = FIDbAccess.GetFieldDateTime(dr["ENDDATE"], DateTime.MinValue);
|
||||
return js;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取机器Curfew和机器的对应关系
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Dictionary<int, List<string>> GetCurfewMachines(FISqlConnection db)
|
||||
{
|
||||
const string SQL_C = "select PRIMARYID,RELATEDID from RELATIONSHIP where RELATIONSHIPTYPEID='CurfewToMachine' and REMOVED<>1";
|
||||
|
||||
Dictionary<int, List<string>> result = new Dictionary<int, List<string>>();
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
DataTable tb = db.GetDataTableBySQL(SQL_C);
|
||||
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
int machineid = FIDbAccess.GetFieldInt(dr["RELATEDID"], 0);
|
||||
string curfewid = FIDbAccess.GetFieldString(dr["PRIMARYID"], "");
|
||||
if (!result.ContainsKey(machineid))
|
||||
result[machineid] = new List<string>();
|
||||
result[machineid].Add(curfewid);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
using Foresight.Data;
|
||||
using IronIntel.Contractor.Users;
|
||||
using IronIntel.Services.Business.Admin;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
|
@ -3,13 +3,156 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
namespace IronIntel.Contractor.Shape
|
||||
{
|
||||
public static class ShapeFileParser
|
||||
{
|
||||
/// <summary>
|
||||
/// 解析.shp文件
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
public static void ParseFromShapeFile(string fileName, Shape shape)
|
||||
{
|
||||
using (FileStream fileStream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
ParseFromShapeFile(fileStream, shape);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解析.shp文件
|
||||
/// </summary>
|
||||
/// <param name="buffer">.shp文件数据</param>
|
||||
/// <param name="shape"></param>
|
||||
public static void ParseFromShapeFile(byte[] buffer, Shape shape)
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream(buffer, false))
|
||||
{
|
||||
ParseFromShapeFile(ms, shape);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解析.shp文件
|
||||
/// </summary>
|
||||
/// <param name="fs">装载.shp文件数据的流</param>
|
||||
public static void ParseFromShapeFile(Stream fs, Shape shape)
|
||||
{
|
||||
fs.Seek(0, SeekOrigin.Begin);
|
||||
using (BinaryReader binaryReader = new BinaryReader(fs))
|
||||
{
|
||||
binaryReader.ReadBytes(24);
|
||||
|
||||
int FileLength = binaryReader.ReadInt32();//<0代表数据长度未知
|
||||
int FileBanben = binaryReader.ReadInt32();
|
||||
int ShapeType = binaryReader.ReadInt32();
|
||||
|
||||
double xmin = binaryReader.ReadDouble();
|
||||
double ymax = -1 * binaryReader.ReadDouble();
|
||||
double xmax = binaryReader.ReadDouble();
|
||||
double ymin = -1 * binaryReader.ReadDouble();
|
||||
double width = xmax - xmin;
|
||||
double height = ymax - ymin;
|
||||
|
||||
binaryReader.ReadBytes(32);
|
||||
|
||||
switch (ShapeType)
|
||||
{
|
||||
case 1://Point
|
||||
case 11://PointZ
|
||||
case 21://PointM
|
||||
MapPoints points = new MapPoints();
|
||||
shape.Points.Add(points);
|
||||
ParsePoints(binaryReader, points);
|
||||
break;
|
||||
case 3://PolyLine
|
||||
case 13://PolyLineZ
|
||||
case 23://PolyLineM
|
||||
ParsePolylines(binaryReader, shape.Polylines);
|
||||
break;
|
||||
case 5://Polygon
|
||||
case 15://PolygonZ
|
||||
case 25://PolygonM
|
||||
ParsePolygons(binaryReader, shape.Polygons);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从zip文件当中解析.shp
|
||||
/// </summary>
|
||||
/// <param name="stream">装载.zip文件内容的流</param>
|
||||
/// <param name="shape"></param>
|
||||
public static void ParseFromZipFile(Stream stream, Shape shape)
|
||||
{
|
||||
const string EXT = ".shp";
|
||||
//using (ZipInputStream s = new ZipInputStream(stream))
|
||||
//{
|
||||
// ZipEntry zipentry = s.GetNextEntry();
|
||||
// while (zipentry != null)
|
||||
// {
|
||||
// if (zipentry.IsDirectory)
|
||||
// {
|
||||
// zipentry = s.GetNextEntry();
|
||||
// continue;
|
||||
// }
|
||||
// string ext = Path.GetExtension(zipentry.FileName);
|
||||
// if (string.Compare(ext, EXT, true) == 0)
|
||||
// {
|
||||
// Stream shpStream = new MemoryStream();
|
||||
// int size = 0;
|
||||
// byte[] data = new byte[2048];
|
||||
// while (true)
|
||||
// {
|
||||
// size = s.Read(data, 0, data.Length);
|
||||
// if (size > 0)
|
||||
// {
|
||||
// shpStream.Write(data, 0, size);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// ParseFromShapeFile(shpStream, shape);
|
||||
// }
|
||||
// zipentry = s.GetNextEntry();
|
||||
// }//while
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从.zip文件当中解析.shp
|
||||
/// </summary>
|
||||
/// <param name="buffer">.zip文件数据</param>
|
||||
/// <param name="shape"></param>
|
||||
public static void ParseFromZipFile(byte[] buffer, Shape shape)
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream(buffer, false))
|
||||
{
|
||||
ParseFromZipFile(ms, shape);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从.zip文件当中解析.shp
|
||||
/// </summary>
|
||||
/// <param name="filename"></param>
|
||||
/// <param name="shape"></param>
|
||||
public static void ParseFromZipFile(string filename, Shape shape)
|
||||
{
|
||||
using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
ParseFromZipFile(fs, shape);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ParsePoints(BinaryReader binaryReader, MapPoints points)
|
||||
{
|
||||
while (binaryReader.PeekChar() != -1)
|
||||
@ -177,148 +320,189 @@ namespace IronIntel.Contractor.Shape
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解析.shp文件
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
public static void ParseFromShapeFile(string fileName, Shape shape)
|
||||
{
|
||||
using (FileStream fileStream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
ParseFromShapeFile(fileStream, shape);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region kmz/kml
|
||||
|
||||
/// <summary>
|
||||
/// 解析.shp文件
|
||||
/// 从kmz文件当中解析.kml,再解析kml
|
||||
/// </summary>
|
||||
/// <param name="buffer">.shp文件数据</param>
|
||||
/// <param name="stream"></param>
|
||||
/// <param name="shape"></param>
|
||||
public static void ParseFromShapeFile(byte[] buffer, Shape shape)
|
||||
public static void ParseFromKMZFile(byte[] buffer, Shape shape)
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream(buffer, false))
|
||||
{
|
||||
ParseFromShapeFile(ms, shape);
|
||||
ParseFromKMZFile(ms, shape);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解析.shp文件
|
||||
/// 从kmz文件当中解析.kml,再解析kml
|
||||
/// </summary>
|
||||
/// <param name="fs">装载.shp文件数据的流</param>
|
||||
public static void ParseFromShapeFile(Stream fs, Shape shape)
|
||||
/// <param name="stream"></param>
|
||||
/// <param name="shape"></param>
|
||||
public static void ParseFromKMZFile(Stream stream, Shape shape)
|
||||
{
|
||||
fs.Seek(0, SeekOrigin.Begin);
|
||||
using (BinaryReader binaryReader = new BinaryReader(fs))
|
||||
const string EXT = ".kml";
|
||||
using (ZipArchive archive = new ZipArchive(stream))
|
||||
{
|
||||
binaryReader.ReadBytes(24);
|
||||
|
||||
int FileLength = binaryReader.ReadInt32();//<0代表数据长度未知
|
||||
int FileBanben = binaryReader.ReadInt32();
|
||||
int ShapeType = binaryReader.ReadInt32();
|
||||
|
||||
double xmin = binaryReader.ReadDouble();
|
||||
double ymax = -1 * binaryReader.ReadDouble();
|
||||
double xmax = binaryReader.ReadDouble();
|
||||
double ymin = -1 * binaryReader.ReadDouble();
|
||||
double width = xmax - xmin;
|
||||
double height = ymax - ymin;
|
||||
|
||||
binaryReader.ReadBytes(32);
|
||||
|
||||
switch (ShapeType)
|
||||
foreach (var e in archive.Entries)
|
||||
{
|
||||
case 1://Point
|
||||
case 11://PointZ
|
||||
case 21://PointM
|
||||
MapPoints points = new MapPoints();
|
||||
shape.Points.Add(points);
|
||||
ParsePoints(binaryReader, points);
|
||||
break;
|
||||
case 3://PolyLine
|
||||
case 13://PolyLineZ
|
||||
case 23://PolyLineM
|
||||
ParsePolylines(binaryReader, shape.Polylines);
|
||||
break;
|
||||
case 5://Polygon
|
||||
case 15://PolygonZ
|
||||
case 25://PolygonM
|
||||
ParsePolygons(binaryReader, shape.Polygons);
|
||||
break;
|
||||
string ext = Path.GetExtension(e.Name);
|
||||
if (string.Compare(ext, EXT, true) == 0)
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(e.Open()))
|
||||
{
|
||||
using (MemoryStream fstream = new MemoryStream())
|
||||
{
|
||||
e.Open().CopyTo(fstream);
|
||||
ParseFromKMLFile(fstream, shape);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从zip文件当中解析.shp
|
||||
/// 解析.kml文件
|
||||
/// </summary>
|
||||
/// <param name="stream">装载.zip文件内容的流</param>
|
||||
/// <param name="shape"></param>
|
||||
public static void ParseFromZipFile(Stream stream, Shape shape)
|
||||
/// <param name="fileName"></param>
|
||||
public static void ParseFromKMLFile(string fileName, Shape shape)
|
||||
{
|
||||
const string EXT = ".shp";
|
||||
//using (ZipInputStream s = new ZipInputStream(stream))
|
||||
//{
|
||||
// ZipEntry zipentry = s.GetNextEntry();
|
||||
// while (zipentry != null)
|
||||
// {
|
||||
// if (zipentry.IsDirectory)
|
||||
// {
|
||||
// zipentry = s.GetNextEntry();
|
||||
// continue;
|
||||
// }
|
||||
// string ext = Path.GetExtension(zipentry.FileName);
|
||||
// if (string.Compare(ext, EXT, true) == 0)
|
||||
// {
|
||||
// Stream shpStream = new MemoryStream();
|
||||
// int size = 0;
|
||||
// byte[] data = new byte[2048];
|
||||
// while (true)
|
||||
// {
|
||||
// size = s.Read(data, 0, data.Length);
|
||||
// if (size > 0)
|
||||
// {
|
||||
// shpStream.Write(data, 0, size);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// ParseFromShapeFile(shpStream, shape);
|
||||
// }
|
||||
// zipentry = s.GetNextEntry();
|
||||
// }//while
|
||||
//}
|
||||
using (FileStream fileStream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
ParseFromKMLFile(fileStream, shape);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从.zip文件当中解析.shp
|
||||
/// 解析.kml文件
|
||||
/// </summary>
|
||||
/// <param name="buffer">.zip文件数据</param>
|
||||
/// <param name="buffer">.kml文件数据</param>
|
||||
/// <param name="shape"></param>
|
||||
public static void ParseFromZipFile(byte[] buffer, Shape shape)
|
||||
public static void ParseFromKMLFile(byte[] buffer, Shape shape)
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream(buffer, false))
|
||||
{
|
||||
ParseFromZipFile(ms, shape);
|
||||
ParseFromKMLFile(ms, shape);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从.zip文件当中解析.shp
|
||||
/// 解析.kml文件
|
||||
/// </summary>
|
||||
/// <param name="filename"></param>
|
||||
/// <param name="shape"></param>
|
||||
public static void ParseFromZipFile(string filename, Shape shape)
|
||||
/// <param name="fs">装载.kml文件数据的流</param>
|
||||
public static void ParseFromKMLFile(Stream fs, Shape shape)
|
||||
{
|
||||
using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
//fs.Seek(0, SeekOrigin.Begin);
|
||||
//StreamReader sr = new StreamReader(fs);
|
||||
//string content = sr.ReadToEnd();
|
||||
fs.Seek(0, SeekOrigin.Begin);
|
||||
XmlDocument xmldoc = new XmlDocument();
|
||||
xmldoc.Load(fs);
|
||||
XmlElement root = xmldoc.DocumentElement;
|
||||
|
||||
XmlNodeList pointNodes = root.GetElementsByTagName("Point");
|
||||
foreach (XmlElement pe in pointNodes)
|
||||
{
|
||||
ParseFromZipFile(fs, shape);
|
||||
ParseKMLPoints(pe, shape.Points);
|
||||
}
|
||||
|
||||
XmlNodeList lineNodes = root.GetElementsByTagName("LineString");
|
||||
foreach (XmlElement le in lineNodes)
|
||||
{
|
||||
ParseKMLLines(le, shape.Polylines);
|
||||
}
|
||||
|
||||
XmlNodeList polygonNodes = root.GetElementsByTagName("Polygon");
|
||||
foreach (XmlElement pe in polygonNodes)
|
||||
{
|
||||
ParseKMLPolygons(pe, shape.Polygons);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void ParseKMLPoints(XmlElement node, List<MapPoints> ls)
|
||||
{
|
||||
if (node == null) return;
|
||||
var coordinates = node["coordinates"];
|
||||
if (coordinates == null) return;
|
||||
|
||||
MapPoints points = new MapPoints();
|
||||
ls.Add(points);
|
||||
|
||||
string coordinatesstr = coordinates.InnerText.Trim();
|
||||
string[] temps = coordinatesstr.Split(',');//Longitude,Latitude,Z
|
||||
MapPoint mp = new MapPoint();
|
||||
double d = 0;
|
||||
if (double.TryParse(temps[0], out d))
|
||||
mp.Longitude = d;
|
||||
if (double.TryParse(temps[1], out d))
|
||||
mp.Latitude = d;
|
||||
points.Points.Add(mp);
|
||||
}
|
||||
|
||||
private static void ParseKMLLines(XmlElement node, List<Polyline> ls)
|
||||
{
|
||||
if (node == null) return;
|
||||
var coordinates = node["coordinates"];
|
||||
if (coordinates == null) return;
|
||||
|
||||
Polyline l = new Polyline();
|
||||
ls.Add(l);
|
||||
|
||||
MapPoints line = new MapPoints();
|
||||
l.Parts.Add(line);
|
||||
|
||||
string coordinatesstr = coordinates.InnerText.Trim();
|
||||
string[] cs = coordinatesstr.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
double d = 0;
|
||||
foreach (string c in cs)
|
||||
{
|
||||
string[] temps = c.Split(',');//Longitude,Latitude,Z
|
||||
MapPoint mp = new MapPoint();
|
||||
if (double.TryParse(temps[0], out d))
|
||||
mp.Longitude = d;
|
||||
if (double.TryParse(temps[1], out d))
|
||||
mp.Latitude = d;
|
||||
line.Points.Add(mp);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ParseKMLPolygons(XmlElement node, List<Polygon> ls)
|
||||
{
|
||||
if (node == null) return;
|
||||
var outer = node["outerBoundaryIs"];
|
||||
if (outer == null) return;
|
||||
var linearRing = outer["LinearRing"];
|
||||
if (linearRing == null) return;
|
||||
var coordinates = linearRing["coordinates"];
|
||||
if (coordinates == null) return;
|
||||
|
||||
Polygon p = new Polygon();
|
||||
ls.Add(p);
|
||||
|
||||
MapPoints ring = new MapPoints();
|
||||
p.Rings.Add(ring);
|
||||
|
||||
string coordinatesstr = coordinates.InnerText.Trim();
|
||||
string[] cs = coordinatesstr.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
double d = 0;
|
||||
foreach (string c in cs)
|
||||
{
|
||||
string[] temps = c.Split(',');//Longitude,Latitude,Z
|
||||
MapPoint mp = new MapPoint();
|
||||
if (double.TryParse(temps[0], out d))
|
||||
mp.Longitude = d;
|
||||
if (double.TryParse(temps[1], out d))
|
||||
mp.Latitude = d;
|
||||
ring.Points.Add(mp);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@ using System.Collections.Concurrent;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Net;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
@ -13,25 +14,18 @@ using System.Threading;
|
||||
using System.Data.SqlClient;
|
||||
using Foresight.Security;
|
||||
using Foresight.Data;
|
||||
using IronIntel.Services;
|
||||
using IronIntel.Services.Business.Admin;
|
||||
using IronIntel.Contractor.Users;
|
||||
using IronIntel.Services.Contractor.Machine;
|
||||
using IronIntel.Services.Users;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using Foresight.Fleet.Services.Attachment;
|
||||
using Foresight.ServiceModel;
|
||||
using Foresight.Fleet.Services.FITracker;
|
||||
using Foresight.Fleet.Services.AssetHealth;
|
||||
using Foresight.Fleet.Services.User;
|
||||
using Foresight.Fleet.Services.Device;
|
||||
using Foresight.Fleet.Services.JobSite;
|
||||
using Foresight.Fleet.Services;
|
||||
using Foresight.Fleet.Services.OTRConfig;
|
||||
using Foresight.Fleet.Services.Customer;
|
||||
using Foresight.Fleet.Services.MapView;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using Foresight.Fleet.Services.Styles;
|
||||
using Foresight.Fleet.Services.Style;
|
||||
using IronIntel.Contractor.Users;
|
||||
using Foresight.Fleet.Services.User;
|
||||
using Foresight.Fleet.Services.SystemOption;
|
||||
using Foresight.Fleet.Services.Inspection;
|
||||
using Foresight;
|
||||
using DocumentFormat.OpenXml.Presentation;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
|
||||
namespace IronIntel.Contractor
|
||||
{
|
||||
@ -46,6 +40,14 @@ namespace IronIntel.Contractor
|
||||
|
||||
private static string _ContractorVersion = "";
|
||||
private static string _FICVersion = "";
|
||||
public const string ICONCOLOR = "?typeid={0}&bkcolor=FF000000&dotcolor=FF69D850&sn={1}";
|
||||
|
||||
public const string WOSMSFootnotes = "WOSMSFootnotes";
|
||||
public const string EstimateMessage = "EstimateMessage";
|
||||
public const string DefaultPORequired = "DefaultPORequired";
|
||||
public const string InvoiceMessage = "InvoiceMessage";
|
||||
|
||||
public const string AlertMappingDefaultCategory = "AlertMappingDefaultCategory";
|
||||
|
||||
private static string EncryptString(string s)
|
||||
{
|
||||
@ -226,10 +228,7 @@ namespace IronIntel.Contractor
|
||||
|
||||
public static void SetStringParam(string paramname, string value)
|
||||
{
|
||||
const string SQL = "if exists(select 1 from SYSPARAMS where PARAMNAME={0}) update SYSPARAMS set PARAMVALUE={1} where PARAMNAME={0}"
|
||||
+ " else insert into SYSPARAMS(PARAMNAME,PARAMVALUE) values({0},{1})";
|
||||
FIDbAccess db = GetDbInstance();
|
||||
db.ExecSQL(SQL, paramname, value);
|
||||
FleetServiceClientHelper.CreateClient<CustomerProvider>().SetSystemParams(CompanyID, paramname, value);
|
||||
_Params[paramname] = value;
|
||||
}
|
||||
|
||||
@ -240,7 +239,7 @@ namespace IronIntel.Contractor
|
||||
/// <returns>参数值</returns>
|
||||
public static string GetStringParam(string paramname, bool useCache = true, FISqlConnection db = null)
|
||||
{
|
||||
const string SQL = "select PARAMVALUE from SYSPARAMS where PARAMNAME={0}";
|
||||
const string SQL = "select PARAMVALUE from SYSPARAMS with(nolock) where PARAMNAME={0}";
|
||||
|
||||
string v = null;
|
||||
if (useCache && _Params.TryGetValue(paramname, out v))
|
||||
@ -276,7 +275,7 @@ namespace IronIntel.Contractor
|
||||
FICDBInstance.ExecSQL(SQL, paramname, value);
|
||||
}
|
||||
|
||||
private static Services.Customers.CustomerInfo _Company = null;
|
||||
private static CustomerInfo _Company = null;
|
||||
|
||||
public static string CompanyID
|
||||
{
|
||||
@ -307,35 +306,59 @@ namespace IronIntel.Contractor
|
||||
}
|
||||
}
|
||||
|
||||
private static CustomerDetail _ForesightCustomer = null;
|
||||
private static object _sycfcust = new object();
|
||||
|
||||
|
||||
public static T GetServiceClient<T>() where T : Foresight.ServiceModel.ServiceClientBase, new()
|
||||
public static CustomerDetail ForesightCustomerDetail
|
||||
{
|
||||
T rst = new T();
|
||||
rst.ServiceAddress = SystemServiceAddresses[0];
|
||||
rst.AppName = APPNAME;
|
||||
return rst;
|
||||
get
|
||||
{
|
||||
if (_ForesightCustomer == null)
|
||||
{
|
||||
lock (_sycfcust)
|
||||
{
|
||||
if (_ForesightCustomer == null)
|
||||
{
|
||||
_ForesightCustomer = FleetServiceClientHelper.CreateClient<CustomerProvider>().GetCustomerDetail("Foresight");
|
||||
}
|
||||
}
|
||||
}
|
||||
return _ForesightCustomer;
|
||||
}
|
||||
}
|
||||
|
||||
public static T GetServiceClient<T>(string sessionid) where T : Foresight.ServiceModel.ServiceClientBase, new()
|
||||
public static CustomerDetail GetCustomerDetail(string cid)
|
||||
{
|
||||
T rst = new T();
|
||||
rst.ServiceAddress = SystemServiceAddresses[0];
|
||||
rst.AppName = APPNAME;
|
||||
rst.LoginSessionID = sessionid;
|
||||
return rst;
|
||||
return FleetServiceClientHelper.CreateClient<CustomerProvider>().GetCustomerDetail(cid);
|
||||
}
|
||||
|
||||
public static Services.LicenseInfo GetLicense()
|
||||
private static CustomerParams _CurrentCustomerParams = null;
|
||||
|
||||
public static CustomerParams CurrentCustomerParams
|
||||
{
|
||||
var ic = GetServiceClient<Services.Customers.CustomerProvider>();
|
||||
get
|
||||
{
|
||||
if (_CurrentCustomerParams == null)
|
||||
_CurrentCustomerParams = GetCustomerParams(CompanyID);
|
||||
return _CurrentCustomerParams;
|
||||
}
|
||||
}
|
||||
|
||||
public static CustomerParams GetCustomerParams(string cid)
|
||||
{
|
||||
return FleetServiceClientHelper.CreateClient<CustomerProvider>().GetConfiguredParams(cid);
|
||||
}
|
||||
|
||||
public static LicenseInfo GetLicense()
|
||||
{
|
||||
CustomerProvider ic = FleetServiceClientHelper.CreateClient<CustomerProvider>();
|
||||
return ic.GetLicenseInfo(CompanyID);
|
||||
}
|
||||
|
||||
public static bool HasLicense(string itemName)
|
||||
{
|
||||
bool result = false;
|
||||
var license = SystemParams.GetLicense();
|
||||
var license = GetLicense();
|
||||
if (license != null && license.Items.Count > 0)
|
||||
{
|
||||
var item = license.Items.FirstOrDefault(m => m.Key.Equals(itemName, StringComparison.OrdinalIgnoreCase));
|
||||
@ -349,8 +372,6 @@ namespace IronIntel.Contractor
|
||||
{
|
||||
if (string.IsNullOrEmpty(_ContractorVersion))
|
||||
{
|
||||
//IronSysServiceClient ic = GetIronSystemServiceClient();
|
||||
//_ContractorVersion = ic.GetServerVersion();
|
||||
_ContractorVersion = GetAssemblyFileVersion();
|
||||
}
|
||||
return _ContractorVersion;
|
||||
@ -370,21 +391,6 @@ namespace IronIntel.Contractor
|
||||
return _FICVersion;
|
||||
}
|
||||
|
||||
private static string[] _IronIntelSystemServiceAddresses = null;
|
||||
|
||||
public static string[] SystemServiceAddresses
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_IronIntelSystemServiceAddresses == null)
|
||||
{
|
||||
string s = GetStringParam("MasterServiceAddress");
|
||||
_IronIntelSystemServiceAddresses = s.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
return _IronIntelSystemServiceAddresses;
|
||||
}
|
||||
}
|
||||
|
||||
private static string _ReportDbString = string.Empty;
|
||||
|
||||
public static string GetIronIntelReportDataDbString(string companyid = null)
|
||||
@ -395,11 +401,6 @@ namespace IronIntel.Contractor
|
||||
{
|
||||
return _ReportDbString;
|
||||
}
|
||||
string svcaddress = GetStringParam("IronIntelSystemServiceAddress");
|
||||
if (string.IsNullOrWhiteSpace(svcaddress))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
CustomerDetail cust = FleetServiceClientHelper.CreateClient<CustomerProvider>(companyid, string.Empty).GetCustomerDetail(companyid);
|
||||
string dbstring = cust.ReportDataDbString;
|
||||
if (!string.IsNullOrEmpty(dbstring))
|
||||
@ -416,6 +417,29 @@ namespace IronIntel.Contractor
|
||||
return GetCustomerDbString(companyid, "MASTER_DATA_DB");
|
||||
}
|
||||
|
||||
public static string[] GetMonitorServiceAddresses()
|
||||
{
|
||||
SystemOptionProvider sp = FleetServiceClientHelper.CreateClient<SystemOptionProvider>();
|
||||
string xml = sp.GetMasterSysParam("ForesightPublicService");
|
||||
if (string.IsNullOrWhiteSpace(xml))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.LoadXml(xml);
|
||||
foreach (XmlNode node in doc.DocumentElement.ChildNodes)
|
||||
{
|
||||
if (string.Compare(node.Name, "MonitorServiceAddress", true) == 0)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(node.InnerText))
|
||||
{
|
||||
return node.InnerText.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string GetCustomerDbString(string companyid, string dbtype)
|
||||
{
|
||||
string key = companyid + dbtype;
|
||||
@ -428,19 +452,19 @@ namespace IronIntel.Contractor
|
||||
return dbstring;
|
||||
}
|
||||
|
||||
public static Services.Customers.CustomerInfo GetCompanyInfo()
|
||||
public static CustomerInfo GetCompanyInfo()
|
||||
{
|
||||
if (_Company == null)
|
||||
{
|
||||
var ic = GetCustomerProvider();
|
||||
var ic = FleetServiceClientHelper.CreateClient<CustomerProvider>(CompanyID);
|
||||
_Company = ic.GetCustomerByID(CompanyID);
|
||||
}
|
||||
return _Company;
|
||||
}
|
||||
public static MainStyle GetMainStyle()
|
||||
{
|
||||
IronSysServiceClient ic = GetIronSystemServiceClient();
|
||||
return ic.GetMainStyle(CompanyID);
|
||||
var sp = FleetServiceClientHelper.CreateClient<StyleProvider>();
|
||||
return sp.GetMainStyle(CompanyID);
|
||||
}
|
||||
|
||||
public static bool IsDealer
|
||||
@ -451,16 +475,16 @@ namespace IronIntel.Contractor
|
||||
}
|
||||
}
|
||||
|
||||
public static Services.Customers.CustomerInfo[] GetContractors()
|
||||
public static CustomerInfo[] GetContractors()
|
||||
{
|
||||
if (IsDealer)
|
||||
{
|
||||
var cust = GetCustomerProvider();
|
||||
return cust.GetContractors(CompanyID);
|
||||
var ic = FleetServiceClientHelper.CreateClient<CustomerProvider>(CompanyID);
|
||||
return ic.GetContractors(CompanyID);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Services.Customers.CustomerInfo[0];
|
||||
return new CustomerInfo[0];
|
||||
}
|
||||
}
|
||||
|
||||
@ -471,8 +495,8 @@ namespace IronIntel.Contractor
|
||||
|
||||
public static byte[] GetForesightLOGOInMainStyle()
|
||||
{
|
||||
IronSysServiceClient ic = GetIronSystemServiceClient();
|
||||
return ic.GetLogoInMainStyle(CompanyID, 1);
|
||||
var sp = FleetServiceClientHelper.CreateClient<StyleProvider>();
|
||||
return sp.GetLogoInMainStyle(CompanyID, 1);
|
||||
}
|
||||
|
||||
public static byte[] GetCompanyLocationLOGO(string companyid)
|
||||
@ -488,7 +512,7 @@ namespace IronIntel.Contractor
|
||||
}
|
||||
}
|
||||
|
||||
public static Services.Customers.CustomerInfo GetFirstDealerInfo()
|
||||
public static CustomerInfo GetFirstDealerInfo()
|
||||
{
|
||||
if (IsDealer)
|
||||
{
|
||||
@ -496,7 +520,7 @@ namespace IronIntel.Contractor
|
||||
}
|
||||
else
|
||||
{
|
||||
var cust = GetCustomerProvider();
|
||||
var cust = FleetServiceClientHelper.CreateClient<CustomerProvider>(CompanyID);
|
||||
var cmps = cust.GetDealers(CompanyID);
|
||||
if ((cmps != null) && (cmps.Length > 0))
|
||||
{
|
||||
@ -506,9 +530,22 @@ namespace IronIntel.Contractor
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Dictionary<string, CustomerInfo> _DealerConttactors = new Dictionary<string, CustomerInfo>();
|
||||
public static CustomerInfo GetCustomerInfo(string id)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(id)) return null;
|
||||
if (!_DealerConttactors.ContainsKey(id))
|
||||
{
|
||||
var ic = FleetServiceClientHelper.CreateClient<CustomerProvider>(id);
|
||||
var c = ic.GetCustomerByID(id);
|
||||
_DealerConttactors[id] = c;
|
||||
}
|
||||
return _DealerConttactors[id];
|
||||
}
|
||||
|
||||
public static bool HasLOGO(string companyid)
|
||||
{
|
||||
IronSysServiceClient ic = GetIronSystemServiceClient();
|
||||
CustomerProvider ic = FleetServiceClientHelper.CreateClient<CustomerProvider>();
|
||||
return ic.HasLOGO(companyid);
|
||||
}
|
||||
public static void ExecSQL(FIDbAccess db, int retrytimes, string sql, params object[] values)
|
||||
@ -533,30 +570,6 @@ namespace IronIntel.Contractor
|
||||
}
|
||||
}
|
||||
|
||||
public static IronSysServiceClient GetIronSystemServiceClient()
|
||||
{
|
||||
IronSysServiceClient ic = GetServiceClient<IronSysServiceClient>();
|
||||
return ic;
|
||||
}
|
||||
|
||||
public static MachineServiceClient2 GetMachineServiceClient()
|
||||
{
|
||||
MachineServiceClient2 ic = GetServiceClient<MachineServiceClient2>();
|
||||
return ic;
|
||||
}
|
||||
|
||||
public static MapAlertLayerClient GetMapAlertLayerClient()
|
||||
{
|
||||
MapAlertLayerClient ic = GetServiceClient<MapAlertLayerClient>();
|
||||
return ic;
|
||||
}
|
||||
|
||||
public static Services.Customers.CustomerProvider GetCustomerProvider()
|
||||
{
|
||||
var ic = GetServiceClient<Services.Customers.CustomerProvider>();
|
||||
return ic;
|
||||
}
|
||||
|
||||
/**Fleet Service***/
|
||||
public static string[] FleetAssetServiceAddresses
|
||||
{
|
||||
@ -591,12 +604,25 @@ namespace IronIntel.Contractor
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_MachineTypeMapViewIconUrl))
|
||||
{
|
||||
MachineServiceClient2 mc2 = SystemParams.GetMachineServiceClient();
|
||||
_MachineTypeMapViewIconUrl = mc2.GetMachineTypeIconUrl();
|
||||
var client = FleetServiceClientHelper.CreateClient<AssetClassProvider>();
|
||||
_MachineTypeMapViewIconUrl = client.GetMachineTypeIconUrl();
|
||||
}
|
||||
return _MachineTypeMapViewIconUrl;
|
||||
}
|
||||
}
|
||||
private static string _MachineMovingIconUrl = string.Empty;
|
||||
public static string MachineMovingIconUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_MachineMovingIconUrl))
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<AssetClassProvider>();
|
||||
_MachineMovingIconUrl = client.GetMachineMovingIconUrl();
|
||||
}
|
||||
return _MachineMovingIconUrl;
|
||||
}
|
||||
}
|
||||
|
||||
public static CustUIStyle GetUIStyle(string useriid)
|
||||
{
|
||||
@ -605,50 +631,14 @@ namespace IronIntel.Contractor
|
||||
int styleID = -1;
|
||||
if (string.IsNullOrEmpty(sid) || !int.TryParse(sid, out styleID))
|
||||
styleID = -1;
|
||||
var sc = GetIronSystemServiceClient();
|
||||
CustUIStyle style = sc.GetDefaultUIStyle(SystemParams.CompanyID, styleID);
|
||||
var sp = FleetServiceClientHelper.CreateClient<StyleProvider>();
|
||||
CustUIStyle style = sp.GetDefaultUIStyle(CompanyID, styleID);
|
||||
return style;
|
||||
}
|
||||
|
||||
//public static int GetTimeAdjust()
|
||||
//{
|
||||
// var sc = GetIronSystemServiceClient();
|
||||
// return sc.GetCompanyTimeAdjust(CompanyID);
|
||||
//}
|
||||
|
||||
public static double GetHoursOffset()
|
||||
public static TimeZoneInfo GetTimeZoneInfo(string custid)
|
||||
{
|
||||
//double offsetMinutes = 0;
|
||||
//string offset = GetStringParam("CustomerTimeZoneOffset");
|
||||
//if (!string.IsNullOrEmpty(offset) && double.TryParse(offset, out offsetMinutes))
|
||||
//{
|
||||
// return offsetMinutes / 60;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
string tzName = GetStringParam("CustomerTimeZone");
|
||||
if (!string.IsNullOrEmpty(tzName))
|
||||
{
|
||||
var tz = TimeZoneInfo.FindSystemTimeZoneById(tzName.Trim());
|
||||
if (tz != null)
|
||||
{
|
||||
TimeSpan offset = tz.GetUtcOffset(DateTime.UtcNow);
|
||||
return offset.Hours + (double)offset.Minutes / 60;
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
var sc = GetIronSystemServiceClient();
|
||||
double offsetHours = sc.GetCompanyTimeAdjust(CompanyID);
|
||||
return offsetHours;
|
||||
}
|
||||
|
||||
public static TimeZoneInfo GetTimeZoneInfo(string custid, FISqlConnection db = null)
|
||||
{
|
||||
|
||||
string tzName = GetStringParam("CustomerTimeZone", true, db);
|
||||
if (string.IsNullOrEmpty(tzName))
|
||||
tzName = FleetServiceClientHelper.CreateClient<CustomerProvider>(custid, string.Empty).GetCustomerTimeZoneName(custid);
|
||||
string tzName = FleetServiceClientHelper.CreateClient<CustomerProvider>(custid, string.Empty).GetCustomerTimeZoneName(custid);
|
||||
var tz = TimeZoneInfo.FindSystemTimeZoneById(tzName.Trim());
|
||||
return tz;
|
||||
}
|
||||
@ -657,54 +647,64 @@ namespace IronIntel.Contractor
|
||||
{
|
||||
var tzs = TimeZoneInfo.GetSystemTimeZones();
|
||||
List<StringKeyValue> result = new List<StringKeyValue>();
|
||||
|
||||
foreach (TimeZoneInfo tz in tzs)
|
||||
DateTime now = DateTime.UtcNow;
|
||||
foreach (TimeZoneInfo tz in tzs.OrderBy(tz => tz.GetUtcOffset(now)).ThenBy(tz => tz.Id))
|
||||
{
|
||||
StringKeyValue skv = new StringKeyValue();
|
||||
skv.Key = tz.Id;
|
||||
TimeSpan offset = tz.GetUtcOffset(DateTime.UtcNow);
|
||||
TimeSpan offset = tz.GetUtcOffset(now);//tz.BaseUtcOffset; BaseUtcOffset有问题
|
||||
skv.Value = string.Format("{0}{1}:{2}", offset.Hours >= 0 ? "+" : "", offset.Hours.ToString("00"), Math.Abs(offset.Minutes).ToString("00"));
|
||||
|
||||
skv.Tag1 = offset.TotalMinutes.ToString();
|
||||
result.Add(skv);
|
||||
}
|
||||
return result.OrderBy(tz => double.Parse(tz.Tag1)).ThenBy(tz => tz.Key).ToArray();
|
||||
//const string SQL = "select name,current_utc_offset as offset from sys.time_zone_info";
|
||||
|
||||
//FISqlConnection db = GetDbInstance();
|
||||
//DataTable tb = db.GetDataTableBySQL(SQL);
|
||||
//if (tb.Rows.Count > 0)
|
||||
//{
|
||||
// foreach (DataRow dr in tb.Rows)
|
||||
// {
|
||||
// StringKeyValue skv = new StringKeyValue();
|
||||
// skv.Key = FIDbAccess.GetFieldString(dr["name"], string.Empty);
|
||||
// skv.Value = FIDbAccess.GetFieldString(dr["offset"], string.Empty);
|
||||
|
||||
// string offsetstr = skv.Value;
|
||||
// string symbol = offsetstr.Substring(0, 1);
|
||||
// string offset = offsetstr.Remove(0, 1);
|
||||
// string[] strs = offset.Split(':');
|
||||
|
||||
// skv.Tag1 = (int.Parse(symbol + strs[0]) * 60 + int.Parse(symbol + strs[1])).ToString();
|
||||
// result.Add(skv);
|
||||
// }
|
||||
//}
|
||||
//return result.ToArray();
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
public static DateTime ConvertToUserTimeFromUtc(Foresight.Fleet.Services.User.UserInfo ui, DateTime utctime)
|
||||
{
|
||||
TimeZoneInfo timeZone = null;
|
||||
if (!string.IsNullOrWhiteSpace(ui.TimeZone))
|
||||
{
|
||||
timeZone = TimeZoneInfo.FindSystemTimeZoneById(ui.TimeZone);
|
||||
}
|
||||
|
||||
if (timeZone == null)
|
||||
{
|
||||
if (ui.IsForesightUser)
|
||||
timeZone = ForesightCustomerDetail.TimeZone;
|
||||
else
|
||||
timeZone = CustomerDetail.TimeZone;
|
||||
}
|
||||
|
||||
return TimeZoneInfo.ConvertTimeFromUtc(new DateTime(utctime.Ticks), timeZone);
|
||||
}
|
||||
|
||||
public static string GetUserTimeZoneId(Foresight.Fleet.Services.User.UserInfo ui)
|
||||
{
|
||||
string tzid = ui.TimeZone;
|
||||
if (!string.IsNullOrWhiteSpace(tzid))
|
||||
return tzid;
|
||||
|
||||
if (ui.IsForesightUser)
|
||||
tzid = ForesightCustomerDetail.TimeZoneId;
|
||||
else
|
||||
tzid = CustomerDetail.TimeZoneId;
|
||||
|
||||
return tzid;
|
||||
}
|
||||
|
||||
public const string APPNAME = "IronIntelCustomerSite";
|
||||
private const string WORKING_COMPANY_HEADER = "WorkingCompanyID";
|
||||
|
||||
public static void SendMail(System.Net.Mail.MailMessage msg)
|
||||
public static long SendMail(System.Net.Mail.MailMessage msg)
|
||||
{
|
||||
SendMail(APPNAME, msg);
|
||||
return SendMail(APPNAME, msg);
|
||||
}
|
||||
|
||||
public static void SendMail(string appname, System.Net.Mail.MailMessage msg)
|
||||
public static long SendMail(string appname, System.Net.Mail.MailMessage msg)
|
||||
{
|
||||
FleetServiceClientHelper.CreateClient<SystemUtil>().SendMail(CompanyID, appname, msg);
|
||||
return FleetServiceClientHelper.CreateClient<SystemUtil>().SendMail(CompanyID, appname, msg);
|
||||
}
|
||||
|
||||
public static void WriteLog(string logType, string source, string message, string detail)
|
||||
@ -729,6 +729,17 @@ namespace IronIntel.Contractor
|
||||
}
|
||||
}
|
||||
|
||||
public static void WriteLog_Ext(string logType, string source, string message, string detail, string extmsg)
|
||||
{
|
||||
try
|
||||
{
|
||||
FleetServiceClientHelper.CreateClient<SystemUtil>().WriteLog(CompanyID, APPNAME, logType, source, message, detail, extmsg);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public static void WriteRefreshLog(string useriid, string userhost, string objname, string refreshtype)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(new WaitCallback((e) => { _WriteRefreshLog(useriid, userhost, objname, refreshtype); }), null);
|
||||
@ -826,10 +837,17 @@ namespace IronIntel.Contractor
|
||||
|
||||
public static Dictionary<string, string> GetAdditionalParameter()
|
||||
{
|
||||
StringKeyValue connector = new StringKeyValue();
|
||||
|
||||
string connectorxml = GetStringParam("Connector");
|
||||
StringKeyValue[] connectors = ConnectorHelper.FromXML(connectorxml);
|
||||
if (connectors != null && connectors.Length > 0)
|
||||
connector = connectors[0];
|
||||
|
||||
var dict = new Dictionary<string, string>
|
||||
{
|
||||
{ "ConnectorToken", ConnectorToken },
|
||||
{ "ConnectorServer", ConnectorServer },
|
||||
{ "ConnectorServer", connector.Key },
|
||||
{ "ConnectorToken", connector.Value },
|
||||
{ "LdapAgentID", LdapAgentID },
|
||||
{ "LdapAgentToken", LdapAgentToken },
|
||||
{ "CanUseConnectorLDAP", CanUseConnectorLDAP ? "1" : "0" }
|
||||
@ -837,5 +855,196 @@ namespace IronIntel.Contractor
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
private static ConcurrentDictionary<string, Dictionary<string, object>> _Languages = new ConcurrentDictionary<string, Dictionary<string, object>>(StringComparer.OrdinalIgnoreCase);
|
||||
private static Dictionary<string, object> GetLanguage(string lang)
|
||||
{
|
||||
if (!_Languages.ContainsKey(lang))
|
||||
{
|
||||
var ldata = LoadLanguage(lang);
|
||||
if (ldata != null)
|
||||
{
|
||||
_Languages[lang] = ldata;
|
||||
return ldata;
|
||||
}
|
||||
}
|
||||
else
|
||||
return _Languages[lang];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> LoadLanguage(string lang)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(lang))
|
||||
lang = "en-us";
|
||||
|
||||
string filename = lang + ".json";
|
||||
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Languages\\" + filename);
|
||||
TextReader tr = File.OpenText(path);
|
||||
Newtonsoft.Json.JsonTextReader jtr = new Newtonsoft.Json.JsonTextReader(tr);
|
||||
Newtonsoft.Json.Linq.JObject obj = Newtonsoft.Json.Linq.JObject.Load(jtr);
|
||||
|
||||
System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
|
||||
Dictionary<string, object> dic = (Dictionary<string, object>)js.DeserializeObject(obj["Values"].ToString());
|
||||
|
||||
return dic;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetTextByKey(string lang, string key, string defaultValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
Dictionary<string, object> dic = GetLanguage(lang);
|
||||
if (dic == null || !dic.ContainsKey(key))
|
||||
return defaultValue;
|
||||
return dic[key].ToString();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
public static string _TimeZoneAbbreviation = "";
|
||||
public static string TimeZoneAbbreviation
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_TimeZoneAbbreviation))
|
||||
{
|
||||
_TimeZoneAbbreviation = GetUpperTimeZone(CustomerDetail.TimeZone.Id);
|
||||
//Dictionary<string, string> dic = GetTimeZoneAbbreviations();
|
||||
//if (dic.ContainsKey(CustomerDetail.TimeZone.Id))
|
||||
// _TimeZoneAbbreviation = dic[CustomerDetail.TimeZone.Id];
|
||||
//else
|
||||
// _TimeZoneAbbreviation = CustomerDetail.TimeZone.Id;
|
||||
}
|
||||
return _TimeZoneAbbreviation;
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetUpperTimeZone(string tzid)
|
||||
{
|
||||
tzid = System.Text.RegularExpressions.Regex.Replace(tzid, @"\(.*\)", "");
|
||||
return System.Text.RegularExpressions.Regex.Replace(tzid, @"[a-z ]*", "");
|
||||
}
|
||||
|
||||
public static bool ShowForesightLogo()
|
||||
{
|
||||
string temp = GetStringParam("ShowForesightLogo");
|
||||
if (string.IsNullOrEmpty(temp))
|
||||
return true;
|
||||
return Helper.IsTrue(temp);
|
||||
}
|
||||
|
||||
public static string GetUserLanguage(string useriid)
|
||||
{
|
||||
var uc = FleetServiceClientHelper.CreateClient<UserQueryClient>();
|
||||
string language = uc.GetUserPreferredLanguageByIID(useriid);
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
var ic = FleetServiceClientHelper.CreateClient<CustomerProvider>(CompanyID);
|
||||
var cust = ic.GetCustomerByID(CompanyID);
|
||||
language = cust.LanguageId;
|
||||
}
|
||||
|
||||
return string.IsNullOrEmpty(language) ? "en-us" : language;
|
||||
}
|
||||
|
||||
|
||||
public static bool CheckRight(string custid, Foresight.Fleet.Services.User.UserInfo user, int featureid, Permissions per = Permissions.ReadOnly)
|
||||
{
|
||||
if (user == null)
|
||||
return false;
|
||||
|
||||
if (user.UserType == Foresight.Fleet.Services.User.UserTypes.SupperAdmin)
|
||||
return true;
|
||||
|
||||
if (user.UserType == Foresight.Fleet.Services.User.UserTypes.Common || user.UserType == Foresight.Fleet.Services.User.UserTypes.Admin)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<PermissionProvider>();
|
||||
Tuple<Feature, Permissions>[] pmss = client.GetUserPermissions(custid, user.UID);
|
||||
if (pmss.Length > 0)
|
||||
{
|
||||
Tuple<Feature, Permissions> permission = pmss.FirstOrDefault(m => m.Item1.Id == featureid);
|
||||
if (permission != null && permission.Item2 >= per)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class ConnectorHelper
|
||||
{
|
||||
public static StringKeyValue[] FromXML(string xmlstr)
|
||||
{
|
||||
List<StringKeyValue> ls = new List<StringKeyValue>();
|
||||
if (!string.IsNullOrEmpty(xmlstr))
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.LoadXml(xmlstr);
|
||||
XmlNode ch = doc.DocumentElement.FirstChild;
|
||||
if (string.Compare(ch.Name, "Connectors", true) == 0)
|
||||
{
|
||||
foreach (XmlNode node in ch.ChildNodes)
|
||||
{
|
||||
ls.Add(FromXml(node));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ls.ToArray();
|
||||
}
|
||||
|
||||
private static StringKeyValue FromXml(XmlNode node)
|
||||
{
|
||||
StringKeyValue kv = new StringKeyValue();
|
||||
foreach (XmlNode ch in node.ChildNodes)
|
||||
{
|
||||
if (string.Compare(ch.Name, "Server", true) == 0)
|
||||
kv.Key = ch.InnerText;
|
||||
else if (string.Compare(ch.Name, "Token", true) == 0)
|
||||
kv.Value = ch.InnerText;
|
||||
|
||||
}
|
||||
return kv;
|
||||
}
|
||||
|
||||
public static XmlDocument ToXml(StringKeyValue[] kvs)
|
||||
{
|
||||
XmlDocument doc = XmlHelper.CreateXmlDocument();
|
||||
XmlNode node = XmlHelper.AppendChildNode(doc.DocumentElement, "Connectors", "");
|
||||
if (kvs != null && kvs.Length > 0)
|
||||
{
|
||||
foreach (var kv in kvs)
|
||||
{
|
||||
var sn = AddSubNode(node, "Connector", "");
|
||||
|
||||
AddSubNode(sn, "Server", kv.Key);
|
||||
AddSubNode(sn, "Token", kv.Value);
|
||||
}
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
|
||||
private static XmlNode AddSubNode(XmlNode parent, string nodename, string innertext)
|
||||
{
|
||||
XmlNode node = parent.OwnerDocument.CreateNode(XmlNodeType.Element, nodename, string.Empty);
|
||||
if (!string.IsNullOrEmpty(innertext))
|
||||
{
|
||||
node.InnerText = innertext;
|
||||
}
|
||||
parent.AppendChild(node);
|
||||
return node;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Data;
|
||||
using Foresight.Data;
|
||||
using Foresight.Fleet.Services.User;
|
||||
using Foresight.Fleet.Services.AssetHealth;
|
||||
|
||||
namespace IronIntel.Contractor.Users
|
||||
{
|
||||
@ -20,6 +22,414 @@ namespace IronIntel.Contractor.Users
|
||||
public string ForeColor { get; set; }
|
||||
public bool OpenInNewWindow { get; set; }
|
||||
public AppModuleType ModuleType { get; set; }
|
||||
public List<NavigateItem> SubItems { get; set; }
|
||||
|
||||
public List<NavigateItem> GetJobsiteNavigateItems(Tuple<Feature, Permissions>[] pmss)
|
||||
{
|
||||
List<NavigateItem> list = new List<NavigateItem>();
|
||||
Foresight.Fleet.Services.Customer.LicenseInfo license = SystemParams.GetLicense();
|
||||
var jsitem = license.Items.FirstOrDefault(m => m.Key == "JobSites");
|
||||
if (jsitem == null || !Helper.IsTrue(jsitem.Value))
|
||||
{
|
||||
return list;
|
||||
}
|
||||
NavigateItem item = null;
|
||||
var jsditem = license.Items.FirstOrDefault(m => m.Key == "JobsiteDispatch");
|
||||
if (jsditem != null && Helper.IsTrue(jsditem.Value))
|
||||
{
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_jobsiterequirements";
|
||||
item.FeatureID = Feature.JOB_SITES_REQUIREMENTS;
|
||||
item.Title = "Jobsite Requirements";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "JobSiteRequirements.aspx";
|
||||
item.IconPath = "img/jobsiterequirements.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.JOB_SITES_REQUIREMENTS) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_dispatchrequests";
|
||||
item.FeatureID = Feature.JOB_SITES_DISPATCHREQUESTS;
|
||||
item.Title = "Dispatch Requests";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "DispatchRequests.aspx";
|
||||
item.IconPath = "img/dispatch.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.JOB_SITES_DISPATCHREQUESTS) != null)
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_jobsitemanage";
|
||||
item.FeatureID = Feature.JOB_SITES;
|
||||
item.Title = "Jobsites";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "JobSiteManage.aspx";
|
||||
item.IconPath = "img/jobsite.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.JOB_SITES) != null)
|
||||
list.Add(item);
|
||||
|
||||
if (jsditem != null || Helper.IsTrue(jsditem.Value))
|
||||
{
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_scheduler";
|
||||
item.FeatureID = Feature.JOB_SITES_SCHEDULER;
|
||||
item.Title = "Scheduler";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "SchedulerManagement.aspx";
|
||||
item.IconPath = "img/scheduler.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.JOB_SITES_SCHEDULER) != null)
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<NavigateItem> GetMaintenanceNavigateItems(Tuple<Feature, Permissions>[] pmss, UserInfo user)
|
||||
{
|
||||
List<NavigateItem> list = new List<NavigateItem>();
|
||||
|
||||
NavigateItem item = new NavigateItem();
|
||||
item.ID = "nav_workorder";
|
||||
item.FeatureID = Feature.WORK_ORDER;
|
||||
item.Title = "Work Order";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "WorkOrderMaintenance.aspx";
|
||||
item.IconPath = "img/workorder.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.WORK_ORDER) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_workorderhis";
|
||||
item.FeatureID = Feature.WORKORDERHISTORY;
|
||||
item.Title = "Work Order History";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "WorkOrderHistory.aspx";
|
||||
item.IconPath = "img/workorderhis.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.WORKORDERHISTORY) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_alertsmanagement";
|
||||
item.FeatureID = Feature.ALERTS_MANAGEMENT;
|
||||
item.Title = "Alerts Management";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "AlertsManagement.aspx";
|
||||
item.IconPath = "img/alert.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.ALERTS_MANAGEMENT) != null)
|
||||
list.Add(item);
|
||||
|
||||
if (user.UserType == UserTypes.SupperAdmin)
|
||||
{
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_alertsmappings";
|
||||
item.FeatureID = Feature.ALERTS_MANAGEMENT;
|
||||
item.Title = "Alert Mappings";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "AlertsMapping.aspx";
|
||||
item.IconPath = "img/alert.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.ALERTS_MANAGEMENT) != null)
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_maintenanceschedule";
|
||||
item.FeatureID = Feature.PREVENTATIVE_MAINTENANCE;
|
||||
item.Title = "Maintenance Schedules";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "MaintenanceSchedulesManagement.aspx";
|
||||
item.IconPath = "img/preventative.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.PREVENTATIVE_MAINTENANCE) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_record";
|
||||
item.FeatureID = Feature.PREVENTATIVE_MAINTENANCE;
|
||||
item.Title = "Maintenance Record";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "MaintanceRecordsManagement.aspx";
|
||||
item.IconPath = "img/record.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.PREVENTATIVE_MAINTENANCE) != null
|
||||
&& pmss.FirstOrDefault(m => m.Item1.Id == Feature.MAINTENANCE_RECORD) != null)
|
||||
list.Add(item);
|
||||
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.FUEL_RECORDS) != null)
|
||||
{
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_fuelrecord";
|
||||
item.FeatureID = Feature.FUEL_RECORDS;
|
||||
item.Title = "Fuel Records";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "FuelRecordManagement.aspx";
|
||||
item.IconPath = "img/fuelrecord.png";
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.CUSTOMER_RECORD) != null)
|
||||
{
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_customerrecord";
|
||||
item.FeatureID = Feature.CUSTOMER_RECORD;
|
||||
item.Title = "Customer Record";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "CustomerRecordManagement.aspx";
|
||||
item.IconPath = "img/customerrecord.png?v=1";
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_surveymanagementresult";
|
||||
item.FeatureID = Feature.WORKORDERSURVEYS;
|
||||
item.Title = "Survey Management/Result";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "SurveyManagement.aspx";
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_wosurveytemplate";
|
||||
item.FeatureID = -1;
|
||||
item.Title = "Templates";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "SurveyTemplateManagement.aspx";
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_wosurveytemplatereport";
|
||||
item.FeatureID = -1;
|
||||
item.Title = "Report";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "SurveyTemplateReport.aspx";
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<NavigateItem> GetSecurityNavigateItems(Tuple<Feature, Permissions>[] pmss, UserInfo user)
|
||||
{
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.USERS) == null)
|
||||
return null;
|
||||
|
||||
List<NavigateItem> list = new List<NavigateItem>();
|
||||
NavigateItem item = new NavigateItem();
|
||||
item.ID = "nav_users";
|
||||
item.FeatureID = Feature.USERS;
|
||||
item.Title = "Users";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "UserManage.aspx";
|
||||
item.IconPath = "img/users.png";
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_user_group";
|
||||
item.Title = "User Group";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "UserGroup.aspx";
|
||||
item.IconPath = "img/usergroup.png";
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_dts";
|
||||
item.Title = "DataTable Permission";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "../fic/fic/Management/DataTablePermission.aspx";
|
||||
//item.IconPath = "img/permission.png";
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_filters";
|
||||
item.Title = "Dashboard Filters";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "../fic/fic/Management/FiltersManagement.aspx";
|
||||
item.IconPath = "img/filters.png";
|
||||
list.Add(item);
|
||||
|
||||
if (IronIntel.Contractor.SystemParams.IsDealer)
|
||||
{
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_usertocontractor";
|
||||
item.Title = "User To Contractor";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "UserToContractorPage.aspx";
|
||||
item.IconPath = "img/contractor.png";
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_curfew";
|
||||
item.FeatureID = Feature.CURFEW_CONFIG;
|
||||
item.Title = "Curfew Configuration";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "CurfewManage.aspx";
|
||||
item.IconPath = "img/curfew.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.CURFEW_CONFIG) != null)
|
||||
list.Add(item);
|
||||
|
||||
if (!IronIntel.Contractor.SystemParams.IsDealer && user.UserType == UserTypes.SupperAdmin)
|
||||
{
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_curfewmt";
|
||||
item.FeatureID = Feature.CURFEW_CONFIG;
|
||||
item.Title = "Curfew Movement Tolerance";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "CurfewMovementTolerance.aspx";
|
||||
item.IconPath = "img/curfewmovementtolerance.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.CURFEW_CONFIG) != null)
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<NavigateItem> GetAssetsNavigateItems(Tuple<Feature, Permissions>[] pmss, UserInfo user)
|
||||
{
|
||||
List<NavigateItem> list = new List<NavigateItem>();
|
||||
|
||||
NavigateItem item = new NavigateItem();
|
||||
item.ID = "nav_managmachines";
|
||||
item.FeatureID = Feature.MANAGE_ASSETS;
|
||||
item.Title = "Manage Assets";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "ManageMachines.aspx";
|
||||
item.IconPath = "img/machines.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.MANAGE_ASSETS) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_assethistory";
|
||||
item.FeatureID = Feature.MANAGE_ASSETS;
|
||||
item.Title = "Asset History";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "AssetHistory.aspx";
|
||||
item.IconPath = "img/workorderhis.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.MANAGE_ASSETS) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_managrentals";
|
||||
item.FeatureID = Feature.MANAGE_ASSETS;
|
||||
item.Title = "Manage Rentals";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "ManageRentals.aspx";
|
||||
item.IconPath = "img/rental.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.MANAGE_ASSETS) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_machinegroups";
|
||||
item.FeatureID = Feature.ASSET_GROUP;
|
||||
item.Title = "Asset Groups";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "MachineGroups.aspx";
|
||||
item.IconPath = "img/machinegroups.png";
|
||||
if (!IronIntel.Contractor.SystemParams.IsDealer && user.UserType >= UserTypes.Admin)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_managegpsdevices";
|
||||
item.FeatureID = Feature.MANAGE_DEVICES;
|
||||
item.Title = "Manage Devices";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "ManageGPSDevices.aspx";
|
||||
item.IconPath = "img/devices.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.MANAGE_DEVICES) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_managmodels";
|
||||
item.Title = "Manage Models";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "ManageModels.aspx";
|
||||
item.IconPath = "img/model.png";
|
||||
if (user.UserType >= UserTypes.Admin)
|
||||
list.Add(item);
|
||||
|
||||
bool license = SystemParams.HasLicense("ShareAsset");
|
||||
if (license && !SystemParams.IsDealer && pmss.FirstOrDefault(m => m.Item1.Id == Feature.MANAGE_DEVICES) != null)
|
||||
{
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_shareasset";
|
||||
item.Title = "Share Assets";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "ShareMachines.aspx";
|
||||
//item.IconPath = "img/model.png";
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<NavigateItem> GetCredentialNavigateItems(Tuple<Feature, Permissions>[] pmss, UserInfo user)
|
||||
{
|
||||
List<NavigateItem> list = new List<NavigateItem>();
|
||||
NavigateItem item = new NavigateItem();
|
||||
item.ID = "nav_credential";
|
||||
item.FeatureID = Feature.CREDENTIALS;
|
||||
item.Title = "Credentials";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "ManageCredential.aspx";
|
||||
item.IconPath = "img/credential.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.CREDENTIALS) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_jdlink";
|
||||
item.FeatureID = Feature.JDLINK;
|
||||
item.Title = "JD Link";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "ManageJDLink.aspx";
|
||||
item.IconPath = "img/jdlink.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.JDLINK) != null)
|
||||
list.Add(item);
|
||||
|
||||
//item = new NavigateItem();
|
||||
//item.ID = "nav_jdnotification";
|
||||
//item.FeatureID = Feature.JDNOTIFICATION;
|
||||
//item.Title = "JohnDeere Notifications";
|
||||
//item.Url = Url + "#" + item.ID;
|
||||
//item.PageUrl = "ManageJDNotifications.aspx";
|
||||
//item.IconPath = "img/jdnotifications.png";
|
||||
//if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.JDNOTIFICATION) != null)
|
||||
// list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_apicredential";
|
||||
item.FeatureID = Feature.APICREDENTIALS;
|
||||
item.Title = "API Credentials";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "ManageAPICredential.aspx";
|
||||
item.IconPath = "img/apicredential.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.APICREDENTIALS) != null)
|
||||
list.Add(item);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public List<NavigateItem> GetOTRConfigNavigateItems(Tuple<Feature, Permissions>[] pmss, UserInfo user)
|
||||
{
|
||||
List<NavigateItem> list = new List<NavigateItem>();
|
||||
NavigateItem item = new NavigateItem();
|
||||
item.ID = "nav_manageharshdriving";
|
||||
item.FeatureID = Feature.HARSH_DRIVING;
|
||||
item.Title = "Manage Harsh Driving";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "ManageHarshDriving.aspx";
|
||||
item.IconPath = "img/harshdriving.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.HARSH_DRIVING) != null)
|
||||
list.Add(item);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class NavigateItem
|
||||
{
|
||||
public string ID { get; set; }
|
||||
public int FeatureID { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string PageUrl { get; set; }
|
||||
public string IconPath { get; set; }
|
||||
}
|
||||
|
||||
public class SecurityNavigateItem
|
||||
@ -30,6 +440,14 @@ namespace IronIntel.Contractor.Users
|
||||
public string IconPath { get; set; }
|
||||
}
|
||||
|
||||
public class CredentialNavigateItem
|
||||
{
|
||||
public string ID { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string IconPath { get; set; }
|
||||
}
|
||||
|
||||
public enum AppModuleType
|
||||
{
|
||||
System,
|
||||
|
@ -5,8 +5,8 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Data;
|
||||
using Foresight.Data;
|
||||
using IronIntel.Contractor.Users;
|
||||
using IronIntel.Services;
|
||||
using Foresight.Fleet.Services.User;
|
||||
using Foresight.Fleet.Services.Styles;
|
||||
|
||||
namespace IronIntel.Contractor.Users
|
||||
{
|
||||
@ -15,69 +15,59 @@ namespace IronIntel.Contractor.Users
|
||||
private const string FITracker = "FITracker";
|
||||
private const string Inspect = "Inspection";
|
||||
private const string TeamIntelligence = "TeamIntelligence";
|
||||
private const string FilterQ = "FilterQ";
|
||||
|
||||
public static AppModuleInfo[] GetAvailableAppModuleInfos(UserInfo user)
|
||||
{
|
||||
const string SQL = @"select ID,APPMODULENAME,APPMODULEDESC,URL,ICONPATH,BACKCOLOR,FORECOLOR,OPENINNEWWINDOW from APPMODULES where VISIBLE>0 and (isnull(SITETYPE,'All')='All' or SITETYPE={0}) ";
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
return new AppModuleInfo[0];
|
||||
}
|
||||
|
||||
string sql = SQL;
|
||||
switch (user.UserType)
|
||||
{
|
||||
case UserTypes.Readonly:
|
||||
sql = SQL + " and SECURITYLEVEL=0";
|
||||
break;
|
||||
case UserTypes.Common:
|
||||
sql = SQL + " and SECURITYLEVEL<=1";
|
||||
break;
|
||||
case UserTypes.Admin:
|
||||
sql = SQL + " and SECURITYLEVEL<=2";
|
||||
break;
|
||||
case UserTypes.SupperAdmin:
|
||||
sql = SQL + " and SECURITYLEVEL<=3";
|
||||
break;
|
||||
default:
|
||||
sql = SQL;
|
||||
break;
|
||||
}
|
||||
|
||||
sql = sql + " order by ORDERINDEX ";
|
||||
|
||||
FIDbAccess db = SystemParams.GetDbInstance();
|
||||
DataTable dt = db.GetDataTableBySQL(sql, SystemParams.CustomerDetail.CustomerType);
|
||||
|
||||
CustUIStyle style = SystemParams.GetUIStyle(user.IID);//获取样式设置
|
||||
string moudleBackgroundColor = "#0078D7";
|
||||
if (style != null && !string.IsNullOrEmpty(style.MenuBackgroundColor))
|
||||
moudleBackgroundColor = style.MenuBackgroundColor;
|
||||
|
||||
List<AppModuleInfo> list = new List<AppModuleInfo>();
|
||||
bool fitracter = SystemParams.HasLicense(FITracker);
|
||||
bool inspect = SystemParams.HasLicense(Inspect);
|
||||
bool teamintelligence = SystemParams.HasLicense(TeamIntelligence);
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
|
||||
var pc = FleetServiceClientHelper.CreateClient<PermissionProvider>();
|
||||
FeatureModule[] ms = pc.GetAvailableModules(SystemParams.CompanyID, user.IID);
|
||||
Tuple<Feature, Permissions>[] pmss = pc.GetUserPermissions(SystemParams.CompanyID, user.IID);
|
||||
|
||||
List<FeatureModule> moudles = new List<FeatureModule>();
|
||||
moudles.AddRange(ms);
|
||||
if (ms.FirstOrDefault(m => m.Id == FeatureModule.MODULE_MAPVIEW) == null)
|
||||
moudles.Insert(0, FeatureModule.Modules[0]);
|
||||
foreach (var m in moudles)
|
||||
{
|
||||
AppModuleInfo ami = ConvertToAppModule(dr);
|
||||
ami.BackColor = moudleBackgroundColor;
|
||||
if (ami.ID.Equals(FITracker, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (fitracter)
|
||||
list.Add(ami);
|
||||
}
|
||||
else if (ami.ID.Equals(Inspect, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (inspect)
|
||||
list.Add(ami);
|
||||
}
|
||||
else if (ami.ID.Equals(TeamIntelligence, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (teamintelligence)
|
||||
list.Add(ami);
|
||||
}
|
||||
else
|
||||
if (m.Id == FeatureModule.MODULE_TEAM && user.UserType != UserTypes.SupperAdmin)
|
||||
continue;
|
||||
|
||||
if (m.Id == FeatureModule.MODULE_MANAGEASSETS && pmss.FirstOrDefault(p => p.Item1.Id == Feature.MANAGE_ASSETS) == null)
|
||||
continue;
|
||||
//if (m.Id == FeatureModule.MODULE_JOBSITES && pmss.FirstOrDefault(p => p.Item1.Id == Feature.JOB_SITES) == null)
|
||||
// continue;
|
||||
|
||||
AppModuleInfo ami = new AppModuleInfo();
|
||||
ami.ID = m.Id.ToString();
|
||||
ami.Name = m.Name;
|
||||
ami.Description = m.Description;
|
||||
ami.Url = m.Url;
|
||||
ami.IconPath = m.IconPath;
|
||||
ami.BackColor = m.BackgroundColor;
|
||||
ami.ForeColor = m.ForeColor;
|
||||
ami.OpenInNewWindow = false;
|
||||
ami.Visible = true;
|
||||
ami.ModuleType = AppModuleType.System;
|
||||
|
||||
if (m.Id == FeatureModule.MODULE_JOBSITES)
|
||||
ami.SubItems = ami.GetJobsiteNavigateItems(pmss);
|
||||
else if (m.Id == FeatureModule.MODULE_ASSETHEALTH)
|
||||
ami.SubItems = ami.GetMaintenanceNavigateItems(pmss, user);
|
||||
else if (m.Id == FeatureModule.MODULE_SECURITY)
|
||||
ami.SubItems = ami.GetSecurityNavigateItems(pmss, user);
|
||||
else if (m.Id == FeatureModule.MODULE_MANAGEASSETS)
|
||||
ami.SubItems = ami.GetAssetsNavigateItems(pmss, user);
|
||||
else if (m.Id == FeatureModule.MODULE_CREDENTIAL)
|
||||
ami.SubItems = ami.GetCredentialNavigateItems(pmss, user);
|
||||
|
||||
if (ami.SubItems == null || ami.SubItems.Count > 0)
|
||||
list.Add(ami);
|
||||
}
|
||||
AppModuleInfo[] wsps = GetFICWorkspace(user);
|
||||
@ -104,23 +94,7 @@ namespace IronIntel.Contractor.Users
|
||||
return false;
|
||||
}
|
||||
|
||||
private static AppModuleInfo ConvertToAppModule(DataRow dr)
|
||||
{
|
||||
AppModuleInfo ai = new AppModuleInfo();
|
||||
ai.ID = FIDbAccess.GetFieldString(dr["ID"], string.Empty);
|
||||
ai.Name = FIDbAccess.GetFieldString(dr["APPMODULENAME"], string.Empty);
|
||||
ai.Description = FIDbAccess.GetFieldString(dr["APPMODULEDESC"], string.Empty);
|
||||
ai.Url = FIDbAccess.GetFieldString(dr["URL"], string.Empty);
|
||||
ai.IconPath = FIDbAccess.GetFieldString(dr["ICONPATH"], string.Empty);
|
||||
ai.BackColor = FIDbAccess.GetFieldString(dr["BACKCOLOR"], string.Empty);
|
||||
ai.ForeColor = FIDbAccess.GetFieldString(dr["FORECOLOR"], string.Empty);
|
||||
ai.OpenInNewWindow = FIDbAccess.GetFieldInt(dr["OPENINNEWWINDOW"], 0) == 1;
|
||||
ai.Visible = true;
|
||||
ai.ModuleType = AppModuleType.System;
|
||||
return ai;
|
||||
}
|
||||
|
||||
private static AppModuleInfo[] GetFICWorkspace(UserInfo user)
|
||||
public static AppModuleInfo[] GetFICWorkspace(UserInfo user)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(SystemParams.FICDbConnectionString))
|
||||
{
|
||||
@ -129,7 +103,7 @@ namespace IronIntel.Contractor.Users
|
||||
|
||||
string SQL = @"select w.IID,isnull(l.WorkSpaceName,w.WSPNAME) as WSPNAME,w.WSPDESCRIPTION from WORKSPACE w
|
||||
left join WorkSpaceLanguage l on w.IID=l.WorkspaceIID and l.LanguageCode='en-us'
|
||||
where (ISPUBLIC=1 or ISPUBLIC>10)";
|
||||
where (ISPUBLIC=1 or ISPUBLIC>10) or (ISPUBLIC=0 AND CREATER={0})";
|
||||
|
||||
FISqlConnection db = new FISqlConnection(SystemParams.FICDbConnectionString);
|
||||
if (user.UserType == UserTypes.Readonly)
|
||||
@ -140,7 +114,7 @@ namespace IronIntel.Contractor.Users
|
||||
|
||||
|
||||
|
||||
DataTable tb = db.GetDataTableBySQL(SQL);
|
||||
DataTable tb = db.GetDataTableBySQL(SQL, user.IID);
|
||||
List<AppModuleInfo> ls = new List<AppModuleInfo>();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
|
@ -1,5 +1,11 @@
|
||||
using FI.FIC;
|
||||
using FI.FIC.Contracts.DataObjects.BaseObject;
|
||||
using Foresight.Fleet.Services;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using Foresight.Fleet.Services.JobSite;
|
||||
using Foresight.Fleet.Services.User;
|
||||
using Foresight.Standard;
|
||||
using IronIntel.Contractor.Machines;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -10,21 +16,24 @@ namespace IronIntel.Contractor.Users
|
||||
{
|
||||
public class UserInfo
|
||||
{
|
||||
private static string[] ContactTypeNames = { "Foreman", "Driver", "Inventory Manager", "Rental Manager", "Service Manager", "Fleet Manager", "Technician", "Other" };
|
||||
public string IID { get; set; }
|
||||
public string ID { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
public string TextAddress { get; set; }
|
||||
public string TextAddressDisplayText { get; set; }
|
||||
public bool IsUser { get; set; }
|
||||
public ContactTypes ContactType { get; set; }
|
||||
public string Mobile { get; set; }
|
||||
public string MobilePhoneDisplayText { get; set; }
|
||||
public string BusinessPhone { get; set; }
|
||||
public string BusinessPhoneDisplayText { get; set; }
|
||||
public string Notes { get; set; }
|
||||
public bool Active { get; set; }
|
||||
public UserTypes UserType { get; set; }
|
||||
public string TransPass { get; set; }
|
||||
public string ManagerIID { get; set; }
|
||||
public string ManagerName { get; set; }
|
||||
public bool AssignedWorkOrders { get; set; }
|
||||
public bool EmailOptOut { get; set; }
|
||||
public bool InspectEmailList { get; set; }
|
||||
public bool TeamIntelligenceUser { get; set; }
|
||||
@ -32,17 +41,50 @@ namespace IronIntel.Contractor.Users
|
||||
public decimal HourlyRate { get; set; }
|
||||
public string[] GroupIDs { get; set; }
|
||||
public string[] GroupNames { get; set; }
|
||||
public bool AllowLoginIntoPC { get; set; }
|
||||
public bool AllowLoginIntoInspectMobile { get; set; }
|
||||
public bool AllowLoginIntoFleetMobile { get; set; }
|
||||
public bool AllowMobileBarcodeScanning { get; set; }
|
||||
public string PreferredLanguage { get; set; }
|
||||
public string TimeZone { get; set; }
|
||||
public string LandingPage { get; set; }
|
||||
public string GroupNamesStr { get { return (GroupNames == null || GroupNames.Length == 0) ? "" : string.Join(",", GroupNames); } }
|
||||
|
||||
public string ContactTypeName
|
||||
public long[] AssetIDs { get; set; }
|
||||
public string[] AssetGroupIDs { get; set; }
|
||||
public string[] JobsiteIDs { get; set; }
|
||||
public string[] AssetTypeIDs { get; set; }
|
||||
public int[] LocationIds { get; set; }
|
||||
public int[] DepartmentIds { get; set; }
|
||||
public bool WorkOrderFollower { get; set; }
|
||||
public bool ExcelExports { get; set; }
|
||||
public LoginVerifyTypes LoginVerifyType { get; set; } = LoginVerifyTypes.OrganizationSetting;
|
||||
public UserInfo[] Managers { get; set; }
|
||||
public string ContactTypeName { get; private set; }
|
||||
public void SetContactTypeName(string lang)
|
||||
{
|
||||
get
|
||||
{
|
||||
int cType = (int)ContactType;
|
||||
if (cType > 7)
|
||||
cType = 7;
|
||||
return ContactTypeNames[cType];
|
||||
}
|
||||
string cname = "";
|
||||
int cType = (int)ContactType;
|
||||
if (cType == 0)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_FOREMAN", "Foreman");
|
||||
else if (cType == 1)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_DRIVER", "Driver");
|
||||
else if (cType == 2)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_INVENTORYMANAGER", "Inventory Manager");
|
||||
else if (cType ==3)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_RENTALMANAGER", "Rental Manager");
|
||||
else if (cType == 4)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_SERVICEMANAGER", "Service Manager");
|
||||
else if (cType == 5)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_FLEETMANAGER", "Fleet Manager");
|
||||
else if (cType == 6)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_TECHNICIAN", "Technician");
|
||||
else if (cType == 7)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_ADVISOR", "Advisor");
|
||||
else if (cType > 8)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_OTHER", "Other");
|
||||
|
||||
ContactTypeName = cname;
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,8 +94,12 @@ namespace IronIntel.Contractor.Users
|
||||
public SubscribeMessageByEmail Subscribe { get; set; }
|
||||
public KeyValuePair<int, Foresight.Fleet.Services.User.Permissions[]>[] Features { get; set; }
|
||||
|
||||
public EmailSchedule Schedule { get; set; }
|
||||
public string UserAlertFilter { get; set; }
|
||||
|
||||
public EmailSchedule Schedule { get; set; }
|
||||
public MessageRestrictInfo[] MessageTypes { get; set; }
|
||||
public UserFilterTemplateItem[] FilterTemplates { get; set; }
|
||||
public int[] DeleteFilterTemplates { get; set; }
|
||||
}
|
||||
|
||||
public enum UserTypes
|
||||
@ -72,6 +118,7 @@ namespace IronIntel.Contractor.Users
|
||||
ServiceManager = 4,
|
||||
FleetManager = 5,
|
||||
Technician = 6,
|
||||
Advisor = 7,
|
||||
Other = 100
|
||||
}
|
||||
|
||||
@ -81,4 +128,15 @@ namespace IronIntel.Contractor.Users
|
||||
public string ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
public class UserFilterTemplateItem
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public AssetListItemInfo[] Assets { get; set; }
|
||||
public MachineGroup[] AssetGroups { get; set; }
|
||||
public AssetType[] AssetTypes { get; set; }
|
||||
public JobSiteItem[] Jobsites { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,12 +2,12 @@
|
||||
using FI.FIC.Contracts.DataObjects;
|
||||
using FI.FIC.Contracts.DataObjects.BaseObject;
|
||||
using FI.FIC.Contracts.DataObjects.Enumeration;
|
||||
using FI.FIC.Models;
|
||||
using Foresight.Data;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using Foresight.Fleet.Services.Customer;
|
||||
using Foresight.Fleet.Services.User;
|
||||
using Foresight.ServiceModel;
|
||||
using IronIntel.Services.Customers;
|
||||
using IronIntel.Services.Users;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@ -17,11 +17,18 @@ namespace IronIntel.Contractor.Users
|
||||
{
|
||||
public static class UserManagement
|
||||
{
|
||||
public static UserInfo[] GetUsers(string companyid = null)
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="companyid"></param>
|
||||
/// <param name="filter"></param>
|
||||
/// <param name="lang">ContactTypeName需根据用户语言获取</param>
|
||||
/// <returns></returns>
|
||||
public static UserInfo[] GetUsers(string companyid = null, string filter = null, string lang = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
var users = FleetServiceClientHelper.CreateClient<UserQueryClient>(companyid, string.Empty).GetUsersByCustomerID(companyid, "");
|
||||
var users = FleetServiceClientHelper.CreateClient<UserQueryClient>(companyid, string.Empty).GetUsersByCustomerID(companyid, filter);
|
||||
if (users == null || users.Length == 0)
|
||||
return new UserInfo[0];
|
||||
|
||||
@ -29,22 +36,12 @@ namespace IronIntel.Contractor.Users
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
foreach (var user in users)
|
||||
{
|
||||
UserInfo u = ConvertUserItem(user);
|
||||
UserInfo u = ConvertUserItem(user, lang);
|
||||
if (maps.ContainsKey(u.IID))
|
||||
u.GroupNames = maps[u.IID].ToArray();
|
||||
list.Add(u);
|
||||
}
|
||||
return list.ToArray();
|
||||
|
||||
//const string SQL = @"SELECT USERIID,USERID,USERNAME,USERTYPE,EMAIL,ACTIVE,MOBILE,BUSINESSPHONE,NOTES FROM USERS";
|
||||
//FIDbAccess db = SystemParams.GetDbInstance();
|
||||
//DataTable dt = db.GetDataTableBySQL(SQL);
|
||||
//List<UserInfo> list = new List<UserInfo>();
|
||||
//foreach (DataRow dr in dt.Rows)
|
||||
//{
|
||||
// list.Add(ConvertToUserInfo(dr));
|
||||
//}
|
||||
//return list.ToArray();
|
||||
}
|
||||
|
||||
|
||||
@ -72,7 +69,7 @@ namespace IronIntel.Contractor.Users
|
||||
return result;
|
||||
}
|
||||
|
||||
public static UserInfo[] GetActiveUsers(string sessionid, string companyid = null)
|
||||
public static UserInfo[] GetActiveUsers(string lang, string sessionid, string companyid = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -81,12 +78,60 @@ namespace IronIntel.Contractor.Users
|
||||
foreach (var user in users)
|
||||
{
|
||||
if (user.Active)
|
||||
list.Add(ConvertUserItem(user));
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
private static UserInfo ConvertUserItem(Foresight.Fleet.Services.User.UserInfo user)
|
||||
public static UserInfo[] GetAllFollowers(string lang, string sessionid, string companyid = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
var client = FleetServiceClientHelper.CreateClient<UserQueryClient>(companyid, sessionid);
|
||||
var users = client.GetUsersByCustomerID(companyid, "");
|
||||
var userattrs = client.GetUserAdditionalAttributeByCustomer(companyid);
|
||||
var followers = userattrs.Where(x => x.WorkOrderFollower).Select(x => x.UserIID);
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
foreach (var user in users)
|
||||
{
|
||||
if (user.Active && user.IsUser && followers.Contains(user.UID, StringComparer.OrdinalIgnoreCase))
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static UserInfo[] GetSalespersons(string sessionid, string lang, string companyid = null, string filter = "")
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
var users = FleetServiceClientHelper.CreateClient<UserQueryClient>(companyid, sessionid).GetUsersByCustomerID(companyid, "");
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
foreach (var user in users)
|
||||
{
|
||||
if (user.Active)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(filter))
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
else
|
||||
{
|
||||
if (user.ID.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0
|
||||
|| user.Name.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0
|
||||
|| user.FOB.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="lang">ContactTypeName需根据用户语言获取</param>
|
||||
/// <returns></returns>
|
||||
private static UserInfo ConvertUserItem(Foresight.Fleet.Services.User.UserInfo user, string lang = null)
|
||||
{
|
||||
if (user == null)
|
||||
return null;
|
||||
@ -97,18 +142,33 @@ namespace IronIntel.Contractor.Users
|
||||
u.UserType = (UserTypes)user.UserType;
|
||||
u.Active = user.Active;
|
||||
u.TextAddress = user.TextAddress;
|
||||
u.TextAddressDisplayText = user.TextAddressDisplayText;
|
||||
u.Mobile = user.Mobile;
|
||||
u.MobilePhoneDisplayText = user.MobilePhoneDisplayText;
|
||||
u.BusinessPhone = user.BusinessPhone;
|
||||
u.BusinessPhoneDisplayText = user.BusinessPhoneDisplayText;
|
||||
u.Notes = user.Remark;
|
||||
u.IsUser = user.IsUser;
|
||||
u.ContactType = (ContactTypes)user.ContactType;
|
||||
u.ManagerIID = user.ManagerIID;
|
||||
u.ManagerName = user.ManagerName;
|
||||
u.AssignedWorkOrders = user.AssignedWorkOrders;
|
||||
u.EmailOptOut = user.EmailOptOut;
|
||||
u.InspectEmailList = user.InspectEmailList;
|
||||
u.TeamIntelligenceUser = user.TeamIntelligenceUser;
|
||||
u.FOB = user.FOB;
|
||||
u.HourlyRate = user.HourlyRate;
|
||||
u.AllowLoginIntoPC = user.AllowLoginIntoPC;
|
||||
u.AllowLoginIntoFleetMobile = user.AllowLoginIntoFleetMobile;
|
||||
u.AllowLoginIntoInspectMobile = user.AllowLoginIntoInspectMobile;
|
||||
u.AllowMobileBarcodeScanning = user.AllowMobileBarcodeScanning;
|
||||
u.PreferredLanguage = user.PreferredLanguage;
|
||||
u.LoginVerifyType = user.LoginVerifyType;
|
||||
u.TimeZone = user.TimeZone;
|
||||
if (!string.IsNullOrWhiteSpace(u.ManagerIID))
|
||||
u.Managers = new UserInfo[] { new UserInfo() { IID = u.ManagerIID, DisplayName = u.ManagerName } };
|
||||
|
||||
u.SetContactTypeName(string.IsNullOrWhiteSpace(lang) ? "en" : lang);
|
||||
return u;
|
||||
}
|
||||
|
||||
@ -130,23 +190,32 @@ namespace IronIntel.Contractor.Users
|
||||
u.IsUser = user.IsUser;
|
||||
u.ContactType = (Foresight.Fleet.Services.User.ContactTypes)user.ContactType;
|
||||
u.ManagerIID = user.ManagerIID;
|
||||
u.AssignedWorkOrders = user.AssignedWorkOrders;
|
||||
u.EmailOptOut = user.EmailOptOut;
|
||||
u.InspectEmailList = user.InspectEmailList;
|
||||
u.TeamIntelligenceUser = user.TeamIntelligenceUser;
|
||||
u.FOB = user.FOB;
|
||||
u.HourlyRate = user.HourlyRate;
|
||||
u.AllowLoginIntoPC = user.AllowLoginIntoPC;
|
||||
u.AllowLoginIntoFleetMobile = user.AllowLoginIntoFleetMobile;
|
||||
u.AllowLoginIntoInspectMobile = user.AllowLoginIntoInspectMobile;
|
||||
u.AllowMobileBarcodeScanning = user.AllowMobileBarcodeScanning;
|
||||
u.PreferredLanguage = user.PreferredLanguage;
|
||||
u.LoginVerifyType = user.LoginVerifyType;
|
||||
u.TimeZone = user.TimeZone;
|
||||
return u;
|
||||
}
|
||||
|
||||
public static UserInfo[] GetUnmanagementUsers()
|
||||
public static UserInfo[] GetUnmanagementUsers(string lang)
|
||||
{
|
||||
const string SQL = @"SELECT USERIID,USERID,USERNAME,USERTYPE,EMAIL,ACTIVE,MOBILE,BUSINESSPHONE,NOTES FROM USERS where isnull(ISUSER,0)=1 and (USERTYPE=0 or USERTYPE=1)";
|
||||
FIDbAccess db = SystemParams.GetDbInstance();
|
||||
DataTable dt = db.GetDataTableBySQL(SQL);
|
||||
var users = FleetServiceClientHelper.CreateClient<UserQueryClient>(SystemParams.CompanyID).GetUsersByCustomerID(SystemParams.CompanyID, "");
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
foreach (var user in users)
|
||||
{
|
||||
list.Add(ConvertToUserInfo(dr));
|
||||
if (user.IsUser && user.UserType < Foresight.Fleet.Services.User.UserTypes.Admin)
|
||||
{
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
@ -167,12 +236,6 @@ namespace IronIntel.Contractor.Users
|
||||
{
|
||||
var dealerusers = GetUsers(dealer.ID);
|
||||
ls.AddRange(dealerusers);
|
||||
//LoginProvider lp = SystemParams.GetLoginProvider();
|
||||
//UserInfoEx[] dealerusers = lp.GetAllUsersByCustomerID(dealer.ID);
|
||||
//foreach (UserInfoEx u in dealerusers)
|
||||
//{
|
||||
// ls.Add(ConvertToServiceUserInfo(u));
|
||||
//}
|
||||
}
|
||||
}
|
||||
return ls.ToArray();
|
||||
@ -187,30 +250,6 @@ namespace IronIntel.Contractor.Users
|
||||
list.Add(ConvertUserItem(user));
|
||||
}
|
||||
return list.ToArray();
|
||||
|
||||
//LoginProvider lp = SystemParams.GetLoginProvider();
|
||||
//UserInfoEx[] susers = lp.GetAllUsersByCustomerID("Foresight");
|
||||
|
||||
//List<UserInfo> list = new List<UserInfo>();
|
||||
//foreach (UserInfoEx u in susers)
|
||||
//{
|
||||
// UserInfo user = ConvertToServiceUserInfo(u);
|
||||
// list.Add(user);
|
||||
//}
|
||||
//return list.ToArray();
|
||||
}
|
||||
|
||||
private static UserInfo ConvertToServiceUserInfo(UserInfoEx suer)
|
||||
{
|
||||
UserInfo user = new UserInfo();
|
||||
user.IID = suer.UID;
|
||||
user.ID = suer.ID;
|
||||
user.DisplayName = suer.Name;
|
||||
user.Mobile = suer.Mobile;
|
||||
user.BusinessPhone = suer.BusinessPhone;
|
||||
user.Active = suer.Active;
|
||||
user.UserType = (UserTypes)3;
|
||||
return user;
|
||||
}
|
||||
|
||||
private static UserInfo ConvertToUserInfo(DataRow dr)
|
||||
@ -228,21 +267,6 @@ namespace IronIntel.Contractor.Users
|
||||
return ui;
|
||||
}
|
||||
|
||||
private static UserInfo GetLocalUserInfo(string sessionid, string iid)
|
||||
{
|
||||
var user = FleetServiceClientHelper.CreateClient<UserQueryClient>(sessionid).GetUserByIID(iid);
|
||||
return ConvertUserItem(user);
|
||||
//const string SQL = "select * from USERS where USERIID={0}";
|
||||
|
||||
//FIDbAccess db = SystemParams.GetDbInstance();
|
||||
//DataTable dt = db.GetDataTableBySQL(SQL, iid);
|
||||
//if (dt.Rows.Count == 0)
|
||||
//{
|
||||
// return null;
|
||||
//}
|
||||
//return ConvertToUserInfo(dt.Rows[0]);
|
||||
}
|
||||
|
||||
public static UserInfo GetUserBySessionID(string sessionid)
|
||||
{
|
||||
var ls = FleetServiceClientHelper.CreateClient<UserQueryClient>(sessionid).GetLoginSession(sessionid);
|
||||
@ -258,78 +282,28 @@ namespace IronIntel.Contractor.Users
|
||||
ui.DisplayName = ls.User.Name;
|
||||
ui.Active = true;
|
||||
ui.UserType = UserTypes.SupperAdmin;
|
||||
ui.TimeZone = ls.User.TimeZone;
|
||||
return ui;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ConvertUserItem(ls.User);
|
||||
}
|
||||
|
||||
//LoginProvider lp = SystemParams.GetLoginProvider();
|
||||
//LoginSession ls = lp.GetLoginSession(sessionid);
|
||||
|
||||
//if (ls == null)
|
||||
//{
|
||||
// return null;
|
||||
//}
|
||||
//if (ls.User.IsForesightUser)
|
||||
//{
|
||||
// UserInfo ui = new UserInfo();
|
||||
// ui.IID = ls.User.UID;
|
||||
// ui.ID = ls.User.ID;
|
||||
// ui.DisplayName = ls.User.Name;
|
||||
// ui.Active = true;
|
||||
// ui.UserType = UserTypes.SupperAdmin;
|
||||
// return ui;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// return GetLocalUserInfo(ls.User.UID);
|
||||
//}
|
||||
}
|
||||
|
||||
public static UserInfo GetUserByIID(string iid)
|
||||
{
|
||||
var user = FleetServiceClientHelper.CreateClient<UserQueryClient>().GetUserByIID(iid);
|
||||
return ConvertUserItem(user);
|
||||
|
||||
//LoginProvider lp = SystemParams.GetLoginProvider();
|
||||
//UserInfoEx ui1 = lp.GetUserInfoEx(iid);
|
||||
//if (ui1 == null)
|
||||
//{
|
||||
// return null;
|
||||
//}
|
||||
|
||||
//if (ui1.IsForesightUser)
|
||||
//{
|
||||
// UserInfo ui = new UserInfo();
|
||||
// ui.IID = ui1.UID;
|
||||
// ui.ID = ui1.ID;
|
||||
// ui.DisplayName = ui1.Name;
|
||||
// ui.Active = true;
|
||||
// ui.UserType = UserTypes.SupperAdmin;
|
||||
// return ui;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// return GetLocalUserInfo(iid);
|
||||
//}
|
||||
}
|
||||
|
||||
public static UserInfo GetUserByID(string userid)
|
||||
{
|
||||
var user = FleetServiceClientHelper.CreateClient<UserQueryClient>().GetUserByUserID(userid);
|
||||
return ConvertUserItem(user);
|
||||
//LoginProvider lp = SystemParams.GetLoginProvider();
|
||||
//UserInfoEx ui1 = lp.GetUserInfoExByUserID(userid);
|
||||
//if (ui1 == null)
|
||||
//{
|
||||
// return null;
|
||||
//}
|
||||
//return GetUserByIID(ui1.UID);
|
||||
}
|
||||
|
||||
public static string AddUser(UserInfo ui, string password, string addby, string sessionid, string clienthost)
|
||||
public static string AddUser(UserInfo ui, string password, string addby, string sessionid, string clienthost, byte[] avadarBytes)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -340,6 +314,12 @@ namespace IronIntel.Contractor.Users
|
||||
client.SessionID = sessionid;
|
||||
client.ClientHost = clienthost;
|
||||
user = client.AddNewUser(user, password, addby);
|
||||
if (avadarBytes != null)
|
||||
{
|
||||
avadarBytes = Helper.GetThumbImg(avadarBytes, 300, 300);
|
||||
client.SetUserAvatar(user.UID, avadarBytes);
|
||||
}
|
||||
|
||||
return user.UID;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -347,47 +327,10 @@ namespace IronIntel.Contractor.Users
|
||||
SystemParams.WriteLog("Error", typeof(UserManagement).FullName + ".AddUser", "Add new user failed: " + ui.ID, ex.ToString());
|
||||
throw;
|
||||
}
|
||||
|
||||
//const string SQL = @"insert into USERS(USERIID,USERID,USERNAME,USERTYPE,EMAIL,ACTIVE,MOBILE,BUSINESSPHONE,NOTES) values({0},{1},{2},{3},{4},{5},{6},{7},{8})";
|
||||
//try
|
||||
//{
|
||||
// LoginProvider lp = SystemParams.GetLoginProvider();
|
||||
// FIDbAccess db = SystemParams.GetDbInstance();
|
||||
// UserInfoEx user = ConvertUserInfoTOUserInfoEx(ui);
|
||||
// if (!string.IsNullOrWhiteSpace(password))
|
||||
// {
|
||||
// ui.IID = lp.RegisterUser(user, password);
|
||||
// db.ExecSQL(SQL, ui.IID, ui.ID, ui.DisplayName, (int)ui.UserType, ui.ID, ui.Active ? 1 : 0, ui.Mobile, ui.BusinessPhone, ui.Notes);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ui.IID = lp.RegisterUser(user, Guid.NewGuid().ToString());
|
||||
// db.ExecSQL(SQL, ui.IID, ui.ID, ui.DisplayName, (int)ui.UserType, ui.ID, ui.Active ? 1 : 0, ui.Mobile, ui.BusinessPhone, ui.Notes);
|
||||
// lp.ForgotPassword(ui.ID);
|
||||
// }
|
||||
// return ui.IID;
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// SystemParams.WriteLog("Error", typeof(UserManagement).FullName + ".AddUserInfo", "Add new user failed: " + ui.ID, ex.ToString());
|
||||
// throw;
|
||||
//}
|
||||
}
|
||||
|
||||
private static UserInfoEx ConvertUserInfoTOUserInfoEx(UserInfo ui)
|
||||
{
|
||||
UserInfoEx user = new UserInfoEx();
|
||||
user.UID = ui.IID;
|
||||
user.ID = ui.ID;
|
||||
user.Name = ui.DisplayName;
|
||||
user.Mobile = ui.Mobile;
|
||||
user.BusinessPhone = ui.BusinessPhone;
|
||||
user.Active = ui.Active;
|
||||
user.CompanyID = SystemParams.CompanyID;
|
||||
return user;
|
||||
}
|
||||
|
||||
public static void UpdateUserInfo(UserInfo ui, string updatedby, string sessionid, string clienthost)
|
||||
public static void UpdateUserInfo(UserInfo ui, string updatedby, string sessionid, string clienthost, byte[] avadarBytes)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -398,28 +341,30 @@ namespace IronIntel.Contractor.Users
|
||||
client.SessionID = sessionid;
|
||||
client.ClientHost = clienthost;
|
||||
client.UpdateUser(user, updatedby);
|
||||
if (avadarBytes != null)
|
||||
{
|
||||
avadarBytes = Helper.GetThumbImg(avadarBytes, 300, 300);
|
||||
client.SetUserAvatar(user.UID, avadarBytes);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemParams.WriteLog("Error", typeof(UserManagement).FullName + ".UpdateUserInfo", "Update user failed: " + ui.IID, ex.ToString());
|
||||
throw;
|
||||
}
|
||||
|
||||
|
||||
//const string SQL = @" update USERS set USERNAME={0},MOBILE={1},BUSINESSPHONE={2},ACTIVE={3},USERTYPE={4},NOTES={5} where USERIID={6}";
|
||||
//try
|
||||
//{
|
||||
// LoginProvider lp = SystemParams.GetLoginProvider();
|
||||
// UserInfoEx user = ConvertUserInfoTOUserInfoEx(ui);
|
||||
// lp.UpdateUser(user);
|
||||
// FIDbAccess db = SystemParams.GetDbInstance();
|
||||
// db.ExecSQL(SQL, ui.DisplayName, ui.Mobile, ui.BusinessPhone, ui.Active ? 1 : 0, ui.UserType, ui.Notes, ui.IID);
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// SystemParams.WriteLog("Error", typeof(UserManagement).FullName + ".UpdateUserInfo", "Update user failed: " + ui.IID, ex.ToString());
|
||||
// throw;
|
||||
//}
|
||||
}
|
||||
public static void SetUserAvatar(string sessionid, string uid, byte[] avadarBytes)
|
||||
{
|
||||
try
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<UserQueryClient>(sessionid);
|
||||
client.SetUserAvatar(uid, avadarBytes);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemParams.WriteLog("Error", typeof(UserManagement).FullName + ".SetUserAvatar", "Set user Avatar failed: " + uid, ex.ToString());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ResetPassword(string useriid, string password, string resetby, string sessionid, string clienthost)
|
||||
@ -428,20 +373,6 @@ namespace IronIntel.Contractor.Users
|
||||
client.SessionID = sessionid;
|
||||
client.ClientHost = clienthost;
|
||||
client.ResetPassword(useriid, password, true, resetby);
|
||||
|
||||
//const string SQL = "select USERID from USERS where USERIID={0}";
|
||||
//FIDbAccess db = SystemParams.GetDbInstance();
|
||||
//string userid = db.GetRC1BySQL(SQL, useriid).ToString();
|
||||
//try
|
||||
//{
|
||||
// LoginProvider lp = SystemParams.GetLoginProvider();
|
||||
// lp.ForgotPassword(userid);
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// SystemParams.WriteLog("Error", typeof(UserManagement).FullName + ".ResetPassword", "Reset Password failed: " + useriid, ex.ToString());
|
||||
// throw;
|
||||
//}
|
||||
}
|
||||
|
||||
public static bool CanDeleteUser(string useriid)
|
||||
@ -450,6 +381,13 @@ namespace IronIntel.Contractor.Users
|
||||
return true;
|
||||
}
|
||||
|
||||
public static byte[] GetUserAvatar(string sessionid, string useriid)
|
||||
{
|
||||
|
||||
var client = FleetServiceClientHelper.CreateClient<UserQueryClient>(sessionid);
|
||||
return client.GetUserAvatar(useriid);
|
||||
}
|
||||
|
||||
|
||||
#region user group
|
||||
|
||||
@ -509,26 +447,6 @@ namespace IronIntel.Contractor.Users
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void SaveUserGroups(string userIID, string[] groupids)
|
||||
{
|
||||
if (groupids == null) return;//groupids为null表示前端group没有加载,不修改用户的Group.
|
||||
const string SQL_map = "insert into USERGROUPMAP(GROUPID,USERIID) values({0},{1})";
|
||||
const string SQL_del = "delete from USERGROUPMAP where USERIID={0}";
|
||||
|
||||
using (FISqlTransaction tran = new FISqlTransaction(SystemParams.DataDbConnectionString))
|
||||
{
|
||||
tran.ExecSQL(SQL_del, userIID);
|
||||
if (groupids.Length > 0)
|
||||
{
|
||||
foreach (string id in groupids)
|
||||
{
|
||||
tran.ExecSQL(SQL_map, id, userIID);
|
||||
}
|
||||
}
|
||||
tran.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddGroup(UserGroupInfo gi)
|
||||
{
|
||||
const string SQL_group = "insert into USERGROUPS(GROUPID,GROUPNAME,NOTES) values({0},{1},{2})";
|
||||
@ -549,7 +467,6 @@ namespace IronIntel.Contractor.Users
|
||||
}
|
||||
tran.Commit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void UpdateGroup(UserGroupInfo gi)
|
||||
@ -637,51 +554,9 @@ namespace IronIntel.Contractor.Users
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region User Machines/Jobsite
|
||||
#region User Machines/Jobsite/MachineType/Department/Location
|
||||
|
||||
public static void SaveUserMachines(string uid, string[] machineids)
|
||||
{
|
||||
const string SQL_D = "delete USERMACHINEMAP where USERIID={0}";
|
||||
const string SQL = @"insert into USERMACHINEMAP(USERIID,MACHINEID) values ({0},{1})";
|
||||
|
||||
FIDbAccess db = SystemParams.GetDbInstance();
|
||||
db.ExecSQL(SQL_D, uid);
|
||||
|
||||
foreach (var mid in machineids)
|
||||
{
|
||||
db.ExecSQL(SQL, uid, mid);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveUserJobsites(string uid, string[] jobsiteids)
|
||||
{
|
||||
const string SQL_D = "delete USERJOBSITEMAP where USERIID={0}";
|
||||
const string SQL = @"insert into USERJOBSITEMAP(USERIID,JOBSITEID) values ({0},{1})";
|
||||
|
||||
FIDbAccess db = SystemParams.GetDbInstance();
|
||||
db.ExecSQL(SQL_D, uid);
|
||||
|
||||
foreach (var jsid in jobsiteids)
|
||||
{
|
||||
db.ExecSQL(SQL, uid, jsid);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveMachineUsers(string machineid, string[] uids, FISqlConnection db = null)
|
||||
{
|
||||
const string SQL_D = "delete USERMACHINEMAP where MACHINEID={0}";
|
||||
const string SQL = @"insert into USERMACHINEMAP(USERIID,MACHINEID) values ({0},{1})";
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
db.ExecSQL(SQL_D, machineid);
|
||||
|
||||
foreach (var uid in uids)
|
||||
{
|
||||
db.ExecSQL(SQL, uid, machineid);
|
||||
}
|
||||
}
|
||||
|
||||
public static UserInfo[] GetUsersByAssetID(string sessionid, long assetid, string companyid)
|
||||
public static UserInfo[] GetUsersByAssetID(string sessionid, long assetid, string companyid, string lang)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -689,7 +564,66 @@ namespace IronIntel.Contractor.Users
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
foreach (var user in users)
|
||||
{
|
||||
list.Add(ConvertUserItem(user));
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static UserInfo[] GetWorkOrderAssignToUsers(string sessionid, string companyid, long assetid, int locid, int depid, string lang)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
var users = FleetServiceClientHelper.CreateClient<AssetQueryClient>(companyid, sessionid).GetUsersAvailableForAsset(companyid, assetid);
|
||||
var cusers = FleetServiceClientHelper.CreateClient<AssetDataAdjustClient>(companyid, sessionid).GetAssetContacts(companyid, assetid);
|
||||
|
||||
List<Foresight.Fleet.Services.User.UserInfo> allusers = new List<Foresight.Fleet.Services.User.UserInfo>();
|
||||
if (users != null && users.Length > 0)
|
||||
allusers.AddRange(users);
|
||||
if (cusers != null && cusers.Length > 0)
|
||||
allusers.AddRange(cusers);
|
||||
|
||||
string[] depandlocusers = null;
|
||||
if (locid > 0 || depid > 0)
|
||||
depandlocusers = FleetServiceClientHelper.CreateClient<UserProfileProvider>(companyid, sessionid).GetUsersByLocAndDep(companyid, locid, depid);
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
List<string> uids = new List<string>();
|
||||
foreach (var user in allusers)
|
||||
{
|
||||
if (uids.Contains(user.UID))
|
||||
continue;
|
||||
|
||||
if (!user.AssignedWorkOrders && user.ContactType != Foresight.Fleet.Services.User.ContactTypes.Advisor) continue;
|
||||
if (depandlocusers == null || depandlocusers.Contains(user.UID, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
uids.Add(user.UID);
|
||||
}
|
||||
}
|
||||
return list.OrderBy(u => u.DisplayName).ToArray();
|
||||
}
|
||||
|
||||
public static UserInfo[] GetUsersByAssets(string sessionid, long[] assetids, string companyid, string lang)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
var users = FleetServiceClientHelper.CreateClient<AssetQueryClient>(companyid, sessionid).GetUsersAvailableForAssets(companyid, assetids);
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
foreach (var user in users)
|
||||
{
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static UserInfo[] GetUsersByJobsiteID(string sessionid, string lang, long jsid, string companyid)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
var users = FleetServiceClientHelper.CreateClient<AssetQueryClient>(companyid, sessionid).GetUsersAvailableForJobsite(companyid, jsid);
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
foreach (var user in users)
|
||||
{
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
@ -858,11 +792,11 @@ namespace IronIntel.Contractor.Users
|
||||
|
||||
return list;
|
||||
}
|
||||
internal static UserInfoItem[] GetPermissionUsers()
|
||||
internal static UserInfoItem[] GetPermissionUsers1()
|
||||
{
|
||||
List<UserInfoItem> users = new List<UserInfoItem>();
|
||||
|
||||
DataTable authenDt = SystemParams.GetDbInstance().GetDataTableBySQL("SELECT * FROM Users");
|
||||
DataTable authenDt = SystemParams.GetDbInstance().GetDataTableBySQL("select * from Users where isnull(DELETED,0)=0");
|
||||
|
||||
string str = "";
|
||||
for (int i = authenDt.Rows.Count - 1; i >= 0; i--)
|
||||
@ -884,7 +818,30 @@ namespace IronIntel.Contractor.Users
|
||||
return users.ToArray();
|
||||
}
|
||||
|
||||
internal static UserPermissionData[] GetUserOrGroupPermission(string UserOrGroup, string objIID, string userIID)
|
||||
internal static UserInfoItem[] GetPermissionUsers()
|
||||
{
|
||||
List<UserInfoItem> ls = new List<UserInfoItem>();
|
||||
|
||||
var users = FleetServiceClientHelper.CreateClient<UserQueryClient>(SystemParams.CompanyID, string.Empty).GetUsersByCustomerID(SystemParams.CompanyID, "");
|
||||
if (users == null || users.Length == 0)
|
||||
return new UserInfoItem[0];
|
||||
|
||||
foreach (var u in users)
|
||||
{
|
||||
if (string.Compare(u.ID, "admin", true) == 0 || (int)u.UserType != 1) //EMUserType.Common
|
||||
continue;
|
||||
|
||||
UserInfoItem user = new UserInfoItem();
|
||||
user.IID = u.UID;
|
||||
user.ID = u.ID;
|
||||
user.DisplayName = u.Name;
|
||||
ls.Add(user);
|
||||
}
|
||||
|
||||
return ls.ToArray();
|
||||
}
|
||||
|
||||
internal static UserPermissionData[] GetUserOrGroupPermission(string UserOrGroup, string objIID, string userIID, string lang)
|
||||
{
|
||||
List<UserPermissionData> UserOrGroupPermissionDatas = new List<UserPermissionData>();
|
||||
|
||||
@ -904,8 +861,8 @@ namespace IronIntel.Contractor.Users
|
||||
UserPermissionData upmd = new UserPermissionData();
|
||||
upmd.FunctionIID = opr.IID;
|
||||
upmd.IsAllowed = false;
|
||||
upmd.ManagementFunction = ResManager.GetLanguage(ResManager.GetResourceString(opr.FunctionName));
|
||||
upmd.Description = ResManager.GetLanguage(ResManager.GetResourceString(opr.Description));
|
||||
upmd.ManagementFunction = ResManager.GetLanguage(lang, ResManager.GetResourceString(opr.FunctionName));
|
||||
upmd.Description = ResManager.GetLanguage(lang, ResManager.GetResourceString(opr.Description));
|
||||
upmd.IsNotPermissionInGroup = true;
|
||||
|
||||
UserOrGroupPermissionDatas.Add(upmd);
|
||||
|
@ -14,6 +14,7 @@ namespace IronIntel.Contractor.Users
|
||||
public static class UserParams
|
||||
{
|
||||
private const string _AutoRecenterMap = "AutoRecenterMap";
|
||||
private const string _ShowJSTooltip = "ShowJSTooltip";
|
||||
private const string _BaseMap = "BaseMap";
|
||||
private const string _MapViewContratorID = "MapViewContratorID";
|
||||
private const string _MapAlertLayer = "MapAlertLayer";
|
||||
@ -26,9 +27,12 @@ namespace IronIntel.Contractor.Users
|
||||
private const string _UnShownJobsites = "UnShownJobsites";
|
||||
private const string _UnShownJobsiteMachines = "UnShownJobsiteMachines";
|
||||
private const string _Onroad = "Onroad";
|
||||
private const string _Attachment = "Attachment";
|
||||
private const string _ExcludeNoLocation = "ExcludeNoLocation";
|
||||
|
||||
private const string _MapViewSearches = "MapViewSearches";
|
||||
private const string _LandingPage = "LandingPage";
|
||||
private const string _BreadcrumbLocationSource = "BreadcrumbLocationSource";
|
||||
|
||||
public static UserParamInfo GetUserParams(string sessionid, string useriid)
|
||||
{
|
||||
@ -46,6 +50,9 @@ namespace IronIntel.Contractor.Users
|
||||
case _AutoRecenterMap:
|
||||
userParams.AutoRecenterMap = Helper.IsTrue(value);
|
||||
break;
|
||||
case _ShowJSTooltip:
|
||||
userParams.ShowJSTooltip = Helper.IsTrue(value);
|
||||
break;
|
||||
case _BaseMap:
|
||||
userParams.BaseMap = value;
|
||||
break;
|
||||
@ -79,9 +86,18 @@ namespace IronIntel.Contractor.Users
|
||||
case _Onroad:
|
||||
userParams.Onroad = int.Parse(value);
|
||||
break;
|
||||
case _Attachment:
|
||||
userParams.Attachment = int.Parse(value);
|
||||
break;
|
||||
case _ExcludeNoLocation:
|
||||
userParams.ExcludeNoLocation = int.Parse(value) == 1;
|
||||
break;
|
||||
case _LandingPage:
|
||||
userParams.LandingPage = value;
|
||||
break;
|
||||
case _BreadcrumbLocationSource:
|
||||
userParams.BreadcrumbLocationSource = int.Parse(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
userParams.MapViewSearches = GetMapViewSearches(sessionid, useriid);
|
||||
@ -98,6 +114,21 @@ namespace IronIntel.Contractor.Users
|
||||
else
|
||||
userParams.MapRefreshInterval = 60;
|
||||
userParams.MachineIconURL = SystemParams.MachineTypeMapViewIconUrl;
|
||||
userParams.MachineMovingIconURL = SystemParams.MachineMovingIconUrl;
|
||||
|
||||
var uc = FleetServiceClientHelper.CreateClient<UserQueryClient>();
|
||||
userParams.PreferredLanguage = uc.GetUserPreferredLanguageByIID(useriid);
|
||||
userParams.TimeZone = uc.GetUserTimeZoneByIID(useriid);
|
||||
if (userParams.BreadcrumbLocationSource < 0)//用户参数未设置,取系统参数
|
||||
{
|
||||
string locsourcestr = SystemParams.GetStringParam(_BreadcrumbLocationSource);
|
||||
int locsource = 0;
|
||||
int.TryParse(locsourcestr, out locsource);
|
||||
userParams.BreadcrumbLocationSource = locsource;
|
||||
}
|
||||
if (userParams.BreadcrumbLocationSource < 0)
|
||||
userParams.BreadcrumbLocationSource = 0;
|
||||
|
||||
return userParams;
|
||||
}
|
||||
|
||||
@ -110,6 +141,7 @@ namespace IronIntel.Contractor.Users
|
||||
|
||||
FIDbAccess db = SystemParams.GetDbInstance();
|
||||
db.ExecSQL(SQL, useriid, _AutoRecenterMap, userParams.AutoRecenterMap ? "true" : "false");
|
||||
db.ExecSQL(SQL, useriid, _ShowJSTooltip, userParams.ShowJSTooltip ? "true" : "false");
|
||||
|
||||
if (!string.IsNullOrEmpty(userParams.BaseMap))
|
||||
db.ExecSQL(SQL, useriid, _BaseMap, userParams.BaseMap);
|
||||
@ -166,8 +198,22 @@ namespace IronIntel.Contractor.Users
|
||||
else
|
||||
db.ExecSQL(SQL_Delete, useriid, _Onroad);
|
||||
|
||||
if (userParams.ExcludeNoLocation)
|
||||
db.ExecSQL(SQL, useriid, _ExcludeNoLocation, userParams.ExcludeNoLocation ? 1 : 0);
|
||||
if (userParams.Attachment >= 0)
|
||||
db.ExecSQL(SQL, useriid, _Attachment, userParams.Attachment);
|
||||
else
|
||||
db.ExecSQL(SQL_Delete, useriid, _Attachment);
|
||||
|
||||
db.ExecSQL(SQL, useriid, _ExcludeNoLocation, userParams.ExcludeNoLocation ? 1 : 0);
|
||||
|
||||
if (!string.IsNullOrEmpty(userParams.LandingPage))
|
||||
db.ExecSQL(SQL, useriid, _LandingPage, userParams.LandingPage);
|
||||
else
|
||||
db.ExecSQL(SQL_Delete, useriid, _LandingPage);
|
||||
|
||||
if (userParams.BreadcrumbLocationSource >= 0)
|
||||
db.ExecSQL(SQL, useriid, _BreadcrumbLocationSource, userParams.BreadcrumbLocationSource);
|
||||
else
|
||||
db.ExecSQL(SQL_Delete, useriid, _BreadcrumbLocationSource);
|
||||
}
|
||||
|
||||
public static string GetStringParameter(string useriid, string paramname)
|
||||
@ -223,7 +269,7 @@ namespace IronIntel.Contractor.Users
|
||||
}
|
||||
}
|
||||
|
||||
public static MapViewSearchItem[] SaveMapViewSearch(string sessionid, string useriid, MapViewSearchItem search)
|
||||
public static MapViewSearchItem[] SaveMapViewSearch(string sessionid, string useriid, MapViewSearchItem search, string lang)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<UserProfileProvider>(sessionid);
|
||||
string xmlstr = client.GetUserParams(SystemParams.CompanyID, useriid, _MapViewSearches);
|
||||
@ -241,8 +287,7 @@ namespace IronIntel.Contractor.Users
|
||||
}
|
||||
}
|
||||
searches.Add(search);
|
||||
|
||||
client.SetUserParam(SystemParams.CompanyID, useriid, _MapViewSearches, MapViewSearcheHelper.ToXml(searches).InnerXml);
|
||||
client.SetUserParam(SystemParams.CompanyID, useriid, _MapViewSearches, MapViewSearcheHelper.ToXml(searches, lang).InnerXml);
|
||||
return searches.OrderByDescending(s => s.IsDefault).ThenBy(s => s.Name).ToArray();
|
||||
}
|
||||
|
||||
@ -269,7 +314,7 @@ namespace IronIntel.Contractor.Users
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
public static MapViewSearchItem[] DeleteMapViewSearch(string sessionid, string useriid, string searchName)
|
||||
public static MapViewSearchItem[] DeleteMapViewSearch(string sessionid, string useriid, string searchName, string lang)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<UserProfileProvider>(sessionid);
|
||||
string xmlstr = client.GetUserParams(SystemParams.CompanyID, useriid, _MapViewSearches);
|
||||
@ -278,7 +323,7 @@ namespace IronIntel.Contractor.Users
|
||||
if (item != null)// remove it
|
||||
searches.Remove(item);
|
||||
|
||||
client.SetUserParam(SystemParams.CompanyID, useriid, _MapViewSearches, MapViewSearcheHelper.ToXml(searches).InnerXml);
|
||||
client.SetUserParam(SystemParams.CompanyID, useriid, _MapViewSearches, MapViewSearcheHelper.ToXml(searches, lang).InnerXml);
|
||||
return searches.OrderByDescending(s => s.IsDefault).ThenBy(s => s.Name).ToArray();
|
||||
}
|
||||
|
||||
@ -295,12 +340,14 @@ namespace IronIntel.Contractor.Users
|
||||
public class UserParamInfo
|
||||
{
|
||||
public bool AutoRecenterMap { get; set; } = false;
|
||||
public bool ShowJSTooltip { get; set; } = false;
|
||||
public string BaseMap { get; set; }
|
||||
public string MapViewContratorID { get; set; }
|
||||
public string MapAlertLayer { get; set; }
|
||||
public string SystemStyleID { get; set; }
|
||||
public int MapRefreshInterval { get; set; }
|
||||
public string MachineIconURL { get; set; }
|
||||
public string MachineMovingIconURL { get; set; }
|
||||
public string AssetDefaultSearch { get; set; }
|
||||
public string JobSiteDefaultSearch { get; set; }
|
||||
public string AssetGroupDefaultSearch { get; set; }
|
||||
@ -308,9 +355,14 @@ namespace IronIntel.Contractor.Users
|
||||
public string[] UnShownJobsites { get; set; }
|
||||
public string[] UnShownJobsiteMachines { get; set; }
|
||||
public int Onroad { get; set; } = -1;
|
||||
public int Attachment { get; set; } = 0;
|
||||
public bool ExcludeNoLocation { get; set; } = true;
|
||||
|
||||
public MapViewSearchItem[] MapViewSearches { get; set; }
|
||||
public string LandingPage { get; set; }
|
||||
public string PreferredLanguage { get; set; }
|
||||
public string TimeZone { get; set; }
|
||||
public int BreadcrumbLocationSource { get; set; } = -1;
|
||||
}
|
||||
|
||||
public class MapViewSearcheHelper
|
||||
@ -345,6 +397,8 @@ namespace IronIntel.Contractor.Users
|
||||
item.IsDefault = Helper.IsTrue(ch.InnerText);
|
||||
else if (string.Compare(ch.Name, "Onroad", true) == 0)
|
||||
item.Onroad = Convert.ToInt32(ch.InnerText);
|
||||
else if (string.Compare(ch.Name, "Attachment", true) == 0)
|
||||
item.Attachment = Convert.ToInt32(ch.InnerText);
|
||||
else if (string.Compare(ch.Name, "AssetDefaultSearch", true) == 0)
|
||||
item.AssetDefaultSearch = ch.InnerText;
|
||||
else if (string.Compare(ch.Name, "JobSiteDefaultSearch", true) == 0)
|
||||
@ -363,7 +417,7 @@ namespace IronIntel.Contractor.Users
|
||||
}
|
||||
return item;
|
||||
}
|
||||
public static XmlDocument ToXml(List<MapViewSearchItem> searches)
|
||||
public static XmlDocument ToXml(List<MapViewSearchItem> searches, string lang)
|
||||
{
|
||||
XmlDocument doc = XmlHelper.CreateXmlDocument();
|
||||
XmlNode node = XmlHelper.AppendChildNode(doc.DocumentElement, "Searches", "");
|
||||
@ -374,7 +428,7 @@ namespace IronIntel.Contractor.Users
|
||||
var sn = AddSubNode(node, "Search", "");
|
||||
|
||||
AddSubNode(sn, "Name", search.Name);
|
||||
AddSubNode(sn, "IsDefault", search.IsDefault ? "Yes" : "No");
|
||||
AddSubNode(sn, "IsDefault", search.IsDefault ? SystemParams.GetTextByKey(lang, "P_UTILITY_YES", "Yes") : SystemParams.GetTextByKey(lang, "P_UTILITY_NO", "No"));
|
||||
if (!string.IsNullOrEmpty(search.AssetDefaultSearch))
|
||||
AddSubNode(sn, "AssetDefaultSearch", search.AssetDefaultSearch);
|
||||
if (!string.IsNullOrEmpty(search.JobSiteDefaultSearch))
|
||||
@ -382,6 +436,7 @@ namespace IronIntel.Contractor.Users
|
||||
if (!string.IsNullOrEmpty(search.AssetGroupDefaultSearch))
|
||||
AddSubNode(sn, "AssetGroupDefaultSearch", search.AssetGroupDefaultSearch);
|
||||
AddSubNode(sn, "Onroad", search.Onroad.ToString());
|
||||
AddSubNode(sn, "Attachment", search.Attachment.ToString());
|
||||
AddSubNode(sn, "ExcludeNoLocation", search.ExcludeNoLocation ? "1" : "0");
|
||||
if (search.UnShownMachines != null && search.UnShownMachines.Length > 0)
|
||||
AddSubNode(sn, "UnShownMachines", string.Join(",", search.UnShownMachines));
|
||||
@ -412,6 +467,7 @@ namespace IronIntel.Contractor.Users
|
||||
public bool IsDefault { get; set; }
|
||||
|
||||
public int Onroad { get; set; } = -1;
|
||||
public int Attachment { get; set; } = 0;
|
||||
public string AssetDefaultSearch { get; set; } = "";
|
||||
public string JobSiteDefaultSearch { get; set; } = "";
|
||||
public string AssetGroupDefaultSearch { get; set; } = "";
|
||||
|
405
IronIntelContractorBusiness/iisitebase/IronIntelBasePage.cs
Normal file
405
IronIntelContractorBusiness/iisitebase/IronIntelBasePage.cs
Normal file
@ -0,0 +1,405 @@
|
||||
using Foresight.Fleet.Services.Customer;
|
||||
using Foresight.Fleet.Services.User;
|
||||
using Foresight.Security;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace IronIntel.Contractor.iisitebase
|
||||
{
|
||||
|
||||
public class IronIntelBasePage : System.Web.UI.Page
|
||||
{
|
||||
public const string LOGINSESSION_COOKIENAME = "iiabc_";
|
||||
public const string LANGUAGE_COOKIENAME = "iiabc_lang";
|
||||
private static int _LOCAL_TIMEOFFSET = 10000;
|
||||
public const string APPNAME = "iron-desktop";
|
||||
public const string CLIENT_TIMEOFFSET_COOKIENAME = "clienttimeoffset";
|
||||
|
||||
private static string _HostName = null;
|
||||
|
||||
private static string _Branch = string.Empty;
|
||||
private static string _AboutUrl = string.Empty;
|
||||
private static string _Copyrights = string.Empty;
|
||||
private static string _PageTitle = string.Empty;
|
||||
private static string _ShowTermofuse = string.Empty;
|
||||
|
||||
public IronIntelBasePage()
|
||||
{
|
||||
EnableViewState = false;
|
||||
}
|
||||
|
||||
public static string LocalHostName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_HostName == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_HostName = Dns.GetHostName();
|
||||
}
|
||||
catch
|
||||
{
|
||||
_HostName = string.Empty;
|
||||
}
|
||||
}
|
||||
return _HostName;
|
||||
}
|
||||
}
|
||||
|
||||
public static int LocalTimeOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_LOCAL_TIMEOFFSET == 10000)
|
||||
{
|
||||
DateTime dt = DateTime.Now;
|
||||
DateTime dt1 = dt.ToUniversalTime();
|
||||
TimeSpan sp = dt1 - dt;
|
||||
_LOCAL_TIMEOFFSET = Convert.ToInt32(sp.TotalMinutes);
|
||||
}
|
||||
return _LOCAL_TIMEOFFSET;
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly byte[] KEY = new byte[] { 219, 239, 201, 20, 173, 133, 64, 29, 33, 71, 49, 117, 208, 115, 79, 169, 1, 126, 201, 229, 115, 35, 62, 102, 71, 16, 71, 220, 44, 95, 186, 223 };
|
||||
private static readonly byte[] IV = new byte[] { 255, 180, 99, 244, 147, 37, 175, 243, 193, 52, 167, 82, 143, 199, 242, 171 };
|
||||
|
||||
public static string EncryptString(string s)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(s))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
byte[] buf = Encoding.UTF8.GetBytes(s);
|
||||
byte[] tmp = SecurityHelper.AesEncrypt(buf, KEY, IV);
|
||||
return Convert.ToBase64String(tmp);
|
||||
}
|
||||
|
||||
public static string DecryptString(string s)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(s))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
byte[] tmp = Convert.FromBase64String(s);
|
||||
byte[] buf = SecurityHelper.AesDecrypt(tmp, KEY, IV);
|
||||
return Encoding.UTF8.GetString(buf);
|
||||
}
|
||||
|
||||
private string GetServerParam(string key)
|
||||
{
|
||||
//IronSysServiceClient ic = new IronSysServiceClient(GetIronSystemServiceAddress());
|
||||
//StringKeyValue[] kvs = ic.GetServerParams();
|
||||
//foreach (StringKeyValue kv in kvs)
|
||||
//{
|
||||
// if (string.Compare(kv.Key, key, true) == 0)
|
||||
// {
|
||||
// return kv.Value;
|
||||
// }
|
||||
//}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public string Branch
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_Branch))
|
||||
{
|
||||
_Branch = GetServerParam("Branch");
|
||||
}
|
||||
return _Branch;
|
||||
}
|
||||
}
|
||||
|
||||
public string AboutUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_AboutUrl))
|
||||
{
|
||||
_AboutUrl = GetServerParam("AboutUrl");
|
||||
}
|
||||
return _AboutUrl;
|
||||
}
|
||||
}
|
||||
|
||||
public string Copyrights
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_Copyrights))
|
||||
{
|
||||
_Copyrights = GetServerParam("Copyrights");
|
||||
}
|
||||
return _Copyrights;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string PageTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_PageTitle))
|
||||
{
|
||||
_PageTitle = GetServerParam("PageTitle");
|
||||
}
|
||||
return _PageTitle;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowTermofuse
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_ShowTermofuse))
|
||||
{
|
||||
_ShowTermofuse = GetServerParam("ShowTermofuse");
|
||||
}
|
||||
return string.Compare(_ShowTermofuse, "True", true) == 0 || string.Compare(_ShowTermofuse, "Yes", true) == 0 || string.Compare(_ShowTermofuse, "1", true) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetLoginSessionID(HttpRequest request)
|
||||
{
|
||||
HttpCookie cookie = request.Cookies[LOGINSESSION_COOKIENAME];
|
||||
if (cookie == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(cookie.Value))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return DecryptString(cookie.Value);
|
||||
}
|
||||
|
||||
public LoginSession GetCurrentLoginSession()
|
||||
{
|
||||
string sessionid = GetLoginSessionID(Request);
|
||||
if (string.IsNullOrWhiteSpace(sessionid))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
try
|
||||
{
|
||||
UserQueryClient ic = FleetServiceClientHelper.CreateClient<UserQueryClient>();
|
||||
return ic.GetLoginSession(sessionid);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void RedirectToLoginPage()
|
||||
{
|
||||
Response.Redirect(LoginPageUrl);
|
||||
}
|
||||
|
||||
protected string LoginPageUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
CustomerProvider cp = FleetServiceClientHelper.CreateClient<CustomerProvider>();
|
||||
return cp.GetPortalLoginUrl();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当用户登录成功后,跳转到用户的默认主界面, 也即是各公司的主界面
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
protected void RedirectToUsersDefaultEntryPage(UserInfo user)
|
||||
{
|
||||
Response.Redirect(GetUserDefaultEntryPageUrl(user), true);
|
||||
}
|
||||
|
||||
protected string GetUserDefaultEntryPageUrl(UserInfo user)
|
||||
{
|
||||
CustomerProvider cp = FleetServiceClientHelper.CreateClient<CustomerProvider>();
|
||||
return cp.GetCompanyPortalEntryUrl(user.CompanyID);
|
||||
}
|
||||
|
||||
protected void ClearLoginSessionCookie()
|
||||
{
|
||||
HttpCookie cookie = new HttpCookie(LOGINSESSION_COOKIENAME);
|
||||
cookie.Value = string.Empty;
|
||||
cookie.Expires = DateTime.Now.AddDays(-3);
|
||||
Response.Cookies.Add(cookie);
|
||||
}
|
||||
|
||||
protected void SetLoginSessionCookie(string sessionid)
|
||||
{
|
||||
HttpCookie cookie = new HttpCookie(LOGINSESSION_COOKIENAME);
|
||||
cookie.Value = EncryptString(sessionid);
|
||||
|
||||
string path = ConfigurationManager.AppSettings["sessioncookiepath"];
|
||||
if (!string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
cookie.Path = path;
|
||||
}
|
||||
string domain = ConfigurationManager.AppSettings["sessioncookiedomain"];
|
||||
if (!string.IsNullOrWhiteSpace(domain))
|
||||
{
|
||||
cookie.Domain = domain;
|
||||
}
|
||||
Response.Cookies.Add(cookie);
|
||||
}
|
||||
|
||||
protected void SetClientTimeOffset(int offset)
|
||||
{
|
||||
HttpCookie cookie = new HttpCookie(CLIENT_TIMEOFFSET_COOKIENAME);
|
||||
cookie.Value = offset.ToString();
|
||||
cookie.Expires = DateTime.Now.AddYears(1);
|
||||
Response.Cookies.Add(cookie);
|
||||
}
|
||||
protected void SetLanguageCookie(string useriid)
|
||||
{
|
||||
HttpCookie cookie = new HttpCookie(LANGUAGE_COOKIENAME);
|
||||
cookie.Value = SystemParams.GetUserLanguage(useriid);
|
||||
|
||||
string path = ConfigurationManager.AppSettings["sessioncookiepath"];
|
||||
if (!string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
cookie.Path = path;
|
||||
}
|
||||
string domain = ConfigurationManager.AppSettings["sessioncookiedomain"];
|
||||
if (!string.IsNullOrWhiteSpace(domain))
|
||||
{
|
||||
cookie.Domain = domain;
|
||||
}
|
||||
Response.Cookies.Add(cookie);
|
||||
}
|
||||
protected string GetLanguageCookie()
|
||||
{
|
||||
HttpCookie cookie = Request.Cookies[LANGUAGE_COOKIENAME];
|
||||
if (cookie == null)
|
||||
{
|
||||
return "en-us";
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(cookie.Value))
|
||||
{
|
||||
return "en-us";
|
||||
}
|
||||
return cookie.Value;
|
||||
}
|
||||
|
||||
protected int GetClientTimeOffset()
|
||||
{
|
||||
HttpCookie cookie = Request.Cookies[CLIENT_TIMEOFFSET_COOKIENAME];
|
||||
if (cookie == null)
|
||||
{
|
||||
return LocalTimeOffset;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(cookie.Value))
|
||||
{
|
||||
return LocalTimeOffset;
|
||||
}
|
||||
int n = 0;
|
||||
if (int.TryParse(cookie.Value, out n))
|
||||
{
|
||||
return n;
|
||||
}
|
||||
else
|
||||
{
|
||||
return LocalTimeOffset;
|
||||
}
|
||||
}
|
||||
|
||||
public static DateTime UtcTimeToClientTime(DateTime dt, int clienttimeoffset)
|
||||
{
|
||||
return dt.AddMinutes(-1 * clienttimeoffset);
|
||||
}
|
||||
|
||||
public static Int64 GetSiteFileDateTime(string url)
|
||||
{
|
||||
string fn = HttpContext.Current.Server.MapPath(url);
|
||||
if (System.IO.File.Exists(fn))
|
||||
{
|
||||
try
|
||||
{
|
||||
return System.IO.File.GetLastWriteTimeUtc(fn).Ticks;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用于构造js/css或图片文件的url,在其最后加上版本标识,解决浏览器缓存问题
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetFileUrlWithVersion(string url)
|
||||
{
|
||||
string fn = HttpContext.Current.Server.MapPath(url);
|
||||
if (System.IO.File.Exists(fn))
|
||||
{
|
||||
try
|
||||
{
|
||||
Int64 n = System.IO.File.GetLastWriteTimeUtc(fn).Ticks;
|
||||
return url + "?sn=" + n.ToString();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return url;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
public static string ReadTextFromStream(System.IO.Stream stream)
|
||||
{
|
||||
using (System.IO.StreamReader sr = new System.IO.StreamReader(stream))
|
||||
{
|
||||
return sr.ReadToEnd();
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetUserHostAddress(HttpRequest request)
|
||||
{
|
||||
const string CLIENT_IP = "client-ip";
|
||||
if (request == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
string rst = request.Headers[CLIENT_IP];
|
||||
if (string.IsNullOrWhiteSpace(rst))
|
||||
{
|
||||
rst = request.UserHostAddress;
|
||||
}
|
||||
if (rst == null)
|
||||
{
|
||||
rst = string.Empty;
|
||||
}
|
||||
return rst;
|
||||
}
|
||||
|
||||
protected string UserHostAddress
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetUserHostAddress(Request);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
using Foresight.Fleet.Services.User;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace IronIntel.Contractor.iisitebase
|
||||
{
|
||||
|
||||
public class IronIntelHttpHandlerBase : IDisposable
|
||||
{
|
||||
public static string LocalHostName
|
||||
{
|
||||
get { return IronIntelBasePage.LocalHostName; }
|
||||
}
|
||||
|
||||
public HttpContext Context { get; private set; }
|
||||
protected LoginSession LoginSession { get; private set; }
|
||||
|
||||
protected int ClientTimeOffset { get; private set; }
|
||||
|
||||
public IronIntelHttpHandlerBase(HttpContext context)
|
||||
{
|
||||
Context = context;
|
||||
try
|
||||
{
|
||||
LoginSession = GetCurrentLoginSession();
|
||||
}
|
||||
catch
|
||||
{
|
||||
LoginSession = null;
|
||||
}
|
||||
ClientTimeOffset = GetClientTimeOffset();
|
||||
}
|
||||
|
||||
|
||||
public LoginSession GetCurrentLoginSession()
|
||||
{
|
||||
HttpCookie cookie = Context.Request.Cookies[IronIntelBasePage.LOGINSESSION_COOKIENAME];
|
||||
if (cookie == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(cookie.Value))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
string sessionid = IronIntelBasePage.DecryptString(cookie.Value);
|
||||
try
|
||||
{
|
||||
UserQueryClient ic = FleetServiceClientHelper.CreateClient<UserQueryClient>();
|
||||
return ic.GetLoginSession(sessionid);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private int GetClientTimeOffset()
|
||||
{
|
||||
HttpCookie cookie = Context.Request.Cookies[IronIntelBasePage.CLIENT_TIMEOFFSET_COOKIENAME];
|
||||
if (cookie == null)
|
||||
{
|
||||
return IronIntelBasePage.LocalTimeOffset;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(cookie.Value))
|
||||
{
|
||||
return IronIntelBasePage.LocalTimeOffset;
|
||||
}
|
||||
int n = 0;
|
||||
if (int.TryParse(cookie.Value, out n))
|
||||
{
|
||||
return n;
|
||||
}
|
||||
else
|
||||
{
|
||||
return IronIntelBasePage.LocalTimeOffset;
|
||||
}
|
||||
}
|
||||
|
||||
public static string ReadTextFromStream(System.IO.Stream stream)
|
||||
{
|
||||
using (System.IO.StreamReader sr = new System.IO.StreamReader(stream))
|
||||
{
|
||||
return sr.ReadToEnd();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ProcessRequest()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private bool disposed = false;
|
||||
protected void Dispose(bool disposed)
|
||||
{
|
||||
Context = null;
|
||||
LoginSession = null;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (!disposed)
|
||||
{
|
||||
Dispose(true);
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public string UserHostAddress
|
||||
{
|
||||
get
|
||||
{
|
||||
return IronIntelBasePage.GetUserHostAddress(Context.Request);
|
||||
}
|
||||
}
|
||||
protected string GetLanguageCookie()
|
||||
{
|
||||
HttpCookie cookie = Context.Request.Cookies[IronIntelBasePage.LANGUAGE_COOKIENAME];
|
||||
if (cookie == null)
|
||||
{
|
||||
return "en-us";
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(cookie.Value))
|
||||
{
|
||||
return "en-us";
|
||||
}
|
||||
return cookie.Value;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="System.Data.SqlClient" version="4.6.0" targetFramework="net471" />
|
||||
<package id="System.Data.SqlClient" version="4.8.1" targetFramework="net472" />
|
||||
<package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net472" />
|
||||
</packages>
|
@ -3,7 +3,8 @@ using Foresight.Fleet.Services;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using Foresight.Fleet.Services.AssetHealth;
|
||||
using Foresight.Fleet.Services.Device;
|
||||
using Foresight.ServiceModel;
|
||||
using Foresight.Fleet.Services.JobSite;
|
||||
using Foresight.Fleet.Services.User;
|
||||
using IronIntel.Contractor.Machines;
|
||||
using IronIntel.Contractor.Maintenance;
|
||||
using IronIntel.Contractor.Users;
|
||||
@ -14,6 +15,11 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using Foresight.Standard;
|
||||
using Foresight.Fleet.Services.Customer;
|
||||
using Foresight.Fleet.Services.AssetHealth.WorkOrder;
|
||||
using IronIntel.Contractor.Site.Maintenance;
|
||||
using System.Drawing;
|
||||
|
||||
namespace IronIntel.Contractor.Site.Asset
|
||||
{
|
||||
@ -32,6 +38,9 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
case "GETMACHINESBYCOMPANY":
|
||||
result = GetMachinesByCompany();
|
||||
break;
|
||||
case "GETMACHINESBYCOMPANY1":
|
||||
result = GetMachinesByCompany1();
|
||||
break;
|
||||
case "GETMACHINEINFO":
|
||||
result = GetMachineInfo();
|
||||
break;
|
||||
@ -65,6 +74,27 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
case "CHANGEASSETPROPERTY":
|
||||
result = ChangeAssetProperty();
|
||||
break;
|
||||
case "GETASSETATTACHMENTINFO":
|
||||
result = GetAssetAttachmentInfo();
|
||||
break;
|
||||
case "DELETEASSETS":
|
||||
result = DeleteAssets();
|
||||
break;
|
||||
case "MERGEASSET":
|
||||
result = MergeAsset();
|
||||
break;
|
||||
case "GETASSETDATASOURCES":
|
||||
result = GetAssetDatasources();
|
||||
break;
|
||||
case "GETASSETS":
|
||||
result = GetAssets();
|
||||
break;
|
||||
case "GETASSETHISTORYS":
|
||||
result = GetAssetHistorys();
|
||||
break;
|
||||
case "GETASSETDETAILINFO":
|
||||
result = GetAssetDetailInfo();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -77,6 +107,33 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
Response.Write(json);
|
||||
Response.End();
|
||||
}
|
||||
|
||||
private object GetAssetDetailInfo()
|
||||
{
|
||||
try
|
||||
{
|
||||
var session = GetCurrentLoginSession();
|
||||
if (session != null)
|
||||
{
|
||||
var clientdata = Request.Form["ClientData"].Split((char)170);
|
||||
var custid = HttpUtility.HtmlDecode(clientdata[0]);
|
||||
var assetidstr = HttpUtility.HtmlDecode(clientdata[1]);
|
||||
long assetid = -1;
|
||||
long.TryParse(assetidstr, out assetid);
|
||||
if (string.IsNullOrWhiteSpace(custid))
|
||||
custid = SystemParams.CompanyID;
|
||||
|
||||
AssetDetailInfo info = CreateClient<AssetQueryClient>(custid).GetAssetDetailInfo(custid, assetid);
|
||||
return new { ID = info.ID, Name = info.DisplayName + " " + info.VIN };
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
private object GetMachinesByCompany()
|
||||
{
|
||||
try
|
||||
@ -88,6 +145,8 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
var companyid = HttpUtility.HtmlDecode(clientdata[0]);
|
||||
bool showHidden = HttpUtility.HtmlDecode(clientdata[1]) == "1";
|
||||
var searchtxt = HttpUtility.HtmlDecode(clientdata[2]);
|
||||
bool attachment = HttpUtility.HtmlDecode(clientdata[3]) == "1";
|
||||
int att = attachment ? 0 : 2;
|
||||
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -97,19 +156,32 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
|
||||
//GpsDeviceInfo[] devs = SystemParams.DeviceProvider.GetDeviceItems(contractorid, "");
|
||||
|
||||
AssetBasicInfo[] assets = CreateClient<AssetQueryClient>(companyid).GetAssetBasicInfoByUser(companyid, searchtxt, session.User.UID);
|
||||
List<AssetBasicItem> list = new List<AssetBasicItem>();
|
||||
AssetBasicInfo[] assets = CreateClient<AssetQueryClient>(companyid).GetAssetBasicInfoByUser(companyid, searchtxt, session.User.UID, att);
|
||||
|
||||
if (assets == null || assets.Length == 0)
|
||||
return string.Empty;
|
||||
|
||||
assets = assets.OrderBy((m) => m.VIN).ToArray();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (var a in assets)
|
||||
{
|
||||
if (!showHidden && a.Hide) continue;
|
||||
AssetBasicItem asset = new AssetBasicItem();
|
||||
Helper.CloneProperty(asset, a);
|
||||
list.Add(asset);
|
||||
asset.EngineHours = a.EngineHours == null ? 0 : a.EngineHours.Value;
|
||||
asset.Odometer = a.Odometer == null ? 0 : a.Odometer.Value;
|
||||
|
||||
sb.Append(SPLIT_CHAR180 + asset.ToString());
|
||||
}
|
||||
return list.OrderBy((m) => m.VIN).ToArray();
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
return sb.ToString().Substring(1);
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
else
|
||||
return new MachineItem[0];
|
||||
return string.Empty;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -118,6 +190,38 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
}
|
||||
}
|
||||
|
||||
private object GetMachinesByCompany1()
|
||||
{
|
||||
try
|
||||
{
|
||||
var session = GetCurrentLoginSession();
|
||||
if (session != null)
|
||||
{
|
||||
string companyid = HttpUtility.HtmlDecode(Request.Form["ClientData"]);
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
|
||||
AssetBasicInfo[] assets = CreateClient<AssetQueryClient>(companyid).GetAssetBasicInfoByUser(companyid, "", session.User.UID, 0);
|
||||
|
||||
if (assets == null || assets.Length == 0)
|
||||
return new AssetBasicInfo[0];
|
||||
|
||||
var items = assets.Select((a) => new { ID = a.ID, Name = a.DisplayName + (string.IsNullOrWhiteSpace(a.VIN) ? "" : ("----" + a.VIN)) });
|
||||
|
||||
items = items.OrderBy((m) => m.Name).ToArray();
|
||||
|
||||
return items;
|
||||
}
|
||||
else
|
||||
return new AssetBasicInfo[0];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddLog("ERROR", "AssetBasePage.GetMachinesByCompany1", ex.Message, ex.ToString());
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
private object GetMachineInfo()
|
||||
{
|
||||
try
|
||||
@ -149,7 +253,7 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
AssetDetailItem2 assetItem = new AssetDetailItem2();
|
||||
Helper.CloneProperty(assetItem, assetDetail);
|
||||
|
||||
assetItem.OnSiteJobsiteID = mother.JobSiteID;
|
||||
assetItem.JobSites = mother.JobSites;
|
||||
assetItem.ContactIDs = string.IsNullOrEmpty(mother.ContactIDs) ? new string[0] : mother.ContactIDs.Split(',');
|
||||
assetItem.MachineGroupIDs = string.IsNullOrEmpty(mother.GroupIDs) ? new string[0] : mother.GroupIDs.Split(',');
|
||||
|
||||
@ -167,9 +271,6 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
// assetItem.MachineRental = rental;
|
||||
//}
|
||||
|
||||
if (assetItem.UnderCarriageHours != null)
|
||||
assetItem.UnderCarriageHours = Math.Round(assetItem.UnderCarriageHours.Value, 2);
|
||||
|
||||
return assetItem;
|
||||
}
|
||||
else
|
||||
@ -189,11 +290,13 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
var session = GetCurrentLoginSession();
|
||||
if (session != null)
|
||||
{
|
||||
if (!CheckRight(SystemParams.CompanyID, Foresight.Fleet.Services.User.Feature.MANAGE_ASSETS, Permissions.FullControl))
|
||||
return "";
|
||||
string clientdata = HttpUtility.HtmlDecode(Request.Params["ClientData"]);
|
||||
AssetDetailItem2 asset = JsonConvert.DeserializeObject<AssetDetailItem2>(clientdata);
|
||||
|
||||
if (SystemParams.IsDealer && string.IsNullOrWhiteSpace(asset.ContractorID))
|
||||
return "Failed";
|
||||
return FailedResult;
|
||||
|
||||
string connectionStr = string.Empty;
|
||||
string customerid = string.Empty;
|
||||
@ -212,19 +315,13 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
AssetDataAdjustClient client = CreateClient<AssetDataAdjustClient>(customerid);
|
||||
if (asset.ID > 0)
|
||||
{
|
||||
//没有权限修改的,保持原来的值
|
||||
var oldMachine = client.GetAssetDetailInfo2(customerid, asset.ID);
|
||||
asset.EngineHours = oldMachine.EngineHours;//EngineHours单独保存
|
||||
var user = UserManagement.GetUserByIID(session.User.UID);
|
||||
if (user.UserType < UserTypes.Admin)
|
||||
if (oldMachine.ShareStatus == AssetShareStatus.Child)
|
||||
{
|
||||
asset.VIN = oldMachine.VIN;
|
||||
asset.VIN = oldMachine.VIN;//共享机器不能修改VIN/Make/Model/Type
|
||||
asset.MakeID = oldMachine.MakeID;
|
||||
asset.MakeName = oldMachine.MakeName;
|
||||
asset.ModelID = oldMachine.ModelID;
|
||||
asset.ModelName = oldMachine.ModelName;
|
||||
asset.Odometer = oldMachine.Odometer;
|
||||
asset.OdometerUnits = oldMachine.OdometerUnits;
|
||||
asset.TypeID = oldMachine.TypeID;
|
||||
}
|
||||
}
|
||||
else if (!asset.IgnoreDuplicate)
|
||||
@ -243,26 +340,29 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
|
||||
AssetDetailInfo2 a = new AssetDetailInfo2();
|
||||
Helper.CloneProperty(a, asset);
|
||||
a.ID = client.UpdateAssetInfo(customerid, a, asset.ContactIDs, asset.MachineGroupIDs, (int)asset.OnSiteJobsiteID, session.User.UID);
|
||||
a.ID = client.UpdateAssetInfo(customerid, a, asset.ContactIDs, asset.MachineGroupIDs, session.User.UID);
|
||||
CreateClient<JobSiteProvider>(customerid).AddAssetToJobSites(customerid, asset.OnSiteJobsiteIDs, a.ID, a.VIN);
|
||||
|
||||
UpdateMachineAttributes(a.ID, asset.ContractorID, asset.MachineAttributes, session.User.UID);
|
||||
if (asset.VisibleOnWorkOrders != null)
|
||||
{
|
||||
foreach (StringKeyValue kv in asset.VisibleOnWorkOrders)
|
||||
{
|
||||
CreateClient<AssetAttachmentProvider>(customerid).ChangeVisibleOnWorkOrder(customerid, Convert.ToInt32(kv.Key), Helper.IsTrue(kv.Value));
|
||||
}
|
||||
|
||||
}
|
||||
long rentalID = -1;
|
||||
if (asset.MachineRental != null)
|
||||
if (a.ShareStatus != AssetShareStatus.Child)
|
||||
{
|
||||
asset.MachineRental.MachineID = a.ID;
|
||||
AssetRentalInfo rentalinfo = new AssetRentalInfo();
|
||||
Helper.CloneProperty(rentalinfo, asset.MachineRental);
|
||||
rentalinfo.RentalRate = (double)asset.MachineRental.RentalRate;
|
||||
rentalID = CreateClient<AssetQueryClient>(customerid).SaveAssetRental(customerid, rentalinfo, session.User.UID);
|
||||
UpdateMachineAttributes(a.ID, asset.ContractorID, asset.MachineAttributes, session.User.UID);
|
||||
|
||||
if (asset.MachineRental != null)
|
||||
{
|
||||
asset.MachineRental.MachineID = a.ID;
|
||||
AssetRentalInfo rentalinfo = new AssetRentalInfo();
|
||||
Helper.CloneProperty(rentalinfo, asset.MachineRental);
|
||||
rentalinfo.RentalRate = (double)asset.MachineRental.RentalRate;
|
||||
rentalID = CreateClient<AssetQueryClient>(customerid).SaveAssetRental(customerid, rentalinfo, session.User.UID);
|
||||
}
|
||||
if (asset.AttachmentInfo != null)
|
||||
{
|
||||
asset.AttachmentInfo.AssetId = a.ID;
|
||||
client.UpdateAssetAttachmentAttribute(customerid, asset.AttachmentInfo, session.User.UID);
|
||||
}
|
||||
}
|
||||
|
||||
return new
|
||||
{
|
||||
Result = 1,
|
||||
@ -271,7 +371,7 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Failed";
|
||||
return FailedResult;
|
||||
}
|
||||
}
|
||||
catch (BusinessException bex)
|
||||
@ -285,6 +385,47 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
}
|
||||
}
|
||||
|
||||
private object GetAssetAttachmentInfo()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (GetCurrentLoginSession() != null)
|
||||
{
|
||||
var clientdata = Request.Form["ClientData"].Split((char)170);
|
||||
var companyid = HttpUtility.HtmlDecode(clientdata[0]);
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
var mid = HttpUtility.HtmlDecode(clientdata[1]);
|
||||
long machineid = -1;
|
||||
long.TryParse(mid, out machineid);
|
||||
|
||||
var client = CreateClient<AssetDataAdjustClient>(companyid);
|
||||
AttachmentAttributeItem attaitem = null;
|
||||
AttachmentAttributeInfo attainfo = client.GetAssetAttachmentAttribute(companyid, machineid);
|
||||
if (attainfo != null)
|
||||
{
|
||||
attaitem = new AttachmentAttributeItem();
|
||||
Helper.CloneProperty(attaitem, attainfo);
|
||||
if (attaitem.AttachedtoAssetId != null && attaitem.AttachedtoAssetId.Value > 0)
|
||||
{
|
||||
var asset = CreateClient<AssetQueryClient>(companyid).GetAssetBasicInfoByID(companyid, attaitem.AttachedtoAssetId.Value);
|
||||
if (asset != null)
|
||||
attaitem.AttachedtoAssetName = asset.DisplayName;
|
||||
}
|
||||
}
|
||||
|
||||
return attaitem;
|
||||
}
|
||||
else
|
||||
return new AttachmentAttributeItem();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemParams.WriteLog("error", "AssetBasePage.GetAssetAttachmentInfo", ex.Message, ex.ToString());
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
private string ChangeAssetProperty()
|
||||
{
|
||||
try
|
||||
@ -313,13 +454,19 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
case "TelematicsEnabled":
|
||||
CreateClient<AssetDataAdjustClient>(contractorid).ChangeAssetTelematicsProperty(contractorid, assetid, value, "", user.IID);
|
||||
break;
|
||||
case "Attachment":
|
||||
CreateClient<AssetDataAdjustClient>(contractorid).ChangeAssetAttachmentProperty(contractorid, assetid, value, "", user.IID);
|
||||
break;
|
||||
case "Preloaded":
|
||||
CreateClient<AssetDataAdjustClient>(contractorid).ChangeAssetPreloadedProperty(contractorid, assetid, value, "", user.IID);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "OK";
|
||||
return OkResult;
|
||||
}
|
||||
else
|
||||
return "Failed";
|
||||
return FailedResult;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -471,9 +618,8 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
|
||||
if (!DateTime.TryParse(edate, out endtime))
|
||||
endtime = DateTime.MaxValue;
|
||||
else
|
||||
endtime = endtime.Date.AddDays(1).AddSeconds(-1);
|
||||
|
||||
AssetBasicInfo asset = CreateClient<AssetQueryClient>(customerid).GetAssetBasicInfoByID(customerid, Convert.ToInt64(assetid));
|
||||
AssetOdometerAdjustInfo[] odos = CreateClient<AssetDataAdjustClient>(customerid).GetOdometerAdjustmentHistory(customerid, Convert.ToInt64(assetid), starttime, endtime);
|
||||
if (odos == null || odos.Length == 0)
|
||||
return new AssetOdometerAdjustItem[0];
|
||||
@ -483,6 +629,8 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
{
|
||||
AssetOdometerAdjustItem item = new AssetOdometerAdjustItem();
|
||||
Helper.CloneProperty(item, odo);
|
||||
item.DisplayName = asset.DisplayName;
|
||||
item.VIN = asset.VIN;
|
||||
list.Add(item);
|
||||
}
|
||||
return list.ToArray();
|
||||
@ -521,9 +669,8 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
|
||||
if (!DateTime.TryParse(edate, out endtime))
|
||||
endtime = DateTime.MaxValue;
|
||||
else
|
||||
endtime = endtime.Date.AddDays(1).AddSeconds(-1);
|
||||
|
||||
AssetBasicInfo asset = CreateClient<AssetQueryClient>(customerid).GetAssetBasicInfoByID(customerid, Convert.ToInt64(assetid));
|
||||
AssetEngineHoursAdjustInfo[] hours = CreateClient<AssetDataAdjustClient>(customerid).GetEngineHoursAdjustmentHistory(customerid, Convert.ToInt64(assetid), starttime, endtime);
|
||||
if (hours == null || hours.Length == 0)
|
||||
return new AssetEngineHoursAdjustItem[0];
|
||||
@ -533,6 +680,8 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
{
|
||||
AssetEngineHoursAdjustItem item = new AssetEngineHoursAdjustItem();
|
||||
Helper.CloneProperty(item, hour);
|
||||
item.DisplayName = asset.DisplayName;
|
||||
item.VIN = asset.VIN;
|
||||
list.Add(item);
|
||||
}
|
||||
return list.ToArray();
|
||||
@ -567,10 +716,12 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
custid = SystemParams.CompanyID;
|
||||
|
||||
StringKeyValue kv = new StringKeyValue();
|
||||
kv.Key = SystemParams.GetStringParam("CustomerTimeZone", false, db);
|
||||
TimeZoneInfo tz = SystemParams.GetTimeZoneInfo(custid, db);
|
||||
DateTime time = TimeZoneInfo.ConvertTimeFromUtc(DateTime.Now.ToUniversalTime(), tz);
|
||||
kv.Value = time.ToString("MM/dd/yyyy HH:mm:ss");
|
||||
|
||||
//kv.Key = CreateClient<CustomerProvider>(custid).GetCustomerTimeZone(custid);
|
||||
kv.Key = SystemParams.GetUserTimeZoneId(session.User);
|
||||
//TimeZoneInfo tz = SystemParams.GetTimeZoneInfo(custid);
|
||||
DateTime time = SystemParams.ConvertToUserTimeFromUtc(session.User, DateTime.UtcNow);
|
||||
kv.Value = time.ToString("MM/dd/yyyy HH:mm:ss");//此处格式不能修改
|
||||
return kv;
|
||||
}
|
||||
else
|
||||
@ -608,9 +759,9 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
}
|
||||
MachineManagement.ChangeMachineIconFile(Convert.ToInt64(kv.Value), uploadFile == null ? "" : uploadFile.FileName, iconfilebyte, db);
|
||||
|
||||
return "OK";
|
||||
return OkResult;
|
||||
}
|
||||
return "Failed";
|
||||
return FailedResult;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -628,7 +779,7 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
string clientdata = HttpUtility.HtmlDecode(Request.Params["ClientData"]);
|
||||
long assetid = 0;
|
||||
long.TryParse(clientdata, out assetid);
|
||||
return MaintenanceManagement.GetPmScheduleByAsset(session.SessionID, assetid);
|
||||
return MaintenanceManagement.GetPmScheduleByAsset(session.SessionID, assetid, true);
|
||||
}
|
||||
else
|
||||
return new PmScheduleInfo[0];
|
||||
@ -665,7 +816,7 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
client.GenerateMissedPMAlert(SystemParams.CompanyID, p.SelectedIntervalID, pmAsset.AssetId);
|
||||
}
|
||||
}
|
||||
return "OK";
|
||||
return OkResult;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -688,7 +839,7 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
|
||||
CreateClient<PMClient>().DeleteAssetsFromSchedule(SystemParams.CompanyID, ps[1], new long[] { assetid }, session.User.UID);
|
||||
}
|
||||
return "OK";
|
||||
return OkResult;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -697,6 +848,200 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
}
|
||||
}
|
||||
|
||||
private object DeleteAssets()
|
||||
{
|
||||
try
|
||||
{
|
||||
var session = GetCurrentLoginSession();
|
||||
if (session != null && session.User.UserType == Foresight.Fleet.Services.User.UserTypes.SupperAdmin)
|
||||
{
|
||||
string clientdata = HttpUtility.HtmlDecode(Request.Params["ClientData"]);
|
||||
string[] ps = JsonConvert.DeserializeObject<string[]>(clientdata);
|
||||
string custid = ps[0];
|
||||
long[] assetids = JsonConvert.DeserializeObject<long[]>(ps[1]);
|
||||
string notes = ps[2];
|
||||
|
||||
if (string.IsNullOrEmpty(custid))
|
||||
custid = SystemParams.CompanyID;
|
||||
|
||||
var client = CreateClient<AssetDataAdjustClient>(custid);
|
||||
foreach (long assetid in assetids)
|
||||
{
|
||||
client.DeleteAsset(custid, Convert.ToInt64(assetid), notes);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
return FailedResult;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemParams.WriteLog("error", "AssetBasePage.DeleteAsset", ex.Message, ex.ToString());
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
private object MergeAsset()
|
||||
{
|
||||
try
|
||||
{
|
||||
var session = GetCurrentLoginSession();
|
||||
if (session != null && session.User.UserType == Foresight.Fleet.Services.User.UserTypes.SupperAdmin)
|
||||
{
|
||||
string clientdata = HttpUtility.HtmlDecode(Request.Params["ClientData"]);
|
||||
string[] ps = JsonConvert.DeserializeObject<string[]>(clientdata);
|
||||
string custid = ps[0];
|
||||
string fromassetid = ps[1];
|
||||
string toassetid = ps[2];
|
||||
string notes = ps[3];
|
||||
|
||||
if (string.IsNullOrEmpty(custid))
|
||||
custid = SystemParams.CompanyID;
|
||||
|
||||
CreateClient<AssetDataAdjustClient>(custid).MergeAsset(custid, Convert.ToInt64(fromassetid), Convert.ToInt64(toassetid), notes);
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
return FailedResult;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemParams.WriteLog("error", "AssetBasePage.MergeAsset", ex.Message, ex.ToString());
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
private object GetAssetDatasources()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (GetCurrentLoginSession() != null)
|
||||
{
|
||||
string clientdata = HttpUtility.HtmlDecode(Request.Params["ClientData"]);
|
||||
string[] ps = JsonConvert.DeserializeObject<string[]>(clientdata);
|
||||
var companyid = HttpUtility.HtmlDecode(ps[0]);
|
||||
var mid = HttpUtility.HtmlDecode(ps[1]);
|
||||
long machineid = -1;
|
||||
long.TryParse(mid, out machineid);
|
||||
|
||||
if (!SystemParams.IsDealer)
|
||||
{
|
||||
companyid = SystemParams.CompanyID;
|
||||
}
|
||||
|
||||
var client = CreateClient<AssetDataAdjustClient>(companyid);
|
||||
string[] datasources = client.GetAssetDatasources(companyid, machineid);
|
||||
if (datasources == null)
|
||||
return new string[0];
|
||||
|
||||
return datasources;
|
||||
}
|
||||
else
|
||||
return new string[0];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemParams.WriteLog("error", "AssetBasePage.GetAssetDatasources", ex.Message, ex.ToString());
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
#region Asset History
|
||||
private object GetAssets()
|
||||
{
|
||||
try
|
||||
{
|
||||
var session = GetCurrentLoginSession();
|
||||
if (session != null)
|
||||
{
|
||||
|
||||
var clientdata = Request.Form["ClientData"].Split((char)170);
|
||||
var companyid = HttpUtility.HtmlDecode(clientdata[0]);
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
|
||||
var items = CreateClient<AssetQueryClient>(companyid).GetAssetListItemsByUser(companyid, session.User.UID, string.Empty, true, 0, false, null, null, null);
|
||||
return items.OrderBy(g => g.VIN).Select(i => new
|
||||
{
|
||||
i.Id,
|
||||
DisplayName = GetDisplayName(i),
|
||||
}).ToArray();
|
||||
}
|
||||
else
|
||||
return new AssetGroupInfo[0];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddLog("ERROR", "MachineDeviceBasePage.GetAssetList", ex.Message, ex.ToString());
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
private object GetAssetHistorys()
|
||||
{
|
||||
try
|
||||
{
|
||||
var session = GetCurrentLoginSession();
|
||||
if (session != null)
|
||||
{
|
||||
string clientdata = Request.Params["ClientData"];
|
||||
string[] ps = JsonConvert.DeserializeObject<string[]>(clientdata);
|
||||
|
||||
var companyid = ps[0];
|
||||
long assetid = Convert.ToInt64(ps[1]);
|
||||
DateTime beginDate = Helper.DBMinDateTime;
|
||||
DateTime endDate = DateTime.MaxValue;
|
||||
if (!DateTime.TryParse(ps[2], out beginDate))
|
||||
beginDate = Helper.DBMinDateTime;
|
||||
if (!DateTime.TryParse(ps[3], out endDate))
|
||||
endDate = DateTime.MaxValue;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
|
||||
AssetHistoryInfo[] items = CreateClient<AssetQueryClient>(companyid).GetAssetHistorys(companyid, assetid, beginDate, endDate, "");
|
||||
if (items == null || items.Length == 0)
|
||||
return new AssetHistoryItem[0];
|
||||
|
||||
List<AssetHistoryItem> ls = new List<AssetHistoryItem>();
|
||||
foreach (AssetHistoryInfo item in items)
|
||||
{
|
||||
AssetHistoryItem his = new AssetHistoryItem();
|
||||
Helper.CloneProperty(his, item);
|
||||
ls.Add(his);
|
||||
}
|
||||
return ls.ToArray();
|
||||
}
|
||||
else
|
||||
return new AssetHistoryItem[0];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
private string GetDisplayName(AssetListItemInfo a)
|
||||
{
|
||||
//Name取值顺序为Name2,Name,VIN,ID用于前端显示
|
||||
string name = a.Name2;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
name = a.Name;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
name = a.VIN;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
name = a.Id.ToString();
|
||||
return name;
|
||||
}
|
||||
class AssetHistoryItem : AssetHistoryInfo
|
||||
{
|
||||
public string DateTimeStr { get { return DateTime == null ? "" : DateTime.Value.ToString(); } }
|
||||
}
|
||||
#endregion
|
||||
|
||||
class PMScheduleAssetItem
|
||||
{
|
||||
public long AssetId { get; set; }
|
||||
@ -707,5 +1052,15 @@ namespace IronIntel.Contractor.Site.Asset
|
||||
public int? StartIntervalValue { get; set; }
|
||||
public string SelectedIntervalID { get; set; }
|
||||
}
|
||||
class AttachmentAttributeItem : AttachmentAttributeInfo
|
||||
{
|
||||
public string AttachedtoAssetName { get; set; }
|
||||
}
|
||||
|
||||
class AssetMergeItem : AssetMergeInfo
|
||||
{
|
||||
public string CompletedOnStr { get { return CompletedOn == DateTime.MinValue ? "" : CompletedOn.ToString(); } }
|
||||
public string MergeOnStr { get { return MergeOn == DateTime.MinValue ? "" : MergeOn.ToString(); } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
346
IronIntelContractorSiteLib/Asset/ShareAssetBasePage.cs
Normal file
346
IronIntelContractorSiteLib/Asset/ShareAssetBasePage.cs
Normal file
@ -0,0 +1,346 @@
|
||||
using Foresight.Data;
|
||||
using Foresight.Fleet.Services;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using Foresight.Fleet.Services.AssetHealth;
|
||||
using Foresight.Fleet.Services.Device;
|
||||
using Foresight.Fleet.Services.JobSite;
|
||||
using Foresight.Fleet.Services.User;
|
||||
using IronIntel.Contractor.Machines;
|
||||
using IronIntel.Contractor.Maintenance;
|
||||
using IronIntel.Contractor.Users;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using Foresight.Standard;
|
||||
|
||||
namespace IronIntel.Contractor.Site.Asset
|
||||
{
|
||||
public class ShareAssetBasePage : ContractorBasePage
|
||||
{
|
||||
protected void ProcessRequest(string method)
|
||||
{
|
||||
object result = null;
|
||||
string methodName = Request.Params["MethodName"];
|
||||
try
|
||||
{
|
||||
if (methodName != null)
|
||||
{
|
||||
switch (methodName.ToUpper())
|
||||
{
|
||||
case "GETSHAREWITHCUSTOMERS":
|
||||
result = GetShareWithCustomers();
|
||||
break;
|
||||
case "SETSHAREWITHCUSTOMERS":
|
||||
result = SetShareWithCustomers();
|
||||
break;
|
||||
case "GETASSETSHAREINFOS":
|
||||
result = GetAssetShareInfos();
|
||||
break;
|
||||
case "GETSHAREASSETLIST":
|
||||
result = GetShareAssetList();
|
||||
break;
|
||||
case "SAVESHAREASSET":
|
||||
result = SaveShareAsset();
|
||||
break;
|
||||
case "UNSHAREASSET":
|
||||
result = UnShareAsset();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemParams.WriteLog("error", "ShareAssetBasePage", ex.Message, ex.ToString());
|
||||
throw ex;
|
||||
}
|
||||
string json = JsonConvert.SerializeObject(result);
|
||||
Response.Write(json);
|
||||
Response.End();
|
||||
}
|
||||
private object GetShareWithCustomers()
|
||||
{
|
||||
try
|
||||
{
|
||||
var session = GetCurrentLoginSession();
|
||||
if (session != null)
|
||||
{
|
||||
|
||||
var clientdata = Request.Form["ClientData"];
|
||||
clientdata = HttpUtility.HtmlDecode(clientdata);
|
||||
string[] ps = JsonConvert.DeserializeObject<string[]>(clientdata);
|
||||
var companyid = ps[0];
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
bool sharableonly = Helper.IsTrue(ps[1]);
|
||||
var custs = CreateClient<ShareAssetsProvider>(companyid).GetSharableCustomers(companyid, sharableonly);
|
||||
return custs.OrderBy((c) => c.CustomerName).ToArray();
|
||||
}
|
||||
else
|
||||
return new MachineItem[0];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddLog("ERROR", "ShareAssetBasePage.GetShareWithCustomers", ex.Message, ex.ToString());
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
private object GetAssetShareInfos()
|
||||
{
|
||||
try
|
||||
{
|
||||
var session = GetCurrentLoginSession();
|
||||
if (session != null)
|
||||
{
|
||||
var clientdata = Request.Form["ClientData"];
|
||||
clientdata = HttpUtility.HtmlDecode(clientdata);
|
||||
string[] ps = JsonConvert.DeserializeObject<string[]>(clientdata);
|
||||
var companyid = ps[0];
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
|
||||
long asstid = -1;
|
||||
long.TryParse(ps[1], out asstid);
|
||||
AssetShareInfo[] assets = CreateClient<ShareAssetsProvider>(companyid).GetAssetShareInfos(companyid, asstid);
|
||||
if (assets == null || assets.Length == 0)
|
||||
return new AssetShareItem[0];
|
||||
|
||||
List<AssetShareItem> ls = new List<AssetShareItem>();
|
||||
foreach (AssetShareInfo item in assets)
|
||||
{
|
||||
AssetShareItem ai = new AssetShareItem();
|
||||
Helper.CloneProperty(ai, item);
|
||||
ls.Add(ai);
|
||||
}
|
||||
|
||||
return ls.ToArray();
|
||||
}
|
||||
else
|
||||
return new AssetShareItem[0];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddLog("ERROR", "ShareAssetBasePage.GetAssetShareInfos", ex.Message, ex.ToString());
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
private object GetShareAssetList()
|
||||
{
|
||||
try
|
||||
{
|
||||
var session = GetCurrentLoginSession();
|
||||
if (session != null)
|
||||
{
|
||||
|
||||
var clientdata = Request.Form["ClientData"];
|
||||
clientdata = HttpUtility.HtmlDecode(clientdata);
|
||||
ShareAssetQueryItem q = JsonConvert.DeserializeObject<ShareAssetQueryItem>(clientdata);
|
||||
if (string.IsNullOrEmpty(q.CustomerId))
|
||||
q.CustomerId = SystemParams.CompanyID;
|
||||
|
||||
ShareAssetItem[] assets = CreateClient<ShareAssetsProvider>(q.CustomerId).GetShareAssetList(q.CustomerId, q.Shared, q.OnRoad, q.IncludeHidden, q.Filter);
|
||||
List<ShareAssetInfo> ls = new List<ShareAssetInfo>();
|
||||
foreach (ShareAssetItem item in assets)
|
||||
{
|
||||
ShareAssetInfo ai = new ShareAssetInfo();
|
||||
Helper.CloneProperty(ai, item);
|
||||
if (ai.ShareInfo != null)
|
||||
{
|
||||
ai.ChildId = ai.ShareInfo.ChildId;
|
||||
ai.ChildName = ai.ShareInfo.ChildName;
|
||||
ai.StartDate = ai.ShareInfo.StartDate;
|
||||
ai.ExpectedRetrievalDate = ai.ShareInfo.ExpectedRetrievalDate;
|
||||
ai.RetrievalDate = ai.ShareInfo.RetrievalDate;
|
||||
}
|
||||
ls.Add(ai);
|
||||
}
|
||||
|
||||
return ls.OrderBy(a => a.VIN).ToArray();
|
||||
}
|
||||
else
|
||||
return new ShareAssetItem[0];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddLog("ERROR", "ShareAssetBasePage.GetShareAssetList", ex.Message, ex.ToString());
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
private object SaveShareAsset()
|
||||
{
|
||||
try
|
||||
{
|
||||
var session = GetCurrentLoginSession();
|
||||
if (session != null)
|
||||
{
|
||||
var clientdata = Request.Form["ClientData"];
|
||||
clientdata = HttpUtility.HtmlDecode(clientdata);
|
||||
var q = JsonConvert.DeserializeObject<SaveShareAssetParam>(clientdata);
|
||||
if (string.IsNullOrEmpty(q.CustomerId))
|
||||
q.CustomerId = SystemParams.CompanyID;
|
||||
|
||||
DateTime? expected = DateTime.TryParse(q.EndDate, out DateTime dt) ? dt : default(DateTime?);
|
||||
ShareAssetsProvider provider = CreateClient<ShareAssetsProvider>(q.CustomerId);
|
||||
string[] results = new string[q.SharedIds.Length];
|
||||
Task[] tasks = new Task[q.SharedIds.Length];
|
||||
for (var i = 0; i < tasks.Length; i++)
|
||||
{
|
||||
var index = i;
|
||||
var id = q.SharedIds[i];
|
||||
tasks[i] = Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
provider.SetShareAsset(q.CustomerId, new AssetShareInfo
|
||||
{
|
||||
ChildId = q.SharedWith,
|
||||
AssetId = id,
|
||||
ExpectedRetrievalDate = expected,
|
||||
HideAssetOnThisSite = q.HideAsset
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
results[index] = ex.Message;
|
||||
}
|
||||
});
|
||||
}
|
||||
Task.WaitAll(tasks);
|
||||
return results;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddLog("ERROR", "ShareAssetBasePage.SaveShareAsset", ex.Message, ex.ToString());
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
private object UnShareAsset()
|
||||
{
|
||||
try
|
||||
{
|
||||
var session = GetCurrentLoginSession();
|
||||
if (session != null)
|
||||
{
|
||||
var clientdata = Request.Form["ClientData"];
|
||||
clientdata = HttpUtility.HtmlDecode(clientdata);
|
||||
var q = JsonConvert.DeserializeObject<SaveShareAssetParam>(clientdata);
|
||||
if (string.IsNullOrEmpty(q.CustomerId))
|
||||
q.CustomerId = SystemParams.CompanyID;
|
||||
|
||||
ShareAssetsProvider provider = CreateClient<ShareAssetsProvider>(q.CustomerId);
|
||||
string[] results = new string[q.SharedIds.Length];
|
||||
Task[] tasks = new Task[q.SharedIds.Length];
|
||||
for (var i = 0; i < tasks.Length; i++)
|
||||
{
|
||||
var index = i;
|
||||
var id = q.SharedIds[i];
|
||||
tasks[i] = Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
provider.UnShareAsset(q.CustomerId, id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
results[index] = ex.Message;
|
||||
}
|
||||
});
|
||||
}
|
||||
Task.WaitAll(tasks);
|
||||
return results;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddLog("ERROR", "ShareAssetBasePage.UnShareAsset", ex.Message, ex.ToString());
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
private object SetShareWithCustomers()
|
||||
{
|
||||
try
|
||||
{
|
||||
var session = GetCurrentLoginSession();
|
||||
if (session != null)
|
||||
{
|
||||
var clientdata = Request.Form["ClientData"];
|
||||
clientdata = HttpUtility.HtmlDecode(clientdata);
|
||||
string[] ps = JsonConvert.DeserializeObject<string[]>(clientdata);
|
||||
var companyid = ps[0];
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
|
||||
string[] ids = JsonConvert.DeserializeObject<string[]>(ps[1]);
|
||||
string[] delids = JsonConvert.DeserializeObject<string[]>(ps[2]);
|
||||
|
||||
var client = CreateClient<ShareAssetsProvider>(companyid);
|
||||
client.SetSharableCustomers(companyid, ids, true);
|
||||
client.SetSharableCustomers(companyid, delids, false);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddLog("ERROR", "ShareAssetBasePage.SetShareWithCustomers", ex.Message, ex.ToString());
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
class ShareAssetInfo : ShareAssetItem
|
||||
{
|
||||
public string ChildId { get; set; }
|
||||
public string ChildName { get; set; }
|
||||
public DateTime? StartDate { get; set; }
|
||||
public DateTime? ExpectedRetrievalDate { get; set; }
|
||||
public DateTime? RetrievalDate { get; set; }
|
||||
public string StartDateStr { get { return Helper.IsNullDateTime(StartDate) ? "" : StartDate.Value.ToShortDateString(); } }
|
||||
public string ExpectedRetrievalDateStr { get { return Helper.IsNullDateTime(ExpectedRetrievalDate) ? "" : ExpectedRetrievalDate.Value.ToShortDateString(); } }
|
||||
public string RetrievalDateStr { get { return Helper.IsNullDateTime(RetrievalDate) ? "" : RetrievalDate.Value.ToShortDateString(); } }
|
||||
public double EngineHoursValue => EngineHours == null ? 0 : EngineHours.Value;
|
||||
}
|
||||
|
||||
class AssetShareItem : AssetShareInfo
|
||||
{
|
||||
public string StartDateStr { get { return Helper.IsNullDateTime(StartDate) ? "" : StartDate.Value.ToShortDateString(); } }
|
||||
public string ExpectedRetrievalDateStr { get { return Helper.IsNullDateTime(ExpectedRetrievalDate) ? "" : ExpectedRetrievalDate.Value.ToShortDateString(); } }
|
||||
public string RetrievalDateStr { get { return Helper.IsNullDateTime(RetrievalDate) ? "" : RetrievalDate.Value.ToShortDateString(); } }
|
||||
|
||||
}
|
||||
|
||||
class ShareAssetQueryItem
|
||||
{
|
||||
public string CustomerId { get; set; }
|
||||
public int Shared { get; set; }
|
||||
public int OnRoad { get; set; }
|
||||
public bool IncludeHidden { get; set; }
|
||||
public string Filter { get; set; }
|
||||
}
|
||||
|
||||
class SaveShareAssetParam
|
||||
{
|
||||
public string CustomerId { get; set; }
|
||||
public long[] SharedIds { get; set; }
|
||||
public string SharedWith { get; set; }
|
||||
public string EndDate { get; set; }
|
||||
public bool HideAsset { get; set; }
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user