private void btn_play_Click(object sender, EventArgs e) { lib rp = new lib(); Form_loading_play fp = new Form_loading_play(); fp.ShowDialog(); }
public static string Merge(lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, int DepartmentId, int SourceModelID, int DestModelID) { var Assets = from a in dc.Assets where a.DepartmentId == DepartmentId && a.ModelId == SourceModelID select a; foreach (var Asset in Assets) Asset.ModelId = DestModelID; var Models = from m in dc.AssetModels where m.DepartmentId == DepartmentId && m.Id == SourceModelID select m; dc.AssetModels.DeleteAllOnSubmit(Models); return null; }
public static int? GetAccountId(lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, int DepartmentID, string Name) { if (string.IsNullOrEmpty(Name)) return null; IQueryable<int> IDs; IDs = from d in dc.Accounts where d.DId == DepartmentID && d.VchName == Name select d.Id; foreach (int ID in IDs) return ID; return null; }
static void Main(string[] args) { lib asd = new lib(); lib.sloj(3, 4); lib.vichet(4, 56); lib.age(35); Console.WriteLine("Введите новый логин:"); Console.WriteLine($"Ваш новый логин - {lib.newlogin()}"); Console.WriteLine("Нахождение дискриминанта: введите a, b, c"); Console.WriteLine($"D={lib.D()}"); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Laba_7, Yarokhmedov D., V-14\n"); Console.WriteLine("Створений список:"); lib word = new lib(8); word.NewHead(15); word.NewHead(11); word.NewHead(7); WriteOut(word.FillArray()); Console.WriteLine("Видаляємо числа пiсля максимального:"); word.DelAfterMax(); WriteOut(word.FillArray()); Console.WriteLine("Видаляємо числа меншi за середнє значення:"); word.DelBelowAverage(); WriteOut(word.FillArray()); }
public static int? GetModelId(lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, int DepartmentID, string Name, int? AssetMakeId) { if (string.IsNullOrEmpty(Name)) return null; IQueryable<int> IDs; IDs = from d in dc.AssetModels where d.DepartmentId == DepartmentID && d.Model == Name select d.Id; foreach (int ID in IDs) return ID; if (AssetMakeId == null) return null; lib.bwa.bigWebDesk.LinqBll.Context.AssetModels data = new lib.bwa.bigWebDesk.LinqBll.Context.AssetModels(); data.DepartmentId = DepartmentID; data.Model = Name; data.MakeId = (int)AssetMakeId; dc.AssetModels.InsertOnSubmit(data); dc.SubmitChanges(); return data.Id; }
public static int? GetLoginCompanyJuncId(lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, int DepartmentID, string Name) { if (string.IsNullOrEmpty(Name)) return null; IQueryable<int> IDs; IDs = from j in dc.Tbl_LoginCompanyJunc join l in dc.Tbl_Logins on j.Login_id equals l.Id into jl join t in dc.Tbl_UserType on j.UserType_Id equals t.Id into jt from sl in jl.DefaultIfEmpty() from st in jt.DefaultIfEmpty() where j.Company_id == DepartmentID & (((sl.FirstName + " " + sl.LastName + ", " + st.Name) == Name) | ((sl.FirstName + " " + sl.LastName) == Name) | ((sl.FirstName + " " + sl.LastName + ", " + sl.Email) == Name)) select j.Id; foreach (int ID in IDs) return ID; return null; }
public static string Merge(lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, int DepartmentId, int SourceMakeID, int DestMakeID) { var MergeInfo = from SourceModel in dc.AssetModels join DestModel in dc.AssetModels on new { SourceDID = SourceModel.DepartmentId, DestDID = DepartmentId, SourceMakeID = SourceModel.MakeId, DestMakeID, SourceModel.Model } equals new { SourceDID = DepartmentId, DestDID = DestModel.DepartmentId, SourceMakeID, DestMakeID = DestModel.MakeId, DestModel.Model } select new { SourceModel, DestModel }; foreach (var mi in MergeInfo) { AssetModels.Merge(dc, DepartmentId, mi.SourceModel.Id, mi.DestModel.Id); } var Models = from m in dc.AssetModels where m.DepartmentId == DepartmentId && m.MakeId == SourceMakeID select m; foreach (var Model in Models) Model.MakeId = DestMakeID; var Assets = from a in dc.Assets where a.DepartmentId == DepartmentId && a.MakeId == SourceMakeID select a; foreach (var a in Assets) a.MakeId = DestMakeID; var Makes = from m in dc.AssetMakes where m.DepartmentId == DepartmentId && m.Id == SourceMakeID select m; dc.AssetMakes.DeleteAllOnSubmit(Makes); dc.SubmitChanges(); return null; }
static void CopyComputerPrinters(AssetComputerPrinterData source, lib.bwa.bigWebDesk.LinqBll.Context.AssetComputerPrinters dest, int DepartmentID, int AssetID) { dest.AssetId = AssetID; dest.DepartmentId = DepartmentID; dest.PrinterDriver = source.PrinterDriver; dest.PrinterName = source.PrinterName; dest.PrinterPort = source.PrinterPort; }
static void CopyComputerProcessor(AssetComputerProcessorData source, lib.bwa.bigWebDesk.LinqBll.Context.AssetComputerProcessors dest, int DepartmentID, int AssetID) { dest.AssetId = AssetID; dest.CPUClass = source.CPUClass; dest.CPUSerial = source.CPUSerial; dest.CPUSpeedMHz = source.CPUSpeedMHz; dest.CPUType = source.CPUType; dest.CPUVendor = source.CPUVendor; dest.CurrentClockSpeed = source.CurrentClockSpeed; dest.CurrentVoltage = source.CurrentVoltage; dest.DepartmentId = DepartmentID; dest.Description = source.Description; dest.DeviceID = source.DeviceID; dest.ExtClock = source.ExtClock; dest.L2CachSize = source.L2CachSize; dest.UniqueId = source.UniqueId; dest.Version = source.Version; }
private void generaAddRowToDt(ref DataTable dt, lib.APWorkFlow.NodeStatusRow drwfh, string regionCaption, string status) { DataRow dr; dr = dt.NewRow(); dr["RegionCaption"] = regionCaption; dr["Approver"] = DBNullConverter.ToStr(drwfh.APPROVED_BY); dr["FlowStatus"] = status; dr["AuditDate"] = DBNullConverter.ToStr(drwfh.COMPLETED_DATE); dr["Comment"] = DBNullConverter.ToStr(drwfh.COMMENTS); dr["IsView"] = 0; dr["IsPending"] = 0; dt.Rows.Add(dr); }
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; }
static void SaveComputers(int DepartmentID, lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, AssetComputerData data) { var lds = ( from d in dc.AssetComputers where d.DepartmentId == DepartmentID && d.AssetId == data.AssetNumber select d ).FirstOrNull(); if (lds == null) { lds = new lib.bwa.bigWebDesk.LinqBll.Context.AssetComputers(); dc.AssetComputers.InsertOnSubmit(lds); } CopyComputers(data, lds, DepartmentID, data.AssetNumber); }
private static void CopyProcessors(lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, int DepartmentId, int OldAssetId, int NewAssetId) { var OldProcessors = (from d in dc.AssetComputerProcessors where d.DepartmentId == DepartmentId && d.AssetId == OldAssetId select d).ToList(); foreach (var d in OldProcessors) { var NewD = new lib.bwa.bigWebDesk.LinqBll.Context.AssetComputerProcessors() { DepartmentId = DepartmentId, AssetId = NewAssetId, CPUType = d.CPUType, CPUSerial = d.CPUSerial, CPUVendor = d.CPUVendor, CPUSpeedMHz = d.CPUSpeedMHz, CPUClass = d.CPUClass, CurrentClockSpeed = d.CurrentClockSpeed, UniqueId = d.UniqueId, Description = d.Description, Version = d.Version, L2CachSize = d.L2CachSize, ExtClock = d.ExtClock, CurrentVoltage = d.CurrentVoltage, DeviceID = d.DeviceID }; dc.AssetComputerProcessors.InsertOnSubmit(NewD); } }
public static int GetStatus(lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, string Name) { if (string.IsNullOrEmpty(Name)) Name = "Active"; IQueryable<int> IDs; IDs = from d in dc.AssetStatus where d.VchStatus == Name select d.Id; foreach (int ID in IDs) return ID; throw new Exception("Asset Status name must be specify"); }
static void GetAssetComputerArrays(int DepartmentID, lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, bigWebApps.HelpDesk.WebApi.Soap.v1.AssetComputerData d) { d.LogicalDrives = ( from ld in dc.AssetComputerLogicalDrives where ld.DepartmentId == DepartmentID && ld.AssetId == d.AssetNumber select new bigWebApps.HelpDesk.WebApi.Soap.v1.AssetComputerLogicalDriveData() { DeviceID = ld.DeviceID, FileSystem = ld.FileSystem, SizeGB = (float?)ld.SizeGB, FreeSpaceGB = (float?)ld.FreeSpaceGB, Description = ld.Description, VolumeName = ld.VolumeName, VolumeSerial = ld.VolumeSerial, Compressed = ld.Compressed, DriveType = ld.DriveType } ).ToArray(); d.Processors = ( from p in dc.AssetComputerProcessors where p.DepartmentId == DepartmentID && p.AssetId == d.AssetNumber select new bigWebApps.HelpDesk.WebApi.Soap.v1.AssetComputerProcessorData() { CPUType = p.CPUType, CPUSerial = p.CPUSerial, CPUVendor = p.CPUVendor, CPUSpeedMHz = p.CPUSpeedMHz, CPUClass = p.CPUClass, CurrentClockSpeed = p.CurrentClockSpeed, UniqueId = p.UniqueId, Description = p.Description, Version = p.Version, L2CachSize = p.L2CachSize, ExtClock = p.ExtClock, CurrentVoltage = (float?)p.CurrentVoltage, DeviceID = p.DeviceID, } ).ToArray(); d.Printers = ( from p in dc.AssetComputerPrinters where p.DepartmentId == DepartmentID && p.AssetId == d.AssetNumber select new bigWebApps.HelpDesk.WebApi.Soap.v1.AssetComputerPrinterData() { PrinterName = p.PrinterName, PrinterDriver = p.PrinterDriver, PrinterPort = p.PrinterPort } ).ToArray(); d.Softwares = ( from p in dc.AssetComputerSoftwares where p.DepartmentId == DepartmentID && p.AssetId == d.AssetNumber select new bigWebApps.HelpDesk.WebApi.Soap.v1.AssetComputerSoftwareData() { SoftwareName = p.SoftwareName, SoftwarePublisher = p.SoftwarePublisher, SoftwareVersion = p.SoftwareVersion } ).ToArray(); }
public static string Merge(Guid OrgId, int DepartmentId, List<lib.bwa.bigWebDesk.LinqBll.Context.Assets> OldAssets, lib.bwa.bigWebDesk.LinqBll.Context.Assets NewAsset, int? OldAssetComputerId) { using (lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc = new lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext(OrgId, DepartmentId)) { int? InactiveMergedStatusID = (from s in dc.AssetStatus where s.VchStatus == "Deleted" select s.Id).FirstOrDefault(); if (InactiveMergedStatusID == null || InactiveMergedStatusID == 0) return "Can not find 'Deleted' asset status"; dc.Assets.InsertOnSubmit(NewAsset); dc.SubmitChanges(); if (OldAssetComputerId != null) { var OldAC = (from ac in dc.AssetComputers where ac.DepartmentId == DepartmentId && ac.AssetId == OldAssetComputerId select ac).FirstOrNull(); if (OldAC != null) { lib.bwa.bigWebDesk.LinqBll.Context.AssetComputers NewAC = new lib.bwa.bigWebDesk.LinqBll.Context.AssetComputers() { DepartmentId = DepartmentId, AssetId = NewAsset.Id, MotherboardSerial = OldAC.MotherboardSerial, BiosSerial = OldAC.BiosSerial, OSSerial = OldAC.OSSerial, RegisteredUser = OldAC.RegisteredUser, OperatingSystem = OldAC.OperatingSystem, RamMbytes = OldAC.RamMbytes, VideoDescription = OldAC.VideoDescription, VideoMemoryMbytes = OldAC.VideoMemoryMbytes, VideoHResolution = OldAC.VideoHResolution, VideoVResolution = OldAC.VideoVResolution, NetworkName = OldAC.NetworkName, NetworkDomain = OldAC.NetworkDomain, NetworkCard1IP = OldAC.NetworkCard1IP, NetworkCard1Mask = OldAC.NetworkCard1Mask, NetworkCard1Gate = OldAC.NetworkCard1Gate, NetworkCard1Address = OldAC.NetworkCard1Address, NetworkCard1Description = OldAC.NetworkCard1Description }; dc.AssetComputers.InsertOnSubmit(NewAC); CopyLogicalDrives(dc, DepartmentId, (int)OldAssetComputerId, (int)NewAsset.Id); CopyPrinters(dc, DepartmentId, (int)OldAssetComputerId, (int)NewAsset.Id); CopyProcessors(dc, DepartmentId, (int)OldAssetComputerId, (int)NewAsset.Id); CopySoftwares(dc, DepartmentId, (int)OldAssetComputerId, (int)NewAsset.Id); } } foreach (lib.bwa.bigWebDesk.LinqBll.Context.Assets OldAsset in OldAssets) { var SchedTicketAssets = dc.SchedTicketAssets.Where(sta => sta.DId == DepartmentId && sta.AssetId == OldAsset.Id); foreach (var SchedTicketAsset in SchedTicketAssets) SchedTicketAsset.AssetId = NewAsset.Id; var TicketAssets = dc.TicketAssets.Where(ta => ta.DId == DepartmentId && ta.AssetId == OldAsset.Id); foreach (var TicketAsset in TicketAssets) TicketAsset.AssetId = NewAsset.Id; var Asset = dc.Assets.Where(a => a.Id == OldAsset.Id).FirstOrNull(); Asset.StatusId = (int)InactiveMergedStatusID; Asset.MergedId = NewAsset.Id; } dc.SubmitChanges(); return null; } }
public static string Merge(lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, int DepartmentId, int SourceTypeID, int DestTypeID) { //AssetMakes var MergeInfo = from SourceMake in dc.AssetMakes join DestMake in dc.AssetMakes on new { SDID = SourceMake.DepartmentId, DDID = DepartmentId, SourceTypeID = SourceMake.TypeId, DestTypeID, SourceMake.Make } equals new { SDID = DepartmentId, DDID = DestMake.DepartmentId, SourceTypeID, DestTypeID = DestMake.TypeId, DestMake.Make } orderby SourceMake.Make, SourceMake.Id, DestMake.Make, DestMake.Id select new { SourceMake, DestMake }; foreach (var mi in MergeInfo) { AssetMakes.Merge(dc, DepartmentId, mi.SourceMake.Id, mi.DestMake.Id); } //AssetMakes var Makes = from m in dc.AssetMakes where m.DepartmentId == DepartmentId && m.TypeId == SourceTypeID select m; foreach (var Make in Makes) Make.TypeId = DestTypeID; //Assets var Assets = from a in dc.Assets where a.DepartmentId == DepartmentId && a.TypeId == SourceTypeID select a; foreach (var Asset in Assets) Asset.TypeId = DestTypeID; //DupeAssetTypeProperties var DupeTypeProperties = from sp in dc.AssetTypeProperties join dp in dc.AssetTypeProperties on new { sDepartmentId = sp.DId, dDepartmentId = DepartmentId, SourceTypeID = sp.AssetTypeId, DestTypeID, sp.Name } equals new { sDepartmentId = DepartmentId, dDepartmentId = dp.DId, SourceTypeID, DestTypeID=dp.AssetTypeId, dp.Name } select new { sp, dp}; foreach (var DupeTypeProperty in DupeTypeProperties) { var TypePropValues = from v in dc.AssetPropertyValues where v.AssetTypePropertyId == DupeTypeProperty.sp.Id select v; foreach (var TypePropValue in TypePropValues) { TypePropValue.AssetTypePropertyId = DupeTypeProperty.dp.Id; dc.AssetTypeProperties.DeleteOnSubmit(DupeTypeProperty.sp); } } dc.SubmitChanges(); //AssetTypeProperties var TypeProperties = from p in dc.AssetTypeProperties where p.DId == DepartmentId && p.AssetTypeId == SourceTypeID select p; foreach (var TypeProperty in TypeProperties) TypeProperty.AssetTypeId = DestTypeID; //AssetTypeCustCap var TypeCustCaps = from c in dc.AssetTypeCustCap where c.TypeId == SourceTypeID select c; foreach (var TypeCustCap in TypeCustCaps) TypeCustCap.TypeId = DestTypeID; //AssetTypes var Types = from t in dc.AssetTypes where t.DepartmentId == DepartmentId && t.Id == SourceTypeID select t; dc.AssetTypes.DeleteAllOnSubmit(Types); dc.SubmitChanges(); return null; }
private static void AddUnique(int n, string uniq, Dictionary<string, List<lib.bwa.bigWebDesk.LinqBll.Context.Sp_SelectDupeAssetsResult>> DupAssets, lib.bwa.bigWebDesk.LinqBll.Context.Sp_SelectDupeAssetsResult ai) { if (string.IsNullOrEmpty(uniq)) return; string FullName = n + uniq; List<lib.bwa.bigWebDesk.LinqBll.Context.Sp_SelectDupeAssetsResult> lai; if (DupAssets.Keys.Contains(FullName)) { lai = DupAssets[FullName]; } else { lai = new List<lib.bwa.bigWebDesk.LinqBll.Context.Sp_SelectDupeAssetsResult>(); DupAssets[FullName] = lai; } lai.Add(ai); }
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); } }
private static void CopySoftwares(lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, int DepartmentId, int OldAssetId, int NewAssetId) { var OldSoftwares = (from d in dc.AssetComputerSoftwares where d.DepartmentId == DepartmentId && d.AssetId == OldAssetId select d).ToList(); foreach (var d in OldSoftwares) { var NewD = new lib.bwa.bigWebDesk.LinqBll.Context.AssetComputerSoftwares() { DepartmentId = DepartmentId, AssetId = NewAssetId, SoftwareName = d.SoftwareName, SoftwarePublisher = d.SoftwarePublisher, SoftwareVersion = d.SoftwareVersion }; dc.AssetComputerSoftwares.InsertOnSubmit(NewD); } }
static void CopyComputers(AssetComputerData source, lib.bwa.bigWebDesk.LinqBll.Context.AssetComputers dest, int DepartmentID, int AssetId) { dest.AssetId = AssetId; dest.DepartmentId = DepartmentID; dest.NetworkCard1Address = source.NetworkCard1Address; dest.NetworkCard1Description = source.NetworkCard1Description; dest.NetworkCard1Gate = source.NetworkCard1Gate; dest.NetworkCard1IP = source.NetworkCard1IP; dest.NetworkCard1Mask = source.NetworkCard1Mask; dest.NetworkDomain = source.NetworkDomain; dest.NetworkName = source.NetworkName; dest.OperatingSystem = source.OperatingSystem; dest.OSSerial = source.OSSerial; dest.RamMbytes = source.RamMbytes; dest.RegisteredUser = source.RegisteredUser; dest.VideoDescription = source.VideoDescription; dest.VideoHResolution = source.VideoHResolution; dest.VideoMemoryMbytes = source.VideoMemoryMbytes; dest.VideoVResolution = source.VideoVResolution; }
public static string Merge(lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, int DepartmentId, int SourceFolderId, int DestFolderId) { var SourceFolders = from f in dc.Folders where f.DId == DepartmentId && f.Id == SourceFolderId select f; var Source = SourceFolders.FirstOrNull(); if (Source == null) return "Can not find the source folder."; var DestFolders = from f in dc.Folders where f.DId == DepartmentId && f.Id == DestFolderId select f; var Dest = DestFolders.FirstOrNull(); if (Dest == null) return "Can not find the destination folder."; if (Dest.ParentId == SourceFolderId) { Dest.ParentId = Source.ParentId; } var SourceSubFolders = from f in dc.Folders where f.DId == DepartmentId && f.ParentId == SourceFolderId select f; foreach (var sub in SourceSubFolders) sub.ParentId = DestFolderId; var SourceTickets = from t in dc.Tbl_ticket where t.Company_id == DepartmentId && t.Folder_id == SourceFolderId select t; foreach (var t in SourceTickets) t.Folder_id = DestFolderId; dc.Folders.DeleteOnSubmit(Source); dc.SubmitChanges(); return null; }
static void CopyComputerSoftware(AssetComputerSoftwareData source, lib.bwa.bigWebDesk.LinqBll.Context.AssetComputerSoftwares dest, int DepartmentID, int AssetID) { dest.AssetId = AssetID; dest.DepartmentId = DepartmentID; dest.SoftwareName = source.SoftwareName; dest.SoftwarePublisher = source.SoftwarePublisher; dest.SoftwareVersion = source.SoftwareVersion; }
private void generaAddInTurnRowToDt(ref DataTable dt, lib.APWorkFlow.NodeStatusRow drwfh, string regionCaption, string status) { string userName = ((AuthorizationDS.StuffUserRow)Session["StuffUser"]).StuffName; DataRow dr; dr = dt.NewRow(); dr["RegionCaption"] = regionCaption; dr["Approver"] = userName; dr["FlowStatus"] = status; dr["AuditDate"] = string.Empty; dr["Comment"] = string.Empty; dr["IsView"] = 1; dr["IsPending"] = 0; dt.Rows.Add(dr); }
static void SaveComputerProcessors(int DepartmentID, lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, AssetComputerData data) { var lds = ( from d in dc.AssetComputerProcessors where d.DepartmentId == DepartmentID && d.AssetId == data.AssetNumber select d ).ToList(); var NeedDel = lds.Where(d1 => !data.Processors.Select(d2 => d2.DeviceID).Contains(d1.DeviceID)).ToList(); dc.AssetComputerProcessors.DeleteAllOnSubmit(NeedDel); var NeedInsert = data.Processors.Where(d1 => !lds.Select(d2 => d2.DeviceID).Contains(d1.DeviceID)).ToList(); foreach (AssetComputerProcessorData i in NeedInsert) { var New = new lib.bwa.bigWebDesk.LinqBll.Context.AssetComputerProcessors(); CopyComputerProcessor(i, New, DepartmentID, data.AssetNumber); dc.AssetComputerProcessors.InsertOnSubmit(New); } var NeedUpdate = lds.Where(d1 => data.Processors.Select(d2 => d2.DeviceID).Contains(d1.DeviceID)).ToList(); foreach (var i in NeedUpdate) { var source = data.Processors.Where(d => d.DeviceID == i.DeviceID).FirstOrDefault(); if (source == null || source.DeviceID == null) continue; CopyComputerProcessor(source, i, DepartmentID, data.AssetNumber); } }
private void generaAddPendingRowToDt(ref DataTable dt, lib.APWorkFlow.NodeStatusRow drwfh, string regionCaption) { AuthorizationBLL auBLL = new AuthorizationBLL(); string approvalNames = auBLL.GetApprovalNamesByUserIds(DBNullConverter.ToStr(drwfh.PARTICIPANT)); DataRow dr = dt.NewRow(); dr["RegionCaption"] = regionCaption; dr["Approver"] = approvalNames; dr["FlowStatus"] = waitingStatus; dr["AuditDate"] = string.Empty; dr["Comment"] = null; dr["IsView"] = 0; dr["IsPending"] = 1; dt.Rows.Add(dr); }
static void SaveComputerSoftwares(int DepartmentID, lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, AssetComputerData data) { var lds = ( from d in dc.AssetComputerSoftwares where d.DepartmentId == DepartmentID && d.AssetId == data.AssetNumber select d ).ToList(); var ss = data.Softwares.ToList(); foreach (var ld in lds) { bool exist = false; for (int i = 0; i < ss.Count; i++) { var s = ss[i]; if (ld.SoftwareName == s.SoftwareName && ld.SoftwarePublisher == s.SoftwarePublisher && ld.SoftwareVersion == s.SoftwareVersion) { exist = true; ss.Remove(s); i--; } } if (exist) continue; dc.AssetComputerSoftwares.DeleteOnSubmit(ld); } foreach (var s in ss) { var New = new lib.bwa.bigWebDesk.LinqBll.Context.AssetComputerSoftwares(); CopyComputerSoftware(s, New, DepartmentID, data.AssetNumber); dc.AssetComputerSoftwares.InsertOnSubmit(New); } }
private static void CopyPrinters(lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc, int DepartmentId, int OldAssetId, int NewAssetId) { var OldPrinters = (from d in dc.AssetComputerPrinters where d.DepartmentId == DepartmentId && d.AssetId == OldAssetId select d).ToList(); foreach (var d in OldPrinters) { var NewD = new lib.bwa.bigWebDesk.LinqBll.Context.AssetComputerPrinters() { DepartmentId = DepartmentId, AssetId = NewAssetId, PrinterDriver = d.PrinterDriver, PrinterName = d.PrinterName, PrinterPort = d.PrinterPort }; dc.AssetComputerPrinters.InsertOnSubmit(NewD); } }