Beispiel #1
0
        async void Handle_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            HttpClient _client = new HttpClient();

            var     details = e.Item as Ambulance.Paramedic.Models.FailReasons;
            HubData data    = new HubData();

            data = JsonConvert.DeserializeObject <HubData>(Helper.Settings.permantdata) as HubData;
            OrderConfirmation order = new OrderConfirmation();

            order.OrderStatus          = false;
            order.ArrivalTime          = DateTime.Now;
            order.OrderFailureReasonId = details.Id;
            order.OrderId = data.OrderId;
            var Json    = JsonConvert.SerializeObject(order);
            var uri     = new Uri(string.Format(Settings.Ngrok + "Paramedic/ConfirmOrder", string.Empty));
            var content = new StringContent(Json, Encoding.UTF8, "application/json");
            HttpResponseMessage response;

            response = await _client.PostAsync(uri, content);

            if (response.IsSuccessStatusCode)
            {
                DependencyService.Get <Toast>().Show("send succesfully");
                await Task.Delay(1000);

                Settings.permantdata = null;
                await Navigation.PushModalAsync(new ParamedicProfile());
            }
            else
            {
                DependencyService.Get <Toast>().Show("Faild to send Request");
            }
        }
Beispiel #2
0
        public void OrderItemsAreUniqueByProductSku()
        {
            var order = MakeOrders();

            var orderService = new OrderService(_mockIProductRepository, _mockICustomerRepository, _mockIEmailService,
                                                _mockIOrderFulfillmentService, _mockITaxRateService);

            _mockIProductRepository.Stub(a => a.IsInStock(Arg <string> .Is.Anything)).Return(true);

            var orderConfirmation = new OrderConfirmation {
                OrderNumber = "AX1123", CustomerId = 1, OrderId = 7
            };

            _mockIOrderFulfillmentService.Stub(s => s.Fulfill(order))
            .Return(orderConfirmation);

            var customer = new Customer
            {
                CustomerId      = 1,
                PostalCode      = "99999",
                StateOrProvince = "WA"
            };

            _mockICustomerRepository.Stub(c => c.Get(Arg <int> .Is.Anything)).Return(customer);

            var result = orderService.PlaceOrder(order);

            Assert.IsNotNull(result);
        }
Beispiel #3
0
        /// <summary>
        /// Runs the processor.
        /// </summary>
        /// <param name="args">The arguments.</param>
        public virtual void Process([NotNull] PipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            object orderNumber = args.CustomData["orderNumber"];

            Assert.IsNotNull(orderNumber, "OrderNumber cannot be null.");

            VisitorOrderManager orderRepository = Context.Entity.Resolve <VisitorOrderManager>();

            Assert.IsNotNull(orderRepository, "OrderManager cannot be null.");

            string orderId = orderNumber.ToString();
            Order  order   = orderRepository.GetAll().SingleOrDefault(o => (o != null) && (o.OrderId == orderId));

            Assert.IsNotNull(order, "Order cannot be null.");

            OrderConfirmation orderConfirmation = Context.Entity.Resolve <OrderConfirmation>();

            Assert.IsNotNull(orderConfirmation, "OrderConfirmation cannot be null.");
            Assert.IsNotNull(orderConfirmation.ConfirmationMessageBuilder, "OrderConfirmation.ConfirmationMessageBuilder cannot be null.");

            orderConfirmation.ConfirmationMessageBuilder.Order = order;

            orderConfirmation.Send();
        }
        public void Init()
        {
            _productRepository       = Substitute.For <IProductRepository>();
            _orderFulfillmentService = Substitute.For <IOrderFulfillmentService>();
            _taxRateService          = Substitute.For <ITaxRateService>();
            _customerRepository      = Substitute.For <ICustomerRepository>();
            _emailService            = Substitute.For <IEmailService>();

            _orderService = new OrderService(_productRepository, _orderFulfillmentService, _taxRateService,
                                             _customerRepository, _emailService);

            _orderConfirmation = new OrderConfirmation {
                CustomerId = 42, OrderId = 12, OrderNumber = "OneTwoThree"
            };
            _taxEntryList = new List <TaxEntry>
            {
                new TaxEntry {
                    Description = "Default", Rate = (decimal)0.2
                },
                new TaxEntry {
                    Description = "High", Rate = (decimal)0.5
                }
            };
            _customer = new Customer {
                CustomerId = 2, PostalCode = "12345", Country = "USA"
            };

            _taxRateService.GetTaxEntries(_customer.PostalCode, _customer.Country).Returns(_taxEntryList);
            _customerRepository.Get(_customer.CustomerId.Value).Returns(_customer);
        }
