Exemplo n.º 1
0
        protected override void OnDeleteTicket()
        {
            ticketService.DeleteTicket(ticket);

            if (OnDeleteEvent != null)
            {
                OnDeleteEvent.Invoke(this, new EventArgs());
            }
        }
Exemplo n.º 2
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Delete this event?", "Security", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                var userId     = currentUser.Keys.FirstOrDefault();
                var userName   = currentUser.Values.FirstOrDefault();
                var eventId    = Convert.ToInt32(dataGridViewEvent.CurrentRow.Cells[0].Value.ToString());
                var invitation = Convert.ToInt32(dataGridViewEvent.CurrentRow.Cells[6].Value.ToString());

                if (!string.IsNullOrEmpty(textBoxCreatorName.Text) &&
                    userName == textBoxCreatorName.Text)
                {
                    var userModel = new UserModel()
                    {
                        Id   = userId,
                        Name = userName,
                    };

                    var eventModel = new EventModel()
                    {
                        Id          = eventId,
                        UserId      = userId,
                        Description = textBoxDescription.Text,
                        Date        = GetDateTime(dateTimePickerDate.Value, Convert.ToInt32(comboBoxHour.SelectedItem)),
                        Location    = textBoxLocation.Text,
                        IsExclusive = checkBoxExclusive.Checked,
                        Invitation  = invitation,
                        Guests      = invitationGuests.Keys.ToList(),
                    };

                    OnDeleteEvent?.Invoke(eventModel, userModel);
                }
                else
                {
                    MessageBox.Show("Invalid Parameters!");
                }
            }
        }
        /// <summary>
        /// Recursively remove an entire folder structure and files with events for monitoring and basic
        /// exception handling.
        /// </summary>
        /// <param name="currentDirectoryInfo"></param>
        public static void RecursiveDelete(DirectoryInfo currentDirectoryInfo)
        {
            if (!currentDirectoryInfo.Exists)
            {
                OnDeleteEvent?.Invoke("Nothing to process");
                return;
            }

            OnDeleteEvent?.Invoke(currentDirectoryInfo.Name);

            foreach (var directoryInfo in currentDirectoryInfo.EnumerateDirectories())
            {
                try
                {
                    RecursiveDelete(directoryInfo);
                }
                catch (Exception ex)
                {
                    OnExceptionEvent?.Invoke(ex);
                }
            }

            currentDirectoryInfo.Delete(true);
        }
 private void OnDeleteClick(object sender, RoutedEventArgs e)
 {
     OnDeleteEvent?.Invoke(this, new OnDeleteEventArgs(this));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Delete all the current selection items
 /// </summary>
 public void DeleteSelection()
 {
     OnDeleteEvent?.Invoke(this, m_selectedObjects.ToArray());
     m_selectedObjects.Clear();
     m_editor.Repaint();
 }