Exemplo n.º 1
0
 private void dgrOrders_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     try
     {
         Order         order = (Order)dgrOrders.SelectedItem;
         PrintDelOrder pd    = new PrintDelOrder(order);
         pd.Closing += delegate(object fsender, System.ComponentModel.CancelEventArgs fe)
         {
             using (Model1 _entities = new Model1())
             {
                 try
                 {
                     Order editOrder = _entities.Orders.Find(order.Id);
                     editOrder.PaymentS = order.PaymentS;
                     editOrder.BalanceS = (Convert.ToDouble(order.TotalS) - Convert.ToDouble(order.PaymentS)).ToString();
                     _entities.Entry(editOrder).State = System.Data.Entity.EntityState.Modified;
                     _entities.SaveChanges();
                 }
                 catch
                 {
                     MessageBox.Show("Произошла ошибка.", "Ошибка базы данных", MessageBoxButton.OK, MessageBoxImage.Hand);
                     Close();
                 }
             }
         };
         Hide();
         pd.ShowDialog();
         ShowDialog();
     }
     catch { return; }
 }
        private void dgridOrders_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            Order         order = (Order)dgridOrders.SelectedItem;
            PrintDelOrder pd    = new PrintDelOrder(order);

            Hide();
            pd.ShowDialog();
            ShowDialog();
        }