示例#1
0
        // GET: DocType/Delete/5
        public ActionResult Delete(Guid id)
        {
            var model = new DocTypeViewModel();

            model.DocType = DocTypeRepository.Read(id);
            return(View(model));
        }
示例#2
0
 public ActionResult Create(DocTypeViewModel model)
 {
     try
     {
         var docType = DocTypeRepository.Create(model.DocType.Name, model.DocType.Description, model.DocType.MetaTags);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View(model));
     }
 }
示例#3
0
 public ActionResult Edit(DocTypeViewModel model)
 {
     try
     {
         // TODO: Add update logic here
         var docType = DocTypeRepository.Update(model.DocType.Id.Value, model.DocType.Name, model.DocType.Description, model.DocType.MetaTags);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View(model));
     }
 }
示例#4
0
        public void Setup()
        {
            _transactionScope     = new TransactionScope();
            _subDocTypeRepository = new SubDocTypeRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
            _docTypeRepository    = new DocTypeRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);

            _docType1 = BuildMeA.DocType("code 5", "description 5");
            _docType2 = BuildMeA.DocType("code 6", "description 6");

            _subDocType1 = BuildMeA.SubDocType("code 1", "description 1").WithDocType(_docType1);
            _subDocType2 = BuildMeA.SubDocType("code 2", "description 3").WithDocType(_docType1);
            _subDocType3 = BuildMeA.SubDocType("code 3", "description 3").WithDocType(_docType1);
            _subDocType4 = BuildMeA.SubDocType("code 4", "description 4").WithDocType(_docType2);
        }
示例#5
0
        // GET: Doc/Delete/5
        public ActionResult Delete(Guid id)
        {
            var model = new DocViewModel();

            var doc = DocRepository.Read(id);

            var docType = DocTypeRepository.Read(Guid.Parse(doc.type));

            model.MetaTags = MetaTagRepository.ReadMany(docType.MetaTags);
            model.Type     = docType.Name;
            model.TypeId   = docType.Id;

            model.Values = mapMetaTagsAndDocValue(model.MetaTags, doc);
            return(View(model));
        }
示例#6
0
 public ActionResult Delete(Guid id, FormCollection collection)
 {
     try
     {
         // TODO: Add delete logic here
         var model = DocTypeRepository.Delete(id);
         return(RedirectToAction("Index"));
     }
     catch
     {
         var model = new DocTypeViewModel();
         model.DocType = DocTypeRepository.Read(id);
         return(View(model));
     }
 }
示例#7
0
        // GET: Doc/FastEntry
        public ActionResult FastEntry(Guid type)
        {
            var model   = new FastEntryViewModel();
            var docType = DocTypeRepository.Read(type);

            model.MetaTags = MetaTagRepository.ReadMany(docType.MetaTags);
            model.Type     = docType.Name;
            model.TypeId   = type;

            model.AutoCompletes = new Dictionary <string, List <string> >();

            foreach (var metaTag in model.MetaTags.Where(m => m.DataType == "string").ToList())
            {
                model.AutoCompletes.Add(metaTag.Name, DocRepository.GetUniqueStringValuesByMetaTagName(metaTag.Name));
            }

            return(View(model));
        }
示例#8
0
        // GET: Doc/Create
        public ActionResult Create(Guid type)
        {
            var model   = new DocViewModel();
            var docType = DocTypeRepository.Read(type);

            model.MetaTags = MetaTagRepository.ReadMany(docType.MetaTags);
            model.Type     = docType.Name;

            model.AutoCompletes = new Dictionary <string, List <string> >();

            foreach (var metaTag in model.MetaTags.Where(m => m.DataType == "string").ToList())
            {
                model.AutoCompletes.Add(metaTag.Name, DocRepository.GetUniqueStringValuesByMetaTagName(metaTag.Name));
            }

            model.MostRecentDocuments = DocRepository.GetMostRecentDocumentsForDocType(type, -90);

            return(View(model));
        }
 public void Setup()
 {
     _transactionScope       = new TransactionScope();
     _autoApprovalRepository =
         new AutoApprovalRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
     _docTypeRepository    = new DocTypeRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
     _subDocTypeRepository = new SubDocTypeRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
     _manCoRepository      = new ManCoRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
     _docType      = BuildMeA.DocType("code", "description");
     _manCo1       = BuildMeA.ManCo("code1", "description1");
     _manCo2       = BuildMeA.ManCo("code2", "description2");
     _subDocType1  = BuildMeA.SubDocType("code 1", "description 1").WithDocType(_docType);
     _subDocType2  = BuildMeA.SubDocType("code 2", "description 3").WithDocType(_docType);
     _autoApproval =
         BuildMeA.AutoApproval().WithDocType(_docType).WithSubDocType(_subDocType1).WithManCo(_manCo1);
     _autoApproval2 =
         BuildMeA.AutoApproval().WithDocType(_docType).WithSubDocType(_subDocType2).WithManCo(_manCo2);
     _autoApproval3 =
         BuildMeA.AutoApproval().WithDocType(_docType).WithSubDocType(_subDocType2).WithManCo(_manCo1);
 }
示例#10
0
        public void Setup()
        {
            _transactionScope        = new TransactionScope();
            _appManCoEmailRepository = new AppManCoEmailRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
            _manCoRepository         = new ManCoRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
            _applicationRepository   = new ApplicationRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
            _docTypeRepository       = new DocTypeRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
            _manCo1       = BuildMeA.ManCo("description", "code");
            _manCo2       = BuildMeA.ManCo("description2", "code2");
            _application1 = BuildMeA.Application("code", "description");
            _docType1     = BuildMeA.DocType("code", "description");

            _manCoRepository.Create(_manCo1);
            _manCoRepository.Create(_manCo2);
            _applicationRepository.Create(_application1);
            _docTypeRepository.Create(_docType1);

            _appManCoEmail  = BuildMeA.AppManCoEmail(_application1.Id, _manCo1.Id, _docType1.Id, "accountNumber", "email");
            _appManCoEmail2 = BuildMeA.AppManCoEmail(_application1.Id, _manCo2.Id, _docType1.Id, "accountNumber2", "email2");
            _appManCoEmail3 = BuildMeA.AppManCoEmail(_application1.Id, _manCo1.Id, _docType1.Id, "accountNumber3", "email3");
            _appManCoEmail4 = BuildMeA.AppManCoEmail(_application1.Id, _manCo2.Id, _docType1.Id, "accountNumber4", "email4");
        }
示例#11
0
        // GET: Doc/Details/5
        public ActionResult Details(Guid id, string format)
        {
            var model = new DocViewModel();

            var doc = DocRepository.Read(id);

            var docType = DocTypeRepository.Read(Guid.Parse(doc.type));

            model.MetaTags = MetaTagRepository.ReadMany(docType.MetaTags);
            model.Id       = Guid.Parse(doc.id);
            model.Type     = docType.Name;
            model.TypeId   = docType.Id;

            model.Values = mapMetaTagsAndDocValue(model.MetaTags, doc);

            if (format != null && format == "json")
            {
                return(Json(model, JsonRequestBehavior.AllowGet));
            }

            return(View(model));
        }
示例#12
0
        // GET: Doc/Edit/5
        public ActionResult Edit(Guid id)
        {
            var model = new DocViewModel();

            var doc = DocRepository.Read(id);

            var docType = DocTypeRepository.Read(Guid.Parse(doc.type));

            model.MetaTags = MetaTagRepository.ReadMany(docType.MetaTags);
            model.Id       = Guid.Parse(doc.id);
            model.Type     = docType.Name;
            model.TypeId   = docType.Id;

            model.Values = mapMetaTagsAndDocValue(model.MetaTags, doc);

            model.AutoCompletes = new Dictionary <string, List <string> >();

            foreach (var metaTag in model.MetaTags.Where(m => m.DataType == "string").ToList())
            {
                model.AutoCompletes.Add(metaTag.Name, DocRepository.GetUniqueStringValuesByMetaTagName(metaTag.Name));
            }

            return(View(model));
        }
示例#13
0
 public void Setup()
 {
     _transactionScope  = new TransactionScope();
     _docTypeRepository = new DocTypeRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
     _docType1          = BuildMeA.DocType("code", "description");
 }
