public void Delete(Ticket ticket)
        {
            var executor = new CommandExecutor("dbo.DeleteTicket", connectionString);
            executor.SetParam("@Id", ticket.Id, SqlDbType.Int);

            executor.ExecuteCommand(true).ThrowIfException();
        }
        public void Delete(Ticket ticket)
        {
            var result = MessageBox.Show(
                string.Format(Resources.DeleteTicketConfirmatonText),
                Resources.DeleteConfirmationCaption,
                MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                try
                {
                    repository.Delete(ticket);
                    RetrieveData();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
        public void OpenEditor(Ticket ticket)
        {
            try
            {
                if (ticket != null)
                {
                    ticket = ticket.Clone();
                }

                var editor = new TicketEditorWindow(ticket);
                var result = editor.ShowDialog();

                if (result.HasValue && result.Value)
                {
                    RetrieveData();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public TicketEditorWindow(Ticket ticket)
        {
            InitializeComponent();

            DataContext = ticket;
        }