Пример #1
0
        private void OrderType_Click(object sender, RoutedEventArgs e)
        {
            Button temp = (Button)sender;

            switch (temp.Name)
            {
            case "standardHotDogButton":
                Order order = new Order(customer.TableName, ItemlistCreate());
                customer.Order = order;
                standardHotDogButton.IsEnabled = false;
                advancedOrderButton.IsEnabled  = false;
                orderButton.IsEnabled          = true;
                break;

            case "advancedOrderButton":
                AdvancedOrder advancedOrderPopup = new AdvancedOrder(this);
                advancedOrderPopup.ShowDialog();
                advancedOrderButton.IsEnabled  = false;
                standardHotDogButton.IsEnabled = false;
                orderButton.IsEnabled          = true;
                break;

            default:
                break;
            }
        }
Пример #2
0
        public void UpdateRootVersionWithDescendantTest()
        {
            Key         orderKey;
            VersionInfo orderVersion;
            Key         orderItemKey;
            VersionInfo orderItemVersion;

            using (var session = Domain.OpenSession()) {
                using (var transactionScope = session.OpenTransaction()) {
                    var order = new AdvancedOrder()
                    {
                        Number = 1, CustomerName = "Customer1"
                    };
                    var orderItem = new AdvancedOrderItem()
                    {
                        Product = "Product", Quantity = 10, Order = order, SupplierName = "Supplier1"
                    };
                    orderKey         = order.Key;
                    orderVersion     = order.VersionInfo;
                    orderItemKey     = orderItem.Key;
                    orderItemVersion = orderItem.VersionInfo;
                    transactionScope.Complete();
                }
            }
            using (var session = Domain.OpenSession()) {
                using (var transactionScope = session.OpenTransaction()) {
                    var order     = session.Query.Single <Order>(orderKey);
                    var orderItem = session.Query.Single <AdvancedOrderItem>(orderItemKey);
                    Assert.IsTrue(orderVersion == order.VersionInfo);
                    Assert.IsTrue(orderItemVersion == orderItem.VersionInfo);
                    orderItem.SupplierName = "Supplier2";
                    Assert.IsFalse(orderVersion == order.VersionInfo);
                    Assert.IsFalse(orderItemVersion == orderItem.VersionInfo);
                    transactionScope.Complete();
                }
            }
        }