示例#1
0
        public void Update(int idAgent, int cpuUsage, int freeMemory)
        {
            using (ZiroBaseDAL dal = new ZiroBaseDAL())
            {
                dal.OpenConnection();

                dal.InsertZiroDataRecord(new ZiroAgentRecord
                {
                    IdAgent = idAgent,
                    CpuUsage = cpuUsage,
                    FreeMemory = freeMemory
                });
            }
            //Console.Clear();
            //bool objectChanged = false;
            //if (StackOfNode!=null)
            //{
            //    foreach (StatObject stat in StackOfNode)
            //    {
            //        if (stat.Id == idAgent)
            //        {
            //            stat.Update(cpuUsage, freeMemory);
            //            objectChanged = true;

            //        }
            //    }
            //}

            //if (!objectChanged)
            //{
            //    StackOfNode.Add(new StatObject { Id = idAgent, CurrentCpuUsage = cpuUsage, CurrentFreeMemory = freeMemory});
            //}
            //Console.WriteLine("{0} updated", idAgent);
        }
示例#2
0
        //TODO: возвращать List<ZiroAgentRecord> моложе определенной даты:
        // к примеру лист со всемидобавлениями в базу за последние 10 секунд
        //public void GetNewPoolList
        public void UpdateConsole(int idAgent, int cpuUsage, int freeMemory)
        {
            using (ZiroBaseDAL dal = new ZiroBaseDAL())
            {
                dal.OpenConnection();

                dal.InsertZiroDataRecord(new ZiroAgentRecord { IdAgent = idAgent,
                                                                    CpuUsage = cpuUsage,
                                                                    FreeMemory = freeMemory});
            }
            //Console.Clear();
            //Console.WriteLine("{0}\tCPU:{1}\tMEMORY11:{2}", idAgent, cpuUsage, freeMemory);
        }
示例#3
0
 public List<ZiroAgentRecord> GetLastRecords(int numbersOfRecord)
 {
     using (ZiroBaseDAL dal = new ZiroBaseDAL())
     {
         dal.OpenConnection();
         return dal.GetZiroLastDataRecords(numbersOfRecord);
     }
 }