/// <summary> /// Gets the invoices. /// </summary> /// <param name="siteId">The site id.</param> /// <param name="username">The username.</param> /// <param name="password">The password.</param> /// <param name="xml">The XML.</param> /// <returns></returns> public string GetInvoices(Guid siteId, string username, string password, string xml) { var user = _authorization.Authorize(siteId, username, password); if (user == null || !Access.Check(user, "API").Read) { return(StatusHelper.FormatMessage(StatusCodes.AccessDenied, MethodBase.GetCurrentMethod().Name, _result).ToString(SaveOptions.DisableFormatting)); } XDocument inputXml; try { inputXml = XDocument.Parse(xml); } catch (Exception ex) { Log.Error(string.Format("LeadForce.API.GetInvoices error, SiteId: {0}, UserName: {1}, Xml: {2}", siteId, username, xml), ex); return(StatusHelper.FormatMessage(StatusCodes.InvalidParameters, MethodBase.GetCurrentMethod().Name, _result).ToString(SaveOptions.DisableFormatting)); } try { var invoices = Invoices.GetInvoices(siteId, inputXml); _result = StatusHelper.FormatMessage(StatusCodes.Ok, MethodBase.GetCurrentMethod().Name, _result); _result.Document.Element("LeadForceResponse").Add(new XElement("Result", invoices.Document.FirstNode)); } catch (Exception ex) { Log.Error(string.Format("LeadForce.API.GetInvoices error, SiteId: {0}, UserName: {1}, Xml: {2}", siteId, username, xml), ex); return(StatusHelper.FormatMessage(StatusCodes.InternalError, MethodBase.GetCurrentMethod().Name, _result).ToString(SaveOptions.DisableFormatting)); } return(_result.ToString(SaveOptions.DisableFormatting)); }