public void Initialize()
        {
            order = new Order();
            order.OrderEntries = null;
            order.SentDate = DateTime.Now;
            order.Id = 10;
            order.User = null;
            userAcc = new UserAccount();
            userAcc.Id = 5;
            orders = new List<Order>();
            orderManagementDaoMock = _factory.CreateMock<IOrderManagementDao>();
            oms.OrderManagementDao = orderManagementDaoMock.MockObject;

            //    NMock.Actions.InvokeAction saveOrder = new NMock.Actions.InvokeAction(new Action(() => orders = new List<Order>(){order}));
              //  orderManagementDaoMock.Expects.Any.MethodWith(x => x.SaveOrUpdate(order)).Will(saveOrder);

            orderInformationDaoMock = _factory.CreateMock<IOrderInformationsDao>();
            ois.OrderInformationDao = orderInformationDaoMock.MockObject;

            orderInformationDaoMock.Expects.Any.MethodWith<Order>(x => x.GetOrderById(order.Id)).WillReturn(order);
            orderInformationDaoMock.Expects.Any.MethodWith<Order>(x => x.GetOrderById(-1)).WillReturn(null);
               // orderInformationDaoMock.Expects.Any.MethodWith(x => x.GetOrdersByUserId(userAcc.Id)).WillReturn(orders.Where(x => x.User.Id == userAcc.Id));
            orderInformationDaoMock.Expects.Any.MethodWith(x => x.GetOrdersByUserId(-1)).WillReturn(orders.Where(x => x.User.Id == userAcc.Id));
            orderInformationDaoMock.Expects.Any.Method(x => x.GetUndeliveredOrders()).WillReturn(orders.Where(x => x.Status != Order.OrderState.DELIVERED));
            orderInformationDaoMock.Expects.Any.MethodWith(x => x.GetUndeliveredByUserId(userAcc.Id)).WillReturn(orders.Where(x => x.Status != Order.OrderState.DELIVERED && x.User.Id == userAcc.Id));
            //orderInformationDaoMock.Expects.Any.MethodWith(x => x.GetDeliveredOrdersByUserId(userAcc.Id)).WillReturn(orders.Where(x => x.Status == Order.OrderState.DELIVERED && x.User.Id == userAcc.Id));
        }
        public void Initialize()
        {
            order = new Order();
            order.OrderEntries = new List<OrderEntry>();
            order.SentDate = DateTime.Now;
            order.User = null;

            orderInformationServiceMock = _factory.CreateMock<IOrderInformationsService>();
            orderManagementServiceMock = _factory.CreateMock<IOrderManagementService>();
            orderManagementDaoMock = _factory.CreateMock<IOrderManagementDao>();
            orderInformationsDaoMock = _factory.CreateMock<IOrderInformationsDao>();

            ois.OrderInformationDao = orderInformationsDaoMock.MockObject;
            oms.OrderManagementDao = orderManagementDaoMock.MockObject;
            oms.OrderInformationDao = orderInformationsDaoMock.MockObject;
            sps.OrderInformationsService = ois;
            sps.OrderManagementService = oms;

            accountAdministrationDao = _factory.CreateMock<IAccountAdministrationDao>();
            userInformationDao = _factory.CreateMock<IUserInformationDao>();
            aas.AccountAdministrationDao = accountAdministrationDao.MockObject;
            aas.UserInformationDao = userInformationDao.MockObject;

            userInformationService = _factory.CreateMock<IUserInformationService>();
            sps.UserInformationService = userInformationService.MockObject;
        }
        public void AddOrderEntryTest()
        {
            List<Order> orders = new List<Order>();
            List<BookType> bookTypeList = new List<BookType>();
            NMock.Actions.InvokeAction saveOrUpdateAction = new NMock.Actions.InvokeAction(() => orders.Add(order));
            orderManagementDaoMock.Expects.Any.MethodWith(x => x.SaveOrUpdate(order)).Will(saveOrUpdateAction);

            bool isInList = false;
            order.OrderEntries = new List<OrderEntry>();
            oms.CreateNewOrder(order);
            orderInformationDaoMock.Expects.Any.MethodWith(x => x.GetOrderById(order.Id)).WillReturn(orders.First(x => x.Id == order.Id));

            getOrder = ois.GetOrderById(order.Id);

            NMock.Actions.InvokeAction saveBookType = new NMock.Actions.InvokeAction(new Action(() => bookTypeList.Add(testBook)));
            storehouseManagementDaoMock.Expects.Any.MethodWith(x => x.SaveBookType(testBook)).Will(saveBookType);

            sms.SaveBookType(testBook);
            booksInformationServiceMock.Expects.Any.MethodWith(x => x.GetBookTypeById(testBook.Id)).WillReturn(bookTypeList.FirstOrDefault(x => x.Id == testBook.Id));

            oms.AddOrderEntry(order, testBook.Id, TEST_AMOUNT);

            foreach (var item in order.OrderEntries)
            {
                if (item.Amount.Equals(TEST_AMOUNT) &&
                    item.BookType.Equals(testBook) &&
                    item.Price.Equals(testBook.Price)) isInList = true;
            };

            Assert.IsTrue(isInList);
        }
 public void AddOrderEntry(Order order, long selectedBookTypeId, int amount)
 {
     BookType bookType = BooksInformationService.GetBookTypeById(selectedBookTypeId);
     OrderEntry orderEntry = new OrderEntry()
     {
         BookType = bookType,
         Price = bookType.Price,
         Amount = amount
     };
     order.OrderEntries.Add(orderEntry);
 }
        public void CompleteOrderTest()
        {
            NMock.Actions.InvokeAction saveOrder = new NMock.Actions.InvokeAction(
              new Action(() => getOrder = order));

            orderManagementDaoMock.Expects.Any.MethodWith(x => x.SaveOrUpdate(order)).Will(saveOrder);
            orderInformationDaoMock.Expects.Any.MethodWith(x => x.GetOrderById(order.Id)).WillReturn(getOrder);
            orderInformationDaoMock.Expects.Any.MethodWith(x => x.GetOrderById(order.Id)).WillReturn(getOrder);

            oms.CreateNewOrder(order);
            oms.CompleteOrder(order.Id);
            orderManagementDaoMock.Expects.One.MethodWith(x => x.SaveOrUpdate(order)).Will(saveOrder);

            getOrder = ois.GetOrderById(order.Id);
            Assert.IsTrue(getOrder.Status.Equals(Order.OrderState.DELIVERED));
        }
 public ActionResult Index(LogInModel loginModelData)
 {
     UserAccount user = ServiceLocator.AuthorizationService.LoginUser(loginModelData.UserName, loginModelData.Password);
     if (user != null)
     {
         switch(user.AccountStatus)
         {
             case UserAccount.Status.LOCKED_OUT:
                 ModelState.AddModelError("Locked Out User Account", "Your account has been locked out. Please contact with administrator to get further details.");
                 return View();
             case UserAccount.Status.REMOVED:
                 ModelState.AddModelError("Removed Account", "Your account has been removed. Please contact with administrator to get further details.");
                 return View();
             case UserAccount.Status.EXPIRED:
                 ModelState.AddModelError("Expired Account", "Your account has expired. Please contact with administrator to prolong it.");
                 return View();
         }
         Session["LoggedUserId"] = (long)user.Id;
         switch(user.Id)
         {
             case 1:
                 SetCurrentMenuPositions(MenuPanelsMapping.ADMINISTRATOR, MenuPrimaryPositionMappings.ADMINISTRATOR_VIEW_ALL_USER_ACCOUNTS);
                 Session["MenuObject"] = ServiceLocator.ApplicationScope.MenuProvider.AdministratorMenu;
                 break;
             case 2:
                 SetCurrentMenuPositions(MenuPanelsMapping.WORKER, MenuPrimaryPositionMappings.WORKER_UNDELIVEREDORDERS);
                 Session["MenuObject"] = ServiceLocator.ApplicationScope.MenuProvider.WorkerMenu;
                 break;
             default:
                 SetCurrentMenuPositions(MenuPanelsMapping.SHOP, MenuPrimaryPositionMappings.SHOP_VIEW_ALL_BOOKS);
                 Session["CurrentOrder"] = new Order()
                 {
                     User = user,
                     OrderEntries = new List<OrderEntry>()
                 };
                 Session["CurrentUser"] = (UserAccount)user;
                 Session["MenuObject"] = ServiceLocator.ApplicationScope.MenuProvider.UserAccountMenu;
                 break;
         }
         return RedirectToAction(((SpringMvc.Menu.MenuComponents.MenuComponent)Session["MenuObject"]).ControllerAction, ((SpringMvc.Menu.MenuComponents.MenuComponent)Session["MenuObject"]).ControllerName);
     }
     else
     {
         ModelState.AddModelError("Password or login incorrect.", "Provided login or password are incorrect. Please try again.");
         return View();
     }
 }
        public void ResultQuantityTest()
        {
            IList<Order> orders = new List<Order>();

            IList<BookType> books = new List<BookType>();
            Category cat = new Category();
            cat.Id = 5;
            cat.Name = "Kategoria";
            for (long i = 1; i < 8; i++)
            {
                BookType bookd = new BookType();
                Order order = new Order();
                OrderEntry entry = new OrderEntry();
                order.OrderEntries = new List<OrderEntry>();
                order.SentDate = DateTime.Now;
                order.Id = 10;
                order.User = null;
                entry.Id = i;
                entry.BookType = bookd;
                order.OrderEntries.Add(entry);
                bookd.Title = "Title" + i;
                bookd.Authors = "Auotr";
                bookd.Id = i;
                bookd.Category = cat;
                booksInformationServiceMock.Expects.Any.MethodWith(x => x.GetBookTypeById(i)).WillReturn(bookd);
                booksInformationServiceMock.Expects.Any.MethodWith(x => x.GetBooksByCategoryId(5)).WillReturn(books);

                orders.Add(order);
                books.Add(bookd);
            }
            booksInformationServiceMock.Expects.Any.Method(x => x.GetAllBooks()).WillReturn(books);

            orderInformationServiceMock.Expects.Any.MethodWith(x => x.GetOrdersByUserId(1)).WillReturn(orders);

            IEnumerable<BookType> result = suggestionService.GetSuggestionsForUser(1);

            Int32 counter = 0;
            foreach (BookType book in result)
            {
                Assert.IsNotNull(book);
                counter++;
            }

            Assert.AreEqual(counter, 5);
        }
        public void DistinctBookTest()
        {
            IEnumerable<BookType> result = null;
            IList<Order> orders = new List<Order>();

            IList<BookType> books = new List<BookType>();
            Category cat = new Category();
            cat.Id = 5;
            cat.Name = "Kategoria";
            for (long i = 1; i < 8; i++)
            {
                BookType bookd = new BookType();
                Order order = new Order();
                OrderEntry entry = new OrderEntry();
                order.OrderEntries = new List<OrderEntry>();
                order.SentDate = DateTime.Now;
                order.Id = 10;
                order.User = null;
                entry.Id = i;
                entry.BookType = bookd;
                order.OrderEntries.Add(entry);
                bookd.Title = "Title" + i;
                bookd.Authors = "Auotr";
                bookd.Id = i;
                bookd.Category = cat;
                booksInformationServiceMock.Expects.Any.MethodWith(x => x.GetBookTypeById(i)).WillReturn(bookd);
                booksInformationServiceMock.Expects.Any.MethodWith(x => x.GetBooksByCategoryId(5)).WillReturn(books);

                orders.Add(order);
                books.Add(bookd);
            }
            booksInformationServiceMock.Expects.Any.Method(x => x.GetAllBooks()).WillReturn(books);

            orderInformationServiceMock.Expects.Any.MethodWith(x => x.GetOrdersByUserId(1)).WillReturn(orders);
            orderInformationServiceMock.Expects.Any.Method(x => x.GetUndeliveredOrders()).WillReturn(orders.Where(x => x.Status != Order.OrderState.DELIVERED));

            result = suggestionService.GetSuggestionsForGuest();
            Assert.AreEqual(result.Count(), result.Distinct().Count());
        }
        public void TestGetDeliveredOrdersByUserId()
        {
            Order order2 = new Order();
            order2.User = userAcc;
            order2.Status = Order.OrderState.DELIVERED;
            order2.OrderEntries = null;
            order2.SentDate = DateTime.Now;
            order2.Id = 10;
            userAcc.Id = 5;
            NMock.Actions.InvokeAction saveOrder = new NMock.Actions.InvokeAction(new Action(() => orders.Add(order2)));
            orderManagementDaoMock.Expects.Any.MethodWith(x => x.SaveOrUpdate(order2)).Will(saveOrder);

            oms.SaveOrder(order2);

            orderInformationDaoMock.Expects.Any.MethodWith(x => x.GetDeliveredOrdersByUserId(userAcc.Id)).WillReturn(orders.Where(x => x.Status == Order.OrderState.DELIVERED && x.User.Id == userAcc.Id));

            bool isOrderThere = false;
            foreach (var item in ois.GetDeliveredOrdersByUserId(userAcc.Id))
            {
                Assert.AreEqual(item.User.Id, userAcc.Id);
                if (item.Id == order.Id) isOrderThere = true;
            }
            Assert.IsTrue(isOrderThere);
        }
 public void CreateNewOrder(Order order)
 {
     order.Status = Order.OrderState.ORDERED;
     order.OrderDate = DateTime.Now;
     OrderManagementDao.SaveOrUpdate(order);
 }
 public void SaveOrUpdate(Order order)
 {
     this.Session.SaveOrUpdate(order);
 }
 public void SaveOrder(Order order)
 {
     OrderManagementDao.SaveOrUpdate(order);
 }
        public void SaveOrderTest()
        {
            NMock.Actions.InvokeAction saveOrder = new NMock.Actions.InvokeAction(
            new Action(() => getOrder = order));

            orderManagementDaoMock.Expects.Any.MethodWith(x => x.SaveOrUpdate(order)).Will(saveOrder);
            orderManagementDaoMock.Expects.Any.MethodWith(x => x.SaveOrUpdate(order)).Will(saveOrder);
            orderInformationDaoMock.Expects.Any.MethodWith(x => x.GetOrderById(order.Id)).WillReturn(getOrder);

            oms.CreateNewOrder(order);
            oms.SaveOrder(order);
            getOrder = ois.GetOrderById(order.Id);
            Assert.IsNotNull(getOrder);
        }
        public void Initialize()
        {
            _factory = new MockFactory();
            order = new Order();
            order.OrderEntries = null;
            order.SentDate = DateTime.Now;
            order.User = null;
            getOrder = new Order();
            testBook = new BookType();
            Category testCategory = new Category();
            testBook.Id = 47123;
            testBook.Title = "Książka testowa";
            testBook.Authors = "Autor testowy";
            testBook.Category = testCategory;
            testBook.Price = 40;
            TEST_AMOUNT = 5;

            orderManagementDaoMock = _factory.CreateMock<IOrderManagementDao>();
            oms.OrderManagementDao = orderManagementDaoMock.MockObject;

            orderInformationDaoMock = _factory.CreateMock<IOrderInformationsDao>();
            ois.OrderInformationDao = orderInformationDaoMock.MockObject;
            oms.OrderInformationDao = orderInformationDaoMock.MockObject;

            storehouseManagementDaoMock = _factory.CreateMock<IStorehouseManagementDao>();
            sms.StorehouseManagementDao = storehouseManagementDaoMock.MockObject;

            booksInformationServiceMock = _factory.CreateMock<IBooksInformationService>();
            sms.BooksInformationService = booksInformationServiceMock.MockObject;
            oms.BooksInformationService = booksInformationServiceMock.MockObject;
        }
        public string BuildInvoice(Order orderDetails, UserAccount userDetails, Invoice invoice)
        {
            BaseFont f_cb = BaseFont.CreateFont("c:\\windows\\fonts\\calibrib.ttf", BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
            BaseFont f_cn = BaseFont.CreateFont("c:\\windows\\fonts\\calibri.ttf", BaseFont.CP1252, BaseFont.NOT_EMBEDDED);

            try {

                string currentDate = DateTime.Now.Day.ToString() + "_" + DateTime.Now.Month.ToString() + "_" + DateTime.Now.Year.ToString();
                string projectPath = System.AppDomain.CurrentDomain.BaseDirectory.ToString();
                string invoiceName = "Invoice_" + orderDetails.Id.ToString() + "_" + currentDate + ".pdf";
                using (System.IO.FileStream fs = new FileStream(projectPath + "\\Tmp\\" + invoiceName, FileMode.Create))
                {
                    Document document = new Document(PageSize.A4, 25, 25, 30, 1);
                    PdfWriter writer = PdfWriter.GetInstance(document, fs);

                    document.AddAuthor("BookStore");
                    document.AddTitle("Customer Invoice - order id:" + orderDetails.Id.ToString());
                    document.Open();

                    PdfContentByte cb = writer.DirectContent;
                    iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance(projectPath + "\\Images\\logo.png");
                    png.ScaleAbsolute(200, 55);
                    png.SetAbsolutePosition(40, 750);
                    cb.AddImage(png);
                    cb.BeginText();

                    writeText(cb, "BookStore Invoice", 350, 820, f_cb, 14);
                    writeText(cb, "Invoice Id", 350, 800, f_cb, 10);
                    writeText(cb, invoice.Id.ToString(), 420, 800, f_cn, 10);
                    writeText(cb, "Order date", 350, 788, f_cb, 10);
                    writeText(cb, orderDetails.OrderDate.ToString(), 420, 788, f_cn, 10);
                    writeText(cb, "Order Id", 350, 776, f_cb, 10);
                    writeText(cb, orderDetails.Id.ToString(), 420, 776, f_cn, 10);
                    writeText(cb, "Customer Id", 350, 764, f_cb, 10);
                    writeText(cb, orderDetails.User.Id.ToString(), 420, 764, f_cn, 10);

                    int left_margin = 40;
                    int top_margin = 720;
                    writeText(cb, "Delivery address", left_margin, top_margin, f_cb, 10);
                    writeText(cb, userDetails.PersonalData.FirstName
                        + " " + userDetails.PersonalData.LastName, left_margin, top_margin-12, f_cn, 10);
                    writeText(cb, userDetails.PersonalData.Address.Street, left_margin, top_margin-24, f_cn, 10);
                    writeText(cb, userDetails.PersonalData.Address.PostalCode
                        + " " + userDetails.PersonalData.Address.City, left_margin, top_margin-36, f_cn, 10);
                    writeText(cb, userDetails.PersonalData.Address.Country, left_margin, top_margin-48, f_cn, 10);

                    left_margin = 350;
                    writeText(cb, "Invoice address", left_margin, top_margin, f_cb, 10);
                    writeText(cb, ApplicationScope.CompanyName, left_margin, top_margin - 12, f_cn, 10);
                    writeText(cb, ApplicationScope.CompanyStreet, left_margin, top_margin - 24, f_cn, 10);
                    writeText(cb, ApplicationScope.CompanyPostalCode + " " + ApplicationScope.CompanyCity,
                        left_margin, top_margin - 36, f_cn, 10);
                    writeText(cb, ApplicationScope.CompanyCountry, left_margin, top_margin - 48, f_cn, 10);

                    cb.EndText();
                    cb.SetLineWidth(0f);
                    cb.MoveTo(40, 620);
                    cb.LineTo(610, 620);
                    cb.Stroke();
                    cb.BeginText();
                    int lastwriteposition = 100;

                    top_margin = 600;
                    left_margin = 40;
                    writeText(cb, "Item Id", left_margin, top_margin, f_cb, 10);
                    writeText(cb, "Description", left_margin+70, top_margin, f_cb, 10);
                    cb.ShowTextAligned(PdfContentByte.ALIGN_RIGHT, "Qty", left_margin + 415, top_margin, 0);
                    writeText(cb, "Unit", left_margin + 420, top_margin, f_cb, 10);
                    cb.ShowTextAligned(PdfContentByte.ALIGN_RIGHT, "Price", left_margin + 495, top_margin, 0);
                    writeText(cb, "Curr", left_margin+500, top_margin, f_cb, 10);

                    top_margin = 588;

                    Decimal totalInvoicedPrice = 0;
                    foreach (OrderEntry entry in orderDetails.OrderEntries)
                    {
                        writeText(cb, entry.BookType.Id.ToString(), left_margin, top_margin, f_cn, 10);
                        writeText(cb, entry.BookType.Authors + ", \"" + entry.BookType.Title + "\"", left_margin + 70, top_margin, f_cn, 10);
                        cb.ShowTextAligned(PdfContentByte.ALIGN_RIGHT, entry.Amount.ToString(), left_margin + 415, top_margin, 0);
                        writeText(cb, ApplicationScope.InvoiceUnit, left_margin + 420, top_margin, f_cn, 10);
                        cb.ShowTextAligned(PdfContentByte.ALIGN_RIGHT, entry.Price.ToString(), left_margin + 495, top_margin, 0);
                        writeText(cb, ApplicationScope.InvoiceCurrency, left_margin + 500, top_margin, f_cn, 10);

                        totalInvoicedPrice = Decimal.Add(totalInvoicedPrice, Decimal.Multiply(entry.Price, (Decimal) entry.Amount));

                        top_margin -= 12;

                        if(top_margin <= lastwriteposition)
                        {
                            cb.EndText();
                            document.NewPage();
                            cb.BeginText();
                            top_margin = 780;
                        }
                    }

                    top_margin -= 80;
                    left_margin = 350;

                    writeText(cb, "Invoice line totals", left_margin, top_margin, f_cb, 10);
                    writeText(cb, "VAT amount", left_margin, top_margin-12, f_cb, 10);
                    writeText(cb, "Invoice grand total", left_margin, top_margin-36, f_cb, 10);
                    left_margin = 540;
                    cb.SetFontAndSize(f_cn, 10);
                    cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, ApplicationScope.InvoiceCurrency, left_margin, top_margin, 0);
                    cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, ApplicationScope.InvoiceCurrency, left_margin, top_margin - 12, 0);
                    cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, ApplicationScope.InvoiceCurrency, left_margin, top_margin - 36, 0);
                    left_margin = 535;
                    cb.ShowTextAligned(PdfContentByte.ALIGN_RIGHT, totalInvoicedPrice.ToString(), left_margin, top_margin, 0);
                    cb.ShowTextAligned(PdfContentByte.ALIGN_RIGHT, invoice.VatPriceValue.ToString(), left_margin, top_margin - 12, 0);
                    cb.ShowTextAligned(PdfContentByte.ALIGN_RIGHT, invoice.TotalValue.ToString(),
                        left_margin, top_margin - 36, 0);

                    cb.EndText();

                    document.Close();
                    writer.Close();
                    fs.Close();
                    return invoiceName;
                }
            }
            catch(Exception error)
            {
                System.Console.WriteLine(error.ToString());
                return null;
            }
        }
        public List<Order> GenerateOrders(List<BookType> bookTypes, List<UserAccount> userAccounts)
        {
            List<Order> orders = new List<Order>();

            for (int index = 0; index < userAccounts.Count; index++)
            {
                DateTime orderDate = DateTime.Parse(orderDates[index]);
                DateTime sentDate = orderDate.AddDays(sentDaysToAdd[index]);
                DateTime deliveryDate = sentDate.AddDays(deliveryDaysToAdd[index]);
                for ( int orderType = 0; orderType < 3; orderType++ )
                {
                    Order order = new Order()
                    {
                        OrderDate = orderDate,
                        User = userAccounts[index],
                    };

                    switch ( orderType )
                    {
                        case 0:
                            order.Status = Order.OrderState.DELIVERED;
                            order.SentDate = sentDate;
                            order.DeliveryDate = deliveryDate;
                            break;

                        case 1:
                            order.Status = Order.OrderState.SENT;
                            order.SentDate = sentDate;
                            break;

                        default:
                            order.Status = Order.OrderState.ORDERED;
                            break;
                    }
                    order.OrderEntries = GenerateOrderEntries(bookTypes, order, index);
                    orders.Add(order);
                }
            }
            return orders;
        }
        private List<OrderEntry> GenerateOrderEntries(List<BookType> bookTypes, Order order, int dataIndex)
        {
            List<OrderEntry> orderEntries = new List<OrderEntry>();
            for (int i = 0; i < numberOfEntries[dataIndex]; i++)
            {
                OrderEntry entry = new OrderEntry()
                {
                    Amount = amountsOfBooks[dataIndex],
                    BookType = bookTypes.ElementAt(random.Next(bookTypes.Count)),
                };
                entry.Price = entry.BookType.Price;
                orderEntries.Add(entry);
            }

            return orderEntries;
        }
 public ActionResult SubmitOrder()
 {
     var currentOrder = Session["CurrentOrder"] as Order;
     ServiceLocator.OrderManagementService.CreateNewOrder(currentOrder);
     if (currentOrder != null)
         Session["CurrentOrder"] = new Order()
         {
             User = currentOrder.User,
             OrderEntries = new List<OrderEntry>()
         };
     return RedirectToAction("YourCart", "MainShop");
 }