示例#1
0
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            DeleteClientModalWindow window = new DeleteClientModalWindow();

            window.MainText.Text = "Вы действительно хотите удалить данную услугу?";

            if (window.ShowDialog() == true)
            {
                string dbcon       = @"Data Source = AddOrder.db; Version=3;";
                string delete_work = "DELETE FROM Works WHERE id = @WorkID";

                using (SQLiteConnection connection = new SQLiteConnection(dbcon))
                {
                    connection.Open();
                    SQLiteCommand delete_work_command = new SQLiteCommand(delete_work, connection);
                    delete_work_command.Parameters.Add("@WorkID", DbType.Int32).Value = WorkID;
                    delete_work_command.ExecuteNonQuery();
                }

                Hide();

                string           message = "Услуга удалена";
                string           caption = "Сообщение";
                MessageBoxButton button  = MessageBoxButton.OK;
                MessageBoxImage  icon    = MessageBoxImage.Information;
                MessageBox.Show(message, caption, button, icon);
            }
        }
示例#2
0
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            DeleteClientModalWindow window = new DeleteClientModalWindow();

            window.MainText.Text = "Вы действительно хотите удалить данного мастера?";

            if (window.ShowDialog() == true)
            {
                Hide();
                string dbcon         = @"Data Source = AddOrder.db; Version=3;";
                string delete_client = "DELETE FROM Masters WHERE MasterName = @Name AND Phone = @Phone";

                using (SQLiteConnection connection = new SQLiteConnection(dbcon))
                {
                    connection.Open();
                    SQLiteCommand delete_client_command = new SQLiteCommand(delete_client, connection);
                    delete_client_command.Parameters.Add("@Name", DbType.String).Value  = FullName.Text;
                    delete_client_command.Parameters.Add("@Phone", DbType.String).Value = PhoneNumber.Text;
                    delete_client_command.ExecuteNonQuery();
                }

                string           message = "Мастер удален";
                string           caption = "Сообщение";
                MessageBoxButton button  = MessageBoxButton.OK;
                MessageBoxImage  icon    = MessageBoxImage.Information;
                MessageBox.Show(message, caption, button, icon);
            }
        }
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            DeleteClientModalWindow window = new DeleteClientModalWindow();


            if (window.ShowDialog() == true)
            {
                Hide();
                string dbcon         = @"Data Source = AddOrder.db; Version=3;";
                string delete_client = "DELETE FROM Clients WHERE Name = @Name AND Phone = @Phone";

                using (SQLiteConnection connection = new SQLiteConnection(dbcon))
                {
                    connection.Open();
                    SQLiteCommand delete_client_command = new SQLiteCommand(delete_client, connection);
                    delete_client_command.Parameters.Add("@Name", DbType.String).Value  = FullName.Text;
                    delete_client_command.Parameters.Add("@Phone", DbType.String).Value = PhoneNumber.Text;
                    delete_client_command.ExecuteNonQuery();
                }

                string           message = "Клиент удален";
                string           caption = "Сообщение";
                MessageBoxButton button  = MessageBoxButton.OK;
                MessageBoxImage  icon    = MessageBoxImage.Information;
                MessageBox.Show(message, caption, button, icon);

                Window1 window1 = this.Owner as Window1;
                window1.DataRefreshClients();

                Close();
            }
        }