using Foresight.Fleet.Services.Asset; using Foresight.ServiceModel; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IronIntel.Contractor.Machines { public class AssetBasicItem { 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 { get { return _EngineHours; } set { value = value > 0 ? value : 0; _EngineHours = Math.Round(value, 2); } } public string CalampDeviceAirID { get; set; }//PairedDeviceSN public bool TelematicsEnabled { get; set; } public bool Hide { get; set; } public bool OnRoad { get; set; } public bool Attachment { get; set; } public bool Preloaded { 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 AssetShareStatus ShareStatus { get; set; } public DateTime? AddedTime { get; set; } public DateTime? AddedLocalTime { get; set; } public double Odometer; public string OdometerUOM { get; set; } public DateTime? OdometerDate { get; set; } public string Description { get; set; } public string AcquisitionType { get; set; } public string PMPlans { get; set; } public string AssetGroups { get; set; } public string Jobsites { get; set; } public AssetCustomStatus CustomStatus { 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; } } 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 class AssetDetailItem2 { public bool IgnoreDuplicate { get; set; }//忽略重复 public long ID { get; set; } public string Name { get; set; } public string Name2 { get; set; } public string VIN { get; set; } public int MakeID { get; set; } public string MakeName { get; set; } public int ModelID { get; set; } public string ModelName { get; set; } public int TypeID { get; set; } public string TypeName { get; set; } public int MakeYear { get; set; } private double? _EngineHours; public double? EngineHours { get { return _EngineHours; } set { if (value != null) _EngineHours = Math.Round(value.Value, 2); else _EngineHours = value; } } public DateTime? EngineHoursLocalTime { get; set; } private double? _Odometer; public double? Odometer { get { return _Odometer; } set { if (value != null) _Odometer = Math.Round(value.Value, 2); else _Odometer = value; } } public DateTime? OdometerLocalTime { get; set; } public string OdometerUnits { get; set; } public string Description { get; set; } public string PairedDeviceSN { get; set; } public double? UnderCarriageHours { get; set; } 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; } public DateTime? AddedLocalTime { get; set; } public DateTime? AddedTime { get; set; } public string AddedByUserName { get; set; } public string IconFileName { get; set; } public string ContractorID { get; set; } public string[] OnSiteJobsiteIDs { get; set; } public List 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"); } } public string EngineHoursDateTimeStr { get { return EngineHoursLocalTime == null ? "" : EngineHoursLocalTime.Value.ToString("MM/dd/yyyy"); } } public string OdometerDateTimeStr { get { return OdometerLocalTime == null ? "" : OdometerLocalTime.Value.ToString("MM/dd/yyyy"); } } } public class MachineItem { public Int64 MachineID { get; set; } public int TypeID { get; set; } public string MachineType { get; set; } public int ModelID { get; set; } public string Model { get; set; } public int MakeID { get; set; } public string Make { get; set; } public string MakeIconColor { get; set; } public string VIN { get; set; } public string Name { get; set; } public string Name2 { get; set; } public int MakeYear { get; set; } public string Notes { get; set; } public string ContractorID { get; set; } public string Contractor { get; set; } public string DealerID { get; set; } public string Dealer { get; set; } public int Status { get; set; } public Int64 GpsDeviceID { get; set; } //空 -1 public string GpsDeviceSN { get; set; } = string.Empty; //空 -1 public double StartingEngineHours { 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 string EngineHoursDateStr { get { return EngineHoursDate == DateTime.MinValue ? "" : EngineHoursDate.ToShortDateString(); } } public string EngineHoursDateTimeStr { get { return EngineHoursDate == DateTime.MinValue ? "" : EngineHoursDate.ToString(); } } public bool Hide { get; set; } public double ODOStart2 { get; set; } private double _ODOMeter; public double ODOMeter { get { return _ODOMeter; } set { value = value > 0 ? value : 0; _ODOMeter = Math.Round(value, 2); } } public DateTime ODOMeterDate { get; set; } public string ODOMeterDateStr { get { return ODOMeterDate == DateTime.MinValue ? "" : ODOMeterDate.ToShortDateString(); } } public string ODOMeterDateTimeStr { get { return ODOMeterDate == DateTime.MinValue ? "" : ODOMeterDate.ToString(); } } public string ODOMeterUom { get; set; } public double FuelCost { get; set; } public string FuelCostUom { get; set; } public double MachineRate { get; set; } public string WorkType { get; set; } public double RetirementHours { get; set; } public double RetirementOdo { get; set; } public bool OnRoad { get; set; } public DateTime LeaseStart { get; set; } public string LeaseStartStr { get { return LeaseStart == DateTime.MinValue ? "" : LeaseStart.ToShortDateString(); } } public DateTime LeaseEnd { get; set; } public string LeaseEndStr { get { return LeaseEnd == DateTime.MinValue ? "" : LeaseEnd.ToShortDateString(); } } public double LeaseTerm { get; set; } public double UndercarriageHours { get; set; } public string AquisitionType { get; set; } public int OnSiteJobsiteID { get; set; } public string[] ContactIDs { get; set; } public MachineAttributeClient[] MachineAttributes { get; set; } public string MachineIconFileName { get; set; } public string DistanceCalcBy { get; set; } public bool TelematicsEnabled { get; set; } public string CostCenter { get; set; } public string EqClass { get; set; } public string Description { get; set; } public string[] MachineGroupIDs { get; set; } public MachineRentalInfo MachineRental { get; set; } public StringKeyValue[] VisibleOnWorkOrders { get; set; } public DateTime AddedOn { get; set; } public string AddedOnStr { get { return AddedOn == DateTime.MinValue ? "" : AddedOn.ToShortDateString(); } } public string AddedBy { get; set; } public string AddedByName { get; set; } public string DisplayName { 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 = MachineID.ToString(); return name; } }//由于地图显示及排序的名称 } public class DeviceItem { public string ContractorID { get; set; } public string DeviceType { get; set; } public int Status { get; set; } public string Notes { get; set; } public DateTime? ServiceStartDate { get; set; } public DateTime? InvoiceDate { get; set; } public DateTime? AddLocalDate { get; set; } public DateTime? AddDate { get; set; } public string InvoiceNumber { get; set; } public PairedAssetItem PairedAsset { get; set; } public string SourceName { get; set; } public string Source { get; set; } public string SourceDeviceId { get; set; } public string AlternativeSerialNumber { get; set; } public string SerialNumber { get; set; } 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("yyyy-MM-dd"); } } 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("yyyy-MM-dd"); } } } public class PairedAssetItem { public long Id { get; set; } public string VIN { get; set; } public string Name { get; set; } public int Year { get; set; } public string MakeName { get; set; } public string ModelName { get; set; } public string TypeName { get; set; } public double? EngineHours { get; set; } public DateTime? EngineHoursDate { get; set; } public DateTime? EngineHoursLocalDate { get; set; } public string EngineHoursDateStr { get { return EngineHoursLocalDate == null ? "" : EngineHoursLocalDate.Value.ToString("M/d/yyyy"); } } } public class CommentItem : Foresight.Fleet.Services.CommentInfo { public string SubmitDateStr { get { return SubmitLocalDate == DateTime.MinValue ? "" : SubmitLocalDate.ToString("M/d/yyyy h:m 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:m:s tt"); } } } public class MachineGroup { public string GroupID { get; set; } public string GroupName { get; set; } public string Description { get; set; } public string Code { get; set; } public long[] MachineIDs { get; set; } } public class AssetMakeItem { public int ID { get; set; } public string Name { get; set; } public string IconColor { get; set; } public string AlterActiveName { get; set; } public string AddedBy { get; set; }//companyid public DateTime AddedDate { get; set; } public string Synonyms { get; set; } public bool CanEdit { get { return SystemParams.CompanyID.Equals(AddedBy, StringComparison.OrdinalIgnoreCase); } } } public class AssetModelItem { public int ID { get; set; } public string Name { get; set; } public string AddedBy { get; set; }//companyid public int MakeID { get; set; } public string MakeName { get; set; } public int TypeID { get; set; } public string TypeName { get; set; } public string Synonyms { get; set; } public bool CanEdit { get { return SystemParams.CompanyID.Equals(AddedBy, StringComparison.OrdinalIgnoreCase); } } } public class MachineAttributeCategoryClient { public string Name { get; set; } public string DisplayText { get; set; } public int TabID { get; set; } public string TabName { get; set; } public int OrderIndex { get; set; } public List MachineAttributes { get; set; } } public class MachineAttributeClient { public int ID { get; set; } public string DisplayText { get; set; } public string Format { get; set; } public string Description { get; set; } public MachineAttributeDataTypes DataType { get; set; } public bool Multiline { get; set; } public int Length { get; set; } public int Precision { get; set; } public string Value { get; set; } public bool Dropdown { get; set; } public string DataSource { get; set; } } public class AssetAttachmentItem { 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 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; } } }