private void LoadAnalyzeNumberToComboBx()
        {
            this.cmbbxLoadplaintextfromdb.Items.Add("Select Analyze Number To Load Content For Search");
            List<int> analyzeno = new List<int>();
            ScrapperRecordMain scrm = new ScrapperRecordMain();
           analyzeno = scrm.LoaadAnalyzeNumber();

           foreach (var filenamesofHTMLn5 in analyzeno)
           {
               this.cmbbxLoadplaintextfromdb.Items.Add(filenamesofHTMLn5);
           }
           if (this.cmbbxLoadplaintextfromdb.Items.Count > 0)
               this.cmbbxLoadplaintextfromdb.SelectedIndex = 0;         


        }
        private void cmbbxLoadplaintextfromdb_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string pageContent = "Load Search HTML Content";
            try
            {
                ScrapperRecordMain scrm = new ScrapperRecordMain();
                int analyzeno = 0;
                analyzeno = Convert.ToInt16(cmbbxLoadplaintextfromdb.SelectedItem.ToString());
                pageContent = scrm.getThePlainHTMLContentTextFromDB(analyzeno);

                if (pageContent == "" || pageContent == null)
                {
                    System.Windows.MessageBox.Show("Empty Data, Please Select Other Analyze Number", "Scraper Demo", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }

                txtbxSearchHTMLContent.Text = pageContent.Replace("System.Windows.Controls.TextBox:", "");
                System.Windows.MessageBox.Show("HTML Content Load For Searching", "Scraper Demo", MessageBoxButton.OK, MessageBoxImage.Information);
       
            }
            catch { }
        }
        private void BtnLoadHTMLContentToDB_Click(object sender, RoutedEventArgs e)
        {
            mainRecords records = new mainRecords();
            sqlConnection sqlconn = new sqlConnection();
            ScrapperRecordMain scrpMainRecord = new ScrapperRecordMain();
            

            if (RecordData.firstanalyzeFlg)
            {
                records.awNo = sqlconn.getAWNO();
                records.webURL = RecordData.mainRecords.webURL;
                records.web1URL = "n/a";
                records.web2URL = "n/a";
                records.scrapDT = DateTime.UtcNow;
                records.AnalyzeNo = sqlconn.getAnalyzeNo();
                        
                records.isURLsimilar = "false";
                if (this.txtbxShowhtmlcontent.Text == null)
                {
                    records.pageContentText = "";
                }
                else
                {
                    records.pageContentText = this.txtbxShowhtmlcontent.ToString();
                }

                records.searchContentText = "";
                records.searchCtxtDT = DateTime.UtcNow;

                scrpMainRecord.insertDatatoMainRecords(records);
                scrpMainRecord.insertDatatoScraperPageTextData(records);

                RecordData.firstanalyzeFlg = false;
                System.Windows.MessageBox.Show("HTML Content Loaded To Database Sucessfully At : " + DateTime.UtcNow.ToString(), "Scraper Demo", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            else if (RecordData.secondanalyzeFlg)
            {
                records.awNo = sqlconn.getAWNO();
                records.webURL = RecordData.mainRecords.webURL;
                records.web1URL = RecordData.mainRecords.web1URL;
                records.web2URL = RecordData.mainRecords.web2URL;
                records.scrapDT = DateTime.UtcNow;
                records.AnalyzeNo = sqlconn.getAnalyzeNo();

                if (records.web1URL == records.web2URL)
                {
                    records.isURLsimilar = "true";
                }
                else
                {
                    records.isURLsimilar = "false";
                }

                if (this.txtbxShowhtmlcontent.Text == null)
                {
                    records.pageContentText = "";
                }
                else
                {
                    records.pageContentText = this.txtbxShowhtmlcontent.ToString();
                }

                records.searchContentText = "";
                records.searchCtxtDT = DateTime.UtcNow;



                scrpMainRecord.insertDatatoMainRecords(records);
                scrpMainRecord.insertDatatoScraperPageTextData(records);

                RecordData.secondanalyzeFlg = false;
                System.Windows.MessageBox.Show("HTML Content Loaded To Database Sucessfully At : " + DateTime.UtcNow.ToString() , "Scraper Demo", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            else 
            {
                RecordData.firstanalyzeFlg = false;
                RecordData.secondanalyzeFlg = false;
                System.Windows.MessageBox.Show("Please analyze first, then load","Scraper Demo",MessageBoxButton.OK,MessageBoxImage.Information);                

            }

        }