Beispiel #5
0
        public void ConfirmOrder()
        {
            // Arrange
            Customer testCustomer = new Customer("Peter Johansson");
            Product  testLaptop   = new Product("laptop");

            testLaptop.Price = 400;
            Product testScreen = new Product("modern skärm");

            testScreen.Price = 1500;
            ShoppingCart sut = new ShoppingCart();

            sut.Customer = testCustomer;
            sut.AddProduct(testLaptop);
            sut.AddProduct(testScreen);

            string expected = "Peter Johansson har beställt varor för 1900 SEK";

            // Act
            sut.Order();
            OrderConfirmation result = sut.OrderConfirmMessage;
            string            actual = result.Message;

            // Assert
            Assert.AreEqual(expected, actual);
        }
        protected static OrderConfirmation ReplaceExistingComponents(OrderConfirmation order, IUnitOfWork uow)
        {
            var addedComponents = new List <Component>();

            foreach (var item in order.Items)
            {
                var currentItem = item;

                var component = addedComponents.FirstOrDefault(c => c.Name == currentItem.Component.Name) ??
                                uow.SingleComponentRepository
                                .Get(c => c.Name == currentItem.Component.Name && c.VendorId == currentItem.Component.VendorId)
                                .FirstOrDefault();

                if (component != null)
                {
                    item.Component = component;
                }
                else
                {
                    uow.SingleComponentRepository.Create(item.Component);
                    addedComponents.Add(item.Component);
                }
            }

            return(order);
        }
        private void NewOrderConfirmation()
        {
            if (Validator.ValidateAll().IsValid)
            {
                if (order.Id == 0)
                {
                    order = UnitOfWork.Orders.Add(order);
                }

                var vm = new OrderConfirmationCreationViewModel(new UnitOfWorkFactory());
                vm.Init();
                var windowView = new OrderConfirmationCreationView(vm);

                if (windowView.ShowDialog() ?? false)
                {
                    var    orderConfNumber = vm.OrderConfNumber;
                    string fileName;

                    try
                    {
                        fileName = FileAccess.CreateDocumentFromTemplate(order.Customer, orderConfNumber, Properties.Settings.Default.ConfirmationTemplatePath);
                    }
                    catch (Win32Exception)
                    {
                        MessageBox.Show("Das Dokument konnte nicht erstellt werden. Eventuell haben Sie die Vorlage noch geöffnet.", "Ein Fehler ist aufgetreten");
                        return;
                    }

                    var document = new Document
                    {
                        IssueDate    = DateTime.Now,
                        Name         = orderConfNumber,
                        Tag          = "Auftragsbestätigung",
                        RelativePath = fileName
                    };

                    document = UnitOfWork.Documents.Add(document);

                    var orderConfirmation = new OrderConfirmation
                    {
                        OrderConfNumber = orderConfNumber,
                        Order           = order,
                        Document        = document
                    };

                    orderConfirmation = UnitOfWork.OrderConfirmations.Add(orderConfirmation);

                    UnitOfWork.Complete();

                    OrderConfirmationList.Add(orderConfirmation);
                    OnPropertyChanged(nameof(OrderConfToolTip));

                    if (vm.OpenAfterSave ?? false)
                    {
                        Open(fileName);
                    }
                }
            }
        }
 public OrderViewModel(int guest, DateTime orderTime, List <OrderItem> foodOrder, List <OrderItem> drinkOrder, OrderConfirmation confirmation)
 {
     Guest        = guest;
     OrderTime    = orderTime;
     FoodOrder    = foodOrder;
     DrinkOrder   = drinkOrder;
     Confirmation = confirmation;
 }
        // GET: OrderConfirmationGuest
        public async Task <ActionResult> OrderConfirmation(int orderId, OrderConfirmation orderConfirm)
        {
            var cartId = (int)HttpContext.Session.GetInt32("CartSession");
            var user   = await _userManager.GetUserAsync(User);

            if (User.Identity.IsAuthenticated)
            {
                var currentOrder = await _context.Carts

                                   .Include(x => x.Items)
                                   .ThenInclude(x => x.CartItemIngredients)
                                   .ThenInclude(x => x.Ingredient)
                                   .Include(x => x.Items)
                                   .ThenInclude(x => x.Dish)
                                   .SingleOrDefaultAsync(x => x.CartId == cartId);

                var order = new Order()
                {
                    OrderId = orderId
                };


                var newOrder = new OrderConfirmation
                {
                    Order     = order,
                    User      = user,
                    CartItems = currentOrder.Items
                };

                var session = HttpContext.Session;
                session.Remove("CartSession");
                return(View(newOrder));
            }
            else
            {
                var currentGuest = await _context.Orders
                                   .Include(x => x.Cart)
                                   .ThenInclude(x => x.Items)
                                   .ThenInclude(x => x.CartItemIngredients)
                                   .ThenInclude(x => x.Ingredient)
                                   .Include(x => x.CartItem)
                                   .ThenInclude(x => x.Dish)
                                   .SingleOrDefaultAsync(x => x.OrderId == orderId && x.CartId == cartId);

                var currentCart = currentGuest.CartItem.ToList();

                var newOrder = new OrderConfirmation
                {
                    Order = currentGuest
                };

                var session = HttpContext.Session;
                session.Remove("CartSession");

                return(View(newOrder));
            }
        }
