// Guarda un item en un XML public static bool SaveAs(string filename, ItemAvailability itemAvailability) { bool tResult = false; try { System.IO.File.WriteAllText(filename, itemAvailability.ToString(), Encoding.Unicode); tResult = true; } catch { tResult = false; } return(tResult); }
// Carga un item desde un XML public static ItemAvailability LoadFrom(string filename) { ItemAvailability tItemAvailability = null; try { var serializer = new XmlSerializer(typeof(ItemAvailability)); FileStream fs = new FileStream(filename, FileMode.Open); StreamReader stream = new StreamReader(fs, Encoding.Unicode); tItemAvailability = (ItemAvailability)serializer.Deserialize(stream); fs.Close(); } catch { } return(tItemAvailability); }
public void Add(ItemAvailability ia) { mItemAvailability.Add(ia); }