private void Button_Add_Click(object sender, EventArgs e) { WriteOffItem writeOffItem = new WriteOffItem( (Product)comboBox_Products.SelectedItem, int.Parse(numericUpDown_Count.Value.ToString()), (string)comboBox_Measures.SelectedItem); ListViewItem item = new ListViewItem(writeOffItem.Product.Name); item.SubItems.Add($"{writeOffItem.Count}{writeOffItem.Measures}"); item.Tag = writeOffItem; listView_WriteOffItem.Items.Add(item); writeOffItems.Add(writeOffItem); }
public static WriteOffProducts FromXml(XElement node) => new WriteOffProducts( (string)node.Element("date"), (string)node.Element("masterName"), node.Element("writeOffItems").Elements("writeOffItem").Select(i => WriteOffItem.FromXml(i)).ToList());