public bool IsSatisfiedBy(ENT_Sender_GRBL.Circle entity)
        {
            double maxSideX     = double.Parse(ConfigurationManager.AppSettings["MAX_AXIS_X_mm"]);
            bool   xSideIsValid = LineValidation.IsValid(entity.Radio, entity.Center.X, maxSideX);

            if (xSideIsValid)
            {
                double maxSideY = double.Parse(ConfigurationManager.AppSettings["MAX_AXIS_Y_mm"]);
                return(LineValidation.IsValid(entity.Radio, entity.Center.Y, maxSideY));
            }

            return(false);
        }
Exemple #2
0
        public async Task <FileUploadResult> HandleUploadAsync(
            int userId,
            HttpFile file,
            ILiquidacaoStore liquidacaoStore,
            IEventStore eventStore)
        {
            using (var reader = new StreamReader(file.Value))
            {
                string line;
                while ((line = await reader.ReadLineAsync()) != null)
                {
                    var currentLine = LineValidation
                                      .ValidateLine(line)
                                      .IsHeader()
                                      .IsEmpty()
                                      .IsOk();

                    if (currentLine.IsValid)
                    {
                        var receipt = currentLine.Receipt;
                        SetReceiptDate(receipt.Recebimento);

                        if (LineValidation.ValidateCnpj(receipt.Cnpj))
                        {
                            var errorMessage = MessageHandler(receipt.Nf, ErrorEnum.CnpjInvalido);
                            Unprocessed.AppendLine(errorMessage);
                            continue;
                        }

                        await ProccessReceiptAsync(receipt);
                    }
                }
            }

            var hum = new HandlerUploadModel
            {
                UserId          = userId,
                LiquidacaoStore = liquidacaoStore,
                EventStore      = eventStore,
                VirtualPath     = Guid.NewGuid().ToString().Replace("-", "")
            };

            return(FileUploadResult(hum, true));
        }
        public bool IsSatisfiedBy(ENT_Sender_GRBL.Triangle entity)
        {
            double maxAxisX = double.Parse(ConfigurationManager.AppSettings["MAX_AXIS_X_mm"]);

            return(LineValidation.IsValid(entity.Base, entity.Start.X, maxAxisX));
        }
Exemple #4
0
        public bool IsSatisfiedBy(ENT_Sender_GRBL.Rectangle entity)
        {
            double maxAxisY = double.Parse(ConfigurationManager.AppSettings["MAX_AXIS_Y_mm"]);

            return(LineValidation.IsValid(entity.Height, entity.Start.Y, maxAxisY));
        }
Exemple #5
0
        public bool IsSatisfiedBy(ENT_Sender_GRBL.Square entity)
        {
            double max = double.Parse(ConfigurationManager.AppSettings["MAX_AXIS_Z_mm"]);

            return(LineValidation.IsValid(entity.SafetyHeightZ, entity.Start.Z, max));
        }
Exemple #6
0
        public bool IsSatisfiedBy(ENT_Sender_GRBL.Square entity)
        {
            double maxSide = double.Parse(ConfigurationManager.AppSettings["MAX_AXIS_Y_mm"]);

            return(LineValidation.IsValid(entity.Side, entity.Start.X, maxSide));
        }