| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 | using System;using System.Linq;using InABox.Core;namespace Comal.Classes{    public enum GPSLocationType    {        Office,        Job,        Supplier,        Employee    }        public interface IGeoFence    {        Guid ID { get; set; }        String Code { get; set; }        string Name { get; set; }        string Street { get; set; }        string City { get; set; }        string State { get; set; }        string Country { get; set; }        string PostCode { get; set; }        double Latitude { get; set; }        double Longitude { get; set; }        string Geofence { get; set; }        GPSLocationType Type { get; set; }    }        public class GeoFenceUnionGenerator : AutoEntityUnionGenerator<IGeoFence>    {        protected override void Configure()        {                        AddTable<CompanyInformation>()                .WithFilter(new Filter<CompanyInformation>(x=>x.DeliveryAddress.Geofence).IsNotEqualTo(""))                .AddConstant(x => x.Code, "OFFICE")                .AliasField(x => x.Name, x => x.CompanyName)                .AliasField(x => x.Street, x => x.DeliveryAddress.Street)                .AliasField(x => x.City, x => x.DeliveryAddress.City)                .AliasField(x => x.State, x => x.DeliveryAddress.State)                .AliasField(x => x.PostCode, x => x.DeliveryAddress.PostCode)                .AliasField(x => x.Latitude, x => x.DeliveryAddress.Location.Latitude)                .AliasField(x => x.Longitude, x => x.DeliveryAddress.Location.Longitude)                .AliasField(x => x.Geofence, x => x.DeliveryAddress.Geofence)                .AddConstant<GPSLocationType>(x=>x.Type,GPSLocationType.Office);                        AddTable<Job>()                .WithFilter(new Filter<Job>(x=>x.SiteAddress.Geofence).IsNotEqualTo("").And(X=>X.JobStatus.Active).IsEqualTo(true))                .AliasField(x => x.Code, x => x.JobNumber)                .AliasField(x => x.Name, x => x.Name)                .AliasField(x => x.Street, x => x.SiteAddress.Street)                .AliasField(x => x.City, x => x.SiteAddress.City)                .AliasField(x => x.State, x => x.SiteAddress.State)                .AliasField(x => x.PostCode, x => x.SiteAddress.PostCode)                .AliasField(x => x.Latitude, x => x.SiteAddress.Location.Latitude)                .AliasField(x => x.Longitude, x => x.SiteAddress.Location.Longitude)                .AliasField(x => x.Geofence, x => x.SiteAddress.Geofence)                .AddConstant<GPSLocationType>(x=>x.Type,GPSLocationType.Job);                        AddTable<Supplier>()                .WithFilter(new Filter<Supplier>(x=>x.Delivery.Geofence).IsNotEqualTo(""))                .AliasField(x => x.Code, x => x.Code)                .AliasField(x => x.Name, x => x.Name)                .AliasField(x => x.Street, x => x.Delivery.Street)                .AliasField(x => x.City, x => x.Delivery.City)                .AliasField(x => x.State, x => x.Delivery.State)                .AliasField(x => x.PostCode, x => x.Delivery.PostCode)                .AliasField(x => x.Latitude, x => x.Delivery.Location.Latitude)                .AliasField(x => x.Longitude, x => x.Delivery.Location.Longitude)                .AliasField(x => x.Geofence, x => x.Delivery.Geofence)                .AddConstant<GPSLocationType>(x=>x.Type,GPSLocationType.Supplier);                        AddTable<Employee>()                .WithFilter(new Filter<Employee>(x=>x.Address.Geofence).IsNotEqualTo(""))                .AliasField(x => x.Code, x => x.Code)                .AliasField(x => x.Name, x => x.Name)                .AliasField(x => x.Street, x => x.Address.Street)                .AliasField(x => x.City, x => x.Address.City)                .AliasField(x => x.State, x => x.Address.State)                .AliasField(x => x.PostCode, x => x.Address.PostCode)                .AliasField(x => x.Latitude, x => x.Address.Location.Latitude)                .AliasField(x => x.Longitude, x => x.Address.Location.Longitude)                .AliasField(x => x.Geofence, x => x.Address.Geofence)                .AddConstant<GPSLocationType>(x=>x.Type,GPSLocationType.Employee);        }        public override bool Distinct => true;                public override Column<IGeoFence>[] IDColumns => new Column<IGeoFence>[] { new Column<IGeoFence>(x=>x.ID) };    }    [UserTracking(typeof(GPSTrackerLocation))]    [AutoEntity(typeof(GeoFenceUnionGenerator))]    public class GeoFence : Entity, IRemotable, IPersistent, IGeoFence, ILicense<GPSTrackerLicense>    {        public string Code { get; set; }        public string Name { get; set; }        public string Street { get; set; }        public string City { get; set; }        public string State { get; set; }        public string Country { get; set; }        public string PostCode { get; set; }        public double Latitude { get; set; }        public double Longitude { get; set; }        public string Geofence { get; set; }        public GPSLocationType Type { get; set; }    }}
 |