示例#14
0
        // GET: Doc
        public ActionResult Index(string query, string docType, string from, string to)
        {
            var model = new DocIndexViewModel();

            model.Query   = (query != null) ? query : "";
            model.DocType = docType;
            model.From    = from;
            model.To      = to;

            bool docTypeIsSet = (docType != null && docType.Length > 0);

            var queryWithFilters = model.Query;

            queryWithFilters += (docTypeIsSet && queryWithFilters.Length > 0) ? ", " : "";
            queryWithFilters += (docTypeIsSet) ? " type:" + docType : "";

            DateTime fromDate;
            DateTime toDate;
            int?     diffFomDays = null;
            int?     diffToDays  = null;

            if (DateTime.TryParse(from, out fromDate))
            {
                diffFomDays = (fromDate - DateTime.Now.Date).Days;
            }

            if (DateTime.TryParse(to, out toDate))
            {
                diffToDays = (toDate - DateTime.Now.Date).Days;
            }

            var docs = new List <dynamic>();

            if (queryWithFilters.Length > 0 || diffFomDays.HasValue || diffToDays.HasValue)
            {
                docs = DocRepository.Search(queryWithFilters, diffFomDays, diffToDays, 50);
            }
            else
            {
                docs = DocRepository.Index();
            }

            var list = new List <DocViewModel>();

            foreach (dynamic doc in docs)
            {
                var     docModel = new DocViewModel();
                DocType type     = DocTypeRepository.Read(Guid.Parse(doc.type));
                docModel.Id   = Guid.Parse(doc.id);
                docModel.Type = type.Name;
                try
                {
                    docModel.Name = doc.name;
                } catch (Exception e)
                {
                    docModel.Name = "";
                }

                docModel.MetaTags = MetaTagRepository.ReadMany(type.MetaTags);
                list.Add(docModel);
            }
            model.Docs = list;

            model.DocTypes = DocTypeRepository.Index();

            return(View(model));
        }
示例#15
0
 // GET: DocType
 public ActionResult Index()
 {
     return(View(DocTypeRepository.Index()));
 }
