/// <summary> /// Открывает окно трансфера обрабатывает его и закрывает /// </summary> /// <param name="Lv_cashAcc"></param> internal void Tranfer(ListView Lv_cashAcc) { if (Lv_cashAcc.SelectedItem != null) { selected_acc = (Cash_Account)Lv_cashAcc.SelectedItem; Transfer_Win transfer = new Transfer_Win(curent_acc, selected_acc); transfer.ShowDialog(); foreach (var acc in MainWindow.ML.all_Cash_Accounts.All_cash_acc) { foreach (var acc_1 in transfer.TL.curent_acc) { if (acc.IdCashAcc == acc_1.IdCashAcc) { acc.Acc_finance = acc_1.Acc_finance; } } } Lv_cashAcc.ItemsSource = MainWindow.ML.all_Cash_Accounts[passport]; } else { MessageBox.Show("Выберите счет"); } }
/// <summary> /// Удаляет выбраный счет /// </summary> /// <param name="Lv_cashAcc"></param> internal void DeletAcc(ListView Lv_cashAcc) { if (Lv_cashAcc.SelectedItem != null) { Cash_Account selected = (Cash_Account)Lv_cashAcc.SelectedItem; for (int i = 0; i < MainWindow.ML.all_Cash_Accounts.All_cash_acc.Count(); i++) { if (MainWindow.ML.all_Cash_Accounts.All_cash_acc[i] == selected) { MainWindow.ML.all_Cash_Accounts.All_cash_acc.Remove(MainWindow.ML.all_Cash_Accounts.All_cash_acc[i]); } } Ev_Mes += Mes; Ev_Mes("Вы удалили счет " + selected.IdCashAcc); MainWindow.ML.LogiAll.Logis.Add(new Logi(("Был удалён счет " + selected.IdCashAcc + " " + (DateTime.Now).ToString()))); MainWindow.ML.LogiAll.Save(); Ev_Mes -= Mes; } Lv_cashAcc.ItemsSource = MainWindow.ML.all_Cash_Accounts[passport]; }
/// <summary> /// Открывае окно перевода другому клиенту /// </summary> /// <param name="Lv_cashAcc"></param> internal void TransferToClient(ListView Lv_cashAcc) { selected_acc = (Cash_Account)Lv_cashAcc.SelectedItem; if (selected_acc == null) { MessageBox.Show("Выберите счет с которого хотите сделать перевод"); } else { TransferToClient_Win tla = new TransferToClient_Win(selected_acc); tla.ShowDialog(); Lv_cashAcc.ItemsSource = MainWindow.ML.all_Cash_Accounts[passport]; } }
/// <summary> /// Заполняет поля при инициализации /// </summary> /// <param name="curent_acc_SEND"></param> /// <param name="selected_acc"></param> internal void Initialaze(ObservableCollection <Cash_Account> curent_acc_SEND, Cash_Account selected_acc, ComboBox Combo_Selected_Acc, TextBlock Current_Acc, TextBlock Current_Finance) { curent_acc = curent_acc_SEND; cur_acc1 = selected_acc; foreach (var cur in curent_acc) { if (cur.IdCashAcc != selected_acc.IdCashAcc) { helper.Add(new Helper_transfer(cur.IdCashAcc.ToString())); } } Combo_Selected_Acc.ItemsSource = curent_acc; Current_Acc.Text = selected_acc.IdCashAcc; Current_Finance.Text = selected_acc.Acc_finance; }
/// <summary> /// Открывает вклад и закрывает текущее окно /// </summary> /// <param name="Tbx_time"></param> /// <param name="Tbx_SumIn"></param> internal void Open(TextBox Tbx_time, TextBox Tbx_SumIn) { try { if (Convert.ToDouble(Tbx_SumIn.Text) > 0 && Convert.ToInt32(Tbx_time.Text) > 0) { var ch_acc = new Cash_Account(MainWindow.ML.clientData[passport], MainWindow.ML.all_Cash_Accounts.All_cash_acc, "Вклад", Tbx_SumIn.Text, Tbx_time.Text); MainWindow.ML.all_Cash_Accounts.All_cash_acc.Add(ch_acc); //var cl1 = MainWindow.ML.all_Cash_Accounts.All_cash_acc.Last().Client; var cl = MainWindow.ML.clientData[passport]; Ev_Mes += Mes; Ev_Mes("Открыт вклад на " + Tbx_SumIn.Text + " Руб."); Ev_Mes -= Mes; MainWindow.ML.LogiAll.Logis.Add(new Logi(("Выдан новый вклад на сумму " + Tbx_SumIn.Text + " Руб. " + (DateTime.Now).ToString()))); MainWindow.ML.LogiAll.Save(); foreach (Window window in App.Current.Windows) { if (window is Deposite_Win) { window.Close(); } } } } catch (Exception e) { Tbx_SumIn.BorderBrush = Brushes.Red; Tbx_time.BorderBrush = Brushes.Red; MessageBox.Show("Проверьте коректность вводимых данных. " + e.Message); } }
/// <summary> /// Заполняет поля при инициализации /// </summary> /// <param name="curent_acc_SEND"></param> /// <param name="selected_acc"></param> internal void Initialaze(Cash_Account selected_acc, TextBlock Current_Acc, TextBlock Current_Finance) { this.selected_acc = selected_acc; Current_Acc.Text = selected_acc.IdCashAcc; Current_Finance.Text = selected_acc.Acc_finance; }
internal TransferToClient_Win(Cash_Account selected_acc) { InitializeComponent(); TL.Initialaze(selected_acc, Current_Acc, Current_Finance); }
internal Transfer_Win(ObservableCollection <Cash_Account> curent_acc_SEND, Cash_Account selected_acc) { InitializeComponent(); TL.Initialaze(curent_acc_SEND, selected_acc, Combo_Selected_Acc, Current_Acc, Current_Finance); }