Example #1
0
        public IActionResult Start(Models.IndexModel model, string action)
        {
            LogController.Begin();
            if (model.FilterList == null | (model.FilterList != null && model.FilterList.flist == null))
            {
                var msg = HelperController.GetMessage("Index.Err.NoFilter");
                LogController.LogError(msg.txt);
                Program.indexModel.ExceptionMessage = msg.txt;
                return(RedirectToAction("Index", "Home"));
            }

            SessionController.SaveSession(model.FilterList);

            Program.indexModel.ExceptionMessage = model.ExceptionMessage;
            Program.indexModel.ErrorFilterList  = model.ErrorFilterList;
            if (!String.IsNullOrEmpty(action) && action != "Start")
            {
                Program.indexModel.FilterList.Remove(action);
                return(RedirectToAction("Index", "Home"));
            }


            Program.indexModel.FilterList = new Classes.FList(model.FilterList);

            //da "GetContent" nicht statisch
            try
            {
                queryController qController = new queryController();
                Program.indexModel.ContentList = new List <Classes.Content>();
                Program.indexModel.ContentList = qController.GetContent(Program.indexModel.FilterList.flist);
            }
            catch (Exception ex)
            {
                LogController.LogError(String.Format(HelperController.GetMessage("Helper.Err.QueryController").txt, ex.ToString()));
                Program.indexModel.ExceptionMessage = HelperController.GetMessage("Helper.Err.QueryController").ext;
            }


            return(RedirectToAction("Index", "Home"));
        }
Example #2
0
        //
        // GET: /Hone/
        public ActionResult Index()
        {
            Models.IndexModel model = new Models.IndexModel();
            var sType = "";

            for (int i = 0; i < 3; i++)
            {
                sType = WidgetType.PieChart.ToString();
                model.Widgets.Add(
                    new Reporting.Models.WidgetModel()
                    {
                        Id = i + 1,
                        Title = "Blah Pie",
                        DataUrl = "/api/pie",
                        Query = "This Week",
                        QueryOptions = new List<String> { "This Week", "Last Week", "This Month", "Last Month" },
                        Type = sType
                    });

            }

            for (int i = 0; i < 3; i++)
            {
                sType = WidgetType.LineChart.ToString();
                model.Widgets.Add(
                    new WidgetModel()
                    {
                        Id = i + 1,
                        Title = "Blah Line",
                        DataUrl = "/api/line",
                        Query = "This Week",
                        QueryOptions = new List<String> { "This Week", "Last Week", "This Month", "Last Month" },
                        Type = sType
                    });
            }

            return View(model);
        }
 public ActionResult Index(Models.IndexModel model)
 {
     return(View(model));
 }
 public ActionResult Index()
 {
     Models.IndexModel model = new Models.IndexModel();
     return View(model);
 }
 public ActionResult Index()
 {
     Models.IndexModel model = new Models.IndexModel(_env);
     return(View(model));
 }
Example #6
0
        public IActionResult SaveToCsv(Models.IndexModel indexModel, int newSite = -1, int newCps = -1)
        {
            LogController.Begin();
            Program.indexModel.ErrorFilterList  = indexModel.ErrorFilterList;
            Program.indexModel.ExceptionMessage = indexModel.ExceptionMessage;
            int num = 0;

            //change only the actual shown part of the contentlist
            for (int i = 0 + Program.indexModel.cps * Program.indexModel.actSite; i < Program.indexModel.ContentList.Count && i < Program.indexModel.cps * (Program.indexModel.actSite + 1); i++)
            {
                int j = i % Program.indexModel.cps;
                Program.indexModel.ContentList[i].download = indexModel.PartialContentList[j].download;

                if (Program.indexModel.ContentList[i].download)
                {
                    num++;
                }
            }
            if (num > 5)
            {
                Program.indexModel.ExceptionMessage = HelperController.GetMessage("Index.Err.ToManyFiles").txt;
                return(RedirectToAction("Index", "Home"));
            }

            if (newSite >= 0)
            {
                return(SetActSite(newSite));
            }
            if (newCps >= 0)
            {
                return(SetCps(newCps));
            }



            switch (Program.indexModel.database.KeyName)
            {
            case ("geoprofiles"):

                var zipFile = FileController.DownloadAndProcessGEOProfiles(Program.indexModel.ContentList);

                if (zipFile != null && System.IO.File.Exists(zipFile))
                {
                    var bArray = System.IO.File.ReadAllBytes(zipFile);
                    return(File(bArray, "application/octet-stream", "export.zip"));
                }
                else
                {
                    Controllers.LogController.LogError($"Zipfile could not be accessed at {zipFile}");
                }
                //break;
                var csv = FileController.WriteListToCsv(Program.indexModel.ContentList);
                if (csv != null)
                {
                    var bArray = System.Text.Encoding.UTF8.GetBytes(csv.ToString());
                    return(File(bArray, "application/octet-stream", "export.csv"));
                }
                break;

            case ("gds"):
                var processedPath = FileController.DowloadAndProcessGDS(Program.indexModel.ContentList);
                if (processedPath != null)
                {
                    return(RedirectToAction("Upload", "Upload"));
                }
                break;
            }

            return(RedirectToAction("Index", "Home"));
        }
 public ActionResult Index(Models.IndexModel postModel)
 {
     postModel.FormPostMessage = "Your form posted";
     return(View(postModel));
 }