Example #1
0
        private static TypesOfOffices CreatingTypesOfOfficesObjectFromEntryForm(EntryFormTypeOfOffice entryForm)
        {
            TypesOfOffices too = new TypesOfOffices();

            too.Capacity = short.Parse(entryForm.textBoxCapacity.Text);
            too.CostOfHiring = double.Parse(entryForm.textBoxCostOfHiring.Text);
            too.Name = entryForm.textBoxName.Text;
            return too;
        }
Example #2
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 #3
0
        /// <summary>
        /// Modyfikowanie zaznaczonego rekordu w tabeli "TypeOfOffices"
        /// </summary>
        private void ModifyRecordFromTypeOfOffices()
        {
            EntryFormTypeOfOffice entryForm = new EntryFormTypeOfOffice(selectedTypesOfOffice);

            bool? result = entryForm.ShowDialog();
            if ((bool)result)
            {
                newSelectedItem = 2;
                Thread newThread = new Thread(ModifyingTypeOfOfficesInNewThread);
                newThread.Start();
            }
            else
            {
                newSelectedItem = 1;
            }
        }