public ActionResult AddMediaItem(int id)
        {
            var cpManager = new API.Common.POIManager();
            var poi = cpManager.Get(id, true);

            return View(poi);
        }
Exemple #2
0
        public ActionResult AddMediaItem(int id)
        {
            var cpManager = new API.Common.POIManager();
            var poi       = cpManager.Get(id, true);

            return(View(poi));
        }
        public async Task <ActionResult> AddMediaItem(int id)
        {
            ViewBag.IsReadOnlyMode = this.IsReadOnlyMode;

            var cpManager = new API.Common.POIManager();
            var poi       = await cpManager.Get(id, true);

            return(View(poi));
        }
        public ActionResult AddComment(int id)
        {
            var cpManager = new API.Common.POIManager();
            var poi = cpManager.Get(id, true);

            POIViewModel viewModel = new POIViewModel();
            viewModel.NewComment = new UserComment() { ChargePointID = poi.ID, CommentType = new UserCommentType { ID = 10 }, CheckinStatusType = new CheckinStatusType { ID = 0 } };
            viewModel.POI = poi;

            ViewBag.ReferenceData = new POIBrowseModel();

            return View(viewModel);
        }
Exemple #5
0
        public ActionResult AddComment(int id)
        {
            var cpManager = new API.Common.POIManager();
            var poi       = cpManager.Get(id, true);

            POIViewModel viewModel = new POIViewModel();

            viewModel.NewComment = new UserComment()
            {
                ChargePointID = poi.ID, CommentType = new UserCommentType {
                    ID = 10
                }, CheckinStatusType = new CheckinStatusType {
                    ID = 0
                }
            };
            viewModel.POI = poi;

            ViewBag.ReferenceData = new POIBrowseModel();

            return(View(viewModel));
        }
        public async Task <ActionResult> AddComment(int id)
        {
            ViewBag.IsReadOnlyMode = this.IsReadOnlyMode;

            var cpManager = new API.Common.POIManager();
            var poi       = await cpManager.Get(id, true);

            POIViewModel viewModel = new POIViewModel();

            viewModel.NewComment = new UserComment()
            {
                ChargePointID = poi.ID, CommentType = new UserCommentType {
                    ID = 10
                }, CheckinStatusType = new CheckinStatusType {
                    ID = 0
                }
            };
            viewModel.POI = poi;

            ViewBag.ReferenceData = new POIBrowseModel(GetCoreReferenceData());

            return(View(viewModel));
        }
        // GET: /POI/Details/5

        //[OutputCache(Duration=240, VaryByParam="id")]
        public async Task <ActionResult> Details(int id = 0, string layout = null, string status = null)
        {
            if (id <= 0)
            {
                return(RedirectToAction("Index"));
            }

            if (status != null)
            {
                ViewBag.Status = status;
            }

            OCM.API.Common.POIManager cpManager = new API.Common.POIManager();
            POIViewModel viewModel = new POIViewModel();

            var poi = await cpManager.Get(id, true, allowDiskCache : false, allowMirrorDB : true);

            if (poi != null)
            {
                ViewBag.FullTitle = "Location Details: OCM-" + poi.ID + " " + poi.AddressInfo.Title;

                List <LocationImage> imageList = null; // new OCM.MVC.App_Code.GeocodingHelper().GetGeneralLocationImages((double)poi.AddressInfo.Latitude, (double)poi.AddressInfo.Longitude);

                if (imageList != null)
                {
                    imageList         = imageList.Where(i => i.Width >= 500).ToList();
                    ViewBag.ImageList = imageList.ToList();
                }

                viewModel.POI = poi;

                if (!IsRequestByRobot)
                {
                    viewModel.NewComment = new UserComment()
                    {
                        ChargePointID = poi.ID, CommentType = new UserCommentType {
                            ID = 10
                        }, CheckinStatusType = new CheckinStatusType {
                            ID = 0
                        }
                    };

                    System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
                    sw.Start();
                    viewModel.POIListNearby = (await cpManager.GetPOIListAsync(new APIRequestParams {
                        MaxResults = 10, Latitude = poi.AddressInfo.Latitude, Longitude = poi.AddressInfo.Longitude, Distance = 15, DistanceUnit = DistanceUnit.Miles, AllowMirrorDB = true
                    })).ToList();
                    viewModel.POIListNearby.RemoveAll(p => p.ID == poi.ID); //don't include the current item in nearby POI list
                    sw.Stop();
                    System.Diagnostics.Debug.WriteLine(sw.ElapsedMilliseconds);

                    ViewBag.ReferenceData = new POIBrowseModel(await GetCoreReferenceDataAsync());

                    //get data quality report

                    //if (IsUserAdmin)
                    //{
                    viewModel.DataQualityReport = new DataAnalysisManager().GetDataQualityReport(poi);
                    //}

                    ViewBag.UserCanEditPOI = false;
                    if (IsUserSignedIn)
                    {
                        var user = new UserManager().GetUser((int)UserID);
                        if (POIManager.CanUserEditPOI(poi, user))
                        {
                            ViewBag.UserCanEditPOI = true;
                        }
                    }
                }
                else
                {
                    viewModel.POIListNearby = new List <ChargePoint>();
                }
            }

            return(View(viewModel));
        }
        //
        // GET: /POI/Details/5
        //[OutputCache(Duration=240, VaryByParam="id")]
        public ActionResult Details(int id = 0, string layout = null, string status = null)
        {
            if (id <= 0) return RedirectToAction("Index");

            if (status != null) ViewBag.Status = status;

            OCM.API.Common.POIManager cpManager = new API.Common.POIManager();
            POIViewModel viewModel = new POIViewModel();

            var poi = cpManager.Get(id, true, allowDiskCache: false, allowMirrorDB: true);
            if (poi != null)
            {
                ViewBag.FullTitle = "Location Details: OCM-" + poi.ID + " " + poi.AddressInfo.Title;

                List<LocationImage> imageList = null; // new OCM.MVC.App_Code.GeocodingHelper().GetGeneralLocationImages((double)poi.AddressInfo.Latitude, (double)poi.AddressInfo.Longitude);

                if (imageList != null)
                {
                    imageList = imageList.Where(i => i.Width >= 500).ToList();
                    ViewBag.ImageList = imageList.ToList();
                }

                viewModel.POI = poi;

                if (!IsRequestByRobot)
                {
                    viewModel.NewComment = new UserComment() { ChargePointID = poi.ID, CommentType = new UserCommentType { ID = 10 }, CheckinStatusType = new CheckinStatusType { ID = 0 } };

                    System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
                    sw.Start();
                    viewModel.POIListNearby = cpManager.GetChargePoints(new APIRequestParams { MaxResults = 10, Latitude = poi.AddressInfo.Latitude, Longitude = poi.AddressInfo.Longitude, Distance = 15, DistanceUnit = DistanceUnit.Miles, AllowMirrorDB = true });
                    viewModel.POIListNearby.RemoveAll(p => p.ID == poi.ID); //don't include the current item in nearby POI list
                    sw.Stop();
                    System.Diagnostics.Debug.WriteLine(sw.ElapsedMilliseconds);

                    ViewBag.ReferenceData = new POIBrowseModel();

                    //get data quality report

                    //if (IsUserAdmin)
                    //{
                    viewModel.DataQualityReport = new DataAnalysisManager().GetDataQualityReport(poi);
                    //}
                }
                else
                {
                    viewModel.POIListNearby = new List<ChargePoint>();
                }
            }

            if (layout == "simple")
            {
                ViewBag.EnableSimpleView = true;
                return View("Details", "_SimpleLayout", viewModel);
            }
            else
            {
                return View(viewModel);
            }
        }
