private void OnInsertChangeEvent(object sender, InsertItemEventArgs e) { XElement xElement = new XElement("AbonentInfo", new XElement("Name", e.abonent.Name), new XElement("Location", e.abonent.Location), new XElement("Address", e.abonent.Address), new XElement("Phone", e.abonent.Phone), new XElement("ID", e.abonent.ID), new XElement("StartDate", e.abonent.StartDate), new XElement("InstallationPayment", e.abonent.InstallationPayment), new XElement("Fee", e.abonent.Fee), new XElement("LastPayment", e.abonent.LastPayment)); abonentInfoFiltered.Add(xElement); Save(); Print(); }
public void OnInsertItemEvent(object sender, InsertItemEventArgs e) { var filename = "computers.xml"; XDocument xdoc = XDocument.Load(filename); xdoc.Element("ArrayOfComputer").Add(new XElement("Computer", new XElement("Id", e.Param.Id), new XElement("Model", e.Param.Model), new XElement("ProcessorType", e.Param.ProcessorType), new XElement("ProcessorSpeed", e.Param.ProcessorSpeed), new XElement("RAMSize", e.Param.RAMSize), new XElement("HardDriveCapacity", e.Param.HardDriveCapacity), new XElement("VideoCardMemory", e.Param.VideoCardMemory), new XElement("Price", e.Param.Price), new XElement("CopiesAvailable", e.Param.CopiesAvailable)) ); xdoc.Save(filename); }