Ejemplo n.º 1
0
        public bool EtlToShapes()
        {
            var context = new RuleTestEntities();
            try
            {

                    var listForInsert = context.massinserts.Where(x => x.is_valid == 0).ToList();
                    foreach (var massinsert in listForInsert)
                    {
                        var result = ValidateAndInsert(massinsert.shape);
                        if (result)
                        {
                            massinsert.is_valid = 1;
                            context.SaveChanges();
                        }
                    }

            }
            catch (Exception exc)
            {
                log.Error(exc);
                return false;
            }
            return true;
        }
Ejemplo n.º 2
0
        public ShapeResponse AddShape(ShapeRequest request)
        {
            var response = new ShapeResponse();
            var context  = new RuleTestEntities();

            try
            {
                var newShape = new shape();
                newShape.name         = request.ShapeDto.name;
                newShape.coordinates  = request.ShapeDto.coordinates;
                newShape.area         = request.Area;
                newShape.date_created = DateTime.Now;
                newShape.is_valid     = 1;
                context.AddObject("shapes", newShape);
                context.SaveChanges();
                response.ShapeId     = newShape.id_shape;
                response.Acknowledge = AcknowledgeType.Success;
            }
            catch (InvalidOperationException exc)
            {
                log.Error(exc);
                response.Message     = exc.Message;
                response.Acknowledge = AcknowledgeType.Failure;
            }
            catch (ArgumentNullException exc)
            {
                log.Error(exc);
                response.Message     = exc.Message;
                response.Acknowledge = AcknowledgeType.Failure;
            }
            catch (NullReferenceException exc)
            {
                log.Error(exc);
                response.Message     = exc.Message;
                response.Acknowledge = AcknowledgeType.Failure;
            }
            catch (OptimisticConcurrencyException exc)
            {
                log.Error(exc);
                response.Message     = exc.Message;
                response.Acknowledge = AcknowledgeType.Failure;
            }
            catch (Exception exc)
            {
                log.Error(exc);
                response.Message     = exc.Message;
                response.Acknowledge = AcknowledgeType.Failure;
            }
            finally
            {
                context.Dispose();
            }
            return(response);
        }
Ejemplo n.º 3
0
 public ShapeResponse AddShape(ShapeRequest request)
 {
     var response = new ShapeResponse();
     var context = new RuleTestEntities();
     try
     {
         var newShape = new shape();
         newShape.name = request.ShapeDto.name;
         newShape.coordinates = request.ShapeDto.coordinates;
         newShape.area = request.Area;
         newShape.date_created = DateTime.Now;
         newShape.is_valid = 1;
         context.AddObject("shapes",newShape);
         context.SaveChanges();
         response.ShapeId = newShape.id_shape;
         response.Acknowledge = AcknowledgeType.Success;
     }
     catch (InvalidOperationException exc)
     {
         log.Error(exc);
         response.Message = exc.Message;
         response.Acknowledge = AcknowledgeType.Failure;
     }
     catch (ArgumentNullException exc)
     {
         log.Error(exc);
         response.Message = exc.Message;
         response.Acknowledge = AcknowledgeType.Failure;
     }
     catch (NullReferenceException exc)
     {
         log.Error(exc);
         response.Message = exc.Message;
         response.Acknowledge = AcknowledgeType.Failure;
     }
     catch (OptimisticConcurrencyException exc)
     {
         log.Error(exc);
         response.Message = exc.Message;
         response.Acknowledge = AcknowledgeType.Failure;
     }
     catch (Exception exc)
     {
         log.Error(exc);
         response.Message = exc.Message;
         response.Acknowledge = AcknowledgeType.Failure;
     }
     finally
     {
         context.Dispose();
     }
     return response;
 }
Ejemplo n.º 4
0
        public bool EtlToShapes()
        {
            var context = new RuleTestEntities();

            try
            {
                var listForInsert = context.massinserts.Where(x => x.is_valid == 0).ToList();
                foreach (var massinsert in listForInsert)
                {
                    var result = ValidateAndInsert(massinsert.shape);
                    if (result)
                    {
                        massinsert.is_valid = 1;
                        context.SaveChanges();
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error(exc);
                return(false);
            }
            return(true);
        }