Example #1
0
        /// <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);

                }
            }
        }
Example #2
0
        /// <summary>
        /// Modyfikowanie zaznaczonego rekordu w tabeli "Users"
        /// </summary>
        private void ModifyRecordFromUsers()
        {
            EntryFormUser entryForm = new EntryFormUser(selectedUser);

            bool? result = entryForm.ShowDialog();
            if ((bool)result)
            {
                Thread newThread = new Thread(ModyfingUsersInNewThread);
                newThread.Start();
            }
        }