Exemplo n.º 1
0
 public string uygulama_kullanim_gonder(string Hardware_id, DataTable app_list_table)
 {
     try
     {
         foreach (DataRow row in app_list_table.Rows)
         {
             App_Usage app_us = new App_Usage();
             app_us.Hardware_Id           = Hardware_id;
             app_us.Process_Name          = row[0].ToString();
             app_us.Process_Windows_Title = row[1].ToString();
             app_us.Cpu         = Convert.ToDouble(row[2]);
             app_us.Memory      = Convert.ToDouble(row[3]);
             app_us.Network_Rec = Convert.ToDouble(row[4]);
             app_us.Network_Out = Convert.ToDouble(row[5]);
             app_us.IO_Read     = Convert.ToDouble(row[6]);
             app_us.IO_Write    = Convert.ToDouble(row[7]);
             app_us.Datetime_   = DateTime.Now;
             app_us.Sync        = true;
             db.App_Usage.Add(app_us);
         }
         db.SaveChanges();
         return("OK");
     }
     catch (Exception x)
     {
         return(x.ToString());
     }
 }
Exemplo n.º 2
0
        public void kullanimlari_esitle(string thardwareid, DataTable sys_table, DataTable app_table)
        {
            PC_Details temp_pc_detail = db.PC_Details.Where(x => x.Hardware_Id == thardwareid).FirstOrDefault();

            if (temp_pc_detail != null)
            {
                foreach (DataRow item in sys_table.Rows)
                {
                    System_Usage temp_sys_usage_data = new System_Usage();
                    temp_sys_usage_data.Hardware_Id = thardwareid;
                    temp_sys_usage_data.Cpu         = Convert.ToDouble(item[2]);
                    temp_sys_usage_data.Memory      = Convert.ToDouble(item[3]);
                    temp_sys_usage_data.Network_Rec = Convert.ToDouble(item[4]);
                    temp_sys_usage_data.Network_Out = Convert.ToDouble(item[5]);
                    temp_sys_usage_data.IO_Read     = Convert.ToDouble(item[6]);
                    temp_sys_usage_data.IO_Write    = Convert.ToDouble(item[7]);
                    temp_sys_usage_data.Datetime_   = Convert.ToDateTime(item[8]);
                    temp_sys_usage_data.Sync        = true;
                    db.System_Usage.Add(temp_sys_usage_data);
                }
                foreach (DataRow item in app_table.Rows)
                {
                    App_Usage temp_app_usage_data = new App_Usage();
                    temp_app_usage_data.Hardware_Id           = thardwareid;
                    temp_app_usage_data.Process_Name          = item[2].ToString();
                    temp_app_usage_data.Process_Windows_Title = item[3].ToString();
                    temp_app_usage_data.Cpu         = Convert.ToDouble(item[4]);
                    temp_app_usage_data.Memory      = Convert.ToDouble(item[5]);
                    temp_app_usage_data.Network_Rec = Convert.ToDouble(item[6]);
                    temp_app_usage_data.Network_Out = Convert.ToDouble(item[7]);
                    temp_app_usage_data.IO_Read     = Convert.ToDouble(item[8]);
                    temp_app_usage_data.IO_Write    = Convert.ToDouble(item[9]);
                    temp_app_usage_data.Datetime_   = Convert.ToDateTime(item[10]);
                    temp_app_usage_data.Sync        = true;
                    db.App_Usage.Add(temp_app_usage_data);
                }
                db.SaveChanges();
            }
        }