Ejemplo n.º 1
0
        public static bool StartStopWatch(string username)
        {
            string          startTime = DateTime.Now.ToString("yyyyMMdd hhmmss");
            StopwatchEntity swe       = new StopwatchEntity(username, startTime);

            swe.isStarted = true;
            swe.StartTime = startTime;

            CloudTable table = Initializer();

            StopwatchEntity swe2 = FetchPartition(table, username);

            if (swe2 == null)
            {
                // Create the TableOperation object that inserts the customer entity.
                TableOperation insertOperation = TableOperation.Insert(swe);
                // Execute the insert operation.
                TableResult tr = table.Execute(insertOperation);
            }
            else
            {
                StopStopWatch(username);
            }
            return(true);
        }
Ejemplo n.º 2
0
        public static bool StopStopWatch(string username)
        {
            CloudTable table = Initializer();

            StopwatchEntity swe2 = FetchPartition(table, username);

            swe2.StopTime  = DateTime.Now.ToString("yyyyMMdd hhmmss");
            swe2.isStarted = false;
            // Create the TableOperation object that inserts the customer entity.
            TableOperation insertOperation = TableOperation.Merge(swe2);
            // Execute the insert operation.
            TableResult tr = table.Execute(insertOperation);

            return(true);
        }