Beispiel #1
0
        private void operatorInformation14(object sender, RoutedEventArgs e)
        {
            OperatorsInformation operatorsInformation = new OperatorsInformation(dataTableOperatorsName.Rows[13][0].ToString());

            operatorsInformation.ShowDialog();
        }
Beispiel #2
0
        private void searchEvent()
        {
            if (search.Text == "")
            {
                return;
            }

            if (localDbConnection.State == ConnectionState.Closed)
            {
                localDbConnection.Open();
            }

            if (localDbConnectionUnity.State == ConnectionState.Closed)
            {
                localDbConnectionUnity.Open();
            }

            int pageCounter = 0;

            SqlCommand commandCount1 = new SqlCommand("SELECT COUNT(*) FROM dbo.searchProjectsAll(@key) ", localDbConnection);

            commandCount1.Parameters.AddWithValue("@key", search.Text.Trim());
            if ((int)commandCount1.ExecuteScalar() > 0)
            {
                SearchProjectsOpen searchProjectsOpen = new SearchProjectsOpen(search.Text.Trim());
                searchProjectsOpen.Show();
                pageCounter++;
            }

            SqlCommand commandCount2 = new SqlCommand("SELECT COUNT(*) FROM dbo.getProjectsToDoForSearch(@key) ", localDbConnection);

            commandCount2.Parameters.AddWithValue("@key", search.Text.Trim());
            if ((int)commandCount2.ExecuteScalar() > 0)
            {
                SearchProjectsToDoOpen searchProjectsOpen = new SearchProjectsToDoOpen(search.Text.Trim());
                searchProjectsOpen.Show();
                pageCounter++;
            }

            SqlCommand commandCount3 = new SqlCommand("SELECT COUNT(*) FROM dbo.getOperatorsForSearch(@key) ", localDbConnectionUnity);

            commandCount3.Parameters.AddWithValue("@key", search.Text.Trim());
            if ((int)commandCount3.ExecuteScalar() > 0)
            {
                SqlCommand commandCount3_1 = new SqlCommand("SELECT * FROM dbo.getOperatorsForSearch(@key) ", localDbConnectionUnity);
                commandCount3_1.Parameters.AddWithValue("@key", search.Text.Trim());

                SqlDataAdapter dataAdapterOperatorsProjectAmount = new SqlDataAdapter(commandCount3_1);
                DataTable      dataTableOperatorsProjectAmount   = new DataTable();
                dataAdapterOperatorsProjectAmount.Fill(dataTableOperatorsProjectAmount);

                for (int i = 0; i < dataTableOperatorsProjectAmount.Rows.Count; i++)
                {
                    OperatorsInformation operatorsInformation = new OperatorsInformation(dataTableOperatorsProjectAmount.Rows[i][0].ToString());
                    operatorsInformation.Show();
                    pageCounter++;
                }
            }

            SqlCommand commandCount4 = new SqlCommand("SELECT COUNT(*) FROM dbo.companiesGroup() WHERE Company = @key", localDbConnection);

            commandCount4.Parameters.AddWithValue("@key", search.Text.Trim());
            if ((int)commandCount4.ExecuteScalar() > 0)
            {
                SearchCustomers searchCustomers = new SearchCustomers(search.Text.Trim());
                searchCustomers.Show();
                pageCounter++;
            }

            SqlCommand commandCount5 = new SqlCommand("SELECT COUNT(*) FROM dbo.productsGroup() WHERE Product = @key", localDbConnection);

            commandCount5.Parameters.AddWithValue("@key", search.Text.Trim());
            if ((int)commandCount5.ExecuteScalar() > 0)
            {
                SearchProducts searchProducts = new SearchProducts(search.Text.Trim());
                searchProducts.Show();
                pageCounter++;
            }

            localDbConnection.Close();
            localDbConnectionUnity.Close();

            if (pageCounter == 0)
            {
                MessageBox.Show(rm.GetString("searchCannotBeFound"), rm.GetString("system"), MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }