Exemple #1
0
        //-----------------------------------------------------------------------------------------------------------

        private Orchestrator.WebUI.Services.Point GetPointForWebService(int pointID)
        {
            Orchestrator.Facade.IPoint        facPoint      = new Orchestrator.Facade.Point();
            Orchestrator.Entities.Point       selectedPoint = facPoint.GetPointForPointId(pointID);
            Orchestrator.WebUI.Services.Point p             = new Orchestrator.WebUI.Services.Point();

            p.PointID     = selectedPoint.PointId;
            p.Description = selectedPoint.Description;
            p.Latitide    = (double)selectedPoint.Latitude;
            p.Latitude    = (double)selectedPoint.Latitude; // added a correctly spelt version but left the old one to prevent having to change everything.

            p.Longitude          = (double)selectedPoint.Longitude;
            p.ClosestTownID      = selectedPoint.PostTown.TownId;
            p.ClosestTown        = selectedPoint.PostTown.TownName;
            p.IdentityID         = selectedPoint.IdentityId;
            p.OrganisationName   = selectedPoint.OrganisationName;
            p.PointNotes         = selectedPoint.PointNotes;
            p.PointCode          = selectedPoint.PointCode;
            p.PhoneNumber        = selectedPoint.PhoneNumber;
            p.AddressID          = selectedPoint.Address.AddressId;
            p.AddressLine1       = selectedPoint.Address.AddressLine1;
            p.AddressLine2       = selectedPoint.Address.AddressLine2;
            p.AddressLine3       = selectedPoint.Address.AddressLine3;
            p.PostTown           = selectedPoint.Address.PostTown;
            p.County             = selectedPoint.Address.County;
            p.PostCode           = selectedPoint.Address.PostCode;
            p.CountryID          = selectedPoint.Address.CountryId;
            p.CountryDescription = selectedPoint.Address.CountryDescription;

            p.GeofencePoints = new List <LatLong>();

            string points = string.Empty;

            for (int i = 0; i < selectedPoint.Geofence.STNumPoints(); i++)
            {
                SqlGeography point  = selectedPoint.Geofence.STPointN(i + 1);
                LatLong      latLon = new LatLong()
                {
                    Latitude = (double)point.Lat, Longitude = (double)point.Long
                };
                p.GeofencePoints.Add(latLon);
            }

            return(p);
        }
Exemple #2
0
        public Orchestrator.WebUI.Services.Point UpdatePoint(Orchestrator.WebUI.Services.Point p, string userId)
        {
            Orchestrator.WebUI.Services.Point returnPoint   = null;
            Orchestrator.Facade.IPoint        facPoint      = new Orchestrator.Facade.Point();
            Orchestrator.Entities.Point       selectedPoint = facPoint.GetPointForPointId(p.PointID);
            selectedPoint.Description                = p.Description;
            selectedPoint.Latitude                   = (decimal)p.Latitide;
            selectedPoint.Longitude                  = (decimal)p.Longitude;
            selectedPoint.PostTown.TownId            = p.ClosestTownID;
            selectedPoint.PostTown.TownName          = p.ClosestTown;
            selectedPoint.PointNotes                 = p.PointNotes;
            selectedPoint.PointCode                  = p.PointCode;
            selectedPoint.PhoneNumber                = p.PhoneNumber;
            selectedPoint.Address.AddressLine1       = p.AddressLine1;
            selectedPoint.Address.AddressLine2       = p.AddressLine2;
            selectedPoint.Address.AddressLine3       = p.AddressLine3;
            selectedPoint.Address.PostTown           = p.PostTown;
            selectedPoint.Address.County             = p.County;
            selectedPoint.Address.PostCode           = p.PostCode;
            selectedPoint.Address.CountryId          = p.CountryID;
            selectedPoint.Address.CountryDescription = p.CountryDescription;

            Entities.FacadeResult facResult = facPoint.Update(selectedPoint, userId);

            if (facResult.Success)
            {
                returnPoint = this.GetPointForWebService(selectedPoint.PointId);
            }
            else
            {
                foreach (BusinessRuleInfringement i in facResult.Infringements)
                {
                    p.ErrorMeesage += String.Format("{0} : {1}{2}", i.Key, i.Description, Environment.NewLine);
                }

                returnPoint = p;
            }

            return(returnPoint);
        }
Exemple #3
0
        public Orchestrator.WebUI.Services.Point GetPoint(int pointID)
        {
            Orchestrator.WebUI.Services.Point p = this.GetPointForWebService(pointID);

            return(p);
        }