Example #1
0
 public bool GoldenTicketActivity()
 {
     try
     {
         var tgsList       = new List <BsonDocument>();
         var userEntity    = Users.First(_ => _.Name == "user1");
         var machineEntity = Machines.First(_ => _.Name == "CLIENT1");
         for (var loopIndex = 0; loopIndex <= _saAmount; loopIndex++)
         {
             tgsList.Add(DocumentCreator.KerberosCreator(userEntity, machineEntity,
                                                         DomainControllers.FirstOrDefault(), DomainList.Single(_ => _.Id == userEntity.Domain).Name
                                                         , DomainList.Single(_ => _.Id == machineEntity.Domain).Name, SourceGateway, $"{(Spn)(_random.Next(0, 5))}/{Machines[loopIndex].Name}", null, "Tgs"));
         }
         DbClient.SetCenterProfileForReplay();
         SvcCtrl.StopService("ATACenter");
         DbClient.InsertBatch(tgsList);
         SvcCtrl.StartService("ATACenter");
         return(true);
     }
     catch (Exception e)
     {
         Logger.Error(e);
         return(false);
     }
 }
Example #2
0
        public static void DocumentCreateTest()
        {
            Document        document        = null;
            DocumentCreator documentCreator = new DocumentCreator();

            document = documentCreator.OrderDocument("divorce");
        }
Example #3
0
        public void NestedTest6()
        {
            var docCreator = new DocumentCreator(delimiter: "~", preprocessText: false);
            var testList   = new List <TestClass>
            {
                new TestClass()
                {
                    Go = true, Go2 = true
                },
                new TestClass()
                {
                    Go = false, Go2 = true
                },
                new TestClass()
                {
                    Go = true, Go2 = false
                },
                new TestClass()
                {
                    Go = false, Go2 = false
                },
            };

            docCreator.AddList(testList, "S");
            docCreator.CreateDocument(inputTemplatePath[5], outputPath[5]);
            FileAssert.AreEqual(outputPath[5], comparisonPath[5]);
        }
Example #4
0
 public bool LsbDistinct()
 {
     try
     {
         var networkActivitities = new List <BsonDocument>();
         if (SelectedUsers.Count < 11 || SelectedMachines.Count < 1)
         {
             return(false);
         }
         DbClient.ClearTestCollections();
         SvcCtrl.StopService("ATACenter");
         DbClient.SetCenterProfileForReplay();
         Logger.Debug("Center profile set for replay");
         networkActivitities.AddRange(
             SelectedUsers.Select(
                 user =>
                 DocumentCreator.SimpleBindCreator(user, SelectedMachines[0],
                                                   SelectedDomainControllers.FirstOrDefault(), DomainList.Single(_ => _.Id == user.Domain).Name
                                                   , DomainList.Single(_ => _.Id == SelectedMachines[0].Domain).Name, SourceGateway)));
         DbClient.InsertBatch(networkActivitities);
         Logger.Debug("Done inserting Ldap activities");
         SvcCtrl.StartService("ATACenter");
         return(true);
     }
     catch (Exception distinctException)
     {
         Logger.Error(distinctException);
         return(false);
     }
 }
        public void BtnProductList_Click(object sender, EventArgs e)
        {
            DocumentCreator dc = new DocumentCreator();

            dc.AddList <Product>(products, "P");

            //Group Totals
            dc.AddInt32("avail", 0);
            dc.AddInt32("unavail", 0);
            dc.AddInt32("tot", 0);

            //Final totals
            dc.AddInt32("available", 0);
            dc.AddInt32("unavailable", 0);
            dc.AddInt32("total", 0);

            dc.AddInt32("showVendor", 0);
            dc.AddBoolean("groupEnd", false);

            currentVendor = "-none-";

            dc.BeforeScanRecord += new BeforeScanRecordEventHandler(Dc_BeforeScanRecord);
            dc.AfterScanRecord  += new AfterScanRecordEventHandler(Dc_AfterScanRecord1);
            dc.ScanEnded        += new ScanEndedEventHandler(Dc_ScanEnded1);
            dc.CreateDocument(_inputPath, _outputPath);
            if (!_isUnitTest)
            {
                Process.Start(_outputPath);
            }
        }
