public DealWindow(ViewDeal deal)
        {
            InitializeComponent();

            viewDeal = deal;

            using (var data = new DataServiceClient())
            {
                ComboBox_Seller.ItemsSource = data.GetUsersId();
                ComboBox_Buyer.ItemsSource = ComboBox_Seller.ItemsSource;
            }

            ComboBox_Buyer.IsEnabled = false;
            ComboBox_ObjOfTransact.IsEnabled = false;
            ComboBox_KindOfCalc.IsEnabled = false;
            TextBox_PersonalNumberOfDeal.IsEnabled = false;
            TextBox_DateOfDeal.IsEnabled = false;
            TextBox_TransactionAmount.IsEnabled = false;

            SetInfo();

            if (deal.DealID > 0)
            {
                Button_Correct.IsEnabled = true;
                Button_Add.IsEnabled = false;
            }
            else
            {
                Button_Correct.IsEnabled = false;
                Button_Add.IsEnabled = true;
            }
        }
        public static Deal ConvertDeal(ViewDeal viewDeal)
        {
            return new Deal
            {
                DealID = viewDeal.DealID,
                Buyer_UserID = viewDeal.Buyer_UserID,
                Seller_UserID = viewDeal.Seller_UserID,
                ObjectOfTransactionID = viewDeal.ObjectOfTransactionID,

                PersonalNumberOfDeal = viewDeal.PersonalNumberOfDeal,
                DateOfDeal = viewDeal.DateOfDeal,
                KindOfCalculatingID = (int)viewDeal.KindOfCalculatingID,
                TransactionAmount = viewDeal.TransactionAmount
            };
        }
 private void Button_Click_Add(object sender, RoutedEventArgs e)
 {
     if (TabItem_Users.IsSelected)
     {
         var user = new ViewUser();
         var userWindow = new UserWindow(user);
         userWindow.ShowDialog();
         UpdateUsers();
     }
     else if(TabItem_ObjOfTransact.IsSelected)
     {
         var objOfTransact = new ViewObjOfTransact();
         var objOfTransactWindow = new ObjOfTransactWindow(objOfTransact);
         objOfTransactWindow.ShowDialog();
         UpdateObjectOfTransaction();
     }
     else if(TabItem_Deals.IsSelected)
     {
         var viewDeal = new ViewDeal();
         var dealWindow = new DealWindow(viewDeal);
         dealWindow.ShowDialog();
         UpdateDeals();
     }
 }
 public void UpdateDeal(ViewDeal deal)
 {
     DataManager.UpdateDealFromDb(DbConverter.ConvertDeal(deal));
 }
 public void DeleteDeal(ViewDeal deal)
 {
     DataManager.DeleteDealFromDb(DbConverter.ConvertDeal(deal));
 }
 public void AddDeal(ViewDeal deal)
 {
     DataManager.AddDealToDb(DbConverter.ConvertDeal(deal));
 }