public void Add() { DS_NiheComputers.CompRow cr = null; DialogComputerAdd D = new DialogComputerAdd(); string infoString = null; if (ComputerAddEvent != null) { ComputerAddEvent(this, D); if (D.Changed) { cr = DS.Comp.NewCompRow(); cr.Name = D.ComputerName; cr.DepartmentID = D.DepartmentID; cr.HDDID = D.HDD; cr.Num = D.Number; cr.OSID = D.OSID; cr.ProcessorID = D.ProcessorID; cr.PurchaseDate = D.PurchaseDate; cr.WarantyDate = D.PurchaseDate.AddYears((int)D.WarantyDate); cr.Room = D.Room; cr.User = D.Username; cr.RAMID = D.RAMID; cr.GUID = D.GUID; DS.Comp.AddCompRow(cr); Computer comp = new Computer(DS, cr); infoString = comp.FullName; EventWriterComp ewc = new EventWriterComp(DS, D); ewc.EventName = "Поступление компьютера"; ewc.Info = comp.FullName; if (comp.Number != null & comp.Number != "") { ewc.Info = string.Format("{0}\r\nИнв. №: {1}", ewc.Info, comp.Number); } if (comp.Vendor != null & comp.Vendor != " ") { ewc.Info = string.Format("{0}\r\nПроизвод.: {1}", ewc.Info, comp.Vendor); } if (comp.Department != null & comp.Department != "") { ewc.Info = string.Format("{0}\r\nСтрукт подразд.: {1}", ewc.Info, comp.Department); } if (comp.ComputerName != null & comp.ComputerName != "") { ewc.Info = string.Format("{0}\r\nИмя комп.: {1}", ewc.Info, comp.ComputerName); } if (comp.Room != null & comp.Room != "") { ewc.Info = string.Format("{0}\r\nКабинет: {1}", ewc.Info, comp.Room); } if (comp.Username != null & comp.Username != "") { ewc.Info = string.Format("{0}\r\nИмя польз.: {1}", ewc.Info, comp.Username); } ewc.Write(); comp = null; } } D = null; }
public void Add_new() { Computer comp = new Computer(DS); DialogComputer D = new DialogComputer(comp); string infoString = null; if (ComputerAddEvent_New != null) { ComputerAddEvent_New(this, D); if (D.Changed) { comp.ComputerName = D.Comp.ComputerName; comp.DepartmentID = D.Comp.DepartmentID; comp.HDDID = D.Comp.HDDID; comp.Number = D.Comp.Number; comp.OSID = D.Comp.OSID; comp.ProcessorID = D.Comp.ProcessorID; comp.PurchaseDate = D.Comp.PurchaseDate; comp.WarantyDate = D.Comp.WarantyDate; comp.Room = D.Comp.Room; comp.Username = D.Comp.Username; comp.RAMID = D.Comp.RAMID; infoString = comp.FullName; EventWriterComp ewc = new EventWriterComp(D); ewc.EventName = "Поступление компьютера"; ewc.Info = comp.FullName; if (comp.Number != null & comp.Number != "") { ewc.Info = string.Format("{0}\r\nИнв. №: {1}", ewc.Info, comp.Number); } if (comp.Vendor != null & comp.Vendor != " ") { ewc.Info = string.Format("{0}\r\nПроизвод.: {1}", ewc.Info, comp.Vendor); } if (comp.Department != null & comp.Department != "") { ewc.Info = string.Format("{0}\r\nСтрукт подразд.: {1}", ewc.Info, comp.Department); } if (comp.ComputerName != null & comp.ComputerName != "") { ewc.Info = string.Format("{0}\r\nИмя комп.: {1}", ewc.Info, comp.ComputerName); } if (comp.Room != null & comp.Room != "") { ewc.Info = string.Format("{0}\r\nКабинет: {1}", ewc.Info, comp.Room); } if (comp.Username != null & comp.Username != "") { ewc.Info = string.Format("{0}\r\nИмя польз.: {1}", ewc.Info, comp.Username); } ewc.Write(); } } D = null; comp = null; }
private void WriteEvent(string S1, DateTime D, string Info, string CompGUID, string ExtendedInfo) { EventWriterComp ewc = new EventWriterComp(DS); ewc.ComputerGUID = CompGUID; ewc.Date = D; ewc.ExtendedInfo = ExtendedInfo; ewc.EventName = S1; if (Info != null) { ewc.Info = Info; } else { ewc.Info = "Простое событие"; } ewc.Write(); }