private bool HasBuild(AllBuildDetails allBuildDetails)
 {
     // no details, there is no build
     if (allBuildDetails == null)
         return false;
     // if there is a completed build, there is a build
     if (allBuildDetails.LastCompletedBuild != null)
         return true;
     // if there is a build in progress, there is a build
     bool buildInProgress = allBuildDetails.Status.IsInProgress;
     return buildInProgress;
 }
        public AllBuildDetails UpdateProject(Project project)
        {
            String url = NetUtils.ConcatUrls(project.Url, "/api/xml");

            logger.Info("Updating project from " + url);

            Credentials credentials = project.Server.Credentials;
            bool ignoreUntrustedCertificate = project.Server.IgnoreUntrustedCertificate;
            String xmlStr = DownloadString(credentials, url, false, ignoreUntrustedCertificate);

            if (logger.IsTraceEnabled)
                logger.Trace("XML: " + xmlStr);

            XmlDocument xml = new XmlDocument();
            xml.LoadXml(xmlStr);

            string status = xml.SelectSingleNode("/*/color").InnerText;
            string lastCompletedBuildUrl = XmlUtils.SelectSingleNodeText(xml, "/*/lastCompletedBuild/url");
            string lastSuccessfulBuildUrl = XmlUtils.SelectSingleNodeText(xml, "/*/lastSuccessfulBuild/url");
            string lastFailedBuildUrl = XmlUtils.SelectSingleNodeText(xml, "/*/lastFailedBuild/url");
            bool? stuck = XmlUtils.SelectSingleNodeBoolean(xml, "/*/queueItem/stuck");

            AllBuildDetails res = new AllBuildDetails();
            res.Status = GetStatus(status, stuck);
            res.LastCompletedBuild = GetBuildDetails(credentials, lastCompletedBuildUrl, ignoreUntrustedCertificate);
            res.LastSuccessfulBuild = GetBuildDetails(credentials, lastSuccessfulBuildUrl, ignoreUntrustedCertificate);
            res.LastFailedBuild = GetBuildDetails(credentials, lastFailedBuildUrl, ignoreUntrustedCertificate);

            logger.Info("Done updating project");
            return res;
        }