示例#1
0
        /// <summary>Import data in Data according to shuffle definition in Definition</summary>
        /// <param name="container"></param>
        /// <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="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 (int created, int updated, int skipped, int deleted, int failed, EntityReferenceCollection references) QuickImport(IContainable container, XmlDocument Definition, Dictionary <string, XmlDocument> Data, EventHandler <ShuffleEventArgs> ShuffleEventHandler, string defpath, bool clearRemainingShuffleVars, bool splitFiles = false)
        {
            container.Logger.StartSection("QuickImport");
            var shuffle = new Shuffler(container);

            if (ShuffleEventHandler != null)
            {
                shuffle.RaiseShuffleEvent += ShuffleEventHandler;
            }
            ShuffleHelper.VerifyShuffleVars(Definition, clearRemainingShuffleVars);
            shuffle.Definition     = Definition;
            shuffle.definitionpath = defpath;

            ShuffleBlocks blocks;

            if (splitFiles)
            {
                blocks = shuffle.MergeFiles(Data);
            }
            else
            {
                blocks = shuffle.Deserialize(Data.First().Value);
            }
            var result = shuffle.ImportToCRM(blocks);

            container.Logger.EndSection();
            return(result);
        }
示例#2
0
        /// <summary>Export data according to shuffle definition in Definition to format Type</summary>
        /// <param name="container"></param>
        /// <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="defpath">Folder path for the shuffle definition file.</param>
        /// <param name="clearRemainingShuffleVars"></param>
        /// <param name="splitFiles">if true, it will split into seperate XmlDocuments for each record exported. </param>
        /// <returns>XmlDocument with exported data</returns>
        public static Dictionary <string, XmlDocument> QuickExport(IContainable container, XmlDocument definition, SerializationType type, char delimeter, EventHandler <ShuffleEventArgs> ShuffleEventHandler, string defpath, bool clearRemainingShuffleVars, bool splitFiles = false)
        {
            container.Logger.StartSection("QuickExport");
            var shuffle = new Shuffler(container);

            if (ShuffleEventHandler != null)
            {
                shuffle.RaiseShuffleEvent += ShuffleEventHandler;
            }
            ShuffleHelper.VerifyShuffleVars(definition, clearRemainingShuffleVars);
            shuffle.Definition     = definition;
            shuffle.definitionpath = defpath;
            var blocks = shuffle.ExportFromCRM();
            Dictionary <string, XmlDocument> results;

            if (splitFiles)
            {
                results = shuffle.SplitFiles(blocks, type, delimeter);
            }
            else
            {
                results = new Dictionary <string, XmlDocument>
                {
                    { string.Empty, shuffle.Serialize(blocks, type, delimeter) }
                };
            }
            container.Logger.EndSection();
            return(results);
        }
示例#3
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);
        }
示例#4
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);
        }