Beispiel #1
0
        /// <summary>
        /// Update the general data: dateCreated, source.
        /// </summary>
        private static void updateDatosGen(ISACFDataContext db)
        {
            XDocument   xDocumentIndex;
            ccfDatosGen dbDatosGen = new ccfDatosGen();

            FileInfo indexFile = new FileInfo(Path.Combine(clsSettings.serviceSettings.dataDirectory.FullName, string.Format("{0}{1}{2}", xmlDestinationFolderName, Path.DirectorySeparatorChar, indexFileName)));

            // Load the XML document containing the CategoryIndex.
            xDocumentIndex = XDocument.Load(indexFile.FullName);

            ccfDatosGen xmlDatosGen = new ccfDatosGen();

            xmlDatosGen = (from e in xDocumentIndex.Descendants("CategoryIndex")
                           where ((string)e.Attribute("CategoryIndex")) != string.Empty
                           select new ccfDatosGen
            {
                dateCreated = (DateTime)e.Attribute("DateCreated"),
                source = (string)e.Attribute("source"),
            }).Single();

            dbDatosGen.dateCreated = xmlDatosGen.dateCreated;
            dbDatosGen.source      = xmlDatosGen.source;

            if (db.Transaction == null & db.Connection.State == System.Data.ConnectionState.Closed)
            {
                db.Connection.Open();
            }

            db.ccfDatosGens.InsertOnSubmit(dbDatosGen);
            db.SubmitChanges();

            if (db.Transaction == null & db.Connection.State == System.Data.ConnectionState.Open)
            {
                db.Connection.Close();
                db = null;
            }

            // Do some Cleanup.
            if (dbDatosGen != null)
            {
                dbDatosGen = null;
            }
            if (xDocumentIndex != null)
            {
                xDocumentIndex = null;
            }
            if (indexFile != null)
            {
                indexFile = null;
            }

            GC.Collect();
        }
Beispiel #2
0
 partial void DeleteccfDatosGen(ccfDatosGen instance);
Beispiel #3
0
 partial void UpdateccfDatosGen(ccfDatosGen instance);
Beispiel #4
0
 partial void InsertccfDatosGen(ccfDatosGen instance);