public ActionResult getTimeSpan(ETtimeSpan model)
        {
            string userInput = model.start + " ; " + model.end;
            string startDate = model.start;
            string endDate   = model.end;

            //////Checking all the hourly data record to confirm if it has been stored in database one by one
            //get time span to get file name of each hourly data file within the time span
            if (startDate == null)
            {
                startDate = Convert.ToString(DateTime.Now.AddMonths(-1)); //default to check if delete hourly data from one month ago to one week agao
            }

            DateTime theStartDate = Convert.ToDateTime(startDate);

            theStartDate = theStartDate.AddDays(-1);

            //get the day before the  startDate data for daily et calcualting
            startDate = Convert.ToString(theStartDate);
            string strYear5  = "";
            string strMonth5 = "";
            string strDay5   = "";

            strYear5 = Convert.ToString(theStartDate.Year);
            if (theStartDate.Month < 10)
            {
                strMonth5 = "0" + Convert.ToString(theStartDate.Month);
            }
            else
            {
                strMonth5 = Convert.ToString(theStartDate.Month);
            }
            if (theStartDate.Day < 10)
            {
                strDay5 = "0" + Convert.ToString(theStartDate.Day);
            }
            else
            {
                strDay5 = Convert.ToString(theStartDate.Day);
            }

            startDate = strYear5 + "-" + strMonth5 + "-" + strDay5;



            if (endDate == null)
            {
                endDate = Convert.ToString(DateTime.Now.AddDays(-7));
                //default end date is one week ago
            }

            DateTime theEndDate = Convert.ToDateTime(endDate);
            string   strYear6   = "";
            string   strMonth6  = "";
            string   strDay6    = "";

            strYear6 = Convert.ToString(theEndDate.Year);
            if (theEndDate.Month < 10)
            {
                strMonth6 = "0" + Convert.ToString(theEndDate.Month);
            }
            else
            {
                strMonth6 = Convert.ToString(theEndDate.Month);
            }
            if (theEndDate.Day < 10)
            {
                strDay6 = "0" + Convert.ToString(theEndDate.Day);
            }
            else
            {
                strDay6 = Convert.ToString(theEndDate.Day);
            }

            endDate = strYear6 + "-" + strMonth6 + "-" + strDay6;



            DateTime dateTime1 = Convert.ToDateTime(startDate + " " + "00:00:00");
            DateTime dateTime2 = Convert.ToDateTime(endDate + " " + "23:00:00");

            TimeSpan hoursSpan    = dateTime2 - dateTime1;
            double   passedHours  = hoursSpan.TotalHours;
            double   iPassedHours = Math.Round(passedHours);
            TimeSpan hourIntervel = new TimeSpan(0, 1, 0, 0); //one hour
            DateTime tempDateTime = dateTime1.AddHours(-1);
            string   theYear      = "";
            string   theMonth     = "";
            string   theDay       = "";
            string   theHour      = "";
            string   theFileName  = "";

            if (passedHours >= 1)
            {
                for (int i = 1; i <= iPassedHours; i++)
                {
                    tempDateTime = tempDateTime + hourIntervel;
                    theYear      = Convert.ToString(tempDateTime.Year);

                    if (tempDateTime.Month > 9)
                    {
                        theMonth = Convert.ToString(tempDateTime.Month);
                    }
                    else
                    {
                        theMonth = "0" + Convert.ToString(tempDateTime.Month);
                    }
                    if (tempDateTime.Day > 9)
                    {
                        theDay = Convert.ToString(tempDateTime.Day);
                    }
                    else
                    {
                        theDay = "0" + Convert.ToString(tempDateTime.Day);
                    }
                    if (tempDateTime.Hour > 9)
                    {
                        theHour = Convert.ToString(tempDateTime.Hour);
                    }
                    else
                    {
                        theHour = "0" + Convert.ToString(tempDateTime.Hour);
                    }
                    theYear     = Convert.ToString(tempDateTime.Year);
                    theFileName = "Waverley_" + theYear + "-" + theMonth + "-" + theDay + "_" + theHour + "-00_FluxData" + ".dat";
                    // Check and call etDataFileDelete if the hourly data file has been stored in database
                    TableSelect tbSelect = new TableSelect();

                    DataTable dt = tbSelect.DoSelect("etc", "dbo", "recordNum,ts", " ts='" + theYear + "-" + theMonth + "-" + theDay + " " + theHour + ":00:00'", "recordNum");
                    int       deleteOperationResult = 1;
                    if (!((dt != null) && (dt.Rows.Count > 0)))
                    {
                        //// The hourly data has not been stored in database.
                    }
                    else
                    {
                        ////The hourly data has been stored in database.
                        // call etDataFileDelete()
                        deleteOperationResult = DeleteEtDataFile(theFileName);
                    }

                    if (deleteOperationResult == 1)
                    {
                        ViewBag.deleteOperationResponse = "Deleting hourly data file is unsuccessful.";
                    }
                }
            }


            //////return Content(deleteResponse.ToString());
            //ViewBag.fromControllerMessage = "The user input is " + userInput;
            //ViewBag.test = "This is test__";
            return(View());
        }
        public ActionResult theTimeSpan()
        {
            ETtimeSpan timeSpanModel = new ETtimeSpan();

            return(View(timeSpanModel));
        }