public static bool SaveLayout(DataLayout dl) { dl.layoutDate = DateTime.Now; dl.layoutId = GetLayoutId(); dl.basePath = CombinePath(dl.layoutName); FileStream fileStream = new FileStream(dl.basePath, FileMode.Create); XmlSerializer xmlSerializer = new XmlSerializer(dl.GetType()); xmlSerializer.Serialize(fileStream, dl); fileStream.Close(); return(true); }
public static bool UpdateLayout(string fileName, DataLayout newLayout) { if (File.Exists(CombinePath(fileName))) { DeleteLayout(fileName); FileStream fileStream = new FileStream(CombinePath(newLayout.layoutName), FileMode.Create); XmlSerializer xmlSerializer = new XmlSerializer(newLayout.GetType()); xmlSerializer.Serialize(fileStream, newLayout); fileStream.Close(); return(true); } return(false); }