2023-04-28 12:21:24 +08:00

143 lines
6.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Foresight.Fleet.Services.AssetHealth.WorkOrder;
using Foresight.Fleet.Services.Customer;
using Foresight.ServiceModel;
using IronIntel.Contractor.Users;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IronIntel.Contractor.Maintenance
{
public class WorkOrderInfoClient : WorkOrderInfo
{
public string AssetName { get; set; }
public string VIN { 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 string CompleteDateStr { get { return CompleteDate == null ? "" : CompleteDate.Value.ToShortDateString(); } }
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 ContactInfoClient : ContactInfo
{
public string ContactPreferenceStr { get; set; }
public int SaveToCustomer { get; set; }
}
public class WorkOrderListItemClient : WorkOrderListItem
{
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
{
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 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.PreparePhonenumber(p.CustomerNumber);
ls.Add(p.CustomerNumber);
}
}
}
return ls.ToArray();
}
}
public string TimeStr { get { return Time == DateTime.MinValue ? "" : Time.ToString("M/d/yyyy h:m tt"); } }
}
}