示例#1
0
        /// <summary>
        /// Pat Banks
        /// Created: 2015/04/26
        ///
        /// Sends the eventType that user wants to edit to the BusinessLogic Layer
        /// Returns an indication of whether or not the transaction was successful
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btnAddType_Click(object sender, RoutedEventArgs e)
        {
            if (!TxtAddEventType.Text.ValidateString())
            {
                ShowInputErrorMessage(TxtAddEventType, "Please enter a valid event type.  No spaces allowed.");
            }
            try
            {
                _result = _eventManager.AddNewEventType(TxtAddEventType.Text);

                if (_result.Equals(EventManager.EventResult.Success))
                {
                    await ShowMessage("Your Request was Processed Successfully", "Success");

                    TxtAddEventType.Text = "";
                    FillComboBox();
                }
                else
                {
                    await ShowMessage("Event type could not be added.", "Error");
                }
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex.Message, "Error Adding Event Type");
            }
        }
示例#2
0
        /// <summary>
        /// Pat Banks
        /// Created: 2015/04/26
        ///
        /// Sends the eventType that user wants to edit to the BusinessLogic Layer
        /// Returns an indication of whether or not the transaction was successful
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btnEditType_Click(object sender, RoutedEventArgs e)
        {
            if (!TxtEditEventType.Text.ValidateString())
            {
                ShowInputErrorMessage(TxtEditEventType, "Please enter a valid Event Type");
            }

            var oldEventType = (Common.EventType)CboEditEvent.SelectedItem;
            var newEventType = new Common.EventType(oldEventType.EventTypeID, TxtEditEventType.Text);

            _result = _eventManager.EditEventType(oldEventType, newEventType);

            if (_result.Equals(EventManager.EventResult.Success))
            {
                await ShowMessage("Your Request was Processed Successfully", "Success");

                CboEditEvent.SelectedIndex = -1;
                TxtEditEventType.Text      = "";
                FillComboBox();
            }
            else
            {
                await ShowMessage("Event type could not be updated.", "Error");
            }
        }
示例#3
0
        /// <summary>
        /// Pat Banks
        /// Created: 2015/04/26
        ///
        /// Sends the eventType that user wants to archive to the BusinessLogic Layer
        /// Returns an indication of whether or not the transaction was successful
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btnArchiveType_Click(object sender, RoutedEventArgs e)
        {
            var archiveEventType = (Common.EventType)CboArchiveEvent.SelectedItem;

            _result = _eventManager.ArchiveAnEventType(archiveEventType);

            if (_result.Equals(EventManager.EventResult.Success))
            {
                await ShowMessage("Your Request was Processed Successfully", "Success");

                CboArchiveEvent.SelectedIndex = -1;
                FillComboBox();
            }
            else
            {
                await ShowMessage("Event type could not be updated.", "Error");
            }
        }
        /// <summary>
        /// Pat Banks
        /// Created: 2015/04/26
        ///
        /// Sends the eventType that user wants to edit to the BusinessLogic Layer
        /// Returns an indication of whether or not the transaction was successful
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btnAddType_Click(object sender, RoutedEventArgs e)
        {
            if (!TxtAddEventType.Text.ValidateString())
            {
                ShowInputErrorMessage(TxtAddEventType, "Please enter a valid event type.  No spaces allowed.");
            }
            try
            {
                _result = _eventManager.AddNewEventType(TxtAddEventType.Text);

                if (_result.Equals(EventManager.EventResult.Success))
                {
                    await ShowMessage("Your Request was Processed Successfully", "Success");
                    TxtAddEventType.Text = "";
                    FillComboBox();
                }
                else
                {
                    await ShowMessage("Event type could not be added.", "Error");
                }
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex.Message, "Error Adding Event Type");
            }
        }
        /// <summary>
        /// Pat Banks
        /// Created: 2015/04/26
        ///
        /// Sends the eventType that user wants to edit to the BusinessLogic Layer
        /// Returns an indication of whether or not the transaction was successful
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btnEditType_Click(object sender, RoutedEventArgs e)
        {
            if (!TxtEditEventType.Text.ValidateString())
            {
                ShowInputErrorMessage(TxtEditEventType, "Please enter a valid Event Type");
            }

            var oldEventType = (Common.EventType)CboEditEvent.SelectedItem;
            var newEventType = new Common.EventType(oldEventType.EventTypeID, TxtEditEventType.Text);

            _result = _eventManager.EditEventType(oldEventType, newEventType);

            if (_result.Equals(EventManager.EventResult.Success))
            {
                await ShowMessage("Your Request was Processed Successfully", "Success");
                CboEditEvent.SelectedIndex = -1;
                TxtEditEventType.Text = "";
                FillComboBox();
            }
            else
            {
                await ShowMessage("Event type could not be updated.", "Error");
            }
        }
        /// <summary>
        /// Pat Banks
        /// Created: 2015/04/26
        ///
        /// Sends the eventType that user wants to archive to the BusinessLogic Layer
        /// Returns an indication of whether or not the transaction was successful
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btnArchiveType_Click(object sender, RoutedEventArgs e)
        {
            var archiveEventType = (Common.EventType)CboArchiveEvent.SelectedItem;

            _result = _eventManager.ArchiveAnEventType(archiveEventType);

            if (_result.Equals(EventManager.EventResult.Success))
            {
                await ShowMessage("Your Request was Processed Successfully", "Success");
                CboArchiveEvent.SelectedIndex = -1;
                FillComboBox();
            }
            else
            {
                await ShowMessage("Event type could not be updated.", "Error");
            }
        }
示例#7
0
        /// <summary>
        /// Hunter Lind
        /// Created: 2015/2/23
        /// Creates an event to replace the old version of itself.
        /// </summary>
        private async void AddNewEvent()
        {
            var newEvent = new Event();

            try
            {
                newEvent.EventItemName = TxtEventName.Text;
                // On-site //
                if (RadOnSiteYes.IsChecked == true)
                {
                    newEvent.OnSite = true;
                }
                else if (RadOnSiteNo.IsChecked == true)
                {
                    newEvent.OnSite = false;
                }
                else
                {
                    throw new InputValidationException(RadOnSite, "Please fill in the on site field");
                }

                // Provided transport //
                if (RadTranspNo.IsChecked == true)
                {
                    newEvent.Transportation = false;
                }
                else if (RadTranspYes.IsChecked == true)
                {
                    newEvent.Transportation = true;
                }
                else
                {
                    throw new InputValidationException(RadTransp, "Please fill out the Transportation field");
                }

                newEvent.Description = TxtDescrip.Text;

                if (CboxType.SelectedItem != null)
                {
                    newEvent.EventTypeID = ((EventType)CboxType.SelectedItem).EventTypeID;
                }
                else
                {
                    throw new InputValidationException(CboxType, "Please select an event type!");
                }
                if (String.IsNullOrEmpty(TxtEventName.Text))
                {
                    throw new InputValidationException(TxtEventName, "Please enter an event name.");
                }
                EventManager.EventResult result = _eventManager.AddNewEvent(newEvent);
                if (result == EventManager.EventResult.Success)
                {
                    await this.ShowMessageDialog("Successfully Added Event");

                    DialogResult = true;
                    Close();
                }
            }
            catch (Exception ex)
            {
                if (ex is InputValidationException)
                {
                    throw new InputValidationException((InputValidationException)ex);
                }
                throw new WanderingTurtleException(this, ex, "Error adding new event");
            }
        }