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); }
//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); }
public List<ZiroAgentRecord> GetLastRecords(int numbersOfRecord) { using (ZiroBaseDAL dal = new ZiroBaseDAL()) { dal.OpenConnection(); return dal.GetZiroLastDataRecords(numbersOfRecord); } }