Example #6
0
        public ActionResult Share(string id, string key)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(HttpNotFound());
            }
            if (string.IsNullOrEmpty(key))
            {
                return(HttpNotFound());
            }

            var project = _projectRepository.Find(id);

            if (project == null)
            {
                return(HttpNotFound());
            }

            if (project.SecurityKey != key)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Forbidden));
            }

            var creator = new DocumentCreator();
            var buffer  = creator.CreatePdf(project);

            return(File(buffer, "application/pdf", project.Name + ".pdf"));
        }
        private Lucene.Net.Store.Directory CreateLuceneIndex(IEnumerable <PackageVersion> packages, string luceneDirectory)
        {
            Lucene.Net.Store.Directory directory;
            if (luceneDirectory != null)
            {
                var directoryInfo = new DirectoryInfo(luceneDirectory);
                directoryInfo.Create();
                directory = new SimpleFSDirectory(directoryInfo);
            }
            else
            {
                directory = new RAMDirectoryWrapper();
            }

            using (var indexWriter = DocumentCreator.CreateIndexWriter(directory, true))
            {
                foreach (var version in packages)
                {
                    var metadata = GetPackageMetadata(version);
                    var document = DocumentCreator.CreateDocument(metadata);
                    indexWriter.AddDocument(document);
                }

                indexWriter.Commit();
            }

            return(directory);
        }
Example #8
0
        private void Button3_Click(object sender, EventArgs e)
        {
            var cb = this.Controls.OfType <RadioButton>().FirstOrDefault(r => r.Checked);

            this.mData = cb.Text;
            AppUtilities.CreateOrUpdateDict("step7", this.mData);
            LoadingSpinner ls = new LoadingSpinner(this, AppMessages.messages["document_created"]);

            try
            {
                ls.show();
                DocumentCreator dc       = new DocumentCreator();
                string          proPath  = dc.createFinancialPackage();
                string          tempPath = Path.Combine(ProjectConfig.projectBase, "~temp_" + AppUtilities.mainData["step5"].ToString());
                ProjectLoader.load(proPath, tempPath);
                t = 1;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception: " + ex.Message);
            }
            finally
            {
                ls.hide();
                this.Close();
                MainWindow mf = new MainWindow();
                mf.Show();
            }
        }
Example #9
0
        public void BtnProductList_Click(object sender, EventArgs e)
        {
            DocumentCreator dc = new DocumentCreator();

            dc.AddList <Vendor>(vendors, "vendor");
            dc.AddList <Product>(products, "prod");

            //Totals per vendor
            dc.AddInt32("avail", 0);
            dc.AddInt32("unavail", 0);
            dc.AddInt32("tot", 0);

            //Final totals
            dc.AddInt32("available", 0);
            dc.AddInt32("unavailable", 0);
            dc.AddInt32("total", 0);


            dc.ScanStart       += new ScanStartEventHandler(Dc_ScanStart);
            dc.AfterScanRecord += new AfterScanRecordEventHandler(Dc_AfterScanRecord1);
            dc.ScanEnded       += new ScanEndedEventHandler(Dc_ScanEnded1);
            dc.CreateDocument(_inputPath, _outputPath);

            if (!_unitTest)
            {
                Process.Start(_outputPath);
            }
        }
        public void GenerateCertificatOfAttendance()
        {
            var repo = new DocumentCreator(Path.Combine(Directory.GetCurrentDirectory(), "..\\..\\"));
            var doc  = repo.CreateCertificateOfAttendance(new FullName("boudoux", "aurelien"), "DOT SHARK", "SET Niveau I", "Saint PRIEST", 5, new FullName("cordier", "fabrice"), DateTime.Now);

            File.Exists(doc).Should().BeTrue();
            //Process.Start(doc);
        }
        public void GenerateDegree()
        {
            var repo = new DocumentCreator(Path.Combine(Directory.GetCurrentDirectory(), "..\\..\\"));
            var doc  = repo.CreateDegree(new FullName("boudoux", "aurelien"), "DOT SHARK", new DateTime(2018, 01, 23), new DateTime(2018, 01, 25), new FullName("cordier", "fabrice"));

            File.Exists(doc).Should().BeTrue();
            //Process.Start(doc);
        }
        public void GenerateSurvey()
        {
            var repo = new DocumentCreator(Path.Combine(Directory.GetCurrentDirectory(), "..\\..\\"));
            var doc  = repo.CreateSurvey(new FullName("cordier", "fabrice"), "SET Niveau II");

            File.Exists(doc).Should().BeTrue();
            //Process.Start(doc);
        }
        public void CreatePdf()
        {
            var project = ProjectFactory.Create();
            var creator = new DocumentCreator();

            string file = string.Format("Test-{0}.pdf", DateTime.Now.Ticks);
            creator.CreatePdf(project, file);
        }
