Exemplo n.º 1
0
        public JsonResult UpdateMark(string id, string name, string description, int mapType)
        {
            AjaxResult ar = new AjaxResult();
            try
            {
                VMarkElement mark = new VMarkElement();

                if (this.SelectedUser == null)
                {
                    mark.Msg = "error";
                    return Json(mark, null, Encoding.UTF8, JsonRequestBehavior.AllowGet);
                }

                mark.RecordID = id;
                mark.Name = name;
                mark.Description = description;
                mark.MapType = (EnumMapType)mapType;
                mark.TenantCode = this.SelectedUser.TenantCode;
                var res = ModelFacade.Position.PositionModel.UpdateMark(mark);
                ar.State = AjaxResultState.Success;
                ar.Data = res;
                return Json(ar, null, Encoding.UTF8, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                ar.State = AjaxResultState.Error;
                ar.Message = ex.Message;
                return Json(ar, JsonRequestBehavior.AllowGet);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 新增标注
        /// </summary>
        public JsonResult CreateMark(string name, string description, string lon, string lat, string zoom, string encodeLatLon, int mapType)
        {
            AjaxResult ar = new AjaxResult();
            try
            {
                VMarkElement markPoint = new VMarkElement();

                if (this.SelectedUser == null)
                {
                    markPoint.Msg = "error";
                    return Json(markPoint, null, Encoding.UTF8, JsonRequestBehavior.AllowGet);
                }

                markPoint.Name = name;
                markPoint.Description = description;
                markPoint.Lat = Convert.ToDouble(lat);
                markPoint.Lon = Convert.ToDouble(lon);
                markPoint.Zoom = Convert.ToInt32(zoom);
                markPoint.EncodeLatLon = encodeLatLon;
                markPoint.MapType = (EnumMapType)mapType;
                markPoint.TenantCode = this.SelectedUser.TenantCode;
                markPoint.UserCode = this.SelectedUser.UserCode;

                var res = ModelFacade.Position.PositionModel.AddMarker(markPoint);
                ar.State = AjaxResultState.Success;
                ar.Data = res;
                return Json(ar, null, Encoding.UTF8, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                ar.State = AjaxResultState.Error;
                ar.Message = ex.Message;
                return Json(ar, JsonRequestBehavior.AllowGet);
            }
        }
Exemplo n.º 3
0
        private VMarkElement ConvertMarkElementEntityToViewModel(EMapMark entity, EnumMapType mapType)
        {
            VMarkElement returnValue = new VMarkElement();
            returnValue.RecordID = entity.RecordID.ToString();
            returnValue.Name = entity.Name;
            returnValue.TenantCode = entity.TenantCode;
            returnValue.UserCode = entity.UserCode;
            returnValue.Description = entity.Description;
            returnValue.Type = entity.Type;
            returnValue.Zoom = entity.Zoom;
            returnValue.Lon = entity.Longitude;
            returnValue.Lat = entity.Latitude;
            returnValue.EncodeLatLon = new PES.GPSExpressEdition.MapService.MapSearchService.MapService().Encode(returnValue.Lat.ToString(), returnValue.Lon.ToString());

            return returnValue;
        }
Exemplo n.º 4
0
        public VMarkElement AddMarker(VMarkElement model)
        {
            EMapMark entity = new EMapMark();
            entity.RecordID = Guid.NewGuid();
            entity.Description = model.Description;
            entity.Latitude = model.Lat;
            entity.Longitude = model.Lon;
            entity.Latlonencode = model.EncodeLatLon;
            entity.Name = model.Name;
            entity.Type = model.Type;
            entity.Zoom = model.Zoom;
            entity.UserCode = model.UserCode;
            entity.TenantCode = model.TenantCode;
            entity.CreateTime = DateTime.Now;

            bool isExists = DACFacade.Gps.MapMarkDAC.Select(model.Name, model.TenantCode) == null ? false : true;
            if (isExists)
            {
                model.Name = string.Empty;
                model.Description = string.Empty;
                model.Msg = "exist";
                return model;
            }

            if (model.MapType == EnumMapType.GoogleCN)
            {
                LatLonModel.ConvertToRealLatLon<EMapMark>(entity, model.MapType);
            }

            int result = DACFacade.Gps.MapMarkDAC.Insert(null, entity);
            model.RecordID = entity.RecordID.ToString();

            return model;
        }
Exemplo n.º 5
0
        public VMarkElement UpdateMark(VMarkElement model)
        {
            VMarkElement returnValue = new VMarkElement();
            EMapMark entity = DACFacade.Gps.MapMarkDAC.Select(model.RecordID);
            entity.Name = model.Name;
            entity.Description = model.Description;
            bool isExists = DACFacade.Gps.MapMarkDAC.Select(entity.Name, entity.TenantCode) == null ? false : true;
            if (!isExists)
            {
                DACFacade.Gps.MapMarkDAC.Update(null, entity);
                returnValue = ConvertMarkElementEntityToViewModel(entity, model.MapType);
            }
            else
            {
                returnValue.Msg = "exist";
            }

            return returnValue;
        }