コード例 #1
0
        public bool SaveObservationObject(ObservationObject observObject)
        {
            log.InfoEx($"SaveObservationObject START. observObject.ObjectId:{0}", observObject.ObjectId);
            bool result = true;

            try
            {
                var bdObservObject = context.VisiblilityObservationObjects.FirstOrDefault(p => p.OBJECTID == observObject.ObjectId);
                if (bdObservObject != null)
                {
                    bdObservObject.Update(observObject);
                    if (Submit())
                    {
                        log.InfoEx($"SaveObservationObject. Observation Point Row with ObjectId '{observObject.ObjectId}' was saved");
                    }
                }
            }
            catch (MilSpaceDataException ex)
            {
                log.WarnEx("SaveObservationObject MilSpaceDataException:{0}", ex.Message);
                if (ex.InnerException != null)
                {
                    log.WarnEx(ex.InnerException.Message);
                }

                result = false;
            }
            catch (Exception ex)
            {
                log.WarnEx($"SaveObservationObject Unexpected exception:{ex.Message}");
                result = false;
            }
            log.InfoEx($"SaveObservationObject END");
            return(result);
        }
コード例 #2
0
 public static bool SaveObservationObject(ObservationObject observationObject)
 {
     using (var accessor = new VisibilityDataAccess())
     {
         return(accessor.SaveObservationObject(observationObject));
     }
 }
コード例 #3
0
        public bool DeleteObservationObject(ObservationObject observObject)
        {
            bool result = true;

            try
            {
                var bdObservObject = context.VisiblilityObservationObjects.FirstOrDefault(p => p.OBJECTID == observObject.ObjectId);
                if (bdObservObject != null)
                {
                    context.VisiblilityObservationObjects.DeleteOnSubmit(bdObservObject);
                    if (Submit())
                    {
                        log.InfoEx($"Observation Point Row with ObjectId '{observObject.ObjectId}' was deleted");
                    }
                }
            }
            catch (MilSpaceDataException ex)
            {
                log.WarnEx(ex.Message);
                if (ex.InnerException != null)
                {
                    log.WarnEx(ex.InnerException.Message);
                }

                result = false;
            }
            catch (Exception ex)
            {
                log.WarnEx($"Unexpected exception:{ex.Message}");
                result = false;
            }
            return(result);
        }
コード例 #4
0
 public static bool DeleteObservationObject(ObservationObject observObject)
 {
     using (var accessor = new VisibilityDataAccess())
     {
         var res = accessor.DeleteObservationObject(observObject);
         return(res);
     }
 }