public CloseQuoteResponse CloseQuote(IOrganizationService service, EntityReference quote, int statuscode)
{
// Close the quote
Entity quoteClose = new Entity("quoteclose");
quoteClose.Attributes.Add("quoteid", new EntityReference("quote", quote.Id));
quoteClose.Attributes.Add("subject", "Quote rejected.");
CloseQuoteRequest closeQuoteRequest = new CloseQuoteRequest()
{
RequestName = "CloseQuote",
QuoteClose = quoteClose,
Status = new OptionSetValue(statuscode)
};
return (CloseQuoteResponse)service.Execute(closeQuoteRequest);
}