Beispiel #10
0
        static void Main(string[] args)
        {
            MailService.GetInstance();

            SetConsoleGraphics();
            new WelcomeMenu().Display();
            new MainMenu().Display();
            OrderConfirmation.GetInstance().Initialize();
        }
Beispiel #11
0
        private OrderConfirmation CreateOrderConfirmationObject(int customerId, int orderId, string orderNumber)
        {
            var orderConfirmationObject = new OrderConfirmation();

            orderConfirmationObject.CustomerId  = customerId;
            orderConfirmationObject.OrderId     = orderId;
            orderConfirmationObject.OrderNumber = orderNumber;
            return(orderConfirmationObject);
        }
Beispiel #12
0
        public void Setup()
        {
            _uow          = new UnitOfWork();
            _orderService = new OrderConfirmationService(null, _uow, Root);

            _project           = _uow.ProjectRepository.Get(p => p.ProjectNumber == "P2013-083").FirstOrDefault();
            _relation          = _project.Files.FirstOrDefault(f => f.File.Name == "R5942565_EU0028S_22104496 SO 10449601");
            _parser            = OrderConfirmationFactory.GetParser(Root, _relation.File);
            _orderConfirmation = _orderService.CreateFromProjectFile(_relation);
        }
Beispiel #13
0
        public void Setup()
        {
            _uow          = new UnitOfWork();
            _orderService = new OrderConfirmationService(null, _uow, Root);

            _project           = _uow.ProjectRepository.Get(p => p.ProjectNumber == "P2013-078").FirstOrDefault();
            _relation          = _project.Files.FirstOrDefault(f => f.File.Name == "Confirm_65225_0001622957");
            _parser            = OrderConfirmationFactory.GetParser(Root, _relation.File);
            _orderConfirmation = _orderService.CreateFromProjectFile(_relation);
        }
