private VMapElementModelByBind ConvertEMapAreaForBind(EMapArea entity) { return new VMapElementModelByBind() { RecordID = entity.RecordID.ToString(), Name = entity.Name, Description = entity.Description, MarkType = VMapElementModelByBind.Area_Type, Points = entity.Points, CreateDate = entity.CreateTime, Zoom = entity.Zoom }; }
public VAreaElement AddArea(VAreaElement model) { EMapArea entity = new EMapArea(); bool isExists = DACFacade.Gps.MapAreaDAC.Select(model.Name, model.TenantCode) == null ? false : true; if (isExists) { model.Msg = "exist"; return model; } entity.RecordID = Guid.NewGuid().ToString(); entity.Description = model.Description; entity.Name = model.Name; entity.Type = model.Type; entity.Zoom = model.Zoom; entity.CreateTime = DateTime.Now; entity.UserCode = ulong.Parse(model.UserCode); entity.TenantCode = ulong.Parse(model.TenantCode); entity.Points = model.Points; IList<LatLon> latlon = LatLon.ConvertToLatLon(model.Points); latlon = LatLonModel.GeRealLatLon(latlon, model.MapType); entity.Points = LatLon.ToParasString(latlon.ToArray()); entity.Acreage = model.Acreage; entity.BorderColor = model.BorderColor; entity.Length = model.Length; entity.Width = model.Width; entity.ShapeType = model.ShapeType; int result = DACFacade.Gps.MapAreaDAC.Insert(null, entity); VAreaElement viewResult = ConvertAreaElementEntityToViewModel(entity, model.MapType); viewResult.IsLcosuArea = model.IsLcosuArea; return viewResult; }
private VAreaElement ConvertAreaElementEntityToViewModel(EMapArea entity, EnumMapType mapType) { VAreaElement returnValue = new VAreaElement(); returnValue.RecordID = entity.RecordID.ToString(); returnValue.Name = entity.Name; returnValue.UserCode = entity.UserCode.ToString(); returnValue.TenantCode = entity.TenantCode.ToString(); returnValue.Description = entity.Description; returnValue.Type = entity.Type; returnValue.Points = entity.Points; returnValue.Acreage = entity.Acreage; returnValue.ShapeType = entity.ShapeType; returnValue.BorderColor = entity.BorderColor; returnValue.Length = entity.Length; returnValue.Width = entity.Width; returnValue.Radius = entity.Radius; returnValue.Zoom = entity.Zoom; return returnValue; }