/// <summary>
        /// Modyfikowanie zaznaczonego rekordu w tabeli "Projects"
        /// </summary>
        private void ModifyRecordFromProjects()
        {
            EntryFormProject entryForm = new EntryFormProject(selectedProject);

            bool? result = entryForm.ShowDialog();
            if ((bool)result)
            {
                newSelectedItem = 2;
                Thread newThread = new Thread(ModyfingProjectsInNewThread);
                newThread.Start();
            }
            else
            {
                newSelectedItem = 1;
            }
        }
        /// <summary>
        /// Obsługa przycisku "Add"
        /// </summary>
        private void buttonAdd_Click(object sender, RoutedEventArgs e)
        {
            if (selectedTable == "TypesOfEmployees")
            {
                EntryFormTypeOfEmployee entryForm = new EntryFormTypeOfEmployee();
                bool? result = entryForm.ShowDialog();
                if ((bool)result)
                {
                    TypesOfEmployees toe = CreatingTypesOfEmployeesObjectFromEntryForm(entryForm);
                    Thread newThread = new Thread(AddRecordToTypesOfEmployees);
                    newThread.Start(toe);
                }
            }

            else if (selectedTable == "TypesOfOffices")
            {
                EntryFormTypeOfOffice entryForm = new EntryFormTypeOfOffice();
                bool? result = entryForm.ShowDialog();
                if ((bool)result)
                {
                    TypesOfOffices too = CreatingTypesOfOfficesObjectFromEntryForm(entryForm);
                    Thread newThread = new Thread(AddRecordToTypesOfOffices);
                    newThread.Start(too);
                }
            }

            else if (selectedTable == "Users")
            {
                EntryFormUser entryForm = new EntryFormUser();
                bool? result = entryForm.ShowDialog();
                if ((bool)result)
                {
                    Users newUser = CreatingUsersObjectFromEntryForm(entryForm);

                    Thread newThread = new Thread(AddRecordToUsers);
                    newThread.Start(newUser);
                }
            }
            else if (selectedTable == "Description")
            {
                EntryFormDescription entryForm = new EntryFormDescription();
                bool? result = entryForm.ShowDialog();
                if ((bool)result)
                {
                    Descriptions newDescription = CreatingDescriptionObjectFromEntryForm(entryForm);
                    Thread newThread = new Thread(AddRecordToDescriptions);
                    newThread.Start(newDescription);
                }
            }

            else if (selectedTable == "Projects")
            {
                EntryFormProject entryForm = new EntryFormProject();
                bool? result = entryForm.ShowDialog();
                if ((bool)result)
                {
                    Projects newProject = CreatingProjectsObjectFromEntryForm(entryForm);

                    Thread newThread = new Thread(AddRecordToProjects);
                    newThread.Start(newProject);
                }
            }

            else if (selectedTable == "Employees")
            {
                EntryFormEmpolyee entryForm = new EntryFormEmpolyee();
                bool? result = entryForm.ShowDialog();
                if ((bool)result)
                {
                    Empolyees newEmployee = CreatingEmployeeObjectFromEntryForm(entryForm);

                    Thread newThread = new Thread(AddRecordToEmployees);
                    newThread.Start(newEmployee);
                }
            }

            else if (selectedTable == "Companies")
            {
                EntryFormCompany entryForm = new EntryFormCompany();
                bool? result = entryForm.ShowDialog();
                if ((bool)result)
                {
                    Companies newCompany = CreatingCompaniesObjectFromEntryForm(entryForm);

                    Thread newThread = new Thread(AddRecordToCompanies);
                    newThread.Start(newCompany);

                }
            }
        }
        private static Projects CreatingProjectsObjectFromEntryForm(EntryFormProject entryForm)
        {
            Projects newProject = new Projects();

            try
            {
                newProject.CompaniesCompanyID = int.Parse(entryForm.textBoxCompaniesCompanyID.Text);
            }
            catch
            {
                newProject.CompaniesCompanyID = null;
            }
            newProject.Complexity = short.Parse(entryForm.textBoxComplexity.Text);
            newProject.Gratification = double.Parse(entryForm.textBoxGratification.Text);
            newProject.MinCodity = short.Parse(entryForm.textBoxMinCodity.Text);
            newProject.MinRespect = int.Parse(entryForm.textBoxMinRespect.Text);
            newProject.Name = entryForm.textBoxName.Text;
            newProject.TimeRounds = short.Parse(entryForm.textBoxTimeRounds.Text);
            try
            {
                newProject.TimeToEnd = short.Parse(entryForm.textBoxTimeToEnd.Text);
            }
            catch
            {
                newProject.TimeToEnd = null;
            }
            return newProject;
        }