Beispiel #1
0
        static void SaveComputerLogicalDrives(int DepartmentID, lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, AssetComputerData data)
        {
            var lds = (
                from d in dc.AssetComputerLogicalDrives
                where d.DepartmentId == DepartmentID && d.AssetId == data.AssetNumber
                select d
                ).ToList();

            var NeedDel = lds.Where(d1 => !data.LogicalDrives.Select(d2 => d2.DeviceID).Contains(d1.DeviceID)).ToList();

            dc.AssetComputerLogicalDrives.DeleteAllOnSubmit(NeedDel);

            var NeedInsert = data.LogicalDrives.Where(d1 => !lds.Select(d2 => d2.DeviceID).Contains(d1.DeviceID)).ToList();

            foreach (AssetComputerLogicalDriveData i in NeedInsert)
            {
                var New = new lib.bwa.bigWebDesk.LinqBll.Context.AssetComputerLogicalDrives();
                //bigWebApps.HelpDesk.WebApi.Utils.CopyProperties<AssetComputerLogicalDriveData>(i, New);
                CopyComputerLogicalDrives(i, New, DepartmentID, data.AssetNumber);
                dc.AssetComputerLogicalDrives.InsertOnSubmit(New);
            }

            var NeedUpdate = lds.Where(d1 => data.LogicalDrives.Select(d2 => d2.DeviceID).Contains(d1.DeviceID)).ToList();

            foreach (var i in NeedUpdate)
            {
                var source = data.LogicalDrives.Where(d => d.DeviceID == i.DeviceID).FirstOrDefault();
                if (source == null || source.DeviceID == null)
                {
                    continue;
                }
                //bigWebApps.HelpDesk.WebApi.Utils.CopyProperties<AssetComputerLogicalDriveData>(source, i);
                CopyComputerLogicalDrives(source, i, DepartmentID, data.AssetNumber);
            }
        }
Beispiel #2
0
 static void CopyComputerLogicalDrives(AssetComputerLogicalDriveData source, lib.bwa.bigWebDesk.LinqBll.Context.AssetComputerLogicalDrives dest, int DepartmentID, int AsetId)
 {
     dest.AssetId      = AsetId;
     dest.Compressed   = source.Compressed;
     dest.DepartmentId = DepartmentID;
     dest.Description  = source.Description;
     dest.DeviceID     = source.DeviceID;
     dest.DriveType    = source.DriveType;
     dest.FileSystem   = source.FileSystem;
     dest.FreeSpaceGB  = source.FreeSpaceGB;
     dest.SizeGB       = source.SizeGB;
     dest.VolumeName   = source.VolumeName;
     dest.VolumeSerial = source.VolumeSerial;
 }
Beispiel #3
0
        private static void CopyLogicalDrives(lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, int DepartmentId, int OldAssetId, int NewAssetId)
        {
            var OldLogicalDrives = (from d in dc.AssetComputerLogicalDrives where d.DepartmentId == DepartmentId && d.AssetId == OldAssetId select d).ToList();

            foreach (var d in OldLogicalDrives)
            {
                var NewD = new lib.bwa.bigWebDesk.LinqBll.Context.AssetComputerLogicalDrives()
                {
                    DepartmentId = DepartmentId,
                    AssetId      = NewAssetId,
                    DeviceID     = d.DeviceID,
                    FileSystem   = d.FileSystem,
                    SizeGB       = d.SizeGB,
                    FreeSpaceGB  = d.FreeSpaceGB,
                    Description  = d.Description,
                    VolumeName   = d.VolumeName,
                    VolumeSerial = d.VolumeSerial,
                    Compressed   = d.Compressed,
                    DriveType    = d.DriveType
                };
                dc.AssetComputerLogicalDrives.InsertOnSubmit(NewD);
            }
        }
Beispiel #4
0
        static void SaveComputerLogicalDrives(int DepartmentID, lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, AssetComputerData data)
        {
            var lds = (
                from d in dc.AssetComputerLogicalDrives
                where d.DepartmentId == DepartmentID && d.AssetId == data.AssetNumber
                select d
                ).ToList();

            var NeedDel = lds.Where(d1 => !data.LogicalDrives.Select(d2 => d2.DeviceID).Contains(d1.DeviceID)).ToList();
            dc.AssetComputerLogicalDrives.DeleteAllOnSubmit(NeedDel);

            var NeedInsert = data.LogicalDrives.Where(d1 => !lds.Select(d2 => d2.DeviceID).Contains(d1.DeviceID)).ToList();
            foreach (AssetComputerLogicalDriveData i in NeedInsert)
            {
                var New = new lib.bwa.bigWebDesk.LinqBll.Context.AssetComputerLogicalDrives();
                //bigWebApps.HelpDesk.WebApi.Utils.CopyProperties<AssetComputerLogicalDriveData>(i, New);
                CopyComputerLogicalDrives(i, New, DepartmentID, data.AssetNumber);
                dc.AssetComputerLogicalDrives.InsertOnSubmit(New);
            }

            var NeedUpdate = lds.Where(d1 => data.LogicalDrives.Select(d2 => d2.DeviceID).Contains(d1.DeviceID)).ToList();
            foreach (var i in NeedUpdate)
            {
                var source = data.LogicalDrives.Where(d => d.DeviceID == i.DeviceID).FirstOrDefault();
                if (source == null || source.DeviceID == null) continue;
                //bigWebApps.HelpDesk.WebApi.Utils.CopyProperties<AssetComputerLogicalDriveData>(source, i);
                CopyComputerLogicalDrives(source, i, DepartmentID, data.AssetNumber);
            }
        }
Beispiel #5
0
        private static void CopyLogicalDrives(lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, int DepartmentId, int OldAssetId, int NewAssetId)
        {
            var OldLogicalDrives = (from d in dc.AssetComputerLogicalDrives where d.DepartmentId == DepartmentId && d.AssetId == OldAssetId select d).ToList();
            foreach (var d in OldLogicalDrives)
            {
                var NewD = new lib.bwa.bigWebDesk.LinqBll.Context.AssetComputerLogicalDrives()
                {
                    DepartmentId = DepartmentId,
                    AssetId = NewAssetId,
                    DeviceID = d.DeviceID,
                    FileSystem = d.FileSystem,
                    SizeGB = d.SizeGB,
                    FreeSpaceGB = d.FreeSpaceGB,
                    Description = d.Description,
                    VolumeName = d.VolumeName,
                    VolumeSerial = d.VolumeSerial,
                    Compressed = d.Compressed,
                    DriveType = d.DriveType

                };
                dc.AssetComputerLogicalDrives.InsertOnSubmit(NewD);
            }
        }