private void PostToLog(uint joinNumber, string time)
        {
            try
            {
                uint quantaty = 0;

                switch (time)
                {
                case "morning":
                    quantaty = (uint)GetForMorning(joinNumber).ToArray().Length;
                    if (debug)
                    {
                        CrestronConsole.PrintLine("total for input {0} today morning: {1}\n", joinNumber, quantaty);
                    }
                    break;

                case "day":
                    quantaty = (uint)GetForDay(joinNumber).ToArray().Length;
                    if (debug)
                    {
                        CrestronConsole.PrintLine("total for input {0} today day: {1}\n", joinNumber, quantaty);
                    }
                    break;

                case "evening":
                    quantaty = (uint)GetForEvening(joinNumber).ToArray().Length;
                    if (debug)
                    {
                        CrestronConsole.PrintLine("total for input {0} today evening: {1}\n", joinNumber, quantaty);
                    }
                    break;

                case "night":
                    quantaty = (uint)GetForNight(joinNumber).ToArray().Length;
                    if (debug)
                    {
                        CrestronConsole.PrintLine("total for input {0} today night: {1}\n", joinNumber, quantaty);
                    }
                    break;

                default:
                    break;
                }

                var joinTracker = new JoinTrackerDaily()
                {
                    UUID       = Guid.NewGuid().ToString(),
                    JoinNumber = joinNumber,
                    Day        = DateTime.Today.ToString(),
                    Time       = time,
                    Quantity   = quantaty
                };

                repoLog.Create(joinTracker);
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
예제 #2
0
 public void Create(JoinTrackerDaily joinTrackerDaily)
 {
     try
     {
         List <JoinTrackerDaily> joinTrackersFromDB = GetEntityFromJson();
         joinTrackersFromDB.Add(joinTrackerDaily);
         SaveJson(joinTrackersFromDB);
     }
     catch (Exception e)
     {
         throw (e);
     }
 }