Exemple #9
0
        //
        // GET: /POI/Details/5

        //[OutputCache(Duration=240, VaryByParam="id")]
        public ActionResult Details(int id = 0, string layout = null, string status = null)
        {
            if (id <= 0)
            {
                return(RedirectToAction("Index"));
            }

            if (status != null)
            {
                ViewBag.Status = status;
            }

            OCM.API.Common.POIManager cpManager = new API.Common.POIManager();

            var poi = cpManager.Get(id, true, allowDiskCache: false, allowMirrorDB: true);

            ViewBag.FullTitle = "Location Details: OCM-" + poi.ID + " " + poi.AddressInfo.Title;

            List <LocationImage> imageList = null; // new OCM.MVC.App_Code.GeocodingHelper().GetGeneralLocationImages((double)poi.AddressInfo.Latitude, (double)poi.AddressInfo.Longitude);

            if (imageList != null)
            {
                imageList         = imageList.Where(i => i.Width >= 500).ToList();
                ViewBag.ImageList = imageList.ToList();
            }

            POIViewModel viewModel = new POIViewModel();

            viewModel.POI = poi;

            if (!IsRequestByRobot)
            {
                viewModel.NewComment = new UserComment()
                {
                    ChargePointID = poi.ID, CommentType = new UserCommentType {
                        ID = 10
                    }, CheckinStatusType = new CheckinStatusType {
                        ID = 0
                    }
                };

                System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
                sw.Start();
                viewModel.POIListNearby = cpManager.GetChargePoints(new APIRequestSettings {
                    MaxResults = 10, Latitude = poi.AddressInfo.Latitude, Longitude = poi.AddressInfo.Longitude, Distance = 15, DistanceUnit = DistanceUnit.Miles, AllowMirrorDB = true
                });
                viewModel.POIListNearby.RemoveAll(p => p.ID == poi.ID); //don't include the current item in nearby POI list
                sw.Stop();
                System.Diagnostics.Debug.WriteLine(sw.ElapsedMilliseconds);

                ViewBag.ReferenceData = new POIBrowseModel();
            }
            else
            {
                viewModel.POIListNearby = new List <ChargePoint>();
            }

            if (layout == "simple")
            {
                ViewBag.EnableSimpleView = true;
                return(View("Details", "_SimpleLayout", viewModel));
            }
            else
            {
                return(View(viewModel));
            }
        }