Beispiel #14
0
        public OrderConfirmation PlaceOrder(Order order)
        {
            if (order == null)
            {
                throw new ArgumentNullException(nameof(order));
            }

            // Get data for order request.
            var id      = Guid.NewGuid().ToString();
            var country = order.Country;
            var product = order.Product;
            var sender  = this.configuration["Name"];

            // Prepare order request.
            var orderRequest = new OrderRequest(
                id,
                country,
                product,
                sender);

            // Get the queue which belongs to the retailer.
            var retailer = this.configuration["Retailer"];

            // Send order request to retailer.
            this.bus.Send(retailer, orderRequest);

            var hasRetailerReplied = false;

            lock (this)
            {
                hasRetailerReplied = Monitor.Wait(this, 2000);
            }

            // Retailer has not replied in time, so we
            // return null to indicate failure.
            if (!hasRetailerReplied)
            {
                throw new Exception("Timeout on request, please try again.");
            }

            if (this.orderResponse.Stock == 0)
            {
                throw new Exception("Product is out of stock.");
            }

            var result = new OrderConfirmation(
                order.Country,
                this.orderResponse.Delivery ?? DateTime.Now,
                this.orderResponse.Product,
                this.orderResponse.ShippingCharge,
                this.orderResponse.Stock,
                this.orderResponse.ShippingFrom);

            return(result);
        }
 protected OrderConfirmationItem CreateOrderConfirmationItem(OrderConfirmation order)
 {
     return(new OrderConfirmationItem
     {
         Component = new Component
         {
             Vendor = order.Vendor,
             VendorId = order.Vendor.Id
         }
     });
 }
        /// <summary>
        /// Executes the specified order.
        /// </summary>
        /// <param name="order">The order.</param>
        protected override void Execute([NotNull] Order order)
        {
            Assert.ArgumentNotNull(order, "order");
            this.OrderId = order.OrderId;

            OrderConfirmation orderConfirmation = Context.Entity.Resolve <OrderConfirmation>();

            Assert.IsNotNull(orderConfirmation, "OrderConfirmation cannot be null.");
            Assert.IsNotNull(orderConfirmation.ConfirmationMessageBuilder, "OrderConfirmation.ConfirmationMessageBuilder cannot be null.");

            orderConfirmation.ConfirmationMessageBuilder.Order = order;
            orderConfirmation.Send();
        }
Beispiel #17
0
        internal static MailService GetInstance()
        {
            Logger.Info("Instantiated MailService");
            if (_instance == null)
            {
                _instance = new MailService();
                Registration.GetInstance().UserRegistered      += _instance.OnUserRegistered;
                OrderConfirmation.GetInstance().OrderConfirmed += _instance.OnOrderConfirmed;
                OrderConfirmation.GetInstance().OrderPrepared  += _instance.OnOrderPrepared;
            }

            return(_instance);
        }
Beispiel #18
0
        private OrderConfirmation MapOrderToOrderConfirmation(OrderRecord order)
        {
            var orderConfirmation = new OrderConfirmation
            {
                ConfirmationId = order.ConfirmationId,
                Order          = new OrderRequest
                {
                    Amount       = order.Amount,
                    CustomerName = order.CustomerName,
                    ProductId    = order.ProductId
                }
            };

            return(orderConfirmation);
        }
        public async Task <OrderConfirmation> CreateAsync(Order createdOrder)
        {
            var confirmationId = await _orderRepository.CreateAsync(createdOrder);

            var shipmentInformation = await _shipmentRepository.CreateAsync(createdOrder);

            var orderConfirmation = new OrderConfirmation
            {
                ConfirmationId      = confirmationId,
                ShipmentInformation = shipmentInformation,
                Customer            = createdOrder.Customer
            };

            return(orderConfirmation);
        }
