Beispiel #1
0
        protected async Task <int> getClientSummaryReport(ClientLookupProvider <T> lookupProvider
                                                          , Dictionary <string, string> kindDisplayNames)
        {
            //or we can write to file and email
            //var file = AppInstance.Instance.writeToFile("stuff to write");

            var countRes = AppInstance.Instance.ModuleContext.GetAllBobsCount();
            var asList   = (from item in countRes
                            let displayItem = new NameValuePair()
            {
                Name = kindDisplayNames[item.Name],
                Value = item.Value
            }
                            select displayItem.toDisplayText()).ToList();
            var resList = new List <string>()
            {
                Resources.GetString(Resource.String.sys_summary_blobcount),
                NameValuePair.getHeaderText()
            };

            resList.AddRange(asList);

            //also add client summary
            var recCount           = lookupProvider.GetCount();
            var clientSummaryCount = new NameValuePair()
            {
                Name  = "Client Summary",
                Value = recCount.ToString()
            };

            resList.Add(clientSummaryCount.toDisplayText());

            var summaryInfo = new LocalDB3().DB.Query <NameValuePair>(
                string.Format(
                    "select KindName as Name, count(*) as Value from {0} group by KindName",
                    Constants.KIND_DERIVED_RECORDSUMMARY)
                );

            resList.Add(System.Environment.NewLine);
            resList.Add("Summary of Records in " + Constants.KIND_DERIVED_RECORDSUMMARY);
            var asStringList = (from nvp in summaryInfo
                                select nvp.toDisplayText()).ToList();

            resList.AddRange(asStringList);
            var asText = string.Join(System.Environment.NewLine, resList);

            setTextResults(asText);
            return(0);
        }