Exemplo n.º 1
0
        public ActionResult DataQuery(UnparsedDataQueryFormModel unparsedDataQueryForm, string submit, FormCollection form)
        {
            DateTime startTime = new DateTime();
            DateTime endTime   = new DateTime();

            if (unparsedDataQueryForm.StartTime != null)
            {
                if (!DateTime.TryParse(unparsedDataQueryForm.StartTime.ToString(), out startTime))
                {
                    ViewData["startTime"] = "Invalid start date!";
                    return(View(DataQueryRepository.NewDataQueryModel(db)));
                }
            }
            if (unparsedDataQueryForm.EndTime != null)
            {
                if (!DateTime.TryParse(unparsedDataQueryForm.EndTime.ToString(), out endTime))
                {
                    ViewData["endTime"] = "Invalid end date!";
                    return(View(DataQueryRepository.NewDataQueryModel(db)));
                }
            }

            DataQueryFormModel dataQueryForm = DataQueryRepository.ParsedDataQueryForm(unparsedDataQueryForm);

            ViewData["norecords"] = "No records found.";

            switch (submit)
            {
            case "Query":
                return(View(DataQueryRepository.NewDataQueryModel(db, dataQueryForm)));

                break;

            case "Download":
                DownloadToSingleFile(dataQueryForm, form);
                return(View("Download"));

                break;
            }

            return(View(DataQueryRepository.NewDataQueryModel(db)));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Returns the Data Query start page.
 /// </summary>
 /// <returns></returns>
 public ActionResult DataQuery()
 {
     return(View(DataQueryRepository.NewDataQueryModel(db)));
 }