Beispiel #1
0
        /// <summary>
        /// Feeds data into the job from an xml or CSV or FL or file name (in case of Excel or custom feeder)
        /// </summary>
        /// <param name="xmlOrCSVOrFixedLengthOrFileName"></param>
        /// <returns></returns>
        public List <string> Feed(string xmlOrCSVOrFixedLengthOrFileName)
        {
            AnyToDataTable anyToDataTable = new AnyToDataTable(this);
            List <string>  errors         = anyToDataTable.Feed(xmlOrCSVOrFixedLengthOrFileName);

            this.DataSource.IsFirstRowHeader = anyToDataTable.IsFirstRowHeader;

            if (!AddAdditionalColumns())
            {
                return(new List <string>());
            }

            this.TotalRowsToBeProcessed = this.InputData.Rows.Count;
            int skipHeaderInCsvRows = this.DataSource.IsFirstRowHeader ? 1 : 0;

            List <DataTable> chunks = InputData.Split(SymplusCoreConfigurationSection.CurrentConfig.RecordsPerThread);

            _JobSlices = new List <JobSlice>();
            int counter = 0;

            foreach (DataTable table in chunks)
            {
                JobSlice jobSlice = new JobSlice(this.JobIdentifier, counter, table, this.CSVRows.Skip(skipHeaderInCsvRows).Skip(counter * SymplusCoreConfigurationSection.CurrentConfig.RecordsPerThread).Take(SymplusCoreConfigurationSection.CurrentConfig.RecordsPerThread).ToList());
                _JobSlices.Add(jobSlice);
                counter++;
            }
            return(errors);
        }
Beispiel #2
0
        /// <summary>
        /// Feeds data into the job from a list objects
        /// </summary>
        /// <param name="inputData">List of objects</param>
        ///<param name="overridenMapping">Comma separated additional mapping override information. For example if "EmpId" from object to be mapped with "EmployeeId" of attribute, then "EmpId=EmployeeId,Ename=EmployeeName"</param>
        /// <returns></returns>
        public List <string> Feed(List <Object> inputData, string overridenMapping)
        {
            this.DataFeededFrom = inputData;
            AnyToDataTable anyToDataTable = new AnyToDataTable(this);
            List <string>  errors         = anyToDataTable.Feed(inputData, overridenMapping);

            this.DataSource.IsFirstRowHeader = anyToDataTable.IsFirstRowHeader;
            this.TotalRowsToBeProcessed      = this.InputData.Rows.Count;
            int skipHeaderInCsvRows = this.DataSource.IsFirstRowHeader ? 1 : 0;

            List <DataTable> chunks = InputData.Split(SymplusCoreConfigurationSection.CurrentConfig.RecordsPerThread);

            _JobSlices = new List <JobSlice>();
            int counter = 0;

            foreach (DataTable table in chunks)
            {
                JobSlice jobSlice = new JobSlice(this.JobIdentifier, counter, table, this.CSVRows.Skip(skipHeaderInCsvRows).Skip(counter * SymplusCoreConfigurationSection.CurrentConfig.RecordsPerThread).Take(SymplusCoreConfigurationSection.CurrentConfig.RecordsPerThread).ToList());
                _JobSlices.Add(jobSlice);
                counter++;
            }
            return(errors);
        }