Beispiel #1
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);
        }
Beispiel #2
0
 public List<ZiroAgentRecord> GetLastRecords(int numbersOfRecord)
 {
     using (ZiroBaseDAL dal = new ZiroBaseDAL())
     {
         dal.OpenConnection();
         return dal.GetZiroLastDataRecords(numbersOfRecord);
     }
 }
Beispiel #3
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);
        }
Beispiel #4
0
 //public float CurrentCpuUsage { get; set; }
 //public float CurrentFreeMemory { get; set; }
 public ZiroMainService()
 {
     //Инициализация базы при первом запуске или удалении файла базы
     if (!File.Exists("ZiroDB.db3"))
     {
         Console.WriteLine("Initialize application");
         ZiroBaseDAL dal = new ZiroBaseDAL();
         dal.CreateBase();
     }
     //Console.WriteLine("Ziro Service created \t [OK] {0}", StackOfNode.Count);
 }