示例#16
0
        // GET: Analysis
        public ActionResult Index(List <string> categories, List <string> facts, string query, string docType, string chartType, string aggFunc,
                                  string from, string to)
        {
            var model = new AnalysisViewModel();

            if (docType == "_all" || docType == null || docType == "")
            {
                model.Categories = MetaTagRepository.Index().Where(mt => mt.DataType == "string" || mt.DataType == "datetime" || mt.DataType == "text").ToDictionary <MetaTag, string>(mt => mt.Id.ToString());
                model.Facts      = MetaTagRepository.Index().Where(mt => mt.DataType == "number").ToDictionary <MetaTag, string>(mt => mt.Id.ToString());
            }
            else
            {
                model.Categories = MetaTagRepository.ReadMany(DocTypeRepository.Read(Guid.Parse(docType)).MetaTags)
                                   .Where(mt => mt.DataType == "string" || mt.DataType == "datetime" || mt.DataType == "text")
                                   .ToDictionary <MetaTag, string>(mt => mt.Id.ToString());

                model.Facts = MetaTagRepository.ReadMany(DocTypeRepository.Read(Guid.Parse(docType)).MetaTags)
                              .Where(mt => mt.DataType == "number")
                              .ToDictionary <MetaTag, string>(mt => mt.Id.ToString());
            }

            categories = (categories != null) ? categories  : new List <string>();
            model.SelectedCategories = categories;
            model.SelectedFacts      = (facts != null)? facts : new List <string>();

            if (chartType == null)
            {
                chartType = "bar";
            }

            if (aggFunc == null)
            {
                aggFunc = "sum";
            }

            model.ChartType = chartType;
            model.AggFunc   = aggFunc;

            model.Query = query;
            Guid docTypeGuid;

            if (Guid.TryParse(docType, out docTypeGuid))
            {
                if (query == null)
                {
                    query = "";
                }

                if (query.Length > 0)
                {
                    query += ", ";
                }

                query += "type:" + docType;
            }

            // from and to date
            model.From = from;
            model.To   = to;

            DateTime fromDate;
            DateTime toDate;
            int?     diffFomDays = null;
            int?     diffToDays  = null;

            if (DateTime.TryParse(from, out fromDate))
            {
                diffFomDays = (fromDate.Date - DateTime.Now.Date).Days;
            }

            if (DateTime.TryParse(to, out toDate))
            {
                diffToDays = (toDate.Date - DateTime.Now.Date).Days;
            }

            var selectedCategoryNames = new List <string>();
            var selectedCategoryTypes = new List <string>();

            // in order to save order of selected categories, use iteration
            foreach (var cat in categories)
            {
                var catName = model.Categories.Where(c => c.Value.Id.ToString() == cat).Select(c => c.Value.Name).FirstOrDefault();
                var catType = model.Categories.Where(c => c.Value.Id.ToString() == cat).Select(c => c.Value.DataType).FirstOrDefault();
                selectedCategoryNames.Add(catName);
                selectedCategoryTypes.Add(catType);
            }

            var selectedFactNames = (facts != null) ? model.Facts.Where(c => facts.Contains(c.Key.ToString())).Select(c => c.Value.Name).ToList <string>() : new List <string>();

            var valueList = new List <List <float> >();
            var labelList = new List <string>();
            var titleList = new List <string>();

            // Todo Build Datasets for chartjs markup
            if (selectedCategoryNames.Count > 1)
            {
                var aggs = DocRepository.Aggregate(selectedCategoryNames, selectedFactNames[0], query, aggFunc, diffFomDays, diffToDays);
                titleList = aggs.Keys.Select(k => k.Split('_')[1]).Distinct().ToList();

                var groupKeys = aggs.Keys.Select(k => k.Split('_')[0]).Distinct().ToList();
                labelList = groupKeys;

                foreach (var group in groupKeys)
                {
                    var valuePairs = aggs.Where(a => a.Key.ToLower().Contains(group.ToLower())).ToList();

                    var values = new List <float>();
                    foreach (var title in titleList)
                    {
                        var pair = valuePairs.Where(p => p.Key.ToLower().Contains(title.ToLower())).ToList();

                        if (pair.Count > 0)
                        {
                            values.Add(pair[0].Value);
                        }
                        else
                        {
                            values.Add(0.0f);
                        }
                    }

                    valueList.Add(values);
                }
            }
            else
            {
                foreach (var fact in selectedFactNames)
                {
                    var aggs   = DocRepository.Aggregate(selectedCategoryNames, fact, query, aggFunc, diffFomDays, diffToDays);
                    var values = (selectedCategoryNames.Count > 0 && selectedFactNames.Count > 0) ? aggs.Values.ToList <float>() : new List <float>();
                    valueList.Add(values);
                    titleList = aggs.Keys.Select(k => k.Replace("_", "")).ToList <string>().Distinct().ToList();

                    labelList.Add(fact);
                    labelList = (model.AggFunc != "count") ? labelList : new List <string>()
                    {
                        "Anzahl"
                    };

                    if (model.AggFunc == "count")
                    {
                        break;
                    }
                }
            }

            model.ChartModel = new ChartViewModel()
            {
                Height     = 400,
                Categories = titleList.Select(val =>
                {
                    DateTime dateTime;
                    if (DateTime.TryParse(val, out dateTime))
                    {
                        return(String.Format("{0:yyyy-MM-dd}", dateTime));
                    }
                    return(val);
                }
                                              ).ToList(),
                SeriesNames = labelList.Select(val =>
                {
                    DateTime dateTime;
                    if (DateTime.TryParse(val, out dateTime))
                    {
                        return(String.Format("{0:yyyy-MM-dd}", dateTime));
                    }
                    return(val);
                }
                                               ).ToList(),
                Values    = valueList,
                Type      = model.ChartType,
                Title     = "",
                HidePanel = true
            };

            model.DocType  = docType;
            model.DocTypes = DocTypeRepository.Index();

            return(View(model));
        }
