Exemple #1
0
        private void NewEntryButtonClicked(object sender, RoutedEventArgs e)
        {
            var diag = new DealEntry();

            if (diag.ShowDialog() == true)
            {
                var order = diag.Order;
                using (var db = new Database())
                {
                    order.Id = db.AddDeal(order.Date, order.ClientId, order.ProductId,
                                          order.UnitId, order.Number, order.Cost, order.UnitPrice, order.CashId, order.Comment);
                }
                Orders.Add(order);
            }
        }
Exemple #2
0
        private void EditOrder(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            var template = (sender as ListViewItem).Content as Utility.Order;
            var diag     = new DealEntry();

            diag.UseTemplate(template);
            if (diag.ShowDialog() == true)
            {
                var order = diag.Order;
                using (var db = new Database())
                {
                    db.UpdateDeal(template.Id, order.Date, order.ClientId, order.ProductId,
                                  order.UnitId, order.Number, order.Cost, order.UnitPrice, order.CashId, order.Comment);
                }
                order.Id = template.Id;
                var index = Orders.IndexOf(template);
                Orders[index] = order;
            }
        }