public string GetGroupChangeInformationBetweenDates(SqlDateTime begin, SqlDateTime end) { string blank = ""; Collection <RequestForm> forms = GetApprovedRequestsBetweenDates(begin, end); List <string> groups = _dataRequest.GetAllGroups(); Dictionary <string, int> groupCount = new Dictionary <string, int>(); foreach (string entry in groups) { groupCount.Add(entry, 0); } foreach (RequestForm entry in forms) { if (entry != null) { string pastGroup = entry.Current.BazookaInfo.Group; string futureGroup = entry.Future.BazookaInfo.Group; if (groupCount.ContainsKey(pastGroup)) { groupCount[pastGroup]--; } if (groupCount.ContainsKey(futureGroup)) { groupCount[futureGroup]++; } } } foreach (string entry in groups) { if (groupCount[entry] != 0) { blank += String.Format("Group {0} changed by {1} people\n", entry, groupCount[entry]); } } return(blank); }
// GET api/RequestForm/GetAllGroups public List<string> GetAllGroups() { RequestDataDB dbaccess = new RequestDataDB(); return dbaccess.GetAllGroups(); }