public static string GetUpdatedSystemPerformanceNetworkStatistic(string ThreadLastUpdateDateStr)
        {
            DataTransfer<List<ControlPanel.Core.Entities.NetworkStatistic>> dt = new DataTransfer<List<ControlPanel.Core.Entities.NetworkStatistic>>();
            try
            {
                NetworkStatisticRepository repo = new NetworkStatisticRepository();
                DateTime date = DateTime.UtcNow;
                if (!DateTime.TryParse(ThreadLastUpdateDateStr, out date))
                    date = DateTime.UtcNow;
                List<ControlPanel.Core.Entities.NetworkStatistic> stats = repo.GetNetworkPerformanceStatisticThreadByLastUpdatedDate(date.ToUniversalTime());

                for(int i=0;i<stats.Count;i++)
                {
                    if (stats[i].TotalUsage == 0 || stats[i].TotalUsage == 0.0)
                    {
                        stats[i].TotalUsage = 1;
                    }
                }
                if (stats != null) stats = stats.OrderBy(x => x.CreationDate).ToList();
                dt.Data = stats;
            }
            catch (Exception exp)
            {
                dt.IsSuccess = false;
                dt.Errors = new string[] { exp.Message };
            }

            return JSONhelper.GetString(dt);
        }
 public void InsertNetworkStatistic(NetworkStatistic stats)
 {
     NetworkStatisticRepository repo = new NetworkStatisticRepository();
     repo.InsertNetworkStatistic(stats);
 }
        public string Execute(string argument)
        {
            NetworkStatisticRepository nStatisticRepo = new NetworkStatisticRepository();
            try
            {
                List<NetworkStatistic> stats = new List<NetworkStatistic>();
                stats = GetSystemNetworkStatistic();

                if (stats.Count > 0 && stats != null)
                {
                    foreach (NetworkStatistic nstatistic in stats)
                    {
                        if (nstatistic.IpAddress != null)
                        {
                            //nstatistic.IpAddress = Convert.ToString(0);
                            InsertNetworkStatistic(nstatistic);
                        }
                    }
                }

                return "Success";
            }
            catch (Exception exp)
            {
                return "Error";
            }
        }