private void ButtonEdit_Click(object sender, RoutedEventArgs e)
        {
            List <HelpStruct> rowsToEdit = new List <HelpStruct>();

            foreach (DataRowView row in payrollsGrid.SelectedItems)
            {
                rowsToEdit.Add(new HelpStruct {
                    login = row.Row.ItemArray[0].ToString(), period = row.Row.ItemArray[1].ToString()
                });
            }

            if (rowsToEdit.Count > 0)
            {
                Window edit_window;

                //Первые окна мы открываем немодально, последнее модально, чтоб потом сразу обновились данные на форме
                if (rowsToEdit.Count > 1)
                {
                    for (int i = 0; i < rowsToEdit.Count - 1; i++)
                    {
                        edit_window = new PayrollRecordWindow(WaysToOpenForm.WaysToOpen.edit, rowsToEdit[i].login, rowsToEdit[i].period);
                        edit_window.Show();
                    }
                }
                //Заключительная форма
                edit_window = new PayrollRecordWindow(WaysToOpenForm.WaysToOpen.edit, rowsToEdit[rowsToEdit.Count - 1].login, rowsToEdit[rowsToEdit.Count - 1].period);
                edit_window.ShowDialog();

                //Обновление списка
                RefreshList();
            }
        }
        private void ButtonCreateNew_Click(object sender, RoutedEventArgs e)
        {
            Window create_window = new PayrollRecordWindow(WaysToOpenForm.WaysToOpen.create);

            create_window.ShowDialog();
            RefreshList();
        }
        private void DataGridCell_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            int    row_index   = payrollsGrid.SelectedIndex;
            string login       = "";
            string period      = "";
            int    current_row = 0;

            foreach (DataRowView row in payrollsGrid.Items)
            {
                if (current_row != row_index)
                {
                    current_row++;
                    continue;
                }
                login  = row.Row.ItemArray[0].ToString();
                period = row.Row.ItemArray[1].ToString();
                break;
            }

            Window edit_window = new PayrollRecordWindow(WaysToOpenForm.WaysToOpen.edit, login, period);

            edit_window.ShowDialog();
            RefreshList();
        }