private void Form1_Load(object sender, EventArgs e) { DriveInfo[] allDrives = DriveInfo.GetDrives(); ServerDetailsClassDataContext DataBase = new ServerDetailsClassDataContext(); ServerDetail Details = new ServerDetail(); var Count = (from rows in DataBase.ServerDetails select rows).Count(); foreach (DriveInfo d in allDrives) { Details.Drive = (d.Name); if (d.IsReady == true) { Details.AvailableSpace = ((d.AvailableFreeSpace) / 1000000).ToString(); Details.TotalFreeSpace = (d.TotalFreeSpace / 1000000).ToString(); Details.TotalSize = (d.TotalSize / 1000000).ToString(); } Details.ID = Count + 1; DataBase.ServerDetails.InsertOnSubmit(Details); DataBase.SubmitChanges(); } }
partial void UpdateServerDetail(ServerDetail instance);
partial void DeleteServerDetail(ServerDetail instance);
partial void InsertServerDetail(ServerDetail instance);