Ejemplo n.º 1
0
        public ActionResult Index()
        {
            TrendModel trendModel = new TrendModel();

            trendModel.SelectedExchange  = Exchange.FAKE_NASDAQ;
            trendModel.SelectedSymbolId  = trendModel.Symbols.Where(x => x.Value == "1").SingleOrDefault().Value;
            trendModel.SelectedSymbolVal = trendModel.Symbols.Where(x => x.Value == "1").SingleOrDefault().Text;

            return(View(trendModel));
        }
Ejemplo n.º 2
0
        public IList <TrendModel> GetWakeTrend(DateTime date)
        {
            var setting = _settingService.GetCurrentSetting();

            var data = _sleepService.GetSleepDataByDate(date)
                       .OrderBy(d => d.SleepTime)
                       .ToList();

            IList <TrendModel> result = new List <TrendModel>();

            if (data.Count > 0)
            {
                DateTime targetTime = setting.TargetWakeTime;

                foreach (var item in data)
                {
                    double totalHours    = (item.WakeTime - targetTime).TotalHours;
                    int    intHours      = Convert.ToInt32(Math.Floor(totalHours));
                    double decimailHours = totalHours - intHours;

                    totalHours = (intHours % 24) + decimailHours;
                    double yValue = totalHours > 12 ? totalHours - 24 : totalHours;

                    TrendModel trend = new TrendModel
                    {
                        YValue      = yValue,
                        AxisXLabel  = item.WakeTime.ToString("MM/dd"),
                        ToolTipText = item.WakeTime.ToString("HH:mm")
                    };

                    result.Add(trend);
                }
            }

            return(result);
        }
Ejemplo n.º 3
0
 public ActionResult Search(TrendModel trendModel)
 {
     trendModel.SelectedSymbolVal = trendModel.Symbols.Where(x => x.Value == trendModel.SelectedSymbolId).SingleOrDefault().Text;
     return(View("Index", trendModel));
 }