Example #1
0
        public void Save(IReadOnlyDataSet instance, string filePath)
        {
            if (instance == null)
            {
                return;
            }
            BinaryFormatter bFormatter = new BinaryFormatter();

            using (var fStream = new FileStream(
                       filePath + FileExtension, FileMode.Create,
                       FileAccess.Write, FileShare.None))
            {
                bFormatter.Serialize(fStream, instance);
            }
        }
Example #2
0
        public static string ToDataString(this IReadOnlyDataSet dataSet)
        {
            string s = string.Concat(LineIndent.Current.Value,
                                     "Інформація про  \"Хвороби\"\n");

            LineIndent.Current.Increase();
            s += dataSet.DicaseTypes.ToLineList(
                "Вид хвороби");
            s += dataSet.Discases.ToLineList(
                "Залеижні хвороби");
            s += dataSet.Patcients.ToLineList(
                "Пацієнти");
            LineIndent.Current.Decrease();
            return(s);
        }
Example #3
0
        public void Save(IReadOnlyDataSet dataSet, string filePath)
        {
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Encoding = Encoding.Unicode;

            using (XmlWriter writer = XmlWriter.Create(
                       filePath + FileExtension, settings))
            {
                writer.WriteStartDocument();
                writer.WriteStartElement("PatcientInfo");
                WriteDicaseTypes(dataSet.DicaseTypes, writer);
                WriteDiscases(dataSet.Discases, writer);
                WritePatcients(dataSet.Patcients, writer);
                writer.WriteEndElement();
                writer.WriteEndDocument();
            };
        }
Example #4
0
 public static void SaveAsText(
     this IReadOnlyDataSet dataSet, string filePath)
 {
     File.WriteAllText(filePath, dataSet.ToDataString(),
                       Encoding.Unicode);
 }