/// <summary>
        /// Internal method for ExportNotes().
        /// </summary>
        private void ExportNotes_Internal()
        {
            using (var dtUsers = GetTableData(SqlQueries.USERS))
                using (var dtNotes = GetTableData(SqlQueries.NOTES))
                    using (var dtHoh = GetTableData(SqlQueries.HEAD_OF_HOUSEHOLD, true))
                    {
                        var headOfHouseHoldMap = GetHeadOfHouseholdMap(dtHoh);
                        var users = dtUsers.AsEnumerable().ToArray();

                        foreach (DataRow row in dtNotes.Rows)
                        {
                            var importNote = F1Note.Translate(row, headOfHouseHoldMap, users);

                            if (importNote != null)
                            {
                                ImportPackage.WriteToPackage(importNote);
                            }
                        }

                        // Cleanup - Remember not to Clear() any cached tables.
                        dtUsers.Clear();
                        dtNotes.Clear();
                        GC.Collect();
                    }
        }
Пример #2
0
        /// <summary>
        /// Export the people and household notes
        /// </summary>
        public override void ExportNotes()
        {
            try
            {
                using (var dtUsers = GetTableData(SQL_USERS))
                    using (var dtNotes = GetTableData(SQL_NOTES))
                        using (var dtHoh = GetTableData(SQL_HEAD_OF_HOUSEHOLD))
                        {
                            var headOfHouseHoldMap = GetHeadOfHouseholdMap(dtHoh);
                            var users = dtUsers.AsEnumerable().ToArray();

                            foreach (DataRow row in dtNotes.Rows)
                            {
                                var importNote = F1Note.Translate(row, headOfHouseHoldMap, users);

                                if (importNote != null)
                                {
                                    ImportPackage.WriteToPackage(importNote);
                                }
                            }
                        }
            }
            catch (Exception ex)
            {
                ErrorMessage = ex.Message;
            }
        }
Пример #3
0
        /// <summary>
        /// Internal method for ExportNotes().
        /// </summary>
        private void ExportNotes_Internal()
        {
            var dtUsers = _db.Table("Users").Data;
            var dtNotes = _db.Table("Notes").Data;

            var headOfHouseHoldMap = GetHeadOfHouseholdMap(_db.Table("Company").Data);
            var users = dtUsers.AsEnumerable().ToArray();

            foreach (DataRow row in dtNotes.Rows)
            {
                var importNote = F1Note.Translate(row, headOfHouseHoldMap, users);

                if (importNote != null)
                {
                    ImportPackage.WriteToPackage(importNote);
                }
            }

            // Cleanup
            dtUsers.Clear();
            dtNotes.Clear();
            GC.Collect();
        }