Example #14
0
        public string Document([System.Web.Http.FromBody] UploadData uploadData)
        {
            string            folder          = Request.Url.GetLeftPart(UriPartial.Authority) + "/Temp/";
            DocumentCreator   documentCreator = new DocumentCreator();
            InformativeExport data            = JsonConvert.DeserializeObject <InformativeExport>(uploadData.data);

            return(documentCreator.Create(folder, data));
        }
Example #15
0
        public void CreatePdf()
        {
            var project = ProjectFactory.Create();
            var creator = new DocumentCreator();

            string file = string.Format("Test-{0}.pdf", DateTime.Now.Ticks);

            creator.CreatePdf(project, file);
        }
        public static void Main(string[] args)
        {
            var documentCreator     = new DocumentCreator();
            var uriSchemeRegisterer = new UriSchemeRegisterer();

            var violetDocumentCreator = new VioletDocumentCreator(documentCreator, uriSchemeRegisterer);

            violetDocumentCreator.Run(args);
        }
Example #17
0
        public bool ExecuteLearningTime()
        {
            try
            {
                var sourceMachine = Machines.Single(_ => _.Name == "APP1");
                var sourceUser    = Users.Single(_ => _.Name == "triservice");
                // Generate Samr for domainController learning time
                foreach (var domainController in DomainControllers)
                {
                    ActivitiesList.Add(DocumentCreator.SamrCreator(sourceUser, sourceMachine,
                                                                   domainController,
                                                                   DomainList.Single(_ => _.Id == sourceUser.Domain).Name
                                                                   , DomainList.Single(_ => _.Id == sourceMachine.Domain).Name, SourceGateway, true,
                                                                   SamrQueryType.EnumerateUsers, SamrQueryOperation.EnumerateUsersInDomain,
                                                                   DomainList.Single(_ => _.Id == sourceMachine.Domain).Id, 35));
                }

                InsertActivities(true);

                do
                {
                    SamrReconnaissanceDetectorProfile = GetSamrDetectorProfile();
                } while (SamrReconnaissanceDetectorProfile["DestinationComputerIdToDetectionStartTimeMapping"]
                         .AsBsonArray.Count != DomainControllers.Count);

                foreach (var coupledSamr in SamrCouples)
                {
                    var samrAmount = coupledSamr.RatingType == "Low" ? 10 : 21;
                    for (var samrIndex = 0; samrIndex < samrAmount; samrIndex++)
                    {
                        var queriedObject = Users[_random.Next(Users.Count)];
                        ActivitiesList.Add(DocumentCreator.SamrCreator(coupledSamr.User, coupledSamr.Machine,
                                                                       DomainControllers.First(_ => _.Domain == DomainList.Single(__ => __.Id == coupledSamr.Machine.Domain).Id),
                                                                       DomainList.Single(_ => _.Id == coupledSamr.User.Domain).Name
                                                                       , DomainList.Single(_ => _.Id == coupledSamr.Machine.Domain).Name, SourceGateway, true,
                                                                       SamrQueryType.QueryUser, SamrQueryOperation.QueryInformationUser,
                                                                       DomainList.Single(_ => _.Id == coupledSamr.Machine.Domain).Id, 10, queriedObject));
                    }
                }

                InsertActivities();

                do
                {
                    SamrReconnaissanceDetectorProfile = GetSamrDetectorProfile();
                } while (SamrReconnaissanceDetectorProfile["DateToQueryToSamrQueryDataMapping"]
                         .AsBsonArray.Count == 0);

                return(true);
            }
            catch (Exception e)
            {
                Logger.Debug(e);
                return(false);
            }
        }