示例#17
0
        public ActionResult Index()
        {
            var model = new HomeViewModel();

            // DateTime Range
            var queryRange = new Nest.DateRangeQuery();

            queryRange.Field                = new Nest.Field();
            queryRange.Field.Name           = "datum";
            queryRange.GreaterThanOrEqualTo = DateTime.Now.AddDays(-DateTime.Now.Day);
            queryRange.LessThanOrEqualTo    = DateTime.Now.AddDays(0);
            var rangeContainer = new Nest.QueryContainer(queryRange);

            // Name TagCloud
            var nameTagCloudModel = new TagCloudViewModel();

            nameTagCloudModel.Title = "Meist verwendete Namen";
            nameTagCloudModel.Tags  = new Dictionary <string, float>();
            var listOfQueriesTagCloud = new List <Nest.QueryContainer>();

            listOfQueriesTagCloud.Add(rangeContainer);

            var res = ElasticClientFactory.Client.Search <ExpandoObject>(s => s
                                                                         .Index("docs")
                                                                         .From(0)
                                                                         .Query(q => q
                                                                                .Bool(b => b
                                                                                      .Must(listOfQueriesTagCloud.ToArray())
                                                                                      )
                                                                                )
                                                                         .Aggregations(a =>
                                                                                       a.Terms("tagcloud", ta => ta.Field("name"))
                                                                                       )
                                                                         );

            foreach (var tag in (res.Aggregations["tagcloud"] as Nest.BucketAggregate).Items)
            {
                var nestTag = tag as Nest.KeyedBucket;
                nameTagCloudModel.Tags.Add(nestTag.Key, nestTag.DocCount.Value);
            }
            model.NameTagCloud = nameTagCloudModel;

            // DocType TagCloud
            var docTagCloudModel = new TagCloudViewModel();

            docTagCloudModel.Title = "Meist verwendete DocTypes";
            docTagCloudModel.Tags  = new Dictionary <string, float>();

            foreach (var docType in DocTypeRepository.Index())
            {
                var listOfQueriesDocType = new List <Nest.QueryContainer>();
                listOfQueriesDocType.Add(rangeContainer);

                var queryDocType = new Nest.MatchQuery();
                queryDocType.Field      = new Nest.Field();
                queryDocType.Field.Name = "type";
                queryDocType.Query      = docType.Id.ToString();
                var docTypesContainer = new Nest.QueryContainer(queryDocType);
                listOfQueriesDocType.Add(docTypesContainer);

                res = ElasticClientFactory.Client.Search <ExpandoObject>(s => s
                                                                         .Index("docs")
                                                                         .From(0)
                                                                         .Query(q => q
                                                                                .Bool(b => b
                                                                                      .Must(listOfQueriesDocType.ToArray())
                                                                                      )
                                                                                )
                                                                         );
                docTagCloudModel.Tags.Add(docType.Name, res.Total);
            }
            model.DocTypeTagCloud = docTagCloudModel;

            // Ort TagCloud
            var ortTagCloudModel = new TagCloudViewModel();

            ortTagCloudModel.Title = "Meist verwendete Orte";
            ortTagCloudModel.Tags  = new Dictionary <string, float>();
            res = ElasticClientFactory.Client.Search <ExpandoObject>(s => s
                                                                     .Index("docs")
                                                                     .From(0)
                                                                     .Query(q => q
                                                                            .Bool(b => b
                                                                                  .Must(listOfQueriesTagCloud.ToArray())
                                                                                  )
                                                                            )
                                                                     .Aggregations(a =>
                                                                                   a.Terms("tagcloud", ta => ta.Field("ort"))
                                                                                   )
                                                                     );

            foreach (var tag in (res.Aggregations["tagcloud"] as Nest.BucketAggregate).Items)
            {
                var nestTag = tag as Nest.KeyedBucket;
                ortTagCloudModel.Tags.Add(nestTag.Key, nestTag.DocCount.Value);
            }
            model.OrtTagCloud = ortTagCloudModel;

            // Kategorie TagCloud
            var kategorieTagCloudModel = new TagCloudViewModel();

            kategorieTagCloudModel.Title = "Meist verwendete Kategorien";
            kategorieTagCloudModel.Tags  = new Dictionary <string, float>();
            res = ElasticClientFactory.Client.Search <ExpandoObject>(s => s
                                                                     .Index("docs")
                                                                     .From(0)
                                                                     .Query(q => q
                                                                            .Bool(b => b
                                                                                  .Must(listOfQueriesTagCloud.ToArray())
                                                                                  )
                                                                            )
                                                                     .Aggregations(a =>
                                                                                   a.Terms("tagcloud", ta => ta.Field("kategorie")
                                                                                           .Aggregations(aa =>
                                                                                                         aa.Sum("summe", ts => ts.Field("preis"))
                                                                                                         ))
                                                                                   )
                                                                     );

            foreach (var tag in (res.Aggregations["tagcloud"] as Nest.BucketAggregate).Items)
            {
                var    nestTag = tag as Nest.KeyedBucket;
                double sum     = 0.0;
                var    sumAggs = (nestTag.Aggregations["summe"] as Nest.ValueAggregate);
                sum = sumAggs.Value.Value;

                kategorieTagCloudModel.Tags.Add(nestTag.Key, (int)sum);
            }
            model.KategorieTagCloud = kategorieTagCloudModel;

            // Handel TagCloud
            var handelTagCloudModel = new TagCloudViewModel();

            handelTagCloudModel.Title = "Meist verwendete Handel";
            handelTagCloudModel.Tags  = new Dictionary <string, float>();
            res = ElasticClientFactory.Client.Search <ExpandoObject>(s => s
                                                                     .Index("docs")
                                                                     .From(0)
                                                                     .Query(q => q
                                                                            .Bool(b => b
                                                                                  .Must(listOfQueriesTagCloud.ToArray())
                                                                                  )
                                                                            )
                                                                     .Aggregations(a =>
                                                                                   a.Terms("tagcloud", ta => ta.Field("handel")
                                                                                           .Aggregations(aa =>
                                                                                                         aa.Sum("summe", ts => ts.Field("preis"))
                                                                                                         )
                                                                                           )
                                                                                   )
                                                                     );

            foreach (var tag in (res.Aggregations["tagcloud"] as Nest.BucketAggregate).Items)
            {
                var    nestTag = tag as Nest.KeyedBucket;
                double sum     = 0.0;
                var    sumAggs = (nestTag.Aggregations["summe"] as Nest.ValueAggregate);
                sum = sumAggs.Value.Value;

                handelTagCloudModel.Tags.Add(nestTag.Key, (int)sum);
            }
            model.HandelTagCloud = handelTagCloudModel;

            // Preis Summe

            var listOfQueriesAusgaben = new List <Nest.QueryContainer>();

            listOfQueriesAusgaben.Add(rangeContainer);

            var queryAusgabe = new Nest.MatchQuery();

            queryAusgabe.Field      = new Nest.Field();
            queryAusgabe.Field.Name = "type";
            queryAusgabe.Query      = "e0c4f438-4509-449b-a491-3fa3093b4129";
            var docTypeContainer = new Nest.QueryContainer(queryAusgabe);

            listOfQueriesAusgaben.Add(docTypeContainer);


            res = ElasticClientFactory.Client.Search <ExpandoObject>(s => s
                                                                     .Index("docs")
                                                                     .From(0)
                                                                     .Size(1000)
                                                                     .Query(q => q
                                                                            .Bool(b => b
                                                                                  .Must(listOfQueriesAusgaben.ToArray())
                                                                                  )
                                                                            )
                                                                     .Aggregations(a =>
                                                                                   a.Sum("summe", aa => aa
                                                                                         .Field("preis"))
                                                                                   )
                                                                     );
            model.SummeAusgaben = res.Aggs.Sum("summe").Value.Value;

            // Einnahmen Summe
            var listOfQueriesEinnahmen = new List <Nest.QueryContainer>();

            listOfQueriesEinnahmen.Add(rangeContainer);
            var queryEinnahme = new Nest.MatchQuery();

            queryEinnahme.Field      = new Nest.Field();
            queryEinnahme.Field.Name = "type";
            queryEinnahme.Query      = "05ce209c-e837-4fc4-b2a4-6b54bf73be46";
            docTypeContainer         = new Nest.QueryContainer(queryEinnahme);
            listOfQueriesEinnahmen.Add(docTypeContainer);

            res = ElasticClientFactory.Client.Search <ExpandoObject>(s => s
                                                                     .Index("docs")
                                                                     .From(0)
                                                                     .Size(1000)
                                                                     .Query(q => q
                                                                            .Bool(b => b
                                                                                  .Must(listOfQueriesEinnahmen.ToArray())
                                                                                  )
                                                                            )
                                                                     .Aggregations(a =>
                                                                                   a.Sum("summe", aa => aa
                                                                                         .Field("betrag"))
                                                                                   )
                                                                     );
            model.SummeEinnahmen = res.Aggs.Sum("summe").Value.Value;

            return(View(model));
        }