예제 #1
0
        private void loadRowData(string index)
        {
            packages.mysql.mysqlSettings mySqlSettings = new packages.mysql.mysqlSettings();

            string query = String.Format("SELECT employees.id, firstname, surname, patronymic FROM {0}.{1} WHERE employees.id = {2}",
                                         packages.mysql.mysqlSettings.dbSchema,
                                         databaseTable,
                                         index);

            mySqlSettings.createConnection();

            using (mySqlSettings.initSqlCommand(query))
            {
                mySqlSettings.openConnection();

                using (MySqlDataReader reader = mySqlSettings.initSqlCommand(query).ExecuteReader())
                {
                    while (reader.Read())
                    {
                        inputFirstName.Text  = (reader["firstname"].ToString());
                        inputSurName.Text    = (reader["surname"].ToString());
                        inputPatronymic.Text = (reader["patronymic"].ToString());
                    }
                }
                populateComboBox();
            }
            mySqlSettings.closeConnection();
        }
예제 #2
0
        private void loadRowData(string index)
        {
            packages.mysql.mysqlSettings mySqlSettings = new packages.mysql.mysqlSettings();

            string query = String.Format("SELECT id, name, description, technical_data FROM {0}.{1} WHERE id = {2}",
                                         packages.mysql.mysqlSettings.dbSchema,
                                         databaseTable,
                                         index);

            mySqlSettings.createConnection();

            using (mySqlSettings.initSqlCommand(query))
            {
                mySqlSettings.openConnection();

                using (MySqlDataReader reader = mySqlSettings.initSqlCommand(query).ExecuteReader())
                {
                    while (reader.Read())
                    {
                        inputName.Text = (reader["name"].ToString());
                    }
                }
                populateComboBox();
            }
            mySqlSettings.closeConnection();
        }
예제 #3
0
        private void loadRowData(string index)
        {
            packages.mysql.mysqlSettings mySqlSettings = new packages.mysql.mysqlSettings();

            string query = String.Format("SELECT name, price_per_unit FROM {0}.{1} WHERE id = {2}",
                                         packages.mysql.mysqlSettings.dbSchema,
                                         databaseTable,
                                         index);

            mySqlSettings.createConnection();

            using (mySqlSettings.initSqlCommand(query))
            {
                mySqlSettings.openConnection();

                using (MySqlDataReader reader = mySqlSettings.initSqlCommand(query).ExecuteReader())
                {
                    while (reader.Read())
                    {
                        inputName.Text  = (reader["name"].ToString());
                        inputPrice.Text = (reader["price_per_unit"].ToString());
                    }
                }
            }
            mySqlSettings.closeConnection();
        }
예제 #4
0
        private void loadRowData(string index)
        {
            packages.mysql.mysqlSettings mySqlSettings = new packages.mysql.mysqlSettings();

            string query = String.Format("SELECT id, quantity, client_name, completion_date, description, SERVICES_id FROM {0}.{1} WHERE id = {2}",
                                         packages.mysql.mysqlSettings.dbSchema,
                                         databaseTable,
                                         index);

            mySqlSettings.createConnection();

            using (mySqlSettings.initSqlCommand(query))
            {
                mySqlSettings.openConnection();

                using (MySqlDataReader reader = mySqlSettings.initSqlCommand(query).ExecuteReader())
                {
                    while (reader.Read())
                    {
                        inputQuantity.Text         = (reader["quantity"].ToString());
                        inputName.Text             = (reader["client_name"].ToString());
                        inputDesc.Text             = (reader["description"].ToString());
                        inputDate.Text             = (reader["completion_date"].ToString());
                        listServices.SelectedValue = (reader["SERVICES_id"]);
                    }
                }
            }
            mySqlSettings.closeConnection();
        }
예제 #5
0
        private void dataGrid_DoubleClick(object sender, MouseButtonEventArgs e)
        {
            var description = (dataGrid.SelectedCells[0].Column.GetCellContent(dataGrid.SelectedCells[0].Item) as TextBlock).Text;
            var id          = (dataGrid.SelectedCells[1].Column.GetCellContent(dataGrid.SelectedCells[1].Item) as TextBlock).Text;
            var quantity    = (dataGrid.SelectedCells[2].Column.GetCellContent(dataGrid.SelectedCells[2].Item) as TextBlock).Text;
            var clientName  = (dataGrid.SelectedCells[3].Column.GetCellContent(dataGrid.SelectedCells[3].Item) as TextBlock).Text;
            var service     = (dataGrid.SelectedCells[6].Column.GetCellContent(dataGrid.SelectedCells[6].Item) as TextBlock).Text;

            windows.orderPage window = new windows.orderPage();

            #region serviceParser
            packages.mysql.mysqlSettings mySqlSettings = new packages.mysql.mysqlSettings();
            string query = String.Format("SELECT name, price_per_unit FROM {0}.{1} WHERE id = {2}",
                                         packages.mysql.mysqlSettings.dbSchema,
                                         "services",
                                         Convert.ToInt32(service)
                                         );

            mySqlSettings.createConnection();

            using (mySqlSettings.initSqlCommand(query))
            {
                mySqlSettings.openConnection();

                using (MySqlDataReader reader = mySqlSettings.initSqlCommand(query).ExecuteReader())
                {
                    while (reader.Read())
                    {
                        window.tbService.Text      = (reader["name"].ToString());
                        window.tbServicePrice.Text = (reader["price_per_unit"].ToString());
                    }
                }
            }

            mySqlSettings.closeConnection();
            #endregion

            int servicePrice = Convert.ToInt32(window.tbServicePrice.Text);
            int total        = servicePrice * Convert.ToInt32(quantity);

            window.Title           = "Замовлення №" + id;
            window.tbTitle.Text    = "Замовлення №" + id.ToString();
            window.tbClient.Text   = clientName;
            window.tbQuantity.Text = quantity;
            window.tbDesc.Text     = description;

            window.tbTotalPrice.Text = total.ToString();
            window.ShowDialog();
        }
예제 #6
0
        private void populateComboBox()
        {
            packages.mysql.mysqlSettings database = new packages.mysql.mysqlSettings();
            string query = String.Format("SELECT id, name FROM {0}.{1}",
                                         packages.mysql.mysqlSettings.dbSchema,
                                         foreignTable
                                         );

            database.createConnection();

            using (database.initSqlCommand(query))
            {
                database.openConnection();

                inputDivision.DisplayMemberPath = "name";
                inputDivision.SelectedValuePath = "id";
                inputDivision.ItemsSource       = database.getData(query).DefaultView;
            }
            database.closeConnection();
        }
예제 #7
0
        private void loadServices()
        {
            packages.mysql.mysqlSettings database = new packages.mysql.mysqlSettings();

            string query = String.Format("SELECT id, name, price_per_unit FROM {0}.{1}",
                                         packages.mysql.mysqlSettings.dbSchema,
                                         "services"
                                         );

            database.createConnection();

            using (database.initSqlCommand(query))
            {
                database.openConnection();

                listServices.SelectedValuePath = "id";
                listServices.DisplayMemberPath = "name";
                listServices.ItemsSource       = database.getData(query).DefaultView;
            }
            database.closeConnection();
        }