Example #18
0
        public void CreateDocument(string projectPath)
        {
            DocumentCreator      documentCreator = new DocumentCreator(projectPath);
            string               path            = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            List <Documentation> documentations  = documentCreator.GetAllDocuments();

            this.doc = DocX.Create(path + @"\" + documentCreator.Title + ".docx");
            doc.InsertParagraph($"{documentCreator.Title}", false, new Formatting()
            {
                Size = 26, FontColor = baseColor
            });
            doc.InsertSectionPageBreak(true);
            int capitol = 1;

            foreach (Documentation documentation in documentations)
            {
                doc.InsertParagraph($"{capitol} - {documentation.Title.Replace(documentCreator.Title,"").Trim('.')}", false, new Formatting()
                {
                    Size = 22
                });
                doc.InsertParagraph(" ", false, new Formatting()
                {
                    Size = 40
                });
                int subCapitol = 1;
                foreach (KeyValuePair <string, Assembly> assembly in documentation.Pages.OrderBy(x => x.Value.Members.OrderBy(y => y.Priority).First().Priority))
                {
                    Paragraph paragraph = doc.InsertParagraph($"{capitol}.{subCapitol} - {assembly.Value.Members.First().Name}", false, new Formatting()
                    {
                        Size = 20
                    });
                    paragraph.IndentationBefore = 0.2f;
                    paragraph = doc.InsertParagraph($"Namespace: {assembly.Value.Name}", false, new Formatting()
                    {
                        Size = 14, FontColor = Color.DarkGray
                    });
                    paragraph.IndentationBefore = 0.4f;
                    foreach (AMember member in assembly.Value.Members.OrderBy(x => x.Priority))
                    {
                        WriteMember(member, false);
                    }
                    doc.InsertParagraph(" ", false, new Formatting()
                    {
                        Size = 24
                    });
                    subCapitol++;
                }
                if (capitol < documentations.Count)
                {
                    doc.InsertSectionPageBreak(true);
                }
                capitol++;
            }
            doc.Save();
        }
        public void HasExpectedFieldNamesAndValues()
        {
            // Arrange
            var package  = GetPackage();
            var expected = new[]
            {
                new KeyValuePair <string, string>(LuceneConstants.IdPropertyName, "DotNetZip"),
                new KeyValuePair <string, string>(LuceneConstants.IdAutocompletePropertyName, "DotNetZip"),
                new KeyValuePair <string, string>(LuceneConstants.TokenizedIdPropertyName, "DotNetZip"),
                new KeyValuePair <string, string>(LuceneConstants.ShingledIdPropertyName, "DotNetZip"),
                new KeyValuePair <string, string>(LuceneConstants.VerbatimVersionPropertyName, "1.00.000"),
                new KeyValuePair <string, string>(LuceneConstants.NormalizedVersionPropertyName, "1.0.0"),
                new KeyValuePair <string, string>(LuceneConstants.FullVersionPropertyName, "1.0.0"),
                new KeyValuePair <string, string>(LuceneConstants.TitlePropertyName, "The Famous DotNetZip"),
                new KeyValuePair <string, string>(LuceneConstants.DescriptionPropertyName, "The description."),
                new KeyValuePair <string, string>(LuceneConstants.SummaryPropertyName, "The summary."),
                new KeyValuePair <string, string>(LuceneConstants.TagsPropertyName, "dot net zip"),
                new KeyValuePair <string, string>(LuceneConstants.AuthorsPropertyName, "Justin Bieber, Nick Jonas"),
                new KeyValuePair <string, string>(LuceneConstants.SemVerLevelPropertyName, ""),
                new KeyValuePair <string, string>(LuceneConstants.ListedPropertyName, "true"),
                new KeyValuePair <string, string>(LuceneConstants.OriginalCreatedPropertyName, "2001-01-01T00:00:00.0000000Z"),
                new KeyValuePair <string, string>(LuceneConstants.OriginalPublishedPropertyName, "2002-02-02T00:00:00.0000000Z"),
                new KeyValuePair <string, string>(LuceneConstants.PublishedDatePropertyName, "20020202"),
                new KeyValuePair <string, string>(LuceneConstants.OriginalLastEditedPropertyName, "2003-03-03T00:00:00.0000000Z"),
                new KeyValuePair <string, string>(LuceneConstants.LastEditedDatePropertyName, "20030303"),
                new KeyValuePair <string, string>(LuceneConstants.SortableTitlePropertyName, "the famous dotnetzip"),
                new KeyValuePair <string, string>(LuceneConstants.IconUrlPropertyName, "http://example/icon.png"),
                new KeyValuePair <string, string>(LuceneConstants.ProjectUrlPropertyName, "http://example/"),
                new KeyValuePair <string, string>(LuceneConstants.MinClientVersionPropertyName, "2.0.0"),
                new KeyValuePair <string, string>(LuceneConstants.ReleaseNotesPropertyName, "The release notes."),
                new KeyValuePair <string, string>(LuceneConstants.CopyrightPropertyName, "The copyright."),
                new KeyValuePair <string, string>(LuceneConstants.LanguagePropertyName, "English"),
                new KeyValuePair <string, string>(LuceneConstants.LicenseUrlPropertyName, "http://example/license.txt"),
                new KeyValuePair <string, string>(LuceneConstants.PackageHashPropertyName, "0123456789ABCDEF"),
                new KeyValuePair <string, string>(LuceneConstants.PackageHashAlgorithmPropertyName, "SHA1"),
                new KeyValuePair <string, string>(LuceneConstants.PackageSizePropertyName, "1200"),
                new KeyValuePair <string, string>(LuceneConstants.RequiresLicenseAcceptancePropertyName, "true"),
                new KeyValuePair <string, string>(LuceneConstants.FlattenedDependenciesPropertyName, "Lucene.Net:2.9.4.1|WindowsAzure.Storage:1.6"),
                new KeyValuePair <string, string>(LuceneConstants.DependenciesPropertyName, "[{\"Id\":\"Lucene.Net\",\"VersionSpec\":\"2.9.4.1\"},{\"Id\":\"WindowsAzure.Storage\",\"VersionSpec\":\"1.6\"}]"),
                new KeyValuePair <string, string>(LuceneConstants.SupportedFrameworksPropertyName, "[\"net40\",\"aspnet99\"]")
            };

            // Act
            var document = DocumentCreator.CreateDocument(package);

            // Assert
            var actual = document.GetFields().Select(f => new KeyValuePair <string, string>(f.Name, f.StringValue)).ToArray();

            Assert.Equal(expected.Length, actual.Length);
            for (int i = 0; i < expected.Length; i++)
            {
                Assert.Equal(expected[i], actual[i]);
            }
        }
        private void ProcessPackageDetails(IndexWriter indexWriter, JObject catalogItem)
        {
            _logger.LogDebug("ProcessPackageDetails");

            indexWriter.DeleteDocuments(CreateDeleteQuery(catalogItem));

            var package  = CatalogPackageMetadataExtraction.MakePackageMetadata(catalogItem);
            var document = DocumentCreator.CreateDocument(package);

            indexWriter.AddDocument(document);
        }
        static void ProcessPackageDetails(IndexWriter indexWriter, JObject catalogItem)
        {
            Trace.TraceInformation("ProcessPackageDetails");

            indexWriter.DeleteDocuments(CreateDeleteQuery(catalogItem));

            var package  = CatalogPackageMetadataExtraction.MakePackageMetadata(catalogItem);
            var document = DocumentCreator.CreateDocument(package);

            indexWriter.AddDocument(document);
        }
Example #22
0
        public void GenerateDocument(string path, string keyID, string username)
        {
            DocumentCreator dc = new DocumentCreator();

            dc.AddString("Date", DateTime.Now.ToShortDateString());
            dc.AddString("keyID", keyID);
            var outputPath = $"{path}//Oswiadczenie.rtf";

            dc.CreateDocument(inputPath, outputPath);
            Process.Start(outputPath);
        }
        public void VerifiesRequiredPropertiesAreProvided(string key, string expected)
        {
            // Arrange
            var package = GetPackage();

            package.Remove(key);

            // Act, Assert
            var exception = Assert.Throws <Exception>(() => DocumentCreator.CreateDocument(package));

            Assert.Equal(expected, exception.Message);
        }
        public void GeneratePackagePaidAgreement()
        {
            var attendees = new List <Attendee>();

            attendees.Add(new Attendee(new FullName("boudoux", "aurelien"), "DOT SHARK"));
            attendees.Add(new Attendee(new FullName("revel", "alexandre"), "TREND"));
            attendees.Add(new Attendee(new FullName("Aldebert", "Gregory"), "TREND"));

            var repo = new DocumentCreator(Path.Combine(Directory.GetCurrentDirectory(), "..\\..\\"));
            var doc  = repo.CreatePaidAgreement("2018 6001 T", "DOT SHARK", "111 rue francis de pressensé", "69100", "VILLEURBANNE", new FullName("boudoux", "aurelien"), "SET Niveau IV", new DateTime(2018, 1, 23), 3, "Saint PRIEST", attendees, AgreementPriceType.PackagePrice, 3500);
            //Process.Start(doc);
        }
        public void ValidatesPropertiesThatAreNotStrings(string key, string expected)
        {
            // Arrange
            var package = GetPackage();

            package[key] = "bad";

            // Act, Assert
            var exception = Assert.Throws <Exception>(() => DocumentCreator.CreateDocument(package));

            Assert.Equal(expected, exception.Message);
        }
        public void GenerateFirstPage()
        {
            var repo = new DocumentCreator(Path.Combine(Directory.GetCurrentDirectory(), "..\\..\\"));

            var signature = "Mélanie DUCOURTIOUX - yolo " + Environment.NewLine +
                            "Service Formation" + Environment.NewLine +
                            "Tél. : 04.37.54 13 60" + Environment.NewLine +
                            "Fax: 04 72 50 97 93" + Environment.NewLine;

            var doc = repo.CreateFirstPage("SET Niveau I", DateTime.Now, "DOT SHARK", new FullName("boudoux", "aurelien"), "111 rue francis de pressensé", "69100", "Villeurbanne", signature);
            //Process.Start(doc);
        }
Example #27
0
        public async Task Init()
        {
            string htmlString =
                File.ReadAllText(@"C:\Users\User\Documents\Code\WebDev\WikEpub\WikEpubLibTests\GetEpubTest\Resources\htmlString.txt");
            var mockHtmlInput = new MockHtmlInput(htmlString);

            var getRecords     = new GetWikiPageRecords();
            var getXmlDocument = new DocumentCreator(new GetTocXml(), new GetContentXml(), new GetContainerXml(), new CreateEpubHtml());
            var epubOut        = new EpubOutput(new System.Net.Http.HttpClient());

            _getEpub = new GetEpub(getRecords, getXmlDocument, mockHtmlInput, epubOut);
            await createTestBook();
        }
        private void UpdateCommitMetadata(DateTime commitTimeStamp, int docsDifference)
        {
            var count = docsDifference;

            if (_metadataForNextCommit != null)
            {
                // we want the total for the entire commit, so add to the number we already have
                count += _metadataForNextCommit.Count;
            }

            _metadataForNextCommit = DocumentCreator.CreateCommitMetadata(
                commitTimeStamp, "from catalog", count, Guid.NewGuid().ToString());
        }
        public void RejectsMissingVersionAndOriginalVersion()
        {
            // Arrange
            var package = GetPackage();

            package.Remove(MetadataConstants.NormalizedVersionPropertyName);
            package.Remove(MetadataConstants.VerbatimVersionPropertyName);

            // Act, Assert
            var exception = Assert.Throws <Exception>(() => DocumentCreator.CreateDocument(package));

            Assert.Equal($"Required property '{MetadataConstants.VerbatimVersionPropertyName}' not found.\r\n", exception.Message);
        }
        public void RejectsInvalidOriginalVersionWhenVersionIsNotProvided()
        {
            // Arrange
            var package = GetPackage();

            package.Remove(MetadataConstants.NormalizedVersionPropertyName);
            package[MetadataConstants.VerbatimVersionPropertyName] = "bad";

            // Act, Assert
            var exception = Assert.Throws <Exception>(() => DocumentCreator.CreateDocument(package));

            Assert.Equal($"Unable to parse '{MetadataConstants.VerbatimVersionPropertyName}' as NuGetVersion.\r\n", exception.Message);
        }
Example #31
0
        protected override void AddDocumentsToIndex()
        {
            using (SqlConnection connection = new SqlConnection(ItemsToIndex.ConnectionString))
            {
                connection.Open();

                foreach (DatabaseItemToIndex itemToIndex in ItemsToIndex.Items)
                {
                    string columns = string.Empty;
                    itemToIndex.Columns.ForEach(columnName => columns += columnName + ",");
                    columns = columns.Remove(columns.Length - 1);

                    string query = "select " + columns + " from " + itemToIndex.TableName;
                    if (string.IsNullOrEmpty(itemToIndex.WhereClause) == false)
                    {
                        query += " where " + itemToIndex.WhereClause;
                    }

                    SqlCommand selectCommand = new SqlCommand(query, connection);

                    SqlDataAdapter adapter = new SqlDataAdapter();
                    adapter.SelectCommand = selectCommand;
                    DataTable table = new DataTable(itemToIndex.TableName);
                    adapter.Fill(table);

                    // Get the primary keys for the data table we are querying and set them in our detached
                    // ADO.NET datatable because this will be used when creating our search index document
                    List <DataColumn> keyColumns = new List <DataColumn> ();
                    using (SqlDataReader primaryKeyReader = selectCommand.ExecuteReader(CommandBehavior.KeyInfo))
                    {
                        DataTable schemaTable = primaryKeyReader.GetSchemaTable();
                        primaryKeyReader.Close();
                        foreach (DataRow row in schemaTable.Rows)
                        {
                            if (Convert.ToBoolean(row["IsKey"]))
                            {
                                string keyColumnName = row["ColumnName"] as string;
                                keyColumns.Add(table.Columns[keyColumnName]);
                            }
                        }
                        table.PrimaryKey = keyColumns.ToArray();

                        foreach (DataRow row in table.Rows)
                        {
                            LuceneDocuments.Document doc = DocumentCreator.GetDocument(row);
                            IndexWriter.AddDocument(doc);
                        }
                    }
                }
            }
        }