예제 #1
0
        private void changeState(bool save)
        {
            watch.Stop();
            elapsedSeconds = (int)watch.ElapsedMilliseconds / 1000;

            end = DateTime.Now;

            // Console.WriteLine(currentState.ToString() + "  a  " + StateList[currentState].name);
            if (save && currentState != 0 && elapsedSeconds > 3) // Só grava no banco se ficou mais de 3 segundos na atividade
            {
                lastOperation = "Saved to db!";
                DalHelper.Add(new Models.Historico(0, StateList[currentState].name, elapsedSeconds, start, end));
            }
            else
            {
                lastOperation = "Ignored";
            }
            ////////////////////////////////
            watch = System.Diagnostics.Stopwatch.StartNew();
            start = DateTime.Now;
            currentState++;
            if (currentState >= StateList.Count)
            {
                currentState = 0;
            }
        }
예제 #2
0
        public List <string> getAllDays()
        {
            List <string> list = new List <string> {
            };
            DataTable dt       = DalHelper.GetDailySummary();

            for (int x = 0; x < dt.Rows.Count; x++)
            {
                list.Add(dt.Rows[x].Field <string> ("date") + " - " + dt.Rows[x].Field <string>("state") + " - " + dt.Rows[x].Field <string>("totalTime").ToString());
            }

            return(list);
        }
예제 #3
0
 public void resetData()
 {
     DalHelper.DeleteAllHistoricos();
 }