Example #1
0
        private void Button_Copy4_Click(object sender, RoutedEventArgs e)
        {
            AddPageOrder o = new AddPageOrder();

            o.Show();
            o.Tag = "1";
            this.Hide();
        }
Example #2
0
        private async void Button_Copy_Click(object sender, RoutedEventArgs e)
        {
            if (ComboBox.Text == "")
            {
                ComboBox.Background = Brushes.Red;
                ComboBox.Opacity    = 0.4;
                return;
            }
            if (data.Text == "")
            {
                data.Background = Brushes.Red;
                data.Opacity    = 0.4;
                return;
            }
            if (textBox_Copy2.Text == "0")
            {
                textBox_Copy2.Background = Brushes.Red;
                textBox_Copy2.Opacity    = 0.4;
                return;
            }

            SqlConnection = new OleDbConnection(connectString);
            SqlConnection.Open();

            OleDbCommand command1 = new OleDbCommand("SELECT * FROM [Салон]", SqlConnection);

            command1 = new OleDbCommand("INSERT INTO [Заказы] (Клиент,Услуги,[Дата создания],[Дата выполнения],Цена)VALUES(@1,@2,@3,@4,@5)", SqlConnection);
            command1.Parameters.AddWithValue("1", ComboBox.Text);

            string for_str = "";

            for (int i = 0; i < strArr.Count(); i++)
            {
                if (strArr[i] != null)
                {
                    for_str += strArr[i] + " - ";
                }
            }
            command1.Parameters.AddWithValue("2", for_str);
            command1.Parameters.AddWithValue("3", DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second + " " + DateTime.Now.Date.Day + "." + DateTime.Now.Date.Month + "." + DateTime.Now.Date.Year);
            command1.Parameters.AddWithValue("4", data.Text);
            command1.Parameters.AddWithValue("5", textBox_Copy2.Text);

            await command1.ExecuteNonQueryAsync();

            MessageBox.Show("Данные успешно добавлены");

            AddPageOrder a = new AddPageOrder();

            a.Tag = this.Tag;
            a.Show();
            this.Close();
        }