public void CalculateRequest()
 {
     if (!SelectedRequestForQuote.CalculatePricing(optionRequestPricer))
     {
         MessageBox.Show("Failed to calculate pricing", "Calculation Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
         log.Error("Failed to calculate pricing for request: " + SelectedRequestForQuote.Request);
     }
 }
        public void CancelEdit()
        {
            if (log.IsDebugEnabled)
            {
                log.Debug("User cancelled edit, restoring from backup");
            }

            SelectedRequestForQuote.CopyMembers(backupOfRequestForQuote);
        }
        public void BeginEdit()
        {
            if (log.IsDebugEnabled)
            {
                log.Debug("Beginning edit, creating from backup of currently selected request.");
            }

            backupOfRequestForQuote = SelectedRequestForQuote.Clone(SelectedRequestForQuote.Identifier);
        }
        public void EndEdit()
        {
            if (log.IsDebugEnabled)
            {
                log.Debug("Ending edit, saving currently selected request as is.");
            }

            // Save to the database
            var success = false;

            if (SelectedRequestForQuote.Identifier == -1)
            {
                var newIdentifer = optionRequestPersistanceManager.SaveRequest(SelectedRequestForQuote);
                if (newIdentifer != -1)
                {
                    SelectedRequestForQuote.Identifier = newIdentifer;
                    chatServiceManager.RegisterParticipant(newIdentifer);
                    success = true;
                }
            }
            else
            {
                success = optionRequestPersistanceManager.UpdateRequest(SelectedRequestForQuote);
            }

            if (!success)
            {
                MessageBox.Show("Failed to save/update request: " + SelectedRequestForQuote.Request,
                                "Request For Quote Persistance Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);

                if (log.IsErrorEnabled)
                {
                    log.Error("Request for quote was not saved/update => " + SelectedRequestForQuote);
                }
            }
            else
            {
                SelectedRequestForQuote.CalculatePricing(optionRequestPricer);
            }
        }