/// <summary>
        /// Open add document into database window.
        /// After close opened window refresh datagrid.
        /// </summary>
        private void AddInsuranceDocumentButton(object sender, RoutedEventArgs e)
        {
            var addPolicyDocument = new AddDocument();

            addPolicyDocument.ShowDialog();
            Refresh.DataGrid(agentDocument.ItemsSource = UserDatagrid.DisplayPolicyListInDataGrid());
        }
 public MenagerWindow()
 {
     InitializeComponent();
     //Current logged user.
     Welcome();
     //Left datagrid source at start.
     agentDocument.ItemsSource = UserDatagrid.DisplayPolicyListInDataGrid();
 }
 /// <summary>
 /// Supplement for delete button, after select item in datagrid press delete key to delete item from database.
 /// After delete datagrid is refreshing.
 /// </summary>
 private void DeleteItemFromDatabaseByDeleteKeyPress(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Delete)
     {
         DeleteItemFromDataBase.DeleteAfterSelectRowInDataGrid(agentDocument.SelectedItem);
         Refresh.DataGrid(agentDocument.ItemsSource = UserDatagrid.DisplayPolicyListInDataGrid());
         e.Handled = true;
     }
 }
 /// <summary>
 /// Opens new window after select position and click button.
 /// </summary>
 private void EditInsuranceDocumentButton(object sender, RoutedEventArgs e)
 {
     DisplayDataEditPolicy.EditPolicyInDatabase(agentDocument.SelectedItem);
     Refresh.DataGrid(agentDocument.ItemsSource = UserDatagrid.DisplayPolicyListInDataGrid());
 }
 /// <summary>
 /// Refresh button, refreshing datagrid if refresh is need.
 /// </summary>
 public void RefreshUserDatagridButton(object sender, RoutedEventArgs e)
 {
     Refresh.DataGrid(agentDocument.ItemsSource = UserDatagrid.DisplayPolicyListInDataGrid());
 }
 /// <summary>
 /// Delete item by select it in datagrid. Position in database is deleting by button click.
 /// After delete datagrid is refreshing.
 /// </summary>
 private void RemovInsuranceDocumentButton(object sender, RoutedEventArgs e)
 {
     DeleteItemFromDataBase.DeleteAfterSelectRowInDataGrid(agentDocument.SelectedItem);
     Refresh.DataGrid(agentDocument.ItemsSource = UserDatagrid.DisplayPolicyListInDataGrid());
 }