public EventWriterComp(DS_NiheComputers DS, DialogComputerAdd D) { this.DS = DS; this.ComputerGUID = D.GUID; this.Date = D.Date; this.ExtendedInfo = D.ExtendedInfo; }
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 Form03NewComp(Class1 C1, DialogComputerAdd Dadd) { this.DS = C1.DS; this.Dadd = Dadd; this.C1 = C1; InitializeComponent(); Init(); }
void Computer_ComputerAddEvent(object sender, DialogComputerAdd D) { Form03NewComp F = new Form03NewComp(C1, D); F.ShowDialog(); }