public JsonResult report(string organisation, string workitemtype = "0", string projectName = "0") { if (workitemtype != "0") { c.WIcountType = GetWorkitemCountByType(organisation, workitemtype, projectName); org.counts = c; return(Json(org, JsonRequestBehavior.AllowGet)); } req = new APIRequest(Session["PAT"].ToString()); string url; url = BaseURL + "/" + organisation + "/_apis/projects?api-version=" + version; string response = req.ApiRequest(url); org = JsonConvert.DeserializeObject <OrgModel>(response); countGen count = new countGen(); org.counts = new orgCounts(); url = BaseURL + "/" + organisation + "/_apis/process/processes?api-version=" + version; response = req.ApiRequest(url); count = JsonConvert.DeserializeObject <countGen>(response); c.processCount = count.Count; foreach (var project in org.Value) { url = BaseURL + organisation + "/" + project.Name + "/_apis/build/definitions?api-version=" + version; response = req.ApiRequest(url); project.counts = new orgCounts(); count = JsonConvert.DeserializeObject <countGen>(response); project.counts.buildDefCount = count.Count; c.buildDefCount += count.Count; url = BaseURLvsrm + organisation + "/" + project.Name + "/_apis/release/definitions?api-version=" + version; response = req.ApiRequest(url); count = JsonConvert.DeserializeObject <countGen>(response); project.counts.releaseDefCount = count.Count; c.releaseDefCount += count.Count; url = BaseURL + organisation + "/" + project.Name + "/_apis/git/repositories?api-version=" + version; response = req.ApiRequest(url); count = JsonConvert.DeserializeObject <countGen>(response); project.counts.repoCount = count.Count; //c.repoCount += count.Count; } // Calling Repos Count AllReposCount(organisation); // Calling Users Count AllUsersCount(organisation); // Calling WorkitemsCount Count AllWorKitemsCount(organisation); WITypes(organisation); //Calling WorkItemCountByType org.counts = c; return(Json(org, JsonRequestBehavior.AllowGet)); }
public void AllReposCount(string organisation) { APIRequest req; //OrgModel org = new OrgModel(); string url; try { url = BaseURL + "/" + organisation + "/_apis/git/repositories?api-version=" + version; req = new APIRequest(Session["PAT"].ToString()); string response = req.ApiRequest(url); countGen count = JsonConvert.DeserializeObject <countGen>(response); c.repoCount = count.Count; } catch (Exception) { } //return org; }