public ReceiveStickerDialog(OMIClist oml) { InitializeComponent(); list = oml; filterOutstandingLoads(oml); comboBox1.Refresh(); }
public OMIClist Load(string filepath) { OMIClist list = new OMIClist(); XmlDocument doc = new XmlDocument(); doc.Load(filepath); XmlNodeList omicsList = doc.SelectNodes("/exports/Truck"); foreach (XmlNode omic in omicsList) { string id = omic.Attributes.GetNamedItem("OMIC").InnerText; OMIC record = new OMIC(id); record.StickersOut.Other = ExtractIntValue(ExtractValue(omic, "StickersOut/Other")); record.StickersOut.Partial = ExtractIntValue(ExtractValue(omic, "StickersOut/Partial")); record.StickersReturned.Other = ExtractIntValue(ExtractValue(omic, "StickersIn/Other")); record.StickersReturned.Partial = ExtractIntValue(ExtractValue(omic, "StickersIn/Partial")); record.UnitCount = ExtractIntValue(ExtractValue(omic, "UnitCount")); record.LoadStatus = ExtractCharValue(ExtractValue(omic, "LoadStatus")); record.DoorID = record.DoorID = ExtractValue(omic, "DoorID"); record.TotalWeight = ExtractFloatValue(ExtractValue(omic, "TotalWeight")); list.AddExistingRecord(record); } return(list); }
OMIClist filterOutstandingLoads(OMIClist oms) { OMIClist ol = oms.Filter((r) => { return(r.LoadStatus == 'N'); }); comboBox2.Items.AddRange(ol.Select(r => r.OMICid).ToArray()); comboBox2.AutoCompleteSource = AutoCompleteSource.ListItems; comboBox2.AutoCompleteMode = AutoCompleteMode.Suggest; return(ol); }
public OMIClist Filter(Predicate <OMIC> p) { List <OMIC> l = list.FindAll(p); OMIClist oml = new OMIClist(); foreach (OMIC o in l) { oml.AddExistingRecord(o); } return(oml); }
public void Save(string filepath, OMIClist data) { XmlDocument doc = new XmlDocument(); doc.LoadXml("<?xml version=\"1.0\" encoding=\"UTF-8\"?> <exports></exports>"); foreach (OMIC om in data) { XmlElement elem = OmicToXElem(om, doc); doc.DocumentElement.AppendChild(elem); } doc.Save(filepath); }
private void LoadToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() != DialogResult.OK) { return; } StorageHandler sh = new StorageHandler(); omList = sh.Load(ofd.FileName); displayList(); }
public Form1() { omList = new OMIClist(); InitializeComponent(); }