Beispiel #20
0
        public ActionResult Confirm(OrderConfirmation confirmation)
        {
            if (confirmation.OrderId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Order order = db.Orders.Find(confirmation.OrderId);

            if (order == null)
            {
                return(HttpNotFound());
            }

            ViewBag.Confirmation = confirmation;

            return(View(order));
        }
        protected OrderConfirmation CreateOrderConfirmation(IUnitOfWork uow)
        {
            var vendor = uow.VendorRepository.Get(v => v.Name == VendorName).FirstOrDefault();

            if (vendor == null)
            {
                vendor = new Vendor();
                uow.VendorRepository.Create(vendor);
            }

            var order = new OrderConfirmation
            {
                Vendor = vendor,
                Items  = new List <OrderConfirmationItem>()
            };

            return(order);
        }
Beispiel #22
0
        public ActionResult Edit([Bind(Include = "OrderId,CustomerId,DateCreated,DateDispatched,PaymentCardId")] Order order)
        {
            OrderConfirmation orderConfirmation = new OrderConfirmation();

            orderConfirmation.OrderId = order.OrderId;

            if (ModelState.IsValid)
            {
                order.OrderItems  = db.OrderItems.Where(oi => oi.OrderId == order.OrderId).ToList <OrderItem>();
                order.PaymentCard = db.PaymentCards.Where(pc => pc.PaymentCardId == order.PaymentCardId).First <PaymentCard>();
                order.Customer    = db.Customers.Where(c => c.CustomerId == order.CustomerId).First <Customer>();

                orderConfirmation.OrderTotal = order.getTotalValue();

                if (ProcessPayment(order).Equals("PAYMENT FAILURE"))
                {
                    orderConfirmation.PaymentOutcome = "Payment failed";
                    return(RedirectToAction("Confirm", new { id = order.OrderId, outcome = "failure" }));
                }

                orderConfirmation.PaymentOutcome = "Payment successful";

                orderConfirmation.WarehouseNotificationOutcome = SendWarehouseMessage(order);

                orderConfirmation.CustomerEmailNotificationOutcome = SendCustomerOrderMessage(order);

                try
                {
                    db.Entry(order).State = EntityState.Modified;
                    db.SaveChanges();
                    orderConfirmation.DatabaseUpdateOutcome = "Our database has been updated to confirm your order";
                }
                catch (Exception ex)
                {
                    orderConfirmation.DatabaseUpdateOutcome = "Unfortunately there was an error saving your order in our database. Our customer service representatives know that this error occurred and will process your order. Please call 01112 223344 and they will confirm your order was successful.";
                    // you would log ex.Message here, of course.
                }

                orderConfirmation.Outcome = "success";
                return(RedirectToAction("Confirm", orderConfirmation));
            }
            ViewBag.PaymentCardId = new SelectList(db.PaymentCards, "PaymentCardId", "CardNumber", order.PaymentCardId);
            return(View(order));
        }
        public void PlaceOrder_OrderValid_SummaryReturnedWithOrderFulfillmentServiceId()
        {
            // Arrange
            StubProductRepository(true, SkuConstString);

            const int orderId           = 123;
            var       orderConfirmation = new OrderConfirmation
            {
                OrderId = orderId
            };

            StubFulfillOrder(orderConfirmation);
            StubTaxRateService(null);
            StubGetStandardCustomerFromRepository();

            // Act
            var orderSummary = _orderService.PlaceOrder(_order);

            // Assert
            Assert.That(orderSummary.OrderId, Is.EqualTo(orderId));
        }
Beispiel #24
0
        public async Task <IActionResult> ShippingDetails(string username)
        {
            //Get user's basket by username
            Basket basket = await _basketManager.FindBasketByUserEager(username);

            // If basket for user doesn't exist yet, create empty one, but don't add it to DB
            if (basket == null)
            {
                RedirectToAction("ViewBasket", "Basket");
            }
            else
            {
                basket.CalcSubtotal();
                await _basketManager.UpdateBasket(basket);
            }
            OrderConfirmation orderConfirmation = new OrderConfirmation {
                ShippingDetails = new ShippingDetails(), Basket = basket, TransactionFailure = false
            };

            return(View(orderConfirmation));
        }
Beispiel #25
0
        public async Task <IActionResult> Post([FromBody, Required] OrderRequest orderRequest)
        {
            var isValidOrder = await orderValidationService.ValidateAsync(orderRequest);

            if (isValidOrder == false)
            {
                return(BadRequest());
            }

            var confirmationId    = Guid.NewGuid().ToString();
            var orderConfirmation = new OrderConfirmation
            {
                ConfirmationId = confirmationId,
                Order          = orderRequest
            };

            await QueueOrderAsync(confirmationId, orderRequest);

            orders.Add(confirmationId, orderRequest);

            return(Created($"/orders/{orderConfirmation.ConfirmationId}", orderConfirmation));
        }
        public void BeforeEach()
        {
            _productRepo             = Substitute.For <IProductRepository>();
            _orderFulfillmentService = Substitute.For <IOrderFulfillmentService>();
            _customerRepository      = Substitute.For <ICustomerRepository>();
            _taxRateService          = Substitute.For <ITaxRateService>();
            _emailService            = Substitute.For <IEmailService>();

            _subject = new OrderService(_orderFulfillmentService,
                                        _customerRepository,
                                        _taxRateService,
                                        _emailService);

            _bestCustomer = new Customer
            {
                CustomerId = 42,
                PostalCode = "12345",
                Country    = "Merica"
            };

            _listOfTaxEntries = new List <TaxEntry>
            {
                new TaxEntry {
                    Description = "High Tax", Rate = (decimal)0.60
                },
                new TaxEntry {
                    Description = "Low Tax", Rate = (decimal)0.10
                }
            };

            _orderConfirmation = new OrderConfirmation
            {
                OrderId     = 1234,
                OrderNumber = "hello"
            };
            _customerRepository.Get(_bestCustomer.CustomerId.Value).Returns(_bestCustomer);
            _taxRateService.GetTaxEntries(_bestCustomer.PostalCode, _bestCustomer.Country).Returns(_listOfTaxEntries);
        }
        public void PlaceOrder_CustomerValid_GetsTaxInfo()
        {
            // Arrange
            StubProductRepository(true, SkuConstString);
            StubGetStandardCustomerFromRepository();

            var orderConfirmation = new OrderConfirmation
            {
                CustomerId = CustomerIdConstInt
            };

            StubFulfillOrder(orderConfirmation);

            var taxList = new List <TaxEntry>
            {
                new TaxEntry
                {
                    Description = "First entry.",
                    Rate        = 2.3m
                },
                new TaxEntry()
                {
                    Description = "Second entry.",
                    Rate        = 0.098m
                }
            };

            StubTaxRateService(taxList);

            // Act
            var orderSummary = _orderService.PlaceOrder(_order);

            // Assert
            _mockTaxRateService.AssertWasCalled(t => t.GetTaxEntries(PostalCodeConstString, CountryConstString));
            Assert.That(orderSummary.Taxes, Is.EqualTo(taxList));
        }
        public IActionResult ConfirmOrder(OrderConfirmation order)
        {
            using (_context)
            {
                Basket basket = new Basket(Request.Cookies["Basket"]);
                if (ModelState.IsValid)
                {
                    //Gets the items from the basket cookie, then calling newOrder method.
                    int orderId = order.NewOrder(basket, _context);
                    CookieManager.RemoveCookie("Basket", Response);

                    //Then returns order no/name information to display confirmation.
                    ViewData["OrderNo"]   = orderId;
                    ViewData["OrderName"] = order.Name;

                    return(View("OrderComplete"));
                }

                //Returning the confirm order view again with errors showing.
                ViewData["basket"] = basket.GetItemDetails(_context);
                ViewData["total"]  = basket.GetTotal(_context);
                return(View());
            }
        }
 private void StubFulfillOrder(OrderConfirmation orderConfirmation)
 {
     _mockOrderFulfillmentService.Stub(o => o.Fulfill(_order)).Return(orderConfirmation);
 }
Beispiel #30
0
        public OrderConfirmation ExtractOrderConfirmationData(IUnitOfWork uow)
        {
            var app = _config.Descendants("parameter")
                      .Where(p => p.Attribute("name").Value == "PdfConverterPath")
                      .Select(p => p.Attribute("value").Value)
                      .FirstOrDefault();

            var items   = _config.Descendants("items");
            var parsers = _config.Descendants("parser");

            var vendorName = _config.Attribute("validation").Value;
            var vendor     = uow.VendorRepository.Get(v => v.Name == vendorName).FirstOrDefault();

            if (vendor == null)
            {
                vendor = new Vendor();
                uow.VendorRepository.Create(vendor);
            }

            var order = new OrderConfirmation
            {
                Vendor = vendor
            };

            foreach (var parser in parsers)
            {
                var tablefile = parser.Attribute("value").Value;
                var rowspace  = parser.Attribute("rowspace").Value;

                var table = ParsePdfColumns(tablefile, app, rowspace);
                //var strategy = parser.Attribute("strategy").Value;

                foreach (var column in parser.Descendants("column"))
                {
                    var property    = column.Attribute("name").Value;
                    var startRow    = column.Attribute("startRowValue").Value;
                    var startOffset = Int32.Parse(column.Attribute("startRowOffset").Value);
                    var endRow      = "";

                    var toEndAttr = column.Attribute("toEnd");
                    var toEnd     = toEndAttr != null && Boolean.Parse(toEndAttr.Value);

                    if (column.Attribute("endRowValue") != null)
                    {
                        endRow = column.Attribute("endRowValue").Value;
                    }

                    var oneLine = endRow == "" && !toEnd;

                    var found       = false;
                    var stringValue = "";

                    for (var columnIndex = 0; columnIndex < table[0].Length && !found; columnIndex++)
                    {
                        var fetching  = false;
                        var firstLine = false;

                        for (var rowIndex = 0; rowIndex < table.Length; rowIndex++)
                        {
                            var cell = table[rowIndex][columnIndex];

                            if (!fetching && cell == startRow)
                            {
                                fetching  = true;
                                firstLine = true;

                                if (oneLine)
                                {
                                    stringValue = table[rowIndex + startOffset][columnIndex];
                                    found       = true;
                                    break;
                                }
                            }
                            else if (fetching && (cell != endRow || toEnd))
                            {
                                stringValue += (firstLine ? "" : "\n") + cell;
                                firstLine    = false;
                            }
                            else if (fetching && cell == endRow)
                            {
                                found = true;
                                break;
                            }
                        }

                        if (toEnd && fetching)
                        {
                            found = true;
                        }
                    }

                    SetValueOfProperty(stringValue.Trim(), property, order);
                }
            }


            foreach (var item in items)
            {
                var tablefile   = item.Attribute("value").Value;
                var rowspace    = item.Attribute("rowspace").Value;
                var checkColumn = Int32.Parse(item.Attribute("startFetchCheckColumn").Value);
                var regex       = new Regex(item.Attribute("startFetchRegex").Value);

                var table = ParsePdfColumns(tablefile, app, rowspace);

                var rowIndex = 0;
                while (rowIndex < table.Length)
                {
                    var found = false;

                    var orderItem = new OrderConfirmationItem
                    {
                        Component = new Component()
                    };

                    if (regex.IsMatch(table[rowIndex][checkColumn]))
                    {
                        var first = true;
                        found = true;

                        foreach (var row in item.Descendants("row"))
                        {
                            if (!first && regex.IsMatch(table[rowIndex][checkColumn]))
                            {
                                break;
                            }

                            first = false;

                            var columnIndex = 0;

                            foreach (var column in row.Descendants("column"))
                            {
                                var skipAttr = column.Attribute("skip");
                                if (skipAttr != null && Boolean.Parse(skipAttr.Value))
                                {
                                    ++columnIndex;
                                    continue;
                                }

                                var stringValue = "";

                                var rowSpanAttr    = column.Attribute("rowspan");
                                var colSpanAttr    = column.Attribute("colspan");
                                var avoidRegexAttr = column.Attribute("avoidWhenMatchesRegex");

                                var rowSpan = rowSpanAttr == null ? 1 : int.Parse(rowSpanAttr.Value);
                                var colSpan = colSpanAttr == null ? 1 : int.Parse(colSpanAttr.Value);

                                var previousColumnIndex = columnIndex;
                                for (var i = 0; i < rowSpan; ++i)
                                {
                                    var currentCell = "";
                                    var currentLine = "";

                                    for (var j = 0; j < colSpan; ++j)
                                    {
                                        currentCell = table[rowIndex][columnIndex++].Trim();

                                        if (!Regex.IsMatch(currentCell, avoidRegexAttr != null ? avoidRegexAttr.Value : "^$"))
                                        {
                                            currentLine += currentCell;
                                        }
                                    }

                                    if (i > 0 && i < rowSpan && currentLine.Length > 0)
                                    {
                                        stringValue += "\n";
                                    }

                                    stringValue += currentLine;

                                    if (rowSpan > 1)
                                    {
                                        columnIndex = previousColumnIndex;

                                        if (regex.IsMatch(table[++rowIndex][checkColumn]))
                                        {
                                            --rowIndex;
                                            break;
                                        }
                                    }
                                }

                                var property = column.Attribute("name").Value;
                                SetValueOfProperty(stringValue, property, orderItem);
                            }

                            ++rowIndex;
                        }
                    }
                    else
                    {
                        ++rowIndex;
                    }

                    if (found)
                    {
                        order.Items.Add(orderItem);
                    }
                }
            }

            if (uow.OrderConfirmationRepository.Get(o => o.OrderNumber == order.OrderNumber && o.VendorId == order.VendorId).Any())
            {
                throw new Exception("Order number already in database");
            }

            uow.OrderConfirmationRepository.Create(ReplaceExistingComponents(order, uow));
            return(order);
        }