コード例 #1
0
        internal static LocationVm MapToLocationVm(this Location location)
        {
            double?    nullable1;
            double?    nullable2;
            double?    nullable;
            LocationVm locationVm = new LocationVm();

            if (location.Latitude.CompareTo(0) != 0)
            {
                nullable1 = new double?(location.Latitude);
            }
            else
            {
                nullable  = null;
                nullable1 = nullable;
            }
            locationVm.Latitude = nullable1;
            if (location.Longitude.CompareTo(0) != 0)
            {
                nullable2 = new double?(location.Longitude);
            }
            else
            {
                nullable  = null;
                nullable2 = nullable;
            }
            locationVm.Longitude = nullable2;
            return(locationVm);
        }
コード例 #2
0
        private List <LocationVm> SaveLocationOnFirstSave(OrganizationVm organization)
        {
            ICollection <Location> locationsModel = new List <Location>();
            LocationVm             vm             = new LocationVm {
                Address = organization.ContactInformation
            };

            {
                locationsModel.Add(vm.ToModel());
            }
            try
            {
                this.organizationService.SaveLocations(organization.Id, locationsModel);

                List <LocationVm> responseModel = new List <LocationVm>();

                foreach (Location m in locationsModel)
                {
                    responseModel.Add(LocationVm.FromModel(m));
                }
                return(responseModel);
            }
            catch (Exception e)
            {
                emailHelper.SendErrorEmail(e);
            }
            return(null);
        }
コード例 #3
0
        // PUT api/organization/5/locations
        public HttpResponseMessage Put(int id, ICollection <LocationVm> value)
        {
            this.OrganizationId = id;
            if (!this.UserIsAdminOfOrganization)
            {
                Request.CreateResponse(HttpStatusCode.Unauthorized);
            }
            var model = new Organization();

            ICollection <Location> locationsModel = new List <Location>();

            foreach (LocationVm vm in value)
            {
                locationsModel.Add(vm.ToModel());
            }
            try
            {
                this.organizationService.SaveLocations(id, locationsModel);

                List <LocationVm> responseModel = new List <LocationVm>();

                foreach (Location m in locationsModel)
                {
                    responseModel.Add(LocationVm.FromModel(m));
                }
                return(Request.CreateResponse(HttpStatusCode.Accepted, responseModel));
            }
            catch (Exception e)
            {
                emailHelper.SendErrorEmail(e);
            }
            return(Request.CreateResponse(HttpStatusCode.BadRequest));
        }
コード例 #4
0
        // GET: Location
        public ActionResult Index()
        {
            LocationVm locationVm = new LocationVm();

            locationVm.Projects = repository.GetProjects();
            locationVm.Cities   = repository.GetAllCities();
            return(View("AddProject", locationVm));
        }
コード例 #5
0
        public ActionResult AddPhase()
        {
            LocationVm locationVm = new LocationVm();

            locationVm.Cities   = repository.GetAllCities();
            locationVm.Projects = repository.GetProjects();
            locationVm.Phase    = repository.GetPhases();
            return(View(locationVm));
        }
コード例 #6
0
        public ActionResult create_leads()
        {
            ViewBag.Message = "Your application description page.";
            LocationVm locationVm = new LocationVm();

            locationVm.Cities   = repository.GetAllCities();
            locationVm.Projects = repository.GetProjects();
            locationVm.Phase    = repository.GetPhases();
            locationVm.Blocks   = repository.GetBlocks();
            return(View(locationVm));
        }
コード例 #7
0
 public LocationVm UpdateLocationGeofence([FromBody] LocationVm location)
 {
     return(GetBusinessLayerProxy(User).UpdateLocationGeofence(location));
 }
コード例 #8
0
        public HttpResponseMessage Get([FromUri] LocationVm param)
        {
            var data = db.GetLocations(param.CompCode, param.CentCode, param.LocCode, param.LocName, param.Extra1, param.Extra2, param.Extra3).ToList();

            return(Request.CreateResponse(new ResponseData(data)));
        }