Exemple #1
0
        /// <summary>Import data in Data according to shuffle definition in Definition</summary>
        /// <param name="Definition">Shuffle Definition</param>
        /// <param name="Data">Exported data</param>
        /// <param name="ShuffleEventHandler">Event handler processing messages from the import. May be null.</param>
        /// <param name="container"></param>
        /// <param name="defpath">Path to definition file, if not standard</param>
        /// <param name="clearRemainingShuffleVars"></param>
        /// <returns>Tuple with counters for: Created, Updated, Skipped and Failed records and a collection of entityreferences for the created/updated records</returns>
        public static Tuple <int, int, int, int, int, EntityReferenceCollection> QuickImport(XmlDocument Definition, XmlDocument Data, EventHandler <ShuffleEventArgs> ShuffleEventHandler, CintContainer container, string defpath, bool clearRemainingShuffleVars)
        {
            container.Logger.StartSection("QuickImport");
            Shuffler shuffle = new Shuffler(container);

            if (ShuffleEventHandler != null)
            {
                shuffle.RaiseShuffleEvent += ShuffleEventHandler;
            }
            ShuffleHelper.VerifyShuffleVars(Definition, clearRemainingShuffleVars);
            shuffle.Definition     = Definition;
            shuffle.definitionpath = defpath;
            ShuffleBlocks blocks = shuffle.Deserialize(Data);
            Tuple <int, int, int, int, int, EntityReferenceCollection> result = shuffle.ImportToCRM(blocks);

            container.Logger.EndSection();
            return(result);
        }
Exemple #2
0
        /// <summary>Export data according to shuffle definition in Definition to format Type</summary>
        /// <param name="Definition">Shuffle Definition</param>
        /// <param name="Type">Type of target file</param>
        /// <param name="Delimeter">Delimeter to use when exporting to Type: Text</param>
        /// <param name="ShuffleEventHandler">Event handler processing messages from the export. May be null.</param>
        /// <param name="container"></param>
        /// <param name="defpath">Folder path for the shuffle definition file.</param>
        /// <param name="clearRemainingShuffleVars"></param>
        /// <returns>XmlDocument with exported data</returns>
        public static XmlDocument QuickExport(XmlDocument Definition, SerializationType Type, char Delimeter, EventHandler <ShuffleEventArgs> ShuffleEventHandler, CintContainer container, string defpath, bool clearRemainingShuffleVars)
        {
            container.Logger.StartSection("QuickExport");
            Shuffler shuffle = new Shuffler(container);

            if (ShuffleEventHandler != null)
            {
                shuffle.RaiseShuffleEvent += ShuffleEventHandler;
            }
            ShuffleHelper.VerifyShuffleVars(Definition, clearRemainingShuffleVars);
            shuffle.Definition     = Definition;
            shuffle.definitionpath = defpath;
            ShuffleBlocks blocks = shuffle.ExportFromCRM();
            XmlDocument   result = shuffle.Serialize(blocks, Type, Delimeter);

            container.Logger.EndSection();
            return(result);
        }