public ProviderResponseScheme UpdateResponseAsRecalled(ProviderResponseScheme scheme) { //TODO: what do I do with this? this can be done when the reponse is either dismissed or pending.. so, ideally // we'd just put back to available state ... but do I care what the previous bid was?? huh?? var response = FindById(scheme.Id); if (response != null) { // update the response state to recalled (tracking receipts are updated) response.SetReceiptState(ResponseReceiptStates.Recalled, this.AccountSession); // update to the DB response = Update(response); // log successful update this.Logger.Info(string.Format("successfully set response state to recalled for Id {0} via user {1}", scheme.Id, this.AccountSession.MemberId)); // create and return the new provider response scheme var consumerPortfolio = this.Mongo.GetConsumerPortfolio(response.ConsumerPortfolioId); var providerPortfolio = this.Mongo.GetProviderPortfolio(response.ProviderPortfolioId); // notify the switch board //this.Switchboard.ResponseUpdated(response, consumerPortfolio, providerPortfolio); // return the updated scheme return(GetProviderResponseScheme(response.Id)); } else { // log non-existent consumer group this.Logger.Warn(string.Format("could not set response to recalled for Id {0} because it does not exist via user {1}", scheme.Id, this.AccountSession.MemberId)); } return(scheme); }
public HttpResponseMessage UpdateResponseAsRecalled(ProviderResponseScheme response) { var schemeValidation = response.Validate(this.AccountSession, ValidationMode.Recalled); if (schemeValidation.IsValid) { try { // handle the submission to the recalled state var results = this.Uow.Responses.UpdateResponseAsRecalled(response); // return the updated results return(CreateSuccessResponse(new { success = true, results = results }, HttpStatusCode.OK)); } catch (Exception ex) { // log exception Logger.Error(string.Format("Exception detected attempting to set state to recalled for Id {0} via user {1}", response.Id, this.AccountSession.MemberId), ex); return(CreateErrorResponse(ex)); } } // invalid parameters, generate response return(CreateInvalidResponse(schemeValidation)); }
public ProviderResponseScheme GetProviderResponseScheme(string id) { // get the responses for this consumer var response = this.Mongo.GetResponseById(id); // get the consumer portfolio var consumerPortfolio = this.Mongo.GetConsumerPortfolio(response.ConsumerPortfolioId); // get the provider portfolio var providerPortfolio = this.Mongo.GetProviderPortfolio(response.ProviderPortfolioId); // build the scheme var responseScheme = new ProviderResponseScheme(response, providerPortfolio, consumerPortfolio); return(responseScheme); }
public void ResponseUpdated(Response response, ConsumerPortfolio consumerPortfolio, ProviderPortfolio providerPortfolio) { // find the identities for this provider portfolio ID var identities = this.Identities.Where(item => item.PortfolioId == providerPortfolio.Id); if (!identities.Any()) { return; } // build a provider response scheme to send out var responseScheme = new ProviderResponseScheme(response, providerPortfolio, consumerPortfolio); // send this out to all client identities foreach (var identity in identities) { // send out the updated resoponse scheme this.HubContext.Clients.Client(identity.ConnectionId).ResponseUpdated(responseScheme); // trace the transmission of this response this.Logger.Trace(string.Format("updated response for Id {0} automatically transmitted to provider portfolio {1} for user Id {2} with connection Id {3}", response.Id, identity.PortfolioId, identity.UserId, identity.ConnectionId)); } }
public ProviderResponseScheme UpdateResponseAsPending(ProviderResponseScheme scheme) { var response = FindById(scheme.Id); if (response != null) { // update the response properties response.Update(scheme, this.AccountSession); // update the response state to pending (tracking receipts are updated) response.SetReceiptState(ResponseReceiptStates.Pending, this.AccountSession, scheme.Quote); // update to the DB response = Update(response); // log successful update this.Logger.Info(string.Format("successfully set response state to pending for Id {0} via user {1}", scheme.Id, this.AccountSession.MemberId)); // create and return the new provider response scheme var consumerPortfolio = this.Mongo.GetConsumerPortfolio(response.ConsumerPortfolioId); var providerPortfolio = this.Mongo.GetProviderPortfolio(response.ProviderPortfolioId); // notify the switch board this.Switchboard.ResponseUpdatedAsPending(response, providerPortfolio, consumerPortfolio); // return the updated scheme return(new ProviderResponseScheme(response, providerPortfolio, consumerPortfolio)); } else { // log non-existent consumer group this.Logger.Warn(string.Format("could not set response to pending for Id {0} because it does not exist via user {1}", scheme.Id, this.AccountSession.MemberId)); } return(scheme); }
public ProviderResponseScheme UpdateResponseAsAvailable(ProviderResponseScheme scheme) { var response = FindById(scheme.Id); if (response != null) { // clear all values that may have previously been set response.Clear(); // update the response state to available (tracking receipts are updated) response.SetReceiptState(ResponseReceiptStates.Available, this.AccountSession); // update to the DB response = Update(response); // log successful update this.Logger.Info(string.Format("successfully set response state to available for Id {0} via user {1}", scheme.Id, this.AccountSession.MemberId)); // create and return the new provider response scheme var consumerPortfolio = this.Mongo.GetConsumerPortfolio(response.ConsumerPortfolioId); var providerPortfolio = this.Mongo.GetProviderPortfolio(response.ProviderPortfolioId); // notify the switch board this.Switchboard.ResponseUpdatedAsAvailable(response, providerPortfolio, consumerPortfolio); // return the updated scheme return(GetProviderResponseScheme(response.Id)); } else { // log non-existent consumer group this.Logger.Warn(string.Format("could not set response to available for Id {0} because it does not exist via user {1}", scheme.Id, this.AccountSession.MemberId)); } return(scheme); }