public void securedDetais(string orderNumber, string parcelNumber)
        {
            try
            {
                Tax_Year      = driver.FindElement(By.Id("PaymentApplicationContent_divTaxBillYear")).Text;
                Current_Owner = driver.FindElement(By.Id("CurrentOwner")).Text;
                Current_Owner = WebDriverTest.After(Current_Owner, "OWNER");
                Tax_Type      = driver.FindElement(By.Id("display-section-header")).Text;

                Secured_Details = Current_Owner + "~" + Tax_Year + "~" + Tax_Type + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "";
                gc.insert_date(orderNumber, parcelNumber, 952, Secured_Details, 1, DateTime.Now);

                IWebElement         TaxHistoryTB = driver.FindElement(By.XPath("//*[@id='PaymentApplicationContent_dataTableSecured']/tbody"));
                IList <IWebElement> TaxHistoryTR = TaxHistoryTB.FindElements(By.TagName("tr"));
                IList <IWebElement> TaxHistoryTD;

                foreach (IWebElement TaxHistory in TaxHistoryTR)
                {
                    TaxHistoryTD = TaxHistory.FindElements(By.TagName("td"));
                    if (TaxHistoryTD.Count != 0 && !TaxHistory.Text.Contains("Parcel Number") && TaxHistoryTD.Count != 6)
                    {
                        Parcel_No          = TaxHistoryTD[0].Text;
                        Installment        = TaxHistoryTD[1].Text;
                        Installment_Amount = TaxHistoryTD[2].Text;
                        Deliquent_After    = TaxHistoryTD[3].Text;
                        Status             = TaxHistoryTD[4].Text;
                        Amount_Due         = TaxHistoryTD[5].Text;
                        Total_Due          = TaxHistoryTD[6].Text;

                        Secured_Details1 = "" + "~" + "" + "~" + "" + "~" + Installment + "~" + Installment_Amount + "~" + Deliquent_After + "~" + Status + "~" + Amount_Due + "~" + Total_Due;
                        gc.insert_date(orderNumber, Parcel_No, 952, Secured_Details1, 1, DateTime.Now);
                    }
                    if (TaxHistoryTD.Count == 6)
                    {
                        Installment1        = TaxHistoryTD[0].Text;
                        Installment_Amount1 = TaxHistoryTD[1].Text;
                        Deliquent_After1    = TaxHistoryTD[2].Text;
                        Status1             = TaxHistoryTD[3].Text;
                        Amount_Due1         = TaxHistoryTD[4].Text;
                        Total_Due1          = TaxHistoryTD[5].Text;

                        Secured_Details2 = "" + "~" + "" + "~" + "" + "~" + Installment1 + "~" + Installment_Amount1 + "~" + Deliquent_After1 + "~" + Status1 + "~" + Amount_Due1 + "~" + Total_Due1;
                        gc.CreatePdf(orderNumber, Parcel_No, "Secured Details" + Tax_Year, driver, "CA", "San Diego");
                        gc.insert_date(orderNumber, Parcel_No, 952, Secured_Details2, 1, DateTime.Now);
                    }
                }
            }
            catch
            { }
        }
        public string FTP_MNHennepin(string houseno, string housedir, string sname, string sttype, string parcelNumber, string searchType, string orderNumber, string ownername, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";

            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())
            {
                //driver.Manage().Window.Size = new Size(1920, 1080);
                // driver = new ChromeDriver();
                //ChromeOptions chromeOptions = new ChromeOptions();
                //chromeOptions.AddArguments("--headless");
                //chromeOptions.AddArguments("--start-maximized");
                //IWebDriver driver = new ChromeDriver(chromeOptions);

                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");
                    if (searchType == "titleflex")
                    {
                        gc.TitleFlexSearch(orderNumber, parcelNumber, "", address, "MN", "Hennepin");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_Hennepin"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }
                    driver.Navigate().GoToUrl("https://www.hennepin.us/residents/property/property-information-search");

                    if (searchType == "address")
                    {
                        driver.FindElement(By.XPath(".//*[@id='mainform']/div[3]/section/div/header/div/ul[1]/li[1]/a")).Click();
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "MN", "Hennepin");
                        Thread.Sleep(8000);
                        driver.SwitchTo().Window(driver.WindowHandles.Last());
                        Thread.Sleep(8000);
                        driver.FindElement(By.XPath("//*[@id='INPUT1']")).SendKeys(houseno);
                        driver.FindElement(By.XPath("//*[@id='INPUT3']")).SendKeys(sname);
                        driver.FindElement(By.XPath("//*[@id='INPUT4']")).SendKeys(Keys.Enter);
                        Thread.Sleep(6000);
                        gc.CreatePdf_WOP(orderNumber, "Address search result", driver, "MN", "Hennepin");
                        //Multi Parcel
                        try
                        {
                            if (driver.FindElement(By.XPath("/ html / body / div / div[2] / table / tbody / tr[2] / td[2] / div[2] / table / tbody")).Displayed)
                            {
                                string mul = driver.FindElement(By.XPath("/ html / body / div / div[2] / table / tbody / tr[2] / td[2] / div[2] / table / tbody")).Text;
                                mul = WebDriverTest.After(mul, "of").Trim();
                                if ((mul != "1") && (mul != "0"))
                                {
                                    //multi address
                                    IWebElement         tbmulti = driver.FindElement(By.XPath("//*[@id='TABLE1']/tbody/tr[2]/td[2]/div[1]/table/tbody"));
                                    IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                                    IList <IWebElement> TDmulti;
                                    int maxCheck = 0;
                                    foreach (IWebElement row in TRmulti)
                                    {
                                        if (maxCheck <= 25)
                                        {
                                            TDmulti = row.FindElements(By.TagName("td"));
                                            if (TDmulti.Count != 0)
                                            {
                                                string multi1 = TDmulti[1].Text + "~" + TDmulti[2].Text;
                                                gc.insert_date(orderNumber, TDmulti[0].Text, 173, multi1, 1, DateTime.Now);
                                                // gc.insert_date(orderNumber, Parcel_No, 58, prop_details, 1, DateTime.Now);
                                            }
                                            maxCheck++;
                                        }
                                    }

                                    if (TRmulti.Count > 25)
                                    {
                                        HttpContext.Current.Session["multiParcel_Hennepin_Multicount"] = "Maximum";
                                    }
                                    else
                                    {
                                        HttpContext.Current.Session["multiparcel_Hennepin"] = "Yes";
                                    }
                                    driver.Quit();
                                    return("MultiParcel");
                                }
                            }
                        }

                        catch { }
                    }
                    else if (searchType == "parcel")
                    {
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search result", driver, "MN", "Hennepin");
                        // Property ID number(PID)

                        driver.FindElement(By.XPath("/html/body/form/div[3]/section/div/header/div/ul[1]/li[2]/a")).Click();
                        //driver.FindElement(By.LinkText("Property ID number(PID)")).Click();
                        Thread.Sleep(6000);
                        driver.SwitchTo().Window(driver.WindowHandles.Last());
                        //  Thread.Sleep(5000);
                        string strparcelNumber = parcelNumber.Replace(" ", "").Replace("-", "");
                        Thread.Sleep(1000);
                        driver.FindElement(By.XPath("/html/body/div/div[2]/div/table/tbody/tr[2]/td[2]/div[1]/form/table/tbody/tr/td/table/tbody/tr[1]/td[2]/input")).SendKeys(parcelNumber);
                        driver.FindElement(By.XPath("//*[@id='TD4']/div[1]/form/table/tbody/tr/td/table/tbody/tr[2]/td[1]/input")).SendKeys(Keys.Enter);
                        Thread.Sleep(6000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search result", driver, "MN", "Hennepin");
                    }

                    try
                    {
                        IWebElement INodata = driver.FindElement(By.XPath("//*[@id='TABLE1']"));
                        if (INodata.Text.Contains("No records found"))
                        {
                            HttpContext.Current.Session["Nodata_Hennepin"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }

                    //property details
                    //*[@id="TABLE_DETAILS"]
                    //TABLE_DETAILS
                    string bulkpropertytext = driver.FindElement(By.XPath("//*[@id='TABLE_DETAILS']")).Text;
                    parcel_no = gc.Between(bulkpropertytext, "Property ID number:", "Address:").Trim();
                    //if (parcel_no.Contains("-"))
                    //{
                    //    parcel_no = parcel_no.Replace("-", "");
                    //}
                    address           = gc.Between(bulkpropertytext, "Address:", "Municipality:").Trim();
                    Muncipality       = gc.Between(bulkpropertytext, "Municipality:", "School district:").Trim();
                    School_District   = gc.Between(bulkpropertytext, "School district:", "Watershed:").Trim();
                    Construction_year = gc.Between(bulkpropertytext, "Construction year:", "Owner name:").Trim();
                    Owner_name        = gc.Between(bulkpropertytext, "Owner name:", "Taxpayer name & address:").Trim();
                    try
                    {
                        Taxpayer_address = gc.Between(bulkpropertytext, "Taxpayer name & address:", "ONLY THE TAXABLE MARKET").Trim();
                        Taxpayer_address = Taxpayer_address.Replace("\r\n", " ");
                    }
                    catch
                    {
                    }
                    try
                    {
                        Taxpayer_address = gc.Between(bulkpropertytext, "Taxpayer name & address:", "Sale information").Trim();
                        Taxpayer_address = Taxpayer_address.Replace("\r\n", " ");
                    }
                    catch
                    {
                    }
                    //*[@id="TABLE_DETAILS"]/tbody/tr[21]/td[2]/p
                    addition_name = gc.Between(bulkpropertytext, "Addition name:", "Lot:").Trim();
                    lot           = gc.Between(bulkpropertytext, "Lot:", "Block:").Trim();
                    block         = gc.Between(bulkpropertytext, "Block:", "Approximate parcel size:").Trim();
                    parcel_size   = gc.Between(bulkpropertytext, "Approximate parcel size:", "Metes & Bounds:").Trim();
                    try
                    {
                        abstract_torrens = gc.Between(bulkpropertytext, "Abstract or Torrens:", "Value and tax summary").Trim();
                    }
                    catch { }
                    string property_details = address + "~" + Muncipality + "~" + School_District + "~" + Construction_year + "~" + Owner_name + "~" + Taxpayer_address + "~" + addition_name + "~" + lot + "~" + block + "~" + parcel_size + "~" + abstract_torrens;
                    gc.insert_date(orderNumber, parcel_no, 164, property_details, 1, DateTime.Now);

                    //assessment details
                    Land_market                      = driver.FindElement(By.XPath(" //*[@id='Table_Detail']/tbody/tr[4]/td[2]")).Text.Trim();
                    Building_market                  = driver.FindElement(By.XPath(" //*[@id='Table_Detail']/tbody/tr[5]/td[2]")).Text.Trim();
                    Machinery_market                 = driver.FindElement(By.XPath(" //*[@id='Table_Detail']/tbody/tr[6]/td[2]")).Text.Trim();
                    Total_market                     = driver.FindElement(By.XPath(" //*[@id='Table_Detail']/tbody/tr[7]/td[2]")).Text.Trim();
                    Qualifying_improvements          = driver.FindElement(By.XPath(" //*[@id='Table_Detail']/tbody/tr[8]/td[2]")).Text.Trim();
                    Veterans_exclusion               = driver.FindElement(By.XPath(" //*[@id='Table_Detail']/tbody/tr[9]/td[2]")).Text.Trim();
                    Homestead_market_value_exclusion = driver.FindElement(By.XPath(" //*[@id='Table_Detail']/tbody/tr[10]/td[2]")).Text.Trim();
                    Property_type                    = driver.FindElement(By.XPath(" //*[@id='Table_Detail']/tbody/tr[12]/td[2]")).Text.Trim();
                    Homestead_status                 = driver.FindElement(By.XPath(" //*[@id='Table_Detail']/tbody/tr[13]/td[2]")).Text.Trim();
                    Relative_homestead               = driver.FindElement(By.XPath(" //*[@id='Table_Detail']/tbody/tr[14]/td[2]")).Text.Trim();
                    Agricultural                     = driver.FindElement(By.XPath(" //*[@id='Table_Detail']/tbody/tr[15]/td[2]")).Text.Trim();
                    Exempt_status                    = driver.FindElement(By.XPath(" //*[@id='Table_Detail']/tbody/tr[16]/td[2]")).Text.Trim();

                    string assessment_details = Land_market + "~" + Building_market + "~" + Machinery_market + "~" + Total_market + "~" + Qualifying_improvements + "~" + Veterans_exclusion + "~" + Homestead_market_value_exclusion + "~" + Property_type + "~" + Homestead_status + "~" + Relative_homestead + "~" + Agricultural + "~" + Exempt_status;
                    gc.insert_date(orderNumber, parcel_no, 169, assessment_details, 1, DateTime.Now);
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");
                    //2018 State Copy
                    try
                    {
                        driver.FindElement(By.PartialLinkText("state copy")).Click();

                        Thread.Sleep(4000);
                        gc.CreatePdf_WOP(orderNumber, "CurrentYear state copy", driver, "MN", "Hennepin");
                        driver.Navigate().Back();
                    }
                    catch (Exception e)
                    {
                    }
                    //current year tax due


                    string strURL = "https://www16.co.hennepin.mn.us/taxpayments/taxesdue.jsp?pid=" + parcel_no;

                    // IWebElement current = driver.FindElement(By.LinkText("Current year taxes due"));
                    // current.SendKeys(Keys.Enter);
                    //string URL1 = current.GetAttribute("href");
                    driver.Navigate().GoToUrl(strURL);
                    //driver.FindElement(By.LinkText("Current year taxes due")).SendKeys(Keys.Enter);
                    Thread.Sleep(6000);
                    gc.CreatePdf_WOP(orderNumber, "Current year taxes due", driver, "MN", "Hennepin");
                    //delinquent tax
                    try
                    {
                        if (driver.FindElement(By.XPath("/html/body/div[1]/section/div/div/div[4]/p")).Displayed)
                        {
                            string delinquenttax = driver.FindElement(By.XPath("/html/body/div[1]/section/div/div/div[4]/p")).Text.Trim();
                            HttpContext.Current.Session["delinquent_Hennepin"] = "Yes";
                        }
                    }
                    catch
                    {
                    }
                    //Property tax information Table
                    //*[@id="taxesdue"]/table/tbody/tr[1]/td[2]

                    try
                    {
                        Property_ID_number    = driver.FindElement(By.XPath("//*[@id='taxesdue']/table/tbody/tr[1]/td[2]")).Text.Trim();
                        Property_address      = driver.FindElement(By.XPath("//*[@id='taxesdue']/table/tbody/tr[2]/td[2]")).Text.Trim();
                        Owner_name1           = driver.FindElement(By.XPath("//*[@id='taxesdue']/table/tbody/tr[3]/td[2]")).Text.Trim();
                        Taxpayer_name_address = driver.FindElement(By.XPath("//*[@id='taxesdue']/table/tbody/tr[4]/td[2]")).Text.Trim();
                        Taxpayer_name_address = Taxpayer_name_address.Replace("\r\n", " ");

                        string tax_year = "-", tax_type = "-";
                        //*[@id="TH1"]
                        tax_year = driver.FindElement(By.XPath("//*[@id='TH1']")).Text.Trim();
                        string property_tax1 = Property_ID_number + "~" + tax_year + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-";
                        gc.insert_date(orderNumber, parcel_no, 171, property_tax1, 1, DateTime.Now);



                        IWebElement         multitableElement1 = driver.FindElement(By.XPath("//*[@id='TBODY4']"));
                        IList <IWebElement> multitableRow1     = multitableElement1.FindElements(By.TagName("tr"));
                        IList <IWebElement> multirowTD1;
                        foreach (IWebElement row in multitableRow1)
                        {
                            if (!row.Text.Contains("taxes"))
                            {
                                multirowTD1 = row.FindElements(By.TagName("td"));
                                if (multirowTD1.Count != 1 && row.Text.Trim() != "")
                                {
                                    string property_tax2 = Property_ID_number + "~" + "-" + "~" + multirowTD1[0].Text.Trim() + "~" + multirowTD1[1].Text.Trim() + "~" + multirowTD1[2].Text.Trim() + "~" + multirowTD1[3].Text.Trim();
                                    gc.insert_date(orderNumber, parcel_no, 171, property_tax2, 1, DateTime.Now);
                                }
                            }
                        }

                        string Ist_half = "-", Ist_half_amount = "-", IInd_half = "-", IInd_half_amount = "-", total_due = "-", total_due_amount = "-", msg = "-", msgadd = "-";
                        Ist_half        = driver.FindElement(By.XPath("//*[@id='TABLE_SEL']/tbody/tr[1]/td[2]")).Text.Trim();
                        Ist_half_amount = driver.FindElement(By.XPath("//*[@id='TABLE_SEL']/tbody/tr[1]/td[4]")).Text.Trim();
                        string property_tax3 = Property_ID_number + "~" + "-" + "~" + Ist_half + "~" + "-" + "~" + "-" + "~" + Ist_half_amount;
                        gc.insert_date(orderNumber, parcel_no, 171, property_tax3, 1, DateTime.Now);


                        IInd_half        = driver.FindElement(By.XPath("//*[@id='TABLE_SEL']/tbody/tr[2]/td[2]")).Text.Trim();
                        IInd_half_amount = driver.FindElement(By.XPath("//*[@id='TABLE_SEL']/tbody/tr[2]/td[4]")).Text.Trim();
                        string property_tax4 = Property_ID_number + "~" + "-" + "~" + IInd_half + "~" + "-" + "~" + "-" + "~" + IInd_half_amount;
                        gc.insert_date(orderNumber, parcel_no, 171, property_tax4, 1, DateTime.Now);

                        total_due        = driver.FindElement(By.XPath("//*[@id='TABLE_SEL']/tbody/tr[4]/td[1]")).Text.Trim();
                        total_due_amount = driver.FindElement(By.XPath("//*[@id='TABLE_SEL']/tbody/tr[4]/td[3]")).Text.Trim();


                        msg = driver.FindElement(By.XPath("/html/body/div[1]/section/div/div/p")).Text.Trim();
                        msg = msg.Replace("\r\n", " ");
                        string property_tax6 = msg + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-";
                        gc.insert_date(orderNumber, parcel_no, 171, property_tax6, 1, DateTime.Now);

                        msgadd = driver.FindElement(By.XPath("//*[@id='taxesdue']/p/strong")).Text.Trim();
                        msgadd = msgadd.Replace("\r\n", " ");
                        string property_tax7 = "Tax Authority  :" + "~" + msgadd + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-";
                        gc.insert_date(orderNumber, parcel_no, 171, property_tax7, 1, DateTime.Now);
                        driver.Navigate().Back();
                        Thread.Sleep(4000);
                    }
                    catch
                    {
                        driver.Navigate().Back();
                    }
                    //Prior Year Taxes
                    // driver.Navigate().GoToUrl(strURL);
                    driver.FindElement(By.PartialLinkText("Prior year taxes")).Click();
                    Thread.Sleep(4000);
                    gc.CreatePdf_WOP(orderNumber, "Prior year taxes", driver, "MN", "Hennepin");
                    //Tax Summary
                    //   Date~Estimated_market_Value~Taxable_market_Value~Total_improvement_amount~Total_net_tax~Total_special_assessments~Solid_waste_fee~Total_Tax

                    string Estimated_market_Value = "-", Taxable_market_Value = "-", Total_improvement_amount = "-", Total_net_tax = "-", Total_special_assessments = "-", Solid_waste_fee = "-", Total_Tax = "-";
                    try
                    {
                        string fulltabletext = driver.FindElement(By.XPath("//*[@id='TABLE_DETAILS']")).Text;

                        Estimated_market_Value    = gc.Between(fulltabletext, "Estimated market value:", "Taxable market value:").Trim();
                        Taxable_market_Value      = gc.Between(fulltabletext, "Taxable market value:", "Total improvement amount:").Trim();
                        Total_improvement_amount  = gc.Between(fulltabletext, "Total improvement amount:", "Total net tax:").Trim();
                        Total_net_tax             = gc.Between(fulltabletext, "Total net tax:", "Total special assessments:").Trim();
                        Total_special_assessments = gc.Between(fulltabletext, "Total special assessments:", "Solid waste fee:").Trim();
                        Solid_waste_fee           = gc.Between(fulltabletext, "Solid waste fee:", "Total Tax:").Trim();
                        Total_Tax = GlobalClass.After(fulltabletext, "Total Tax:").Trim().Replace("\r\n", "");
                        string tax_Summary = Estimated_market_Value + "~" + Taxable_market_Value + "~" + Total_improvement_amount + "~" + Total_net_tax + "~" + Total_special_assessments + "~" + Solid_waste_fee + "~" + Total_Tax;
                        gc.insert_date(orderNumber, parcel_no, 172, tax_Summary, 1, DateTime.Now);
                        driver.Navigate().Back();
                        //Current Year Value
                        driver.FindElement(By.LinkText("Current year values")).Click();
                        Thread.Sleep(4000);
                        gc.CreatePdf_WOP(orderNumber, "Current Year Value", driver, "MN", "Hennepin");
                        driver.Navigate().Back();
                    }
                    catch
                    { }

                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "MN", "Hennepin", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderNumber, "MN", "Hennepin");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw ex;
                }
            }
        }
        public string FTP_CASantaClara(string address, string assessment_id, string parcelNumber, string searchType, string orderNumber, string directParcel, string ownername)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";

            //var driverService = PhantomJSDriverService.CreateDefaultService();
            //driverService.HideCommandPromptWindow = true;
            // driver = new PhantomJSDriver();
            //driver = new ChromeDriver();

            var option = new ChromeOptions();

            option.AddArgument("No-Sandbox");
            using (driver = new ChromeDriver(option))
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");

                    if (searchType == "titleflex")
                    {
                        gc.TitleFlexSearch(orderNumber, parcelNumber, ownername, "", "CA", "Santa Clara");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_CASantaClara"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "address")
                    {
                        try
                        {
                            driver.Navigate().GoToUrl("https://www.sccassessor.org/index.php/online-services/property-search/real-property");
                            Thread.Sleep(2000);

                            IWebElement iframeElementAdd = driver.FindElement(By.XPath("//*[@id='blockrandom']"));
                            driver.SwitchTo().Frame(iframeElementAdd);
                            Thread.Sleep(2000);

                            driver.FindElement(By.XPath("//*[@id='searchinput']")).SendKeys(address);
                            gc.CreatePdf_WOP(orderNumber, "Address search", driver, "CA", "Santa Clara");
                            driver.FindElement(By.Id("btnAddress")).SendKeys(Keys.Enter);
                            Thread.Sleep(4000);

                            //MultiParcel
                            try
                            {
                                IWebElement         MultiTable = driver.FindElement(By.XPath("//*[@id='asrGrid']/div[2]/table/tbody"));
                                IList <IWebElement> MultiTR    = MultiTable.FindElements(By.TagName("tr"));
                                IList <IWebElement> MultiTD;
                                gc.CreatePdf_WOP(orderNumber, "Multi Address search", driver, "CA", "Santa Clara");
                                int maxCheck = 0;

                                foreach (IWebElement multi in MultiTR)
                                {
                                    if (maxCheck <= 25)
                                    {
                                        MultiTD = multi.FindElements(By.TagName("td"));
                                        if (MultiTD.Count != 0)
                                        {
                                            parcelNumber     = MultiTD[0].Text;
                                            property_Address = MultiTD[1].Text;
                                            MultiParcelData  = property_Address;
                                            gc.insert_date(orderNumber, parcelNumber, 547, MultiParcelData, 1, DateTime.Now);
                                        }
                                        maxCheck++;
                                    }
                                }

                                if (MultiTR.Count > 25)
                                {
                                    HttpContext.Current.Session["multiParcel_SantaClara_Multicount"] = "Maximum";
                                }
                                else
                                {
                                    HttpContext.Current.Session["multiparcel_SantaClara"] = "Yes";
                                }
                                driver.Quit();

                                return("MultiParcel");
                            }
                            catch
                            { }
                        }
                        catch
                        { }
                        try
                        {
                            //No Data Found
                            string nodata = driver.FindElement(By.XPath("//*[@id='ContentMasterPage_lblError']/div")).Text;
                            if (nodata.Contains("No records meet your search criteria:"))
                            {
                                HttpContext.Current.Session["Nodata_CASantaClara"] = "Zero";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                        try
                        {
                            //No Data Found
                            string nodata = driver.FindElement(By.XPath("//*[@id='ui-id-1']")).Text;
                            if (nodata.Contains("No Such Address"))
                            {
                                HttpContext.Current.Session["Nodata_CASantaClara"] = "Zero";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                    }

                    if (searchType == "parcel")
                    {
                        try
                        {
                            driver.Navigate().GoToUrl("https://www.sccassessor.org/index.php/online-services/property-search/real-property");
                            Thread.Sleep(2000);

                            IWebElement iframeElement1 = driver.FindElement(By.XPath("//*[@id='blockrandom']"));
                            driver.SwitchTo().Frame(iframeElement1);
                            Thread.Sleep(2000);

                            driver.FindElement(By.XPath("//*[@id='myTab-accordion']/div[3]/div[1]/h4/a")).Click();
                            Thread.Sleep(2000);

                            driver.FindElement(By.Id("apninput")).SendKeys(parcelNumber);
                            gc.CreatePdf_WOP(parcelNumber, "Parcel search", driver, "CA", "Santa Clara");
                            driver.FindElement(By.Id("btnAPN")).SendKeys(Keys.Enter);
                            Thread.Sleep(4000);
                            try
                            {
                                //No Data Found
                                string nodata = driver.FindElement(By.XPath("//*[@id='ContentMasterPage_lblError']/div")).Text;
                                if (nodata.Contains("No records meet your search criteria:"))
                                {
                                    HttpContext.Current.Session["Nodata_CASantaClara"] = "Zero";
                                    driver.Quit();
                                    return("No Data Found");
                                }
                            }
                            catch { }
                        }
                        catch
                        { }
                    }

                    //Property Details
                    parcelno         = driver.FindElement(By.XPath("//*[@id='divFrame']/div[1]/div/div[1]")).Text;
                    parcelno         = WebDriverTest.After(parcelno, ":").Replace("\r\n", " ").Trim();
                    Property_Address = driver.FindElement(By.XPath("//*[@id='oneAddress']/div/div[1]/div")).Text;


                    //Assessment Deatils
                    Tax_Default_Date = driver.FindElement(By.XPath("//*[@id='tab-1-collapse']/div/div/div[1]/div/div/div/table/tbody/tr[2]/td[2]")).Text;
                    Tax_Default_Date = WebDriverTest.After(Tax_Default_Date, ": ");

                    IWebElement         AssementTB = driver.FindElement(By.XPath("//*[@id='tab-1-collapse']/div/div/div[2]/div/div[2]/div/table/tbody"));
                    IList <IWebElement> AssementTR = AssementTB.FindElements(By.TagName("tr"));
                    IList <IWebElement> AssementTD;
                    foreach (IWebElement Assement in AssementTR)
                    {
                        AssementTD = Assement.FindElements(By.TagName("td"));
                        if (AssementTD.Count != 0 || !Assement.Text.Contains(" "))
                        {
                            lan = AssementTD[0].Text;
                            if (lan.Contains("Land:"))
                            {
                                Land_Value = AssementTD[1].Text;
                            }
                            Imp = AssementTD[0].Text;
                            if (Imp.Contains("Improvements:"))
                            {
                                Impovement = AssementTD[1].Text;
                            }
                            TAss = AssementTD[0].Text;
                            if (TAss.Contains("Total:"))
                            {
                                Total_Assessed = AssementTD[1].Text;
                            }
                        }
                    }

                    IWebElement         AssementTB1 = driver.FindElement(By.XPath("//*[@id='tab-1-collapse']/div/div/div[2]/div/div[4]/div/table/tbody"));
                    IList <IWebElement> AssementTR1 = AssementTB1.FindElements(By.TagName("tr"));
                    IList <IWebElement> AssementTD1;
                    foreach (IWebElement Assement1 in AssementTR1)
                    {
                        AssementTD1 = Assement1.FindElements(By.TagName("td"));
                        if (AssementTD1.Count != 0 || !Assement1.Text.Contains(" "))
                        {
                            Homeowner = AssementTD1[0].Text;
                            if (Homeowner.Contains("Homeowner:"))
                            {
                                Home_Owner = AssementTD1[1].Text;
                            }
                            other = AssementTD1[0].Text;
                            if (other.Contains("Other:"))
                            {
                                Other = AssementTD1[1].Text;
                            }
                            TExe = AssementTD1[0].Text;
                            if (TExe.Contains("Total:"))
                            {
                                Total_Expections = AssementTD1[1].Text;
                            }
                        }
                    }

                    IWebElement         AssementTB2 = driver.FindElement(By.XPath("//*[@id='tab-1-collapse']/div/div/div[2]/div/div[5]/div/table/tbody"));
                    IList <IWebElement> AssementTR2 = AssementTB2.FindElements(By.TagName("tr"));
                    IList <IWebElement> AssementTD2;
                    foreach (IWebElement Assement2 in AssementTR2)
                    {
                        AssementTD2 = Assement2.FindElements(By.TagName("td"));
                        if (AssementTD2.Count != 0 || !Assement2.Text.Contains(" "))
                        {
                            Net_Total = AssementTD2[0].Text;
                            if (Net_Total.Contains("Total:"))
                            {
                                Net_Assed_Value = AssementTD2[1].Text;
                            }
                        }
                    }

                    Assesssment_Details = Land_Value + "~" + Impovement + "~" + Total_Assessed + "~" + Home_Owner + "~" + Other + "~" + Total_Expections + "~" + Net_Assed_Value + "~" + Tax_Default_Date;
                    gc.CreatePdf(orderNumber, parcelno, "Assessment Details", driver, "CA", "Santa Clara");
                    ByVisibleElement(driver.FindElement(By.XPath("//*[@id='tab-1-collapse']/div/div/div[2]/div/div[2]/div/table/tbody/tr[4]/td[1]")));
                    gc.CreatePdf(orderNumber, parcelno, "Assessment Details1", driver, "CA", "Santa Clara");
                    ByVisibleElement(driver.FindElement(By.XPath("//*[@id='tab-1-collapse']/div/div/div[2]/div/div[4]/div/table/thead/tr/td")));
                    gc.CreatePdf(orderNumber, parcelno, "Assessment Details2", driver, "CA", "Santa Clara");
                    gc.insert_date(orderNumber, parcelno, 542, Assesssment_Details, 1, DateTime.Now);

                    driver.FindElement(By.XPath("//*[@id='myTab-accordion']/div[5]/div[1]/h4/a")).Click();
                    Thread.Sleep(2000);

                    TRA = driver.FindElement(By.XPath("//*[@id='tab-5-collapse']/div/div/div/div/div[1]/div[1]/div/div/div[1]")).Text;
                    TRA = gc.Between(TRA, "TAX RATE AREA INFORMATION  ", "(Tax Rate Information as").Trim();

                    Property_Details = Property_Address + "~" + TRA;
                    gc.insert_date(orderNumber, parcelno, 541, Property_Details, 1, DateTime.Now);

                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    //Tax Information
                    driver.Navigate().GoToUrl("https://payments.sccgov.org/propertytax/Secured");
                    Thread.Sleep(2000);

                    //Address Search
                    //driver.FindElement(By.XPath("//*[@id='tab2_link']/a")).SendKeys(Keys.Enter);
                    //Thread.Sleep(2000);

                    //driver.FindElement(By.Id("FullAddress")).SendKeys(address);
                    //driver.FindElement(By.XPath("//*[@id='FullAddress']")).SendKeys(Keys.Enter);
                    //Thread.Sleep(2000);

                    //parcelno = driver.FindElement(By.XPath("/html/body/div[2]/div/div[2]/div/form/div[1]/div/dl/dd[1]")).Text;
                    //parcelno = WebDriverTest.Before(parcelno, " View Payment History");

                    driver.FindElement(By.Id("ParcelNumber")).SendKeys(parcelno);
                    try
                    {
                        gc.CreatePdf(orderNumber, parcelno, "Tax Details 1", driver, "CA", "Santa Clara");
                        driver.FindElement(By.Id("ParcelSubmit")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);
                    }
                    catch
                    { }


                    try
                    {
                        ByVisibleElement(driver.FindElement(By.XPath("//*[@id='index_avoidconv_link']/span")));
                        gc.CreatePdf(orderNumber, parcelno, "Tax Details 2", driver, "CA", "Santa Clara");
                    }
                    catch
                    {
                    }
                    //Tax Payment History Details
                    try
                    {
                        driver.FindElement(By.XPath("//*[@id='tabs']/a/span")).Click();
                        Thread.Sleep(5000);
                    }
                    catch
                    { }

                    try
                    {
                        driver.FindElement(By.XPath("/html/body/div[2]/div/div[2]/div/form/div[1]/div/dl/dd[1]/a")).Click();
                        Thread.Sleep(5000);
                    }
                    catch
                    { }
                    IWebElement         TaxHistoryTB = driver.FindElement(By.XPath("//*[@id='historybody']"));
                    IList <IWebElement> TaxHistoryTR = TaxHistoryTB.FindElements(By.TagName("tr"));
                    IList <IWebElement> TaxHistoryTD;

                    foreach (IWebElement TaxHistory in TaxHistoryTR)
                    {
                        TaxHistoryTD = TaxHistory.FindElements(By.TagName("td"));
                        if (TaxHistoryTD.Count != 0)
                        {
                            Tax_Year_Payment           = TaxHistoryTD[0].Text;
                            APN_Suffix_Payment         = TaxHistoryTD[1].Text;
                            Installment_Payment        = TaxHistoryTD[2].Text;
                            Tax_Amount_Payment         = TaxHistoryTD[3].Text;
                            Additional_Charges_Payment = TaxHistoryTD[4].Text;
                            Paid_Amount_Payment        = TaxHistoryTD[5].Text;
                            Paid_Date_Payment          = TaxHistoryTD[6].Text;


                            Taxpayment_Details = Tax_Year_Payment + "~" + APN_Suffix_Payment + "~" + Installment_Payment + "~" + Tax_Amount_Payment + "~" + Additional_Charges_Payment + "~" + Paid_Amount_Payment + "~" + Paid_Date_Payment;
                            gc.CreatePdf(orderNumber, parcelno, "Tax Payment History Details", driver, "CA", "Santa Clara");
                            gc.insert_date(orderNumber, parcelno, 544, Taxpayment_Details, 1, DateTime.Now);
                        }
                    }
                    try
                    {
                        ByVisibleElement(driver.FindElement(By.XPath("//*[@id='historybody']/tr[11]/td[1]")));
                        gc.CreatePdf(orderNumber, parcelno, "Tax Payment History Details1", driver, "CA", "Santa Clara");
                    }
                    catch { }

                    try
                    {
                        driver.FindElement(By.XPath("//*[@id='closebutton']")).Click();
                        Thread.Sleep(2000);
                    }
                    catch { }



                    //Current Tax Details
                    try
                    {
                        tax_type = driver.FindElement(By.XPath("//*[@id='select_invoiceslist']/div[1]/div[1]/span")).Text;

                        try
                        {
                            IWebElement CurrentBill    = driver.FindElement(By.XPath("//*[@id='select_invoiceslist']/div/div[1]/div/a"));
                            string      CurrentTaxBill = CurrentBill.GetAttribute("href");
                            gc.downloadfile(CurrentTaxBill, orderNumber, parcelno, "Current Tax Bill", "CA", "Santa Clara");
                        }
                        catch
                        { }

                        if (tax_type == "Annual Tax Bill" || tax_type == "Supplemental Tax Bill")
                        {
                            for (int i = 0; i < 3; i++)
                            {
                                for (int j = 2; j < 11; j++)
                                {
                                    Installment += driver.FindElement(By.XPath("//*[@id='select_invoiceslist']/div/div[3]/div[" + (i + 2) + "]/div[ " + j + " ]")).Text + "~";
                                }
                                Installment = tax_type + "~" + Installment.Remove(Installment.Length - 1, 1);
                                i++;
                                gc.CreatePdf(orderNumber, parcelno, "Current Tax Details", driver, "CA", "Santa Clara");
                                gc.insert_date(orderNumber, parcelno, 540, Installment, 1, DateTime.Now);
                                Installment = "";
                            }
                        }
                    }
                    catch
                    { }


                    try
                    {
                        tax_type_Supp = driver.FindElement(By.XPath("//*[@id='select_invoiceslist']/div[2]/div[1]/span")).Text;

                        try
                        {
                            IWebElement SupplementalBill    = driver.FindElement(By.XPath("//*[@id='select_invoiceslist']/div[2]/div[1]/div/a"));
                            string      SupplementalTaxBill = SupplementalBill.GetAttribute("href");
                            gc.downloadfile(SupplementalTaxBill, orderNumber, parcelno, "Supplemental Tax Bill", "CA", "Santa Clara");
                        }
                        catch
                        { }

                        if (tax_type_Supp == "Supplemental Tax Bill")
                        {
                            InstallmentSupplemnt = "";
                            for (int k = 0; k < 3; k++)
                            {
                                for (int l = 2; l < 11; l++)
                                {
                                    InstallmentSupplemnt += driver.FindElement(By.XPath("//*[@id='select_invoiceslist']/div[2]/div[3]/div[" + (k + 2) + "]/div[" + l + "]")).Text + "~";
                                }
                                InstallmentSupplemnt = tax_type_Supp + "~" + InstallmentSupplemnt.Remove(InstallmentSupplemnt.Length - 1, 1);
                                k++;
                                gc.CreatePdf(orderNumber, parcelno, "Supplemental Tax Details", driver, "CA", "Santa Clara");
                                gc.insert_date(orderNumber, parcelno, 545, InstallmentSupplemnt, 1, DateTime.Now);
                                InstallmentSupplemnt = "";
                            }
                        }


                        if (tax_type_Supp == "Supplemental Tax Bill")
                        {
                            InstallmentSupplemnt1 = "";
                            for (int m = 0; m < 3; m++)
                            {
                                for (int n = 2; n < 11; n++)
                                {
                                    try
                                    {
                                        InstallmentSupplemnt1 += driver.FindElement(By.XPath("//*[@id='select_invoiceslist']/div[3]/div[3]/div[" + (m + 2) + "]/div[" + n + "]")).Text + "~";
                                    }
                                    catch
                                    { }
                                }
                                InstallmentSupplemnt1 = tax_type_Supp + "~" + InstallmentSupplemnt1.Remove(InstallmentSupplemnt1.Length - 1, 1);
                                m++;
                                try
                                {
                                    ByVisibleElement(driver.FindElement(By.XPath("//*[@id='select_invoiceslist']/div[3]/div[3]/div[1]/div[2]")));
                                    gc.CreatePdf(orderNumber, parcelno, "Supplemental Tax Details1", driver, "CA", "Santa Clara");
                                    Thread.Sleep(2000);
                                }
                                catch { }
                                gc.insert_date(orderNumber, parcelno, 546, InstallmentSupplemnt1, 1, DateTime.Now);
                                InstallmentSupplemnt1 = "";
                            }
                        }
                    }
                    catch
                    { }


                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "CA", "Santa Clara", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderNumber, "CA", "Santa Clara");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw;
                }
            }
        }
        public string FTP_NMBernalillo(string houseno, string sname, string sttype, string parcelNumber, string searchType, string orderNumber, string ownername, string dierctSearch)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";

            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            //driver = new ChromeDriver();
            //driver = new PhantomJSDriver();
            using (driver = new PhantomJSDriver())
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");
                    if (searchType == "titleflex")
                    {
                        string address = houseno + " " + sname;
                        gc.TitleFlexSearch(orderNumber, parcelNumber, "", address, "NM", "Bernalillo");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_NMBernalillio"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }
                    if (searchType == "address")
                    {
                        string result = "";
                        // http://assessor.bernco.gov/public.access/Search/Disclaimer.aspx?FromUrl=../search/commonsearch.aspx?mode=realprop
                        driver.Navigate().GoToUrl("http://assessor.bernco.gov/public.access/Search/Disclaimer.aspx?FromUrl=../search/commonsearch.aspx?mode=realprop");
                        try
                        {
                            driver.FindElement(By.XPath("//*[@id='topmenu']/ul/li[1]/a")).Click();
                            Thread.Sleep(2000);
                        }
                        catch
                        { }
                        driver.FindElement(By.XPath("//*[@id='btAgree']")).SendKeys(Keys.Enter);
                        driver.FindElement(By.Id("inpNo")).SendKeys(houseno);
                        driver.FindElement(By.XPath("//*[@id='inpStreet']")).SendKeys(sname);
                        gc.CreatePdf_WOP(orderNumber, "InputPassed AddressSearch", driver, "NM", "Bernalillo");
                        driver.FindElement(By.Id("inpStreet")).SendKeys(Keys.Enter);
                        Thread.Sleep(6000);
                        try
                        {
                            result = driver.FindElement(By.XPath("//*[@id='ml']")).Text;
                        }

                        catch
                        {
                        }

                        try
                        {
                            srtAddress = driver.FindElement(By.XPath("//*[@id='frmMain']/table/tbody/tr/td/div/div/table[2]/tbody/tr/td/table/tbody/tr[3]/td/center/table[1]/tbody/tr/td[3]")).Text;
                            Address    = Convert.ToInt32(WebDriverTest.Between(srtAddress, "Displaying 1 - ", " of"));


                            if (Address > 15)
                            {
                                HttpContext.Current.Session["multiParcel_NMBernalillo_count"] = "Maximum";
                                driver.Quit();
                                return("Maximum");
                            }
                            if (srtAddress != "" && Address <= 15 && !result.Contains("Return to Search Results"))
                            {
                                IWebElement         IAddressTable = driver.FindElement(By.XPath("//*[@id='searchResults']/tbody"));
                                IList <IWebElement> IAddressrow   = IAddressTable.FindElements(By.TagName("tr"));
                                IList <IWebElement> IAddressTD;
                                foreach (IWebElement Row in IAddressrow)
                                {
                                    IAddressTD = Row.FindElements(By.TagName("td"));
                                    HttpContext.Current.Session["multiparcel_NMBernalillo"] = "Yes";
                                    if (IAddressTD.Count != 0 && !Row.Text.Contains("Parcel ID") && Row.Text != "")
                                    {
                                        string ParcelID = IAddressTD[0].Text;
                                        string Owner    = IAddressTD[1].Text;
                                        string Addres   = IAddressTD[2].Text;
                                        string Property = Owner + "~" + Addres;
                                        gc.insert_date(orderNumber, ParcelID, 98, Property, 1, DateTime.Now);
                                        gc.CreatePdf_WOP(orderNumber, "Mulitparcelgrid", driver, "NM", "Bernalillo");
                                    }
                                }
                                driver.Quit();
                                return("MultiParcel");
                            }
                            else
                            {
                            }
                        }
                        catch { }
                    }

                    if (searchType == "parcel")
                    {
                        driver.Navigate().GoToUrl("http://assessor.bernco.gov/public.access/search/commonsearch.aspx?mode=parid");
                        try
                        {
                            driver.FindElement(By.XPath("//*[@id='topmenu']/ul/li[1]/a")).Click();
                            Thread.Sleep(2000);
                        }
                        catch
                        { }
                        driver.FindElement(By.XPath("//*[@id='btAgree']")).SendKeys(Keys.Enter);
                        driver.FindElement(By.Id("inpSuf")).SendKeys(parcelNumber);
                        gc.CreatePdf(orderNumber, parcelNumber, "InputPassed ParcelSearch", driver, "NM", "Bernalillo");
                        driver.FindElement(By.XPath("//*[@id='btSearch']")).SendKeys(Keys.Enter);
                        Thread.Sleep(6000);
                    }

                    try
                    {
                        IWebElement INodata = driver.FindElement(By.XPath("//*[@id='frmMain']/table/tbody/tr/td/div/div/table[2]"));
                        if (INodata.Text.Contains("search did not find any records"))
                        {
                            HttpContext.Current.Session["Nodata_NMBernalillio"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }

                    //Property Details
                    driver.FindElement(By.XPath("//*[@id='sidemenu']/li[1]/a")).SendKeys(Keys.Enter);
                    //Screenshot
                    gc.CreatePdf_WOP(orderNumber, "PropertyDetails", driver, "NM", "Bernalillo");
                    //Profile
                    outparcelno           = driver.FindElement(By.XPath("//*[@id='datalet_header_row']/td/table/tbody/tr[1]/td[1]")).Text;
                    outparcelno           = WebDriverTest.After(outparcelno, ": ");
                    strClassname          = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[1]/table[2]/tbody/tr[1]/td[2]")).Text;
                    strTaxdistrcit        = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[1]/table[2]/tbody/tr[2]/td[2]")).Text;
                    strTaxyear            = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[2]/table[2]/tbody/tr[1]/td[2]")).Text;
                    strOwnername          = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[2]/table[2]/tbody/tr[2]/td[2]")).Text;
                    strLocationaddrss     = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[4]/table[2]/tbody/tr[1]/td[2]")).Text;
                    strCity               = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[4]/table[2]/tbody/tr[2]/td[2]")).Text;
                    strProprtydescription = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[4]/table[2]/tbody/tr[5]/td[2]")).Text;
                    strRealproperty       = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[6]/table[2]/tbody/tr[1]/td[2]")).Text;
                    strYearBuilt          = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[6]/table[2]/tbody/tr[2]/td[2]")).Text;
                    strLotSize            = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[6]/table[2]/tbody/tr[3]/td[2]")).Text;
                    strLandUseCode        = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[6]/table[2]/tbody/tr[4]/td[2]")).Text;
                    strStyle              = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[6]/table[2]/tbody/tr[5]/td[2]")).Text;

                    string property_details = strClassname + "~" + strTaxdistrcit + "~" + strTaxyear + "~" + strOwnername + "~" + strLocationaddrss + "~" + strCity + "~" + strProprtydescription + "~" + strRealproperty + "~" + strYearBuilt + "~" + strLotSize + "~" + strLandUseCode + "~" + strStyle;
                    gc.insert_date(orderNumber, outparcelno, 100, property_details, 1, DateTime.Now);

                    //Assement Details
                    driver.FindElement(By.XPath("//*[@id='sidemenu']/li[2]/a")).SendKeys(Keys.Enter);
                    //Screenshot
                    gc.CreatePdf(orderNumber, outparcelno, "Assessment Details", driver, "NM", "Bernalillo");
                    //Values
                    strValues          = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[1]/table[2]/tbody/tr[1]/td[2]")).Text;
                    strFullLandValue   = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[1]/table[2]/tbody/tr[2]/td[2]")).Text;
                    strTablevalues     = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[1]/table[2]/tbody/tr[3]/td[2]")).Text;
                    strFullImpValue    = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[1]/table[2]/tbody/tr[4]/td[2]")).Text;
                    strTotalValue      = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[1]/table[2]/tbody/tr[5]/td[2]")).Text;
                    strTaxable         = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[1]/table[2]/tbody/tr[7]/td[2]")).Text;
                    strException       = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[2]/table[2]/tbody/tr[1]/td[2]")).Text;
                    strVetaranan       = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[2]/table[2]/tbody/tr[2]/td[2]")).Text;
                    strOther           = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[2]/table[2]/tbody/tr[3]/td[2]")).Text;
                    strNettaxablevalue = driver.FindElement(By.XPath("/html/body/div/div[3]/section/div/form/div[3]/div/div/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[3]/table[2]/tbody/tr[1]/td[2]")).Text;

                    string assement_details = strValues + "~" + strFullLandValue + "~" + strTablevalues + "~" + strFullImpValue + "~" + strTotalValue + "~" + strTaxable + "~" + strException + "~" + strVetaranan + "~" + strOther + "~" + strNettaxablevalue;
                    gc.insert_date(orderNumber, outparcelno, 101, assement_details, 1, DateTime.Now);
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    //Tax Status

                    driver.Navigate().GoToUrl("https://www.bernco.gov/treasurer/property-tax-search.aspx");

                    //Screenshot
                    gc.CreatePdf(orderNumber, outparcelno, "Address Search Result", driver, "NM", "Bernalillo");

                    //Tax Authority
                    Tax_Authority = "One Civic Plaza NW Albuquerque, NM 87102";

                    IWebElement LinkSearch = driver.FindElement(By.XPath("//*[@id='_af46712e95534fbaab28f66852f6c7ca_pnl02cd722299cd4618a01367f388ce5d42Content']/p[5]")).FindElement(By.TagName("a"));
                    string      linkhref   = LinkSearch.GetAttribute("href");
                    driver.Navigate().GoToUrl(linkhref);
                    IJavaScriptExecutor js1 = driver as IJavaScriptExecutor;
                    //js1.ExecuteScript("arguments[0].click();", LinkSearch);
                    //Thread.Sleep(7000);

                    //js1.ExecuteScript("document.getElementById('ctl03_TemplateBody_ctl00_PageLayout_ctl00_Placeholder3_ctl00_pageContent_ctl00_Placeholder5_ctl00_ctl00_parcelId').value='" + outparcelno + "'");
                    //gc.CreatePdf(orderNumber, outparcelno, "Parcel Search", driver, "NM", "Bernalillo");

                    Thread.Sleep(3000);
                    gc.CreatePdf(orderNumber, outparcelno, "Parcel Search Result", driver, "NM", "Bernalillo");
                    driver.FindElement(By.Id("ctl03_TemplateBody_ctl00_PageLayout_ctl00_Placeholder3_ctl00_pageContent_ctl00_PlaceHolder2_ctl00_searchByParcel")).Click();
                    Thread.Sleep(3000);
                    driver.FindElement(By.Id("ctl03_TemplateBody_ctl00_PageLayout_ctl00_Placeholder3_ctl00_pageContent_ctl00_Placeholder5_ctl00_ctl00_parcelId")).SendKeys(outparcelno);
                    gc.CreatePdf(orderNumber, outparcelno, "Parcel Click Result", driver, "NM", "Bernalillo");
                    driver.FindElement(By.Id("ctl03_TemplateBody_ctl00_PageLayout_ctl00_Placeholder3_ctl00_pageContent_ctl00_Placeholder5_ctl00_ctl00_submit")).Click();
                    Thread.Sleep(2000);
                    //IWebElement ParcelLinkSearch = driver.FindElement(By.XPath("//*[@id='ctl03_TemplateBody_ctl00_PageLayout_ctl00_Placeholder3_ctl00_pageContent_ctl00_Placeholder5_ctl00_placeHolder_ctl00_resultList_ctl00_ctl04_parcel']"));
                    //js1.ExecuteScript("arguments[0].click();", ParcelLinkSearch);
                    //Thread.Sleep(7000);
                    //gc.CreatePdf(orderNumber, outparcelno, "Parcel Search", driver, "NM", "Bernalillo");

                    ////Current OwnerShip Data
                    //IWebElement IOwnerSubmit = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div/table/tbody"));
                    //js1.ExecuteScript("arguments[0].click();", IOwnerSubmit);
                    //gc.CreatePdf(orderNumber, outparcelno, "Current OwnerShip Search", driver, "NM", "Bernalillo");
                    //Thread.Sleep(7000);
                    //outparcelno = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div/table/tbody/tr[2]/td/table/tbody/tr[1]/td")).Text;
                    IWebElement ButtonLinkSearch = driver.FindElement(By.Id("ctl03_TemplateBody_ctl00_PageLayout_ctl00_Placeholder3_ctl00_pageContent_ctl00_Placeholder5_ctl00_placeHolder_ctl00_resultList_ctl00_ctl04_parcel"));
                    js1.ExecuteScript("arguments[0].click();", ButtonLinkSearch);
                    Thread.Sleep(9000);
                    string Ownershiptable = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div/table/tbody/tr[2]/td/table/tbody")).Text;
                    if (Ownershiptable.Contains("OWNER 2:"))
                    {
                        Owner1 = driver.FindElement(By.Id("ctl03_TemplateBody_ctl00_PageLayout_ctl00_Placeholder3_ctl00_pageContent_ctl00_Placeholder5_ctl00_placeHolder_ctl00_owner2Row")).Text.Replace("OWNER 2:", "");
                    }
                    else
                    {
                        Owner1 = driver.FindElement(By.Id("ctl03_TemplateBody_ctl00_PageLayout_ctl00_Placeholder3_ctl00_pageContent_ctl00_Placeholder5_ctl00_placeHolder_ctl00_owner1Row")).Text.Replace("OWNER 1:", "");
                    }
                    Location_Address = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div/table/tbody/tr[3]/td/table/tbody/tr/td")).Text;
                    LegalDescription = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div/table/tbody/tr[4]/td/ul/li")).Text;

                    //Notice Of Values
                    IWebElement IValue = driver.FindElement(By.Id("ctl03_TemplateBody_ctl00_PageLayout_ctl00_Placeholder3_ctl00_pageContent_ctl00_PlaceHolder2_ctl00_noticeOfValues"));
                    //js1.ExecuteScript("arguments[0].click();", IValue);
                    IValue.Click();
                    Thread.Sleep(7000);
                    gc.CreatePdf(orderNumber, outparcelno, "Notice of Values Search", driver, "NM", "Bernalillo");

                    //Screenshot

                    //Tax Bill Download
                    IWebElement ITaxbill = driver.FindElement(By.Id("ctl03_TemplateBody_ctl00_PageLayout_ctl00_Placeholder3_ctl00_pageContent_ctl00_PlaceHolder2_ctl00_taxBill"));
                    //js1.ExecuteScript("arguments[0].click();", ITaxbill);
                    ITaxbill.Click();
                    Thread.Sleep(7000);
                    gc.CreatePdf(orderNumber, outparcelno, "Tax Bill Search", driver, "NM", "Bernalillo");
                    //Screenshot
                    try
                    {
                        //Take tax bills amount and store into table
                        IWebElement         tbTaxbill = driver.FindElement(By.XPath("//*[@id='ctl03_TemplateBody_ctl00_PageLayout_ctl00_Placeholder3_ctl00_pageContent_ctl00_Placeholder5_ctl00_placeHolder_ctl00_panel']/div/table[1]/tbody/tr/td[2]/table/tbody"));
                        IList <IWebElement> trTaxbill = tbTaxbill.FindElements(By.TagName("tr"));
                        IList <IWebElement> tdTaxbill;
                        foreach (IWebElement row in trTaxbill)
                        {
                            tdTaxbill = row.FindElements(By.TagName("td"));
                            if (tdTaxbill.Count != 0 && tdTaxbill[0].Text != " ")
                            {
                                Agencies        = GlobalClass.After(tdTaxbill[0].Text, ":");
                                TaxRate         = GlobalClass.After(tdTaxbill[1].Text, ":");
                                NetTaxableValue = GlobalClass.After(tdTaxbill[2].Text, ":");
                                AmountDue       = GlobalClass.After(tdTaxbill[3].Text, ":");

                                if (Agencies == "")
                                {
                                    Agencies        = tdTaxbill[0].Text;
                                    TaxRate         = tdTaxbill[1].Text;
                                    NetTaxableValue = tdTaxbill[2].Text;
                                    AmountDue       = tdTaxbill[3].Text;
                                }


                                strRowData = Agencies + "~" + TaxRate + "~" + NetTaxableValue + "~" + AmountDue;
                                gc.insert_date(orderNumber, outparcelno, 115, strRowData, 1, DateTime.Now);
                            }
                        }
                    }
                    catch
                    { }
                    //OtherTaxDue
                    try
                    {
                        IWebElement         Tbtx = driver.FindElement(By.XPath("//*[@id='ctl03_TemplateBody_ctl00_PageLayout_ctl00_Placeholder3_ctl00_pageContent_ctl00_Placeholder5_ctl00_placeHolder_ctl00_panel']/div/table[2]/tbody"));
                        IList <IWebElement> TRtx = Tbtx.FindElements(By.TagName("tr"));
                        IList <IWebElement> TDtx;

                        foreach (IWebElement row5 in TRtx)
                        {
                            if (!row5.Text.Contains("YEAR"))
                            {
                                TDtx                 = row5.FindElements(By.TagName("td"));
                                OtherTaxDueYear      = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div/div/div/div/table[2]/tbody/tr[2]/td[1]")).Text;
                                OtherTaxDueTax       = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div/div/div/div/table[2]/tbody/tr[2]/td[2]")).Text;
                                OtherTaxDueInterest  = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div/div/div/div/table[2]/tbody/tr[2]/td[3]")).Text;
                                OtherTaxDuePanalty   = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div/div/div/div/table[2]/tbody/tr[2]/td[4]")).Text;
                                OtherTaxDueFees      = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div/div/div/div/table[2]/tbody/tr[2]/td[5]")).Text;
                                OtherTaxDueAmountDue = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div/div/div/div/table[2]/tbody/tr[2]/td[6]")).Text;
                                string thertax = OtherTaxDueYear + "~" + OtherTaxDueTax + "~" + OtherTaxDueInterest + "~" + OtherTaxDuePanalty + "~" + OtherTaxDueFees + "~" + OtherTaxDueAmountDue;
                                gc.insert_date(orderNumber, outparcelno, 118, thertax, 1, DateTime.Now);
                            }
                        }
                    }
                    catch { }

                    //Tax And Payment History
                    IWebElement ITaxpay = driver.FindElement(By.Id("ctl03_TemplateBody_ctl00_PageLayout_ctl00_Placeholder3_ctl00_pageContent_ctl00_PlaceHolder2_ctl00_taxPaymentHistory"));
                    //js1.ExecuteScript("arguments[0].click();", ITaxpay);
                    ITaxpay.Click();
                    Thread.Sleep(9000);
                    gc.CreatePdf(orderNumber, outparcelno, "Parcel Search", driver, "NM", "Bernalillo");

                    IWebElement         Tableinstallment = driver.FindElement(By.XPath("//*[@id='ctl03_TemplateBody_ctl00_PageLayout_ctl00_Placeholder3_ctl00_pageContent_ctl00_Placeholder5_ctl00_placeHolder_ctl00_historyList_ctl00']/tbody"));
                    IList <IWebElement> TRinstallment    = Tableinstallment.FindElements(By.TagName("tr"));
                    IList <IWebElement> TDinstallment;

                    try
                    {
                        foreach (IWebElement row in TRinstallment)
                        {
                            if (!row.Text.Contains("Summary of Taxes Due"))
                            {
                                TDinstallment = row.FindElements(By.TagName("td"));
                                if (TDinstallment.Count != 0)
                                {
                                    try
                                    {
                                        taxYear    = GlobalClass.After(TDinstallment[0].Text, "\r\n");
                                        netTaxable = GlobalClass.After(TDinstallment[1].Text, "\r\n");
                                        tax        = GlobalClass.After(TDinstallment[2].Text, "\r\n");
                                        Interest   = GlobalClass.After(TDinstallment[3].Text, "\r\n");
                                        Penalty    = GlobalClass.After(TDinstallment[4].Text, "\r\n");
                                        Fees       = GlobalClass.After(TDinstallment[5].Text, "\r\n");
                                        Paid       = GlobalClass.After(TDinstallment[6].Text, "\r\n");
                                        AmountDue  = GlobalClass.After(TDinstallment[7].Text, "\r\n");
                                        if (taxYear == "" && netTaxable == "")
                                        {
                                            taxYear    = TDinstallment[0].Text;
                                            netTaxable = TDinstallment[1].Text;
                                            tax        = TDinstallment[2].Text;
                                            Interest   = TDinstallment[3].Text;
                                            Penalty    = TDinstallment[4].Text;
                                            Fees       = TDinstallment[5].Text;
                                            Paid       = TDinstallment[6].Text;
                                            AmountDue  = TDinstallment[7].Text;
                                        }

                                        if (taxYear == "")
                                        {
                                            FirstHalftax       = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div[1]/div/div[1]/table/tbody/tr[12]/td[3]")).Text;
                                            FirstHalfInterest  = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div[1]/div/div[1]/table/tbody/tr[12]/td[4]")).Text;
                                            FirstHalfPenalty   = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div[1]/div/div[1]/table/tbody/tr[12]/td[5]")).Text;
                                            FirstHalfFees      = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div[1]/div/div[1]/table/tbody/tr[12]/td[6]")).Text;
                                            FirstHalfPaid      = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div[1]/div/div[1]/table/tbody/tr[12]/td[7]")).Text;
                                            FirstHalfAmountDue = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div[1]/div/div[1]/table/tbody/tr[12]/td[8]")).Text;

                                            SecondHalftax       = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div[1]/div/div[1]/table/tbody/tr[13]/td[3]")).Text;
                                            SecondHalfInterest  = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div[1]/div/div[1]/table/tbody/tr[13]/td[4]")).Text;
                                            SecondHalfPenalty   = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div[1]/div/div[1]/table/tbody/tr[13]/td[5]")).Text;
                                            SecondHalfFees      = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div[1]/div/div[1]/table/tbody/tr[13]/td[6]")).Text;
                                            SecondHalfPaid      = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div[1]/div/div[1]/table/tbody/tr[13]/td[7]")).Text;
                                            SecondHalfAmountDue = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div[1]/div/div[1]/table/tbody/tr[13]/td[8]")).Text;

                                            TotalHalftax       = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div[1]/div/div[1]/table/tbody/tr[14]/td[3]")).Text;
                                            TotalHalfInterest  = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div[1]/div/div[1]/table/tbody/tr[14]/td[4]")).Text;
                                            TotalHalfPenalty   = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div[1]/div/div[1]/table/tbody/tr[14]/td[5]")).Text;
                                            TotalHalfFees      = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div[1]/div/div[1]/table/tbody/tr[14]/td[6]")).Text;
                                            TotalHalfPaid      = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div[1]/div/div[1]/table/tbody/tr[14]/td[7]")).Text;
                                            TotalHalfAmountDue = driver.FindElement(By.XPath("/html/body/form/div[6]/div[5]/div[1]/div[1]/div[3]/div[2]/div[1]/div/div[1]/table/tbody/tr[14]/td[8]")).Text;
                                        }
                                        if (taxYear == "" && netTaxable == "")
                                        {
                                            string taxinf = Owner1 + "~" + Location_Address + "~" + LegalDescription + "~" + "2017" + "~" + netTaxable + "~" + tax + "~" + Interest + "~" + Penalty + "~" + Fees + "~" + Paid + "~" + AmountDue + "~" + FirstHalftax + "~" + FirstHalfInterest + "~" + FirstHalfPenalty + "~" + FirstHalfFees + "~" + FirstHalfPaid + "~" + FirstHalfAmountDue + "~" + SecondHalftax + "~" + SecondHalfInterest + "~" + SecondHalfPenalty + "~" + SecondHalfFees + "~" + SecondHalfPaid + "~" + SecondHalfAmountDue + "~" + TotalHalftax + "~" + TotalHalfInterest + "~" + TotalHalfPenalty + "~" + TotalHalfFees + "~" + TotalHalfPaid + "~" + TotalHalfAmountDue + "~" + Tax_Authority + "~";
                                            gc.insert_date(orderNumber, outparcelno, 114, taxinf, 1, DateTime.Now);
                                        }
                                        else
                                        {
                                            string taxinf = Owner1 + "~" + Location_Address + "~" + LegalDescription + "~" + taxYear + "~" + netTaxable + "~" + tax + "~" + Interest + "~" + Penalty + "~" + Fees + "~" + Paid + "~" + AmountDue + "~" + FirstHalftax + "~" + FirstHalfInterest + "~" + FirstHalfPenalty + "~" + FirstHalfFees + "~" + FirstHalfPaid + "~" + FirstHalfAmountDue + "~" + SecondHalftax + "~" + SecondHalfInterest + "~" + SecondHalfPenalty + "~" + SecondHalfFees + "~" + SecondHalfPaid + "~" + SecondHalfAmountDue + "~" + TotalHalftax + "~" + TotalHalfInterest + "~" + TotalHalfPenalty + "~" + TotalHalfFees + "~" + TotalHalfPaid + "~" + TotalHalfAmountDue + "~" + Tax_Authority + "~";
                                            gc.insert_date(orderNumber, outparcelno, 114, taxinf, 1, DateTime.Now);
                                        }
                                    }
                                    catch { }
                                }
                            }
                        }
                    }
                    catch { }

                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "NM", "Bernalillo", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderNumber, "NM", "Bernalillo");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw ex;
                }
            }
        }
Example #5
0
        public string FTP_FLMarion(string address, string assessment_id, string parcelNumber, string searchType, string orderNumber, string directParcel, string ownername)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            List <string> mcheck = new List <string>();

            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";

            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())
            {
                //driver = new ChromeDriver();

                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");

                    if (searchType == "titleflex")
                    {
                        titleaddress = address;
                        titleOwner   = ownername;
                        gc.TitleFlexSearch(orderNumber, "", ownername, titleaddress, "FL", "Marion");

                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_FLMarion"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "address")
                    {
                        driver.Navigate().GoToUrl("http://www.pa.marion.fl.us/PropertySearch.aspx");
                        Thread.Sleep(2000);

                        driver.FindElement(By.Id("MCPAMaster_MCPAContent_rblSearchBy_0")).Click();
                        Thread.Sleep(2000);

                        driver.FindElement(By.Id("MCPAMaster_MCPAContent_txtParm")).SendKeys(address);

                        driver.FindElement(By.Id("MCPAMaster_MCPAContent_btnWine")).SendKeys(Keys.Enter);
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "FL", "Marion");
                        Thread.Sleep(2000);

                        try
                        {
                            IWebElement         MultiAddressTB = driver.FindElement(By.XPath("//*[@id='srch']/table[1]/tbody"));
                            IList <IWebElement> MultiAddressTR = MultiAddressTB.FindElements(By.TagName("tr"));
                            IList <IWebElement> MultiAddressTD;
                            gc.CreatePdf_WOP(orderNumber, "Multi Address search", driver, "FL", "Marion");

                            if (MultiAddressTR.Count == 1)
                            {
                                driver.FindElement(By.XPath("//*[@id='srch']/table[1]/tbody/tr/td[1]/a")).Click();
                                Thread.Sleep(4000);
                            }

                            else
                            {
                                int    AddressmaxCheck = 0;
                                string xpath           = "";
                                int    m = 1;
                                foreach (IWebElement MultiAddress in MultiAddressTR)
                                {
                                    if (AddressmaxCheck <= 25)
                                    {
                                        MultiAddressTD = MultiAddress.FindElements(By.TagName("td"));
                                        if (MultiAddressTD.Count != 0 && MultiAddress.Text.Contains(address.ToUpper()))
                                        {
                                            IWebElement Parcelno1 = MultiAddressTD[0].FindElement(By.TagName("a"));
                                            Parcelno         = Parcelno1.Text;
                                            Owner            = MultiAddressTD[1].Text;
                                            Property_Address = MultiAddressTD[2].Text;

                                            MultiAddress_details = Owner + "~" + Property_Address;
                                            gc.insert_date(orderNumber, Parcelno, 672, MultiAddress_details, 1, DateTime.Now);

                                            xpath = "//*[@id='srch']/table[1]/tbody/tr[" + m + "]/td[1]/a";
                                            mcheck.Add(MultiAddressTD[0].Text.Trim());
                                        }
                                        m++;
                                    }
                                    AddressmaxCheck++;
                                }
                                if (mcheck.Count == 1)
                                {
                                    driver.FindElement(By.XPath(xpath)).Click();
                                    Thread.Sleep(4000);
                                }
                                else
                                {
                                    if (MultiAddressTR.Count > 25)
                                    {
                                        HttpContext.Current.Session["multiParcel_FLMarion_Multicount"] = "Maximum";
                                        driver.Quit();
                                        return("Maximum");
                                    }
                                    else
                                    {
                                        HttpContext.Current.Session["multiparcel_FLMarion"] = "Yes";
                                        driver.Quit();
                                        return("MultiParcel");
                                    }
                                }
                            }
                        }
                        catch
                        { }
                        try
                        {
                            //No Data Found
                            string nodata = driver.FindElement(By.Id("srch")).Text;
                            if (nodata.Contains("0 records found. End of search reached."))
                            {
                                HttpContext.Current.Session["Nodata_FLMarion"] = "Yes";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                    }

                    if (searchType == "parcel")
                    {
                        driver.Navigate().GoToUrl("http://www.pa.marion.fl.us/PropertySearch.aspx");
                        Thread.Sleep(2000);

                        driver.FindElement(By.Id("MCPAMaster_MCPAContent_rblSearchBy_2")).Click();
                        Thread.Sleep(2000);

                        driver.FindElement(By.Id("MCPAMaster_MCPAContent_txtParm")).SendKeys(parcelNumber);

                        driver.FindElement(By.Id("MCPAMaster_MCPAContent_btnWine")).SendKeys(Keys.Enter);
                        gc.CreatePdf(orderNumber, parcelNumber, "ParcelSearch", driver, "FL", "Marion");
                        Thread.Sleep(2000);

                        driver.FindElement(By.XPath("//*[@id='srch']/table[1]/tbody/tr/td[1]/a")).Click();
                        Thread.Sleep(2000);
                        try
                        {
                            //No Data Found
                            string nodata = driver.FindElement(By.Id("srch'")).Text;
                            if (nodata.Contains("0 records found. End of search reached."))
                            {
                                HttpContext.Current.Session["Nodata_FLMarion"] = "Yes";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                    }

                    if (searchType == "ownername")
                    {
                        var chromeOptions = new ChromeOptions();
                        var chDriver      = new ChromeDriver(chromeOptions);

                        chDriver.Navigate().GoToUrl("http://www.pa.marion.fl.us/PropertySearch.aspx");
                        Thread.Sleep(2000);

                        chDriver.FindElement(By.Id("MCPAMaster_MCPAContent_rblSearchBy_1")).Click();
                        Thread.Sleep(2000);

                        chDriver.FindElement(By.Id("MCPAMaster_MCPAContent_txtParm")).SendKeys(ownername);

                        chDriver.FindElement(By.Id("MCPAMaster_MCPAContent_btnWine")).SendKeys(Keys.Enter);
                        gc.CreatePdf_WOP(orderNumber, "Owner search", chDriver, "FL", "Marion");
                        Thread.Sleep(2000);

                        try
                        {
                            IWebElement         MultiOwnerTB = chDriver.FindElement(By.XPath("//*[@id='srch']/table[1]/tbody"));
                            IList <IWebElement> MultiOwnerTR = MultiOwnerTB.FindElements(By.TagName("tr"));
                            IList <IWebElement> MultiOwnerTD;
                            gc.CreatePdf_WOP(orderNumber, "Multi Owner search", chDriver, "FL", "Marion");

                            if (MultiOwnerTR.Count == 1)
                            {
                                chDriver.FindElement(By.XPath("//*[@id='srch']/table[1]/tbody/tr/td[1]/a")).Click();
                                Thread.Sleep(2000);
                            }

                            else
                            {
                                int OwnermaxCheck = 0;
                                foreach (IWebElement MultiOwner in MultiOwnerTR)
                                {
                                    if (OwnermaxCheck <= 25)
                                    {
                                        MultiOwnerTD = MultiOwner.FindElements(By.TagName("td"));
                                        if (MultiOwnerTD.Count != 0)
                                        {
                                            IWebElement Parcelno1 = MultiOwnerTD[0].FindElement(By.TagName("a"));
                                            Parcelno         = Parcelno1.Text;
                                            Owner            = MultiOwnerTD[1].Text;
                                            Property_Address = MultiOwnerTD[2].Text;

                                            MultiOwner_details = Owner + "~" + Property_Address;
                                            gc.insert_date(orderNumber, Parcelno, 672, MultiOwner_details, 1, DateTime.Now);
                                        }
                                        OwnermaxCheck++;
                                    }
                                }
                                if (MultiOwnerTR.Count > 25)
                                {
                                    HttpContext.Current.Session["multiParcel_FLMarion_Multicount"] = "Maximum";
                                }
                                else
                                {
                                    HttpContext.Current.Session["multiparcel_FLMarion"] = "Yes";
                                }
                                chDriver.Quit();

                                return("MultiParcel");
                            }
                        }
                        catch
                        { }

                        try
                        {
                            //No Data Found
                            string nodata = driver.FindElement(By.XPath("//*[@id='srch']/text()")).Text;
                            if (nodata.Contains("0 records found. End of search reached."))
                            {
                                HttpContext.Current.Session["Nodata_FLMarion"] = "Yes";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                        chDriver.Quit();
                    }

                    Thread.Sleep(3000);
                    driver.SwitchTo().Window(driver.WindowHandles.Last());
                    Thread.Sleep(4000);

                    //Property Details
                    //try
                    //{
                    //    driver.FindElement(By.XPath("//*[@id='prc']/div/a[1]")).Click();
                    //    Thread.Sleep(6000);
                    //}
                    //catch
                    //{ }


                    try
                    {
                        ParcelID      = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/h1")).Text;
                        Primary_Key   = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[1]/tbody/tr/td[1]")).Text;
                        Primary_Key   = WebDriverTest.After(Primary_Key, "Prime Key: ");
                        Owner_Mailing = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[2]/tbody/tr/td[1]")).Text;

                        try
                        {
                            driver.FindElement(By.XPath("//*[@id='prc']/div/a[2]")).Click();
                            Thread.Sleep(2000);
                            full           = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[2]/tbody/tr/td[2]")).Text;
                            Taxes_Assments = gc.Between(full, "Taxes / Assessments:", "Map ID:");
                            try
                            {
                                assess1  = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[3]/tbody/tr/td[1]")).Text.Replace("\r\n", "~");
                                assess11 = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[3]/tbody/tr/td[2]")).Text.Replace("\r\n", "~");

                                DBconnection dbconn = new DBconnection();
                                dbconn.ExecuteQuery("update data_field_master set Data_Fields_Text='" + assess1 + "' where Id = '" + 692 + "'");
                                gc.CreatePdf(orderNumber, ParcelID, "Assessment1 Details", driver, "FL", "Marion");
                                gc.insert_date(orderNumber, ParcelID, 692, assess11, 1, DateTime.Now);
                            }
                            catch
                            { }

                            //History Accessd Values
                            try
                            {
                                IWebElement         HistoryTB = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[4]/tbody"));
                                IList <IWebElement> HistoryTR = HistoryTB.FindElements(By.TagName("tr"));
                                IList <IWebElement> HistoryTD;

                                foreach (IWebElement History in HistoryTR)
                                {
                                    HistoryTD = History.FindElements(By.TagName("td"));
                                    if (HistoryTD.Count != 0 && HistoryTR.Count != 1)
                                    {
                                        Year        = HistoryTD[0].Text;
                                        Land_Just   = HistoryTD[1].Text;
                                        Building    = HistoryTD[2].Text;
                                        Misc_Value  = HistoryTD[3].Text;
                                        Mkt_Just    = HistoryTD[4].Text;
                                        Assed_Value = HistoryTD[5].Text;
                                        Exceptions  = HistoryTD[6].Text;
                                        Taxabl_Val  = HistoryTD[7].Text;

                                        History_details = Year + "~" + Land_Just + "~" + Building + "~" + Misc_Value + "~" + Mkt_Just + "~" + Assed_Value + "~" + Exceptions + "~" + Taxabl_Val;
                                        gc.insert_date(orderNumber, ParcelID, 693, History_details, 1, DateTime.Now);
                                    }
                                }
                            }
                            catch
                            { }
                            driver.Navigate().Back();
                            Thread.Sleep(5000);
                        }
                        catch
                        { }
                        Map_Id  = gc.Between(full, "Map ID:", "Millage:");
                        Millage = GlobalClass.After(full, "Millage:");
                        full1   = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[2]/tbody/tr/td[3]")).Text;
                        try
                        {
                            Acres = gc.Between(full1, "Acres: ", "Situs: ").Replace("More Situs", "");
                            Situs = WebDriverTest.After(full1, "Situs: ");
                        }
                        catch { }

                        Proty_Desp = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td")).Text;
                        Proty_Desp = gc.Between(Proty_Desp, "Property Description", "Land Data - Warning: Verify Zoning");
                        try
                        {
                            Improve1 = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[6]/tbody/tr/td[1]/table/tbody/tr/td[2]")).Text.Replace("\r\n", "~");

                            string[] rowarrayname1 = Improve1.Split('~');

                            Improve    = rowarrayname1[0];
                            Year_Built = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[6]/tbody/tr/td[2]")).Text;
                            Year_Built = gc.Between(Year_Built, "Year Built", "Physical Deterioration");
                        }
                        catch
                        { }

                        property = Primary_Key + "~" + Owner_Mailing + "~" + Situs + "~" + Taxes_Assments + "~" + Map_Id + "~" + Millage + "~" + Acres + "~" + Proty_Desp + "~" + Improve + "~" + Year_Built;
                        gc.CreatePdf(orderNumber, ParcelID, "Assessment11 Details", driver, "FL", "Marion");
                        gc.insert_date(orderNumber, ParcelID, 691, property, 1, DateTime.Now);
                    }
                    catch
                    { }

                    //try
                    //{
                    //    assess = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[3]/tbody/tr/td[1]")).Text.Replace("\r\n", "~");
                    //    assess1 = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[3]/tbody/tr/td[2]")).Text.Replace("\r\n", "~");

                    //    DBconnection dbconn = new DBconnection();
                    //    dbconn.ExecuteQuery("update data_field_master set Data_Fields_Text='" + assess + "' where Id = '" + 692 + "'");
                    //    gc.insert_date(orderNumber, ParcelID, 692, assess1, 1, DateTime.Now);
                    //}
                    //catch
                    //{ }

                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    //Tax Details
                    driver.Navigate().GoToUrl("https://www.mariontax.com/itm/PropertySearchAccount.aspx");
                    Thread.Sleep(4000);

                    driver.FindElement(By.Id("btnAgree")).Click();
                    Thread.Sleep(4000);

                    driver.FindElement(By.Id("_ctl0_ContentPlaceHolder1_txtAccount")).SendKeys(ParcelID);

                    gc.CreatePdf(orderNumber, ParcelID, "Tax Details", driver, "FL", "Marion");

                    driver.FindElement(By.Id("_ctl0_ContentPlaceHolder1_btnSearch")).SendKeys(Keys.Enter);
                    Thread.Sleep(4000);

                    gc.CreatePdf(orderNumber, ParcelID, "Tax Parcels Details", driver, "FL", "Marion");

                    driver.FindElement(By.Id("_ctl0_ContentPlaceHolder1_rptSummary__ctl0_lnkDetails1")).Click();
                    Thread.Sleep(4000);


                    //Tax Payment History
                    try
                    {
                        IWebElement         BreakdownTB = driver.FindElement(By.XPath("//*[@id='_ctl0_ContentPlaceHolder1_tblSummary']/tbody"));
                        IList <IWebElement> BreakdownTR = BreakdownTB.FindElements(By.TagName("tr"));
                        IList <IWebElement> BreakdownTD;

                        foreach (IWebElement Breakdown in BreakdownTR)
                        {
                            BreakdownTD = Breakdown.FindElements(By.TagName("td"));
                            if (BreakdownTD.Count != 0 && !Breakdown.Text.Contains("Year"))
                            {
                                Tax_Year    = BreakdownTD[0].Text;
                                Roll        = BreakdownTD[1].Text;
                                Acc_Num     = BreakdownTD[2].Text;
                                Sta         = BreakdownTD[3].Text;
                                Date_Paid   = BreakdownTD[4].Text;
                                Amount_Paid = BreakdownTD[5].Text;
                                Balnc_Due   = BreakdownTD[6].Text;

                                Payment_details = Tax_Year + "~" + Roll + "~" + Acc_Num + "~" + Sta + "~" + Date_Paid + "~" + Amount_Paid + "~" + Balnc_Due;
                                gc.insert_date(orderNumber, ParcelID, 695, Payment_details, 1, DateTime.Now);
                            }
                        }
                    }
                    catch
                    { }

                    //Tax Information
                    Acc_No = driver.FindElement(By.XPath("//*[@id='tbl1']/tbody/tr[2]/td[2]")).Text.Replace("               ", "");
                    Typ    = driver.FindElement(By.XPath("//*[@id='tbl1']/tbody/tr[2]/td[4]/table/tbody/tr/td[1]")).Text;
                    Add    = driver.FindElement(By.XPath("//*[@id='tbl1']/tbody/tr[3]/td[2]")).Text;

                    try
                    {
                        Deliquent = driver.FindElement(By.XPath("//*[@id='tbl3']/tbody/tr[4]/td")).Text;
                    }
                    catch
                    { }

                    try
                    {
                        Roll_Coment = driver.FindElement(By.XPath("//*[@id='_ctl0_ContentPlaceHolder1_tblSummary']/tbody/tr[3]/td[2]")).Text;
                    }
                    catch
                    { }
                    List <string> ParcelSearch = new List <string>();

                    try
                    {
                        IWebElement         ParcelTB = driver.FindElement(By.XPath("//*[@id='_ctl0_ContentPlaceHolder1_tblSummary']/tbody"));
                        IList <IWebElement> ParcelTR = ParcelTB.FindElements(By.TagName("tr"));
                        ParcelTR.Reverse();
                        int rows_count = ParcelTR.Count;

                        for (int row = 0; row < rows_count; row++)
                        {
                            if (row == rows_count - 1 || row == rows_count - 2 || row == rows_count - 3)
                            {
                                IList <IWebElement> Columns_row = ParcelTR[row].FindElements(By.TagName("td"));

                                int columns_count = Columns_row.Count;

                                for (int column = 0; column < columns_count; column++)
                                {
                                    if (column == columns_count - 2)
                                    {
                                        IWebElement ParcelBill_link = Columns_row[0].FindElement(By.TagName("a"));
                                        string      Parcelurl       = ParcelBill_link.GetAttribute("href");
                                        ParcelSearch.Add(Parcelurl);
                                    }
                                }
                            }
                        }
                    }
                    catch
                    { }

                    foreach (string Parcelbill in ParcelSearch)
                    {
                        driver.Navigate().GoToUrl(Parcelbill);
                        Thread.Sleep(3000);

                        Taxy = driver.FindElement(By.XPath("//*[@id='_ctl0_ContentPlaceHolder1_lblDetTaxYear']")).Text;

                        try
                        {
                            Pdes1 = driver.FindElement(By.XPath("//*[@id='Table2a']/tbody/tr[1]/td")).Text;
                            Pdes2 = driver.FindElement(By.XPath("//*[@id='Table2a']/tbody/tr[2]/td")).Text;
                            Pdes3 = driver.FindElement(By.XPath("//*[@id='Table2a']/tbody/tr[3]/td")).Text;
                            Pdes4 = driver.FindElement(By.XPath("//*[@id='Table2a']/tbody/tr[4]/td")).Text;

                            P_des = Pdes1 + " " + Pdes2 + " " + Pdes3 + " " + Pdes4;
                        }
                        catch
                        { }


                        try
                        {
                            OInfo1     = driver.FindElement(By.XPath("//*[@id='Table2b']/tbody/tr[1]/td")).Text;
                            M_Addr1    = driver.FindElement(By.XPath("//*[@id='Table2b']/tbody/tr[2]/td")).Text;
                            M_Addr2    = driver.FindElement(By.XPath("//*[@id='Table2b']/tbody/tr[3]/td")).Text;
                            Owner_Mail = OInfo1 + " & " + M_Addr1 + " " + M_Addr2;
                        }
                        catch
                        { }

                        try
                        {
                            OInfo1     = driver.FindElement(By.XPath("//*[@id='Table2b']/tbody/tr[1]/td")).Text;
                            OInfo2     = driver.FindElement(By.XPath("//*[@id='Table2b']/tbody/tr[2]/td")).Text;
                            M_Addr1    = driver.FindElement(By.XPath("//*[@id='Table2b']/tbody/tr[3]/td")).Text;
                            M_Addr2    = driver.FindElement(By.XPath("//*[@id='Table2b']/tbody/tr[4]/td")).Text;
                            Owner_Mail = OInfo1 + " " + OInfo2 + " & " + M_Addr1 + " " + M_Addr2;
                        }
                        catch
                        { }

                        try
                        {
                            IWebElement         tbmulti11 = driver.FindElement(By.XPath("//*[@id='Table2c']/tbody"));
                            IList <IWebElement> TRmulti11 = tbmulti11.FindElements(By.TagName("tr"));
                            IList <IWebElement> TDmulti11;

                            foreach (IWebElement row in TRmulti11)
                            {
                                TDmulti11 = row.FindElements(By.TagName("td"));
                                if (TDmulti11.Count != 0)
                                {
                                    Mkt = TDmulti11[0].Text;
                                    if (Mkt.Contains("MARKET VALU"))
                                    {
                                        Markt_Value = TDmulti11[0].Text.Replace(" ", "");
                                        Markt_Value = WebDriverTest.After(Markt_Value, "MARKETVALU");
                                    }
                                    Asst = TDmulti11[0].Text;
                                    if (Asst.Contains("ASSESSMENT"))
                                    {
                                        ASSESSMENT = TDmulti11[0].Text.Replace(" ", "");
                                        ASSESSMENT = WebDriverTest.After(ASSESSMENT, "ASSESSMENT");
                                    }
                                    Txb = TDmulti11[0].Text;
                                    if (Txb.Contains("TAXABLE"))
                                    {
                                        TAXABLE = TDmulti11[0].Text.Replace(" ", "");
                                        TAXABLE = WebDriverTest.After(TAXABLE, "TAXABLE");
                                    }
                                    Ext = TDmulti11[0].Text;
                                    if (Ext.Contains("EXCD01"))
                                    {
                                        EXC = TDmulti11[0].Text.Replace(" ", "");
                                        EXC = WebDriverTest.After(EXC, "EXCD01");
                                    }
                                    Ext1 = TDmulti11[0].Text;
                                    if (Ext1.Contains("EXCD38"))
                                    {
                                        EXC1 = TDmulti11[0].Text.Replace(" ", "");
                                        EXC1 = WebDriverTest.After(EXC1, "EXCD38");
                                    }
                                    Ext2 = TDmulti11[0].Text;
                                    if (Ext2.Contains("EXCD02"))
                                    {
                                        EXC2 = TDmulti11[0].Text.Replace(" ", "");
                                        EXC2 = WebDriverTest.After(EXC2, "EXCD02");
                                    }
                                    Count_Asst = TDmulti11[0].Text;
                                    if (Count_Asst.Contains("COUNTY ASMT"))
                                    {
                                        County_ASMT = TDmulti11[0].Text.Replace(" ", "");
                                        County_ASMT = WebDriverTest.After(County_ASMT, "COUNTYASMT");
                                    }
                                    Count_txbl = TDmulti11[0].Text;
                                    if (Count_txbl.Contains("COUNTY TXBL"))
                                    {
                                        County_TXBL = TDmulti11[0].Text.Replace(" ", "");
                                        County_TXBL = WebDriverTest.After(County_TXBL, "COUNTYTXBL");
                                    }
                                    Tax_Asst = TDmulti11[0].Text;
                                    if (Tax_Asst.Contains("SCHOOL ASMT"))
                                    {
                                        Tax_ASMT = TDmulti11[0].Text.Replace(" ", "");
                                        Tax_ASMT = WebDriverTest.After(Tax_ASMT, "SCHOOLASMT");
                                    }
                                    Tax_txbl = TDmulti11[0].Text;
                                    if (Tax_txbl.Contains("SCHOOL TXBL"))
                                    {
                                        Tax_TXBL = TDmulti11[0].Text.Replace(" ", "");
                                        Tax_TXBL = WebDriverTest.After(Tax_TXBL, "SCHOOLTXBL");
                                    }
                                }
                            }

                            IWebElement         tbmulti1 = driver.FindElement(By.XPath("//*[@id='Table2d']/tbody"));
                            IList <IWebElement> TRmulti1 = tbmulti1.FindElements(By.TagName("tr"));
                            IList <IWebElement> TDmulti1;

                            foreach (IWebElement row in TRmulti1)
                            {
                                TDmulti1 = row.FindElements(By.TagName("td"));
                                if (TDmulti1.Count != 0)
                                {
                                    txes = TDmulti1[0].Text;
                                    if (txes.Contains("TAXES"))
                                    {
                                        TAXES = TDmulti1[0].Text.Replace(" ", "");
                                        TAXES = WebDriverTest.After(TAXES, "TAXES");
                                    }

                                    sptxs = TDmulti1[0].Text;
                                    if (sptxs.Contains("SP. ASMT"))
                                    {
                                        SP_ASMT = TDmulti1[0].Text.Replace(" ", "");
                                        SP_ASMT = WebDriverTest.After(SP_ASMT, "SP.ASMT");
                                    }

                                    intt = TDmulti1[0].Text;
                                    if (intt.Contains("INT."))
                                    {
                                        INT = TDmulti1[0].Text.Replace(" ", "");
                                        INT = WebDriverTest.After(INT, "INT.");
                                    }

                                    Salet = TDmulti1[0].Text;
                                    if (Salet.Contains("SALE 5%"))
                                    {
                                        SALE = TDmulti1[0].Text.Replace(" ", "");
                                        SALE = WebDriverTest.After(SALE, "SALE5%");
                                    }

                                    Advt = TDmulti1[0].Text;
                                    if (Advt.Contains("ADV. FEE"))
                                    {
                                        ADV = TDmulti1[0].Text.Replace(" ", "");
                                        ADV = WebDriverTest.After(ADV, "ADV.FEE");
                                    }
                                }
                            }

                            Tax_Info = Acc_No + "~" + Typ + "~" + Add + "~" + Taxy + "~" + P_des + "~" + Owner_Mail + "~" + Markt_Value + "~" + ASSESSMENT + "~" + TAXABLE + "~" + EXC + "~" + EXC1 + "~" + EXC2 + "~" + TAXES + "~" + SP_ASMT + "~" + INT + "~" + SALE + "~" + ADV + "~" + County_ASMT + "~" + County_TXBL + "~" + Tax_ASMT + "~" + Tax_TXBL;
                            gc.insert_date(orderNumber, ParcelID, 697, Tax_Info, 1, DateTime.Now);
                            Markt_Value = ""; ASSESSMENT = ""; TAXABLE = ""; EXC = ""; EXC1 = ""; EXC2 = ""; TAXES = ""; SP_ASMT = ""; INT = ""; SALE = ""; ADV = ""; County_ASMT = ""; County_TXBL = ""; Tax_ASMT = ""; Tax_TXBL = "";
                        }
                        catch
                        { }
                        gc.CreatePdf(orderNumber, ParcelID, "Tax Payment Details" + Taxy, driver, "FL", "Marion");
                        Thread.Sleep(2000);

                        //Tax Receipt
                        try
                        {
                            Receipt = driver.FindElement(By.XPath("//*[@id='tbl5']/tbody/tr[4]/td")).Text.Replace(" ", "");

                            Commonreceipt = Receipt;

                            if (Commonreceipt.Length == 58)
                            {
                                A = Receipt.Substring(0, 10);
                                B = Receipt.Substring(10, 19);
                                C = Receipt.Substring(29, 9);
                                D = Receipt.Substring(38, 7);
                                E = Receipt.Substring(45, 4);
                                F = Receipt.Substring(49, 9);

                                Receipt_Details5 = A + "~" + B + "~" + "~" + C + "~" + D + "~" + E + "~" + F;
                                gc.insert_date(orderNumber, ParcelID, 698, Receipt_Details5, 1, DateTime.Now);
                            }

                            if (Commonreceipt.Length == 42)
                            {
                                A = Receipt.Substring(0, 10);
                                B = Receipt.Substring(10, 19);
                                C = Receipt.Substring(29, 4);
                                D = Receipt.Substring(33, 9);

                                Receipt_Details1 = A + "~" + B + "~" + C + "~" + D + "~" + "" + "~" + "" + "~" + "";
                                gc.insert_date(orderNumber, ParcelID, 698, Receipt_Details1, 1, DateTime.Now);
                            }

                            if (Commonreceipt.Length == 62)
                            {
                                A = Receipt.Substring(0, 10);
                                B = Receipt.Substring(10, 19);
                                C = Receipt.Substring(29, 4);
                                D = Receipt.Substring(33, 9);
                                E = Receipt.Substring(42, 7);
                                F = Receipt.Substring(49, 4);
                                G = Receipt.Substring(53, 9);

                                Receipt_Details2 = A + "~" + B + "~" + C + "~" + D + "~" + E + "~" + F + "~" + G;
                                gc.insert_date(orderNumber, ParcelID, 698, Receipt_Details2, 1, DateTime.Now);
                            }

                            if (Commonreceipt.Length == 61)
                            {
                                A = Receipt.Substring(0, 10);
                                B = Receipt.Substring(10, 19);
                                C = Receipt.Substring(29, 4);
                                D = Receipt.Substring(33, 10);
                                E = Receipt.Substring(43, 6);
                                F = Receipt.Substring(49, 5);
                                G = Receipt.Substring(54, 7);

                                Receipt_Details3 = A + "~" + B + "~" + C + "~" + D + "~" + E + "~" + F + "~" + G;
                                gc.insert_date(orderNumber, ParcelID, 698, Receipt_Details3, 1, DateTime.Now);
                            }

                            if (Commonreceipt.Length == 60)
                            {
                                A = Receipt.Substring(0, 10);
                                B = Receipt.Substring(10, 19);
                                C = Receipt.Substring(29, 4);
                                D = Receipt.Substring(33, 9);
                                E = Receipt.Substring(42, 7);
                                F = Receipt.Substring(49, 4);
                                G = Receipt.Substring(53, 7);

                                Receipt_Details4 = A + "~" + B + "~" + C + "~" + D + "~" + E + "~" + F + "~" + G;
                                gc.insert_date(orderNumber, ParcelID, 698, Receipt_Details4, 1, DateTime.Now);
                            }

                            if (Commonreceipt.Length == 56)
                            {
                                A = Receipt.Substring(0, 10);
                                B = Receipt.Substring(10, 19);
                                C = Receipt.Substring(29, 9);
                                D = Receipt.Substring(38, 7);
                                E = Receipt.Substring(45, 4);
                                F = Receipt.Substring(49, 7);

                                Receipt_Details4 = A + "~" + B + "~" + "" + "~" + C + "~" + D + "~" + E + "~" + F;
                                gc.insert_date(orderNumber, ParcelID, 698, Receipt_Details4, 1, DateTime.Now);
                            }
                            if (Commonreceipt.Length == 64)
                            {
                                A = Receipt.Substring(0, 10);
                                B = Receipt.Substring(10, 19);
                                C = Receipt.Substring(29, 4);
                                D = Receipt.Substring(33, 9);
                                E = Receipt.Substring(42, 8);
                                F = Receipt.Substring(50, 4);
                                G = Receipt.Substring(54, 10);

                                Receipt_Details9 = A + "~" + B + "~" + C + "~" + D + "~" + E + "~" + F + "~" + G;
                                gc.insert_date(orderNumber, ParcelID, 698, Receipt_Details9, 1, DateTime.Now);
                            }
                        }
                        catch
                        { }

                        //driver.Navigate().Back();
                        //Thread.Sleep(2000);
                    }

                    driver.FindElement(By.Id("_ctl0_ContentPlaceHolder1_lnkAcctBill2")).Click();
                    Thread.Sleep(3000);

                    driver.SwitchTo().Window(driver.WindowHandles.Last());
                    Thread.Sleep(4000);

                    //Ad-Valorem & Non-Ad Valorem
                    IWebElement         AdValoremTB = driver.FindElement(By.XPath("//*[@id='Table3']/tbody"));
                    IList <IWebElement> AdValoremTR = AdValoremTB.FindElements(By.TagName("tr"));
                    IList <IWebElement> AdValoremTD;

                    foreach (IWebElement AdValorem in AdValoremTR)
                    {
                        AdValoremTD = AdValorem.FindElements(By.TagName("td"));
                        if (AdValoremTD.Count != 0 && !AdValorem.Text.Contains("TAXING AUTHORITY") && AdValoremTD[0].Text != "" && !AdValorem.Text.Contains("*** PAID *** PAID *** PAID ***") && !AdValorem.Text.Contains("PERIOD"))
                        {
                            //if (AdValorem.Text.Contains("COMBINED TAXES & ASSESSMENTS TOTAL:"))
                            //{
                            //    break;
                            //}
                            string Output = AdValoremTD[0].Text;
                            Output = Regex.Replace(Output, @"\s+", " ").TrimStart();
                            Output = Output.Replace(" ", "~");
                            string[]      rowarrayname1 = Output.Split('~');
                            List <string> listname      = new List <string>();
                            listname.AddRange(rowarrayname1);
                            int    count = listname.Count();
                            string name = "", millege = "", assessed = "", exemptions = "", taxable = "", taxes = "";
                            int    k = 0;
                            if (count == 2 && listname[0].Any(Char.IsDigit))
                            {
                                Advalorem_details1 = "Total Millege" + "~" + listname[0] + "~" + "" + "~" + "" + "~" + "Total Ad Valorem Taxes" + "~" + listname[1];
                                gc.CreatePdf(orderNumber, ParcelID, "Ad-Valorem & Non-Ad Valorem Taxs Details" + Taxy, driver, "FL", "Marion");
                                gc.insert_date(orderNumber, ParcelID, 700, Advalorem_details1, 1, DateTime.Now);
                            }
                            else
                            {
                                for (int i = 0; i < count; i++)
                                {
                                    if (!listname[i].Any(Char.IsDigit))
                                    {
                                        name = name + " " + listname[i];
                                    }
                                    else
                                    {
                                        if (listname[i].Any(Char.IsDigit) && (k == 0))
                                        {
                                            millege = listname[i];
                                        }
                                        if (listname[i].Any(Char.IsDigit) && (k == 1))
                                        {
                                            assessed = listname[i];
                                        }
                                        if (listname[i].Any(Char.IsDigit) && (k == 2))
                                        {
                                            exemptions = listname[i];
                                        }
                                        if (listname[i].Any(Char.IsDigit) && (k == 3))
                                        {
                                            taxable = listname[i];
                                        }
                                        if (listname[i].Any(Char.IsDigit) && (k == 4))
                                        {
                                            taxes = listname[i];
                                        }
                                        k++;
                                    }
                                }
                            }
                            Advalorem_details = name + "~" + millege + "~" + assessed + "~" + exemptions + "~" + taxable + "~" + taxes;
                            gc.CreatePdf(orderNumber, ParcelID, "Ad-Valorem & Non-Ad Valorem Taxs Details" + Taxy, driver, "FL", "Marion");
                            gc.insert_date(orderNumber, ParcelID, 700, Advalorem_details, 1, DateTime.Now);
                        }
                    }

                    //Taxing Authority
                    driver.Navigate().GoToUrl("https://www.mariontax.com/itm.asp");
                    Thread.Sleep(2000);
                    Deliquent_Comments = "";
                    CER_Comments       = "";
                    try
                    {
                        Taxing_Authority = driver.FindElement(By.XPath("//*[@id='ss-block-container-1']/div/address[2]")).Text.Replace("\r\n", " ");
                    }
                    catch { }

                    if (Deliquent == "DELINQUENT TAXES DUE          ")
                    {
                        Deliquent_Comments = "For prior tax amount due, you must call the tax Collector's Office.";
                    }

                    if (Roll_Coment == "CER")
                    {
                        CER_Comments = "Tax Sale in property. Need to contact Tax Collector";
                    }
                    Taxauthority_Details = Taxing_Authority + "~" + Deliquent_Comments + "~" + CER_Comments;
                    gc.CreatePdf(orderNumber, ParcelID, "Tax Authority", driver, "FL", "Marion");
                    gc.insert_date(orderNumber, ParcelID, 704, Taxauthority_Details, 1, DateTime.Now);

                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "FL", "Marion", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderNumber, "FL", "Marion");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw;
                }
            }
        }
Example #6
0
        public void FTP_LA(string address, string parcelNumber, string searchType, string orderNumber, string directParcel, string treasurerCaptcha)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

            if (treasurerCaptcha == "")
            {
                var driverService = PhantomJSDriverService.CreateDefaultService();
                driverService.HideCommandPromptWindow = true;
                driver = new PhantomJSDriver();
                try
                {
                    if (searchType == "address")
                    {
                        if (Assessor_pageLoad())
                        {
                            GlobalClass.multiParcel_la = "Yes";;
                            driver.FindElement(By.Name("basicsearchterm")).SendKeys(address);
                            driver.FindElement(By.XPath("/html/body/div/div[2]/div/form[1]/div/span/button")).Click();
                            Thread.Sleep(3000);

                            //Select address from list....
                            IWebElement         tableElement = driver.FindElement(By.XPath("/html/body/div/div[3]/div/table"));
                            IList <IWebElement> tableRow     = tableElement.FindElements(By.TagName("tr"));
                            IList <IWebElement> rowTD;

                            foreach (IWebElement row in tableRow)
                            {
                                rowTD = row.FindElements(By.TagName("td"));
                                if (rowTD.Count != 0)
                                {
                                    string multi = rowTD[1].Text + "~" + rowTD[2].Text.Replace("'", "");
                                    gc.insert_data(orderNumber, DateTime.Now, rowTD[0].Text.Trim(), 51, multi, 1);
                                    //db.ExecuteQuery("insert into la_multiowner(parcel_no,situs_address,legal_description,order_no) values('" + rowTD[0].Text + "','" + rowTD[1].Text + "','" + rowTD[2].Text.Replace("'", "") + "','" + orderNumber + "') ");
                                }
                            }
                            driver.Quit();
                            return;
                        }
                    }
                    else if (searchType == "parcel")
                    {
                        string parcelUrl = "https://portal.assessor.lacounty.gov/parceldetail/" + parcelNumber;
                        driver.Navigate().GoToUrl(parcelUrl);

                        GlobalClass.parcel_status = driver.FindElement(By.XPath("/html/body/div/div/section[1]/div[2]/div/div/div[1]/div[2]/div[3]/dl/dd[1]")).Text.TrimStart().TrimEnd();

                        if (GlobalClass.parcel_status == "DELETED" || GlobalClass.parcel_status == "INACTIVE" || GlobalClass.parcel_status == "IN ACTIVE")
                        {
                            driver.Quit();
                            return;
                        }

                        GlobalClass.parcelNumber_la = driver.FindElement(By.XPath("/html/body/div/div/section[1]/div[2]/div/div/div[1]/div[1]/h2/div")).Text;
                        GlobalClass.parcelNumber_la = WebDriverTest.Between(GlobalClass.parcelNumber_la, " ", " ");
                        gc.CreatePdf(orderNumber, parcelNumber, "Assessor", driver, "CA", "Los Angeles");

                        //scrap exemption...
                        IWebElement exemption = driver.FindElement(By.XPath("/html/body/div/div/section[1]/div[2]/div/div/div[1]/div[2]/div[3]/dl/dd[6]"));
                        string      exemp_Value = "-", usetype = "-", taxratearea = "-", yearbuilt = "-";
                        exemp_Value = exemption.Text;

                        //if (directParcel == "Yes")
                        //{
                        IWebElement sit_addr          = driver.FindElement(By.XPath("/html/body/div/div/section[2]/div[2]/div/div[2]/div[1]/div[3]/dl/dd"));
                        string      situs_address     = sit_addr.Text;
                        IWebElement legal_desc        = driver.FindElement(By.XPath("/html/body/div/div/section[2]/div[2]/div/div[2]/div[1]/div[4]/dl/dd"));
                        string      legal_description = legal_desc.Text;
                        usetype = driver.FindElement(By.XPath("/html/body/div/div/section[1]/div[2]/div/div/div[1]/div[2]/div[2]/dl/dd[1]")).Text.Trim();
                        if (usetype == "")
                        {
                            usetype = "-";
                        }
                        taxratearea = driver.FindElement(By.XPath("/html/body/div/div/section[1]/div[2]/div/div/div[1]/div[2]/div[2]/dl/dd[3]")).Text.Trim();
                        if (taxratearea == "")
                        {
                            taxratearea = "-";
                        }
                        yearbuilt = driver.FindElement(By.XPath("/html/body/div/div/section[1]/div[2]/div/div/div[1]/div[4]/div[3]/dl/dd[1]")).Text.Trim();
                        if (yearbuilt == "")
                        {
                            yearbuilt = "-";
                        }
                        string property = situs_address + "~" + legal_description + "~" + usetype + "~" + taxratearea + "~" + yearbuilt;
                        gc.insert_data(orderNumber, DateTime.Now, parcelNumber, 50, property, 1);
                        //  db.ExecuteQuery("insert into la_multiowner(parcel_no,situs_address,legal_description,order_no) values('" + parcelNumber + "','" + situs_address + "','" + legal_description + "','" + orderNumber + "') ");

                        //  }
                        //scrap table...
                        IWebElement tblAssess = driver.FindElement(By.XPath("/html/body/div/div/section[1]/div[2]/div/div/div[1]/div[5]/table"));

                        string yr1 = driver.FindElement(By.XPath("/html/body/div/div/section[1]/div[2]/div/div/div[1]/div[5]/table/thead/tr/th[2]")).Text;
                        yr1 = WebDriverTest.Before(yr1, " Roll");
                        string yr2 = driver.FindElement(By.XPath("/html/body/div/div/section[1]/div[2]/div/div/div[1]/div[5]/table/thead/tr/th[3]")).Text;
                        yr2 = WebDriverTest.Before(yr2, " Current");
                        List <string> data1 = getTableData1(tblAssess);
                        string        land = "-", improvement = "-", total = "-";

                        land        = "$" + WebDriverTest.After(data1[1], "$").TrimStart();
                        improvement = "$" + WebDriverTest.After(data1[2], "$").TrimStart();
                        total       = "$" + WebDriverTest.After(data1[3], "$").TrimStart();
                        string ass = yr1 + "~" + land + "~" + improvement + "~" + total + "~" + exemp_Value;
                        gc.insert_data(orderNumber, DateTime.Now, parcelNumber, 52, ass, 1);
                        //db.ExecuteQuery("insert into la_assessor (order_no,parcel_no,year,land,improvements,total,exemption_type) values ('" + orderNumber + "','" + parcelNumber + "','" + yr1 + "','" + land + "','" + improvement + "','" + total + "','" + exemp_Value + "')");

                        List <string> data2 = getTableData(tblAssess);
                        land        = "$" + WebDriverTest.After(data2[1], "$").TrimStart();
                        improvement = "$" + WebDriverTest.After(data2[2], "$").TrimStart();
                        total       = "$" + WebDriverTest.After(data2[3], "$").TrimStart();
                        string ass1 = yr2 + "~" + land + "~" + improvement + "~" + total + "~" + exemp_Value;
                        gc.insert_data(orderNumber, DateTime.Now, parcelNumber, 52, ass1, 1);
                        //db.ExecuteQuery("insert into la_assessor (order_no,parcel_no,year,land,improvements,total,exemption_type) values ('" + orderNumber + "','" + parcelNumber + "','" + yr2 + "','" + land + "','" + improvement + "','" + total + "','" + exemp_Value + "')");



                        //treasurer details.....
                        driver.Navigate().GoToUrl("https://vcheck.ttc.lacounty.gov/");
                        Thread.Sleep(5000);
                        var imgId = driver.FindElement(By.Id("recaptcha_challenge_image"));

                        GlobalClass.imgURL = imgId.GetAttribute("src");

                        string    outPath = System.Web.HttpContext.Current.Server.MapPath("~/captcha\\") + parcelNumber + ".png";
                        WebClient captcha = new WebClient();
                        captcha.DownloadFile(GlobalClass.imgURL, outPath);

                        if (GlobalClass.imgURL != "")
                        {
                            //db.ExecuteQuery("insert into la_url (parcel_no,order_no,src) values ('" + parcelNumber + "','" + orderNumber + "','" + GlobalClass.imgURL + "')");
                            GlobalClass.sDriver = driver;
                            return;
                        }
                    }
                }

                catch (Exception ex)
                {
                    if (driver != null)
                    {
                        driver.Quit();
                    }
                    throw ex;
                }
            }
            else
            {
                //try
                //{
                GlobalClass.sDriver.FindElement(By.Id("recaptcha_response_field")).SendKeys(treasurerCaptcha);
                GlobalClass.sDriver.FindElement(By.Id("next")).Click();

                IList <IWebElement> optionsClass = GlobalClass.sDriver.FindElements(By.TagName("span"));
                foreach (IWebElement strOption in optionsClass)
                {
                    if (strOption.Text.Contains("Property Tax Inquiry/One-"))
                    {
                        strOption.Click();
                        break;
                    }
                }

                string[] treasParclNo = GlobalClass.parcelNumber_la.Split('-');
                GlobalClass.sDriver.FindElement(By.Name("mapbook")).SendKeys(treasParclNo[0]);
                GlobalClass.sDriver.FindElement(By.Name("page")).SendKeys(treasParclNo[1]);
                GlobalClass.sDriver.FindElement(By.Name("parcel")).SendKeys(treasParclNo[2]);

                Thread.Sleep(3000);
                if (GlobalClass.sDriver.FindElement(By.Id("inquirebutton")).Enabled == true)
                {
                    GlobalClass.sDriver.FindElement(By.Id("inquirebutton")).Click();
                }


                outputPath = "";
                outputPath = ConfigurationManager.AppSettings["screenShotPath-la"];
                outputPath = outputPath + orderNumber + "\\" + parcelNumber + "\\";
                if (!Directory.Exists(outputPath))
                {
                    Directory.CreateDirectory(outputPath);
                }
                string img = outputPath + "taxSummary" + ".png";
                string pdf = outputPath + "taxSummary" + ".pdf";

                //driver.Manage().Window.Maximize();
                GlobalClass.sDriver.TakeScreenshot().SaveAsFile(img, ScreenshotImageFormat.Png);

                WebDriverTest.ConvertImageToPdf(img, pdf);
                if (File.Exists(img))
                {
                    File.Delete(img);
                }

                // CreatePdf(orderNumber, parcelNumber, "taxSummary");

                IList <IWebElement> installInfos = GlobalClass.sDriver.FindElements(By.ClassName("installmentinfo"));
                int    i = 0;
                string insInfo = "-", tax_year = "-", seq_no = "-", insInfo1 = "-", tax_year1 = "-", seq_no1 = "-";
                foreach (IWebElement installInfo in installInfos)
                {
                    if (i == 0)
                    {
                        insInfo  = WebDriverTest.After(installInfo.Text, "YEAR: ");
                        tax_year = WebDriverTest.Before(insInfo, "SEQUENCE:").TrimStart().TrimEnd();
                        seq_no   = WebDriverTest.After(insInfo, "SEQUENCE:").TrimStart().TrimEnd();
                    }
                    else
                    {
                        insInfo1  = WebDriverTest.After(installInfo.Text, "YEAR: ");
                        tax_year1 = WebDriverTest.Before(insInfo1, "SEQUENCE:").TrimStart().TrimEnd();
                        seq_no1   = WebDriverTest.After(insInfo1, "SEQUENCE:").TrimStart().TrimEnd();
                    }
                    i++;
                }


                IList <IWebElement> tableElements = GlobalClass.sDriver.FindElements(By.ClassName("installmenttable"));
                int j = 0;
                foreach (IWebElement tableElement in tableElements)
                {
                    IList <IWebElement> tableRow = tableElement.FindElements(By.TagName("tr"));
                    IList <IWebElement> rowTD;
                    List <string>       installment1 = new List <string>();
                    List <string>       installment2 = new List <string>();
                    foreach (IWebElement row in tableRow)
                    {
                        rowTD = row.FindElements(By.TagName("td"));
                        if (rowTD.Count == 5)
                        {
                            installment1.Add(rowTD[1].Text);
                            installment2.Add(rowTD[4].Text);
                        }
                    }

                    string tax_amt = "-", penalty_amt = "-", total_due = "-", paid_amt = "-", balance_due = "-", delinquent = "-", tax_status = "-";

                    tax_status = WebDriverTest.After(GlobalClass.sDriver.FindElement(By.ClassName("installmentstatus")).Text, "Tax Status:").TrimStart();

                    //installment1....
                    //Installment~Tax_amount~Penalty_amount~Total_due~Paid_amount~Balance_due~Delinquent~Tax_status~Tax_year~Seq_no

                    tax_amt    = installment1[0]; penalty_amt = installment1[1]; total_due = installment1[2]; paid_amt = installment1[3]; balance_due = installment1[4];
                    delinquent = installment1[5];
                    if (delinquent == " ")
                    {
                        delinquent = "-";
                    }
                    if (j == 0)
                    {
                        string inst = "1" + "~" + tax_amt + "~" + penalty_amt + "~" + total_due + "~" + paid_amt + "~" + balance_due + "~" + delinquent + "~" + tax_status + "~" + tax_year + "~" + seq_no;
                        gc.insert_data(orderNumber, DateTime.Now, parcelNumber, 53, inst, 1);


                        //installment1....

                        tax_amt = installment2[0]; penalty_amt = installment2[1]; total_due = installment2[2]; paid_amt = installment2[3]; balance_due = installment2[4]; delinquent = installment2[5];
                        if (delinquent == " ")
                        {
                            delinquent = "-";
                        }
                        string inst1 = "2" + "~" + tax_amt + "~" + penalty_amt + "~" + total_due + "~" + paid_amt + "~" + balance_due + "~" + delinquent + "~" + tax_status + "~" + tax_year + "~" + seq_no;
                        gc.insert_data(orderNumber, DateTime.Now, parcelNumber, 53, inst1, 1);
                    }
                    else
                    {
                        string inst = "1" + "~" + tax_amt + "~" + penalty_amt + "~" + total_due + "~" + paid_amt + "~" + balance_due + "~" + delinquent + "~" + "SUPPLEMENTAL" + "~" + tax_year1 + "~" + seq_no1;
                        gc.insert_data(orderNumber, DateTime.Now, parcelNumber, 53, inst, 1);
                        //installment1....

                        tax_amt = installment2[0]; penalty_amt = installment2[1]; total_due = installment2[2]; paid_amt = installment2[3]; balance_due = installment2[4]; delinquent = installment2[5];
                        if (delinquent == " ")
                        {
                            delinquent = "-";
                        }
                        string inst1 = "2" + "~" + tax_amt + "~" + penalty_amt + "~" + total_due + "~" + paid_amt + "~" + balance_due + "~" + delinquent + "~" + "SUPPLEMENTAL" + "~" + tax_year1 + "~" + seq_no1;
                        gc.insert_data(orderNumber, DateTime.Now, parcelNumber, 53, inst1, 1);
                    }
                    j++;
                }



                //delinquent data....
                try
                {
                    IWebElement         delinqTable = GlobalClass.sDriver.FindElement(By.ClassName("installmentdelinq"));
                    IList <IWebElement> tblRow      = delinqTable.FindElements(By.TagName("tr"));
                    IList <IWebElement> rowtD;
                    List <string>       tr1 = new List <string>();
                    List <string>       tr3 = new List <string>();

                    foreach (IWebElement row in tblRow)
                    {
                        rowtD = row.FindElements(By.TagName("td"));
                        tr1.Add(rowtD[1].Text);
                        if (rowtD.Count >= 4)
                        {
                            tr3.Add(rowtD[3].Text);
                        }
                    }
                    //insert data
                }
                catch
                {
                }

                GlobalClass.sDriver.Quit();

                //}
                ////catch (Exception ex)
                ////{
                //    GlobalClass.sDriver.Quit();
                //    throw ex;
                //}
            }
        }
        public string FTP_ORDeschutes(string address, string ownername, string parcelNumber, string searchType, string orderNumber, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            GlobalClass.sname = "OR";
            GlobalClass.cname = "Deschutes";
            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";

            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            //  driver = new ChromeDriver();;

            using (driver = new PhantomJSDriver())
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");

                    if (searchType == "titleflex")
                    {
                        gc.TitleFlexSearch(orderNumber, parcelNumber, "", address, "OR", "Deschutes");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_ORDeschutes"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "address")
                    {
                        driver.Navigate().GoToUrl("http://dial.deschutes.org/");
                        Thread.Sleep(2000);

                        driver.FindElement(By.XPath("/html/body/div[1]/div[1]/ul/li[6]/a")).Click();
                        Thread.Sleep(2000);

                        driver.FindElement(By.Id("value")).SendKeys(address);
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "OR", "Deschutes");

                        driver.FindElement(By.XPath("/html/body/div[1]/div[2]/form/input[1]")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);
                        gc.CreatePdf_WOP(orderNumber, "Address search Result", driver, "OR", "Deschutes");

                        //MultiParcel
                        try
                        {
                            IWebElement         MultiTable = driver.FindElement(By.XPath("/html/body/div[1]/div[2]/div[2]/div[4]/div/table/tbody"));
                            IList <IWebElement> MultiTR    = MultiTable.FindElements(By.TagName("tr"));
                            IList <IWebElement> MultiTD;
                            gc.CreatePdf_WOP(orderNumber, "MultiAddresssearch", driver, "OR", "Deschutes");
                            foreach (IWebElement Multi in MultiTR)
                            {
                                MultiTD = Multi.FindElements(By.TagName("td"));
                                if (MultiTD.Count != 0 && !Multi.Text.Contains("Personal"))
                                {
                                    parcelNumber     = MultiTD[2].Text;
                                    OwnerName        = MultiTD[3].Text;
                                    Property_Address = MultiTD[4].Text;
                                    City             = MultiTD[5].Text;
                                    Subdivision      = MultiTD[6].Text;
                                    Property_Type    = MultiTD[7].Text;
                                    Multidata        = OwnerName + "~" + Property_Address + "~" + City + "~" + Subdivision + "~" + Property_Type;
                                    gc.insert_date(orderNumber, parcelNumber, 272, Multidata, 1, DateTime.Now);
                                }
                            }
                            driver.Quit();
                            HttpContext.Current.Session["multiParcel_ORDeschutes"] = "Yes";

                            if (MultiTR.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_ORDeschutes_Multicount"] = "Maximum";
                            }
                            return("MultiParcel");
                        }
                        catch
                        { }
                    }

                    else if (searchType == "parcel")
                    {
                        driver.Navigate().GoToUrl("http://dial.deschutes.org/");
                        Thread.Sleep(2000);

                        driver.FindElement(By.XPath("/html/body/div[1]/div[1]/ul/li[4]/a")).Click();
                        Thread.Sleep(2000);

                        driver.FindElement(By.Id("value")).SendKeys(parcelNumber);
                        gc.CreatePdf(orderNumber, parcelNumber, "ParcelSearch", driver, "OR", "Deschutes");
                        driver.FindElement(By.XPath("/html/body/div[1]/div[2]/form/input[1]")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);
                    }

                    else if (searchType == "ownername")
                    {
                        driver.Navigate().GoToUrl("http://dial.deschutes.org/");
                        Thread.Sleep(2000);

                        driver.FindElement(By.XPath("/html/body/div[1]/div[1]/ul/li[3]/a")).Click();
                        Thread.Sleep(2000);
                        driver.FindElement(By.Id("value")).SendKeys(ownername);
                        gc.CreatePdf(orderNumber, parcelNumber, "OwnerSearch", driver, "OR", "Deschutes");
                        driver.FindElement(By.XPath("/html/body/div[1]/div[2]/form/input[1]")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);

                        //MultiParcel
                        try
                        {
                            IWebElement         MultiTable = driver.FindElement(By.XPath("/html/body/div[1]/div[2]/div[2]/div[4]/div/table/tbody"));
                            IList <IWebElement> MultiTR    = MultiTable.FindElements(By.TagName("tr"));
                            IList <IWebElement> MultiTD;
                            gc.CreatePdf(orderNumber, parcelNumber, "MultiOwnersearch", driver, "OR", "Deschutes");
                            foreach (IWebElement Multi in MultiTR)
                            {
                                MultiTD = Multi.FindElements(By.TagName("td"));
                                if (MultiTD.Count != 0 && !Multi.Text.Contains("Personal"))
                                {
                                    parcelNumber     = MultiTD[2].Text;
                                    OwnerName        = MultiTD[3].Text;
                                    Property_Address = MultiTD[4].Text;
                                    City             = MultiTD[5].Text;
                                    Subdivision      = MultiTD[6].Text;
                                    Property_Type    = MultiTD[7].Text;
                                    Multidata        = OwnerName + "~" + Property_Address + "~" + City + "~" + Subdivision + "~" + Property_Type;
                                    gc.insert_date(orderNumber, parcelNumber, 272, Multidata, 1, DateTime.Now);
                                }
                            }
                            HttpContext.Current.Session["multiParcel_ORDeschutes"] = "Yes";
                            if (MultiTR.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_ORDeschutes_Multicount"] = "Maximum";
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                        catch
                        { }
                    }

                    try
                    {
                        IWebElement INodata = driver.FindElement(By.XPath("//*[@id='content-app']/div[2]"));
                        if (INodata.Text.Contains("returned no matches"))
                        {
                            HttpContext.Current.Session["Nodata_ORDeschutes"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }

                    //Property_Details
                    try
                    {
                        Mailing_Name = driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[2]/div[2]/div[1]/p[2]")).Text;
                        Mailing_Name = gc.Between(Mailing_Name, "Mailing Name:", "Map and Taxlot:").Trim();

                        Map_Tax = driver.FindElement(By.Id("uxMapTaxlot")).Text;

                        Account_Number = driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[2]/div[2]/div[1]/p[2]")).Text;
                        Account_Number = gc.Between(Account_Number, "Account:", "Situs Address:").Trim();

                        Situs_Address = driver.FindElement(By.Id("uxSitusAddress")).Text;

                        Tax_Status = driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[2]/div[2]/div[1]/p[2]")).Text;
                        Tax_Status = WebDriverTest.After(Tax_Status, "Tax Status:").Trim();

                        Assessor_Property_Description = driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[2]/div[2]/div[2]/p[4]/strong[2]/a")).Text;

                        Assessor_Acres = driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[2]/div[2]/div[2]/p[5]")).Text;
                        Assessor_Acres = gc.Between(Assessor_Acres, "Assessor Acres:", "Property Class:").Trim();

                        Property_Class = driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[2]/div[2]/div[2]/p[5]")).Text;
                        Property_Class = WebDriverTest.After(Property_Class, "Property Class:").Trim();

                        gc.CreatePdf(orderNumber, Account_Number, "Property Details", driver, "OR", "Deschutes");

                        IWebElement ValueTable = driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[2]/div[2]/div[3]/table[1]/tbody"));
                        Thread.Sleep(2000);
                        IList <IWebElement> ValueTR = ValueTable.FindElements(By.TagName("tr"));
                        IList <IWebElement> ValueTD;
                        List <string>       Land       = new List <string>();
                        List <string>       Structures = new List <string>();
                        List <string>       Total      = new List <string>();

                        int i = 0;
                        foreach (IWebElement Value in ValueTR)
                        {
                            ValueTD = Value.FindElements(By.TagName("td"));
                            if (i == 0)
                            {
                                Land.Add(ValueTD[1].Text);
                            }
                            else if (i == 1)
                            {
                                Structures.Add(ValueTD[1].Text);
                            }
                            else if (i == 2)
                            {
                                Total.Add(ValueTD[1].Text);
                            }
                            i++;
                        }

                        IWebElement         AssessedTable = driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[2]/div[2]/div[3]/table[2]/tbody"));
                        IList <IWebElement> AssessedTR    = AssessedTable.FindElements(By.TagName("tr"));
                        IList <IWebElement> AssessedTD;

                        List <string> Maximum_Assessed   = new List <string>();
                        List <string> Assessed_Value     = new List <string>();
                        List <string> Veterans_Exemption = new List <string>();

                        int j = 0;
                        foreach (IWebElement Assessed in AssessedTR)
                        {
                            AssessedTD = Assessed.FindElements(By.TagName("td"));
                            if (j == 0)
                            {
                                Maximum_Assessed.Add(AssessedTD[1].Text);
                            }
                            else if (j == 1)
                            {
                                Assessed_Value.Add(AssessedTD[1].Text);
                            }
                            else if (j == 2)
                            {
                                Veterans_Exemption.Add(AssessedTD[1].Text);
                            }
                            j++;
                        }


                        driver.FindElement(By.XPath("/html/body/div[1]/div[2]/ul/li[2]/ul/li[5]/a")).Click();
                        Thread.Sleep(2000);
                        Year_Built = driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[2]/div[2]/table[1]/tbody/tr/td[3]")).Text;

                        Property_Deatail = Mailing_Name + "~" + Map_Tax + "~" + Account_Number + "~" + Situs_Address + "~" + Tax_Status + "~" + Assessor_Property_Description + "~" + Assessor_Acres + "~" + Property_Class + "~" + Land[0] + "~" + Structures[0] + "~" + Total[0] + "~" + Maximum_Assessed[0] + "~" + Assessed_Value[0] + "~" + Veterans_Exemption[0] + "~" + Year_Built;
                        gc.insert_date(orderNumber, Account_Number, 273, Property_Deatail, 1, DateTime.Now);
                    }
                    catch
                    { }

                    //Assement_Details
                    try
                    {
                        driver.FindElement(By.XPath("/html/body/div[1]/div[2]/ul/li[2]/ul/li[2]/a")).Click();
                        Thread.Sleep(2000);

                        IWebElement AssementTable = driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[2]/div[2]/table/tbody"));
                        Thread.Sleep(4000);
                        IList <IWebElement> AssementTR = AssementTable.FindElements(By.TagName("tr"));
                        IList <IWebElement> AssementTH;
                        IList <IWebElement> AssementTD;
                        gc.CreatePdf(orderNumber, Account_Number, "Assement Details", driver, "OR", "Deschutes");
                        List <string> Value_History              = new List <string>();
                        List <string> RealMarketValue_Land       = new List <string>();
                        List <string> RealMarketValue_Structures = new List <string>();
                        List <string> TotalRealMarket_Value      = new List <string>();
                        List <string> MaximumAssessed_Value      = new List <string>();
                        List <string> TotalAssessed_Value        = new List <string>();
                        List <string> VeteransExemption_Value    = new List <string>();

                        int k = 0;
                        foreach (IWebElement Assement in AssementTR)
                        {
                            AssementTD = Assement.FindElements(By.TagName("td"));

                            if (k == 0)
                            {
                                AssementTH = Assement.FindElements(By.TagName("th"));
                                Value_History.Add(AssementTH[1].Text);
                                Value_History.Add(AssementTH[2].Text);
                                Value_History.Add(AssementTH[3].Text);
                                Value_History.Add(AssementTH[4].Text);
                                Value_History.Add(AssementTH[5].Text);
                            }
                            else if (k == 1)
                            {
                                RealMarketValue_Land.Add(AssementTD[1].Text);
                                RealMarketValue_Land.Add(AssementTD[2].Text);
                                RealMarketValue_Land.Add(AssementTD[3].Text);
                                RealMarketValue_Land.Add(AssementTD[4].Text);
                                RealMarketValue_Land.Add(AssementTD[5].Text);
                            }
                            else if (k == 2)
                            {
                                RealMarketValue_Structures.Add(AssementTD[1].Text);
                                RealMarketValue_Structures.Add(AssementTD[2].Text);
                                RealMarketValue_Structures.Add(AssementTD[3].Text);
                                RealMarketValue_Structures.Add(AssementTD[4].Text);
                                RealMarketValue_Structures.Add(AssementTD[5].Text);
                            }
                            else if (k == 3)
                            {
                                TotalRealMarket_Value.Add(AssementTD[1].Text);
                                TotalRealMarket_Value.Add(AssementTD[2].Text);
                                TotalRealMarket_Value.Add(AssementTD[3].Text);
                                TotalRealMarket_Value.Add(AssementTD[4].Text);
                                TotalRealMarket_Value.Add(AssementTD[5].Text);
                            }
                            else if (k == 4)
                            {
                                MaximumAssessed_Value.Add(AssementTD[1].Text);
                                MaximumAssessed_Value.Add(AssementTD[2].Text);
                                MaximumAssessed_Value.Add(AssementTD[3].Text);
                                MaximumAssessed_Value.Add(AssementTD[4].Text);
                                MaximumAssessed_Value.Add(AssementTD[5].Text);
                            }
                            else if (k == 5)
                            {
                                TotalAssessed_Value.Add(AssementTD[1].Text);
                                TotalAssessed_Value.Add(AssementTD[2].Text);
                                TotalAssessed_Value.Add(AssementTD[3].Text);
                                TotalAssessed_Value.Add(AssementTD[4].Text);
                                TotalAssessed_Value.Add(AssementTD[5].Text);
                            }
                            else if (k == 6)
                            {
                                VeteransExemption_Value.Add(AssementTD[1].Text);
                                VeteransExemption_Value.Add(AssementTD[2].Text);
                                VeteransExemption_Value.Add(AssementTD[3].Text);
                                VeteransExemption_Value.Add(AssementTD[4].Text);
                                VeteransExemption_Value.Add(AssementTD[5].Text);
                            }
                            k++;
                        }
                        Assemnt_Details1 = Value_History[0] + "~" + RealMarketValue_Land[0] + "~" + RealMarketValue_Structures[0] + "~" + TotalRealMarket_Value[0] + "~" + MaximumAssessed_Value[0] + "~" + TotalAssessed_Value[0] + "~" + VeteransExemption_Value[0];
                        Assemnt_Details2 = Value_History[1] + "~" + RealMarketValue_Land[1] + "~" + RealMarketValue_Structures[1] + "~" + TotalRealMarket_Value[1] + "~" + MaximumAssessed_Value[1] + "~" + TotalAssessed_Value[1] + "~" + VeteransExemption_Value[1];
                        Assemnt_Details3 = Value_History[2] + "~" + RealMarketValue_Land[2] + "~" + RealMarketValue_Structures[2] + "~" + TotalRealMarket_Value[2] + "~" + MaximumAssessed_Value[2] + "~" + TotalAssessed_Value[2] + "~" + VeteransExemption_Value[2];
                        Assemnt_Details4 = Value_History[3] + "~" + RealMarketValue_Land[3] + "~" + RealMarketValue_Structures[3] + "~" + TotalRealMarket_Value[3] + "~" + MaximumAssessed_Value[3] + "~" + TotalAssessed_Value[3] + "~" + VeteransExemption_Value[3];
                        Assemnt_Details5 = Value_History[4] + "~" + RealMarketValue_Land[4] + "~" + RealMarketValue_Structures[4] + "~" + TotalRealMarket_Value[4] + "~" + MaximumAssessed_Value[4] + "~" + TotalAssessed_Value[4] + "~" + VeteransExemption_Value[4];
                        gc.insert_date(orderNumber, Account_Number, 282, Assemnt_Details1, 1, DateTime.Now);
                        gc.insert_date(orderNumber, Account_Number, 282, Assemnt_Details2, 1, DateTime.Now);
                        gc.insert_date(orderNumber, Account_Number, 282, Assemnt_Details3, 1, DateTime.Now);
                        gc.insert_date(orderNumber, Account_Number, 282, Assemnt_Details4, 1, DateTime.Now);
                        gc.insert_date(orderNumber, Account_Number, 282, Assemnt_Details5, 1, DateTime.Now);
                    }
                    catch
                    { }
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");
                    //Tax Information
                    try
                    {
                        driver.FindElement(By.XPath("/html/body/div[1]/div[2]/ul/li[2]/ul/li[3]/a")).Click();
                        Thread.Sleep(2000);
                        int ye = 0;
                        Tax_Code = driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[2]/div[2]/div[2]/div[1]/p[3]")).Text;
                        Tax_Code = WebDriverTest.After(Tax_Code, "Tax Code Area: ").Trim();

                        IWebElement         taxyeartable = driver.FindElement(By.XPath("//*[@id='results-data']/div[4]/table[1]/tbody"));
                        IList <IWebElement> Taxyearrow   = taxyeartable.FindElements(By.TagName("tr"));
                        IList <IWebElement> Taxyeartd;
                        foreach (IWebElement Taxyear in Taxyearrow)
                        {
                            Taxyeartd = Taxyear.FindElements(By.TagName("td"));
                            if (Taxyeartd.Count != 0 && ye == 0)
                            {
                                TaxYear_2016 = Taxyeartd[0].Text;
                                TaxYear_2017 = Taxyeartd[1].Text;
                                TaxYear_2018 = Taxyeartd[1].Text;
                                ye++;
                            }
                        }
                        gc.CreatePdf(orderNumber, Account_Number, "Tax Details", driver, "OR", "Deschutes");

                        IWebElement TBPayment = driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[2]/div[2]/div[4]/table[2]/tbody"));
                        Thread.Sleep(2000);
                        IList <IWebElement> TRPayment = TBPayment.FindElements(By.TagName("tr"));
                        IList <IWebElement> TDPayment;

                        foreach (IWebElement PaymentTax in TRPayment)
                        {
                            TDPayment = PaymentTax.FindElements(By.TagName("td"));
                            if (TDPayment.Count != 0 && !PaymentTax.Text.Contains("Year") && !PaymentTax.Text.Contains("Total:"))
                            {
                                Payment_Year     = TDPayment[0].Text;
                                Date_Due         = TDPayment[1].Text;
                                Transaction_Type = TDPayment[2].Text;
                                Transaction_Date = TDPayment[3].Text;
                                AsOf_Date        = TDPayment[4].Text;
                                Amount_Received  = TDPayment[5].Text;
                                Tax_Due          = TDPayment[6].Text;
                                Discount_Amount  = TDPayment[7].Text;
                                Interest_Charged = TDPayment[8].Text;
                                Refund_Interest  = TDPayment[9].Text;

                                Payment_Details = Payment_Year + "~" + Date_Due + "~" + Transaction_Type + "~" + Transaction_Date + "~" + AsOf_Date + "~" + Amount_Received + "~" + Tax_Due + "~" + Discount_Amount + "~" + Interest_Charged + "~" + Refund_Interest;
                                gc.insert_date(orderNumber, Account_Number, 292, Payment_Details, 1, DateTime.Now);
                            }
                            if (TDPayment.Count == 3)
                            {
                                string Total1       = TDPayment[0].Text;
                                string Total1_Value = TDPayment[1].Text;

                                string Payment_Details1 = "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + Total1 + "~" + Total1_Value + "~" + "" + "~" + "" + "~" + "";
                                gc.insert_date(orderNumber, Account_Number, 292, Payment_Details1, 1, DateTime.Now);
                            }
                        }

                        try
                        {
                            //Download Pdf files
                            IWebElement CurrentBalance = driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[2]/div[2]/div[2]/div[1]/p[2]/a"));
                            CurrentTaxBalance = CurrentBalance.GetAttribute("href");
                            gc.downloadfile(CurrentTaxBalance, orderNumber, Account_Number, "Current_Balance", "OR", "Deschutes");

                            FilePath = gc.filePath(orderNumber, Account_Number) + "Current_Balance.pdf";
                            PdfReader reader;
                            reader = new PdfReader(FilePath);
                            String textFromPage = PdfTextExtractor.GetTextFromPage(reader, 1);
                            System.Diagnostics.Debug.WriteLine("" + textFromPage);

                            pdftext = textFromPage;

                            try
                            {
                                Acct_sttus = gc.Between(pdftext, "Account Status ", " Loan Number");
                                Rol_Typ    = gc.Between(pdftext, "Roll Type ", " Property");
                                Situs      = gc.Between(pdftext, "Address ", " Interest");
                                Id_situs   = gc.Between(pdftext, "ID ", "Situs");
                                Ints_Id    = gc.Between(pdftext, "To ", "Tax Summary");

                                TaxSummary_details = Acct_sttus + "~" + Rol_Typ + "~" + Situs + "~" + Id_situs + "~" + Ints_Id;
                                gc.insert_date(orderNumber, Account_Number, 898, TaxSummary_details, 1, DateTime.Now);
                            }
                            catch
                            { }

                            tableassess = GlobalClass.After(pdftext, "Due Date").Trim();
                            string[]      tableArray = tableassess.Split('\n');
                            List <string> rowarray1 = new List <string>();
                            int           i = 0, j = 0, k = 0, y = 0, w = 0;
                            int           count1 = tableArray.Length;
                            for (i = 0; i < count1; i++)
                            {
                                a1 = tableArray[i].Replace(" ", "~");
                                string[] rowarray = a1.Split('~');
                                rowarray1.AddRange(rowarray);
                                if (rowarray1.Count != 5 & rowarray1.Count != 3 && rowarray1.Count != 2)
                                {
                                    newrow = rowarray1[j] + "~" + rowarray1[j + 1] + "~" + rowarray1[j + 2] + "~" + rowarray1[j + 3] + "~" + rowarray1[j + 4] + "~" + rowarray1[j + 5] + "~" + rowarray1[j + 6] + "~" + rowarray1[j + 7] + " " + rowarray1[j + 8] + " " + rowarray1[j + 9];
                                    gc.insert_date(orderNumber, Account_Number, 896, newrow, 1, DateTime.Now);
                                    rowarray1.Clear();
                                }
                                if (rowarray1.Count == 5)
                                {
                                    newrow1 = "" + "~" + rowarray1[k] + "~" + rowarray1[k + 1] + "~" + rowarray1[k + 2] + "~" + rowarray1[k + 3] + "~" + rowarray1[k + 4] + "~" + "" + "~" + "" + " " + "" + " " + "";
                                    gc.insert_date(orderNumber, Account_Number, 896, newrow1, 1, DateTime.Now);
                                }
                                if (rowarray1.Count == 3)
                                {
                                    newrow11 = " " + "~" + "Total" + "~" + rowarray1[y] + "~" + rowarray1[y + 1] + "~" + "$0.00" + "~" + rowarray1[y + 2] + "~" + "" + "~" + "" + " " + "" + " " + "";
                                    gc.insert_date(orderNumber, Account_Number, 896, newrow11, 1, DateTime.Now);
                                    rowarray1.Clear();
                                }
                            }

                            try
                            {
                                string FinalRow = newrow10.Replace("", "") + "~" + newrow11 + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + " " + "" + " " + "";
                                gc.insert_date(orderNumber, Account_Number, 896, FinalRow, 1, DateTime.Now);
                            }
                            catch
                            { }

                            //try
                            //{
                            //    IWebElement Tax_State1 = driver.FindElement(By.XPath("//*[@id='results-data']/div[4]/table[1]/tbody/tr[3]/td[3]/a"));
                            //    Tax_Statemet1 = Tax_State1.GetAttribute("href");
                            //    gc.downloadfile(Tax_Statemet1, orderNumber, Account_Number, "Tax Statemet 2015", "OR", "Deschutes");

                            //    IWebElement Tax_State2 = driver.FindElement(By.XPath("//*[@id='results-data']/div[4]/table[1]/tbody/tr[3]/td[4]/a"));
                            //    Tax_Statemet2 = Tax_State2.GetAttribute("href");
                            //    gc.downloadfile(Tax_Statemet2, orderNumber, Account_Number, "Tax Statemet 2016", "OR", "Deschutes");
                            //}
                            //catch
                            //{ }

                            List <string> urlListTaxBills = new List <string>();

                            IWebElement         TaxStateTB = driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[2]/div[2]/div[4]/table[1]/tbody"));
                            IList <IWebElement> TaxStateTR = TaxStateTB.FindElements(By.TagName("tr"));
                            IList <IWebElement> TaxStateA;

                            foreach (IWebElement TaxState in TaxStateTR)
                            {
                                TaxStateA = TaxState.FindElements(By.TagName("a"));
                                if (TaxStateA.Count != 0)
                                {
                                    urlListTaxBills.Add(TaxStateA[0].GetAttribute("href"));
                                    urlListTaxBills.Add(TaxStateA[1].GetAttribute("href"));
                                    urlListTaxBills.Add(TaxStateA[2].GetAttribute("href"));
                                }
                            }

                            try
                            {
                                int z    = 0;
                                int bill = 0;
                                foreach (string sewer in urlListTaxBills)
                                {
                                    if (z == 0 || z == 1 || z == 2)
                                    {
                                        gc.downloadfile(sewer, orderNumber, Account_Number, "TaxYear_Statement" + bill, "OR", "Deschutes");
                                        filename  = "TaxYear_Statement" + bill;
                                        FilePath1 = gc.filePath(orderNumber, Account_Number) + filename + ".pdf";
                                        PdfReader reader1;
                                        reader1 = new PdfReader(FilePath1);
                                        String textFromPage1 = PdfTextExtractor.GetTextFromPage(reader1, 1);
                                        System.Diagnostics.Debug.WriteLine("" + textFromPage1);

                                        pdftext1 = textFromPage1;

                                        tableassess2 = gc.Between(pdftext1, "PAYMENT OPTIONS", "TOTAL DUE (").Trim();
                                        string[]      tableArray2 = tableassess2.Split('\n');
                                        List <string> rowarray4   = new List <string>();

                                        int n = 0, o = 0, p = 0, q = 0;
                                        int count3 = tableArray2.Length;

                                        for (n = 1; n < count3; n++)
                                        {
                                            a3 = tableArray2[n].Replace(" ", "~");
                                            string[] rowarray5 = a3.Split('~');
                                            rowarray4.AddRange(rowarray5);

                                            if (rowarray4.Count == 4)
                                            {
                                                newrow4 = rowarray4[0] + "~" + rowarray4[1] + "~" + rowarray4[2] + "~" + rowarray4[3];
                                                gc.insert_date(orderNumber, Account_Number, 906, newrow4, 1, DateTime.Now);
                                            }
                                            if (rowarray4.Count == 3)
                                            {
                                                if (q == 2)
                                                {
                                                    newrow4 = rowarray4[0] + "~" + "" + "~" + rowarray4[1] + "~" + rowarray4[2];
                                                    gc.insert_date(orderNumber, Account_Number, 906, newrow4, 1, DateTime.Now);
                                                }
                                                if (q == 3)
                                                {
                                                    newrow4 = "Total" + "~" + rowarray4[0] + "~" + rowarray4[1] + "~" + rowarray4[2];
                                                    gc.insert_date(orderNumber, Account_Number, 906, newrow4, 1, DateTime.Now);
                                                    q++;
                                                }
                                            }
                                            if (rowarray4.Count == 2)
                                            {
                                                newrow4 = rowarray4[0] + "~" + "" + "~" + "" + "~" + rowarray4[1];
                                                gc.insert_date(orderNumber, Account_Number, 906, newrow4, 1, DateTime.Now);
                                            }
                                            q++;
                                            rowarray4.Clear();
                                        }

                                        year = gc.Between(pdftext1, "DESCHUTES COUNTY REAL", "PROPERTY TAXES ACCOUNT NO.").Trim();

                                        tableassess3 = gc.Between(pdftext1, "Date Due Amount", "Mailing address change on back").Trim();
                                        try
                                        {
                                            tableassess3 = GlobalClass.After(tableassess3, "Date Due Amount");
                                        }
                                        catch { }
                                        line1 = gc.Between(tableassess3, "Full Payment Enclosed", "or 2/3 Payment Enclosed").Trim();
                                        line2 = gc.Between(tableassess3, "or 2/3 Payment Enclosed", "or 1/3 Payment Enclosed").Trim();
                                        line3 = GlobalClass.After(tableassess3, "or 1/3 Payment Enclosed").Trim();

                                        tableArray2 = line1.Split('\n');
                                        line1       = tableArray2[0];
                                        line2       = line2 + " " + tableArray2[1] + " " + tableArray2[2];
                                        line3       = line3.Replace("\n", " ");

                                        string[] tableline1 = line1.Split(' ');
                                        string[] tableline2 = line2.Split(' ');
                                        string[] tableline3 = line3.Split(' ');

                                        newrow3 = year + "~" + "Full Payment Enclosed" + "~" + tableline1[0] + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + tableline1[1] + "~" + tableline1[2];
                                        gc.insert_date(orderNumber, Account_Number, 899, newrow3, 1, DateTime.Now);
                                        newrow3 = year + "~" + "or 2/3 Payment Enclosed" + "~" + tableline2[0] + "~" + tableline2[1] + "~" + tableline2[3] + "~" + "" + "~" + "" + "~" + tableline2[4] + "~" + tableline2[2];
                                        gc.insert_date(orderNumber, Account_Number, 899, newrow3, 1, DateTime.Now);
                                        newrow3 = year + "~" + "or 1/3 Payment Enclosed" + "~" + tableline3[0] + "~" + tableline3[1] + "~" + tableline3[2] + "~" + tableline3[3] + "~" + tableline3[6] + "~" + tableline3[4] + "~" + tableline3[5];
                                        gc.insert_date(orderNumber, Account_Number, 899, newrow3, 1, DateTime.Now);
                                        bill++;
                                    }
                                }
                            }
                            catch
                            { }
                        }
                        catch
                        { }
                    }
                    catch
                    { }

                    //Sales_Information
                    try
                    {
                        driver.FindElement(By.XPath("/html/body/div[1]/div[2]/ul/li[2]/ul/li[4]/a")).Click();
                        Thread.Sleep(2000);
                        gc.CreatePdf(orderNumber, Account_Number, "Sales Details", driver, "OR", "Deschutes");
                    }
                    catch
                    { }

                    //Land_Structure
                    try
                    {
                        driver.FindElement(By.XPath("//*[@id='navigation']/ul/li[2]/ul/li[5]/a")).Click();
                        Thread.Sleep(2000);
                        gc.CreatePdf(orderNumber, Account_Number, "Land Structure Details", driver, "OR", "Deschutes");
                    }
                    catch
                    { }

                    //SpecialAssements_Details
                    try
                    {
                        driver.FindElement(By.XPath("/html/body/div[1]/div[2]/ul/li[2]/ul/li[6]/a")).Click();
                        Thread.Sleep(2000);

                        IWebElement SpecialTable = driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[2]/div[2]/table/tbody"));
                        Thread.Sleep(2000);
                        IList <IWebElement> SpecialTR = SpecialTable.FindElements(By.TagName("tr"));
                        IList <IWebElement> SpecialTD;
                        gc.CreatePdf(orderNumber, Account_Number, "Special Details", driver, "OR", "Deschutes");
                        foreach (IWebElement Special in SpecialTR)
                        {
                            SpecialTD = Special.FindElements(By.TagName("td"));
                            if (SpecialTD.Count != 0)
                            {
                                Special_Description = SpecialTD[0].Text;
                                Special_Amount      = SpecialTD[1].Text;
                                Special_Year        = SpecialTD[2].Text;
                                Special_details     = Special_Description + "~" + Special_Amount + "~" + Special_Year;
                                gc.insert_date(orderNumber, Account_Number, 290, Special_details, 1, DateTime.Now);
                            }
                        }
                    }
                    catch
                    { }

                    try
                    {
                        Tax_Authority = "Deschutes Services Building,1300 NW Wall Street, 2nd Floor Bend, OR 97701" + " " + "(541) 388 - 6540 Phone" + " " + "(541) 385 - 3248 Fax";
                    }
                    catch
                    { }
                    Tax_details = Tax_Code + "~" + TaxYear_2014 + "~" + TaxYear_2015 + "~" + TaxYear_2016 + "~" + TaxYear_2017 + "~" + TaxYear_2018 + "~" + Tax_Authority;
                    gc.insert_date(orderNumber, Account_Number, 291, Tax_details, 1, DateTime.Now);

                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "OR", "Deschutes", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    //megrge pdf files
                    gc.mergpdf(orderNumber, "OR", "Deschutes");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    throw ex;
                }
            }
        }
        public string FTP_FLPalmBeach(string address, string ownername, string parcelNumber, string searchType, string orderNumber, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";

            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            string[] stringSeparators1 = new string[] { "\r\n" };
            // driver = new ChromeDriver();
            using (driver = new PhantomJSDriver())
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");
                    if (searchType == "titleflex")
                    {
                        // string titleaddress = houseno + " " + housedir + " " + sname + " " + sttype + " " + unitno;
                        gc.TitleFlexSearch(orderNumber, "", "", address, "FL", "Palm Beach");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_FLPalmBeach"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "address")
                    {
                        driver.Navigate().GoToUrl("http://www.pbcgov.com/PAPA/index.htm");
                        Thread.Sleep(4000);

                        IWebElement iframeElement = driver.FindElement(By.Id("master-search"));
                        Thread.Sleep(6000);
                        driver.SwitchTo().Frame(iframeElement);

                        driver.FindElement(By.Id("txtSearch")).SendKeys(address);
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "FL", "Palm Beach");

                        driver.FindElement(By.XPath("//*[@id='form2']/div[3]/div[1]/div/button")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);

                        //MultiParcel
                        try
                        {
                            IWebElement         MultiTable = driver.FindElement(By.Id("gvSrchResults"));
                            IList <IWebElement> MultiTR    = MultiTable.FindElements(By.TagName("tr"));
                            IList <IWebElement> MultiTD;

                            int maxCheck = 0;

                            gc.CreatePdf_WOP(orderNumber, "MultiAddresssearch", driver, "FL", "Palm Beach");
                            foreach (IWebElement Multi in MultiTR)
                            {
                                MultiTD = Multi.FindElements(By.TagName("td"));
                                if (MultiTD.Count != 0 && !Multi.Text.Contains("Owner Name"))
                                {
                                    OwnerName    = MultiTD[0].Text;
                                    Location     = MultiTD[1].Text;
                                    Municipality = MultiTD[2].Text;
                                    parcelNumber = MultiTD[3].Text;

                                    Multidata = OwnerName + "~" + Location + "~" + Municipality;
                                    gc.insert_date(orderNumber, parcelNumber, 330, Multidata, 1, DateTime.Now);
                                }
                                maxCheck++;
                            }


                            if (maxCheck <= 25)
                            {
                                HttpContext.Current.Session["multiParcel_FLPalmBeach"] = "Yes";
                                GlobalClass.multiParcel_FLPalmBeach = "Yes";
                                driver.Quit();
                                return("MultiParcel");
                            }
                            if (MultiTR.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_FLPalmBeach_Multicount"] = "Maximum";
                                GlobalClass.multiParcel_FLPalmBeach_Multicount = "Maximum";
                                driver.Quit();
                                return("Maximum");
                            }
                        }
                        catch
                        { }
                    }
                    else if (searchType == "parcel")
                    {
                        driver.Navigate().GoToUrl("http://www.pbcgov.com/PAPA/index.htm");
                        Thread.Sleep(2000);

                        IWebElement iframeElement = driver.FindElement(By.Id("master-search"));
                        Thread.Sleep(6000);
                        driver.SwitchTo().Frame(iframeElement);

                        driver.FindElement(By.Id("txtSearch")).SendKeys(parcelNumber);
                        gc.CreatePdf(orderNumber, parcelNumber, "ParcelSearch", driver, "FL", "Palm Beach");

                        driver.FindElement(By.XPath("//*[@id='form2']/div[3]/div[1]/div/button")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);
                    }
                    else if (searchType == "ownername")
                    {
                        driver.Navigate().GoToUrl("http://www.pbcgov.com/PAPA/index.htm");
                        Thread.Sleep(2000);

                        IWebElement iframeElement = driver.FindElement(By.Id("master-search"));
                        Thread.Sleep(6000);
                        driver.SwitchTo().Frame(iframeElement);

                        driver.FindElement(By.Id("txtSearch")).SendKeys(ownername);
                        gc.CreatePdf(orderNumber, parcelNumber, "OwnerSearch", driver, "FL", "Palm Beach");

                        driver.FindElement(By.XPath("//*[@id='form2']/div[3]/div[1]/div/button")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);

                        //MultiParcel
                        try
                        {
                            IWebElement         MultiTable = driver.FindElement(By.Id("gvSrchResults"));
                            IList <IWebElement> MultiTR    = MultiTable.FindElements(By.TagName("tr"));
                            IList <IWebElement> MultiTD;

                            int maxCheck = 0;

                            gc.CreatePdf_WOP(orderNumber, "MultiOwnersearch", driver, "FL", "Palm Beach");
                            foreach (IWebElement Multi in MultiTR)
                            {
                                if (maxCheck <= 25)
                                {
                                    MultiTD = Multi.FindElements(By.TagName("td"));
                                    if (MultiTD.Count != 0 && !Multi.Text.Contains("Owner Name"))
                                    {
                                        OwnerName    = MultiTD[0].Text;
                                        Location     = MultiTD[1].Text;
                                        Municipaliti = MultiTD[2].Text;
                                        parcelNumber = MultiTD[3].Text;

                                        Multidata = OwnerName + "~" + Location + "~" + Municipaliti;
                                        gc.insert_date(orderNumber, parcelNumber, 330, Multidata, 1, DateTime.Now);
                                    }
                                    maxCheck++;
                                }
                            }
                            HttpContext.Current.Session["multiParcel_FLPalmBeach"] = "Yes";
                            if (MultiTR.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_FLPalmBeach_Multicount"] = "Maximum";
                                return("Maximum");
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                        catch
                        { }
                    }

                    try
                    {
                        string Nodata = driver.FindElement(By.Id("MainContent_lblMsg")).Text;
                        if (Nodata == "No Results matched your search criteria. Please modify your search and try again.")
                        {
                            HttpContext.Current.Session["Nodata_FLPalmBeach"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch
                    { }

                    //Scraped Data
                    Location_Address = driver.FindElement(By.XPath("//*[@id='tdDetail']/table/tbody/tr[2]/td[2]")).Text;
                    Municipality     = driver.FindElement(By.XPath("//*[@id='tdDetail']/table/tbody/tr[3]/td[2]")).Text;
                    ParcelNo         = driver.FindElement(By.XPath("//*[@id='tdDetail']/table/tbody/tr[4]/td[2]")).Text;
                    amck.TaxId       = ParcelNo;
                    gc.CreatePdf(orderNumber, ParcelNo, "Property Result", driver, "FL", "Palm Beach");
                    try
                    {
                        SubDivision       = driver.FindElement(By.XPath("//*[@id='tdDetail']/table/tbody/tr[5]/td[2]")).Text;
                        Legal_Description = driver.FindElement(By.XPath("//*[@id='tdDetail']/table/tbody/tr[8]/td[2]")).Text;

                        IWebElement         Acrestable = driver.FindElement(By.XPath("//*[@id='propertyInformationDiv']/fieldset/table[1]/tbody/tr[2]/td[1]/table[2]/tbody"));
                        IList <IWebElement> AcresTR    = Acrestable.FindElements(By.TagName("tr"));
                        IList <IWebElement> AcresTD;

                        foreach (IWebElement Acre in AcresTR)
                        {
                            AcresTD = Acre.FindElements(By.TagName("td"));
                            if (AcresTD.Count != 0 && Acre.Text.Contains("Acres"))
                            {
                                Acres = AcresTD[1].Text;
                            }
                        }

                        IWebElement         Yeartable = driver.FindElement(By.XPath("//*[@id='propertyInformationDiv']/fieldset/table[1]/tbody/tr[2]/td[2]/table/tbody"));
                        IList <IWebElement> YearTR    = Yeartable.FindElements(By.TagName("tr"));
                        IList <IWebElement> YearTD;

                        foreach (IWebElement Year in YearTR)
                        {
                            YearTD = Year.FindElements(By.TagName("td"));
                            if (YearTD.Count != 0 && Year.Text.Contains("Year Built"))
                            {
                                Year_Built = YearTD[2].Text;
                            }
                        }

                        IWebElement         OwnerTable = driver.FindElement(By.XPath("//*[@id='ownerInformationDiv']/fieldset/table/tbody/tr[2]/td[1]/table/tbody"));
                        IList <IWebElement> OwnerTR    = OwnerTable.FindElements(By.TagName("tr"));
                        IList <IWebElement> OwnerTD;

                        foreach (IWebElement Owner in OwnerTR)
                        {
                            OwnerTD = Owner.FindElements(By.TagName("td"));
                            if (OwnerTD.Count != 0 && !Owner.Text.Contains("Owner(s)"))
                            {
                                Owner_Name += OwnerTD[0].Text + " ";
                            }
                        }
                        string Mailaddress1     = driver.FindElement(By.Id("MainContent_lblAddrLine3")).Text;
                        string Mailing_Address2 = driver.FindElement(By.XPath("//*[@id='ownerInformationDiv']/fieldset/table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td")).Text;
                        Mailing_Address = Mailing_Address2 + " " + Mailaddress1;
                    }
                    catch
                    { }
                    Property_Details = Location_Address + "~" + Municipality + "~" + SubDivision + "~" + Legal_Description + "~" + Acres + "~" + Year_Built + "~" + Owner_Name + "~" + Mailing_Address;
                    gc.insert_date(orderNumber, ParcelNo, 338, Property_Details, 1, DateTime.Now);

                    //Appraisals Details
                    try
                    {
                        IWebElement         AppraisalsTable = driver.FindElement(By.XPath("//*[@id='tblApprsal']/tbody"));
                        IList <IWebElement> AppraisalsTR    = AppraisalsTable.FindElements(By.TagName("tr"));
                        IList <IWebElement> AppraisalsTD;

                        List <string> Tax_Year          = new List <string>();
                        List <string> Improvement_Value = new List <string>();
                        List <string> Land_Value        = new List <string>();
                        List <string> TotalMarket_Value = new List <string>();

                        int i = 1;
                        foreach (IWebElement Appraisals in AppraisalsTR)
                        {
                            AppraisalsTD = Appraisals.FindElements(By.TagName("td"));
                            if (!Appraisals.Text.Contains("Show 5 year"))
                            {
                                if (i == 1)
                                {
                                    Tax_Year.Add(AppraisalsTD[1].Text);
                                    Tax_Year.Add(AppraisalsTD[2].Text);
                                    Tax_Year.Add(AppraisalsTD[3].Text);
                                    Tax_Year.Add(AppraisalsTD[4].Text);
                                    Tax_Year.Add(AppraisalsTD[5].Text);
                                }
                                else if (i == 2)
                                {
                                    Improvement_Value.Add(AppraisalsTD[1].Text);
                                    Improvement_Value.Add(AppraisalsTD[2].Text);
                                    Improvement_Value.Add(AppraisalsTD[3].Text);
                                    Improvement_Value.Add(AppraisalsTD[4].Text);
                                    Improvement_Value.Add(AppraisalsTD[5].Text);
                                }
                                else if (i == 3)
                                {
                                    Land_Value.Add(AppraisalsTD[1].Text);
                                    Land_Value.Add(AppraisalsTD[2].Text);
                                    Land_Value.Add(AppraisalsTD[3].Text);
                                    Land_Value.Add(AppraisalsTD[4].Text);
                                    Land_Value.Add(AppraisalsTD[5].Text);
                                }
                                else if (i == 4)
                                {
                                    TotalMarket_Value.Add(AppraisalsTD[1].Text);
                                    TotalMarket_Value.Add(AppraisalsTD[2].Text);
                                    TotalMarket_Value.Add(AppraisalsTD[3].Text);
                                    TotalMarket_Value.Add(AppraisalsTD[4].Text);
                                    TotalMarket_Value.Add(AppraisalsTD[5].Text);
                                }
                                i++;
                            }
                        }
                        Appraisals_details1 = Tax_Year[0] + "~" + Improvement_Value[0] + "~" + Land_Value[0] + "~" + TotalMarket_Value[0];
                        Appraisals_details2 = Tax_Year[1] + "~" + Improvement_Value[1] + "~" + Land_Value[1] + "~" + TotalMarket_Value[1];
                        Appraisals_details3 = Tax_Year[2] + "~" + Improvement_Value[2] + "~" + Land_Value[2] + "~" + TotalMarket_Value[2];
                        Appraisals_details4 = Tax_Year[3] + "~" + Improvement_Value[3] + "~" + Land_Value[3] + "~" + TotalMarket_Value[3];
                        Appraisals_details5 = Tax_Year[4] + "~" + Improvement_Value[4] + "~" + Land_Value[4] + "~" + TotalMarket_Value[4];
                        //gc.CreatePdf(orderNumber, ParcelNo, "Appraisls Details", driver, "FL", "Palm Beach");
                        gc.insert_date(orderNumber, ParcelNo, 342, Appraisals_details1, 1, DateTime.Now);
                        gc.insert_date(orderNumber, ParcelNo, 342, Appraisals_details2, 1, DateTime.Now);
                        gc.insert_date(orderNumber, ParcelNo, 342, Appraisals_details3, 1, DateTime.Now);
                        gc.insert_date(orderNumber, ParcelNo, 342, Appraisals_details4, 1, DateTime.Now);
                        gc.insert_date(orderNumber, ParcelNo, 342, Appraisals_details5, 1, DateTime.Now);
                    }
                    catch
                    { }

                    //Assessed Details
                    try
                    {
                        IWebElement         AssessedTable = driver.FindElement(By.XPath("//*[@id='tblAssVal']/tbody"));
                        IList <IWebElement> AssessedTR    = AssessedTable.FindElements(By.TagName("tr"));
                        IList <IWebElement> AssessedTD;

                        List <string> Tax_Year         = new List <string>();
                        List <string> Assessed_Value   = new List <string>();
                        List <string> Exemption_Amount = new List <string>();
                        List <string> Taxable_Value    = new List <string>();

                        int j = 1;
                        foreach (IWebElement Assessed in AssessedTR)
                        {
                            AssessedTD = Assessed.FindElements(By.TagName("td"));
                            if (!Assessed.Text.Contains("Show 5 year"))
                            {
                                if (j == 1)
                                {
                                    Tax_Year.Add(AssessedTD[1].Text);
                                    Tax_Year.Add(AssessedTD[2].Text);
                                    Tax_Year.Add(AssessedTD[3].Text);
                                    Tax_Year.Add(AssessedTD[4].Text);
                                    Tax_Year.Add(AssessedTD[5].Text);
                                }
                                else if (j == 2)
                                {
                                    Assessed_Value.Add(AssessedTD[1].Text);
                                    Assessed_Value.Add(AssessedTD[2].Text);
                                    Assessed_Value.Add(AssessedTD[3].Text);
                                    Assessed_Value.Add(AssessedTD[4].Text);
                                    Assessed_Value.Add(AssessedTD[5].Text);
                                }
                                else if (j == 3)
                                {
                                    Exemption_Amount.Add(AssessedTD[1].Text);
                                    Exemption_Amount.Add(AssessedTD[2].Text);
                                    Exemption_Amount.Add(AssessedTD[3].Text);
                                    Exemption_Amount.Add(AssessedTD[4].Text);
                                    Exemption_Amount.Add(AssessedTD[5].Text);
                                }
                                else if (j == 4)
                                {
                                    Taxable_Value.Add(AssessedTD[1].Text);
                                    Taxable_Value.Add(AssessedTD[2].Text);
                                    Taxable_Value.Add(AssessedTD[3].Text);
                                    Taxable_Value.Add(AssessedTD[4].Text);
                                    Taxable_Value.Add(AssessedTD[5].Text);
                                }
                                j++;
                            }
                        }
                        Assessed_details1 = Tax_Year[0] + "~" + Assessed_Value[0] + "~" + Exemption_Amount[0] + "~" + Taxable_Value[0];
                        Assessed_details2 = Tax_Year[1] + "~" + Assessed_Value[1] + "~" + Exemption_Amount[1] + "~" + Taxable_Value[1];
                        Assessed_details3 = Tax_Year[2] + "~" + Assessed_Value[2] + "~" + Exemption_Amount[2] + "~" + Taxable_Value[2];
                        Assessed_details4 = Tax_Year[3] + "~" + Assessed_Value[3] + "~" + Exemption_Amount[3] + "~" + Taxable_Value[3];
                        Assessed_details5 = Tax_Year[4] + "~" + Assessed_Value[4] + "~" + Exemption_Amount[4] + "~" + Taxable_Value[4];
                        //gc.CreatePdf(orderNumber, ParcelNo, "Assessed Details", driver, "FL", "Palm Beach");
                        gc.insert_date(orderNumber, ParcelNo, 348, Assessed_details1, 1, DateTime.Now);
                        gc.insert_date(orderNumber, ParcelNo, 348, Assessed_details2, 1, DateTime.Now);
                        gc.insert_date(orderNumber, ParcelNo, 348, Assessed_details3, 1, DateTime.Now);
                        gc.insert_date(orderNumber, ParcelNo, 348, Assessed_details4, 1, DateTime.Now);
                        gc.insert_date(orderNumber, ParcelNo, 348, Assessed_details5, 1, DateTime.Now);
                    }
                    catch
                    { }
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    //TaxesValue Details
                    try
                    {
                        IWebElement         TaxesValueTable = driver.FindElement(By.XPath("//*[@id='tblTaxes']/tbody"));
                        IList <IWebElement> TaxesValueTR    = TaxesValueTable.FindElements(By.TagName("tr"));
                        IList <IWebElement> TaxesValueTD;

                        List <string> Tax_Year      = new List <string>();
                        List <string> Ad_Valorem    = new List <string>();
                        List <string> NonAd_Valorem = new List <string>();
                        List <string> Total_tax     = new List <string>();

                        int k = 1;
                        foreach (IWebElement TaxesValue in TaxesValueTR)
                        {
                            TaxesValueTD = TaxesValue.FindElements(By.TagName("td"));
                            if (!TaxesValue.Text.Contains("Show 5 year"))
                            {
                                if (k == 1)
                                {
                                    Tax_Year.Add(TaxesValueTD[1].Text);
                                    Tax_Year.Add(TaxesValueTD[2].Text);
                                    Tax_Year.Add(TaxesValueTD[3].Text);
                                    Tax_Year.Add(TaxesValueTD[4].Text);
                                    Tax_Year.Add(TaxesValueTD[5].Text);
                                }
                                else if (k == 2)
                                {
                                    Ad_Valorem.Add(TaxesValueTD[1].Text);
                                    Ad_Valorem.Add(TaxesValueTD[2].Text);
                                    Ad_Valorem.Add(TaxesValueTD[3].Text);
                                    Ad_Valorem.Add(TaxesValueTD[4].Text);
                                    Ad_Valorem.Add(TaxesValueTD[5].Text);
                                }
                                else if (k == 3)
                                {
                                    NonAd_Valorem.Add(TaxesValueTD[1].Text);
                                    NonAd_Valorem.Add(TaxesValueTD[2].Text);
                                    NonAd_Valorem.Add(TaxesValueTD[3].Text);
                                    NonAd_Valorem.Add(TaxesValueTD[4].Text);
                                    NonAd_Valorem.Add(TaxesValueTD[5].Text);
                                }
                                else if (k == 4)
                                {
                                    Total_tax.Add(TaxesValueTD[1].Text);
                                    Total_tax.Add(TaxesValueTD[2].Text);
                                    Total_tax.Add(TaxesValueTD[3].Text);
                                    Total_tax.Add(TaxesValueTD[4].Text);
                                    Total_tax.Add(TaxesValueTD[5].Text);
                                }
                                k++;
                            }
                        }
                        TaxesValue_details1 = Tax_Year[0] + "~" + Ad_Valorem[0] + "~" + NonAd_Valorem[0] + "~" + Total_tax[0];
                        TaxesValue_details2 = Tax_Year[1] + "~" + Ad_Valorem[1] + "~" + NonAd_Valorem[1] + "~" + Total_tax[1];
                        TaxesValue_details3 = Tax_Year[2] + "~" + Ad_Valorem[2] + "~" + NonAd_Valorem[2] + "~" + Total_tax[2];
                        TaxesValue_details4 = Tax_Year[3] + "~" + Ad_Valorem[3] + "~" + NonAd_Valorem[3] + "~" + Total_tax[3];
                        TaxesValue_details5 = Tax_Year[4] + "~" + Ad_Valorem[4] + "~" + NonAd_Valorem[4] + "~" + Total_tax[4];
                        //gc.CreatePdf(orderNumber, ParcelNo, "TaxValues Details", driver, "FL", "Palm Beach");
                        gc.insert_date(orderNumber, ParcelNo, 349, TaxesValue_details1, 1, DateTime.Now);
                        gc.insert_date(orderNumber, ParcelNo, 349, TaxesValue_details2, 1, DateTime.Now);
                        gc.insert_date(orderNumber, ParcelNo, 349, TaxesValue_details3, 1, DateTime.Now);
                        gc.insert_date(orderNumber, ParcelNo, 349, TaxesValue_details4, 1, DateTime.Now);
                        gc.insert_date(orderNumber, ParcelNo, 349, TaxesValue_details5, 1, DateTime.Now);
                    }
                    catch
                    { }

                    //Tax Information Details
                    driver.Navigate().GoToUrl("https://pbctax.manatron.com/Tabs/PropertyTax.aspx");
                    Thread.Sleep(2000);

                    var SelectParcel    = driver.FindElement(By.Id("selSearchBy"));
                    var SelectParcelTax = new SelectElement(SelectParcel);
                    SelectParcelTax.SelectByText("Property Control Number");

                    driver.FindElement(By.Id("fldInput")).SendKeys(ParcelNo);
                    driver.FindElement(By.Id("btnsearch")).SendKeys(Keys.Enter);
                    Thread.Sleep(2000);

                    gc.CreatePdf(orderNumber, ParcelNo, "ParcelTax Details", driver, "FL", "Palm Beach");
                    driver.FindElement(By.XPath("//*[@id='grm-search']/tbody/tr[2]/td[6]/a")).Click();
                    Thread.Sleep(2000);
                    gc.CreatePdf(orderNumber, ParcelNo, "Tax Summary Details", driver, "FL", "Palm Beach");

                    Real_Property    = driver.FindElement(By.XPath("//*[@id='lxT506']/table/tbody/tr[2]/td[2]")).Text;
                    property_Address = driver.FindElement(By.XPath("//*[@id='lxT506']/table/tbody/tr[3]/td/table/tbody/tr[1]/td[2]")).Text;
                    property_Address = WebDriverTest.After(property_Address, "Property Address:").Trim();
                    string[] linesName = property_Address.Split(stringSeparators1, StringSplitOptions.None);
                    OwnerOf_record = driver.FindElement(By.XPath("//*[@id='lxT506']/table/tbody/tr[3]/td/table/tbody/tr[2]/td[1]")).Text;
                    OwnerOf_record = WebDriverTest.After(OwnerOf_record, "Owner of Record").Trim();
                    string[] linesName1 = OwnerOf_record.Split(stringSeparators1, StringSplitOptions.None);
                    driver.Navigate().GoToUrl("https://www.pbctax.com/content/help");
                    Thread.Sleep(2000);
                    Tax_Authority = driver.FindElement(By.XPath("//*[@id='content-area']/div/div/div/div[1]/p")).Text.Replace("Mailing Address", "").Trim();
                    gc.CreatePdf(orderNumber, ParcelNo, "Tax Authority", driver, "FL", "Palm Beach");
                    driver.Navigate().Back();
                    Thread.Sleep(2000);
                    TaxBill_Details = Real_Property + "~" + property_Address + "~" + OwnerOf_record + "~" + Tax_Authority;
                    gc.insert_date(orderNumber, ParcelNo, 357, TaxBill_Details, 1, DateTime.Now);

                    //Tax Payment History Details
                    List <string> billinfo = new List <string>();
                    try
                    {
                        IWebElement         TaxPaymentTB = driver.FindElement(By.XPath("//*[@id='508']/table/tbody"));
                        IList <IWebElement> TaxPaymentTR = TaxPaymentTB.FindElements(By.TagName("tr"));
                        IList <IWebElement> TaxPaymentTD;
                        int a = 0;
                        //gc.CreatePdf(orderNumber, ParcelNo, "Tax Payment Details", driver, "FL", "Palm Beach");
                        foreach (IWebElement TaxPayment in TaxPaymentTR)
                        {
                            TaxPaymentTD = TaxPayment.FindElements(By.TagName("td"));
                            if (TaxPaymentTD.Count != 0)
                            {
                                if (a < 3)
                                {
                                    if (TaxPaymentTD.Count != 0 && !TaxPayment.Text.Contains("Bill Year"))
                                    {
                                        IWebElement value1  = TaxPaymentTD[0].FindElement(By.TagName("a"));
                                        string      addview = value1.GetAttribute("href");
                                        billinfo.Add(addview);
                                    }
                                    a++;
                                }
                                Bill_Year         = TaxPaymentTD[0].Text;
                                Bill_Type         = TaxPaymentTD[1].Text;
                                Bill_Number       = TaxPaymentTD[2].Text;
                                Gross_Tax         = TaxPaymentTD[3].Text;
                                Penalty_Fees      = TaxPaymentTD[4].Text;
                                Interest          = TaxPaymentTD[5].Text;
                                Discount          = TaxPaymentTD[6].Text;
                                Amount_Due        = TaxPaymentTD[7].Text;
                                TaxpaymentDetails = Bill_Year + "~" + Bill_Type + "~" + Bill_Number + "~" + Gross_Tax + "~" + Penalty_Fees + "~" + Interest + "~" + Discount + "~" + Amount_Due;
                                gc.insert_date(orderNumber, ParcelNo, 359, TaxpaymentDetails, 1, DateTime.Now);
                            }
                        }
                    }
                    catch
                    { }
                    //Tax Bill
                    int s = 0;
                    foreach (string taxinfoclick in billinfo)
                    {
                        try
                        {
                            driver.Navigate().GoToUrl(taxinfoclick);
                            Thread.Sleep(2000);
                            gc.CreatePdf(orderNumber, ParcelNo, "TaxBill_priorYear" + s, driver, "FL", "Palm Beach");
                            Billtaxyear = driver.FindElement(By.XPath("//*[@id='lxT538']/h1")).Text.Replace("Bill Detail", "").Trim();
                            //Tax And Assement Details//
                            IWebElement         TaxAssementTB = driver.FindElement(By.XPath("//*[@id='dnn_ContentPane']/div[4]"));
                            IList <IWebElement> TaxAssementTR = TaxAssementTB.FindElements(By.TagName("tr"));
                            IList <IWebElement> TaxAssementTD;
                            int taxrowcount = TaxAssementTR.Count;
                            int b           = 1; /*string pathid = "";*/
                            foreach (IWebElement TaxAssement in TaxAssementTR)
                            {
                                TaxAssementTD = TaxAssement.FindElements(By.TagName("td"));
                                if (TaxAssement.Text.Contains("Ad Valorem"))
                                {
                                    Tax_Type = "Ad Valorem";
                                }
                                if (TaxAssement.Text.Contains("Non Ad Valorem"))
                                {
                                    Tax_Type = "Non Ad Valorem";
                                }

                                if (TaxAssementTD.Count != 0 && !TaxAssement.Text.Contains("Ad Valorem") && TaxAssement.Text != "" && TaxAssementTD.Count != 1 && !TaxAssement.Text.Contains("Non Ad Valorem"))
                                {
                                    if (TaxAssementTD.Count == 4 && !TaxAssement.Text.Contains("Total Tax"))
                                    {
                                        Description         = "Sub Total";
                                        TaxGross_Tax        = TaxAssementTD[0].Text;
                                        Credit              = TaxAssementTD[1].Text;
                                        Net_Tax             = TaxAssementTD[2].Text;
                                        Savings             = TaxAssementTD[3].Text;
                                        TaxAssement_Details = Billtaxyear + "~" + Tax_Type + "~" + Description + "~" + TaxGross_Tax + "~" + Credit + "~" + Net_Tax + "~" + Savings;
                                        gc.insert_date(orderNumber, ParcelNo, 363, TaxAssement_Details, 1, DateTime.Now);
                                    }
                                    else
                                    {
                                        if (b % 2 == 0 && b != taxrowcount)
                                        {
                                            try
                                            {
                                                //pathid = driver.FindElement(By.XPath("//*[@id='lxT512']/table/tbody/tr["+ b +"]/td[1]")).GetAttribute("tb");
                                                driver.FindElement(By.XPath("//*[@id='lxT512']/table/tbody/tr[" + b + "]/td[1]/a")).SendKeys(Keys.Enter);
                                                Thread.Sleep(2000);
                                                //gc.CreatePdf(orderNumber, ParcelNo, "Ad Valorem and Non Ad Valorem" + b, driver, "FL", "Palm Beach");
                                            }
                                            catch
                                            {
                                            }
                                            Description         = TaxAssementTD[0].Text;
                                            TaxGross_Tax        = TaxAssementTD[1].Text;
                                            Credit              = TaxAssementTD[2].Text;
                                            Net_Tax             = TaxAssementTD[3].Text;
                                            Savings             = TaxAssementTD[4].Text;
                                            TaxAssement_Details = Billtaxyear + "~" + Tax_Type + "~" + Description + "~" + TaxGross_Tax + "~" + Credit + "~" + Net_Tax + "~" + Savings;
                                            gc.insert_date(orderNumber, ParcelNo, 363, TaxAssement_Details, 1, DateTime.Now);
                                            Description = ""; TaxGross_Tax = ""; Credit = ""; Net_Tax = ""; Savings = "";
                                        }
                                    }
                                    if (TaxAssement.Text.Contains("Total Tax") && !TaxAssement.Text.Contains("Sub Total"))
                                    {
                                        Description  = "Total Tax";
                                        TaxGross_Tax = TaxAssementTD[0].Text;
                                        Credit       = TaxAssementTD[1].Text;
                                        Net_Tax      = TaxAssementTD[2].Text;
                                        if (Tax_Type == "Non Ad Valorem")
                                        {
                                            amck.Instamount1 = Net_Tax;
                                        }
                                        Savings             = TaxAssementTD[3].Text;
                                        TaxAssement_Details = Billtaxyear + "~" + Tax_Type + "~" + Description + "~" + TaxGross_Tax + "~" + Credit + "~" + Net_Tax + "~" + Savings;
                                        gc.insert_date(orderNumber, ParcelNo, 363, TaxAssement_Details, 1, DateTime.Now);
                                    }
                                }
                                b++;
                            }
                        }
                        catch { }
                        gc.CreatePdf(orderNumber, ParcelNo, "Ad Valorem and Non Ad Valorem" + Billtaxyear, driver, "FL", "Palm Beach");
                        //Tax Installment Details

                        try
                        {
                            IWebElement         TaxInstallmentTB = driver.FindElement(By.XPath("//*[@id='dnn_ContentPane']/div[5]"));
                            IList <IWebElement> TaxInstallmentTR = TaxInstallmentTB.FindElements(By.TagName("tr"));
                            IList <IWebElement> TaxInstallmentTD;

                            foreach (IWebElement TaxInstallment in TaxInstallmentTR)
                            {
                                TaxInstallmentTD = TaxInstallment.FindElements(By.TagName("td"));

                                if (TaxInstallmentTD.Count != 0 && !TaxInstallment.Text.Contains("Period"))
                                {
                                    if (TaxInstallmentTD[0].Text.Trim() == "Total Due:")
                                    {
                                        Period     = "";
                                        BillNumber = "";
                                        Due_Date   = "";
                                        BillYear   = TaxInstallmentTD[0].Text;
                                        Tax        = TaxInstallmentTD[1].Text;
                                        Discount1  = TaxInstallmentTD[2].Text;
                                        Penality   = TaxInstallmentTD[3].Text;
                                        Interest1  = TaxInstallmentTD[4].Text;
                                        Total_Due  = TaxInstallmentTD[5].Text;
                                        if (s == 0)
                                        {
                                            if (TaxInstallmentTR.Count == 3)
                                            {
                                                if (Total_Due == "$0.00")
                                                {
                                                    amck.IsDelinquent = "No";
                                                    amck.InstPaidDue1 = "Paid";
                                                    gc.InsertAmrockTax(orderNumber, amck.TaxId, amck.Instamount1, amck.Instamount2, amck.Instamount3, amck.Instamount4, amck.Instamountpaid1, amck.Instamountpaid2, amck.Instamountpaid3, amck.Instamountpaid4, amck.InstPaidDue1, amck.InstPaidDue2, amck.instPaidDue3, amck.instPaidDue4, amck.IsDelinquent);
                                                }
                                                else if (Total_Due != "$0.00" && Interest1 != "$0.00")
                                                {
                                                    amck.IsDelinquent = "Yes";
                                                    amck.InstPaidDue1 = "Due";
                                                    gc.InsertAmrockTax(orderNumber, amck.TaxId, amck.Instamount1, amck.Instamount2, amck.Instamount3, amck.Instamount4, amck.Instamountpaid1, amck.Instamountpaid2, amck.Instamountpaid3, amck.Instamountpaid4, amck.InstPaidDue1, amck.InstPaidDue2, amck.instPaidDue3, amck.instPaidDue4, amck.IsDelinquent);
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        Period     = TaxInstallmentTD[0].Text;
                                        BillNumber = TaxInstallmentTD[1].Text;
                                        Due_Date   = TaxInstallmentTD[2].Text;
                                        BillYear   = TaxInstallmentTD[3].Text;
                                        if (BillYear != "")
                                        {
                                            amck.TaxYear = BillYear;
                                        }
                                        Tax       = TaxInstallmentTD[4].Text;
                                        Discount1 = TaxInstallmentTD[5].Text;
                                        Penality  = TaxInstallmentTD[6].Text;
                                        Interest1 = TaxInstallmentTD[7].Text;
                                        Total_Due = TaxInstallmentTD[8].Text;
                                    }

                                    TaxInstallmentDetails = Period + "~" + BillNumber + "~" + Due_Date + "~" + BillYear + "~" + Tax + "~" + Discount1 + "~" + Penality + "~" + Interest1 + "~" + Total_Due;
                                    gc.insert_date(orderNumber, ParcelNo, 361, TaxInstallmentDetails, 1, DateTime.Now);
                                }
                            }
                        }
                        catch
                        { }
                        //Tax Payment details
                        try
                        {
                            IWebElement         PaymentTB = driver.FindElement(By.XPath("//*[@id='dnn_ContentPane']/div[7]"));
                            IList <IWebElement> PaymentTR = PaymentTB.FindElements(By.TagName("tr"));
                            IList <IWebElement> PaymentTD;

                            foreach (IWebElement Payment in PaymentTR)
                            {
                                PaymentTD = Payment.FindElements(By.TagName("td"));

                                if (PaymentTD.Count != 0 && !Payment.Text.Contains("Bill Year"))
                                {
                                    Payment_BillYear   = PaymentTD[0].Text;
                                    Payment_BillNumber = PaymentTD[1].Text;
                                    Receipt_Number     = PaymentTD[2].Text;
                                    Amount_Paid        = PaymentTD[3].Text;
                                    if (Amount_Paid != "")
                                    {
                                        amck.Instamountpaid1 = Amount_Paid;
                                    }
                                    Last_Paid = PaymentTD[4].Text;
                                    Paid_By   = PaymentTD[5].Text;

                                    Payment_Details = Payment_BillYear + "~" + Payment_BillNumber + "~" + Receipt_Number + "~" + Amount_Paid + "~" + Last_Paid + "~" + Paid_By;
                                    gc.insert_date(orderNumber, ParcelNo, 362, Payment_Details, 1, DateTime.Now);
                                }
                            }
                        }
                        catch
                        { }
                        //Tax Bill Dowload
                        try
                        {
                            IWebElement         taxinfotable = driver.FindElement(By.XPath("//*[@id='lxT538']/p"));
                            IList <IWebElement> viwetaxbill  = taxinfotable.FindElements(By.TagName("a"));
                            foreach (IWebElement taxyearelement in viwetaxbill)
                            {
                                if (taxyearelement.Text.Contains("Print Tax Bill"))
                                {
                                    string viewhref = taxyearelement.GetAttribute("href");
                                    gc.downloadfile(viewhref, orderNumber, ParcelNo, "ViewTaxBill.pdf" + s, "FL", "Palm Beach");
                                }
                            }
                            s++;
                        }
                        catch { }
                    }
                    TaxTime     = DateTime.Now.ToString("HH:mm:ss");
                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");


                    gc.insert_TakenTime(orderNumber, "FL", "Palm Beach", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    //megrge pdf files
                    gc.mergpdf(orderNumber, "FL", "Palm Beach");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    throw ex;
                }
            }
        }
Example #9
0
        public string FTP_OKTulsa(string houseno, string sname, string direction, string sttype, string parcelNumber, string searchType, string accountnumber, string orderNumber, string ownername, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";

            sname = sname + sttype;
            var driverService      = PhantomJSDriverService.CreateDefaultService();
            IJavaScriptExecutor js = driver as IJavaScriptExecutor;

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())
            //driver = new ChromeDriver();
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");
                    if (searchType == "titleflex")
                    {
                        string address = houseno + " " + direction + " " + sname + " " + accountnumber;
                        gc.TitleFlexSearch(orderNumber, parcelNumber, "", address, "OK", "Tulsa");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_OKTulsa"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }
                    driver.Navigate().GoToUrl("http://www.assessor.tulsacounty.org/assessor-property-search.php");
                    try
                    {
                        driver.FindElement(By.XPath("//*[@id='content']/form/button[1]")).SendKeys(Keys.Enter);
                    }
                    catch { }

                    if (searchType == "address")
                    {
                        IWebElement add = driver.FindElement(By.XPath("//*[@id='srchaddr']/label"));
                        add.Click();
                        driver.FindElement(By.Id("streetno")).SendKeys(houseno);
                        driver.FindElement(By.XPath("//*[@id='propertysearches']/div[2]/p[1]/select[1]")).SendKeys(direction);

                        driver.FindElement(By.Id("streetname")).SendKeys(sname);
                        driver.FindElement(By.Id("bttnaddr")).SendKeys(Keys.Enter);
                        gc.CreatePdf_WOP(orderNumber, "Address search result", driver, "OK", "Tulsa");
                        try
                        {
                            string mul = driver.FindElement(By.XPath("//*[@id='pickone_info']")).Text;
                            mul = WebDriverTest.After(mul, "to");
                            mul = WebDriverTest.Before(mul, "of").Trim();

                            if ((mul != "1") && (mul != "0"))
                            {
                                //multi parcel
                                IWebElement         tbmulti = driver.FindElement(By.XPath("//*[@id='pickone']/tbody"));
                                IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));

                                IList <IWebElement> TDmulti;
                                foreach (IWebElement row in TRmulti)
                                {
                                    TDmulti = row.FindElements(By.TagName("td"));
                                    if (TDmulti.Count != 0)
                                    {
                                        string multi = TDmulti[0].Text + "~" + TDmulti[1].Text + "~" + TDmulti[2].Text + "~" + TDmulti[3].Text + "~" + TDmulti[4].Text + "~" + TDmulti[5].Text;
                                        gc.insert_date(orderNumber, TDmulti[0].Text, 109, multi, 1, DateTime.Now);
                                    }
                                }

                                gc.CreatePdf_WOP(orderNumber, "Multiparcel Address Search", driver, "OK", "Tulsa");
                                HttpContext.Current.Session["multiparcel_Tulsa"] = "Yes";
                                if (TRmulti.Count > 25)
                                {
                                    HttpContext.Current.Session["multiparcel_Tulsa_count"] = "Maximum";
                                }
                                driver.Quit();
                                return("MultiParcel");
                            }
                        }

                        catch { }
                    }

                    else if (searchType == "parcel")
                    {
                        driver.FindElement(By.XPath("//*[@id='srchprcl']")).Click();
                        driver.FindElement(By.Id("parcel")).SendKeys(parcelNumber);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search", driver, "OK", "Tulsa");
                        driver.FindElement(By.Id("bttnprcl")).SendKeys(Keys.Enter);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search result", driver, "OK", "Tulsa");
                    }

                    else if (searchType == "block")
                    {
                        driver.FindElement(By.XPath("//*[@id='srchacct']/label")).Click();
                        driver.FindElement(By.Id("account")).SendKeys(accountnumber);
                        gc.CreatePdf_WOP(orderNumber, "Account Number search", driver, "OK", "Tulsa");
                        driver.FindElement(By.Id("bttnacct")).SendKeys(Keys.Enter);
                        gc.CreatePdf_WOP(orderNumber, "Account Number result search", driver, "OK", "Tulsa");
                    }

                    else if (searchType == "ownername")
                    {
                        string[] on     = ownername.Split(' ');
                        string   first  = on[0];
                        string   second = on[1];
                        //ownername = second + " " + first;

                        driver.FindElement(By.XPath("//*[@id='srchprsn']/label")).Click();
                        driver.FindElement(By.Id("ln")).SendKeys(first);
                        driver.FindElement(By.Id("fn")).SendKeys(second);
                        gc.CreatePdf_WOP(orderNumber, "Owner Name search", driver, "OK", "Tulsa");
                        driver.FindElement(By.Id("bttnprsn")).SendKeys(Keys.Enter);
                        gc.CreatePdf_WOP(orderNumber, "Owner Name search result", driver, "OK", "Tulsa");

                        try
                        {
                            string mul = driver.FindElement(By.XPath("//*[@id='pickone_info']")).Text;
                            mul = WebDriverTest.After(mul, "to");
                            mul = WebDriverTest.Before(mul, "of").Trim();

                            if ((mul != "1") && (mul != "0"))
                            {
                                //multi parcel
                                IWebElement         tbmulti = driver.FindElement(By.XPath("//*[@id='pickone']/tbody"));
                                IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));

                                IList <IWebElement> TDmulti;
                                foreach (IWebElement row in TRmulti)
                                {
                                    TDmulti = row.FindElements(By.TagName("td"));
                                    if (TDmulti.Count != 0)
                                    {
                                        string multi = TDmulti[0].Text + "~" + TDmulti[1].Text + "~" + TDmulti[2].Text + "~" + TDmulti[3].Text + "~" + TDmulti[4].Text + "~" + TDmulti[5].Text;
                                        gc.insert_date(orderNumber, TDmulti[0].Text, 109, multi, 1, DateTime.Now);
                                    }
                                }
                            }

                            gc.CreatePdf_WOP(orderNumber, " Multi Parcel Owner Name search", driver, "OK", "Tulsa");
                            HttpContext.Current.Session["multiparcel_Tulsa"] = "Yes";

                            driver.Quit();
                            return("MultiParcel");
                        }

                        catch { }
                    }

                    try
                    {
                        IWebElement INodata = driver.FindElement(By.XPath("//*[@id='content']/p[4]"));
                        if (INodata.Text.Contains("No properties were found"))
                        {
                            HttpContext.Current.Session["Nodata_OKTulsa"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }

                    Thread.Sleep(4000);
                    //Assessment Information
                    string Parcel_No = "-", Account_No = "-", Owner_Name = "-", Property_Address = "-", Mailing_Address = "-", Legal_Description = "-", Year_Built = "-";
                    string fullqucikfacts = driver.FindElement(By.XPath("//*[@id='quick']/table/tbody")).Text;
                    //Parcel_No = driver.FindElement(By.XPath("//*[@id='quick']/table/tbody/tr[1]/td[2]")).Text;
                    Parcel_No  = gc.Between(fullqucikfacts, "Parcel #", "Situs address").Trim();
                    amck.TaxId = Parcel_No;
                    //Account_No = driver.FindElement(By.XPath("//*[@id='quick']/table/tbody/tr[1]/td[2]")).Text;
                    Account_No = gc.Between(fullqucikfacts, "Account #", "Parcel #").Trim();
                    //Owner_Name = driver.FindElement(By.XPath("//*[@id='quick']/table/tbody/tr[4]/td[2]")).Text;
                    Owner_Name = gc.Between(fullqucikfacts, "Owner name", "Fair cash").Trim();
                    //Property_Address = driver.FindElement(By.XPath("//*[@id='quick']/table/tbody/tr[3]/td[2]/text()")).Text;
                    Property_Address  = gc.Between(fullqucikfacts, "Situs address", "Owner name").Trim();
                    Legal_Description = GlobalClass.After(fullqucikfacts, "Legal description");
                    string legalmailtext = driver.FindElement(By.XPath("//*[@id='general']/table/tbody")).Text;
                    // Mailing_Address = driver.FindElement(By.XPath("//*[@id='general']/table/tbody/tr[3]/td[2]/text()[1]")).Text;
                    Mailing_Address = gc.Between(legalmailtext, "Owner mailing address", "Land area");
                    //Legal_Description = driver.FindElement(By.XPath("//*[@id='quick']/table/tbody/tr[7]/td[2]/text()[2]")).Text;

                    try
                    {
                        Year_Built = driver.FindElement(By.XPath("//*[@id='improvements']/table/tbody/tr/td[5]")).Text;
                    }
                    catch { }


                    if (Mailing_Address.Contains("\r\n"))
                    {
                        Mailing_Address = Mailing_Address.Replace("\r\n", "");
                    }

                    if (Legal_Description.Contains("\r\n"))
                    {
                        Legal_Description = Legal_Description.Replace("\r\n", "");
                    }
                    string prop = Account_No + "~" + Owner_Name + "~" + Property_Address + "~" + Mailing_Address + "~" + Legal_Description + "~" + Year_Built;
                    gc.insert_date(orderNumber, Parcel_No, 111, prop, 1, DateTime.Now);


                    //Assessment information
                    //insert year

                    string              AssessedYear = "", MarketValue = "", Totaltaxablevalue = "", AssessmentRatio = "", GrossAssessed = "", Exemptions = "", NetAssessed = "", LandValue = "", Improvementsvalue = "", Homestead = "", AdditionalHomestead = "", SeniorValuationLimitation = "", Veteran = "";
                    IWebElement         TBTax = driver.FindElement(By.XPath("//*[@id='tax']/table"));
                    IList <IWebElement> TRTax = TBTax.FindElements(By.TagName("tr"));
                    IList <IWebElement> THTax;
                    foreach (IWebElement row1 in TRTax)
                    {
                        THTax = row1.FindElements(By.TagName("th"));
                        if (THTax.Count != 0)
                        {
                            AssessedYear = THTax[1].Text + "~" + THTax[2].Text;
                        }
                        else
                        {
                            THTax = row1.FindElements(By.TagName("td"));
                            if (THTax.Count != 0 && THTax.Count != 1 && THTax.Count != 2)
                            {
                                MarketValue       = THTax[1].Text + "~" + THTax[2].Text;
                                Totaltaxablevalue = THTax[1].Text + "~" + THTax[2].Text;
                                AssessmentRatio   = THTax[1].Text + "~" + THTax[2].Text;
                                GrossAssessed     = THTax[1].Text + "~" + THTax[2].Text;
                                Exemptions        = THTax[1].Text + "~" + THTax[2].Text;
                                NetAssessed       = THTax[1].Text + "~" + THTax[2].Text;
                            }
                        }
                    }
                    IWebElement         TBTax1 = driver.FindElement(By.XPath("//*[@id='value']/table"));
                    IList <IWebElement> TRTax1 = TBTax1.FindElements(By.TagName("tr"));
                    IList <IWebElement> THTax1;
                    foreach (IWebElement row1 in TRTax1)
                    {
                        THTax1 = row1.FindElements(By.TagName("th"));
                        if (THTax1.Count != 0)
                        {
                            AssessedYear = THTax1[1].Text + "~" + THTax1[2].Text;
                        }
                        else
                        {
                            THTax1 = row1.FindElements(By.TagName("td"));
                            if (THTax1.Count != 0)
                            {
                                LandValue         = THTax1[1].Text + "~" + THTax1[2].Text;
                                Improvementsvalue = THTax1[1].Text + "~" + THTax1[2].Text;
                            }
                        }
                    }
                    IWebElement         TBTax2 = driver.FindElement(By.XPath("//*[@id='adjustments']/table"));
                    IList <IWebElement> TRTax2 = TBTax2.FindElements(By.TagName("tr"));
                    IList <IWebElement> THTax2;
                    foreach (IWebElement row1 in TRTax1)
                    {
                        THTax2 = row1.FindElements(By.TagName("th"));
                        if (THTax2.Count != 0)
                        {
                            AssessedYear = THTax2[1].Text + "~" + THTax2[2].Text;
                        }
                        else
                        {
                            THTax2 = row1.FindElements(By.TagName("td"));
                            if (THTax2.Count != 0)
                            {
                                Homestead                 = THTax2[1].Text + "~" + THTax2[2].Text;
                                AdditionalHomestead       = THTax2[1].Text + "~" + THTax2[2].Text;
                                SeniorValuationLimitation = THTax2[1].Text + "~" + THTax2[2].Text;
                                Veteran = THTax2[1].Text + "~" + THTax2[2].Text;
                            }
                        }
                    }



                    var split1  = AssessedYear.Split('~');
                    var split2  = MarketValue.Split('~');
                    var split3  = Totaltaxablevalue.Split('~');
                    var split4  = AssessmentRatio.Split('~');
                    var split5  = GrossAssessed.Split('~');
                    var split6  = Exemptions.Split('~');
                    var split7  = NetAssessed.Split('~');
                    var split8  = LandValue.Split('~');
                    var split9  = Improvementsvalue.Split('~');
                    var split10 = Homestead.Split('~');
                    var split11 = AdditionalHomestead.Split('~');
                    var split12 = SeniorValuationLimitation.Split('~');
                    var split13 = Veteran.Split('~');
                    for (int I = 0; split1.Length > I; I++)
                    {
                        string AssessDetail = split1[I] + "~" + split2[I] + "~" + split3[I] + "~" + split4[I] + "~" + split5[I] + "~" + split6[I] + "~" + split7[I] + "~" + split8[I] + "~" + split9[I] + "~" + split10[I] + "~" + split11[I] + "~" + split12[I] + "~" + split13[I];
                        gc.insert_date(orderNumber, Parcel_No, 112, AssessDetail, 1, DateTime.Now);
                    }
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    //insert tax information of assessment
                    //IWebElement TBTax3 = driver.FindElement(By.XPath("//*[@id='tax']/table/tbody"));
                    //IList<IWebElement> TRTax3 = TBTax1.FindElements(By.TagName("tr"));
                    //IList<IWebElement> TDTax3;
                    //foreach (IWebElement row1 in TRTax3)
                    //{
                    //    if (!row1.Text.Contains("Tax rate") && !row1.Text.Contains("Estimated taxes") && !row1.Text.Contains("Most recent"))
                    //    {
                    //        TDTax3 = row1.FindElements(By.TagName("td"));
                    //        string t_val = TDTax3[0].Text + "~" + TDTax3[1].Text + "~" + TDTax3[2].Text;
                    //        gc.insert_date(orderNumber, Parcel_No, 112, t_val, 1, DateTime.Now);
                    //    }

                    //}

                    //Values
                    //IWebElement TBval = driver.FindElement(By.XPath("//*[@id='value']/table/tbody"));
                    //IList<IWebElement> TRVal = TBval.FindElements(By.TagName("tr"));
                    //IList<IWebElement> TDVal;
                    //foreach (IWebElement row1 in TRVal)
                    //{
                    //    TDVal = row1.FindElements(By.TagName("td"));
                    //    string val = TDVal[0].Text + "~" + TDVal[1].Text + "~" + TDVal[2].Text;
                    //    gc.insert_date(orderNumber, Parcel_No, 112, val, 1, DateTime.Now);
                    //}

                    //Exemptions claimed
                    //IWebElement TBexe = driver.FindElement(By.XPath("//*[@id='adjustments']/table/tbody"));
                    //IList<IWebElement> TRexe = TBexe.FindElements(By.TagName("tr"));
                    //IList<IWebElement> TDexe;
                    //foreach (IWebElement row1 in TRexe)
                    //{
                    //    TDexe = row1.FindElements(By.TagName("td"));
                    //    string exe = TDexe[0].Text + "~" + TDexe[1].Text + "~" + TDexe[2].Text;
                    //    gc.insert_date(orderNumber, Parcel_No, 112, exe, 1, DateTime.Now);
                    //}

                    //Tax Account Details
                    driver.Navigate().GoToUrl("http://www.treasurer.tulsacounty.org/");
                    Thread.Sleep(4000);
                    IWebElement iframe = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/iframe"));
                    driver.SwitchTo().Frame(iframe);
                    IWebElement frame1 = driver.FindElement(By.XPath("/html/frameset/frameset/frame[1]"));
                    driver.SwitchTo().Frame(frame1);
                    driver.FindElement(By.XPath("/html/body/div[1]/div[6]")).Click();
                    driver.SwitchTo().DefaultContent();
                    Thread.Sleep(4000);
                    driver.SwitchTo().Frame(iframe);
                    IWebElement frame2 = driver.FindElement(By.XPath("/html/frameset/frameset/frame[2]"));
                    driver.SwitchTo().Frame("main_frame");
                    driver.FindElement(By.XPath("//*[@id='HyperLink1']")).SendKeys(Keys.Enter);
                    Thread.Sleep(4000);


                    if (Parcel_No.Contains("-"))
                    {
                        string[] s = Parcel_No.Split('-');
                        Parcel_No = s[0] + s[1] + s[2] + s[3];
                    }


                    driver.FindElement(By.XPath("//*[@id='tb_PN']")).SendKeys(Parcel_No);
                    gc.CreatePdf(orderNumber, Parcel_No, "ImputPassed TaxSearch", driver, "OK", "Tulsa");
                    driver.FindElement(By.XPath("//*[@id='Button2']")).SendKeys(Keys.Enter);
                    gc.CreatePdf(orderNumber, Parcel_No, "TaxSearch Result", driver, "OK", "Tulsa");
                    string              Parcel_ID = "-", t_Owner_Name = "-", T_Property_Address = "-", Tax_Year = "-", Tax_Type = "-", Tax_Amount = "-", Tax_Balance = "-", Interest = "-", Costs = "-", Total_Due = "-", Paid_Date = "-", Tax_Amount_Paid = "-", Interest_Paid = "-", Costs_Paid = "-", Total_Paid = "-", Reference_Number = "-", Paid_By = "-", Taxing_Authority = "-";
                    IWebElement         TBtx = driver.FindElement(By.XPath("/html/body/form/div[3]/table[2]/tbody/tr[1]/td/table/tbody"));
                    IList <IWebElement> TRtx = TBtx.FindElements(By.TagName("tr"));
                    int count = TRtx.Count;
                    for (int a = 2; a <= count; a++)
                    {
                        IWebElement tx = driver.FindElement(By.XPath("/html/body/form/div[3]/table[2]/tbody/tr[1]/td/table/tbody/tr[" + a + "]/td[6]/a[1]"));
                        tx.SendKeys(Keys.Enter);
                        Thread.Sleep(3000);

                        Parcel_ID          = driver.FindElement(By.XPath("//*[@id='form1']/div[3]/div[2]/table/tbody/tr/td/table[2]/tbody/tr[1]/td/table[1]/tbody/tr/td[2]/span")).Text;
                        t_Owner_Name       = driver.FindElement(By.XPath("/html/body/form/div[3]/div[2]/table/tbody/tr/td/table[2]/tbody/tr[3]/td/table/tbody/tr[1]/td[1]/table/tbody/tr[3]/td/span")).Text;
                        T_Property_Address = driver.FindElement(By.XPath("/html/body/form/div[3]/div[2]/table/tbody/tr/td/table[2]/tbody/tr[3]/td/table/tbody/tr[2]/td/table[3]/tbody/tr/td[2]/span")).Text;
                        Tax_Year           = driver.FindElement(By.XPath("/html/body/form/div[3]/div[2]/table/tbody/tr/td/table[1]/tbody/tr[1]/td/table/tbody/tr[2]/td/span")).Text;
                        var s = Tax_Year;
                        var firstSpaceIndex = s.IndexOf(" ");
                        var firstString     = s.Substring(0, firstSpaceIndex); // INAGX4
                        var secondString    = s.Substring(firstSpaceIndex + 1);
                        Tax_Year     = firstString;
                        amck.TaxYear = Tax_Year;
                        gc.CreatePdf(orderNumber, Parcel_No, "Detailed Tax Information" + Tax_Year, driver, "OK", "Tulsa");


                        try
                        {
                            string taxalert = driver.FindElement(By.XPath("//*[@id='lblmsgtxt']")).Text;
                            if (taxalert.Contains("Please call "))
                            {
                                gc.insert_date(orderNumber, Parcel_No, 1872, taxalert.Replace("/r/n", ""), 1, DateTime.Now);
                                HttpContext.Current.Session["Taxalert_Tulsa"] = "Yes";
                                driver.Quit();
                                // return "'" + taxalert + "'";
                                return("Data Inserted Successfully");
                            }
                        }
                        catch
                        {
                        }
                        try
                        {
                            Tax_Type         = secondString;
                            Tax_Amount       = driver.FindElement(By.XPath("/html/body/form/div[3]/div[2]/table/tbody/tr/td/table[3]/tbody/tr[2]/td/table/tbody/tr[5]/td[2]/span")).Text;
                            amck.Instamount1 = Tax_Amount;
                            Tax_Balance      = driver.FindElement(By.XPath("/html/body/form/div[3]/div[2]/table/tbody/tr/td/table[3]/tbody/tr[2]/td/table/tbody/tr[9]/td[2]/span")).Text;
                            Interest         = driver.FindElement(By.XPath("/html/body/form/div[3]/div[2]/table/tbody/tr/td/table[3]/tbody/tr[2]/td/table/tbody/tr[10]/td[2]/span")).Text;
                            Costs            = driver.FindElement(By.XPath("/html/body/form/div[3]/div[2]/table/tbody/tr/td/table[3]/tbody/tr[2]/td/table/tbody/tr[11]/td[2]")).Text;
                            Total_Due        = driver.FindElement(By.XPath("/html/body/form/div[3]/div[2]/table/tbody/tr/td/table[3]/tbody/tr[2]/td/table/tbody/tr[12]/td[2]/span")).Text;

                            string ta  = driver.FindElement(By.XPath("/html/body/form/div[3]/div[1]/table/tbody/tr[2]/td")).Text;
                            string ta1 = driver.FindElement(By.XPath("/html/body/form/div[3]/div[1]/table/tbody/tr[3]/td")).Text;
                            string ta2 = driver.FindElement(By.XPath("/html/body/form/div[3]/div[1]/table/tbody/tr[4]")).Text;
                            Taxing_Authority = ta + ta1 + ta2;
                        }
                        catch
                        {
                        }
                        int    k = 0;
                        string totalpaid1 = "", totalpaid2 = "";
                        try
                        {
                            IWebElement         TBtax = driver.FindElement(By.XPath("/html/body/form/div[3]/div[2]/table/tbody/tr/td/table[4]/tbody/tr[1]/td/table[2]/tbody"));
                            IList <IWebElement> TRtax = TBtax.FindElements(By.TagName("tr"));
                            IList <IWebElement> TDtax;
                            foreach (IWebElement row1 in TRtax)
                            {
                                if (!row1.Text.Contains("Seq#"))
                                {
                                    TDtax                = row1.FindElements(By.TagName("td"));
                                    Paid_Date            = TDtax[1].Text;
                                    Tax_Amount_Paid      = TDtax[2].Text;
                                    Interest_Paid        = TDtax[3].Text;
                                    Costs_Paid           = TDtax[4].Text;
                                    Total_Paid           = TDtax[5].Text;
                                    amck.Instamountpaid1 = Total_Paid;
                                    Reference_Number     = TDtax[6].Text;
                                    Paid_By              = TDtax[7].Text;
                                    string tax_auth = t_Owner_Name + "~" + T_Property_Address + "~" + Tax_Year + "~" + Tax_Type + "~" + Tax_Amount + "~" + Tax_Balance + "~" + Interest + "~" + Costs + "~" + Total_Due + "~" + Taxing_Authority + "~" + Paid_Date + "~" + Tax_Amount_Paid + "~" + Interest_Paid + "~" + Costs_Paid + "~" + Total_Paid + "~" + Reference_Number + "~" + Paid_By;
                                    gc.insert_date(orderNumber, Parcel_ID, 116, tax_auth, 1, DateTime.Now);
                                    if (k == 0)
                                    {
                                        totalpaid1 = Total_Paid;
                                    }
                                    if (k == 1)
                                    {
                                        totalpaid2 = Total_Paid;
                                        if (totalpaid1 == totalpaid2)
                                        {
                                            amck.IsDelinquent = "Yes";
                                        }
                                    }
                                    k++;
                                }
                            }
                        }
                        catch
                        {
                        }

                        string Deli_invoice = "";
                        if (a == 2)
                        {
                            try
                            {
                                Deli_invoice = driver.FindElement(By.XPath("//*[@id='form1']/div[3]/div[2]/table/tbody/tr/td/table[3]/tbody/tr[2]/td/table/tbody/tr[9]/td[3]/span")).Text;
                            }
                            catch { }
                            if (Deli_invoice.Contains("INVOICE-NO"))
                            {
                                amck.IsDelinquent = "Yes";
                            }
                            else
                            {
                                if (Tax_Amount == Total_Paid)
                                {
                                    amck.InstPaidDue1 = "Paid";
                                    amck.IsDelinquent = "No";
                                }
                                else if (Total_Due != "$0.00" && Total_Due == Tax_Amount)
                                {
                                    amck.InstPaidDue1 = "Due";
                                    amck.IsDelinquent = "No";
                                }
                                else
                                {
                                    amck.IsDelinquent = "Yes";
                                }
                            }

                            if (amck.IsDelinquent != "Yes")
                            {
                                gc.InsertAmrockTax(orderNumber, amck.TaxId, amck.Instamount1, amck.Instamount2, amck.Instamount3, amck.Instamount4, amck.Instamountpaid1, amck.Instamountpaid2, amck.Instamountpaid3, amck.Instamountpaid4, amck.InstPaidDue1, amck.InstPaidDue2, amck.instPaidDue3, amck.instPaidDue4, amck.IsDelinquent);
                            }
                            else
                            {
                                gc.InsertAmrockTax(orderNumber, amck.TaxId, null, null, null, null, null, null, null, null, null, null, null, null, amck.IsDelinquent);
                            }
                        }


                        driver.FindElement(By.XPath("/html/body/form/div[3]/div[2]/table/tbody/tr/td/table[2]/tbody/tr[1]/td/table[1]/tbody/tr/td[3]/span/a[1]")).SendKeys(Keys.Enter);
                        Thread.Sleep(4000);
                        gc.CreatePdf(orderNumber, Parcel_No, "Tax History details", driver, "OK", "Tulsa");
                        //Tax History
                        string              Tax_Roll_Number = "-", Tax_Amount_T = "-", Tax_Balance_Due = "-", Interest_Due = "-", Cost = "-", Tax_Total_Due = "-";
                        IWebElement         TBtax_history = driver.FindElement(By.XPath("/html/body/form/div[3]/table/tbody/tr/td/table[2]/tbody"));
                        IList <IWebElement> TRtax_history = TBtax_history.FindElements(By.TagName("tr"));
                        IList <IWebElement> TDtax_history;
                        foreach (IWebElement row1 in TRtax_history)
                        {
                            if (!row1.Text.Contains("Tax Roll Number"))
                            {
                                TDtax_history   = row1.FindElements(By.TagName("td"));
                                Tax_Roll_Number = TDtax_history[0].Text;
                                Tax_Amount_T    = TDtax_history[1].Text;
                                Tax_Balance_Due = TDtax_history[2].Text;
                                Interest_Due    = TDtax_history[3].Text;
                                Cost            = TDtax_history[4].Text;
                                Tax_Total_Due   = TDtax_history[5].Text;
                                string tax_history = Tax_Year + "~" + Tax_Roll_Number + "~" + Tax_Amount_T + "~" + Tax_Balance_Due + "~" + Interest_Due + "~" + Cost + "~" + Tax_Total_Due;
                                gc.insert_date(orderNumber, Parcel_ID, 117, tax_history, 1, DateTime.Now);
                            }
                        }

                        driver.FindElement(By.XPath("//*[@id='HyperLink2']")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);

                        driver.FindElement(By.XPath("//*[@id='HyperLink2']")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                    }

                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "OK", "Tulsa", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderNumber, "OK", "Tulsa");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw ex;
                }
            }
        }
Example #10
0
        public void insertInstallment(string orderNumber, string parcelNumber, string fileName, string taxType)
        {
            string tax_type = "-", tax_year = "-", land = "-", build = "-", tax_ratearea = "-", legal_description = "-", inst_type = "-", due_date = "-", tax_status = "-", amount_due = "-", Penalties_Due = "-", Additional_Fees_Due = "-", Paid_Amount = "-", Paid_Date = "-", Total_Due_Amount = "-", delinquent = "-", output = "";

            string total_assessement = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_TableCell15")).Text;

            tax_type          = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblDetailsTitle")).Text;
            output            = tax_type.Substring(tax_type.LastIndexOf("YEAR") + 4);
            land              = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_TableCell10")).Text;
            build             = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_TableCell11")).Text;
            tax_ratearea      = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_TaxRateArea")).Text;
            legal_description = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_PropertyData")).Text;
            parcelNumber      = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_CellAssessNum")).Text;
            string prop_addr = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_SitusAddress")).Text;

            totalnetasses = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_TableCell186")).Text;

            string[] yrArray = output.Split('-');
            string   yr1     = WebDriverTest.After(yrArray[0], ",").TrimStart();
            string   yr2     = WebDriverTest.After(yrArray[1], ",");;

            tax_year = yr1 + "-" + yr2;
            if (taxType != "supplemental")
            {
                string property_details = prop_addr + "~" + legal_description;
                gc.insert_date(orderNumber, parcelNumber, 30, property_details, 1, DateTime.Now);
            }

            if (taxType == "secured")
            {
                string assess = tax_year + "~" + land + "~" + build + "~" + fullassess + "~" + total_assessement + "~" + hometownasses + "~" + totalnetasses;
                gc.insert_date(orderNumber, parcelNumber, 31, assess, 1, DateTime.Now);
                //db.ExecuteQuery("update la_assessor set land ='" + land + "', improvements = '" + build + "',legal_description = '" + legal_description + "',total_assessment='" + total_assessement + "' where order_no ='" + orderNumber + "'");
            }
            //Assessment_Year~Land~Building/Structure~Full_Value~Total_Assessed_Value~Homeowner_Exemption~Net_Assessed_Value
            string assess_sup = tax_year + "~" + land + "~" + build + "~" + fullassess + "~" + total_assessement + "~" + hometownasses + "~" + totalnetasses;

            // gc.insert_date(orderNumber,DateTime.Now , parcelNumber, 31, assess_sup, 1);
            //tax payemnt history
            tax_type = Between(tax_type, "RIVERSIDE COUNTY", "PROPERTY TAX");
            //tax_year = output;


            inst_type = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_TableCell22")).Text;
            if (inst_type.Contains("1st"))
            {
                due_date            = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Inst1DueDate")).Text;
                tax_status          = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Inst1Status")).Text;
                amount_due          = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Inst1TaxesDue")).Text;
                Penalties_Due       = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Inst1PenaltiesDue")).Text;
                Additional_Fees_Due = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Inst1AddlFeesDue")).Text;
                Total_Due_Amount    = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Inst1TotalDue")).Text;
                //Tax_Rate_Area~Tax_Year~Tax_Type~Installment_Type~Due_Date~Tax_Status~Amount_Due~Penalties_Due~Additional_Fees_Due~Paid_ Amount~Paid_Date~Total_Due_Amount
                string ins1 = tax_ratearea + "~" + tax_year + "~" + tax_type + "~" + inst_type + "~" + due_date + "~" + tax_status + "~" + amount_due + "~" + Penalties_Due + "~" + Additional_Fees_Due + "~" + Paid_Amount + "~" + Paid_Date + "~" + Total_Due_Amount;
                gc.insert_date(orderNumber, parcelNumber, 32, ins1, 1, DateTime.Now);
                //db.ExecuteQuery("insert into la_tax_summary (parcel_no, order_no,installment,due_date, tax_amount, tax_status,balance_due,Penalties_Due,total_due,paid_amount,delinquent,tax_year,add_charges,tax_type,tax_ratearea) values ('" + parcelNumber + "','" + orderNumber + "', '" + inst_type + "','" + due_date + "','" + amount_due + "','" + tax_status + "','','" + Penalties_Due + "','" + Total_Due_Amount + "','" + Paid_Amount + "','" + delinquent + "','" + tax_year + "','" + Additional_Fees_Due + "','" + tax_type + "','" + tax_ratearea + "') ");
            }
            inst_type = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_TableCell25")).Text;
            if (inst_type.Contains("2nd"))
            {
                due_date            = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Inst2DueDate")).Text;
                tax_status          = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Inst2Status")).Text;
                amount_due          = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Inst2TaxesDue")).Text;
                Penalties_Due       = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Inst2PenaltiesDue")).Text;
                Additional_Fees_Due = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Inst2AddlFeesDue")).Text;
                Total_Due_Amount    = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Inst2TotalDue")).Text;
                string ins2 = tax_ratearea + "~" + tax_year + "~" + tax_type + "~" + inst_type + "~" + due_date + "~" + tax_status + "~" + amount_due + "~" + Penalties_Due + "~" + Additional_Fees_Due + "~" + Paid_Amount + "~" + Paid_Date + "~" + Total_Due_Amount;
                gc.insert_date(orderNumber, parcelNumber, 32, ins2, 1, DateTime.Now);
                //db.ExecuteQuery("insert into la_tax_summary (parcel_no, order_no,installment,due_date, tax_amount, tax_status,balance_due,Penalties_Due,total_due,paid_amount,delinquent,tax_year,add_charges,tax_type,tax_ratearea) values ('" + parcelNumber + "','" + orderNumber + "', '" + inst_type + "','" + due_date + "','" + amount_due + "','" + tax_status + "','','" + Penalties_Due + "','" + Total_Due_Amount + "','" + Paid_Amount + "','" + delinquent + "','" + tax_year + "','" + Additional_Fees_Due + "','" + tax_type + "','" + tax_ratearea + "') ");
                gc.CreatePdf(orderNumber, Outparcelno, "tax_details", driver, "CA", "RiverSide");
            }
        }
        public string FTP_CASanBernardino(string houseno, string sname, string stype, string city, string parcelNumber, string searchType, string orderNumber, string ownername, string unitno)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";
            var    driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");
                    if (searchType == "titleflex")
                    {
                        address = houseno + " " + sname + " " + stype + " " + unitno;
                        gc.TitleFlexSearch(orderNumber, parcelNumber, "", address, "CA", "San Bernardino");

                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_CASanBernardino"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "address")
                    {
                        driver.Navigate().GoToUrl("http://www.mytaxcollector.com/trSearch.aspx");
                        Thread.Sleep(2000);

                        driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/form/table/tbody/tr[1]/td[2]/nobr/input")).SendKeys(houseno);
                        driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/form/table/tbody/tr[2]/td[2]/nobr/input")).SendKeys(sname);

                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "CA", "San Bernardino");
                        driver.FindElement(By.Id("ctl00_contentHolder_cmdSearch")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        gc.CreatePdf_WOP(orderNumber, "Address search Result", driver, "CA", "San Bernardino");


                        try
                        {
                            IWebElement         MultiAddressTB = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/div[1]/table/tbody"));
                            IList <IWebElement> MultiAddressTR = MultiAddressTB.FindElements(By.TagName("tr"));
                            IList <IWebElement> MultiAddressTD;
                            gc.CreatePdf_WOP(orderNumber, "Multi Address search", driver, "CA", "San Bernardino");
                            int AddressmaxCheck = 0;

                            if (MultiAddressTR.Count == 2)
                            {
                                driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/div[1]/table/tbody/tr[2]/td[1]/a")).Click();
                                Thread.Sleep(2000);
                            }

                            else
                            {
                                foreach (IWebElement MultiAddress in MultiAddressTR)
                                {
                                    if (AddressmaxCheck <= 25)
                                    {
                                        MultiAddressTD = MultiAddress.FindElements(By.TagName("td"));
                                        if (MultiAddressTD.Count != 0 && !MultiAddress.Text.Contains("Parcel Number"))
                                        {
                                            Parcelno = MultiAddressTD[0].Text;
                                            Address  = MultiAddressTD[1].Text;

                                            MultiAddress_details = Address;
                                            gc.insert_date(orderNumber, Parcelno, 557, MultiAddress_details, 1, DateTime.Now);
                                        }
                                        AddressmaxCheck++;
                                    }
                                }
                                if (MultiAddressTR.Count > 25)
                                {
                                    HttpContext.Current.Session["multiParcel_SanBernardino_Multicount"] = "Maximum";
                                }
                                else
                                {
                                    HttpContext.Current.Session["multiparcel_SanBernardino"] = "Yes";
                                }
                                driver.Quit();

                                return("MultiParcel");
                            }
                        }
                        catch
                        { }
                    }
                    if (searchType == "parcel")
                    {
                        driver.Navigate().GoToUrl("http://www.mytaxcollector.com/trSearch.aspx");
                        Thread.Sleep(2000);

                        driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/form/table/tbody/tr[6]/td[2]/input")).SendKeys(parcelNumber);
                        gc.CreatePdf(orderNumber, parcelNumber, "ParcelSearch", driver, "CA", "San Bernardino");

                        driver.FindElement(By.Id("ctl00_contentHolder_cmdSearch")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);
                    }

                    else if (searchType == "ownername")
                    {
                        driver.Navigate().GoToUrl("http://www.sbcounty.gov/assessor/pims/(S(fbwsp3kdg4b2bm5y5tgxd2r3))/PIMSINTERFACE.ASPX");
                        Thread.Sleep(2000);

                        IWebElement iframeElementOwner = driver.FindElement(By.XPath("//*[@id='frameSearchResults']"));
                        driver.SwitchTo().Frame(iframeElementOwner);
                        Thread.Sleep(2000);

                        driver.FindElement(By.Id("mnuPIMS_2")).Click();
                        Thread.Sleep(3000);

                        driver.FindElement(By.Id("FormattedNameSearchInput1_txtLASTNAME")).SendKeys(ownername);
                        driver.FindElement(By.Id("FormattedNameSearchInput1_btnStartNameSearch")).SendKeys(Keys.Enter);
                        Thread.Sleep(4000);
                        try
                        {
                            IWebElement         MultiOwnerTB = driver.FindElement(By.XPath("//*[@id='G_UltraWebGridSearchResults']/tbody"));
                            IList <IWebElement> MultiOwnerTR = MultiOwnerTB.FindElements(By.TagName("tr"));
                            IList <IWebElement> MultiOwnerTD;
                            gc.CreatePdf_WOP(orderNumber, "Multi Owner search", driver, "CA", "San Bernardino");
                            int maxCheck = 0;

                            foreach (IWebElement MultiOwner in MultiOwnerTR)
                            {
                                if (maxCheck <= 25)
                                {
                                    MultiOwnerTD = MultiOwner.FindElements(By.TagName("td"));
                                    if (MultiOwnerTD.Count != 0)
                                    {
                                        Parcelno = MultiOwnerTD[1].Text;
                                        Address  = MultiOwnerTD[6].Text;

                                        MultiOwner_details = Address;
                                        gc.insert_date(orderNumber, Parcelno, 557, MultiOwner_details, 1, DateTime.Now);
                                    }
                                    maxCheck++;
                                }
                            }

                            if (MultiOwnerTR.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_SanBernardino_Multicount"] = "Maximum";
                            }
                            else
                            {
                                HttpContext.Current.Session["multiparcel_SanBernardino"] = "Yes";
                            }
                            driver.Quit();

                            return("MultiParcel");
                        }
                        catch
                        { }
                    }
                    try
                    {
                        Parcelno = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[1]/tbody/tr[2]/td")).Text;
                        Parcelno = WebDriverTest.After(Parcelno, "Parcel ").Replace("-", "");
                    }
                    catch
                    { }

                    //Property Details
                    driver.Navigate().GoToUrl("http://www.sbcounty.gov/assessor/pims/(S(fbwsp3kdg4b2bm5y5tgxd2r3))/PIMSINTERFACE.ASPX");
                    Thread.Sleep(4000);

                    IWebElement iframeElementAdd = driver.FindElement(By.XPath("//*[@id='frameSearchResults']"));
                    driver.SwitchTo().Frame(iframeElementAdd);
                    Thread.Sleep(2000);

                    driver.FindElement(By.Id("mnuPIMS_1")).Click();
                    Thread.Sleep(3000);

                    driver.FindElement(By.Id("ParcelInquiryInput1_txtParcelNbr")).SendKeys(Parcelno);
                    driver.FindElement(By.Id("ParcelInquiryInput1_btnStartParcelInquiry")).SendKeys(Keys.Enter);
                    Thread.Sleep(6000);
                    driver.SwitchTo().DefaultContent();

                    IWebElement iframeElementAdd1 = driver.FindElement(By.XPath("//*[@id='frmset']/frame[2]"));
                    driver.SwitchTo().Frame(iframeElementAdd1);
                    Thread.Sleep(2000);

                    IWebElement iframeElementAdd2 = driver.FindElement(By.XPath("//*[@id='RadPageViewPropInfo']/iframe"));
                    driver.SwitchTo().Frame(iframeElementAdd2);
                    Thread.Sleep(2000);

                    try
                    {
                        Parcelno              = driver.FindElement(By.XPath("//*[@id='spnPROPERTYINFO']/center[1]/table/tbody/tr[2]/td[1]")).Text;
                        ownername1            = driver.FindElement(By.XPath("//*[@id='spnPROPERTYINFO']/div[1]/table/tbody/tr/td[3]/table/tbody/tr[2]/td[1]")).Text;
                        Effective_Date        = driver.FindElement(By.XPath("//*[@id='spnPROPERTYINFO']/div[1]/table/tbody/tr/td[3]/table/tbody/tr[2]/td[2]")).Text;
                        ownername2            = driver.FindElement(By.XPath("//*[@id='spnPROPERTYINFO']/div[1]/table/tbody/tr/td[3]/table/tbody/tr[3]/td")).Text;
                        Owner_Mailing_Address = ownername1 + ownername2;
                        Legal_Description     = driver.FindElement(By.XPath("//*[@id='spnPROPERTYINFO']/div[3]/textarea")).Text;

                        Property_Details = Owner_Mailing_Address + "~" + Effective_Date + "~" + Legal_Description;
                        gc.CreatePdf(orderNumber, Parcelno, "Property Details", driver, "CA", "San Bernardino");
                        gc.insert_date(orderNumber, Parcelno, 558, Property_Details, 1, DateTime.Now);
                    }
                    catch
                    { }
                    driver.SwitchTo().DefaultContent();

                    //Assessment Details
                    IWebElement iframeElementAdd3 = driver.FindElement(By.XPath("//*[@id='frmset']/frame[2]"));
                    driver.SwitchTo().Frame(iframeElementAdd3);
                    Thread.Sleep(2000);

                    driver.FindElement(By.XPath("//*[@id='RadTabStripMain']/div/ul/li[2]/a")).Click();
                    Thread.Sleep(2000);

                    IWebElement iframeElementAdd4 = driver.FindElement(By.XPath("//*[@id='RadPageViewRollValuesHist']/iframe"));
                    driver.SwitchTo().Frame(iframeElementAdd4);
                    Thread.Sleep(4000);

                    Land_Value          = driver.FindElement(By.XPath("//*[@id='mainsect']/tbody/tr[8]/td[1]")).Text;
                    Improvement_Value   = driver.FindElement(By.XPath("//*[@id='mainsect']/tbody/tr[9]/td[1]")).Text;
                    Improvement_Penalty = driver.FindElement(By.XPath("//*[@id='mainsect']/tbody/tr[10]/td[1]")).Text;
                    PresProp_Value      = driver.FindElement(By.XPath("//*[@id='mainsect']/tbody/tr[11]/td[1]")).Text;
                    PresProp_Penalty    = driver.FindElement(By.XPath("//*[@id='mainsect']/tbody/tr[12]/td[1]")).Text;
                    Total_Penalties     = driver.FindElement(By.XPath("//*[@id='mainsect']/tbody/tr[13]/td[1]")).Text;
                    TotalAssessed_Value = driver.FindElement(By.XPath("//*[@id='mainsect']/tbody/tr[14]/td[1]")).Text;
                    Homeowner_Exemption = driver.FindElement(By.XPath("//*[@id='mainsect']/tbody/tr[15]/td[1]")).Text;
                    Special_Exemptions  = driver.FindElement(By.XPath("//*[@id='mainsect']/tbody/tr[16]/td[1]")).Text;
                    Net_Value           = driver.FindElement(By.XPath("//*[@id='mainsect']/tbody/tr[17]/td[1]")).Text;

                    Assessment_Details = Land_Value + "~" + Improvement_Value + "~" + Improvement_Penalty + "~" + PresProp_Value + "~" + PresProp_Penalty + "~" + Total_Penalties + "~" + TotalAssessed_Value + "~" + Homeowner_Exemption + "~" + Special_Exemptions + "~" + Net_Value;
                    gc.CreatePdf(orderNumber, Parcelno, "Assessment Details", driver, "CA", "San Bernardino");
                    gc.insert_date(orderNumber, Parcelno, 559, Assessment_Details, 1, DateTime.Now);
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    driver.Navigate().GoToUrl("http://www.mytaxcollector.com/trSearch.aspx");
                    Thread.Sleep(2000);

                    driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/form/table/tbody/tr[6]/td[2]/input")).SendKeys(Parcelno);

                    driver.FindElement(By.Id("ctl00_contentHolder_cmdSearch")).SendKeys(Keys.Enter);
                    Thread.Sleep(2000);

                    driver.FindElement(By.XPath("//*[@id='ctl00_menuHolder_trLeftNav_LeftNavMenuControln9']/td/table/tbody/tr/td/a")).Click();
                    Thread.Sleep(2000);

                    //Tax Payment History Details

                    IWebElement         PaymentTB = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/div[1]/table/tbody"));
                    IList <IWebElement> PaymentTR = PaymentTB.FindElements(By.TagName("tr"));
                    IList <IWebElement> PaymentTD;

                    foreach (IWebElement Payment in PaymentTR)
                    {
                        PaymentTD = Payment.FindElements(By.TagName("td"));
                        if (PaymentTD.Count != 0 && !Payment.Text.Contains("Bill Number"))
                        {
                            Bill_Number = PaymentTD[0].Text;
                            Eff_Date    = PaymentTD[1].Text;
                            Extnd_Date  = PaymentTD[2].Text;
                            Correction  = PaymentTD[3].Text;
                            Remarks     = PaymentTD[4].Text;

                            Payment_details = Bill_Number + "~" + Eff_Date + "~" + Extnd_Date + "~" + Correction + "~" + Remarks;
                            gc.CreatePdf(orderNumber, Parcelno, "Tax Paymnt Details", driver, "CA", "San Bernardino");
                            gc.insert_date(orderNumber, Parcelno, 560, Payment_details, 1, DateTime.Now);
                        }
                    }

                    //Current Tax Details
                    driver.FindElement(By.XPath("//*[@id='ctl00_menuHolder_trLeftNav_LeftNavMenuControln10']/td/table/tbody/tr/td/a")).Click();
                    Thread.Sleep(2000);

                    List <string> secure   = new List <string>();
                    List <string> Unsecure = new List <string>();
                    try
                    {
                        Bill_Type = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/form/div[1]/div")).Text;

                        IWebElement         Receipttable    = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/form/div[1]/table[3]/tbody"));
                        IList <IWebElement> ReceipttableRow = Receipttable.FindElements(By.TagName("tr"));
                        IList <IWebElement> ReceipttableTD;

                        foreach (IWebElement Receipt in ReceipttableRow)
                        {
                            ReceipttableTD = Receipt.FindElements(By.TagName("td"));
                            if (ReceipttableTD.Count != 0 && Receipt.Text.Contains("Installment"))
                            {
                                IWebElement Bill_link = ReceipttableTD[0].FindElement(By.TagName("a"));
                                url = Bill_link.GetAttribute("href");
                                secure.Add(url);
                            }
                            if (ReceipttableTD.Count != 0 && !Receipt.Text.Contains("Bill Number") && !Receipt.Text.Contains("Total:"))
                            {
                                Penalty  = ReceipttableTD[2].Text;
                                Cost     = ReceipttableTD[3].Text;
                                Inst_Del = ReceipttableTD[6].Text;

                                CurrentTax_Details = Bill_Type + "~" + Penalty + "~" + Cost + "~" + Inst_Del + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-";
                                gc.CreatePdf(orderNumber, Parcelno, "Secured Tax Bills Details", driver, "CA", "San Bernardino");
                                gc.insert_date(orderNumber, Parcelno, 561, CurrentTax_Details, 1, DateTime.Now);
                            }
                        }

                        //Deliquent taxes
                        try
                        {
                            bill_type = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/form/div[2]/table[1]/tbody/tr/th/center/font/a")).Text;

                            IWebElement         Unsecuredtable = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/form/div[2]/table[2]/tbody"));
                            IList <IWebElement> UnsecuredRow   = Unsecuredtable.FindElements(By.TagName("tr"));
                            IList <IWebElement> UnsecuredTD;

                            foreach (IWebElement Unsecured in UnsecuredRow)
                            {
                                UnsecuredTD = Unsecured.FindElements(By.TagName("td"));
                                if (UnsecuredTD.Count != 0 && Unsecured.Text.Contains("*"))
                                {
                                    IWebElement UnBill_link = UnsecuredTD[0].FindElement(By.TagName("a"));
                                    Unurl = UnBill_link.GetAttribute("href");
                                    Unsecure.Add(Unurl);
                                }
                                if (UnsecuredTD.Count != 0 && !Unsecured.Text.Contains("Bill Number") && !Unsecured.Text.Contains("Responsible Parties"))
                                {
                                    Lien       = UnsecuredTD[3].Text;
                                    Intrest    = UnsecuredTD[5].Text;
                                    Unpenalty  = UnsecuredTD[6].Text;
                                    Uncost     = UnsecuredTD[7].Text;
                                    Redemption = UnsecuredTD[8].Text;

                                    UnCurrentTax_Details = bill_type + "~" + Lien + "~" + Intrest + "~" + Unpenalty + "~" + Uncost + "~" + Redemption + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-";
                                    gc.CreatePdf(orderNumber, Parcelno, "UnSecured Tax Bills Details", driver, "CA", "San Bernardino");
                                    gc.insert_date(orderNumber, Parcelno, 566, UnCurrentTax_Details, 1, DateTime.Now);
                                }
                            }
                        }
                        catch
                        { }

                        foreach (string bill in secure)
                        {
                            driver.Navigate().GoToUrl(bill);
                            Thread.Sleep(3000);
                            try
                            {
                                Billed_Owner = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[2]/tbody/tr[1]/td/table/tbody/tr[2]/td[2]")).Text;
                                try
                                {
                                    Co_Owner = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[2]/tbody/tr[1]/td/table/tbody/tr[3]/td[2]")).Text;
                                }
                                catch { }
                                Default_date   = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[2]/tbody/tr[3]/td/table/tbody/tr[1]/td[2]")).Text;
                                Tax_Type       = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[2]/tbody/tr[3]/td/table/tbody/tr[1]/td[3]")).Text;
                                TaxBill_Number = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[2]/tbody/tr[3]/td/table/tbody/tr[2]/td[1]")).Text;
                                Extend_date    = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[2]/tbody/tr[3]/td/table/tbody/tr[2]/td[2]")).Text;
                                Effective_date = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[2]/tbody/tr[3]/td/table/tbody/tr[2]/td[3]")).Text;
                                Taxrate_Year   = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[2]/tbody/tr[3]/td/table/tbody/tr[4]/td[3]")).Text;

                                IWebElement         valuetableElement = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[2]/tbody/tr[5]/td/table/tbody/tr/td[2]/table/tbody"));
                                IList <IWebElement> valuetableRow     = valuetableElement.FindElements(By.TagName("tr"));
                                IList <IWebElement> valuerowTD;

                                List <string> Installment1 = new List <string>();
                                List <string> Due_Amt1     = new List <string>();
                                List <string> Delq_Amt1    = new List <string>();
                                List <string> Due_Date1    = new List <string>();
                                List <string> Pmt_Posted1  = new List <string>();
                                List <string> Installment2 = new List <string>();
                                List <string> Due_Amt2     = new List <string>();
                                List <string> Delq_Amt2    = new List <string>();
                                List <string> Due_Date2    = new List <string>();
                                List <string> Total_Tax    = new List <string>();
                                List <string> Pay_Status   = new List <string>();

                                int j = 0;
                                foreach (IWebElement row in valuetableRow)
                                {
                                    valuerowTD = row.FindElements(By.TagName("td"));
                                    if (j == 0)
                                    {
                                        Installment1.Add(valuerowTD[0].Text);
                                    }
                                    else if (j == 1)
                                    {
                                        Due_Amt1.Add(valuerowTD[0].Text);
                                    }
                                    else if (j == 2)
                                    {
                                        Delq_Amt1.Add(valuerowTD[0].Text);
                                    }
                                    else if (j == 3)
                                    {
                                        Due_Date1.Add(valuerowTD[0].Text);
                                    }
                                    else if (j == 4)
                                    {
                                        Pmt_Posted1.Add(valuerowTD[0].Text);
                                    }
                                    else if (j == 5)
                                    {
                                        Installment2.Add(valuerowTD[0].Text);
                                    }
                                    else if (j == 6)
                                    {
                                        Due_Amt2.Add(valuerowTD[0].Text);
                                    }
                                    else if (j == 7)
                                    {
                                        Delq_Amt2.Add(valuerowTD[0].Text);
                                    }
                                    else if (j == 8)
                                    {
                                        Due_Date2.Add(valuerowTD[0].Text);
                                    }
                                    else if (j == 9)
                                    {
                                        Total_Tax.Add(valuerowTD[0].Text);
                                    }
                                    else if (j == 10)
                                    {
                                        Pay_Status.Add(valuerowTD[0].Text);
                                    }
                                    j++;
                                }

                                SecuredCurrentTax_Details = "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + Billed_Owner + "~" + Co_Owner + "~" + Default_date + "~" + Tax_Type + "~" + TaxBill_Number + "~" + Extend_date + "~" + Effective_date + "~" + Taxrate_Year + "~" + Installment1[0] + "~" + Due_Amt1[0] + "~" + Delq_Amt1[0] + "~" + Due_Date1[0] + "~" + Pmt_Posted1[0] + "~" + Installment2[0] + "~" + Due_Amt2[0] + "~" + Delq_Amt2[0] + "~" + Due_Date2[0] + "~" + Total_Tax[0] + "~" + Pay_Status[0];
                                gc.CreatePdf(orderNumber, Parcelno, "Secured Bills Details", driver, "CA", "San Bernardino");
                                gc.insert_date(orderNumber, Parcelno, 561, SecuredCurrentTax_Details, 1, DateTime.Now);
                            }
                            catch
                            { }
                        }
                    }
                    catch
                    { }

                    try
                    {
                        foreach (string Unbill in Unsecure)
                        {
                            driver.Navigate().GoToUrl(Unbill);
                            Thread.Sleep(3000);

                            UnBilled_Owner    = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[2]/tbody/tr[1]/td/table/tbody/tr[2]/td[2]")).Text;
                            UnCo_Owner        = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[2]/tbody/tr[1]/td/table/tbody/tr[3]/td[2]")).Text;
                            UnDefault_Date    = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[2]/tbody/tr[3]/td/table/tbody/tr[1]/td[2]")).Text;
                            UnTax_Type        = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[2]/tbody/tr[3]/td/table/tbody/tr[1]/td[3]")).Text;
                            UnBill_Number     = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[2]/tbody/tr[3]/td/table/tbody/tr[2]/td[1]")).Text;
                            UnExtended_Date   = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[2]/tbody/tr[3]/td/table/tbody/tr[2]/td[2]")).Text;
                            UnEffective_Owner = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[2]/tbody/tr[3]/td/table/tbody/tr[2]/td[3]")).Text;
                            UnTaxrate_Year    = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[2]/tbody/tr[3]/td/table/tbody/tr[4]/td[3]")).Text;

                            IWebElement         UnvaluetableElement = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/table[2]/tbody/tr[5]/td/table/tbody/tr/td[2]/table/tbody"));
                            IList <IWebElement> UnvaluetableRow     = UnvaluetableElement.FindElements(By.TagName("tr"));
                            IList <IWebElement> UnvaluerowTD;

                            List <string> UnInstallment = new List <string>();
                            List <string> UnDue_Amt     = new List <string>();
                            List <string> UnDelq_Amt    = new List <string>();
                            List <string> UnDue_Date    = new List <string>();
                            List <string> UnTotal_Tax   = new List <string>();
                            List <string> UnPay_Status  = new List <string>();


                            int K = 0;
                            foreach (IWebElement Unrow in UnvaluetableRow)
                            {
                                UnvaluerowTD = Unrow.FindElements(By.TagName("td"));
                                if (K == 0)
                                {
                                    UnInstallment.Add(UnvaluerowTD[0].Text);
                                }
                                else if (K == 1)
                                {
                                    UnDue_Amt.Add(UnvaluerowTD[0].Text);
                                }
                                else if (K == 2)
                                {
                                    UnDelq_Amt.Add(UnvaluerowTD[0].Text);
                                }
                                else if (K == 3)
                                {
                                    UnDue_Date.Add(UnvaluerowTD[0].Text);
                                }
                                else if (K == 4)
                                {
                                    UnTotal_Tax.Add(UnvaluerowTD[0].Text);
                                }
                                else if (K == 5)
                                {
                                    UnPay_Status.Add(UnvaluerowTD[0].Text);
                                }
                                K++;
                            }
                            UnSecuredCurrentTax_Details = "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + UnBilled_Owner + "~" + UnCo_Owner + "~" + UnDefault_Date + "~" + UnTax_Type + "~" + UnBill_Number + "~" + UnExtended_Date + "~" + UnEffective_Owner + "~" + UnTaxrate_Year + "~" + UnInstallment[0] + "~" + UnDue_Amt[0] + "~" + UnDelq_Amt[0] + "~" + UnDue_Date[0] + "~" + UnTotal_Tax[0] + "~" + UnPay_Status[0];
                            gc.CreatePdf(orderNumber, Parcelno, "UnSecured Bills Details", driver, "CA", "San Bernardino");
                            gc.insert_date(orderNumber, Parcelno, 566, UnSecuredCurrentTax_Details, 1, DateTime.Now);
                        }
                    }
                    catch
                    { }

                    TaxTime     = DateTime.Now.ToString("HH:mm:ss");
                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "CA", "San Bernardino", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderNumber, "CA", "San Bernardino");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw ex;
                }
            }
        }
        public string FTP_GAFayette(string address, string assessment_id, string parcelNumber, string searchType, string orderNumber, string directParcel, string ownername)
        {
            string Parcelno = "", Owner = "", Property_Address = "", Legal_Desp = "", MultiOwner_details = "", MultiAddress_details = "";
            string Parcel_ID = "", Location = "", Legal = "", Property_Class = "", Nighbrhod = "", Tax_Dis = "", Zoing = "", Acres = "", Homestd = "", Exemption = "", Overall_OwnMailAdd = "", Year_Built = "";
            string property = "", yblt = "", Mailing_Address2 = "", Mailing_Address1 = "", Owner1 = "", Owner2 = "", Exemp = "", Home = "", Acrs = "", Zone = "", tx_Dis = "", Nhg = "", Pro_Cls = "", Lg_Des = "", Loc = "", Par = "";
            string Year1 = "", Year2 = "", Year3 = "", Year4 = "", Assemnt_Details1 = "", Assemnt_Details2 = "", Assemnt_Details3 = "", Assemnt_Details4 = "", total = "", Total_Payments = "", Convey = "", Convey_Fee = "", Paid = "", Total_Paid = "", TaxPayment_details1 = "", TaxPayment_details = "", Balnce_Due = "", Tax_Bill = "", Tax_year = "";
            string Taxy = "", Total_DUE = "", Last_PAYDATE = "", Tax_P = "", Tax_Payer = "", Map = "", Map_Code = "", Desk = "", Desk_Pro = "", Locy = "", Tax_Location = "", Bl_No = "", Tax_Billno = "", Disti = "", Tax_Dist = "", Build_Val = "", Land_Val = "", Tax_Acres = "", FrMkt_Val = "", Tax_DueDate = "", Tax_Exmpions = "", TaxInfo_Details = "";
            string Cu_Du = "", Penalt = "", In_Tx = "", Oth_Fe = "", Pre_Pay = "", Bc_Tx = "", Tl_Du = "", Cur_Due = "", Tax_Penalty = "", Int_Rest = "", Other_Fees = "", Previous_Payments = "", Back_Taxes = "", TaxToal_Due = "", DueTaxInfo_Details = "";
            string Entity = "", FMV = "", Net_Assmnt = "", Exmpl = "", Taxble_Value = "", Millage_Rate = "", Grs_Tax = "", Cretit = "", NetTax = "", CityPayment_details = "", Taxble_Value1 = "", Millage_Rate1 = "", Grs_Tax1 = "", Cretit1 = "", NetTax1 = "";
            string Tax_Auth1 = "", Tax_Auth2 = "", Tax_Authotiry = "", TaxAuthority_Details = "";

            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";

            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");

                    if (searchType == "titleflex")
                    {
                        string titleaddress = address;
                        gc.TitleFlexSearch(orderNumber, "", "", titleaddress, "GA", "Fayette");

                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_GAFayette"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }

                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "address")
                    {
                        driver.Navigate().GoToUrl("https://qpublic.schneidercorp.com/Application.aspx?AppID=942&LayerID=18406&PageTypeID=2&PageID=8204");
                        Thread.Sleep(2000);
                        try
                        {
                            driver.FindElement(By.XPath("//*[@id='appBody']/div[4]/div/div/div[3]/a[1]")).Click();
                            Thread.Sleep(2000);
                        }
                        catch { }

                        driver.FindElement(By.Id("ctlBodyPane_ctl01_ctl01_txtAddress")).SendKeys(address);
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "GA", "Fayette");
                        driver.FindElement(By.Id("ctlBodyPane_ctl01_ctl01_btnSearch")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);

                        try
                        {
                            IWebElement         MultiAddressTB = driver.FindElement(By.XPath("//*[@id='ctlBodyPane_ctl00_ctl01_gvwParcelResults']/tbody"));
                            IList <IWebElement> MultiAddressTR = MultiAddressTB.FindElements(By.TagName("tr"));
                            IList <IWebElement> MultiAddressTD;
                            gc.CreatePdf_WOP(orderNumber, "Multi Address search", driver, "GA", "Fayette");
                            int AddressmaxCheck = 0;
                            foreach (IWebElement MultiAddress in MultiAddressTR)
                            {
                                if (AddressmaxCheck <= 25)
                                {
                                    MultiAddressTD = MultiAddress.FindElements(By.TagName("td"));
                                    if (MultiAddressTD.Count != 0)
                                    {
                                        Parcelno         = MultiAddressTD[1].Text;
                                        Owner            = MultiAddressTD[2].Text;
                                        Property_Address = MultiAddressTD[3].Text;
                                        Legal_Desp       = MultiAddressTD[4].Text;

                                        MultiAddress_details = Owner + "~" + Property_Address + "~" + Legal_Desp;
                                        gc.insert_date(orderNumber, Parcelno, 784, MultiAddress_details, 1, DateTime.Now);
                                    }
                                    AddressmaxCheck++;
                                }
                            }
                            if (MultiAddressTR.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_GAFayette_Multicount"] = "Maximum";
                            }
                            else
                            {
                                HttpContext.Current.Session["multiparcel_GAFayette"] = "Yes";
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                        catch
                        { }
                    }

                    if (searchType == "parcel")
                    {
                        driver.Navigate().GoToUrl("https://qpublic.schneidercorp.com/Application.aspx?AppID=942&LayerID=18406&PageTypeID=2&PageID=8204");
                        Thread.Sleep(2000);
                        try
                        {
                            driver.FindElement(By.XPath("//*[@id='appBody']/div[4]/div/div/div[3]/a[1]")).Click();
                            Thread.Sleep(2000);
                        }
                        catch { }

                        if (parcelNumber.Contains(" ") || parcelNumber.Contains("-"))
                        {
                            parcelNumber = parcelNumber.Replace(" ", "").Replace("-", "");
                        }

                        string CommonParcel = parcelNumber;

                        if (CommonParcel.Length == 9)
                        {
                            driver.FindElement(By.Id("ctlBodyPane_ctl02_ctl01_txtParcelID")).SendKeys(parcelNumber);
                            gc.CreatePdf(orderNumber, parcelNumber, "ParcelSearch", driver, "GA", "Fayette");
                            driver.FindElement(By.Id("ctlBodyPane_ctl02_ctl01_btnSearch")).SendKeys(Keys.Enter);
                            Thread.Sleep(2000);
                        }

                        if (CommonParcel.Length == 7)
                        {
                            driver.FindElement(By.Id("ctlBodyPane_ctl02_ctl01_txtParcelID")).SendKeys(parcelNumber);
                            gc.CreatePdf(orderNumber, parcelNumber, "ParcelSearch", driver, "GA", "Fayette");
                            driver.FindElement(By.Id("ctlBodyPane_ctl02_ctl01_btnSearch")).SendKeys(Keys.Enter);
                            Thread.Sleep(2000);
                        }
                    }

                    if (searchType == "ownername")
                    {
                        driver.Navigate().GoToUrl("https://qpublic.schneidercorp.com/Application.aspx?AppID=942&LayerID=18406&PageTypeID=2&PageID=8204");
                        Thread.Sleep(2000);
                        try
                        {
                            driver.FindElement(By.XPath("//*[@id='appBody']/div[4]/div/div/div[3]/a[1]")).Click();
                            Thread.Sleep(2000);
                        }
                        catch { }

                        driver.FindElement(By.Id("ctlBodyPane_ctl00_ctl01_txtName")).SendKeys(ownername);
                        gc.CreatePdf_WOP(orderNumber, "Owner search", driver, "GA", "Fayette");
                        driver.FindElement(By.Id("ctlBodyPane_ctl00_ctl01_btnSearch")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);

                        try
                        {
                            IWebElement         MultiOwnerTB = driver.FindElement(By.XPath("//*[@id='ctlBodyPane_ctl00_ctl01_gvwParcelResults']/tbody"));
                            IList <IWebElement> MultiOwnerTR = MultiOwnerTB.FindElements(By.TagName("tr"));
                            IList <IWebElement> MultiOwnerTD;
                            gc.CreatePdf_WOP(orderNumber, "Multi Owner search", driver, "GA", "Fayette");
                            int AddressmaxCheck = 0;
                            foreach (IWebElement MultiOwner in MultiOwnerTR)
                            {
                                if (AddressmaxCheck <= 25)
                                {
                                    MultiOwnerTD = MultiOwner.FindElements(By.TagName("td"));
                                    if (MultiOwnerTD.Count != 0)
                                    {
                                        Parcelno         = MultiOwnerTD[1].Text;
                                        Owner            = MultiOwnerTD[2].Text;
                                        Property_Address = MultiOwnerTD[3].Text;
                                        Legal_Desp       = MultiOwnerTD[4].Text;

                                        MultiOwner_details = Owner + "~" + Property_Address + "~" + Legal_Desp;
                                        gc.insert_date(orderNumber, Parcelno, 784, MultiOwner_details, 1, DateTime.Now);
                                    }
                                    AddressmaxCheck++;
                                }
                            }
                            if (MultiOwnerTR.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_GAFayette_Multicount"] = "Maximum";
                            }
                            else
                            {
                                HttpContext.Current.Session["multiparcel_GAFayette"] = "Yes";
                            }
                            driver.Quit();

                            return("MultiParcel");
                        }
                        catch
                        { }
                    }

                    try
                    {
                        IWebElement Inodata = driver.FindElement(By.Id("ctlBodyPane_noDataList_pnlNoResults"));
                        if (Inodata.Text.Contains("No results match your search criteria"))
                        {
                            HttpContext.Current.Session["Nodata_GAFayette"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }
                    //Property Details
                    IWebElement         PropertyTB = driver.FindElement(By.XPath("//*[@id='ctlBodyPane_ctl00_mSection']/div/table[1]/tbody"));
                    IList <IWebElement> PropertyTR = PropertyTB.FindElements(By.TagName("tr"));
                    IList <IWebElement> PropertyTD;
                    foreach (IWebElement Property in PropertyTR)
                    {
                        PropertyTD = Property.FindElements(By.TagName("td"));
                        if (PropertyTD.Count != 0)
                        {
                            Par = PropertyTD[0].Text;
                            if (Par.Contains("Parcel Number"))
                            {
                                Parcel_ID = PropertyTD[1].Text;
                            }

                            Loc = PropertyTD[0].Text;
                            if (Loc.Contains("Location Address"))
                            {
                                Location = PropertyTD[1].Text;
                            }

                            Lg_Des = PropertyTD[0].Text;
                            if (Lg_Des.Contains("Legal Description"))
                            {
                                Legal = PropertyTD[1].Text;
                            }

                            Pro_Cls = PropertyTD[0].Text;
                            if (Pro_Cls.Contains("Property Class"))
                            {
                                Property_Class = PropertyTD[1].Text;
                            }

                            Nhg = PropertyTD[0].Text;
                            if (Nhg.Contains("Neighborhood"))
                            {
                                Nighbrhod = PropertyTD[1].Text;
                            }

                            tx_Dis = PropertyTD[0].Text;
                            if (tx_Dis.Contains("Tax District"))
                            {
                                Tax_Dis = PropertyTD[1].Text;
                            }

                            Zone = PropertyTD[0].Text;
                            if (Zone.Contains("Zoning"))
                            {
                                Zoing = PropertyTD[1].Text;
                            }

                            Acrs = PropertyTD[0].Text;
                            if (Acrs.Contains("Acres"))
                            {
                                Acres = PropertyTD[1].Text;
                            }

                            Home = PropertyTD[0].Text;
                            if (Home.Contains("Homestead"))
                            {
                                Homestd = PropertyTD[1].Text;
                            }

                            Exemp = PropertyTD[0].Text;
                            if (Exemp.Contains("Exemptions"))
                            {
                                Exemption = PropertyTD[1].Text;
                            }
                        }
                    }

                    try
                    {
                        Owner1             = driver.FindElement(By.XPath("//*[@id='ctlBodyPane_ctl01_ctl01_lnkOwnerName1_lblSearch']")).Text;
                        Owner2             = driver.FindElement(By.Id("ctlBodyPane_ctl01_ctl01_lblOwnerName2")).Text;
                        Mailing_Address1   = driver.FindElement(By.Id("ctlBodyPane_ctl01_ctl01_lblAddress1")).Text;
                        Mailing_Address2   = driver.FindElement(By.Id("ctlBodyPane_ctl01_ctl01_lblCityStZip")).Text;
                        Overall_OwnMailAdd = Owner1 + " " + Owner2 + " & " + Mailing_Address1 + " " + Mailing_Address2;
                    }
                    catch
                    { }

                    try
                    {
                        Owner1             = driver.FindElement(By.XPath("//*[@id='ctlBodyPane_ctl01_ctl01_lnkOwnerName1_lblSearch']")).Text;
                        Mailing_Address1   = driver.FindElement(By.Id("ctlBodyPane_ctl01_ctl01_lblAddress1")).Text;
                        Mailing_Address2   = driver.FindElement(By.Id("ctlBodyPane_ctl01_ctl01_lblCityStZip")).Text;
                        Overall_OwnMailAdd = Owner1 + " & " + Mailing_Address1 + " " + Mailing_Address2;
                    }
                    catch
                    { }

                    try
                    {
                        Owner1             = driver.FindElement(By.XPath("//*[@id='ctlBodyPane_ctl01_ctl01_lnkOwnerName1_lnkSearch']")).Text;
                        Mailing_Address1   = driver.FindElement(By.Id("ctlBodyPane_ctl01_ctl01_lblAddress1")).Text;
                        Mailing_Address2   = driver.FindElement(By.Id("ctlBodyPane_ctl01_ctl01_lblCityStZip")).Text;
                        Overall_OwnMailAdd = Owner1 + " & " + Mailing_Address1 + " " + Mailing_Address2;
                    }
                    catch
                    { }

                    try
                    {
                        IWebElement         Yeartb = driver.FindElement(By.XPath("//*[@id='ctlBodyPane_ctl04_mSection']/div/div/div[1]/table/tbody"));
                        IList <IWebElement> YearTR = Yeartb.FindElements(By.TagName("tr"));
                        IList <IWebElement> YearTD;

                        foreach (IWebElement Tax4 in YearTR)
                        {
                            YearTD = Tax4.FindElements(By.TagName("td"));
                            if (YearTD.Count != 0)
                            {
                                yblt = YearTD[0].Text;
                                if (yblt.Contains("Year Built"))
                                {
                                    Year_Built = YearTD[1].Text;
                                }
                            }
                        }
                    }
                    catch
                    { }

                    property = Location + "~" + Legal + "~" + Property_Class + "~" + Nighbrhod + "~" + Tax_Dis + "~" + Zoing + "~" + Acres + "~" + Homestd + "~" + Exemption + "~" + Overall_OwnMailAdd + "~" + Year_Built;
                    gc.CreatePdf(orderNumber, Parcel_ID, "Property Details", driver, "GA", "Fayette");
                    gc.insert_date(orderNumber, Parcel_ID, 785, property, 1, DateTime.Now);

                    //Assessment Details
                    IWebElement         AssmThTb = driver.FindElement(By.XPath("//*[@id='ctlBodyPane_ctl02_ctl01_grdValuation']/thead"));
                    IList <IWebElement> AssmThTr = AssmThTb.FindElements(By.TagName("tr"));
                    IList <IWebElement> AssmTh;

                    foreach (IWebElement Assm in AssmThTr)
                    {
                        AssmTh = Assm.FindElements(By.TagName("th"));
                        if (AssmTh.Count != 0)
                        {
                            Year1 = AssmTh[0].Text;
                            Year2 = AssmTh[1].Text;
                            Year3 = AssmTh[2].Text;
                            Year4 = AssmTh[3].Text;
                        }
                    }

                    IWebElement         AssmTb = driver.FindElement(By.XPath("//*[@id='ctlBodyPane_ctl02_ctl01_grdValuation']/tbody"));
                    IList <IWebElement> AssmTr = AssmTb.FindElements(By.TagName("tr"));
                    IList <IWebElement> AssmTd;
                    int j = 0;

                    List <string> LUC         = new List <string>();
                    List <string> Class       = new List <string>();
                    List <string> Land_Value  = new List <string>();
                    List <string> Build_Value = new List <string>();
                    List <string> Total_Value = new List <string>();
                    List <string> Assed_Value = new List <string>();

                    foreach (IWebElement Assmrow in AssmTr)
                    {
                        AssmTd = Assmrow.FindElements(By.TagName("td"));

                        if (AssmTd.Count != 0)
                        {
                            if (j == 0)
                            {
                                LUC.Add(AssmTd[2].Text);
                                LUC.Add(AssmTd[3].Text);
                                LUC.Add(AssmTd[4].Text);
                                LUC.Add(AssmTd[5].Text);
                            }
                            else if (j == 1)
                            {
                                Class.Add(AssmTd[2].Text);
                                Class.Add(AssmTd[3].Text);
                                Class.Add(AssmTd[4].Text);
                                Class.Add(AssmTd[5].Text);
                            }
                            else if (j == 2)
                            {
                                Land_Value.Add(AssmTd[2].Text);
                                Land_Value.Add(AssmTd[3].Text);
                                Land_Value.Add(AssmTd[4].Text);
                                Land_Value.Add(AssmTd[5].Text);
                            }
                            else if (j == 3)
                            {
                                Build_Value.Add(AssmTd[2].Text);
                                Build_Value.Add(AssmTd[3].Text);
                                Build_Value.Add(AssmTd[4].Text);
                                Build_Value.Add(AssmTd[5].Text);
                            }
                            else if (j == 4)
                            {
                                Total_Value.Add(AssmTd[2].Text);
                                Total_Value.Add(AssmTd[3].Text);
                                Total_Value.Add(AssmTd[4].Text);
                                Total_Value.Add(AssmTd[5].Text);
                            }
                            else if (j == 6)
                            {
                                Assed_Value.Add(AssmTd[2].Text);
                                Assed_Value.Add(AssmTd[3].Text);
                                Assed_Value.Add(AssmTd[4].Text);
                                Assed_Value.Add(AssmTd[5].Text);
                            }

                            j++;
                        }
                    }

                    Assemnt_Details1 = Year1 + "~" + LUC[0] + "~" + Class[0] + "~" + Land_Value[0] + "~" + Build_Value[0] + "~" + Total_Value[0] + "~" + Assed_Value[0];
                    Assemnt_Details2 = Year2 + "~" + LUC[1] + "~" + Class[1] + "~" + Land_Value[1] + "~" + Build_Value[1] + "~" + Total_Value[1] + "~" + Assed_Value[1];
                    Assemnt_Details3 = Year3 + "~" + LUC[2] + "~" + Class[2] + "~" + Land_Value[2] + "~" + Build_Value[2] + "~" + Total_Value[2] + "~" + Assed_Value[2];
                    Assemnt_Details4 = Year4 + "~" + LUC[3] + "~" + Class[3] + "~" + Land_Value[3] + "~" + Build_Value[3] + "~" + Total_Value[3] + "~" + Assed_Value[3];
                    gc.insert_date(orderNumber, Parcel_ID, 791, Assemnt_Details1, 1, DateTime.Now);
                    gc.insert_date(orderNumber, Parcel_ID, 791, Assemnt_Details2, 1, DateTime.Now);
                    gc.insert_date(orderNumber, Parcel_ID, 791, Assemnt_Details3, 1, DateTime.Now);
                    gc.insert_date(orderNumber, Parcel_ID, 791, Assemnt_Details4, 1, DateTime.Now);
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    try
                    {
                        //Tax Details
                        driver.Navigate().GoToUrl("http://www.fayettecountytaxcomm.com/taxbillsearch.aspx");

                        driver.FindElement(By.Id("Body_MapParcelID1")).SendKeys(Parcel_ID);
                        Thread.Sleep(2000);

                        gc.CreatePdf(orderNumber, Parcel_ID, "Tax Parcel Search", driver, "GA", "Fayette");
                        driver.FindElement(By.Id("Body_MapParcelIDGo")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);

                        gc.CreatePdf(orderNumber, Parcel_ID, "Tax Site", driver, "GA", "Fayette");
                        driver.FindElement(By.XPath("//*[@id='Body_GridView1']/tbody/tr[2]/td[1]/a")).Click();
                        Thread.Sleep(2000);

                        driver.SwitchTo().Window(driver.WindowHandles.Last());
                        Thread.Sleep(3000);

                        //Tax Payment Details
                        try
                        {
                            IWebElement         TaxPaymentTB = driver.FindElement(By.XPath("//*[@id='Body_GridView1']/tbody"));
                            IList <IWebElement> TaxPaymentTR = TaxPaymentTB.FindElements(By.TagName("tr"));
                            IList <IWebElement> TaxPaymentTD;

                            foreach (IWebElement TaxPayment in TaxPaymentTR)
                            {
                                TaxPaymentTD = TaxPayment.FindElements(By.TagName("td"));
                                if (TaxPaymentTD.Count != 0 && !TaxPayment.Text.Contains("Year"))
                                {
                                    Tax_year   = TaxPaymentTD[0].Text;
                                    Tax_Bill   = TaxPaymentTD[1].Text;
                                    Balnce_Due = TaxPaymentTD[2].Text;

                                    TaxPayment_details = Tax_year + "~" + Tax_Bill + "~" + Balnce_Due;
                                    gc.CreatePdf(orderNumber, Parcel_ID, "Tax Payment Details", driver, "GA", "Fayette");
                                    gc.insert_date(orderNumber, Parcel_ID, 792, TaxPayment_details, 1, DateTime.Now);
                                }
                            }
                        }
                        catch
                        { }

                        try
                        {
                            IWebElement         Tax2TB = driver.FindElement(By.XPath("//*[@id='form1']/div[3]/div/table/tbody"));
                            IList <IWebElement> Tax2TR = Tax2TB.FindElements(By.TagName("tr"));
                            IList <IWebElement> Tax2TD;
                            foreach (IWebElement Tax2 in Tax2TR)
                            {
                                Tax2TD = Tax2.FindElements(By.TagName("td"));
                                if (Tax2TD.Count != 0)
                                {
                                    total = Tax2TD[0].Text;
                                    if (total.Contains("Total Payments Pending:"))
                                    {
                                        Total_Payments = Tax2TD[1].Text;
                                    }
                                    Convey = Tax2TD[0].Text;
                                    if (Convey.Contains("Convenience Fee:"))
                                    {
                                        Convey_Fee = Tax2TD[1].Text;
                                    }
                                    Paid = Tax2TD[0].Text;
                                    if (Paid.Contains("Total Amount to be paid:"))
                                    {
                                        Total_Paid = Tax2TD[1].Text;
                                    }
                                }
                            }

                            TaxPayment_details1 = "" + "~" + "" + "~" + "" + "~" + Total_Payments + "~" + Convey_Fee + "~" + Total_Paid;
                            gc.insert_date(orderNumber, Parcel_ID, 792, TaxPayment_details1, 1, DateTime.Now);
                        }
                        catch
                        { }
                        //Tax Info Details

                        List <string> TaxInfoSearch = new List <string>();

                        IWebElement         TaxInfoTB = driver.FindElement(By.XPath("//*[@id='Body_GridView1']/tbody"));
                        IList <IWebElement> TaxInfoTR = TaxInfoTB.FindElements(By.TagName("tr"));
                        TaxInfoTR.Reverse();

                        int rows_count = TaxInfoTR.Count;

                        for (int row = 0; row < rows_count; row++)
                        {
                            if (row == rows_count - 1 || row == rows_count - 2 || row == rows_count - 3)
                            {
                                IList <IWebElement> Columns_row = TaxInfoTR[row].FindElements(By.TagName("td"));

                                int columns_count = Columns_row.Count;

                                for (int column = 0; column < columns_count; column++)
                                {
                                    if (column == columns_count - 2)
                                    {
                                        IWebElement ParcelBill_link = Columns_row[1].FindElement(By.TagName("a"));
                                        string      Parcelurl       = ParcelBill_link.GetAttribute("href");
                                        TaxInfoSearch.Add(Parcelurl);
                                    }
                                }
                            }
                        }

                        foreach (string TaxInfobill in TaxInfoSearch)
                        {
                            driver.Navigate().GoToUrl(TaxInfobill);
                            Thread.Sleep(3000);
                            driver.SwitchTo().Window(driver.WindowHandles.Last());
                            Thread.Sleep(2000);
                            try
                            {
                                Taxy         = driver.FindElement(By.Id("PropertyTaxLabel")).Text;
                                Taxy         = WebDriverTest.Before(Taxy, " Property Tax Statement");
                                Total_DUE    = driver.FindElement(By.Id("TotalDueTopText")).Text;
                                Last_PAYDATE = driver.FindElement(By.Id("LastPaymentTopText")).Text;
                                Last_PAYDATE = WebDriverTest.After(Last_PAYDATE, "Last payment made on: ");
                            }
                            catch
                            { }

                            try
                            {
                                IWebElement         IntrestTB = driver.FindElement(By.XPath("//*[@id='TaxPayerInfo']/tbody"));
                                IList <IWebElement> IntrestTR = IntrestTB.FindElements(By.TagName("tr"));
                                IList <IWebElement> IntrestTD;
                                foreach (IWebElement Intrest in IntrestTR)
                                {
                                    IntrestTD = Intrest.FindElements(By.TagName("td"));
                                    if (IntrestTD.Count != 0)
                                    {
                                        Tax_P = IntrestTD[0].Text;
                                        if (Tax_P.Contains("Tax Payer:"))
                                        {
                                            Tax_Payer = IntrestTD[1].Text;
                                        }
                                        Map = IntrestTD[0].Text;
                                        if (Map.Contains("Map Code:"))
                                        {
                                            Map_Code = IntrestTD[1].Text;
                                        }
                                        Desk = IntrestTD[0].Text;
                                        if (Desk.Contains("Description:"))
                                        {
                                            Desk_Pro = IntrestTD[1].Text;
                                        }
                                        Locy = IntrestTD[0].Text;
                                        if (Locy.Contains("Location:"))
                                        {
                                            Tax_Location = IntrestTD[1].Text;
                                        }
                                        Bl_No = IntrestTD[0].Text;
                                        if (Bl_No.Contains("Bill No:"))
                                        {
                                            Tax_Billno = IntrestTD[1].Text;
                                        }
                                        Disti = IntrestTD[0].Text;
                                        if (Disti.Contains("District:"))
                                        {
                                            Tax_Dist = IntrestTD[1].Text;
                                        }
                                    }
                                }
                            }
                            catch
                            { }

                            try
                            {
                                IWebElement         CinfoTB = driver.FindElement(By.XPath("//*[@id='BottomTable']/tbody"));
                                IList <IWebElement> CinfoTR = CinfoTB.FindElements(By.TagName("tr"));
                                IList <IWebElement> CinfoTD;
                                foreach (IWebElement Cinfo in CinfoTR)
                                {
                                    CinfoTD = Cinfo.FindElements(By.TagName("td"));
                                    if (CinfoTD.Count != 0 && !Cinfo.Text.Contains("Building Value") && Cinfo.Text != "")
                                    {
                                        Build_Val    = CinfoTD[0].Text;
                                        Land_Val     = CinfoTD[1].Text;
                                        Tax_Acres    = CinfoTD[2].Text;
                                        FrMkt_Val    = CinfoTD[3].Text;
                                        Tax_DueDate  = CinfoTD[4].Text;
                                        Tax_Exmpions = CinfoTD[7].Text;
                                    }
                                }
                            }
                            catch
                            { }

                            gc.CreatePdf(orderNumber, Parcel_ID, "Tax Info Details" + " " + Taxy, driver, "GA", "Fayette");

                            TaxInfo_Details = Taxy + "~" + Tax_Payer + "~" + Map_Code + "~" + Desk_Pro + "~" + Tax_Location + "~" + Tax_Billno + "~" + Tax_Dist + "~" + Last_PAYDATE + "~" + Build_Val + "~" + Land_Val + "~" + Tax_Acres + "~" + FrMkt_Val + "~" + Tax_Exmpions + "~" + Tax_DueDate + "~" + Total_DUE;
                            gc.insert_date(orderNumber, Parcel_ID, 793, TaxInfo_Details, 1, DateTime.Now);
                            Tax_Payer = ""; Map_Code = ""; Desk_Pro = ""; Tax_Location = ""; Tax_Billno = ""; Tax_Dist = ""; Last_PAYDATE = ""; Build_Val = ""; Land_Val = ""; Tax_Acres = ""; FrMkt_Val = ""; Tax_Exmpions = ""; Tax_DueDate = ""; Total_DUE = "";

                            try
                            {
                                IWebElement         DueTaxTB = driver.FindElement(By.XPath("//*[@id='CurrentDueTable']/tbody"));
                                IList <IWebElement> DueTaxTR = DueTaxTB.FindElements(By.TagName("tr"));
                                IList <IWebElement> DueTaxTD;

                                foreach (IWebElement DueTax in DueTaxTR)
                                {
                                    DueTaxTD = DueTax.FindElements(By.TagName("td"));
                                    if (DueTaxTD.Count != 0 && DueTaxTD.Count != 1 && DueTaxTD.Count != 8 && DueTaxTD.Count != 9)
                                    {
                                        Cu_Du = DueTaxTD[1].Text;
                                        if (Cu_Du.Contains("Current Due"))
                                        {
                                            Cur_Due = DueTaxTD[2].Text;
                                        }
                                        Penalt = DueTaxTD[1].Text;
                                        if (Penalt.Contains("Penalty"))
                                        {
                                            Tax_Penalty = DueTaxTD[2].Text;
                                        }
                                        In_Tx = DueTaxTD[1].Text;
                                        if (In_Tx.Contains("Interest"))
                                        {
                                            Int_Rest = DueTaxTD[2].Text;
                                        }
                                        Oth_Fe = DueTaxTD[1].Text;
                                        if (Oth_Fe.Contains("Other Fees"))
                                        {
                                            Other_Fees = DueTaxTD[2].Text;
                                        }
                                        Pre_Pay = DueTaxTD[1].Text;
                                        if (Pre_Pay.Contains("Previous Payments"))
                                        {
                                            Previous_Payments = DueTaxTD[2].Text;
                                        }
                                        Bc_Tx = DueTaxTD[1].Text;
                                        if (Bc_Tx.Contains("Back Taxes"))
                                        {
                                            Back_Taxes = DueTaxTD[2].Text;
                                        }
                                        Tl_Du = DueTaxTD[1].Text;
                                        if (Tl_Du.Contains("Total Due"))
                                        {
                                            TaxToal_Due = DueTaxTD[2].Text;
                                        }
                                    }
                                }

                                DueTaxInfo_Details = Taxy + "~" + Cur_Due + "~" + Tax_Penalty + "~" + Int_Rest + "~" + Other_Fees + "~" + Previous_Payments + "~" + Back_Taxes + "~" + TaxToal_Due;
                                gc.insert_date(orderNumber, Parcel_ID, 802, DueTaxInfo_Details, 1, DateTime.Now);
                            }
                            catch
                            { }

                            try
                            {
                                IWebElement         CityTaxPaymentTB = driver.FindElement(By.XPath("//*[@id='EntityTable']/tbody"));
                                IList <IWebElement> CityTaxPaymentTR = CityTaxPaymentTB.FindElements(By.TagName("tr"));
                                IList <IWebElement> CityTaxPaymentTD;

                                foreach (IWebElement CityTaxPayment in CityTaxPaymentTR)
                                {
                                    CityTaxPaymentTD = CityTaxPayment.FindElements(By.TagName("td"));
                                    if (CityTaxPaymentTD.Count != 0 && !CityTaxPayment.Text.Contains("Entity") && !CityTaxPayment.Text.Contains("Totals: "))
                                    {
                                        Entity       = CityTaxPaymentTD[0].Text;
                                        FMV          = CityTaxPaymentTD[1].Text;
                                        Net_Assmnt   = CityTaxPaymentTD[2].Text;
                                        Exmpl        = CityTaxPaymentTD[3].Text;
                                        Taxble_Value = CityTaxPaymentTD[4].Text;
                                        Millage_Rate = CityTaxPaymentTD[5].Text;
                                        Grs_Tax      = CityTaxPaymentTD[6].Text;
                                        Cretit       = CityTaxPaymentTD[7].Text;
                                        NetTax       = CityTaxPaymentTD[8].Text;

                                        CityPayment_details = Entity + "~" + FMV + "~" + Net_Assmnt + "~" + Exmpl + "~" + Taxble_Value + "~" + Millage_Rate + "~" + Grs_Tax + "~" + Cretit + "~" + NetTax;
                                        gc.insert_date(orderNumber, Parcel_ID, 803, CityPayment_details, 1, DateTime.Now);
                                    }
                                }
                            }
                            catch
                            { }

                            try
                            {
                                IWebElement         CityTaxPaymentTB1 = driver.FindElement(By.XPath("//*[@id='EntityTable']/tbody"));
                                IList <IWebElement> CityTaxPaymentTR1 = CityTaxPaymentTB1.FindElements(By.TagName("tr"));
                                IList <IWebElement> CityTaxPaymentTD1;

                                foreach (IWebElement CityTaxPayment1 in CityTaxPaymentTR1)
                                {
                                    CityTaxPaymentTD1 = CityTaxPayment1.FindElements(By.TagName("td"));
                                    if (CityTaxPaymentTD1.Count != 0 && CityTaxPayment1.Text.Contains("Totals: "))
                                    {
                                        Taxble_Value1 = CityTaxPaymentTD1[0].Text;
                                        Millage_Rate1 = CityTaxPaymentTD1[1].Text;
                                        Grs_Tax1      = CityTaxPaymentTD1[2].Text;
                                        Cretit1       = CityTaxPaymentTD1[3].Text;
                                        NetTax1       = CityTaxPaymentTD1[4].Text;

                                        CityPayment_details = "" + "~" + "" + "~" + "" + "~" + "" + "~" + Taxble_Value1 + "~" + Millage_Rate1 + "~" + Grs_Tax1 + "~" + Cretit1 + "~" + NetTax1;
                                        gc.insert_date(orderNumber, Parcel_ID, 803, CityPayment_details, 1, DateTime.Now);
                                    }
                                }
                            }
                            catch
                            { }
                        }
                    }
                    catch
                    { }

                    //Tax Avthority
                    driver.Navigate().GoToUrl("http://www.fayettecountytaxcomm.com/");
                    Thread.Sleep(2000);

                    Tax_Auth1     = driver.FindElement(By.XPath("/html/body/div/table/tbody/tr[3]/td[3]/p[19]")).Text.Replace("Suite 109 (Motor Vehicles)", "");
                    Tax_Auth2     = driver.FindElement(By.XPath("/html/body/div/table/tbody/tr[3]/td[3]/p[15]")).Text;
                    Tax_Authotiry = Tax_Auth1 + " & " + Tax_Auth2;

                    TaxAuthority_Details = Tax_Authotiry;
                    gc.CreatePdf(orderNumber, Parcel_ID, "Tax Authority Details", driver, "GA", "Fayette");
                    gc.insert_date(orderNumber, Parcel_ID, 804, TaxAuthority_Details, 1, DateTime.Now);

                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "GA", "Fayette", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderNumber, "GA", "Fayette");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw;
                }
            }
        }
Example #13
0
        public string FTP_NevadaCA(string address, string assessment_id, string parcelNumber, string searchType, string orderNumber, string directParcel, string ownername)
        {
            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "", AssessTakenTime = "", TaxTakentime = "", CityTaxtakentime = "";
            string TotaltakenTime = "";

            List <string> strTaxRealestate1 = new List <string>();
            string        address1 = "", Assess = "", fee_parcel = "", Tra = "";
            string        Roll_Category = "", Address = "", Tax_year = "", First_Installment_Paid_Status = "", First_Installment_Paid_Date = "", First_Installment_Total_Due = "", First_Installment_Total_Paid = "", First_Installment_Balance = "", Second_Installment_Paid_Status = "", Second_Installment_Paid_Date = "", Second_Installment_Total_Due = "", Second_Installment_Total_Paid = "", Second_Installment_Balance = "", FirstandSecondInstallment_Total_Due = "", FirstandSecondInstallment_Total_Paid = "", FirstandSecondInstallment_Total_Balance = "";
            string        Assessor_ID_Number = "", Tax_Rate_Area = "";
            string        Default_Number = "", Pay_Plan_in_Effect = "", Annual_Payment = "", Balance = "";

            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            //driver = new PhantomJSDriver();
            //  driver = new ChromeDriver();
            using (driver = new PhantomJSDriver())
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");

                    if (searchType == "titleflex")
                    {
                        gc.TitleFlexSearch(orderNumber, parcelNumber, ownername, address, "CA", "Nevada");
                        parcelNumber = GlobalClass.global_parcelNo;
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        //parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType = "parcel";
                    }

                    //if (searchType == "address")
                    //{
                    //    var Select = driver.FindElement(By.Id("idSitus"));
                    //    var selectElement1 = new SelectElement(Select);
                    //    selectElement1.SelectByText("Begins with");
                    //    driver.FindElement(By.XPath(" /html/body/form/center/table/tbody/tr[5]/td[3]/input")).SendKeys(address);
                    //    gc.CreatePdf_WOP(orderNumber, "Address search", driver, "CA", "Nevada");
                    //    driver.FindElement(By.XPath("/html/body/form/center/p/input[1]")).SendKeys(Keys.Enter);
                    //    gc.CreatePdf_WOP(orderNumber, "Address search result", driver, "CA", "Nevada");
                    //    Thread.Sleep(6000);
                    //    IWebElement tbmulti = driver.FindElement(By.XPath("/html/body/form/center/table/tbody"));
                    //    IList<IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                    //    int maxCheck = 0;
                    //    if (TRmulti.Count > 6)
                    //    {
                    //        IList<IWebElement> TDmulti;
                    //        foreach (IWebElement row in TRmulti)
                    //        {
                    //            if (maxCheck <= 25)
                    //            {
                    //                if (!row.Text.Contains("Assessment No."))
                    //                {
                    //                    TDmulti = row.FindElements(By.TagName("td"));
                    //                    if (TDmulti.Count == 3 && TDmulti[0].Text.Trim() != "")
                    //                    {
                    //                        Assess = TDmulti[0].Text;
                    //                        fee_parcel = TDmulti[1].Text;
                    //                        Tra = TDmulti[2].Text;
                    //                    }
                    //                    if (TDmulti.Count == 1 && TDmulti[0].Text.Trim() != "")
                    //                    {
                    //                        address1 = TDmulti[0].Text;
                    //                        string multi1 = Assess + "~" + Tra + "~" + address1;
                    //                        gc.insert_date(orderNumber, fee_parcel, 518, multi1, 1, DateTime.Now);
                    //                        //Assessment Id~Tra~Address
                    //                    }
                    //                }
                    //                maxCheck++;
                    //            }
                    //        }

                    //        if (TRmulti.Count > 25)
                    //        {
                    //            HttpContext.Current.Session["multiParcel_NevadaCA_Multicount"] = "Maximum";
                    //        }
                    //        else
                    //        {
                    //            HttpContext.Current.Session["multiparcel_NevadaCA"] = "Yes";
                    //        }
                    //        driver.Quit();
                    //        gc.mergpdf(orderNumber, "CA", "Nevada");
                    //        return "MultiParcel";
                    //    }
                    //}
                    //else if (searchType == "parcel")
                    //{
                    //    if ((HttpContext.Current.Session["titleparcel"] != null && HttpContext.Current.Session["titleparcel"].ToString() != ""))
                    //    {
                    //        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                    //    }
                    //    var Select = driver.FindElement(By.Id("idfeeparcel"));
                    //    var selectElement1 = new SelectElement(Select);
                    //    selectElement1.SelectByText("Begins with");
                    //    if (parcelNumber.Contains("-"))
                    //    {
                    //        parcelNumber = parcelNumber.Replace("-", "");
                    //    }
                    //    string a = parcelNumber.Substring(0, 3);
                    //    string b = parcelNumber.Substring(3, 3);
                    //    string c = parcelNumber.Substring(6, 3);
                    //    string d = parcelNumber.Substring(9, 3);
                    //    parcelNumber = a + "-" + b + "-" + c + "-" + d;
                    //    driver.FindElement(By.XPath("/html/body/form/center/table/tbody/tr[4]/td[3]/input")).SendKeys(parcelNumber);
                    //    gc.CreatePdf(orderNumber, parcelNumber, "Parcel search", driver, "CA", "Nevada");
                    //    driver.FindElement(By.XPath("/html/body/form/center/p/input[1]")).SendKeys(Keys.Enter);
                    //}
                    //IWebElement runButton = driver.FindElement(By.XPath("/html/body/form/center/table/tbody/tr[2]/td[1]/a"));
                    //runButton.Click();
                    //Thread.Sleep(4000);

                    ////property details
                    //string parcelNumber = "", owner_name = "", ImprovementValue = "", totalValue = "", Bussiness_property = "";
                    //string fulltabletext = driver.FindElement(By.XPath(" / html / body / form / center / table / tbody")).Text.Trim().Replace("\r\n", "");
                    //parcelNumber = gc.Between(fulltabletext, "Assessor Parcel Number (APN)", "Assessment Number").Trim();
                    //gc.CreatePdf(orderNumber, parcelNumber, "Property details", driver, "CA", "Nevada");
                    //Assessor_ID_Number = gc.Between(fulltabletext, "Assessment Number", "Tax Rate Area (TRA)").Trim();
                    //Tax_Rate_Area = gc.Between(fulltabletext, "Tax Rate Area (TRA)", "Current Document Number").Trim();
                    //owner_name = gc.Between(fulltabletext, "Owner", "Lot Size").Trim();
                    //string prop = Assessor_ID_Number + "~" + Tax_Rate_Area + "~" + owner_name;
                    ////  Assessment Number~Tax Rate Area~Owner Name
                    //gc.insert_date(orderNumber, parcelNumber, 513, prop, 1, DateTime.Now);

                    ////Assessment details
                    //string Land = "", Fixtures = "", Growing = "", Personal_Property = "", Homeowners_Exemption = "", Other_Exemption = "", Net_Assessment = "";
                    //Land = gc.Between(fulltabletext, "Land", "Structure").Trim();
                    //ImprovementValue = gc.Between(fulltabletext, "Structure", "Fixtures").Trim();
                    //Fixtures = gc.Between(fulltabletext, "Fixtures", "Growing").Trim();
                    //Growing = gc.Between(fulltabletext, "Growing", "Total Land and Improvements").Trim();
                    //totalValue = gc.Between(fulltabletext, "Total Land and Improvements", "Personal Property").Trim();
                    //Personal_Property = gc.Between(fulltabletext, "Personal Property", "Business Property").Trim();
                    //Bussiness_property = gc.Between(fulltabletext, "Business Property", "Homeowners Exemption (HOX)").Trim();
                    //Homeowners_Exemption = gc.Between(fulltabletext, "Homeowners Exemption (HOX)", "Other Exemptions").Trim();
                    //Other_Exemption = gc.Between(fulltabletext, "Other Exemptions", "Net Assessment").Trim();
                    //Net_Assessment = WebDriverTest.After(fulltabletext, "Net Assessment");
                    //Net_Assessment = WebDriverTest.Before(Net_Assessment, "NavigationNew Search");
                    //string assess = Land + "~" + ImprovementValue + "~" + Fixtures + "~" + Growing + "~" + totalValue + "~" + Personal_Property + "~" + Bussiness_property + "~" + Homeowners_Exemption + "~" + Other_Exemption + "~" + Net_Assessment;
                    //gc.insert_date(orderNumber, parcelNumber, 514, assess, 1, DateTime.Now);
                    ////Land Value~Improvement Value~Fixtures~Growing~Total Value~Personal Property~Business Property~Homeowners Exemption~Other Exemptions~Net Assessment
                    //AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    //Tax details
                    driver.Navigate().GoToUrl("https://common1.mptsweb.com/mbc/nevada/tax/search");
                    string[] parceid = parcelNumber.Split('-');
                    string   strparcel = "", parcelId = "", TaxAuthority = "", Address1 = "", Address2 = "";

                    // Tax Authority
                    string TaxAuth1 = "", TaxAuth2 = "", TaxAuth3 = "";
                    try
                    {
                        IWebElement itaxauth1 = driver.FindElement(By.XPath("//*[@id='footer']/div[1]/div/div[1]/div[2]/div/ul[1]/li[2]"));
                        TaxAuth1 = itaxauth1.Text;
                        IWebElement itaxauth2 = driver.FindElement(By.XPath("//*[@id='footer']/div[1]/div/div[1]/div[2]/div/ul[1]/li[3]"));
                        TaxAuth2 = itaxauth2.Text;
                        IWebElement itaxauth3 = driver.FindElement(By.XPath("//*[@id='footer']/div[1]/div/div[1]/div[2]/div/ul[1]/li[4]"));
                        TaxAuth3     = itaxauth3.Text;
                        TaxAuthority = TaxAuth1 + " " + TaxAuth2 + " " + TaxAuth3;
                    }
                    catch { }
                    try
                    {
                        for (int i = 0; i < parceid.Length; i++)
                        {
                            if (parceid[i].Length == 2)
                            {
                                strparcel = "0" + parceid[i];
                                parcelId += strparcel + "-";
                            }
                            else if (parceid[i].Length == 1)
                            {
                                strparcel = "00" + parceid[i];
                                parcelId += strparcel + "-";
                            }
                            else if (parceid[i].Length == 3)
                            {
                                parcelId += parceid[i] + "-";
                            }
                        }
                        parcelNumber = parcelId.TrimEnd('-');
                    }
                    catch { }

                    for (int k = 1; k < 3; k++)
                    {
                        if (k == 1)
                        {
                            try
                            {
                                //select year
                                var year           = driver.FindElement(By.Id("SelTaxYear"));
                                var selectElement1 = new SelectElement(year);
                                selectElement1.SelectByIndex(0);
                                //searchBy
                                var searchby       = driver.FindElement(By.Id("SearchVal"));
                                var selectElement2 = new SelectElement(searchby);
                                selectElement2.SelectByText("FEE PARCEL");
                                driver.FindElement(By.XPath("//*[@id='SearchValue']")).SendKeys(parcelNumber);
                                driver.FindElement(By.XPath("//*[@id='SearchSubmit']")).SendKeys(Keys.Enter);
                                Thread.Sleep(3000);
                                gc.CreatePdf(orderNumber, parcelNumber, "tax1", driver, "CA", "Nevada");
                            }
                            catch { }
                        }

                        else if (k == 2)
                        {
                            try
                            {
                                //select year
                                var year           = driver.FindElement(By.Id("SelTaxYear"));
                                var selectElement1 = new SelectElement(year);
                                selectElement1.SelectByIndex(1);
                                //searchBy
                                var searchby       = driver.FindElement(By.Id("SearchVal"));
                                var selectElement2 = new SelectElement(searchby);
                                selectElement2.SelectByText("FEE PARCEL");
                                driver.FindElement(By.XPath("//*[@id='SearchSubmit']")).SendKeys(Keys.Enter);
                                Thread.Sleep(3000);
                                gc.CreatePdf(orderNumber, parcelNumber, "tax2", driver, "CA", "Nevada");
                            }
                            catch { }
                        }

                        else if (k == 3)
                        {
                            try
                            {
                                //select year
                                var year           = driver.FindElement(By.Id("SelTaxYear"));
                                var selectElement1 = new SelectElement(year);
                                selectElement1.SelectByIndex(2);
                                //searchBy
                                var searchby       = driver.FindElement(By.Id("SearchVal"));
                                var selectElement2 = new SelectElement(searchby);
                                selectElement2.SelectByText("FEE PARCEL");
                                driver.FindElement(By.XPath("//*[@id='SearchSubmit']")).SendKeys(Keys.Enter);
                                Thread.Sleep(3000);
                                gc.CreatePdf(orderNumber, parcelNumber, "tax3", driver, "CA", "Nevada");
                            }
                            catch { }
                        }

                        int j;
                        //Current Tax Details Table
                        try
                        {
                            int divCount = driver.FindElements(By.XPath("//*[@id='ResultDiv']/div")).Count;
                            for (j = 1; j <= divCount; j++)
                            {
                                IWebElement Itaxstmt = driver.FindElement(By.XPath("//*[@id='ResultDiv']/div[" + j + "]/div/div/div/a"));
                                string      stmt1    = Itaxstmt.GetAttribute("href");
                                strTaxRealestate1.Add(stmt1);
                            }
                        }
                        catch { }
                    }
                    foreach (string real in strTaxRealestate1)
                    {
                        driver.Navigate().GoToUrl(real);
                        Thread.Sleep(4000);
                        string pdfassess         = driver.FindElement(By.XPath(" /html/body/div[2]/section/div/div/div/div[6]/div/div[1]/div[1]/div[2]")).Text;
                        string pdfyear           = driver.FindElement(By.XPath("/html/body/div[2]/section/div/div/div/div[6]/div/div[1]/div[3]/div[2]")).Text;
                        string pdf               = pdfassess + " " + pdfyear;
                        string fulltabletextTax1 = driver.FindElement(By.XPath("//*[@id='h2tab1']/div[1]/div[1]/dl")).Text.Trim().Replace("\r\n", "");
                        First_Installment_Paid_Status = gc.Between(fulltabletextTax1, "Paid Status", "Delinq. Date").Trim();
                        First_Installment_Paid_Date   = gc.Between(fulltabletextTax1, "Delinq. Date", "Total Due").Trim();
                        First_Installment_Total_Due   = gc.Between(fulltabletextTax1, "Total Due", "Total Paid").Trim();
                        First_Installment_Total_Paid  = gc.Between(fulltabletextTax1, "Total Paid", "Balance").Trim();
                        First_Installment_Balance     = WebDriverTest.After(fulltabletextTax1, "Balance");

                        string fulltabletextTax2 = driver.FindElement(By.XPath("//*[@id='h2tab1']/div[1]/div[2]/dl")).Text.Trim().Replace("\r\n", "");
                        Second_Installment_Paid_Status = gc.Between(fulltabletextTax2, "Paid Status", "Delinq. Date").Trim();
                        Second_Installment_Paid_Date   = gc.Between(fulltabletextTax2, "Delinq. Date", "Total Due").Trim();
                        Second_Installment_Total_Due   = gc.Between(fulltabletextTax2, "Total Due", "Total Paid").Trim();
                        Second_Installment_Total_Paid  = gc.Between(fulltabletextTax2, "Total Paid", "Balance").Trim();
                        Second_Installment_Balance     = WebDriverTest.After(fulltabletextTax2, "Balance");

                        string fulltabletextTax3 = driver.FindElement(By.XPath("//*[@id='h2tab1']/div[2]/dl")).Text.Trim().Replace("\r\n", "");
                        FirstandSecondInstallment_Total_Due     = gc.Between(fulltabletextTax3, "Total Due", "Total Paid").Trim();
                        FirstandSecondInstallment_Total_Paid    = gc.Between(fulltabletextTax3, "Total Paid", "Total Balance").Trim();
                        FirstandSecondInstallment_Total_Balance = WebDriverTest.After(fulltabletextTax3, "Total Balance");

                        gc.CreatePdf(orderNumber, parcelNumber, "Taxes" + pdf, driver, "CA", "Nevada");
                        driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/ul/li[2]/a")).Click();
                        Thread.Sleep(3000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Assess info" + pdf, driver, "CA", "Nevada");
                        string fulltabletextTax4 = driver.FindElement(By.XPath("//*[@id='h2tab2']/dl")).Text.Trim().Replace("\r\n", "");
                        string assessment        = gc.Between(fulltabletextTax4, "Assessment", "Taxyear").Trim();
                        Tax_year      = gc.Between(fulltabletextTax4, "Taxyear", "Parcel Number").Trim();
                        Roll_Category = gc.Between(fulltabletextTax4, "Roll Category", "Doc Num").Trim();
                        IWebElement IAddress1 = driver.FindElement(By.XPath("//*[@id='h2tab2']/dl/dd[6]"));
                        Address1 = IAddress1.Text;
                        IWebElement IAddress2 = driver.FindElement(By.XPath("//*[@id='h2tab2']/dl/dd[7]"));
                        Address2 = IAddress2.Text;
                        Address  = Address1 + " " + Address2;
                        string tax = assessment + "~" + Roll_Category + "~" + Address + "~" + Tax_year + "~" + First_Installment_Paid_Status + "~" + First_Installment_Paid_Date + "~" + First_Installment_Total_Due + "~" + First_Installment_Total_Paid + "~" + First_Installment_Balance + "~" + Second_Installment_Paid_Status + "~" + Second_Installment_Paid_Date + "~" + Second_Installment_Total_Due + "~" + Second_Installment_Total_Paid + "~" + Second_Installment_Balance + "~" + FirstandSecondInstallment_Total_Due + "~" + FirstandSecondInstallment_Total_Paid + "~" + FirstandSecondInstallment_Total_Balance + "~" + TaxAuthority;
                        gc.insert_date(orderNumber, parcelNumber, 1271, tax, 1, DateTime.Now);

                        //      Assessment~Roll Category~Address~Tax year~First Installment Paid Status~First Installment Paid Date~First Installment Total Due~First Installment Total Paid~First Installment Balance~Second Installment Paid Status~Second Installment Paid Date~Second Installment Total Due~Second Installment Total Paid~Second Installment Balance~First and Second Installment Total Due~First and Second Installment Total Paid~First and Second Installment Total Balance
                        //*[@id="h2tab2"]/dl/dd[6]
                        //download taxbill
                        try
                        {
                            IWebElement Itaxbill = driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/div/div[1]/div[4]/div/a"));
                            string      URL1     = Itaxbill.GetAttribute("href");
                            gc.downloadfile(URL1, orderNumber, parcelNumber, "TaxBill" + pdf, "CA", "Nevada");
                        }
                        catch { }


                        //Taxcode Info

                        driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/ul/li[3]/a")).Click();
                        Thread.Sleep(3000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Tax code" + pdf, driver, "CA", "Nevada");

                        int      count       = driver.FindElements(By.XPath("//*[@id='h2tab3']/div")).Count;
                        int      divCount2   = count + 1;
                        string[] TaxCode     = new string[divCount2];
                        string[] description = new string[divCount2];
                        string[] rate        = new string[divCount2];
                        string[] Istinstall  = new string[divCount2];
                        string[] IIndinstall = new string[divCount2];
                        string[] total       = new string[divCount2];
                        string[] phone       = new string[divCount2];
                        for (int i = 1; i <= count; i++)
                        {
                            string Description1 = driver.FindElement(By.XPath(" //*[@id='h2tab3']/div[" + i + "]/div/div/dl")).Text.Trim().Replace("\r\n", "");
                            TaxCode[i]     = gc.Between(Description1, "Tax Code", "Description").Trim();
                            description[i] = gc.Between(Description1, "Description", "Rate").Trim();
                            rate[i]        = gc.Between(Description1, "Rate", "1st Installment").Trim();
                            Istinstall[i]  = gc.Between(Description1, "1st Installment", "2nd Installment").Trim();
                            IIndinstall[i] = gc.Between(Description1, "2nd Installment", "Total").Trim();
                            total[i]       = gc.Between(Description1, "Total", "Phone").Trim();
                            phone[i]       = WebDriverTest.After(Description1, "Phone");
                            string taxcode = Tax_year + "~" + TaxCode[i] + "~" + description[i] + "~" + rate[i] + "~" + Istinstall[i] + "~" + IIndinstall[i] + "~" + total[i] + "~" + phone[i];
                            gc.insert_date(orderNumber, parcelNumber, 1272, taxcode, 1, DateTime.Now);
                        }
                        //Tax Year~Tax Code~Description~Rate~1st Installment~2nd Installment~Total~Phone

                        //Default Tax
                        try
                        {
                            driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/ul/li[4]/a")).Click();
                            Thread.Sleep(3000);
                            gc.CreatePdf(orderNumber, parcelNumber, "Default Tax" + pdf, driver, "CA", "Nevada");

                            Default_Number     = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[1]/div[2]")).Text;
                            Pay_Plan_in_Effect = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[2]/div[2]")).Text;
                            Annual_Payment     = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[3]/div[2]")).Text;
                            Balance            = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[4]/div[2]")).Text;

                            string default_tax = Tax_year + "~" + Default_Number + "~" + Pay_Plan_in_Effect + "~" + Annual_Payment + "~" + Balance;
                            gc.insert_date(orderNumber, parcelNumber, 1273, default_tax, 1, DateTime.Now);
                        }
                        //Tax Year~Default Number~Pay Plan in Effect~Annual Payment~Balance
                        catch { }
                    }
                    TaxTime     = DateTime.Now.ToString("HH:mm:ss");
                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "CA", "Nevada", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderNumber, "CA", "Nevada");
                    return("Data Inserted Successfully");
                }

                catch (Exception ex)
                {
                    driver.Quit();
                    throw ex;
                }
            }
        }
        public string FTP_CAShasta(string houseno, string sname, string direction, string type, string unitno, string parcelNumber, string searchType, string orderNumber, string directParcel, string ownername)
        {
            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "", AssessTakenTime = "", TaxTakentime = "", CityTaxtakentime = "";
            string TotaltakenTime = "";

            List <string> strTaxRealestate1 = new List <string>();
            string        address1 = "", Assess = "", fee_parcel = "", Tra = "";
            string        Roll_Category = "", Address = "", Tax_year = "", First_Installment_Paid_Status = "", First_Installment_Paid_Date = "", First_Installment_Total_Due = "", First_Installment_Total_Paid = "", First_Installment_Balance = "", Second_Installment_Paid_Status = "", Second_Installment_Paid_Date = "", Second_Installment_Total_Due = "", Second_Installment_Total_Paid = "", Second_Installment_Balance = "", FirstandSecondInstallment_Total_Due = "", FirstandSecondInstallment_Total_Paid = "", FirstandSecondInstallment_Total_Balance = "";
            string        Assessor_ID_Number = "", Tax_Rate_Area = "";
            string        Default_Number = "", Pay_Plan_in_Effect = "", Annual_Payment = "", Balance = "";

            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            // driver = new PhantomJSDriver();
            //  driver = new ChromeDriver();
            using (driver = new PhantomJSDriver())
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");
                    driver.Navigate().GoToUrl("https://www.co.shasta.ca.us/index/assessor_index/assessment_inquiry.aspx");
                    Thread.Sleep(4000);
                    if (searchType == "titleflex")
                    {
                        string address = "";
                        address = houseno + " " + sname + " " + direction + " " + type + " " + unitno;
                        gc.TitleFlexSearch(orderNumber, parcelNumber.Trim(), ownername.Trim(), address.Trim(), "CA", "Shasta");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_ShataCA"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }
                    if (searchType == "block")
                    {
                        IWebElement iframeElement = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/div/div[2]/div/div[2]/div/div[2]/div/div[2]/iframe"));
                        driver.SwitchTo().Frame(iframeElement);
                        var Select         = driver.FindElement(By.Id("idAsmt"));
                        var selectElement1 = new SelectElement(Select);
                        selectElement1.SelectByText("Begins with");
                        driver.FindElement(By.XPath("/html/body/form/table/tbody/tr[3]/td[3]/input")).SendKeys(unitno);
                        gc.CreatePdf(orderNumber, parcelNumber, "Assessment search", driver, "CA", "Shasta");
                        driver.FindElement(By.XPath("/html/body/form/p/input[1]")).SendKeys(Keys.Enter);
                        Thread.Sleep(4000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Assessment search result", driver, "CA", "Shasta");
                    }
                    else if (searchType == "parcel")
                    {
                        IWebElement iframeElement = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/div/div[2]/div/div[2]/div/div[2]/div/div[2]/iframe"));
                        driver.SwitchTo().Frame(iframeElement);

                        var Select         = driver.FindElement(By.Id("idfeeparcel"));
                        var selectElement1 = new SelectElement(Select);
                        selectElement1.SelectByText("Begins with");

                        driver.FindElement(By.XPath("/html/body/form/table/tbody/tr[4]/td[3]/input")).SendKeys(parcelNumber);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search", driver, "CA", "Shasta");
                        driver.FindElement(By.XPath("/html/body/form/p/input[1]")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search result", driver, "CA", "Shasta");



                        IWebElement         tbmulti = driver.FindElement(By.XPath("/html/body/form/table/tbody"));
                        IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                        int l = 0;
                        if (TRmulti.Count > 6)
                        {
                            IList <IWebElement> TDmulti;
                            foreach (IWebElement row in TRmulti)
                            {
                                if (l <= 25)
                                {
                                    if (!row.Text.Contains("Asmt"))
                                    {
                                        TDmulti = row.FindElements(By.TagName("td"));
                                        if (TDmulti.Count == 3 && TDmulti[0].Text.Trim() != "")
                                        {
                                            Assess     = TDmulti[0].Text;
                                            fee_parcel = TDmulti[1].Text;
                                            Tra        = TDmulti[2].Text;

                                            string multi1 = fee_parcel + "~" + Tra;
                                            gc.insert_date(orderNumber, Assess, 663, multi1, 1, DateTime.Now);
                                        }
                                    }
                                    l++;
                                }
                            }

                            if (TRmulti.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_CAShasta_Multicount"] = "Maximum";
                                driver.Quit();
                                gc.mergpdf(orderNumber, "CA", "Shasta");
                                return("Maximum");
                            }
                            else
                            {
                                HttpContext.Current.Session["multiparcel_CAShasta"] = "Yes";
                                driver.Quit();
                                gc.mergpdf(orderNumber, "CA", "Shasta");
                                return("MultiParcel");
                            }
                        }
                    }

                    try
                    {
                        IWebElement INodata = driver.FindElement(By.XPath("/html/body/form/table"));
                        if (INodata.Text.Contains("Assessor Inquiry: Please enter search criteria"))
                        {
                            HttpContext.Current.Session["Nodata_ShataCA"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }

                    string parcel_id1 = "";
                    parcel_id1 = driver.FindElement(By.XPath("/html/body/form/table/tbody/tr[2]/td[2]")).Text.Trim();

                    IWebElement runButton = driver.FindElement(By.XPath("/html/body/form/table/tbody/tr[2]/td[1]/a"));
                    runButton.Click();
                    Thread.Sleep(4000);

                    //property details
                    string Parcel_id = "", owner_name = "", ImprovementValue = "", totalValue = "", Bussiness_property = "", PropertyType = "", Acres = "", AsmtDescription = "", AsmtStatus = "", YearBuilt = "";
                    string fulltabletext = driver.FindElement(By.XPath("/html/body/form/table/tbody")).Text.Trim().Replace("\r\n", "");
                    Parcel_id = gc.Between(fulltabletext, "Assessor ID Number", "Tax Rate Area (TRA)").Trim();
                    gc.CreatePdf(orderNumber, parcel_id1, "Property details", driver, "CA", "Shasta");

                    Tax_Rate_Area   = gc.Between(fulltabletext, "Tax Rate Area (TRA)", "Last Recording Date").Trim();
                    PropertyType    = gc.Between(fulltabletext, "Property Type", "Acres").Trim();
                    Acres           = gc.Between(fulltabletext, "Acres", "Asmt Description").Trim();
                    AsmtDescription = gc.Between(fulltabletext, "Asmt Description", "Asmt Status").Trim();
                    AsmtStatus      = gc.Between(fulltabletext, "Asmt Status", "Roll Values").Trim();
                    YearBuilt       = gc.Between(fulltabletext, "Year Built", "Bedrooms").Trim();
                    string prop = Parcel_id + "~" + Tax_Rate_Area + "~" + PropertyType + "~" + Acres + "~" + AsmtDescription + "~" + AsmtStatus + "~" + YearBuilt;
                    //  Assessment Number~Tax Rate Area~Property Type~Acres~Asmt Description~Asmt Status~Year Built

                    gc.insert_date(orderNumber, parcel_id1, 658, prop, 1, DateTime.Now);

                    //Assessment details
                    string Land = "", Fixtures = "", Growing = "", Personal_Property = "", Homeowners_Exemption = "", Other_Exemption = "", Net_Assessment = "";
                    Land                 = gc.Between(fulltabletext, "Land", "Structure").Trim();
                    ImprovementValue     = gc.Between(fulltabletext, "Structure", "Fixtures").Trim();
                    Fixtures             = gc.Between(fulltabletext, "Fixtures", "Growing").Trim();
                    Growing              = gc.Between(fulltabletext, "Growing", "Total Land and Improvements").Trim();
                    totalValue           = gc.Between(fulltabletext, "Total Land and Improvements", "Personal Property").Trim();
                    Personal_Property    = gc.Between(fulltabletext, "Personal Property", "Business Property").Trim();
                    Bussiness_property   = gc.Between(fulltabletext, "Business Property", "Homeowners Exemption").Trim();
                    Homeowners_Exemption = gc.Between(fulltabletext, "Homeowners Exemption", "Other Exemption").Trim();
                    Other_Exemption      = gc.Between(fulltabletext, "Other Exemption", "Net Assessment").Trim();
                    Net_Assessment       = gc.Between(fulltabletext, "Net Assessment", "Ownership").Trim();
                    string assess = Land + "~" + ImprovementValue + "~" + Fixtures + "~" + Growing + "~" + totalValue + "~" + Personal_Property + "~" + Bussiness_property + "~" + Homeowners_Exemption + "~" + Other_Exemption + "~" + Net_Assessment;
                    gc.insert_date(orderNumber, parcel_id1, 659, assess, 1, DateTime.Now);
                    //Land Value~Improvement Value~Fixtures~Growing~Total Value~Personal Property~Business Property~Homeowners Exemption~Other Exemptions~Net Assessment
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");
                    //Tax details
                    driver.Navigate().GoToUrl("https://common2.mptsweb.com/mbc/shasta/tax/search#");
                    for (int k = 1; k < 4; k++)
                    {
                        if (k == 1)
                        {
                            //select year
                            var year           = driver.FindElement(By.Id("SelTaxYear"));
                            var selectElement1 = new SelectElement(year);
                            selectElement1.SelectByIndex(0);
                            //searchBy
                            var searchby       = driver.FindElement(By.Id("SearchVal"));
                            var selectElement2 = new SelectElement(searchby);
                            selectElement2.SelectByText("FEE PARCEL");
                            driver.FindElement(By.XPath("//*[@id='SearchValue']")).SendKeys(parcel_id1);
                            driver.FindElement(By.XPath("//*[@id='SearchSubmit']")).SendKeys(Keys.Enter);
                            Thread.Sleep(3000);
                            gc.CreatePdf(orderNumber, parcel_id1, "tax1", driver, "CA", "Shasta");
                        }

                        else if (k == 2)
                        {
                            //select year
                            var year           = driver.FindElement(By.Id("SelTaxYear"));
                            var selectElement1 = new SelectElement(year);
                            selectElement1.SelectByIndex(1);
                            //searchBy
                            var searchby       = driver.FindElement(By.Id("SearchVal"));
                            var selectElement2 = new SelectElement(searchby);
                            selectElement2.SelectByText("FEE PARCEL");
                            driver.FindElement(By.XPath("//*[@id='SearchSubmit']")).SendKeys(Keys.Enter);
                            Thread.Sleep(3000);
                            gc.CreatePdf(orderNumber, parcel_id1, "tax2", driver, "CA", "Shasta");
                        }

                        else if (k == 3)
                        {
                            //select year
                            var year           = driver.FindElement(By.Id("SelTaxYear"));
                            var selectElement1 = new SelectElement(year);
                            selectElement1.SelectByIndex(2);
                            //searchBy
                            var searchby       = driver.FindElement(By.Id("SearchVal"));
                            var selectElement2 = new SelectElement(searchby);
                            selectElement2.SelectByText("FEE PARCEL");
                            driver.FindElement(By.XPath("//*[@id='SearchSubmit']")).SendKeys(Keys.Enter);
                            Thread.Sleep(3000);
                            gc.CreatePdf(orderNumber, parcel_id1, "tax3", driver, "CA", "Shasta");
                        }

                        int j;
                        //Current Tax Details Table
                        try
                        {
                            int divCount = driver.FindElements(By.XPath("//*[@id='ResultDiv']/div")).Count;
                            for (j = 1; j <= divCount; j++)
                            {
                                IWebElement Itaxstmt = driver.FindElement(By.XPath("//*[@id='ResultDiv']/div[" + j + "]/div/div/div/a"));
                                string      stmt1    = Itaxstmt.GetAttribute("href");
                                strTaxRealestate1.Add(stmt1);
                            }
                        }
                        catch { }
                    }
                    int k1 = 1;
                    foreach (string real in strTaxRealestate1)
                    {
                        driver.Navigate().GoToUrl(real);
                        Thread.Sleep(4000);

                        string pdfassess         = driver.FindElement(By.XPath(" /html/body/div[2]/section/div/div/div/div[6]/div/div[1]/div[1]/div[2]")).Text;
                        string pdfyear           = driver.FindElement(By.XPath("/html/body/div[2]/section/div/div/div/div[6]/div/div[1]/div[3]/div[2]")).Text;
                        int    pdf               = k1;
                        string fulltabletextTax1 = driver.FindElement(By.XPath("//*[@id='h2tab1']/div[1]/div[1]/dl")).Text.Trim().Replace("\r\n", "");
                        if (fulltabletextTax1.Contains("Delinq. Date"))
                        {
                            First_Installment_Paid_Status = gc.Between(fulltabletextTax1, "Paid Status", "Delinq. Date").Trim();
                            First_Installment_Paid_Date   = gc.Between(fulltabletextTax1, "Delinq. Date", "Total Due").Trim();
                        }
                        else
                        {
                            First_Installment_Paid_Status = gc.Between(fulltabletextTax1, "Paid Status", "Paid Date").Trim();
                            First_Installment_Paid_Date   = gc.Between(fulltabletextTax1, "Paid Date", "Total Due").Trim();
                        }
                        First_Installment_Total_Due  = gc.Between(fulltabletextTax1, "Total Due", "Total Paid").Trim();
                        First_Installment_Total_Paid = gc.Between(fulltabletextTax1, "Total Paid", "Balance").Trim();
                        First_Installment_Balance    = WebDriverTest.After(fulltabletextTax1, "Balance");

                        string fulltabletextTax2 = driver.FindElement(By.XPath("//*[@id='h2tab1']/div[1]/div[2]/dl")).Text.Trim().Replace("\r\n", "");
                        if (fulltabletextTax2.Contains("Delinq. Date"))
                        {
                            Second_Installment_Paid_Status = gc.Between(fulltabletextTax2, "Paid Status", "Delinq. Date").Trim();
                            Second_Installment_Paid_Date   = gc.Between(fulltabletextTax2, "Delinq. Date", "Total Due").Trim();
                        }
                        else
                        {
                            Second_Installment_Paid_Status = gc.Between(fulltabletextTax2, "Paid Status", "Paid Date").Trim();
                            Second_Installment_Paid_Date   = gc.Between(fulltabletextTax2, "Paid Date", "Total Due").Trim();
                        }
                        Second_Installment_Total_Due  = gc.Between(fulltabletextTax2, "Total Due", "Total Paid").Trim();
                        Second_Installment_Total_Paid = gc.Between(fulltabletextTax2, "Total Paid", "Balance").Trim();
                        Second_Installment_Balance    = WebDriverTest.After(fulltabletextTax2, "Balance");

                        string fulltabletextTax3 = driver.FindElement(By.XPath("//*[@id='h2tab1']/div[2]/dl")).Text.Trim().Replace("\r\n", "");
                        FirstandSecondInstallment_Total_Due     = gc.Between(fulltabletextTax3, "Total Due", "Total Paid").Trim();
                        FirstandSecondInstallment_Total_Paid    = gc.Between(fulltabletextTax3, "Total Paid", "Total Balance").Trim();
                        FirstandSecondInstallment_Total_Balance = WebDriverTest.After(fulltabletextTax3, "Total Balance");

                        gc.CreatePdf(orderNumber, parcel_id1, "Taxes" + pdf, driver, "CA", "Shasta");
                        driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/ul/li[2]/a")).Click();
                        Thread.Sleep(3000);
                        gc.CreatePdf(orderNumber, parcel_id1, "Assess info" + pdf, driver, "CA", "Shasta");
                        string fulltabletextTax4 = driver.FindElement(By.XPath("//*[@id='h2tab2']/dl")).Text.Trim().Replace("\r\n", "");
                        string assessment        = gc.Between(fulltabletextTax4, "Assessment", "Taxyear").Trim();
                        Tax_year      = gc.Between(fulltabletextTax4, "Taxyear", "Parcel Number").Trim();
                        Roll_Category = gc.Between(fulltabletextTax4, "Roll Category", "Doc Num").Trim();
                        string owner = WebDriverTest.After(fulltabletextTax4, "Owner");
                        string tax   = assessment + "~" + Roll_Category + "~" + owner + "~" + Tax_year + "~" + First_Installment_Paid_Status + "~" + First_Installment_Paid_Date + "~" + First_Installment_Total_Due + "~" + First_Installment_Total_Paid + "~" + First_Installment_Balance + "~" + Second_Installment_Paid_Status + "~" + Second_Installment_Paid_Date + "~" + Second_Installment_Total_Due + "~" + Second_Installment_Total_Paid + "~" + Second_Installment_Balance + "~" + FirstandSecondInstallment_Total_Due + "~" + FirstandSecondInstallment_Total_Paid + "~" + FirstandSecondInstallment_Total_Balance;
                        gc.insert_date(orderNumber, parcel_id1, 660, tax, 1, DateTime.Now);

                        //      Assessment~Roll Category~Address~Tax year~First Installment Paid Status~First Installment Paid Date~First Installment Total Due~First Installment Total Paid~First Installment Balance~Second Installment Paid Status~Second Installment Paid Date~Second Installment Total Due~Second Installment Total Paid~Second Installment Balance~First and Second Installment Total Due~First and Second Installment Total Paid~First and Second Installment Total Balance

                        //download taxbill
                        try
                        {
                            IWebElement Itaxbill = driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/div/div[1]/div[4]/div/a"));
                            string      URL1     = Itaxbill.GetAttribute("href");
                            gc.downloadfile(URL1, orderNumber, parcel_id1, "TaxBill" + pdf, "CA", "Shasta");
                        }
                        catch { }

                        //Taxcode Info

                        driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/ul/li[3]/a")).Click();
                        Thread.Sleep(3000);
                        gc.CreatePdf(orderNumber, parcel_id1, "Tax code" + pdf, driver, "CA", "Shasta");

                        int      count       = driver.FindElements(By.XPath("//*[@id='h2tab3']/div")).Count;
                        int      divCount2   = count + 1;
                        string[] TaxCode     = new string[divCount2];
                        string[] description = new string[divCount2];
                        string[] rate        = new string[divCount2];
                        string[] Istinstall  = new string[divCount2];
                        string[] IIndinstall = new string[divCount2];
                        string[] total       = new string[divCount2];
                        string[] phone       = new string[divCount2];
                        for (int i = 1; i <= count; i++)
                        {
                            string Description1 = driver.FindElement(By.XPath(" //*[@id='h2tab3']/div[" + i + "]/div/div/dl")).Text.Trim().Replace("\r\n", "");
                            TaxCode[i]     = gc.Between(Description1, "Tax Code", "Description").Trim();
                            description[i] = gc.Between(Description1, "Description", "Rate").Trim();
                            rate[i]        = gc.Between(Description1, "Rate", "1st Installment").Trim();
                            Istinstall[i]  = gc.Between(Description1, "1st Installment", "2nd Installment").Trim();
                            IIndinstall[i] = gc.Between(Description1, "2nd Installment", "Total").Trim();
                            total[i]       = gc.Between(Description1, "Total", "Phone").Trim();
                            phone[i]       = WebDriverTest.After(Description1, "Phone");
                            string taxcode = Tax_year + "~" + TaxCode[i] + "~" + description[i] + "~" + rate[i] + "~" + Istinstall[i] + "~" + IIndinstall[i] + "~" + total[i] + "~" + phone[i];
                            gc.insert_date(orderNumber, parcel_id1, 661, taxcode, 1, DateTime.Now);
                        }
                        //Tax Year~Tax Code~Description~Rate~1st Installment~2nd Installment~Total~Phone

                        //Default Tax
                        try
                        {
                            driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/ul/li[4]/a")).Click();
                            Thread.Sleep(3000);
                            gc.CreatePdf(orderNumber, parcel_id1, "Default Tax" + pdf, driver, "CA", "Shasta");

                            Default_Number     = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[1]/div[2]")).Text;
                            Pay_Plan_in_Effect = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[2]/div[2]")).Text;
                            Annual_Payment     = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[3]/div[2]")).Text;
                            Balance            = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[4]/div[2]")).Text;

                            string default_tax = Tax_year + "~" + Default_Number + "~" + Pay_Plan_in_Effect + "~" + Annual_Payment + "~" + Balance;
                            gc.insert_date(orderNumber, parcel_id1, 662, default_tax, 1, DateTime.Now);
                        }
                        //Tax Year~Default Number~Pay Plan in Effect~Annual Payment~Balance
                        catch { }
                        k1++;
                    }
                    TaxTime     = DateTime.Now.ToString("HH:mm:ss");
                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "CA", "Shasta", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderNumber, "CA", "Shasta");
                    return("Data Inserted Successfully");
                }

                catch (Exception ex)
                {
                    driver.Quit();
                    throw ex;
                }
            }
        }
Example #15
0
        public string FTP_LAEastBatonRouge(string houseno, string sname, string sttype, string parcelNumber, string searchType, string orderNumber, string ownername, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";

            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())//PhantomJSDriver
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");

                    if (searchType == "titleflex")
                    {
                        string address = houseno + " " + sname + " " + sttype;
                        gc.TitleFlexSearch(orderNumber, parcelNumber, "", address, "LA", "East Baton Rouge");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["EastbatonLA_NoRecord"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    driver.Navigate().GoToUrl("http://www.ebrpa.org/PageDisplay.asp?p1=1503");
                    Thread.Sleep(2000);
                    IWebElement iframeElement = null;
                    try
                    {
                        iframeElement = driver.FindElement(By.XPath("/html/body/center/div[2]/table/tbody/tr/td[2]/table/tbody/tr/td/table/tbody/tr[2]/td/font/div[1]/iframe"));
                    }
                    catch { }
                    try
                    {
                        if (iframeElement == null)
                        {
                            iframeElement = driver.FindElement(By.XPath("//*[@id='single-blocks']/div[2]/div[2]/div/div/div/div/div/iframe"));
                        }
                    }
                    catch { }
                    Thread.Sleep(2000);
                    driver.SwitchTo().Frame(iframeElement);
                    //if (searchType == "address")
                    //{
                    //    //driver.Navigate().GoToUrl("http://www.ebrpa.org/PageDisplay.asp?p1=1503");
                    //    //Thread.Sleep(2000);

                    //    //IWebElement iframeElement = driver.FindElement(By.XPath("/html/body/center/div[2]/table/tbody/tr/td[2]/table/tbody/tr/td/table/tbody/tr[2]/td/font/div[1]/iframe"));
                    //    //Thread.Sleep(2000);
                    //    driver.SwitchTo().Frame(iframeElement);

                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/input[3]")).Click();
                    //    Thread.Sleep(2000);
                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/div[2]/div/input[1]")).SendKeys(houseno);
                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/div[2]/div/input[2]")).SendKeys(sname);

                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/div[5]/button")).Click();
                    //    Thread.Sleep(2000);
                    //    //Screen-Shot
                    //    gc.CreatePdf_WOP(orderNumber, "AddressSearch", driver, "LA", "East Baton Rouge");


                    //    //MultiParcel
                    //    IWebElement MultiParcelTable = driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/table/tbody"));
                    //    IList<IWebElement> MultiParcelTR = MultiParcelTable.FindElements(By.TagName("tr"));

                    //    if (MultiParcelTR.Count == 1)
                    //    {
                    //        NavigateUrl(driver);
                    //    }
                    //    else
                    //    {
                    //        try
                    //        {
                    //            string no = driver.FindElement(By.XPath("//*[@id='ng-view']/div/div")).Text;
                    //            if (no.Contains("No results found"))
                    //            {
                    //                HttpContext.Current.Session["EastbatonLA_NoRecord"] = "Yes";
                    //                driver.Quit();
                    //                return "No Data Found";
                    //            }
                    //        }
                    //        catch
                    //        {

                    //        }

                    //        IList<IWebElement> MultiParcelTD;
                    //        foreach (IWebElement multi in MultiParcelTR)
                    //        {
                    //            MultiParcelTD = multi.FindElements(By.TagName("td"));
                    //            if (MultiParcelTD.Count != 0)
                    //            {
                    //                parcelNumber = MultiParcelTD[0].Text;
                    //                Ownername = MultiParcelTD[1].Text;
                    //                Physicaladdrerss = MultiParcelTD[2].Text;
                    //                Multidata = Ownername + "~" + Physicaladdrerss;
                    //                gc.insert_date(orderNumber, parcelNumber, 177, Multidata, 1, DateTime.Now);
                    //            }
                    //            HttpContext.Current.Session["multiParcel_LAEastBatonRouge"] = "Yes";
                    //        }

                    //        if (MultiParcelTR.Count > 25)
                    //        {
                    //            HttpContext.Current.Session["multiParcel_LAEastBatonRouge_Multicount"] = "Maximum";
                    //        }
                    //        driver.Quit();
                    //        return "MultiParcel";
                    //    }
                    //}

                    //else if (searchType == "parcel")
                    //{
                    //    driver.Navigate().GoToUrl("http://www.ebrpa.org/PageDisplay.asp?p1=1503");
                    //    Thread.Sleep(2000);

                    //    IWebElement iframeElement = driver.FindElement(By.XPath("/html/body/center/div[2]/table/tbody/tr/td[2]/table/tbody/tr/td/table/tbody/tr[2]/td/font/div[1]/iframe"));
                    //    driver.SwitchTo().Frame(iframeElement);

                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/input[1]")).Click();
                    //    Thread.Sleep(2000);
                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/input[7]")).SendKeys(parcelNumber);
                    //    gc.CreatePdf(orderNumber, parcelNumber, "ParcelSearch", driver, "LA", "East Baton Rouge");
                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/div[5]/button")).Click();
                    //    Thread.Sleep(2000);

                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/table/tbody/tr/td[4]/a")).Click();
                    //    Thread.Sleep(3000);
                    //    NavigateUrl(driver);
                    //}

                    //else if (searchType == "ownername")
                    //{
                    //    driver.Navigate().GoToUrl("http://www.ebrpa.org/PageDisplay.asp?p1=1503");
                    //    Thread.Sleep(2000);

                    //    IWebElement iframeElement = driver.FindElement(By.XPath("/html/body/center/div[2]/table/tbody/tr/td[2]/table/tbody/tr/td/table/tbody/tr[2]/td/font/div[1]/iframe"));
                    //    driver.SwitchTo().Frame(iframeElement);

                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/input[2]")).Click();
                    //    Thread.Sleep(2000);
                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/input[7]")).SendKeys(ownername);
                    //    gc.CreatePdf(orderNumber, parcelNumber, "ParcelSearch", driver, "LA", "East Baton Rouge");
                    //    driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/form/div[5]/button")).Click();
                    //    Thread.Sleep(2000);
                    //    gc.CreatePdf(orderNumber, outparcelno, "Property_Search", driver, "LA", "East Baton Rouge");
                    //    //MultiParcel
                    //    IWebElement MultiParcelTable = driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/div/div/table/tbody"));
                    //    IList<IWebElement> MultiParcelTR = MultiParcelTable.FindElements(By.TagName("tr"));

                    //    if (MultiParcelTR.Count == 1)
                    //    {
                    //        NavigateUrl(driver);
                    //    }
                    //    else
                    //    {
                    //        IList<IWebElement> MultiParcelTD;
                    //        foreach (IWebElement multi in MultiParcelTR)
                    //        {
                    //            MultiParcelTD = multi.FindElements(By.TagName("td"));
                    //            if (MultiParcelTD.Count != 0)
                    //            {
                    //                parcelNumber = MultiParcelTD[0].Text;
                    //                Ownername = MultiParcelTD[1].Text;
                    //                Physicaladdrerss = MultiParcelTD[2].Text;
                    //                Multidata = Ownername + "~" + Physicaladdrerss;
                    //                gc.insert_date(orderNumber, parcelNumber, 177, Multidata, 1, DateTime.Now);
                    //            }
                    //        }

                    //        HttpContext.Current.Session["multiParcel_LAEastBatonRouge"] = "Yes";
                    //        if (MultiParcelTR.Count > 25)
                    //        {
                    //            HttpContext.Current.Session["multiParcel_LAEastBatonRouge_Multicount"] = "Maximum";
                    //        }
                    //        driver.Quit();
                    //        return "MultiParcel";
                    //    }

                    //}
                    if (searchType == "address")
                    {
                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/input[3]")).Click();
                        Thread.Sleep(2000);
                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/div[2]/div/input[1]")).SendKeys(houseno);
                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/div[2]/div/input[2]")).SendKeys(sname);
                        gc.CreatePdf_WOP(orderNumber, "Address Search", driver, "LA", "East Baton Rouge");
                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/div[5]/button")).Click();
                        Thread.Sleep(2000);
                        //Screen-Shot
                        gc.CreatePdf_WOP(orderNumber, "Address Search Result", driver, "LA", "East Baton Rouge");


                        //MultiParcel
                        IWebElement         MultiParcelTable = driver.FindElement(By.XPath("//*[@id='ng-view']/div/table/tbody"));
                        IList <IWebElement> MultiParcelTR    = MultiParcelTable.FindElements(By.TagName("tr"));

                        if (MultiParcelTR.Count == 1)
                        {
                            NavigateUrl(driver);
                        }
                        else
                        {
                            try
                            {
                                string no = driver.FindElement(By.XPath("//*[@id='ng-view']/div/div")).Text;
                                if (no.Contains("No results found"))
                                {
                                    HttpContext.Current.Session["EastbatonLA_NoRecord"] = "Yes";
                                    driver.Quit();
                                    return("No Data Found");
                                }
                            }
                            catch
                            {
                            }

                            IList <IWebElement> MultiParcelTD;
                            foreach (IWebElement multi in MultiParcelTR)
                            {
                                MultiParcelTD = multi.FindElements(By.TagName("td"));
                                if (MultiParcelTD.Count != 0)
                                {
                                    parcelNumber     = MultiParcelTD[0].Text;
                                    Ownername        = MultiParcelTD[1].Text;
                                    Physicaladdrerss = MultiParcelTD[2].Text;
                                    Multidata        = Ownername + "~" + Physicaladdrerss;
                                    gc.insert_date(orderNumber, parcelNumber, 177, Multidata, 1, DateTime.Now);
                                }
                                HttpContext.Current.Session["multiParcel_LAEastBatonRouge"] = "Yes";
                            }

                            if (MultiParcelTR.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_LAEastBatonRouge_Multicount"] = "Maximum";
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                    }

                    else if (searchType == "parcel")
                    {
                        //driver.Navigate().GoToUrl("http://www.ebrpa.org/PageDisplay.asp?p1=1503");
                        //Thread.Sleep(2000);

                        //IWebElement iframeElement = driver.FindElement(By.XPath("/html/body/center/div[2]/table/tbody/tr/td[2]/table/tbody/tr/td/table/tbody/tr[2]/td/font/div[1]/iframe"));
                        //driver.SwitchTo().Frame(iframeElement);

                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/input[1]")).Click();
                        Thread.Sleep(2000);
                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/input[7]")).SendKeys(parcelNumber);
                        gc.CreatePdf(orderNumber, parcelNumber, "ParcelSearch", driver, "LA", "East Baton Rouge");
                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/div[5]/button")).Click();
                        Thread.Sleep(2000);

                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/table/tbody/tr/td[4]/a")).Click();
                        Thread.Sleep(3000);
                        NavigateUrl(driver);
                    }

                    else if (searchType == "ownername")
                    {
                        //driver.Navigate().GoToUrl("http://www.ebrpa.org/PageDisplay.asp?p1=1503");
                        //Thread.Sleep(2000);

                        //IWebElement iframeElement = driver.FindElement(By.XPath("/html/body/center/div[2]/table/tbody/tr/td[2]/table/tbody/tr/td/table/tbody/tr[2]/td/font/div[1]/iframe"));
                        //driver.SwitchTo().Frame(iframeElement);

                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/input[2]")).Click();
                        Thread.Sleep(2000);
                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/input[7]")).SendKeys(ownername);
                        gc.CreatePdf(orderNumber, parcelNumber, "ParcelSearch", driver, "LA", "East Baton Rouge");
                        driver.FindElement(By.XPath("//*[@id='ng-view']/div/form/div[5]/button")).Click();
                        Thread.Sleep(2000);
                        gc.CreatePdf(orderNumber, outparcelno, "Property_Search", driver, "LA", "East Baton Rouge");
                        //MultiParcel
                        IWebElement         MultiParcelTable = driver.FindElement(By.XPath("//*[@id='ng-view']/div/table/tbody"));
                        IList <IWebElement> MultiParcelTR    = MultiParcelTable.FindElements(By.TagName("tr"));

                        if (MultiParcelTR.Count == 1)
                        {
                            NavigateUrl(driver);
                        }
                        else
                        {
                            IList <IWebElement> MultiParcelTD;
                            foreach (IWebElement multi in MultiParcelTR)
                            {
                                MultiParcelTD = multi.FindElements(By.TagName("td"));
                                if (MultiParcelTD.Count != 0)
                                {
                                    parcelNumber     = MultiParcelTD[0].Text;
                                    Ownername        = MultiParcelTD[1].Text;
                                    Physicaladdrerss = MultiParcelTD[2].Text;
                                    Multidata        = Ownername + "~" + Physicaladdrerss;
                                    gc.insert_date(orderNumber, parcelNumber, 177, Multidata, 1, DateTime.Now);
                                }
                            }

                            HttpContext.Current.Session["multiParcel_LAEastBatonRouge"] = "Yes";
                            if (MultiParcelTR.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_LAEastBatonRouge_Multicount"] = "Maximum";
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                    }

                    //Scrapped Data

                    //Property Deatails
                    outparcelno = driver.FindElement(By.XPath("/html/body/div[3]/div/div[1]/span[2]")).Text;
                    OwnerName   = driver.FindElement(By.XPath("/html/body/div[3]/div/div[2]/div/span[2]")).Text;
                    if (OwnerName.Contains("\r\n"))
                    {
                        OwnerName = OwnerName.Replace("\r\n", ",");
                    }
                    Mailingaddress = driver.FindElement(By.XPath("/html/body/div[3]/div/div[3]/div/span")).Text;
                    if (Mailingaddress.Contains("\r\n"))
                    {
                        Mailingaddress = Mailingaddress.Replace("\r\n", ",");
                    }
                    Property_Type   = driver.FindElement(By.XPath("/html/body/div[3]/div/div[5]/div/span")).Text;
                    Propertyaddress = driver.FindElement(By.XPath("/html/body/div[3]/div/div[7]/div/span[2]")).Text;
                    if (Propertyaddress.Contains("\r\n"))
                    {
                        Propertyaddress = Propertyaddress.Replace("\r\n", ",");
                    }
                    gc.CreatePdf(orderNumber, outparcelno, "Assement", driver, "LA", "East Baton Rouge");

                    //Assessment Details
                    //string year = driver.FindElement(By.XPath("/html/body/div[2]/div/span[1]")).Text;
                    //IWebElement TBAssess = driver.FindElement(By.XPath("/html/body/div[3]/div/div[8]/table/tbody"));
                    string year = "";
                    try
                    {
                        year = driver.FindElement(By.XPath("/html/body/div[2]/div/span")).Text.Replace("Assessment Listing", "").Trim();
                    }
                    catch { }
                    IWebElement         TBAssess = driver.FindElement(By.XPath("//*[@id='parcelDetails']/div[8]/table/tbody"));
                    IList <IWebElement> TRAssess = TBAssess.FindElements(By.TagName("tr"));
                    IList <IWebElement> TDAssess;
                    foreach (IWebElement assess in TRAssess)
                    {
                        TDAssess = assess.FindElements(By.TagName("td"));
                        if (TDAssess.Count != 0)
                        {
                            Property_class   = TDAssess[0].Text;
                            AssedValues      = TDAssess[1].Text;
                            Units            = TDAssess[2].Text;
                            Homestead        = TDAssess[3].Text;
                            Assement_details = year + "~" + Property_class + "~" + AssedValues + "~" + Units + "~" + Homestead;
                            gc.insert_date(orderNumber, outparcelno, 198, Assement_details, 1, DateTime.Now);
                        }
                    }
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    //TaxDistribution Details
                    //IWebElement TBTax = driver.FindElement(By.XPath("/html/body/div[3]/div/div[11]/table/tbody"));
                    IWebElement         TBTax = driver.FindElement(By.XPath("//*[@id='parcelDetails']/div[11]/table/tbody"));
                    IList <IWebElement> TRTax = TBTax.FindElements(By.TagName("tr"));
                    IList <IWebElement> TDTax;
                    foreach (IWebElement tax in TRTax)
                    {
                        TDTax = tax.FindElements(By.TagName("td"));
                        if (TDTax.Count != 0)
                        {
                            Millage                = TDTax[0].Text;
                            Mills                  = TDTax[1].Text;
                            Tax                    = TDTax[2].Text;
                            Homestead_Tax          = TDTax[3].Text;
                            TaxDistributionDetails = Millage + "~" + Mills + "~" + Tax + "~" + Homestead_Tax;
                            gc.insert_date(orderNumber, outparcelno, 201, TaxDistributionDetails, 1, DateTime.Now);
                        }
                    }

                    amc.TaxId = outparcelno;
                    //TaxInformation Details
                    driver.Navigate().GoToUrl("http://snstaxpayments.com/ebr");
                    Thread.Sleep(2000);

                    driver.FindElement(By.Id("submit")).SendKeys(Keys.Enter);
                    Thread.Sleep(2000);

                    driver.FindElement(By.XPath("/html/body/div[1]/div[3]/form/div/div/div[1]/div[2]/label/input")).Click();
                    Thread.Sleep(2000);
                    driver.FindElement(By.Id("searchFor1")).SendKeys(outparcelno);
                    gc.CreatePdf(orderNumber, outparcelno, "Tax", driver, "LA", "East Baton Rouge");
                    driver.FindElement(By.Id("searchButton")).SendKeys(Keys.Enter);
                    Thread.Sleep(2000);
                    gc.CreatePdf(orderNumber, outparcelno, "View", driver, "LA", "East Baton Rouge");

                    IWebElement         SelectOption = driver.FindElement(By.Id("taxyear"));
                    IList <IWebElement> Select       = SelectOption.FindElements(By.TagName("option"));
                    List <string>       option       = new List <string>();
                    int Check = 0;
                    foreach (IWebElement Op in Select)
                    {
                        if (Check <= 2)
                        {
                            option.Add(Op.Text);
                            Check++;
                        }
                    }
                    int amccount = 0;
                    foreach (string item in option)
                    {
                        var SelectAddress    = driver.FindElement(By.Id("taxyear"));
                        var SelectAddressTax = new SelectElement(SelectAddress);
                        SelectAddressTax.SelectByText(item);
                        Thread.Sleep(4000);
                        driver.FindElement(By.Id("searchButton")).SendKeys(Keys.Enter);
                        Thread.Sleep(4000);

                        try
                        {
                            driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[3]/table/tbody/tr/td[1]/button")).Click();
                            Thread.Sleep(7000);
                        }
                        catch
                        { }

                        gc.CreatePdf(orderNumber, outparcelno, "Popup 2015", driver, "LA", "East Baton Rouge");

                        //Open Popup
                        try
                        {
                            Notice = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div/div/div[3]/div[1]")).Text;
                            Notice = WebDriverTest.After(Notice, "Tax Notice#");

                            Taxyear     = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div/div/div[3]/div[2]")).Text;
                            Taxyear     = WebDriverTest.After(Taxyear, "Tax Year");
                            amc.TaxYear = Taxyear;

                            TaxPayer = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div/div/div[4]")).Text;
                            TaxPayer = WebDriverTest.Between(TaxPayer, "Taxpayer", "**** ").Replace("\r\n", " ").Trim();

                            IWebElement         TBOpen    = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div/div/div[5]"));
                            IList <IWebElement> DivMaster = TBOpen.FindElements(By.TagName("div"));
                            foreach (IWebElement div in DivMaster)
                            {
                                Taxes    = DivMaster[0].Text.Trim();
                                Interest = DivMaster[1].Text.Trim();
                                Cost     = DivMaster[2].Text.Trim();
                                Other    = DivMaster[3].Text.Trim();
                                Paid     = DivMaster[4].Text.Trim();
                                Balance  = DivMaster[5].Text.Trim();
                            }
                            try
                            {
                                IWebElement ITaxsale = driver.FindElement(By.XPath("//*[@id='details']/div[5]"));
                                if (ITaxsale.Text.Contains("Tax Sale Status: "))
                                {
                                    amc.IsDelinquent = "Yes";
                                }
                                double TaxesAmount = 0.00, InterestAmount = 0.00, CostAmount = 0.00, OtherAmount = 0.00, PaidAmount = 0.00, BalanceAmount = 0.00;

                                TaxesAmount    = Convert.ToDouble(Taxes.Replace("Taxes\r\n", "").Trim());
                                InterestAmount = Convert.ToDouble(Interest.Replace("Interest\r\n", "").Trim());
                                PaidAmount     = Convert.ToDouble(Paid.Replace("Paid\r\n", "").Trim());
                                CostAmount     = Convert.ToDouble(Cost.Replace("Cost\r\n", "").Trim());
                                OtherAmount    = Convert.ToDouble(Other.Replace("Other\r\n", "").Trim());
                                BalanceAmount  = Convert.ToDouble(Balance.Replace("Balance\r\n", "").Trim());


                                if (TaxesAmount != 0 && InterestAmount == 0 && CostAmount == 0 && OtherAmount == 0 && PaidAmount != 0 && BalanceAmount == 0)
                                {
                                    amc.Instamount1     = Taxes.Replace("Taxes\r\n", "").Trim();
                                    amc.Instamountpaid1 = Paid.Replace("Paid\r\n", "").Trim();
                                    amc.InstPaidDue1    = "Paid";
                                    amc.IsDelinquent    = "No";
                                }
                                else if (TaxesAmount != 0 && InterestAmount == 0 && CostAmount == 0 && OtherAmount == 0 && PaidAmount == 0 && BalanceAmount != 0 && TaxesAmount == BalanceAmount)
                                {
                                    amc.Instamount1     = Taxes.Replace("Taxes\r\n", "").Trim();
                                    amc.Instamountpaid1 = Balance.Replace("Balance\r\n", "").Trim();
                                    amc.InstPaidDue1    = "Due";
                                    amc.IsDelinquent    = "No";
                                }
                                else if (TaxesAmount != 0 && InterestAmount != 0 && ((CostAmount != 0 || CostAmount == 0) && (OtherAmount == 0 || OtherAmount != 0)) && PaidAmount == 0 && BalanceAmount != 0 && TaxesAmount < BalanceAmount)
                                {
                                    amc.IsDelinquent = "Yes";
                                }
                                else if (TaxesAmount != 0 && InterestAmount != 0 && ((CostAmount != 0 || CostAmount == 0) && (OtherAmount == 0 || OtherAmount != 0)) && PaidAmount != 0 && BalanceAmount == 0 && TaxesAmount < PaidAmount)
                                {
                                    amc.IsDelinquent = "Yes";
                                }
                            }
                            catch { }


                            if (Interest.Replace("Interest\r\n", "") != "0.00" && Balance.Replace("Balance\r\n", "") != "0.00")
                            {
                                Deliquent_Interest      = Interest;
                                Deliquent_Balance       = Balance;
                                Interest                = "";
                                Balance                 = "";
                                DeliquentTaxInformation = Notice + "~" + Taxyear + "~" + TaxPayer + "~" + Taxes.Replace("Taxes\r\n", "") + "~" + Interest.Replace("Interest\r\n", "") + "~" + Cost.Replace("Cost\r\n", "") + "~" + Other.Replace("Other\r\n", "") + "~" + Paid.Replace("Paid\r\n", "") + "~" + Balance.Replace("Balance\r\n", "") + "~" + Deliquent_Interest.Replace("Interest\r\n", "") + "~" + Deliquent_Balance.Replace("Balance\r\n", "");
                                gc.insert_date(orderNumber, outparcelno, 203, DeliquentTaxInformation, 1, DateTime.Now);
                            }
                            else
                            {
                                string TaxInformation = Notice + "~" + Taxyear + "~" + TaxPayer + "~" + Taxes.Replace("Taxes\r\n", "") + "~" + Interest.Replace("Interest\r\n", "") + "~" + Cost.Replace("Cost\r\n", "") + "~" + Other.Replace("Other\r\n", "") + "~" + Paid.Replace("Paid\r\n", "") + "~" + Balance.Replace("Balance\r\n", "") + "~" + Deliquent_Interest.Replace("Interest\r\n", "") + "~" + Deliquent_Balance.Replace("Balance\r\n", "");
                                gc.insert_date(orderNumber, outparcelno, 203, TaxInformation, 1, DateTime.Now);
                            }

                            Legal_Description = driver.FindElement(By.XPath("//*[@id='details']/div[7]")).Text.Replace("Legal", "");

                            if (amccount < 1)
                            {
                                if (amc.IsDelinquent == "Yes")
                                {
                                    gc.InsertAmrockTax(orderNumber, amc.TaxId, null, null, null, null, null, null, null, null, null, null, null, null, amc.IsDelinquent);
                                    amccount++;
                                }

                                if (amc.IsDelinquent == "No")
                                {
                                    gc.InsertAmrockTax(orderNumber, amc.TaxId, amc.Instamount1, amc.Instamount2, amc.Instamount3, amc.Instamount4, amc.Instamountpaid1, amc.Instamountpaid2, amc.Instamountpaid3, amc.Instamountpaid4, amc.InstPaidDue1, amc.InstPaidDue2, amc.instPaidDue3, amc.instPaidDue4, amc.IsDelinquent);
                                    amccount++;
                                }
                            }

                            //Tax History
                            IWebElement         TBHistory = driver.FindElement(By.XPath("/html/body/div[5]/div[2]/div/div/div[9]/table/tbody"));
                            IList <IWebElement> TRHistory = TBHistory.FindElements(By.TagName("tr"));
                            IList <IWebElement> TDHistory;
                            foreach (IWebElement History in TRHistory)
                            {
                                TDHistory = History.FindElements(By.TagName("td"));
                                if (TDHistory.Count != 0)
                                {
                                    Date        = TDHistory[0].Text;
                                    Description = TDHistory[1].Text;
                                    Amount      = TDHistory[2].Text;
                                    TaxHistory  = Date + "~" + Description + "~" + Amount;
                                    gc.insert_date(orderNumber, outparcelno, 202, TaxHistory, 1, DateTime.Now);
                                }
                            }

                            IWebElement ITax = driver.FindElement(By.XPath("//*[@id='details']/div[2]/a"));
                            strTax = ITax.GetAttribute("href");
                            Thread.Sleep(5000);
                            driver.Navigate().GoToUrl(strTax);
                            Actions action = new Actions(driver);
                            action.SendKeys(Keys.Escape).Build().Perform();
                            gc.CreatePdf(orderNumber, outparcelno, "Bill 2015", driver, "LA", "East Baton Rouge");
                            driver.Navigate().Back();
                            Thread.Sleep(2000);
                        }
                        catch
                        { }
                    }
                    try
                    {
                        for (int k = 1; k < 4; k++)
                        {
                            if (k == 1)
                            {
                                try
                                {
                                    var SelectAddress2017    = driver.FindElement(By.Id("taxyear"));
                                    var SelectAddressTax2017 = new SelectElement(SelectAddress2017);
                                    SelectAddressTax2017.SelectByIndex(0);
                                    Thread.Sleep(4000);
                                    driver.FindElement(By.Id("searchButton")).SendKeys(Keys.Enter);
                                    Thread.Sleep(4000);
                                    gc.CreatePdf(orderNumber, outparcelno, "View1", driver, "LA", "East Baton Rouge");
                                    driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[3]/table/tbody/tr/td[1]/button")).Click();
                                    Thread.Sleep(5000);

                                    IWebElement ITax = driver.FindElement(By.XPath("//*[@id='details']/div[2]/a"));
                                    strTax = ITax.GetAttribute("href");
                                    Thread.Sleep(5000);
                                    driver.Navigate().GoToUrl(strTax);
                                    Actions action = new Actions(driver);
                                    action.SendKeys(Keys.Escape).Build().Perform();
                                    gc.CreatePdf(orderNumber, outparcelno, "Bill 2017", driver, "LA", "East Baton Rouge");
                                    driver.Navigate().Back();
                                    Thread.Sleep(2000);
                                }
                                catch
                                { }
                            }
                            else if (k == 2)
                            {
                                try
                                {
                                    var SelectAddress2016    = driver.FindElement(By.Id("taxyear"));
                                    var SelectAddressTax2016 = new SelectElement(SelectAddress2016);
                                    SelectAddressTax2016.SelectByIndex(1);
                                    Thread.Sleep(4000);
                                    driver.FindElement(By.Id("searchButton")).SendKeys(Keys.Enter);
                                    Thread.Sleep(4000);
                                    gc.CreatePdf(orderNumber, outparcelno, "View2", driver, "LA", "East Baton Rouge");
                                    driver.FindElement(By.XPath("/html/body/div[1]/div[3]/div[3]/table/tbody/tr/td[1]/button")).Click();
                                    Thread.Sleep(5000);

                                    IWebElement ITax = driver.FindElement(By.XPath("//*[@id='details']/div[2]/a"));
                                    strTax = ITax.GetAttribute("href");
                                    Thread.Sleep(5000);
                                    driver.Navigate().GoToUrl(strTax);
                                    Actions action = new Actions(driver);
                                    action.SendKeys(Keys.Escape).Build().Perform();
                                    gc.CreatePdf(orderNumber, outparcelno, "Bill 2016", driver, "LA", "East Baton Rouge");
                                    driver.Close();
                                }
                                catch
                                { }
                            }
                        }
                    }
                    catch
                    { }

                    property_details = OwnerName + "~" + Propertyaddress + "~" + Mailingaddress + "~" + Property_Type + "~" + Legal_Description;
                    gc.insert_date(orderNumber, outparcelno, 197, property_details, 1, DateTime.Now);

                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "LA", "East Baton Rouge", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    //megrge pdf files
                    gc.mergpdf(orderNumber, "LA", "East Baton Rouge");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw ex;
                }
            }
        }
Example #16
0
        public string FTP_SonomaCA(string address, string assessment_id, string parcelNumber, string searchType, string orderNumber, string directParcel, string ownername)
        {
            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "", AssessTakenTime = "", TaxTakentime = "", CityTaxtakentime = "";
            string TotaltakenTime = "";

            List <string> strTaxRealestate1 = new List <string>();
            string        address1 = "", Assess = "", fee_parcel = "", Tra = "";
            string        Roll_Category = "", Address = "", Tax_year = "", First_Installment_Paid_Status = "", First_Installment_Paid_Date = "", First_Installment_Total_Due = "", First_Installment_Total_Paid = "", First_Installment_Balance = "", Second_Installment_Paid_Status = "", Second_Installment_Paid_Date = "", Second_Installment_Total_Due = "", Second_Installment_Total_Paid = "", Second_Installment_Balance = "", FirstandSecondInstallment_Total_Due = "", FirstandSecondInstallment_Total_Paid = "", FirstandSecondInstallment_Total_Balance = "";
            string        Assessor_ID_Number = "", Tax_Rate_Area = "";
            string        Default_Number = "", Pay_Plan_in_Effect = "", Annual_Payment = "", Balance = "";

            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;

            //driver = new PhantomJSDriver();
            //   driver = new ChromeDriver();
            using (driver = new PhantomJSDriver()) //PhantomJSDriver
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");
                    driver.Navigate().GoToUrl("https://common1.mptsweb.com/megabytecommonsite/(S(3hmhea1rmc3zsryxx5djgjep))/PublicInquiry/Inquiry.aspx?CN=sonoma&SITE=Public&DEPT=Asr&PG=Search");
                    Thread.Sleep(4000);
                    if (searchType == "titleflex")
                    {
                        gc.TitleFlexSearch(orderNumber, parcelNumber, ownername, address, "CA", "Sonoma");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_SonomaCA"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }
                    if (searchType == "address")
                    {
                        var Select         = driver.FindElement(By.Id("idSitus"));
                        var selectElement1 = new SelectElement(Select);
                        selectElement1.SelectByText("Begins with");
                        driver.FindElement(By.XPath(" /html/body/form/center/table/tbody/tr[5]/td[3]/input")).SendKeys(address);
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "CA", "Sonoma");
                        driver.FindElement(By.XPath("/html/body/form/center/p/input[1]")).SendKeys(Keys.Enter);
                        gc.CreatePdf_WOP(orderNumber, "Address search result", driver, "CA", "Sonoma");
                        Thread.Sleep(6000);
                        try
                        {
                            IWebElement         tbmulti = driver.FindElement(By.XPath("/html/body/form/center/table/tbody"));
                            IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                            int maxCheck = 0;
                            if (TRmulti.Count > 6)
                            {
                                IList <IWebElement> TDmulti;
                                foreach (IWebElement row in TRmulti)
                                {
                                    if (maxCheck <= 25)
                                    {
                                        if (!row.Text.Contains("Assessment No."))
                                        {
                                            TDmulti = row.FindElements(By.TagName("td"));
                                            if (TDmulti.Count == 3 && TDmulti[0].Text.Trim() != "")
                                            {
                                                Assess     = TDmulti[0].Text;
                                                fee_parcel = TDmulti[1].Text;
                                                Tra        = TDmulti[2].Text;
                                            }
                                            if (TDmulti.Count == 1 && TDmulti[0].Text.Trim() != "")
                                            {
                                                address1 = TDmulti[0].Text;
                                                string multi1 = Tra + "~" + address1;
                                                gc.insert_date(orderNumber, Assess, 1265, multi1, 1, DateTime.Now);
                                                //Assessment Id~Tra~Address
                                            }
                                        }
                                        maxCheck++;
                                    }
                                }

                                if (TRmulti.Count > 25)
                                {
                                    HttpContext.Current.Session["multiParcel_SonomaCA_Multicount"] = "Maximum";
                                }
                                else
                                {
                                    HttpContext.Current.Session["multiparcel_SonomaCA"] = "Yes";
                                }
                                driver.Quit();
                                gc.mergpdf(orderNumber, "CA", "Sonoma");
                                return("MultiParcel");
                            }
                        }
                        catch { }
                    }

                    else if (searchType == "parcel")
                    {
                        if ((HttpContext.Current.Session["titleparcel"] != null && HttpContext.Current.Session["titleparcel"].ToString() != ""))
                        {
                            parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        }
                        var Select         = driver.FindElement(By.Id("idfeeparcel"));
                        var selectElement1 = new SelectElement(Select);
                        selectElement1.SelectByText("Begins with");
                        if (parcelNumber.Contains("-"))
                        {
                            parcelNumber = parcelNumber.Replace("-", "");
                        }
                        try
                        {
                            string a = parcelNumber.Substring(0, 3);
                            string b = parcelNumber.Substring(3, 3);
                            string c = parcelNumber.Substring(6, 3);
                            string d = parcelNumber.Substring(9, 3);
                            parcelNumber = a + "-" + b + "-" + c + "-" + d;
                        }
                        catch { }
                        driver.FindElement(By.XPath("/html/body/form/center/table/tbody/tr[4]/td[3]/input")).SendKeys(parcelNumber);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search", driver, "CA", "Sonoma");
                        driver.FindElement(By.XPath("/html/body/form/center/p/input[1]")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);
                        try
                        {
                            IWebElement         tbmulti = driver.FindElement(By.XPath("/html/body/form/center/table/tbody"));
                            IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                            int maxCheck = 0;
                            if (TRmulti.Count > 6)
                            {
                                IList <IWebElement> TDmulti;
                                foreach (IWebElement row in TRmulti)
                                {
                                    if (maxCheck <= 25)
                                    {
                                        if (!row.Text.Contains("Assessment No."))
                                        {
                                            TDmulti = row.FindElements(By.TagName("td"));
                                            if (TDmulti.Count == 3 && TDmulti[0].Text.Trim() != "")
                                            {
                                                Assess     = TDmulti[0].Text;
                                                fee_parcel = TDmulti[1].Text;
                                                Tra        = TDmulti[2].Text;
                                            }
                                            if (TDmulti.Count == 1 && TDmulti[0].Text.Trim() != "")
                                            {
                                                address1 = TDmulti[0].Text;
                                                string multi1 = Tra + "~" + address1;
                                                gc.insert_date(orderNumber, Assess, 1265, multi1, 1, DateTime.Now);
                                                //Assessment Id~Tra~Address
                                            }
                                        }
                                        maxCheck++;
                                    }
                                }

                                if (TRmulti.Count > 25)
                                {
                                    HttpContext.Current.Session["multiParcel_SonomaCA_Multicount"] = "Maximum";
                                }
                                else
                                {
                                    HttpContext.Current.Session["multiparcel_SonomaCA"] = "Yes";
                                }
                                driver.Quit();
                                gc.mergpdf(orderNumber, "CA", "Sonoma");
                                return("MultiParcel");
                            }
                        }
                        catch { }
                    }
                    else if (searchType == "assessment")
                    {
                        if ((HttpContext.Current.Session["titleparcel"] != null && HttpContext.Current.Session["titleparcel"].ToString() != ""))
                        {
                            parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        }
                        var Select         = driver.FindElement(By.Id("idfeeparcel"));
                        var selectElement1 = new SelectElement(Select);
                        selectElement1.SelectByText("Begins with");
                        if (parcelNumber.Contains("-"))
                        {
                            parcelNumber = parcelNumber.Replace("-", "");
                        }
                        try
                        {
                            string a = parcelNumber.Substring(0, 3);
                            string b = parcelNumber.Substring(3, 3);
                            string c = parcelNumber.Substring(6, 3);
                            string d = parcelNumber.Substring(9, 3);
                            parcelNumber = a + "-" + b + "-" + c + "-" + d;
                        }
                        catch { }
                        driver.FindElement(By.XPath("/html/body/form/center/table/tbody/tr[4]/td[3]/input")).SendKeys(parcelNumber);
                        gc.CreatePdf(orderNumber, parcelNumber, "Assessment search", driver, "CA", "Sonoma");
                        driver.FindElement(By.XPath("/html/body/form/center/p/input[1]")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);
                    }
                    try
                    {
                        IWebElement INodata = driver.FindElement(By.XPath("/html/body/form/center/table"));
                        if (INodata.Text.Contains("Assessor Inquiry: Please enter search criteria"))
                        {
                            HttpContext.Current.Session["Nodata_SonomaCA"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }
                    try
                    {
                        IWebElement runButton = driver.FindElement(By.XPath("/html/body/form/center/table/tbody/tr[2]/td[1]/a"));
                        runButton.Click();
                        Thread.Sleep(4000);
                    }
                    catch { }

                    //property details
                    string Parcel_id = "", totalValue = "", Lot_Size = "";
                    string fulltabletext = driver.FindElement(By.XPath(" / html / body / form / center / table / tbody")).Text.Trim().Replace("\r\n", "");
                    Parcel_id = gc.Between(fulltabletext, "Assessor Parcel Number (APN)", "Assessment Number").Trim();
                    gc.CreatePdf(orderNumber, Parcel_id, "Property details", driver, "CA", "Sonoma");
                    Assessor_ID_Number = gc.Between(fulltabletext, "Assessment Number", "Tax Rate Area (TRA)").Trim();
                    Tax_Rate_Area      = gc.Between(fulltabletext, "Tax Rate Area (TRA)", "Current Document Number").Trim();
                    Lot_Size           = gc.Between(fulltabletext, "Lot Size(Acres)", "Lot Size(SqFt)").Trim();
                    string prop = Assessor_ID_Number + "~" + Tax_Rate_Area + "~" + Lot_Size;
                    //  Assessment Number~Tax Rate Area~Owner Name
                    gc.insert_date(orderNumber, Parcel_id, 1260, prop, 1, DateTime.Now);

                    //Assessment details
                    string Structural_Imprv = "", Land = "", Fixtures_Real_property = "", Fix_Personal_Property1 = "", Growing_Imprv = "", Fix_Personal_Property = "", Personal_Property = "", Manufactured_Homes = "", Homeowners_Exemption = "", OtherExemptions = "", NetAssessedValue = "", NetAssessedValue1 = "";
                    string Address1 = "", Address2 = "";
                    Land                   = gc.Between(fulltabletext, "Land", "Structural Impr").Trim();
                    Structural_Imprv       = gc.Between(fulltabletext, "Structural Imprv", "Fixtures Real Property").Trim();
                    Fixtures_Real_property = gc.Between(fulltabletext, "Fixtures Real Property", "Growing").Trim();
                    Growing_Imprv          = gc.Between(fulltabletext, "Growing Imprv", "Total Land and Improvements").Trim();
                    totalValue             = gc.Between(fulltabletext, "Total Land and Improvements", "Fixtures Personal Property").Trim();
                    Fix_Personal_Property  = gc.Between(fulltabletext, "Fixtures Personal Property", "Manufactured Homes").Trim();
                    Fix_Personal_Property1 = GlobalClass.Before(Fix_Personal_Property, "Personal Property").Trim();
                    Personal_Property      = GlobalClass.After(Fix_Personal_Property, "Personal Property").Trim();
                    Manufactured_Homes     = gc.Between(fulltabletext, "Manufactured Homes", "Homeowners Exemption (HOX)").Trim();
                    Homeowners_Exemption   = gc.Between(fulltabletext, "Homeowners Exemption (HOX)", "Other Exemptions").Trim();
                    OtherExemptions        = gc.Between(fulltabletext, "Other Exemptions", "Net Assessed Value");
                    try
                    {
                        NetAssessedValue  = GlobalClass.After(fulltabletext, "Homeowners Exemption (HOX)");
                        NetAssessedValue1 = gc.Between(NetAssessedValue, "Net Assessed Value", "Navigation");
                    }
                    catch { }

                    string assess = Land + "~" + Structural_Imprv + "~" + Fixtures_Real_property + "~" + Growing_Imprv + "~" + totalValue + "~" + Fix_Personal_Property1 + "~" + Personal_Property + "~" + Manufactured_Homes + "~" + Homeowners_Exemption + "~" + OtherExemptions + "~" + NetAssessedValue1;
                    gc.insert_date(orderNumber, Parcel_id, 1261, assess, 1, DateTime.Now);
                    //Land Value~Improvement Value~Fixtures~Growing~Total Value~Personal Property~Business Property~Homeowners Exemption~Other Exemptions~Net Assessment
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");
                    //Tax details
                    driver.Navigate().GoToUrl("https://common3.mptsweb.com/mbc/sonoma/tax/search");
                    Thread.Sleep(2000);

                    // Tax Authority
                    string TaxAuth1 = "", TaxAuth2 = "", TaxAuth3 = "", TaxAuthority = "";
                    try
                    {
                        IWebElement itaxauth1 = driver.FindElement(By.XPath("//*[@id='footer']/div[1]/div/div[1]/div[2]/div/ul/li[2]"));
                        TaxAuth1 = itaxauth1.Text;
                        IWebElement itaxauth2 = driver.FindElement(By.XPath("//*[@id='footer']/div[1]/div/div[1]/div[2]/div/ul/li[3]"));
                        TaxAuth2 = itaxauth2.Text;
                        IWebElement itaxauth3 = driver.FindElement(By.XPath("//*[@id='footer']/div[1]/div/div[1]/div[2]/div/ul/li[4]"));
                        TaxAuth3     = itaxauth3.Text;
                        TaxAuthority = TaxAuth1 + " " + TaxAuth2 + " " + TaxAuth3;
                    }
                    catch { }

                    for (int k = 1; k < 4; k++)
                    {
                        if (k == 1)
                        {
                            //select year
                            var year           = driver.FindElement(By.Id("SelTaxYear"));
                            var selectElement1 = new SelectElement(year);
                            selectElement1.SelectByIndex(0);
                            //searchBy
                            var searchby       = driver.FindElement(By.Id("SearchVal"));
                            var selectElement2 = new SelectElement(searchby);
                            selectElement2.SelectByText("FEE PARCEL");
                            driver.FindElement(By.XPath("//*[@id='SearchValue']")).SendKeys(Parcel_id);
                            driver.FindElement(By.XPath("//*[@id='SearchSubmit']")).SendKeys(Keys.Enter);
                            Thread.Sleep(3000);
                            gc.CreatePdf(orderNumber, Parcel_id, "tax1", driver, "CA", "Sonoma");
                        }

                        else if (k == 2)
                        {
                            //select year
                            var year           = driver.FindElement(By.Id("SelTaxYear"));
                            var selectElement1 = new SelectElement(year);
                            selectElement1.SelectByIndex(1);
                            //searchBy
                            var searchby       = driver.FindElement(By.Id("SearchVal"));
                            var selectElement2 = new SelectElement(searchby);
                            selectElement2.SelectByText("FEE PARCEL");
                            driver.FindElement(By.XPath("//*[@id='SearchSubmit']")).SendKeys(Keys.Enter);
                            Thread.Sleep(3000);
                            gc.CreatePdf(orderNumber, Parcel_id, "tax2", driver, "CA", "Sonoma");
                        }

                        else if (k == 3)
                        {
                            //select year
                            var year           = driver.FindElement(By.Id("SelTaxYear"));
                            var selectElement1 = new SelectElement(year);
                            selectElement1.SelectByIndex(2);
                            //searchBy
                            var searchby       = driver.FindElement(By.Id("SearchVal"));
                            var selectElement2 = new SelectElement(searchby);
                            selectElement2.SelectByText("FEE PARCEL");
                            driver.FindElement(By.XPath("//*[@id='SearchSubmit']")).SendKeys(Keys.Enter);
                            Thread.Sleep(3000);
                            gc.CreatePdf(orderNumber, Parcel_id, "tax3", driver, "CA", "Sonoma");
                        }



                        int j;
                        //Current Tax Details Table
                        try
                        {
                            int divCount = driver.FindElements(By.XPath("//*[@id='ResultDiv']/div")).Count;
                            for (j = 1; j <= divCount; j++)
                            {
                                IWebElement Itaxstmt = driver.FindElement(By.XPath("//*[@id='ResultDiv']/div[" + j + "]/div/div/div/a"));
                                string      stmt1    = Itaxstmt.GetAttribute("href");
                                strTaxRealestate1.Add(stmt1);
                            }
                        }
                        catch { }
                    }
                    foreach (string real in strTaxRealestate1)
                    {
                        driver.Navigate().GoToUrl(real);
                        Thread.Sleep(4000);
                        string pdfassess         = driver.FindElement(By.XPath(" /html/body/div[2]/section/div/div/div/div[6]/div/div[1]/div[1]/div[2]")).Text;
                        string pdfyear           = driver.FindElement(By.XPath("/html/body/div[2]/section/div/div/div/div[6]/div/div[1]/div[3]/div[2]")).Text;
                        string pdf               = pdfassess + " " + pdfyear;
                        string fulltabletextTax1 = driver.FindElement(By.XPath("//*[@id='h2tab1']/div[1]/div[1]/dl")).Text.Trim().Replace("\r\n", "");
                        if (fulltabletextTax1.Contains("Delinq. Date"))
                        {
                            First_Installment_Paid_Status = gc.Between(fulltabletextTax1, "Paid Status", "Delinq. Date").Trim();
                            First_Installment_Paid_Date   = gc.Between(fulltabletextTax1, "Delinq. Date", "Total Due").Trim();
                        }
                        else
                        {
                            First_Installment_Paid_Status = gc.Between(fulltabletextTax1, "Paid Status", "Paid Date").Trim();
                            First_Installment_Paid_Date   = gc.Between(fulltabletextTax1, "Paid Date", "Total Due").Trim();
                        }
                        First_Installment_Total_Due  = gc.Between(fulltabletextTax1, "Total Due", "Total Paid").Trim();
                        First_Installment_Total_Paid = gc.Between(fulltabletextTax1, "Total Paid", "Balance").Trim();
                        First_Installment_Balance    = WebDriverTest.After(fulltabletextTax1, "Balance");

                        string fulltabletextTax2 = driver.FindElement(By.XPath("//*[@id='h2tab1']/div[1]/div[2]/dl")).Text.Trim().Replace("\r\n", "");
                        if (fulltabletextTax2.Contains("Delinq. Date"))
                        {
                            Second_Installment_Paid_Status = gc.Between(fulltabletextTax2, "Paid Status", "Delinq. Date").Trim();
                            Second_Installment_Paid_Date   = gc.Between(fulltabletextTax2, "Delinq. Date", "Total Due").Trim();
                        }
                        else
                        {
                            Second_Installment_Paid_Status = gc.Between(fulltabletextTax2, "Paid Status", "Paid Date").Trim();
                            Second_Installment_Paid_Date   = gc.Between(fulltabletextTax2, "Paid Date", "Total Due").Trim();
                        }
                        Second_Installment_Total_Due  = gc.Between(fulltabletextTax2, "Total Due", "Total Paid").Trim();
                        Second_Installment_Total_Paid = gc.Between(fulltabletextTax2, "Total Paid", "Balance").Trim();
                        Second_Installment_Balance    = WebDriverTest.After(fulltabletextTax2, "Balance");

                        string fulltabletextTax3 = driver.FindElement(By.XPath("//*[@id='h2tab1']/div[2]/dl")).Text.Trim().Replace("\r\n", "");
                        FirstandSecondInstallment_Total_Due     = gc.Between(fulltabletextTax3, "Total Due", "Total Paid").Trim();
                        FirstandSecondInstallment_Total_Paid    = gc.Between(fulltabletextTax3, "Total Paid", "Total Balance").Trim();
                        FirstandSecondInstallment_Total_Balance = WebDriverTest.After(fulltabletextTax3, "Total Balance");

                        gc.CreatePdf(orderNumber, Parcel_id, "Taxes" + pdf, driver, "CA", "Sonoma");
                        driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/ul/li[2]/a")).Click();
                        Thread.Sleep(3000);
                        gc.CreatePdf(orderNumber, Parcel_id, "Assess info" + pdf, driver, "CA", "Sonoma");
                        string fulltabletextTax4 = driver.FindElement(By.XPath("//*[@id='h2tab2']/dl")).Text.Trim().Replace("\r\n", "");
                        string assessment        = gc.Between(fulltabletextTax4, "Assessment", "Taxyear").Trim();
                        Tax_year      = gc.Between(fulltabletextTax4, "Taxyear", "Parcel Number").Trim();
                        Roll_Category = gc.Between(fulltabletextTax4, "Roll Category", "Doc Num").Trim();
                        IWebElement IAddress1 = driver.FindElement(By.XPath("//*[@id='h2tab2']/dl/dd[6]"));
                        Address1 = IAddress1.Text;
                        IWebElement IAddress2 = driver.FindElement(By.XPath("//*[@id='h2tab2']/dl/dd[7]"));
                        Address2 = IAddress2.Text;
                        Address  = Address1 + " " + Address2;
                        string tax = assessment + "~" + Roll_Category + "~" + Address + "~" + Tax_year + "~" + First_Installment_Paid_Status + "~" + First_Installment_Paid_Date + "~" + First_Installment_Total_Due + "~" + First_Installment_Total_Paid + "~" + First_Installment_Balance + "~" + Second_Installment_Paid_Status + "~" + Second_Installment_Paid_Date + "~" + Second_Installment_Total_Due + "~" + Second_Installment_Total_Paid + "~" + Second_Installment_Balance + "~" + FirstandSecondInstallment_Total_Due + "~" + FirstandSecondInstallment_Total_Paid + "~" + FirstandSecondInstallment_Total_Balance + "~" + TaxAuthority;
                        gc.insert_date(orderNumber, Parcel_id, 1262, tax, 1, DateTime.Now);

                        //      Assessment~Roll Category~Address~Tax year~First Installment Paid Status~First Installment Paid Date~First Installment Total Due~First Installment Total Paid~First Installment Balance~Second Installment Paid Status~Second Installment Paid Date~Second Installment Total Due~Second Installment Total Paid~Second Installment Balance~First and Second Installment Total Due~First and Second Installment Total Paid~First and Second Installment Total Balance

                        //download taxbill
                        try
                        {
                            IWebElement Itaxbill = driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/div/div[1]/div[4]/div/a"));
                            string      URL1     = Itaxbill.GetAttribute("href");
                            gc.downloadfile(URL1, orderNumber, Parcel_id, "TaxBill" + pdf, "CA", "Sonoma");
                        }
                        catch { }

                        //Taxcode Info
                        try
                        {
                            driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/ul/li[3]/a")).Click();
                            Thread.Sleep(3000);
                            gc.CreatePdf(orderNumber, Parcel_id, "Tax code" + pdf, driver, "CA", "Sonoma");

                            int      count       = driver.FindElements(By.XPath("//*[@id='h2tab3']/div")).Count;
                            int      divCount2   = count + 1;
                            string[] TaxCode     = new string[divCount2];
                            string[] description = new string[divCount2];
                            string[] rate        = new string[divCount2];
                            string[] Istinstall  = new string[divCount2];
                            string[] IIndinstall = new string[divCount2];
                            string[] total       = new string[divCount2];
                            string[] phone       = new string[divCount2];
                            for (int i = 1; i <= count; i++)
                            {
                                string Description1 = driver.FindElement(By.XPath(" //*[@id='h2tab3']/div[" + i + "]/div/div/dl")).Text.Trim().Replace("\r\n", "");
                                TaxCode[i]     = gc.Between(Description1, "Tax Code", "Description").Trim();
                                description[i] = gc.Between(Description1, "Description", "Rate").Trim();
                                rate[i]        = gc.Between(Description1, "Rate", "1st Installment").Trim();
                                Istinstall[i]  = gc.Between(Description1, "1st Installment", "2nd Installment").Trim();
                                IIndinstall[i] = gc.Between(Description1, "2nd Installment", "Total").Trim();
                                total[i]       = gc.Between(Description1, "Total", "Phone").Trim();
                                phone[i]       = WebDriverTest.After(Description1, "Phone");
                                string taxcode = Tax_year + "~" + TaxCode[i] + "~" + description[i] + "~" + rate[i] + "~" + Istinstall[i] + "~" + IIndinstall[i] + "~" + total[i] + "~" + phone[i];
                                gc.insert_date(orderNumber, Parcel_id, 1263, taxcode, 1, DateTime.Now);
                            }
                        }
                        catch { }
                        //Tax Year~Tax Code~Description~Rate~1st Installment~2nd Installment~Total~Phone

                        //Default Tax
                        try
                        {
                            driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/ul/li[4]/a")).Click();
                            Thread.Sleep(3000);
                            gc.CreatePdf(orderNumber, Parcel_id, "Default Tax" + pdf, driver, "CA", "Sonoma");

                            Default_Number     = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[1]/div[2]")).Text;
                            Pay_Plan_in_Effect = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[2]/div[2]")).Text;
                            Annual_Payment     = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[3]/div[2]")).Text;
                            Balance            = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[4]/div[2]")).Text;

                            string default_tax = Tax_year + "~" + Default_Number + "~" + Pay_Plan_in_Effect + "~" + Annual_Payment + "~" + Balance;
                            gc.insert_date(orderNumber, Parcel_id, 1264, default_tax, 1, DateTime.Now);
                        }
                        //Tax Year~Default Number~Pay Plan in Effect~Annual Payment~Balance
                        catch { }
                    }
                    TaxTime     = DateTime.Now.ToString("HH:mm:ss");
                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "CA", "Sonoma", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderNumber, "CA", "Sonoma");
                    return("Data Inserted Successfully");
                }

                catch (Exception ex)
                {
                    driver.Quit();
                    throw ex;
                }
            }
        }
        public string FTP_Eldarado(string Address, string account, string parcelNumber, string ownername, string searchType, string orderno, string directParcel)
        {
            GlobalClass.global_orderNo             = orderno;
            HttpContext.Current.Session["orderNo"] = orderno;
            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())
            {
                int           multicount = 0;
                string        StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";
                string        multiparcel = "", MapTaxLot = "", SitusAddress = "", LegalDescription = "";
                IWebElement   PropertyValidation;
                string[]      stringSeparators1 = new string[] { "\r\n" };
                List <string> listurl           = new List <string>();

                List <string> Columnurl = new List <string>();
                string        Date      = "";
                Date = DateTime.Now.ToString("M/d/yyyy");
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");
                    //if (searchType == "titleflex")
                    //{
                    //    gc.TitleFlexSearch(orderno, parcelNumber, ownername, Address, "CA", "El Dorado");

                    //    parcelNumber = GlobalClass.global_parcelNo;
                    //    if (GlobalClass.TitleFlex_Search == "Yes")
                    //    {
                    //        driver.Quit();
                    //        return "MultiParcel";
                    //    }
                    //    searchType = "parcel";
                    //}
                    if (searchType == "address")
                    {
                        driver.Navigate().GoToUrl("https://common3.mptsweb.com/MBC/eldorado/tax/search");
                        IWebElement   PropertyInformation       = driver.FindElement(By.Id("SearchVal"));
                        SelectElement PropertyInformationSelect = new SelectElement(PropertyInformation);
                        PropertyInformationSelect.SelectByValue("situs");
                        driver.FindElement(By.Id("SearchValue")).SendKeys(Address);
                        driver.FindElement(By.Id("SearchSubmit")).Click();
                        Thread.Sleep(2000);
                        IWebElement Addresstax = driver.FindElement(By.XPath("//*[@id='ResultDiv']/div"));
                        string      Firststep = ""; int Max = 0;
                        try
                        {
                            IWebElement         PropertyIteamTable = driver.FindElement(By.XPath("//*[@id='ResultDiv']/div/div"));
                            IList <IWebElement> PropertyIeamRow    = PropertyIteamTable.FindElements(By.TagName("p"));

                            foreach (IWebElement Property in PropertyIeamRow)
                            {
                                if (PropertyIeamRow.Count != 0 & !Property.Text.Contains("View Details"))
                                {
                                    string   Parcelnumber = GlobalClass.After(Property.Text, "Fee Parcel :").Trim();
                                    string[] splitparcel  = Parcelnumber.Split('-');
                                    string   split3       = splitparcel[2].Substring(1, 2);
                                    parcelNumber = splitparcel[0] + splitparcel[1] + split3;
                                    string Addressta   = gc.Between(Property.Text, "Address :", "Year :");
                                    string Yearpar     = gc.Between(Property.Text, "Year :", "TRA :");
                                    string roallcast   = gc.Between(Property.Text, "Roll Cat. :", "Fee Parcel :");
                                    string Multiresult = "~" + Addressta + "~" + Yearpar + "~" + roallcast;
                                    gc.insert_date(orderno, Parcelnumber, 360, Multiresult, 1, DateTime.Now);
                                    Max++;
                                }
                            }
                            if (Max == 1)
                            {
                                searchType = "parcel";
                            }
                            if (Max > 1 & Max < 26)
                            {
                                HttpContext.Current.Session["multiParcel_CAEldorado"] = "Yes";
                                gc.CreatePdf_WOP(orderno, "MultyAddressSearch", driver, "CA", "El Dorado");
                                driver.Quit();
                                return("MultiParcel");
                            }
                            if (Max > 25)
                            {
                                HttpContext.Current.Session["multiParcel_CAEldorado_Count"] = "Maximum";
                                gc.CreatePdf_WOP(orderno, "MultyAddressSearch", driver, "CA", "El Dorado");
                                driver.Quit();
                                return("Maximum");
                            }
                        }
                        catch { }
                        try
                        {
                            IWebElement INodata = driver.FindElement(By.Id("ResultDiv"));
                            if (INodata.Text.Contains("no matching records were found"))
                            {
                                HttpContext.Current.Session["Nodata_CAEldorado"] = "Zero";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                    }
                    if (searchType == "parcel")
                    {
                        driver.Navigate().GoToUrl("http://main.edcgov.us/CGI/WWB012/WWM400/A");

                        Thread.Sleep(3000);
                        var SerachCategory = driver.FindElement(By.XPath("//*[@id='T']"));
                        var selectElement1 = new SelectElement(SerachCategory);
                        selectElement1.SelectByText("Secured Parcel Number (999-999-99)");
                        Thread.Sleep(3000);

                        driver.FindElement(By.XPath("//*[@id='K']")).SendKeys(parcelNumber.Trim());
                        gc.CreatePdf(orderno, parcelNumber, "Account Number Search", driver, "CA", "El Dorado");
                        Thread.Sleep(1000);


                        driver.FindElement(By.XPath("/html/body/form/table/tbody/tr/td/span/input")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        gc.CreatePdf(orderno, parcelNumber, "Parcel Search", driver, "CA", "El Dorado");
                    }
                    else if (searchType == "ownername")
                    {
                        driver.Navigate().GoToUrl("http://main.edcgov.us/CGI/WWB012/WWM400/A");

                        Thread.Sleep(3000);
                        var SerachCategory = driver.FindElement(By.XPath("//*[@id='T']"));
                        var selectElement1 = new SelectElement(SerachCategory);
                        selectElement1.SelectByText("Owner's Name (Last First) or (Company)");
                        Thread.Sleep(3000);
                        gc.CreatePdf_WOP(orderno, "ownerNameSearch", driver, "CA", "El Dorado");
                        driver.FindElement(By.XPath("//*[@id='K']")).SendKeys(ownername.Trim());
                        Thread.Sleep(1000);
                        try
                        {
                            IWebElement   ImultiCount = driver.FindElement(By.XPath("//*[@id='Q']"));
                            SelectElement selectCount = new SelectElement(ImultiCount);
                            selectCount.SelectByText("50");
                        }
                        catch { }
                        driver.FindElement(By.XPath("/html/body/form/table/tbody/tr/td/span/input")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        try
                        {
                            string strmultiCount = driver.FindElement(By.XPath("/html/body/p[2]")).Text;
                            string strMcount     = gc.Between(strmultiCount, "Record Count = ", " of");
                            if (Convert.ToInt32(strMcount) > 25)
                            {
                                HttpContext.Current.Session["multiParcel_CAEldorado_Count"] = "Maximum";
                                return("Maximum");
                            }
                        }
                        catch { }
                        gc.CreatePdf_WOP(orderno, "ownerNameSearchResult", driver, "CA", "El Dorado");
                        IWebElement         MuliparcTB = driver.FindElement(By.XPath("//*[@id='idWWM983']/tbody"));
                        IList <IWebElement> MuliparcTR = MuliparcTB.FindElements(By.TagName("tr"));
                        if (MuliparcTR.Count() > 2)
                        {
                            IList <IWebElement> MuliparcTD;

                            foreach (IWebElement row1 in MuliparcTR)
                            {
                                MuliparcTD = row1.FindElements(By.TagName("td"));
                                if (MuliparcTD.Count != 0 && multicount < 25)
                                {
                                    parcelNumber = MuliparcTD[1].Text;
                                    ownername    = MuliparcTD[2].Text;

                                    string Multipar = ownername + "~" + "~" + "~";
                                    gc.insert_date(orderno, parcelNumber, 360, Multipar, 1, DateTime.Now);
                                    HttpContext.Current.Session["multiParcel_CAEldorado"] = "Yes";
                                    multicount++;
                                }
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }



                        //gc.CreatePdf(orderno, parcelNumber, "Account Number Search Result", driver, "OR", "Marion");
                    }
                    else if (searchType == "block")
                    {
                        driver.Navigate().GoToUrl("http://main.edcgov.us/CGI/WWB012/WWM400/A");

                        Thread.Sleep(3000);
                        var SerachCategory = driver.FindElement(By.XPath("//*[@id='T']"));
                        var selectElement1 = new SelectElement(SerachCategory);
                        selectElement1.SelectByText("Owner's Name (Last First) or (Company)");
                        Thread.Sleep(3000);
                        gc.CreatePdf_WOP(orderno, "Account Number Search", driver, "CA", "El Dorado");
                        driver.FindElement(By.XPath("//*[@id='K']")).SendKeys(ownername.Trim());
                        Thread.Sleep(1000);
                        try
                        {
                            IWebElement   ImultiCount = driver.FindElement(By.XPath("//*[@id='Q']"));
                            SelectElement selectCount = new SelectElement(ImultiCount);
                            selectCount.SelectByText("50");
                        }
                        catch { }
                        driver.FindElement(By.XPath("/html/body/form/table/tbody/tr/td/span/input")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        try
                        {
                            string strmultiCount = driver.FindElement(By.XPath("/html/body/p[2]")).Text;
                            string strMcount     = gc.Between(strmultiCount, "Record Count = ", " of");
                            if (Convert.ToInt32(strMcount) > 25)
                            {
                                HttpContext.Current.Session["multiParcel_CAEldorado_Count"] = "Maximum";
                                return("Maximum");
                            }
                        }
                        catch { }
                        gc.CreatePdf_WOP(orderno, "Account Number Search Result", driver, "CA", "El Dorado");
                        IWebElement         MuliparcTB = driver.FindElement(By.XPath("/[@id='idWWM983']/tbody"));
                        IList <IWebElement> MuliparcTR = MuliparcTB.FindElements(By.TagName("tr"));
                        if (MuliparcTR.Count() > 2)
                        {
                            IList <IWebElement> MuliparcTD;

                            foreach (IWebElement row1 in MuliparcTR)
                            {
                                MuliparcTD = row1.FindElements(By.TagName("td"));
                                if (MuliparcTD.Count != 0 && multicount < 25)
                                {
                                    parcelNumber = MuliparcTD[1].Text;
                                    ownername    = MuliparcTD[2].Text;

                                    string Multipar = ownername;
                                    gc.insert_date(orderno, parcelNumber, 360, Multipar, 1, DateTime.Now);

                                    HttpContext.Current.Session["multiParcel_CAEldorado"] = "Yes";
                                    multicount++;
                                }
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                    }

                    try
                    {
                        IWebElement INodata = driver.FindElement(By.XPath("/html/body/p[2]"));
                        if (INodata.Text.Contains("No Records Found"))
                        {
                            HttpContext.Current.Session["Nodata_CAEldorado"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }

                    // assessment details
                    string YearBuilt = "", Abstractcode = "", Reference = "", SubdivisionTractNumber = "", SubdivisionTractName = "", TaxRateArea = "", City = "", BulData = "";
                    Reference = driver.FindElement(By.XPath("//*[@id='idWWM983']/tbody/tr[2]/td[3]/span")).Text.Trim();
                    string chkpa1 = "";
                    string chkpa  = driver.FindElement(By.XPath("//*[@id='idWWM983']/tbody/tr[2]/td[2]/a")).Text;
                    try
                    {
                        chkpa1 = driver.FindElement(By.XPath("//*[@id='idWWM983']/tbody/tr[3]/td[2]/a")).Text;
                    }
                    catch { }
                    driver.FindElement(By.XPath("//*[@id='idWWM983']/tbody/tr[2]/td[2]/a")).SendKeys(Keys.Enter);
                    Thread.Sleep(1000);
                    gc.CreatePdf(orderno, parcelNumber, "Assessment Details", driver, "CA", "El Dorado");
                    parcelNumber = driver.FindElement(By.XPath("//*[@id='Top']")).Text.Replace("Parcel Number ", "").Trim();
                    IWebElement         YearB  = driver.FindElement(By.XPath("/html/body/table[8]/tbody"));
                    IList <IWebElement> YearTR = YearB.FindElements(By.TagName("tr"));
                    IList <IWebElement> YearTD;

                    foreach (IWebElement row1 in YearTR)
                    {
                        YearTD = row1.FindElements(By.TagName("td"));
                        if (row1.Text.Contains("Year Built"))
                        {
                            if (YearTD.Count != 0)
                            {
                                YearBuilt = YearTD[1].Text;
                            }
                        }
                    }
                    try
                    {
                        YearB  = driver.FindElement(By.XPath("/html/body/table[9]/tbody"));
                        YearTR = YearB.FindElements(By.TagName("tr"));


                        foreach (IWebElement row1 in YearTR)
                        {
                            YearTD = row1.FindElements(By.TagName("td"));
                            if (row1.Text.Contains("Year Built"))
                            {
                                if (YearTD.Count != 0)
                                {
                                    YearBuilt = YearTD[1].Text;
                                }
                            }
                        }
                    }
                    catch { }
                    string OW1 = "", Ow2 = "", Ow3 = "";
                    OW1 = driver.FindElement(By.XPath("/html/body")).Text;

                    ownername = gc.Between(OW1, "Current Property Owners\r\n", "\r\nProperty Description Values Event List Characteristics Background Top of Page").Trim();

                    ownername = ownername.Replace("\r\n", "");



                    BulData = driver.FindElement(By.XPath("//*[@id='PROPDESC']")).Text;

                    Reference = gc.Between(BulData, "Reference:", "For Zoning,").Trim();

                    try { Abstractcode = gc.Between(BulData, "Abstract code:", "Reference:").Trim(); }
                    catch { }
                    if (Abstractcode.Contains("G.I.S. Map"))
                    {
                        Abstractcode = "";
                    }
                    //Reference = WebDriverTest.After(BulData, "Reference:").Trim();
                    //var FRefSplit = Reference.Split('(');
                    //Reference = FRefSplit[0];

                    try
                    {
                        SubdivisionTractNumber = gc.Between(BulData, "Subdivision Tract Number:", "Subdivision Tract Name:").Trim();
                        SubdivisionTractName   = gc.Between(BulData, "Subdivision Tract Name: ", "Subdivision map").Trim();
                    }
                    catch { }

                    if (SubdivisionTractName == "")
                    {
                        try
                        {
                            SubdivisionTractName = gc.Between(BulData, "Subdivision Tract Name: ", "Timeshare Interval Id:").Trim();
                        }
                        catch { }
                    }

                    TaxRateArea = WebDriverTest.After(BulData, "Tax Rate Area:").Trim();
                    var Citysplit = TaxRateArea.Split(' ');
                    TaxRateArea = Citysplit[0];
                    City        = WebDriverTest.After(BulData, Citysplit[0]).Trim();

                    string ProperTyDetail = ownername + "~" + Abstractcode + "~" + Reference + "~" + SubdivisionTractNumber + "~" + SubdivisionTractName + "~" + TaxRateArea + "~" + City + "~" + YearBuilt;
                    gc.insert_date(orderno, parcelNumber, 260, ProperTyDetail, 1, DateTime.Now);
                    string Column = "";

                    string TaxablePropertyValues20172018 = "", Land = "", LandTotal = "", ImprovementStructures = "", ImprovementTotal = "", TotalRoll = "", NetRoll = "";
                    string LandProp8 = "", ImporevePro8 = "", Exemption = "";
                    TaxablePropertyValues20172018 = driver.FindElement(By.XPath("/html/body/table[4]/caption")).Text.Trim().Replace("\r\n", " ");
                    IWebElement         MultiAssessTB = driver.FindElement(By.XPath("/html/body/table[4]/tbody"));
                    IList <IWebElement> MultiAssessTR = MultiAssessTB.FindElements(By.TagName("tr"));
                    IList <IWebElement> MultiAssessTD;

                    foreach (IWebElement row1 in MultiAssessTR)
                    {
                        MultiAssessTD = row1.FindElements(By.TagName("td"));
                        if (MultiAssessTD.Count != 0)
                        {
                            Column = MultiAssessTD[0].Text + "~" + Column;
                            Land   = MultiAssessTD[1].Text + "~" + Land;
                        }
                    }
                    Column = Column + "dsds";
                    Land   = Land + "dsds";
                    Column = Column.Replace("~dsds", "");
                    Land   = Land.Replace("~dsds", "");
                    //if (listurl.Count == 4)
                    //{
                    //    Land = listurl[0];
                    //    LandTotal = listurl[1];
                    //    //   ImprovementStructures = listurl[2];
                    //    //  ImprovementTotal = listurl[3];
                    //    TotalRoll = listurl[2];
                    //    NetRoll = listurl[3];
                    //}
                    //else
                    //{
                    //    Land = listurl[0];
                    //    LandTotal = listurl[1];
                    //    ImprovementStructures = listurl[2];
                    //    ImprovementTotal = listurl[3];
                    //    TotalRoll = listurl[4];
                    //    NetRoll = listurl[5];
                    //}

                    DBconnection dbconn = new DBconnection();



                    dbconn.ExecuteQuery("update  data_field_master set Data_Fields_Text='" + Column + "' where Id = '" + 261 + "'");


                    string Assessment = Land;
                    gc.insert_date(orderno, parcelNumber, 261, Assessment, 1, DateTime.Now);
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    driver.Navigate().GoToUrl("https://taxcollector.edcgov.us/GetAPN.aspx");
                    Thread.Sleep(2000);
                    driver.FindElement(By.XPath("//*[@id='btnawoc']")).Click();
                    Thread.Sleep(2000);
                    driver.FindElement(By.XPath("//*[@id='form1']/table[2]/tbody/tr[2]/td[1]/a/img")).Click();
                    Thread.Sleep(2000);
                    driver.FindElement(By.XPath("//*[@id='txtAPN']")).SendKeys(parcelNumber);
                    gc.CreatePdf(orderno, parcelNumber, "Input Passed Tax Search", driver, "CA", "El Dorado");
                    Thread.Sleep(1000);



                    //Tax bill download....
                    IWebElement         SelectOption = driver.FindElement(By.Id("ddList"));
                    IList <IWebElement> Select       = SelectOption.FindElements(By.TagName("option"));
                    List <string>       option       = new List <string>();
                    int Check = 0;
                    foreach (IWebElement Op in Select)
                    {
                        if (Check <= 2)
                        {
                            option.Add(Op.Text);
                        }
                        Check++;
                    }

                    //load chrome driver...
                    //IWebDriver chDriver = new ChromeDriver();
                    var chromeOptions     = new ChromeOptions();
                    var downloadDirectory = ConfigurationManager.AppSettings["AutoPdf"];

                    chromeOptions.AddUserProfilePreference("download.default_directory", downloadDirectory);
                    chromeOptions.AddUserProfilePreference("download.prompt_for_download", false);
                    chromeOptions.AddUserProfilePreference("disable-popup-blocking", "true");

                    var chDriver = new ChromeDriver(chromeOptions);
                    try
                    {
                        chDriver.Navigate().GoToUrl("https://taxcollector.edcgov.us/GetAPN.aspx");
                        chDriver.FindElement(By.XPath("//*[@id='btnawoc']")).Click();
                        chDriver.FindElement(By.XPath("//*[@id='form1']/table[2]/tbody/tr[2]/td[1]/a/img")).Click();
                        chDriver.FindElement(By.XPath("//*[@id='txtAPN']")).SendKeys(parcelNumber);

                        foreach (string item in option)
                        {
                            var SelectAddress    = chDriver.FindElement(By.Id("ddList"));
                            var SelectAddressTax = new SelectElement(SelectAddress);
                            SelectAddressTax.SelectByText(item);
                            chDriver.FindElement(By.XPath("//*[@id='btnView']")).Click();
                            Thread.Sleep(9000);

                            string yr       = GlobalClass.Before(item, "-");
                            string fileName = "EDC_TaxBill_Copy_for_Secured_APN_" + parcelNumber + "_Year_" + yr + ".pdf";
                            gc.AutoDownloadFile(orderno, parcelNumber, "El Dorado", "CA", fileName);
                        }
                        chDriver.Quit();
                    }

                    catch (Exception ex)
                    {
                        chDriver.Quit();
                        GlobalClass.LogError(ex, orderno);
                    }


                    driver.FindElement(By.XPath("//*[@id='btnSecSum']")).SendKeys(Keys.Enter);
                    Thread.Sleep(1000);


                    gc.CreatePdf(orderno, parcelNumber, "Tax History Detail", driver, "CA", "El Dorado");
                    string Description = "", TaxAuthority = "360 Fair Lane, Placerville, CA 95667 (530) 621-5800,Fax: (530) 642-8870", Grand_Total_Secured_Taxes_Due = "", Fisrt_Instalment = "", Due = "", Default_Due = "", Year = "", Second_Instalment = "", Default_Bill = "", Total = "", Total_Default_Due = "";


                    //*[@id="main"]/table[1]/tbody/tr[1]/td/table[4]/tbody

                    string taxsum = "";
                    try
                    {
                        IWebElement         tbmulti = driver.FindElement(By.XPath("//*[@id='main']/table[1]/tbody/tr[1]/td/table[4]/tbody"));
                        IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                        IList <IWebElement> TDmulti;
                        foreach (IWebElement row in TRmulti)
                        {
                            if (!row.Text.Contains("Description"))
                            {
                                TDmulti = row.FindElements(By.TagName("td"));
                                if (TDmulti.Count == 8)
                                {
                                    taxsum = TDmulti[0].Text + "~" + TDmulti[1].Text + "~" + TDmulti[2].Text + "~" + TDmulti[3].Text + "~" + TDmulti[4].Text + "~" + TDmulti[5].Text + "~" + TDmulti[6].Text;
                                    gc.insert_date(orderno, parcelNumber, 265, taxsum, 1, DateTime.Now);
                                }
                                if (TDmulti.Count == 4)
                                {
                                    taxsum = "Totals" + "~" + "" + "~" + "" + "~" + TDmulti[1].Text + "~" + TDmulti[2].Text + "~" + "" + "~" + "";
                                    gc.insert_date(orderno, parcelNumber, 265, taxsum, 1, DateTime.Now);
                                }
                                if (TDmulti.Count == 3)
                                {
                                    taxsum = "Grand Total Secured Taxes Due" + "~" + "" + "~" + "" + "~" + TDmulti[1].Text + "~" + "" + "~" + "" + "~" + "";
                                    gc.insert_date(orderno, parcelNumber, 265, taxsum, 1, DateTime.Now);
                                }
                            }
                        }
                    }
                    catch { }

                    //IWebElement CurrentTaxHistoryTB1 = driver.FindElement(By.XPath("//*[@id='main']/table[1]/tbody/tr[1]/td/table[4]/tbody"));
                    //IList<IWebElement> CurrentTaxHistoryTR1 = CurrentTaxHistoryTB1.FindElements(By.TagName("tr"));
                    //IList<IWebElement> CurrentTaxHistoryTD1;
                    //int rowcount = CurrentTaxHistoryTR1.Count;
                    //int count = 0;
                    //foreach (IWebElement row1 in CurrentTaxHistoryTR1)
                    //{

                    //    CurrentTaxHistoryTD1 = row1.FindElements(By.TagName("td"));
                    //    if (CurrentTaxHistoryTD1.Count != 0 && row1.Text != "" && !row1.Text.Contains("Current Owner") && !row1.Text.Contains("Description"))
                    //    {
                    //        if (count < rowcount - 2)
                    //        {
                    //            //Description~Fisrt_Instalment~Second_Instalment~Due~Default_Due~Year~Default_Bill~Total~Total_Default_Due~Grand_Total_Secured_Taxes_Due
                    //            taxsum = CurrentTaxHistoryTD1[0].Text + "~" + CurrentTaxHistoryTD1[1].Text + "~" + CurrentTaxHistoryTD1[2].Text + "~" + CurrentTaxHistoryTD1[3].Text + "~" + CurrentTaxHistoryTD1[4].Text + "~" + CurrentTaxHistoryTD1[5].Text + "~" + CurrentTaxHistoryTD1[6].Text;
                    //            gc.insert_date(orderno, parcelNumber, 265, taxsum, 1, DateTime.Now);
                    //        }
                    //        if (count == rowcount - 2)
                    //        {
                    //            taxsum = "Totals" + "~" + "" + "~" + "" + "~" + CurrentTaxHistoryTD1[1].Text + "~" + CurrentTaxHistoryTD1[2].Text + "~" + "" + "~" + "";
                    //            gc.insert_date(orderno, parcelNumber, 265, taxsum, 1, DateTime.Now);
                    //        }
                    //        if (count == rowcount - 1)
                    //        {
                    //            taxsum = "Grand Total Secured Taxes Due" + "~" + "" + "~" + "" + "~" + CurrentTaxHistoryTD1[1].Text + "~" + "" + "~" + "" + "~" + "";
                    //            gc.insert_date(orderno, parcelNumber, 265, taxsum, 1, DateTime.Now);
                    //        }
                    //    }

                    //    count++;
                    //}


                    try
                    {
                        IWebElement         CurrentTaxHistoryTB = driver.FindElement(By.XPath("//*[@id='main']/table[1]/tbody/tr[1]/td/table[4]/tbody"));
                        IList <IWebElement> CurrentTaxHistoryTR = CurrentTaxHistoryTB.FindElements(By.TagName("tr"));
                        IList <IWebElement> CurrentTaxHistoryTD;
                        IList <IWebElement> CurrentTaxHistoryTA;
                        listurl.Clear();
                        foreach (IWebElement row1 in CurrentTaxHistoryTR)
                        {
                            CurrentTaxHistoryTD = row1.FindElements(By.TagName("td"));
                            if (CurrentTaxHistoryTD.Count != 0 && CurrentTaxHistoryTD.Count != 2 && CurrentTaxHistoryTD.Count != 1 && CurrentTaxHistoryTD[0].Text.Trim() != "Description")
                            {
                                foreach (IWebElement row in CurrentTaxHistoryTD)
                                {
                                    CurrentTaxHistoryTA = row.FindElements(By.TagName("a"));
                                    if (CurrentTaxHistoryTA.Count != 0)
                                    {
                                        listurl.Add(CurrentTaxHistoryTA[0].GetAttribute("href"));
                                    }
                                }
                                foreach (string URL in listurl)

                                {
                                    gc.downloadfile(URL, orderno, parcelNumber, "Tax_Bill" + Description, "CA", "El Dorado");
                                }
                            }
                        }
                    }
                    catch { }

                    try
                    {
                        driver.FindElement(By.XPath("//*[@id='MainContent_menus']/table/tbody/tr[2]/td[2]/a/img")).Click();
                        Thread.Sleep(2000);
                    }
                    catch { }
                    try
                    {
                        gc.CreatePdf(orderno, parcelNumber, "Payment History Detail", driver, "CA", "El Dorado");
                        string PaymentHistoryforAPN = "", DatePaid = "", Installment = "", Amount = "";
                        PaymentHistoryforAPN = driver.FindElement(By.XPath("//*[@id='menus']/table/tbody/tr[2]/td[2]/h2[1]")).Text;
                        var Paysplit = PaymentHistoryforAPN.Split(':');
                        PaymentHistoryforAPN = Paysplit[1];
                        IWebElement         CurrentPayHistoryTB = driver.FindElement(By.XPath("//*[@id='form1']/table/tbody/tr[3]/td/table/tbody"));
                        IList <IWebElement> CurrentPayHistoryTR = CurrentPayHistoryTB.FindElements(By.TagName("tr"));
                        IList <IWebElement> CurrentPayHistoryTD;

                        foreach (IWebElement row1 in CurrentPayHistoryTR)
                        {
                            CurrentPayHistoryTD = row1.FindElements(By.TagName("td"));
                            if (CurrentPayHistoryTD.Count != 0 && CurrentPayHistoryTD.Count != 1 && CurrentPayHistoryTD[0].Text.Trim() != "Date Paid")
                            {
                                DatePaid     = CurrentPayHistoryTD[0].Text;
                                Description  = CurrentPayHistoryTD[1].Text;
                                Default_Bill = CurrentPayHistoryTD[2].Text;
                                Installment  = CurrentPayHistoryTD[3].Text;
                                Year         = CurrentPayHistoryTD[4].Text;
                                Amount       = CurrentPayHistoryTD[5].Text;

                                string CurrenttaxHistory = PaymentHistoryforAPN + "~" + DatePaid + "~" + Description + "~" + Default_Bill + "~" + Installment + "~" + Year + "~" + Amount;
                                gc.insert_date(orderno, parcelNumber, 264, CurrenttaxHistory, 1, DateTime.Now);
                            }
                        }
                    }
                    catch { }

                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");

                    gc.insert_TakenTime(orderno, "CA", "El Dorado", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);


                    driver.Quit();
                    gc.mergpdf(orderno, "CA", "El Dorado");

                    //gc.MMREM_Template(orderno,parcelNumber,"",driver,"CA", "El Dorado","95","");
                    return("Data Inserted Successfully");
                }

                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderno);
                    throw ex;
                }
            }
        }
Example #18
0
        public string FTP_CAContracosta(string houseno, string sname, string stype, string city, string parcelNumber, string searchType, string orderNumber, string ownername, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";

            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            // driver = new ChromeDriver();
            //driver = new PhantomJSDriver()
            using (driver = new PhantomJSDriver())
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");
                    string taddress = "";
                    if (searchType == "titleflex")
                    {
                        if (directParcel != null)
                        {
                            taddress = houseno + " " + directParcel + " " + sname;
                        }
                        else
                        {
                            taddress = houseno + " " + directParcel + " " + sname;
                        }
                        gc.TitleFlexSearch(orderNumber, parcelNumber, ownername, taddress, "CA", "Contra Costa");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_CAContraCosta"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                        searchType   = "parcel";
                        parcelNumber = GlobalClass.global_parcelNo.Replace("-", "");
                        parcelNumber = parcelNumber.Substring(0, 9);
                    }

                    if (searchType == "address")
                    {
                        driver.Navigate().GoToUrl("https://taxcolp.cccounty.us/taxpaymentrev3/lookup/");
                        Thread.Sleep(4000);

                        var SelectAddress = driver.FindElement(By.Id("searchtypeselect"));
                        Thread.Sleep(4000);
                        var SelectAddressTax = new SelectElement(SelectAddress);
                        SelectAddressTax.SelectByText("Property Address");
                        if (directParcel == null || directParcel == "")
                        {
                            address = houseno + " " + sname;
                        }

                        else
                        {
                            if (directParcel != null)
                            {
                                address = houseno + " " + directParcel + " " + sname;
                            }
                            else
                            {
                                address = houseno + " " + directParcel + " " + sname;
                            }
                        }


                        driver.FindElement(By.Id("searchfield")).SendKeys(address);

                        //var SelectAddressSuffix = driver.FindElement(By.Id("streetsuffixselect"));
                        //var SelectAddressSuffixTax = new SelectElement(SelectAddressSuffix);
                        //SelectAddressSuffixTax.SelectByText(stype);

                        var SelectAddressCity    = driver.FindElement(By.Id("cityselect"));
                        var SelectAddressCityTax = new SelectElement(SelectAddressCity);
                        SelectAddressCityTax.SelectByText(city.ToUpper().ToString().Trim());

                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "CA", "Contra Costa");
                        driver.FindElement(By.XPath("/html/body/div/div[3]/div[2]/form/div/div/div[6]/input")).SendKeys(Keys.Enter);
                        Thread.Sleep(8000);

                        //MultiParcel
                        try
                        {
                            IWebElement         MultiTable = driver.FindElement(By.XPath("//*[@id='address-picker']/table/tbody"));
                            IList <IWebElement> MultiTR    = MultiTable.FindElements(By.TagName("tr"));
                            IList <IWebElement> MultiTD;

                            int maxCheck = 0;
                            gc.CreatePdf_WOP(orderNumber, "MultiAddress", driver, "CA", "Contra Costa");
                            foreach (IWebElement Multi in MultiTR)
                            {
                                if (maxCheck <= 25)
                                {
                                    MultiTD = Multi.FindElements(By.TagName("td"));
                                    if (MultiTD.Count != 0)
                                    {
                                        Property_Address = MultiTD[0].Text;
                                        parcelNumber     = MultiTD[1].Text;

                                        Multiparcel = Property_Address.Replace("\r\n", "");
                                        gc.insert_date(orderNumber, parcelNumber, 411, Multiparcel, 1, DateTime.Now);
                                    }
                                    maxCheck++;
                                }
                            }
                            HttpContext.Current.Session["multiParcel_CAContraCosta"] = "Yes";

                            if (MultiTR.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_CAContraCosta_Multicount"] = "Maximum";
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                        catch { }
                    }

                    if (searchType == "parcel")
                    {
                        driver.Navigate().GoToUrl("https://taxcolp.cccounty.us/taxpaymentrev3/lookup/");
                        Thread.Sleep(4000);

                        var SelectParcel    = driver.FindElement(By.Id("searchtypeselect"));
                        var SelectParcelTax = new SelectElement(SelectParcel);
                        SelectParcelTax.SelectByText("Parcel Number");

                        driver.FindElement(By.Id("searchfield")).Click();
                        parcel   = parcelNumber.Replace("-", "");
                        parcel1  = parcel.Substring(0, 3);
                        parcel2  = parcel.Substring(3, 3);
                        parcel3  = parcel.Substring(6, 3);
                        ParcelId = parcel1 + parcel2 + parcel3;
                        Thread.Sleep(8000);
                        driver.FindElement(By.Id("searchfield")).Clear();
                        driver.FindElement(By.Id("searchfield")).Click();
                        driver.FindElement(By.Id("searchfield")).SendKeys(ParcelId);
                        gc.CreatePdf(orderNumber, parcelNumber, "ParcelSearch", driver, "CA", "Contra Costa");
                        driver.FindElement(By.XPath("/html/body/div/div[3]/div[2]/form/div/div/div[6]/input")).SendKeys(Keys.Enter);
                        Thread.Sleep(8000);
                    }

                    try
                    {
                        IWebElement Inodata = driver.FindElement(By.Id("error"));
                        if (Inodata.Text.Contains("Address Not Found") || Inodata.Text.Contains("APN not found"))
                        {
                            HttpContext.Current.Session["Nodata_CAContraCosta"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }
                    //Property Details
                    driver.FindElement(By.XPath("//*[@id='results']/div[1]/div[1]/a")).SendKeys(Keys.Enter);
                    Thread.Sleep(6000);

                    Situs_Address = driver.FindElement(By.XPath("//*[@id='results']/div[1]/h3")).Text;
                    Situs_Address = WebDriverTest.After(Situs_Address, "Address (Situs): ").Trim();

                    outparcelno = driver.FindElement(By.XPath("//*[@id='hide-details']/div[1]/h3")).Text;
                    outparcelno = GlobalClass.After(outparcelno, "Parcel Number (APN): ").Trim();
                    // outparcelno = gc.Between(outparcelno, "Parcel Number (APN): ", "SIGN UP HERE FOR SECURED").Trim();

                    gc.CreatePdf(orderNumber, outparcelno, "Property Details", driver, "CA", "Contra Costa");
                    Property_Deatail = Situs_Address;
                    gc.insert_date(orderNumber, outparcelno, 320, Property_Deatail, 1, DateTime.Now);

                    //Assement details
                    driver.FindElement(By.LinkText("ASSESSMENT INFORMATION")).Click();
                    Thread.Sleep(4000);
                    gc.CreatePdf(orderNumber, outparcelno, "Assement Details", driver, "CA", "Contra Costa");
                    IWebElement         AssementTB = driver.FindElement(By.XPath("//*[@id='current-assessment-information']/table/tbody"));
                    IList <IWebElement> AssementTR = AssementTB.FindElements(By.TagName("tr"));
                    IList <IWebElement> AssementTD;
                    foreach (IWebElement Assement in AssementTR)
                    {
                        AssementTD = Assement.FindElements(By.TagName("td"));
                        if (AssementTD.Count != 0)
                        {
                            if (Assement.Text.Contains("Assessment Year"))
                            {
                                Assessment_Year = AssementTD[1].Text;
                            }
                            else
                            {
                                Land = AssementTD[2].Text + "~" + Land;
                            }
                        }
                    }
                    Land = Assessment_Year + "~" + Land.Replace("~-", "");
                    gc.insert_date(orderNumber, outparcelno, 365, Land, 1, DateTime.Now);
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    //CurrentTax details

                    driver.FindElement(By.LinkText("CURRENT TAXES")).Click();
                    Thread.Sleep(4000);
                    gc.CreatePdf(orderNumber, outparcelno, "CurretntTax Details", driver, "CA", "Contra Costa");

                    List <string> urlListSecured      = new List <string>();
                    List <string> urlListSupplemental = new List <string>();

                    IWebElement         CurrentTaxTB = driver.FindElement(By.XPath("//*[@id='results']/div[2]/table/tbody"));
                    IList <IWebElement> CurrentTaxTR = CurrentTaxTB.FindElements(By.TagName("tr"));
                    IList <IWebElement> CurrentTaxTD;
                    IList <IWebElement> CurrentTaxA;
                    foreach (IWebElement CurrentTax in CurrentTaxTR)
                    {
                        CurrentTaxTD = CurrentTax.FindElements(By.TagName("td"));
                        CurrentTaxA  = CurrentTax.FindElements(By.TagName("a"));
                        if (CurrentTaxTD.Count != 0)
                        {
                            Bill_Type   = CurrentTaxTD[0].Text;
                            Bill_SaleId = CurrentTaxTD[1].Text.Replace(" - View Bill", "").Trim();
                            Install_No  = CurrentTaxTD[2].Text;
                            Date_Due    = CurrentTaxTD[3].Text;
                            Amount      = CurrentTaxTD[4].Text;
                            try
                            {
                                Pay = CurrentTaxTD[5].Text;
                            }
                            catch { Pay = "PAY"; }

                            Currenttax_Details = Bill_Type + "~" + Bill_SaleId + "~" + Install_No + "~" + Date_Due + "~" + Amount + "~" + Pay + "~" + "-";
                            gc.insert_date(orderNumber, outparcelno, 366, Currenttax_Details, 1, DateTime.Now);
                        }
                        if (CurrentTaxA.Count != 0)
                        {
                            if (Bill_Type == "SECURED")
                            {
                                urlListSecured.Add(CurrentTaxA[0].GetAttribute("href"));
                            }
                            else if (Bill_Type == "SUPPLEMENTAL")
                            {
                                urlListSupplemental.Add(CurrentTaxA[0].GetAttribute("href"));
                            }
                        }
                    }
                    try
                    {
                        TotalAmountSelected_ToPay = driver.FindElement(By.XPath("//*[@id='summary']/div[2]/div[3]/h3")).Text;

                        Totaltax_Details = "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + TotalAmountSelected_ToPay;
                        gc.insert_date(orderNumber, outparcelno, 366, Totaltax_Details, 1, DateTime.Now);
                    }
                    catch
                    { }

                    //Download Tax Bills
                    try
                    {
                        int    i = 0;
                        String Parent_Window1 = driver.CurrentWindowHandle;
                        foreach (string item in urlListSecured)
                        {
                            gc.downloadfileHeader(item, orderNumber, outparcelno, "Secured_Bill" + i, "CA", "Contra Costa", driver);
                            i++;
                        }

                        int k = 0;
                        foreach (string item in urlListSupplemental)
                        {
                            gc.downloadfileHeader(item, orderNumber, outparcelno, "Supplemental_Bill" + k, "CA", "Contra Costa", driver);
                            k++;
                        }
                        System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                        driver.SwitchTo().Window(driver.WindowHandles.Last());
                        Thread.Sleep(4000);

                        driver.SwitchTo().Window(Parent_Window1);
                        Thread.Sleep(2000);
                    }
                    catch
                    { }
                    //TaxHistory Details
                    driver.FindElement(By.LinkText("TAX HISTORY")).Click();
                    Thread.Sleep(4000);
                    gc.CreatePdf(orderNumber, outparcelno, "TaxHistory Details", driver, "CA", "Contra Costa");

                    IWebElement         TaxHistoryTB = driver.FindElement(By.XPath("//*[@id='prioryear-results']/div[2]/table/tbody"));
                    IList <IWebElement> TaxHistoryTR = TaxHistoryTB.FindElements(By.TagName("tr"));
                    IList <IWebElement> TaxHistoryTD;

                    foreach (IWebElement TaxHistory in TaxHistoryTR)
                    {
                        TaxHistoryTD = TaxHistory.FindElements(By.TagName("td"));
                        if (TaxHistoryTD.Count != 0)
                        {
                            TaxBill_Type           = TaxHistoryTD[0].Text;
                            Tax_Year               = TaxHistoryTD[1].Text.Replace("View Bill", "\r\n").Trim();
                            Instal_No              = TaxHistoryTD[2].Text;
                            AdValorem_tax          = TaxHistoryTD[3].Text;
                            Special_Assessments    = TaxHistoryTD[4].Text;
                            Delinquent_PenaltyCost = TaxHistoryTD[5].Text;
                            TaxAmount              = TaxHistoryTD[6].Text;
                            Bill_Status            = TaxHistoryTD[7].Text;

                            TaxBillAmount_Details = TaxBill_Type + "~" + Tax_Year + "~" + Instal_No + "~" + AdValorem_tax + "~" + Special_Assessments + "~" + Delinquent_PenaltyCost + "~" + TaxAmount + "~" + Bill_Status;
                            gc.insert_date(orderNumber, outparcelno, 367, TaxBillAmount_Details, 1, DateTime.Now);
                        }
                    }
                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "CA", "Contra Costa", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    //megrge pdf files
                    gc.mergpdf(orderNumber, "CA", "Contra Costa");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw ex;
                }
            }
        }
        public string FTP_Summit(string Address, string account, string parcelNumber, string searchType, string orderNumber, string ownername, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            string ParcellNumber = "";
            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";
            var    driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())
            {
                string AlterNateID = "", PropertyAddress = "", LegalDescriptoin = "", YearBuilt = "";
                string Route = "", address = "", parcel = "", owner = "";
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");
                    if (searchType == "titleflex")
                    {
                        string straddress = Address + " " + account;
                        gc.TitleFlexSearch(orderNumber, "", "", straddress, "OH", "Summit");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_OHSummit"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "address")
                    {
                        driver.Navigate().GoToUrl("http://fiscaloffice.summitoh.net/index.php/property-tax-search");
                        Thread.Sleep(2000);
                        IWebElement iframeElement = driver.FindElement(By.XPath("//*[@id='blockrandom']"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement);
                        driver.FindElement(By.XPath("//*[@id='wrapper']/table/tbody/tr[3]/td/table/tbody/tr[4]/td[2]/input")).SendKeys(Address);
                        Thread.Sleep(2000);
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "OH", "Summit");

                        driver.FindElement(By.XPath("//*[@id='wrapper']/table/tbody/tr[3]/td/table/tbody/tr[6]/td/input[1]")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        gc.CreatePdf_WOP(orderNumber, "Address search Result", driver, "OH", "Summit");
                        Thread.Sleep(1000);
                        int multi = 0;
                        IList <IWebElement> Propertytable = driver.FindElements(By.XPath("/html/body/table[4]/tbody/tr"));
                        int rowcount = Propertytable.Count;
                        for (int i = 2; i <= rowcount; i++)
                        {
                            try
                            {
                                address = driver.FindElement(By.XPath("/html/body/table[4]/tbody/tr[" + i + "]/td[4]")).Text;

                                string ChkCondition = address;
                                var    ChkSplit     = ChkCondition.Split(' ');
                                ChkCondition = ChkSplit[0] + " " + ChkSplit[1];

                                IWebElement pa = driver.FindElement(By.XPath("/html/body/table[4]/tbody/tr[" + i + "]/td[2]/input"));
                                parcel  = pa.GetAttribute("value");
                                Route   = driver.FindElement(By.XPath("/html/body/table[4]/tbody/tr[" + i + "]/td[3]")).Text;
                                address = driver.FindElement(By.XPath("/html/body/table[4]/tbody/tr[" + i + "]/td[4]")).Text;
                                owner   = driver.FindElement(By.XPath("/html/body/table[4]/tbody/tr[" + i + "]/td[5]")).Text;

                                string multiparcedata = Route + "~" + address + "~" + owner;
                                gc.insert_date(orderNumber, parcel, 121, multiparcedata, 1, DateTime.Now);

                                if (address.Contains(ChkCondition.ToUpper()))
                                {
                                    multi++;
                                    pa.Click();
                                    break;
                                }

                                //if(multi!=1 && multi > 1)
                                // {
                                //    HttpContext.Current.Session["multiParcel_Summit"] = "Yes";
                                //    driver.Quit();
                                //    return "MultiParcel";
                                //}
                            }
                            catch { }
                        }
                    }

                    else if (searchType == "parcel")
                    {
                        driver.Navigate().GoToUrl("http://fiscaloffice.summitoh.net/index.php/property-tax-search");
                        Thread.Sleep(2000);
                        IWebElement iframeElement = driver.FindElement(By.XPath("//*[@id='blockrandom']"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement);
                        driver.FindElement(By.XPath("//*[@id='wrapper']/table/tbody/tr[3]/td/table/tbody/tr[2]/td[2]/input")).SendKeys(parcelNumber);
                        Thread.Sleep(2000);
                        gc.CreatePdf(orderNumber, parcelNumber, "M_Parcel Number Search", driver, "OH", "Summit");
                        //  gc.CreatePdf_WOP(orderNumber, "Parcel search",driver, "OH", "Summit");
                        driver.FindElement(By.XPath("//*[@id='wrapper']/table/tbody/tr[3]/td/table/tbody/tr[6]/td/input[1]")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);
                        gc.CreatePdf(orderNumber, parcelNumber, "M_Parcel Number Search", driver, "OH", "Summit");
                        try
                        {
                            IWebElement iframeElement3 = driver.FindElement(By.XPath("/html/frameset/frame[2]"));
                            driver.SwitchTo().Frame(iframeElement3);
                            owner            = driver.FindElement(By.XPath("/html/body/table/tbody/tr[9]/td[2]/font")).Text;
                            PropertyAddress  = driver.FindElement(By.XPath("/html/body/table/tbody/tr[11]/td[2]/font")).Text;
                            parcelNumber     = driver.FindElement(By.XPath("/html/body/table/tbody/tr[7]/td[2]/font")).Text;
                            AlterNateID      = driver.FindElement(By.XPath("/html/body/table/tbody/tr[8]/td[2]/font")).Text;
                            LegalDescriptoin = driver.FindElement(By.XPath("/html/body/table/tbody/tr[12]/td[2]/font")).Text;
                            YearBuilt        = driver.FindElement(By.XPath("/html/body/table/tbody/tr[25]/td[2]/font")).Text;
                            if (YearBuilt.Contains("\r\n"))
                            {
                                YearBuilt = "";
                            }
                            string PropertyDetail = AlterNateID + "~" + PropertyAddress + "~" + owner + "~" + LegalDescriptoin + "~" + YearBuilt.Replace("\r\n", "");


                            gc.insert_date(orderNumber, parcelNumber, 120, PropertyDetail, 1, DateTime.Now);
                        }
                        catch { }
                    }
                    else if (searchType == "ownername")
                    {
                        driver.Navigate().GoToUrl("http://fiscaloffice.summitoh.net/index.php/property-tax-search");
                        Thread.Sleep(2000);
                        IWebElement iframeElement = driver.FindElement(By.XPath("//*[@id='blockrandom']"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement);
                        driver.FindElement(By.XPath("//*[@id='wrapper']/table/tbody/tr[3]/td/table/tbody/tr[5]/td[2]/input")).SendKeys(ownername);
                        Thread.Sleep(2000);
                        gc.CreatePdf_WOP(orderNumber, "OwnerName search", driver, "OH", "Summit");

                        driver.FindElement(By.XPath("//*[@id='wrapper']/table/tbody/tr[3]/td/table/tbody/tr[6]/td/input[1]")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        gc.CreatePdf_WOP(orderNumber, "Ownername search Result", driver, "OH", "Summit");
                        Thread.Sleep(1000);
                        try
                        {
                            IWebElement iframeElement3 = driver.FindElement(By.XPath("/html/frameset/frame[2]"));
                            driver.SwitchTo().Frame(iframeElement3);
                            owner           = driver.FindElement(By.XPath("/html/body/table/tbody/tr[9]/td[2]/font")).Text;
                            PropertyAddress = driver.FindElement(By.XPath("/html/body/table/tbody/tr[11]/td[2]/font")).Text;
                            parcelNumber    = driver.FindElement(By.XPath("/html/body/table/tbody/tr[7]/td[2]/font")).Text;
                        }
                        catch
                        {
                        }

                        try
                        {
                            IWebElement         MultiOwnerTable = driver.FindElement(By.XPath("/html/body/table[4]"));
                            IList <IWebElement> MultiOwnerRow   = MultiOwnerTable.FindElements(By.TagName("tr"));
                            IList <IWebElement> MultiOwnerTD;
                            int i = 2;
                            //string AlterNateID = "", PropertyAddress = "", LegalDescriptoin = "", YearBuilt = "";
                            foreach (IWebElement row1 in MultiOwnerRow)
                            {
                                string ChkMulti = driver.FindElement(By.XPath("/html/body/table[3]/tbody/tr/th")).Text;
                                ChkMulti = WebDriverTest.After(ChkMulti, "New Search");
                                ChkMulti = ChkMulti.Replace("\r\n", "");


                                if (ChkMulti == "1 Records Found")
                                {
                                    driver.FindElement(By.XPath("/html/body/table[4]/tbody/tr[" + i + "]/td[2]/input")).SendKeys(Keys.Enter);
                                    Thread.Sleep(3000);
                                    iframeElement = driver.FindElement(By.XPath("/html/frameset/frame[2]"));

                                    driver.SwitchTo().Frame(iframeElement);

                                    parcelNumber     = driver.FindElement(By.XPath("/html/body/table/tbody/tr[7]/td[2]/font")).Text;
                                    AlterNateID      = driver.FindElement(By.XPath("/html/body/table/tbody/tr[8]/td[2]/font")).Text;
                                    PropertyAddress  = driver.FindElement(By.XPath("/html/body/table/tbody/tr[11]/td[2]/font")).Text;
                                    LegalDescriptoin = driver.FindElement(By.XPath("/html/body/table/tbody/tr[12]/td[2]/font")).Text;
                                    YearBuilt        = driver.FindElement(By.XPath("/html/body/table/tbody/tr[25]/td[2]/font")).Text;
                                    owner            = driver.FindElement(By.XPath("/html/body/table/tbody/tr[9]/td[2]/font")).Text;
                                    string PropertyDetail = AlterNateID + "~" + PropertyAddress + "~" + owner + "~" + LegalDescriptoin + "~" + YearBuilt;

                                    gc.insert_date(orderNumber, parcelNumber, 120, PropertyDetail, 1, DateTime.Now);

                                    break;
                                }
                                else
                                {
                                    try
                                    {
                                        IWebElement pa = driver.FindElement(By.XPath("/html/body/table[4]/tbody/tr[" + i + "]/td[2]/input"));
                                        parcel  = pa.GetAttribute("value");
                                        Route   = driver.FindElement(By.XPath("/html/body/table[4]/tbody/tr[" + i + "]/td[3]")).Text;
                                        address = driver.FindElement(By.XPath("/html/body/table[4]/tbody/tr[" + i + "]/td[4]")).Text;
                                        owner   = driver.FindElement(By.XPath("/html/body/table[4]/tbody/tr[" + i + "]/td[5]")).Text;

                                        string multiparcedata = Route + "~" + address + "~" + owner;
                                        gc.insert_date(orderNumber, parcel, 121, multiparcedata, 1, DateTime.Now);
                                        i++;
                                    }
                                    catch
                                    {
                                        HttpContext.Current.Session["multiParcel_Summit"] = "Yes";
                                        driver.Quit();
                                        return("MultiParcel");
                                    }
                                }
                            }
                        }
                        catch { }
                    }

                    try
                    {
                        IWebElement INodata = driver.FindElement(By.XPath("/html/body/center/font"));
                        if (INodata.Text.Contains("No records"))
                        {
                            HttpContext.Current.Session["Nodata_OHSummit"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }


                    if (searchType == "address")
                    {
                        IWebElement iframeElement3 = driver.FindElement(By.XPath("/html/frameset/frame[2]"));
                        driver.SwitchTo().Frame(iframeElement3);
                        owner            = driver.FindElement(By.XPath("/html/body/table/tbody/tr[9]/td[2]/font")).Text;
                        PropertyAddress  = driver.FindElement(By.XPath("/html/body/table/tbody/tr[11]/td[2]/font")).Text;
                        parcelNumber     = driver.FindElement(By.XPath("/html/body/table/tbody/tr[7]/td[2]/font")).Text;
                        AlterNateID      = driver.FindElement(By.XPath("/html/body/table/tbody/tr[8]/td[2]/font")).Text;
                        LegalDescriptoin = driver.FindElement(By.XPath("/html/body/table/tbody/tr[12]/td[2]/font")).Text;
                        YearBuilt        = driver.FindElement(By.XPath("/html/body/table/tbody/tr[25]/td[2]/font")).Text;
                        if (YearBuilt.Contains("\r\n"))
                        {
                            YearBuilt = "";
                        }
                        string PropertyDetail = AlterNateID + "~" + PropertyAddress + "~" + owner + "~" + LegalDescriptoin + "~" + YearBuilt.Replace("\r\n", "");


                        gc.insert_date(orderNumber, parcelNumber, 120, PropertyDetail, 1, DateTime.Now);
                    }
                    gc.CreatePdf(orderNumber, parcelNumber, "Property Detail", driver, "OH", "Summit");

                    driver.SwitchTo().DefaultContent();
                    IWebElement Iframe = driver.FindElement(By.XPath("/html/frameset/frame[2]"));
                    driver.SwitchTo().Frame(Iframe);
                    string Year = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/font[2]/b")).Text;

                    Year = WebDriverTest.After(Year, "Tax Year ");
                    string Land = "";

                    string Building = "";

                    string Total                = "";
                    string AssessedLand         = "";
                    string AssessedBuilding     = "";
                    string AssessedTotal        = "";
                    string Homestead            = "";
                    string OwnerOccupancyCredit = "";
                    string Ok              = "";
                    int    Increment       = 0;
                    int    IncrementSecond = 0;

                    IWebElement         AssessedTable = driver.FindElement(By.XPath("/html/body/table"));
                    IList <IWebElement> AssessedRow   = AssessedTable.FindElements(By.TagName("tr"));
                    IList <IWebElement> TDAss;
                    foreach (IWebElement row1 in AssessedRow)
                    {
                        TDAss = row1.FindElements(By.TagName("td"));
                        if (Ok == "Allowed" && Increment == 0)
                        {
                            Land     = TDAss[1].Text.ToString();
                            Building = TDAss[4].Text.ToString();
                            Total    = TDAss[7].Text.ToString();
                            Increment++;
                        }
                        else if (Ok == "Allowed" && Increment == 1)
                        {
                            AssessedLand     = TDAss[1].Text.ToString();
                            AssessedBuilding = TDAss[4].Text.ToString();
                            AssessedTotal    = TDAss[7].Text.ToString();

                            Increment++;
                        }
                        else if (Ok == "Allowed Second" && IncrementSecond == 0 || IncrementSecond == 1)
                        {
                            IncrementSecond++;
                        }
                        else if (Ok == "Allowed Second" && IncrementSecond == 2)
                        {
                            Homestead = TDAss[1].Text.ToString();
                            IncrementSecond++;
                        }
                        else if (Ok == "Allowed Second" && IncrementSecond == 3)
                        {
                            OwnerOccupancyCredit = TDAss[1].Text.ToString();
                            IncrementSecond++;
                        }
                        if (IncrementSecond == 4)
                        {
                            break;
                        }

                        if (row1.Text.Contains("SUMMARY ALL CARDS FOR PARCEL " + parcelNumber.Replace("-", "")))
                        {
                            Ok = "Allowed";
                        }

                        if (row1.Text.Contains(Year + " SUMMARY INFORMATION FOR PARCEL " + parcelNumber.Replace("-", "")))
                        {
                            Ok = "Allowed Second";
                        }
                    }
                    string AssessmentData = Year + "~" + Land + "~" + Building + "~" + Total + "~" + AssessedLand + "~" + AssessedBuilding + "~" + AssessedTotal + "~" + Homestead + "~" + OwnerOccupancyCredit;
                    gc.insert_date(orderNumber, parcelNumber, 124, AssessmentData, 1, DateTime.Now);
                    //driver.FindElement(By.LinkText("Tax Info")).SendKeys(Keys.Enter);

                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    driver.SwitchTo().DefaultContent();
                    IWebElement iframeElement1 = driver.FindElement(By.XPath("/html/frameset/frame[1]"));
                    driver.SwitchTo().Frame(iframeElement1);
                    IWebElement         ISpan1 = driver.FindElement(By.XPath("/html/body/table/tbody/tr[6]/td/a"));
                    IJavaScriptExecutor js1    = driver as IJavaScriptExecutor;
                    js1.ExecuteScript("arguments[0].click();", ISpan1);
                    Thread.Sleep(2000);
                    driver.SwitchTo().DefaultContent();
                    gc.CreatePdf(orderNumber, parcelNumber, "Tax Information", driver, "OH", "Summit");
                    IWebElement iframeElement2 = driver.FindElement(By.XPath("/html/frameset/frame[2]"));
                    driver.SwitchTo().Frame(iframeElement2);

                    string DeliqTax = "", Adjustment = "", DecemberIntrest = "", AugustInterest = "", TaxTotal = "", RealEstate = "", SpecialAssessment = "", TotalPaid = "", PaidAmount = "", TotalDue = "", M03StreetLightSweeping = "", DeliqTax2nd = "", Adjustment2nd = "", DecemberIntrest2nd = "", AugustInterest2nd = "", TaxTotal2nd = "", RealEstate2nd = "", SpecialAssessment2nd = "", TotalPaid2nd = "", PaidAmount2nd = "", TotalDue2nd = "", M03StreetLightSweeping2nd = "", Adjustment_NonDeliq = "", Adjustment_NonDeliq2nd = "", TotalNondeliq = "", TotalNondeliq2nd, Paymentdate = "", Paymentdate2nd = "";

                    DeliqTax               = driver.FindElement(By.XPath("/html/body/table/tbody/tr[34]/td[2]/font")).Text;
                    DeliqTax2nd            = "_";
                    Adjustment             = driver.FindElement(By.XPath("/html/body/table/tbody/tr[35]/td[2]/font")).Text;
                    Adjustment2nd          = "_";
                    DecemberIntrest        = driver.FindElement(By.XPath("/html/body/table/tbody/tr[36]/td[2]/font")).Text;
                    DecemberIntrest2nd     = "_";
                    AugustInterest         = driver.FindElement(By.XPath("/html/body/table/tbody/tr[37]/td[2]/font")).Text;
                    AugustInterest2nd      = "_";
                    TaxTotal               = driver.FindElement(By.XPath("/html/body/table/tbody/tr[38]/td[2]/font/b")).Text;
                    TaxTotal2nd            = "_";
                    RealEstate             = driver.FindElement(By.XPath("/html/body/table/tbody/tr[40]/td[2]/font")).Text;
                    RealEstate2nd          = driver.FindElement(By.XPath("/html/body/table/tbody/tr[40]/td[3]/font")).Text;
                    SpecialAssessment      = driver.FindElement(By.XPath("/html/body/table/tbody/tr[40]/td[2]/font")).Text;
                    SpecialAssessment2nd   = driver.FindElement(By.XPath("/html/body/table/tbody/tr[41]/td[3]/font")).Text;
                    Adjustment_NonDeliq    = driver.FindElement(By.XPath("/html/body/table/tbody/tr[42]/td[2]/font")).Text;
                    Adjustment_NonDeliq2nd = driver.FindElement(By.XPath("/html/body/table/tbody/tr[42]/td[3]/font")).Text;
                    try
                    {
                        TotalPaid        = driver.FindElement(By.XPath("/html/body/table/tbody/tr[49]/td[2]/font")).Text;
                        TotalPaid2nd     = driver.FindElement(By.XPath("/html/body/table/tbody/tr[49]/td[3]/font/b")).Text;
                        TotalNondeliq    = driver.FindElement(By.XPath("/html/body/table/tbody/tr[43]/td[2]/font/b")).Text;
                        TotalNondeliq2nd = driver.FindElement(By.XPath("/html/body/table/tbody/tr[43]/td[3]/font/b")).Text;

                        Paymentdate               = driver.FindElement(By.XPath("/html/body/table/tbody/tr[46]/td[1]/font")).Text + "&" + driver.FindElement(By.XPath("/html/body/table/tbody/tr[47]/td[1]/font")).Text;
                        Paymentdate2nd            = "_";
                        PaidAmount                = driver.FindElement(By.XPath("/html/body/table/tbody/tr[46]/td[3]/font")).Text + "&" + driver.FindElement(By.XPath("/html/body/table/tbody/tr[47]/td[3]/font")).Text;
                        PaidAmount2nd             = "_";
                        M03StreetLightSweeping    = driver.FindElement(By.XPath("/html/body/table/tbody/tr[55]/td[5]/font")).Text;
                        M03StreetLightSweeping2nd = driver.FindElement(By.XPath("/html/body/table/tbody/tr[55]/td[6]/font")).Text;
                    }
                    catch
                    {
                    }
                    try
                    {
                        TotalPaid        = driver.FindElement(By.XPath("/html/body/table/tbody/tr[48]/td[2]/font")).Text;
                        TotalPaid2nd     = driver.FindElement(By.XPath("/html/body/table/tbody/tr[48]/td[3]/font/b")).Text;
                        TotalNondeliq    = driver.FindElement(By.XPath("/html/body/table/tbody/tr[43]/td[2]/font/b")).Text;
                        TotalNondeliq2nd = driver.FindElement(By.XPath("/html/body/table/tbody/tr[43]/td[3]/font/b")).Text;

                        Paymentdate               = driver.FindElement(By.XPath("/html/body/table/tbody/tr[46]/td[1]/font")).Text;
                        Paymentdate2nd            = "_";
                        PaidAmount                = driver.FindElement(By.XPath("/html/body/table/tbody/tr[46]/td[3]/font")).Text;
                        PaidAmount2nd             = "_";
                        M03StreetLightSweeping    = driver.FindElement(By.XPath("/html/body/table/tbody/tr[54]/td[5]/font")).Text;
                        M03StreetLightSweeping2nd = driver.FindElement(By.XPath("/html/body/table/tbody/tr[54]/td[6]/font")).Text;
                    }
                    catch
                    {
                    }
                    try
                    {
                        M03StreetLightSweeping    = "";
                        M03StreetLightSweeping2nd = "";
                    }
                    catch
                    { }
                    IWebElement         TaxInfotable = driver.FindElement(By.XPath("/html/body/table/tbody"));
                    IList <IWebElement> TaxInfotRow  = TaxInfotable.FindElements(By.TagName("tr"));
                    IList <IWebElement> TDTax;

                    foreach (IWebElement row1 in TaxInfotRow)
                    {
                        TDTax = row1.FindElements(By.TagName("td"));
                        if (TDTax[0].Text == "FH/SH AMOUNT DUE:")
                        {
                            TotalDue    = TDTax[1].Text;
                            TotalDue2nd = TDTax[2].Text;
                            break;
                        }
                    }



                    address = PropertyAddress;

                    string TaxInformation1           = owner + "~" + address + "~" + Year + "~" + "1st Half" + "~" + DeliqTax + "~" + Adjustment + "~" + DecemberIntrest + "~" + AugustInterest + "~" + TaxTotal + "~" + RealEstate + "~" + SpecialAssessment + "~" + Adjustment_NonDeliq + "~" + TotalNondeliq + "~" + Paymentdate.Replace("\r\n", "") + "~" + PaidAmount.Replace("\r\n", "") + "~" + TotalPaid + "~" + TotalDue + "~" + M03StreetLightSweeping;
                    string TaxInformation2           = owner + "~" + address + "~" + Year + "~" + "2nd Half" + "~" + DeliqTax2nd + "~" + Adjustment2nd + "~" + DecemberIntrest2nd + "~" + AugustInterest2nd + "~" + TaxTotal2nd + "~" + RealEstate2nd + "~" + SpecialAssessment2nd + "~" + Adjustment_NonDeliq2nd + "~" + TotalNondeliq + "~" + Paymentdate2nd.Replace("\r\n", "") + "~" + PaidAmount2nd.Replace("\r\n", "") + "~" + TotalPaid2nd + "~" + TotalDue2nd + "~" + M03StreetLightSweeping2nd;
                    gc.insert_date(orderNumber, parcelNumber, 130, TaxInformation1, 1, DateTime.Now);
                    gc.insert_date(orderNumber, parcelNumber, 130, TaxInformation2, 1, DateTime.Now);



                    var    split1 = TaxInformation1.Split('~');
                    var    split2 = TaxInformation2.Split('~');
                    string TaxDisDate = "", Settle = "", ProjNumber = "", ActionorCode = "", FisrtHalf = "", Secondhalf = "", Allowed = "";
                    foreach (IWebElement row1 in TaxInfotRow)
                    {
                        int I = 0;
                        TDTax = row1.FindElements(By.TagName("td"));
                        //if (TDTax[0].Text == "2017 TAX BILL DETAILS FOR PARCEL " + parcelNumber.Replace("-", "") || Allowed == "OK")
                        //{
                        //    if (TDTax[0].Text.Contains("TAX BILL DETAILS FOR PARCEL "))

                        //    {

                        //    }
                        //        Allowed = "OK";
                        //    if (TDTax[0].Text.Trim() != "DATE" && TDTax[0].Text != "2017 TAX BILL DETAILS FOR PARCEL " + parcelNumber.Replace("-", ""))
                        //    {
                        if (TDTax[0].Text.Contains("TAX BILL DETAILS FOR PARCEL ") || Allowed == "OK")

                        {
                            Allowed = "OK";
                            if (TDTax[0].Text.Trim() != "DATE" && !row1.Text.Contains("TAX BILL DETAILS FOR PARCEL"))
                            {
                                TaxDisDate   = TDTax[0].Text;
                                Settle       = TDTax[1].Text;
                                ProjNumber   = TDTax[2].Text;
                                ActionorCode = TDTax[3].Text;
                                FisrtHalf    = TDTax[4].Text;
                                Secondhalf   = TDTax[5].Text;
                                string[] stringSeparators = new string[] { "\r\n" };

                                string[] lines = TaxDisDate.Split(stringSeparators, StringSplitOptions.None);

                                string[] lines2 = Settle.Split(stringSeparators, StringSplitOptions.None);
                                string[] lines3 = ProjNumber.Split(stringSeparators, StringSplitOptions.None);
                                string[] lines4 = ActionorCode.Split(stringSeparators, StringSplitOptions.None);
                                string[] lines5 = FisrtHalf.Split(stringSeparators, StringSplitOptions.None);
                                string[] lines6 = Secondhalf.Split(stringSeparators, StringSplitOptions.None);

                                foreach (var item in lines)
                                {
                                    TaxDisDate = lines[I];
                                    try
                                    { Settle = lines2[I]; }
                                    catch { Settle = ""; }
                                    try
                                    { ProjNumber = lines3[I]; }
                                    catch
                                    { ProjNumber = ""; }

                                    ActionorCode = lines4[I];
                                    FisrtHalf    = lines5[I];
                                    Secondhalf   = lines6[I];
                                    string TaxDistributiondata = TaxDisDate + "~" + Settle + "~" + ProjNumber + "~" + ActionorCode + "~" + FisrtHalf + "~" + Secondhalf;
                                    gc.insert_date(orderNumber, parcelNumber, 132, TaxDistributiondata, 1, DateTime.Now);
                                    I++;
                                }

                                Allowed = "";
                            }
                        }
                        if (TDTax[0].Text == "DELQ REAL ESTATE & ASSESSMENT TAX:")
                        {
                            break;
                        }
                    }
                    string LUC = "", Class = "", OwnerOccupancycretit = "", FlagHomestead = "", CAUV = "", Forest = "", stub = "", Certyear = "", DeloqContract = "", Bankruptcy = "";

                    LUC   = driver.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td[3]/font")).Text;
                    Class = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/font")).Text;
                    OwnerOccupancycretit = driver.FindElement(By.XPath("/html/body/table/tbody/tr[5]/td[2]/font")).Text;
                    FlagHomestead        = driver.FindElement(By.XPath("/html/body/table/tbody/tr[6]/td[2]/font")).Text;
                    CAUV          = driver.FindElement(By.XPath("/html/body/table/tbody/tr[7]/td[5]/font")).Text;
                    Forest        = driver.FindElement(By.XPath("/html/body/table/tbody/tr[8]/td[5]/font")).Text;
                    stub          = driver.FindElement(By.XPath("/html/body/table/tbody/tr[9]/td[5]/font")).Text;
                    Certyear      = driver.FindElement(By.XPath("/html/body/table/tbody/tr[10]/td[5]/font")).Text;
                    DeloqContract = driver.FindElement(By.XPath("/html/body/table/tbody/tr[11]/td[5]/font")).Text;
                    Bankruptcy    = driver.FindElement(By.XPath("/html/body/table/tbody/tr[12]/td[5]/font")).Text;

                    string FlagDetail = LUC + "~" + Class + "~" + OwnerOccupancycretit + "~" + FlagHomestead + "~" + CAUV + "~" + Forest + "~" + stub + "~" + Certyear + "~" + DeloqContract + "~" + Bankruptcy;
                    gc.insert_date(orderNumber, parcelNumber, 133, FlagDetail, 1, DateTime.Now);
                    driver.SwitchTo().DefaultContent();

                    driver.SwitchTo().Frame(iframeElement1);
                    try
                    {
                        ISpan1 = driver.FindElement(By.XPath("/html/body/table/tbody/tr[15]/td/a"));
                    }
                    catch { }
                    try
                    {
                        if (ISpan1.Text.Trim() == "")
                        {
                            ISpan1 = driver.FindElement(By.XPath("/html/body/table/tbody/tr[16]/td/a"));
                        }
                    }
                    catch { }
                    js1.ExecuteScript("arguments[0].click();", ISpan1);
                    Thread.Sleep(2000);
                    gc.CreatePdf(orderNumber, parcelNumber, "Tax History", driver, "OH", "Summit");
                    string InstallmetTaxhis = "", Taxyear = "", taxAmount = "", Payment = "", TaxDue = "", taxAmount2nd = "", Payment2nd = "", TaxDue2nd = "";
                    driver.SwitchTo().DefaultContent();
                    driver.SwitchTo().Frame(iframeElement2);

                    IWebElement         TaxHistoryBody  = driver.FindElement(By.XPath("/html/body"));
                    IList <IWebElement> TaxHistoryTable = TaxHistoryBody.FindElements(By.TagName("table"));
                    IList <IWebElement> TDtaxhistory;
                    int j = 3;
                    foreach (IWebElement row1 in TaxHistoryTable)
                    {
                        try
                        {
                            Taxyear   = driver.FindElement(By.XPath("/html/body/table[" + j + "]/tbody/tr[2]/td[1]")).Text;
                            taxAmount = driver.FindElement(By.XPath("/html/body/table[" + j + "]/tbody/tr[3]/td[2]")).Text;

                            taxAmount2nd = driver.FindElement(By.XPath("/html/body/table[" + j + "]/tbody/tr[3]/td[3]")).Text;
                            Payment      = driver.FindElement(By.XPath("/html/body/table[" + j + "]/tbody/tr[4]/td[2]")).Text;
                            Payment2nd   = driver.FindElement(By.XPath("/html/body/table[" + j + "]/tbody/tr[4]/td[3]")).Text;
                            TaxDue       = driver.FindElement(By.XPath("/html/body/table[" + j + "]/tbody/tr[5]/td[2]/font")).Text;
                            TaxDue2nd    = driver.FindElement(By.XPath("/html/body/table[" + j + "]/tbody/tr[5]/td[3]/font")).Text;

                            string TaxHistoryData1 = "1St Half" + "~" + Taxyear + "~" + taxAmount + "~" + Payment + "~" + TaxDue;
                            string TaxHistoryData2 = "2nd Half" + "~" + Taxyear + "~" + taxAmount2nd + "~" + Payment2nd + "~" + TaxDue2nd;
                            gc.insert_date(orderNumber, parcelNumber, 134, TaxHistoryData1, 1, DateTime.Now);
                            gc.insert_date(orderNumber, parcelNumber, 134, TaxHistoryData2, 1, DateTime.Now);
                            j++;
                        }
                        catch
                        {
                            break;
                        }
                    }
                    string TaxpayPaiddate = "", Taxpaytaxamount = "", Type = "", Bseq = "";
                    driver.SwitchTo().DefaultContent();

                    driver.SwitchTo().Frame(iframeElement1);
                    try
                    {
                        ISpan1 = driver.FindElement(By.LinkText("PAYMENTS"));
                    }
                    catch { }
                    try
                    {
                        if (ISpan1.Text == "" && ISpan1.Text.Contains("Payments"))
                        {
                            ISpan1 = driver.FindElement(By.LinkText("Payments"));
                        }
                    }
                    catch { }
                    //string CHK = driver.FindElement(By.XPath("/html/body/table/tbody/tr[16]/td/a")).Text;
                    //string CHK1 = driver.FindElement(By.XPath("/html/body/table/tbody/tr[17]/td/a")).Text;
                    //try
                    //{
                    //    if (CHK.Contains("Payments"))
                    //    { ISpan1 = driver.FindElement(By.XPath("/html/body/table/tbody/tr[16]/td/a")); }

                    //}
                    //catch { }
                    //try
                    //{

                    //        if (CHK1.Contains("PAYMENTS"))
                    //        {
                    //            ISpan1 = driver.FindElement(By.XPath("/html/body/table/tbody/tr[17]/td/a"));
                    //        }


                    //}
                    //catch { }
                    js1.ExecuteScript("arguments[0].click();", ISpan1);
                    Thread.Sleep(3000);
                    gc.CreatePdf(orderNumber, parcelNumber, "Payment Deatil", driver, "OH", "Summit");
                    driver.SwitchTo().DefaultContent();
                    driver.SwitchTo().Frame(iframeElement2);

                    IWebElement         TaxPayMenttable = driver.FindElement(By.XPath("/html/body/table[3]/tbody"));
                    IList <IWebElement> TaxpaymentTR    = TaxPayMenttable.FindElements(By.TagName("tr"));
                    IList <IWebElement> TaxPaymentTD;

                    foreach (IWebElement row1 in TaxpaymentTR)
                    {
                        TaxPaymentTD = row1.FindElements(By.TagName("td"));
                        if (TaxPaymentTD.Count != 0)
                        {
                            TaxpayPaiddate  = TaxPaymentTD[0].Text;
                            Taxpaytaxamount = TaxPaymentTD[1].Text;
                            Type            = TaxPaymentTD[2].Text;
                            Bseq            = TaxPaymentTD[3].Text;
                            string TaxPayment = TaxpayPaiddate + "~" + Taxpaytaxamount + "~" + Type + "~" + Bseq;

                            gc.insert_date(orderNumber, parcelNumber, 136, TaxPayment, 1, DateTime.Now);
                        }
                    }
                    driver.SwitchTo().DefaultContent();

                    driver.SwitchTo().Frame(iframeElement1);



                    String Parent_Window = driver.CurrentWindowHandle;

                    IWebElement view = driver.FindElement(By.XPath("/html/body/table/tbody/tr[7]/td/a"));



                    string url = view.GetAttribute("href");
                    //string billpdf = outputPath + "Tax_bill.pdf";
                    //System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                    //WebClient downloadpdf = new WebClient();
                    //downloadpdf.DownloadFile(url, billpdf);
                    gc.downloadfile(url, orderNumber, parcelNumber, "Tax_bill.pdf", "OH", "Summit");


                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");

                    gc.insert_TakenTime(orderNumber, "OH", "Summit", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);


                    driver.Quit();
                    gc.mergpdf(orderNumber, "OH", "Summit");
                    return("Data Inserted Successfully");
                }

                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw ex;
                }
            }
        }
Example #20
0
        public string FTP_NapaCA(string address, string assessment_id, string parcelNumber, string searchType, string orderNumber, string directParcel, string ownername)
        {
            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "", AssessTakenTime = "", TaxTakentime = "", CityTaxtakentime = "";
            string TotaltakenTime = "";

            List <string> strTaxRealestate1 = new List <string>();
            string        address1 = "", Assess = "", fee_parcel = "", Tra = "";
            string        Roll_Category = "", Address = "", Tax_year = "", First_Installment_Paid_Status = "", First_Installment_Paid_Date = "", First_Installment_Total_Due = "", First_Installment_Total_Paid = "", First_Installment_Balance = "", Second_Installment_Paid_Status = "", Second_Installment_Paid_Date = "", Second_Installment_Total_Due = "", Second_Installment_Total_Paid = "", Second_Installment_Balance = "", FirstandSecondInstallment_Total_Due = "", FirstandSecondInstallment_Total_Paid = "", FirstandSecondInstallment_Total_Balance = "";
            string        Assessor_ID_Number = "", Tax_Rate_Area = "";
            string        Default_Number = "", Pay_Plan_in_Effect = "", Annual_Payment = "", Balance = "";

            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            // new PhantomJSDriver()
            using (driver = new PhantomJSDriver())
            {
                //  driver = new ChromeDriver();

                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");
                    driver.Navigate().GoToUrl("https://www.countyofnapa.org/150/Assessor-Parcel-Data");
                    //Thread.Sleep(4000);
                    IWebElement iframeElement = driver.FindElement(By.XPath("//*[@id='ctl00_MasterContentPlaceHolder_ContentiFrame']"));
                    driver.SwitchTo().Frame(iframeElement);
                    Thread.Sleep(2000);
                    if (searchType == "titleflex")
                    {
                        gc.TitleFlexSearch(orderNumber, "", ownername, address, "CA", "Napa");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }
                    if (searchType == "address")
                    {
                        //var Select = driver.FindElement(By.Id("idSitus"));
                        //var selectElement1 = new SelectElement(Select);
                        //selectElement1.SelectByText("Begins with");
                        //IWebElement text = driver.FindElement(By.Name("idSitus"));
                        //IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
                        //js.ExecuteScript("document.getElementById('idSitus').value='" + address + "'");
                        driver.FindElement(By.Name("idSitus")).SendKeys(address);
                        // driver.FindElement(By.XPath("/html/body/form/table/tbody/tr[5]/td[3]/input")).SendKeys(address);
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "CA", "Napa");
                        driver.FindElement(By.Name("Submit")).SendKeys(Keys.Enter);
                        gc.CreatePdf_WOP(orderNumber, "Address search result", driver, "CA", "Napa");
                        Thread.Sleep(6000);
                        try
                        {
                            IWebElement         tbmulti = driver.FindElement(By.XPath("/html/body/form/table/tbody/tr[2]/td[1]/a"));
                            IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                            int maxCheck = 0;
                            if (TRmulti.Count > 6)
                            {
                                IList <IWebElement> TDmulti;
                                foreach (IWebElement row in TRmulti)
                                {
                                    if (maxCheck <= 25)
                                    {
                                        if (!row.Text.Contains("Assessment No."))
                                        {
                                            TDmulti = row.FindElements(By.TagName("td"));
                                            if (TDmulti.Count == 3 && TDmulti[0].Text.Trim() != "")
                                            {
                                                Assess     = TDmulti[0].Text;
                                                fee_parcel = TDmulti[1].Text;
                                                Tra        = TDmulti[2].Text;
                                            }
                                            if (TDmulti.Count == 1 && TDmulti[0].Text.Trim() != "")
                                            {
                                                address1 = TDmulti[0].Text;
                                                string multi1 = Assess + "~" + Tra + "~" + address1;
                                                gc.insert_date(orderNumber, fee_parcel, 1238, multi1, 1, DateTime.Now);
                                                //Assessment Id~Tra~Address
                                            }
                                        }
                                        maxCheck++;
                                    }
                                }

                                if (TRmulti.Count > 25)
                                {
                                    HttpContext.Current.Session["multiParcel_CANapa_Multicount"] = "Maximum";
                                }
                                else
                                {
                                    HttpContext.Current.Session["multiparcel_CANapa"] = "Yes";
                                }
                                driver.Quit();
                                gc.mergpdf(orderNumber, "CA", "Napa");
                                return("MultiParcel");
                            }
                        }
                        catch { }
                    }
                    else if (searchType == "parcel")
                    {
                        var Select         = driver.FindElement(By.Id("idfeeparcel"));
                        var selectElement1 = new SelectElement(Select);
                        selectElement1.SelectByText("Begins with");
                        if (parcelNumber.Contains("-"))
                        {
                            parcelNumber = parcelNumber.Replace("-", "");
                        }
                        string a = parcelNumber.Substring(0, 3);
                        string b = parcelNumber.Substring(3, 3);
                        string c = parcelNumber.Substring(6, 3);
                        string d = "";
                        if (parcelNumber.Length == 12)
                        {
                            d = parcelNumber.Substring(9, 3);
                        }
                        parcelNumber = a + "-" + b + "-" + c + "-" + d;
                        driver.FindElement(By.XPath("/html/body/form/table/tbody/tr[3]/td[3]/input")).SendKeys(parcelNumber.Trim());
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search", driver, "CA", "Napa");
                        driver.FindElement(By.XPath("/html/body/form/p/input[1]")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);
                    }
                    // /html/body/form/table/tbody/tr[2]/td[1]/a
                    Thread.Sleep(2000);
                    try
                    {
                        IWebElement runButton = driver.FindElement(By.XPath("/html/body/form/table/tbody/tr[2]/td[1]/a"));
                        runButton.Click();
                        Thread.Sleep(4000);
                    }
                    catch { }
                    //property details
                    string Parcel_id = "", owner_name = "", ImprovementValue = "", totalValue = "", Bussiness_property = "";
                    string fulltabletext = driver.FindElement(By.XPath("/html/body/form/table/tbody")).Text.Trim();
                    // Parcel_id = gc.Between(fulltabletext, "Assessor Parcel Number (APN)", "Assessment Number").Trim();

                    Assessor_ID_Number = gc.Between(fulltabletext, "Assessor ID Number", "Tax Rate Area (TRA)").Trim();
                    Tax_Rate_Area      = gc.Between(fulltabletext, "Tax Rate Area (TRA)", "Last Recording Date").Trim();
                    pltitle.TaxIDNumberFurtherDescribed = Tax_Rate_Area;
                    //owner_name = gc.Between(fulltabletext, "Owner", "Lot Size").Trim();
                    gc.CreatePdf(orderNumber, Assessor_ID_Number, "Property details", driver, "CA", "Napa");
                    string prop = Assessor_ID_Number + "~" + Tax_Rate_Area + "~" + owner_name;
                    //  Assessment Number~Tax Rate Area~Owner Name
                    gc.insert_date(orderNumber, Assessor_ID_Number, 1233, prop, 1, DateTime.Now);

                    //Assessment details
                    string Land = "", Structural_Imprv = "", Fixtures_Real_Property = "", Growing_Imprv = "", TotalLandandImprovements = "", FixturesPersonalProperty = "", Personal_Property = "", ManufacturedHomes = "", Homeowners_Exemption = "", Other_Exemption = "", Acres = "", NetAssessedValue = "";
                    Land                     = gc.Between(fulltabletext, "Land", "Structural Imprv").Trim();
                    Structural_Imprv         = gc.Between(fulltabletext, "Structural Imprv", "Fixtures Real Property").Trim();
                    Fixtures_Real_Property   = gc.Between(fulltabletext, "Fixtures Real Property", "Growing Imprv").Trim();
                    Growing_Imprv            = gc.Between(fulltabletext, "Growing Imprv", "Total Land and Improvements").Trim();
                    TotalLandandImprovements = gc.Between(fulltabletext, "Total Land and Improvements", "Fixtures Personal Property").Trim();
                    FixturesPersonalProperty = gc.Between(fulltabletext, "Fixtures Personal Property", "\r\nPersonal Property").Trim();
                    Personal_Property        = gc.Between(fulltabletext, "\r\nPersonal Property", "Manufactured Homes").Trim();
                    ManufacturedHomes        = gc.Between(fulltabletext, "Manufactured Homes", "Homeowners Exemption").Trim();

                    Homeowners_Exemption = gc.Between(fulltabletext, "Homeowners Exemption", "Other Exemption").Trim();
                    string he = Homeowners_Exemption.Replace(",", "").Replace("$", "").Trim();
                    if (he == "")
                    {
                        pltitle.ExemptionHomeowners = null;
                    }
                    else
                    {
                        pltitle.ExemptionHomeowners = he;
                    }

                    Other_Exemption  = gc.Between(fulltabletext, "Other Exemption", "Net Assessed Value").Trim();
                    NetAssessedValue = gc.Between(fulltabletext, "Net Assessed Value", "Building Description(s)").Trim();
                    Acres            = gc.Between(fulltabletext, "Acres", "Lot Size(SqFt)");
                    string assess = Land + "~" + Structural_Imprv + "~" + Fixtures_Real_Property + "~" + Growing_Imprv + "~" + TotalLandandImprovements + "~" + FixturesPersonalProperty + "~" + Personal_Property + "~" + ManufacturedHomes + "~" + Homeowners_Exemption + "~" + Other_Exemption + "~" + NetAssessedValue + "~" + Acres;
                    gc.insert_date(orderNumber, Assessor_ID_Number, 1234, assess, 1, DateTime.Now);

                    // pltitle.TaxRateArea = Tax_Rate_Area.Trim();
                    pltitle.Land = Land.Replace(",", "").Replace("$", "").Trim();
                    if (pltitle.Land == "")
                    {
                        pltitle.Land = null;
                    }
                    pltitle.Improvements = Structural_Imprv.Replace(",", "").Replace("$", "").Trim();
                    if (pltitle.Improvements == "")
                    {
                        pltitle.Improvements = null;
                    }

                    // pltitle.TotalValue = TotalLandandImprovements.Replace(",", "").Replace("$", "").Trim();

                    //Land~Structural Imprv~Fixtures Real Property~Growing Imprv~Total Land and Improvements~Fixtures Personal Property~Personal Property~Manufactured Homes~Homeowners Exemption~Other Exemption~Net Assessed Value
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");
                    //Tax details
                    int lat = 0;
                    driver.Navigate().GoToUrl("https://common2.mptsweb.com/mbc/napa/tax/search/");
                    string Tax_Authority1 = driver.FindElement(By.XPath("//*[@id='footer']/div[1]/div/div[1]/div[2]/div/ul[1]")).Text;
                    string Tax_Authority  = GlobalClass.After(Tax_Authority1, "Treasurer - Tax Collector");
                    for (int k = 1; k < 4; k++)
                    {
                        if (k == 1)
                        {
                            //select year
                            var year           = driver.FindElement(By.Id("SelTaxYear"));
                            var selectElement1 = new SelectElement(year);
                            selectElement1.SelectByIndex(0);
                            //searchBy
                            var searchby       = driver.FindElement(By.Id("SearchVal"));
                            var selectElement2 = new SelectElement(searchby);
                            selectElement2.SelectByText("FEE PARCEL");
                            driver.FindElement(By.XPath("//*[@id='SearchValue']")).SendKeys(Assessor_ID_Number);
                            driver.FindElement(By.XPath("//*[@id='SearchSubmit']")).SendKeys(Keys.Enter);
                            Thread.Sleep(3000);
                            gc.CreatePdf(orderNumber, Assessor_ID_Number, "tax1", driver, "CA", "Napa");
                        }

                        else if (k == 2)
                        {
                            //select year
                            var year           = driver.FindElement(By.Id("SelTaxYear"));
                            var selectElement1 = new SelectElement(year);
                            selectElement1.SelectByIndex(1);
                            //searchBy
                            var searchby       = driver.FindElement(By.Id("SearchVal"));
                            var selectElement2 = new SelectElement(searchby);
                            selectElement2.SelectByText("FEE PARCEL");
                            driver.FindElement(By.XPath("//*[@id='SearchSubmit']")).SendKeys(Keys.Enter);
                            Thread.Sleep(3000);
                            gc.CreatePdf(orderNumber, Assessor_ID_Number, "tax2", driver, "CA", "Napa");
                        }

                        else if (k == 3)
                        {
                            //select year
                            var year           = driver.FindElement(By.Id("SelTaxYear"));
                            var selectElement1 = new SelectElement(year);
                            selectElement1.SelectByIndex(2);
                            //searchBy
                            var searchby       = driver.FindElement(By.Id("SearchVal"));
                            var selectElement2 = new SelectElement(searchby);
                            selectElement2.SelectByText("FEE PARCEL");
                            driver.FindElement(By.XPath("//*[@id='SearchSubmit']")).SendKeys(Keys.Enter);
                            Thread.Sleep(3000);
                            gc.CreatePdf(orderNumber, Assessor_ID_Number, "tax3", driver, "CA", "Napa");
                        }

                        int j;
                        //Current Tax Details Table
                        try
                        {
                            int divCount = driver.FindElements(By.XPath("//*[@id='ResultDiv']/div")).Count;
                            for (j = 1; j <= divCount; j++)
                            {
                                if (k != 1)
                                {
                                    IWebElement Itaxstmt = driver.FindElement(By.XPath("//*[@id='ResultDiv']/div[" + j + "]/div/div/div/a"));
                                    string      stmt1    = Itaxstmt.GetAttribute("href");
                                    strTaxRealestate1.Add(stmt1);
                                }
                                if (k == 1)
                                {
                                    IWebElement Itaxstmt = driver.FindElement(By.XPath("//*[@id='ResultDiv']/div[" + j + "]/div/div/div/a"));
                                    string      stmt1    = Itaxstmt.GetAttribute("href");
                                    strTaxRealestate1.Add(stmt1);
                                    lat++;
                                }
                            }
                        }
                        catch { }
                    }
                    int    q     = 0;
                    string pyear = "";
                    foreach (string real in strTaxRealestate1)
                    {
                        driver.Navigate().GoToUrl(real);
                        Thread.Sleep(4000);
                        string pdfassess        = driver.FindElement(By.XPath(" /html/body/div[2]/section/div/div/div/div[6]/div/div[1]/div[1]/div[2]")).Text;
                        string pdfyear          = driver.FindElement(By.XPath("/html/body/div[2]/section/div/div/div/div[6]/div/div[1]/div[3]/div[2]")).Text;
                        string Installmenttype1 = driver.FindElement(By.XPath("//*[@id='h2tab1']/div[1]/div[1]/h4")).Text;
                        string pdf = pdfassess + " " + pdfyear;
                        string fulltabletextTax1 = driver.FindElement(By.XPath("//*[@id='h2tab1']/div[1]/div[1]/dl")).Text.Trim().Replace("\r\n", "");
                        if (fulltabletextTax1.Contains("Delinq. Date"))
                        {
                            First_Installment_Paid_Status = gc.Between(fulltabletextTax1, "Paid Status", "Delinq. Date").Trim();
                            First_Installment_Paid_Date   = gc.Between(fulltabletextTax1, "Delinq. Date", "Total Due").Trim();
                        }
                        else
                        {
                            First_Installment_Paid_Status = gc.Between(fulltabletextTax1, "Paid Status", "Paid Date").Trim();
                            First_Installment_Paid_Date   = gc.Between(fulltabletextTax1, "Paid Date", "Total Due").Trim();
                        }
                        First_Installment_Total_Due  = gc.Between(fulltabletextTax1, "Total Due", "Total Paid").Trim();
                        First_Installment_Total_Paid = gc.Between(fulltabletextTax1, "Total Paid", "Balance").Trim();
                        First_Installment_Balance    = WebDriverTest.After(fulltabletextTax1, "Balance");
                        string installmenttype2  = driver.FindElement(By.XPath("//*[@id='h2tab1']/div[1]/div[2]/h4")).Text;
                        string fulltabletextTax2 = driver.FindElement(By.XPath("//*[@id='h2tab1']/div[1]/div[2]/dl")).Text.Trim().Replace("\r\n", "");
                        if (fulltabletextTax2.Contains("Delinq. Date"))
                        {
                            Second_Installment_Paid_Status = gc.Between(fulltabletextTax2, "Paid Status", "Delinq. Date").Trim();
                            Second_Installment_Paid_Date   = gc.Between(fulltabletextTax2, "Delinq. Date", "Total Due").Trim();
                        }
                        else
                        {
                            Second_Installment_Paid_Status = gc.Between(fulltabletextTax2, "Paid Status", "Paid Date").Trim();
                            Second_Installment_Paid_Date   = gc.Between(fulltabletextTax2, "Paid Date", "Total Due").Trim();
                        }
                        Second_Installment_Total_Due  = gc.Between(fulltabletextTax2, "Total Due", "Total Paid").Trim();
                        Second_Installment_Total_Paid = gc.Between(fulltabletextTax2, "Total Paid", "Balance").Trim();
                        Second_Installment_Balance    = WebDriverTest.After(fulltabletextTax2, "Balance");

                        string fulltabletextTax3 = driver.FindElement(By.XPath("//*[@id='h2tab1']/div[2]/dl")).Text.Trim().Replace("\r\n", "");
                        FirstandSecondInstallment_Total_Due     = gc.Between(fulltabletextTax3, "Total Due", "Total Paid").Trim();
                        FirstandSecondInstallment_Total_Paid    = gc.Between(fulltabletextTax3, "Total Paid", "Total Balance").Trim();
                        FirstandSecondInstallment_Total_Balance = WebDriverTest.After(fulltabletextTax3, "Total Balance");

                        gc.CreatePdf(orderNumber, Assessor_ID_Number, "Taxes" + q, driver, "CA", "Napa");
                        driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/ul/li[2]/a")).Click();
                        Thread.Sleep(3000);
                        gc.CreatePdf(orderNumber, Assessor_ID_Number, "Assess info" + q, driver, "CA", "Napa");
                        string fulltabletextTax4 = driver.FindElement(By.XPath("//*[@id='h2tab2']")).Text.Trim();
                        string assessment        = gc.Between(fulltabletextTax4, "Assessment", "Taxyear").Trim().Replace("\r\n", " ");
                        Tax_year      = gc.Between(fulltabletextTax4, "Taxyear", "Parcel Number").Trim().Replace("\r\n", " ");
                        Roll_Category = gc.Between(fulltabletextTax4, "Roll Category", "Doc Num").Trim().Replace("\r\n", " ");
                        string rollcasttype = GlobalClass.Before(Roll_Category, "-");
                        Address = WebDriverTest.After(fulltabletextTax4, "Address").Replace("\r\n", " ").Trim();
                        string tax = assessment + "~" + Roll_Category + "~" + Address + "~" + Tax_year + "~" + Installmenttype1 + "~" + First_Installment_Paid_Status + "~" + First_Installment_Paid_Date + "~" + First_Installment_Total_Due + "~" + First_Installment_Total_Paid + "~" + First_Installment_Balance + "~" + FirstandSecondInstallment_Total_Due + "~" + FirstandSecondInstallment_Total_Paid + "~" + FirstandSecondInstallment_Total_Balance + "~" + Tax_Authority;
                        gc.insert_date(orderNumber, Assessor_ID_Number, 1235, tax, 1, DateTime.Now);
                        string tax1 = assessment + "~" + Roll_Category + "~" + Address + "~" + Tax_year + "~" + installmenttype2 + "~" + Second_Installment_Paid_Status + "~" + Second_Installment_Paid_Date + "~" + Second_Installment_Total_Due + "~" + Second_Installment_Total_Paid + "~" + Second_Installment_Balance + "~" + FirstandSecondInstallment_Total_Due + "~" + FirstandSecondInstallment_Total_Paid + "~" + FirstandSecondInstallment_Total_Balance + "~" + Tax_Authority;
                        gc.insert_date(orderNumber, Assessor_ID_Number, 1235, tax1, 1, DateTime.Now);
                        if (Roll_Category.Contains("CS"))
                        {
                            pyear = Tax_year;
                        }

                        if (q < lat)
                        {
                            pltitle.TaxTypeID          = 1;
                            pltitle.TaxingEntity       = "TAX-IN32";
                            pltitle.TaxIDNumber        = Assessor_ID_Number;
                            pltitle.Year               = Convert.ToInt16(Tax_year);
                            pltitle.assyear            = Tax_year;
                            pltitle.FirstTaxesOutDate  = null;
                            pltitle.FirstDueDate       = null;
                            pltitle.FirstInstallment   = First_Installment_Total_Due.Replace(",", "").Replace("$", "").Trim();
                            pltitle.FirstPaid          = First_Installment_Total_Paid.Replace(",", "").Replace("$", "").Trim();
                            pltitle.FirstDue           = First_Installment_Balance.Replace(",", "").Replace("$", "").Trim();
                            pltitle.SecondTaxesOutDate = null;
                            pltitle.SecondDueDate      = null;
                            pltitle.SecondInstallment  = Second_Installment_Total_Due.Replace(",", "").Replace("$", "").Trim();
                            pltitle.SecondPaid         = Second_Installment_Total_Paid.Replace(",", "").Replace("$", "").Trim();
                            pltitle.SecondDue          = Second_Installment_Balance.Replace(",", "").Replace("$", "").Trim();

                            if (First_Installment_Total_Paid == "$0.00")
                            {
                                pltitle.FirstPaid = "False";
                            }
                            else
                            {
                                pltitle.FirstPaid = "True";
                            }

                            if (Second_Installment_Total_Paid == "$0.00")
                            {
                                pltitle.SecondPaid = "False";
                            }
                            else
                            {
                                pltitle.SecondPaid = "True";
                            }

                            if (First_Installment_Balance == "$0.00")
                            {
                                pltitle.FirstDue = "False";
                            }
                            else
                            {
                                pltitle.FirstDue = "True";
                            }

                            if (Second_Installment_Balance == "$0.00")
                            {
                                pltitle.SecondDue = "False";
                            }
                            else
                            {
                                pltitle.SecondDue = "True";
                            }


                            if (First_Installment_Paid_Status == "PAID")
                            {
                                if (First_Installment_Paid_Date == "")
                                {
                                    pltitle.FirstTaxesOutDate = null;
                                }
                                else
                                {
                                    pltitle.FirstTaxesOutDate = First_Installment_Paid_Date;
                                    pltitle.FirstDueDate      = null;
                                }
                            }
                            else if ((First_Installment_Paid_Status == "LATE") || (First_Installment_Paid_Status == "DUE"))
                            {
                                if (First_Installment_Paid_Date == "")
                                {
                                    pltitle.FirstDueDate = null;
                                }
                                else
                                {
                                    pltitle.FirstDueDate      = First_Installment_Paid_Date;
                                    pltitle.FirstTaxesOutDate = null;
                                }
                            }

                            if (Second_Installment_Paid_Status == "PAID")
                            {
                                if (Second_Installment_Paid_Date == "")
                                {
                                    pltitle.SecondTaxesOutDate = null;
                                }
                                else
                                {
                                    pltitle.SecondTaxesOutDate = Second_Installment_Paid_Date;
                                    pltitle.SecondDueDate      = null;
                                }
                            }
                            else if (Second_Installment_Paid_Status == "LATE" || Second_Installment_Paid_Status == "DUE")
                            {
                                if (Second_Installment_Paid_Date == "")
                                {
                                    pltitle.SecondDueDate = null;
                                }
                                else
                                {
                                    pltitle.SecondDueDate      = Second_Installment_Paid_Date;
                                    pltitle.SecondTaxesOutDate = null;
                                }
                            }
                        }

                        //Assessment~Roll Category~Address~Tax year~First Installment Paid Status~First Installment Paid Date~First Installment Total Due~First Installment Total Paid~First Installment Balance~Second Installment Paid Status~Second Installment Paid Date~Second Installment Total Due~Second Installment Total Paid~Second Installment Balance~First and Second Installment Total Due~First and Second Installment Total Paid~First and Second Installment Total Balance

                        //download taxbill
                        try
                        {
                            IWebElement Itaxbill = driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/div/div[1]/div[4]/div/a"));
                            string      URL1     = Itaxbill.GetAttribute("href");
                            gc.downloadfile(URL1, orderNumber, Assessor_ID_Number, "TaxBill" + q, "CA", "Napa");
                        }
                        catch { }
                        //Taxcode Info

                        driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/ul/li[3]/a")).Click();
                        Thread.Sleep(3000);
                        gc.CreatePdf(orderNumber, Assessor_ID_Number, "Tax code" + q, driver, "CA", "Napa");

                        int      count       = driver.FindElements(By.XPath("//*[@id='h2tab3']/div")).Count;
                        int      divCount2   = count + 1;
                        string[] TaxCode     = new string[divCount2];
                        string[] description = new string[divCount2];
                        string[] rate        = new string[divCount2];
                        string[] Istinstall  = new string[divCount2];
                        string[] IIndinstall = new string[divCount2];
                        string[] total       = new string[divCount2];
                        string[] phone       = new string[divCount2];
                        for (int i = 1; i <= count; i++)
                        {
                            string Description1 = driver.FindElement(By.XPath(" //*[@id='h2tab3']/div[" + i + "]/div/div/dl")).Text.Trim().Replace("\r\n", "");
                            TaxCode[i]     = gc.Between(Description1, "Tax Code", "Description").Trim();
                            description[i] = gc.Between(Description1, "Description", "Rate").Trim();
                            rate[i]        = gc.Between(Description1, "Rate", "1st Installment").Trim();
                            Istinstall[i]  = gc.Between(Description1, "1st Installment", "2nd Installment").Trim();
                            IIndinstall[i] = gc.Between(Description1, "2nd Installment", "Total").Trim();
                            total[i]       = gc.Between(Description1, "Total", "Phone").Trim();
                            phone[i]       = WebDriverTest.After(Description1, "Phone");
                            string taxcode = Tax_year + "~" + TaxCode[i] + "~" + description[i] + "~" + rate[i] + "~" + Istinstall[i] + "~" + IIndinstall[i] + "~" + total[i] + "~" + phone[i];
                            gc.insert_date(orderNumber, Assessor_ID_Number, 1236, taxcode, 1, DateTime.Now);
                        }
                        //Tax Year~Tax Code~Description~Rate~1st Installment~2nd Installment~Total~Phone

                        //Default Tax
                        try
                        {
                            driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/ul/li[4]/a")).Click();
                            Thread.Sleep(3000);
                            gc.CreatePdf(orderNumber, Assessor_ID_Number, "Default Tax" + q, driver, "CA", "Napa");

                            Default_Number     = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[1]/div[2]")).Text;
                            Pay_Plan_in_Effect = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[2]/div[2]")).Text;
                            Annual_Payment     = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[3]/div[2]")).Text;
                            Balance            = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[4]/div[2]")).Text;

                            string default_tax = Tax_year + "~" + Default_Number + "~" + Pay_Plan_in_Effect + "~" + Annual_Payment + "~" + Balance;
                            gc.insert_date(orderNumber, Assessor_ID_Number, 1237, default_tax, 1, DateTime.Now);
                        }
                        //Tax Year~Default Number~Pay Plan in Effect~Annual Payment~Balance
                        catch { }

                        if (q < lat)
                        {
                            //  pltitle.TaxIDNumber = parcelNumber;
                            if (rollcasttype.Contains("CS"))
                            {
                                gc.InsertSearchTax(orderNumber, pltitle.Land, pltitle.Improvements, pltitle.ExemptionHomeowners, pltitle.ExemptionAdditional, pltitle.FirstInstallment, pltitle.FirstDueDate, pltitle.FirstTaxesOutDate, pltitle.FirstPaid, pltitle.FirstDue, pltitle.SecondInstallment, pltitle.SecondDueDate, pltitle.SecondTaxesOutDate, pltitle.SecondPaid, pltitle.SecondDue, pltitle.assyear, 1, pltitle.Year, "Napa County Treasurer-Tax Collector", pltitle.TaxIDNumber, "County", pltitle.TaxIDNumberFurtherDescribed);
                            }
                            if (rollcasttype.Contains("SS"))
                            {
                                if (pyear == Tax_year)
                                {
                                    gc.InsertSearchTax(orderNumber, pltitle.Land, pltitle.Improvements, pltitle.ExemptionHomeowners, pltitle.ExemptionAdditional, pltitle.FirstInstallment, pltitle.FirstDueDate, pltitle.FirstTaxesOutDate, pltitle.FirstPaid, pltitle.FirstDue, pltitle.SecondInstallment, pltitle.SecondDueDate, pltitle.SecondTaxesOutDate, pltitle.SecondPaid, pltitle.SecondDue, pltitle.assyear, 100, pltitle.Year, "Napa County Treasurer-Tax Collector", pltitle.TaxIDNumber, "Supplemental", pltitle.TaxIDNumberFurtherDescribed);
                                }
                            }
                            q++;
                        }
                    }
                    TaxTime     = DateTime.Now.ToString("HH:mm:ss");
                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "CA", "Napa", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);
                    driver.Quit();
                    gc.mergpdf(orderNumber, "CA", "Napa");
                    return("Data Inserted Successfully");
                }

                catch (Exception ex)
                {
                    driver.Quit();
                    throw ex;
                }
            }
        }
Example #21
0
        public string FTP_Utah(string houseno, string direction, string sname, string sttype, string parcelNumber, string searchType, string orderNumber, string ownername, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            // driver = new PhantomJSDriver();
            //driver = new ChromeDriver();
            IJavaScriptExecutor js = driver as IJavaScriptExecutor;
            string        pathurl = "", Owner_Name = "";
            string        StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";
            List <string> taxurllist = new List <string>();

            using (driver = new PhantomJSDriver())
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");
                    if (searchType == "titleflex")
                    {
                        string address = houseno + " " + direction + " " + sname + " " + sttype;
                        gc.TitleFlexSearch(orderNumber, parcelNumber, "", address, "UT", "Utah");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Utah_Zero"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    driver.Navigate().GoToUrl("http://www.utahcountyonline.org/LandRecords/Index.asp");
                    if (searchType == "address")
                    {
                        driver.Navigate().GoToUrl("http://www.utahcountyonline.org/LandRecords/AddressSearchForm.asp");
                        Thread.Sleep(2000);
                        //driver.FindElement(By.XPath("/html/body/div/div[6]/div[2]/table/tbody/tr/td/table/tbody/tr/td[1]/ul[1]/li[2]/a")).SendKeys(Keys.Enter);
                        //gc.CreatePdf_WOP_Chrome(orderNumber, "Address Search",driver, "UT", "Utah");
                        driver.FindElement(By.Id("av_house")).SendKeys(houseno);
                        driver.FindElement(By.Id("av_dir")).SendKeys(direction);
                        driver.FindElement(By.Id("av_street")).SendKeys(sname);
                        driver.FindElement(By.Id("street_type")).SendKeys(sttype);
                        //IWebElement rdio = driver.FindElement(By.XPath("//*[@id='form1']/table/tbody/tr/td/p[2]/label[2]/label/input"));
                        //js.ExecuteScript("arguments[0].click();", rdio);
                        driver.FindElement(By.XPath("//*[@id='form1']/table/tbody/tr/td/p[3]/input")).SendKeys(Keys.Enter);
                        gc.CreatePdf_WOP_Chrome(orderNumber, "Address Search result", driver, "UT", "Utah");
                        //multi parcel
                        IWebElement         multitableElement = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table[1]/tbody"));
                        IList <IWebElement> multitableRow     = multitableElement.FindElements(By.TagName("tr"));
                        if (multitableRow.Count > 2)
                        {
                            IList <IWebElement> multirowTD;
                            foreach (IWebElement row in multitableRow)
                            {
                                multirowTD = row.FindElements(By.TagName("td"));
                                if (multirowTD.Count != 0 && !row.Text.Contains("Serial Number"))
                                {
                                    string multi = multirowTD[1].Text.Trim() + "~" + "-";
                                    gc.insert_date(orderNumber, multirowTD[0].Text.Trim(), 119, multi, 1, DateTime.Now);
                                }
                            }
                            HttpContext.Current.Session["multiparcel_Utah"] = "Yes";
                            if (multitableRow.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_Utah_Multicount"] = "Maximum";
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                        if (multitableRow.Count == 1)
                        {
                            HttpContext.Current.Session["Utah_Zero"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                        else
                        {
                            driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table[1]/tbody/tr[2]/td[1]/a")).SendKeys(Keys.Enter);
                            IWebElement url = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[2]/td[1]/a"));
                            pathurl    = url.GetAttribute("href");
                            Owner_Name = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[2]/td[1]")).Text;
                            driver.Navigate().GoToUrl(pathurl);
                            gc.CreatePdf_WOP_Chrome(orderNumber, "Address Search result page", driver, "UT", "Utah");
                        }
                    }

                    else if (searchType == "parcel")
                    {
                        driver.FindElement(By.XPath("/html/body/div/div[6]/div[2]/table/tbody/tr/td/table/tbody/tr/td[1]/ul[1]/li[3]/a")).SendKeys(Keys.Enter);
                        if (parcelNumber.Contains(":") || parcelNumber.Contains(" "))
                        {
                            parcelNumber = parcelNumber.Replace(":", "").Trim();
                            parcelNumber = parcelNumber.Replace(" ", "").Trim();
                        }
                        gc.CreatePdf_Chrome(orderNumber, parcelNumber, "Parcel Search", driver, "UT", "Utah");
                        driver.FindElement(By.Id("av_serial")).SendKeys(parcelNumber);
                        IWebElement rdio = driver.FindElement(By.XPath("//*[@id='form1']/table/tbody/tr/td/p[2]/label[2]/label/input"));
                        js.ExecuteScript("arguments[0].click();", rdio);
                        driver.FindElement(By.XPath("//*[@id='form1']/table/tbody/tr/td/p[3]/input")).SendKeys(Keys.Enter);
                        gc.CreatePdf_Chrome(orderNumber, parcelNumber, "Parcel Search result", driver, "UT", "Utah");

                        IList <IWebElement> TRserial = driver.FindElements(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr"));
                        int count = TRserial.Count;
                        for (int i = 2; i <= count; i++)
                        {
                            try
                            {
                                string selectedvalue = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[" + i + "]/td[3]/select/option[1]")).Text;
                                selectedvalue = selectedvalue.Replace(":", "");
                                if (selectedvalue == parcelNumber)
                                {
                                    IWebElement propinfo = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[" + i + "]/td[3]/select/option[2]"));
                                    string      url      = propinfo.GetAttribute("value");
                                    Owner_Name = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[2]/td[1]")).Text;
                                    gc.CreatePdf_Chrome(orderNumber, parcelNumber, "Parcel Search - select parcel number page", driver, "UT", "Utah");
                                    pathurl = "http://www.utahcounty.gov/LandRecords/" + url;
                                    driver.Navigate().GoToUrl(pathurl);
                                    //  break;
                                }
                            }
                            catch { }
                        }
                    }
                    else if (searchType == "ownername")
                    {
                        driver.FindElement(By.XPath("/html/body/div/div[6]/div[2]/table/tbody/tr/td/table/tbody/tr/td[1]/ul[1]/li[1]/a")).SendKeys(Keys.Enter);
                        gc.CreatePdf_WOP_Chrome(orderNumber, "Owner name Search", driver, "UT", "Utah");
                        driver.FindElement(By.Id("av_name")).SendKeys(ownername);
                        IWebElement rdio = driver.FindElement(By.XPath("//*[@id='av_valid_0']"));
                        //js.ExecuteScript("arguments[0].click();", rdio);
                        rdio.Click();
                        driver.FindElement(By.XPath("//*[@id='form1']/div/table/tbody/tr[1]/td/p[3]/input")).SendKeys(Keys.Enter);
                        gc.CreatePdf_WOP_Chrome(orderNumber, "Owner name Search result", driver, "UT", "Utah");

                        try
                        {
                            //multi parcel
                            IWebElement         multitableElement = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table[1]/tbody"));
                            IList <IWebElement> multitableRow     = multitableElement.FindElements(By.TagName("tr"));
                            IList <IWebElement> multirowTD;
                            foreach (IWebElement row in multitableRow)
                            {
                                multirowTD = row.FindElements(By.TagName("td"));
                                if (multirowTD.Count != 0 && !row.Text.Contains("Owner"))
                                {
                                    string multi = multirowTD[0].Text.Trim() + "~" + multirowTD[4].Text.Trim();
                                    gc.insert_date(orderNumber, multirowTD[1].Text.Trim(), 119, multi, 1, DateTime.Now);
                                }
                            }

                            HttpContext.Current.Session["multiparcel_Utah"] = "Yes";
                            if (multitableRow.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_Utah_Multicount"] = "Maximum";
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                        catch { }
                        try
                        {
                            IWebElement Nodata = driver.FindElement(By.XPath("/html/body/table"));
                            if (!Nodata.Text.Contains("Property Address") && !Nodata.Text.Contains("Owner Name"))
                            {
                                HttpContext.Current.Session["Utah_Zero"] = "Zero";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                    }


                    Thread.Sleep(3000);
                    //Property details

                    string Parcel_ID = "-", Property_Address = "-", Mailing_Address = "-", Legal_Description = "-";
                    Parcel_ID         = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[1]/td[1]")).Text;
                    Parcel_ID         = WebDriverTest.After(Parcel_ID, "Serial Number:");
                    Property_Address  = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[3]/td[1]")).Text;
                    Property_Address  = WebDriverTest.After(Property_Address, "Property Address:");
                    Mailing_Address   = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[4]/td[1]")).Text;
                    Mailing_Address   = WebDriverTest.After(Mailing_Address, "Mailing Address:");
                    Legal_Description = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[8]/td[1]")).Text;
                    Legal_Description = WebDriverTest.After(Legal_Description, "Legal Description:");

                    IList <IWebElement> tron = driver.FindElements(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/div/div/div[1]/table[2]/tbody/tr"));
                    for (int trcount = 1; trcount <= tron.Count; trcount++)
                    {
                        IWebElement on       = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/div/div/div[1]/table[2]/tbody/tr[" + trcount + "]/td[1]/span"));
                        string      greentag = on.GetAttribute("class");

                        if (greentag == "style1yv")
                        {
                            Owner_Name += driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/div/div/div[1]/table[2]/tbody/tr[" + trcount + "]/ td[3]")).Text + "&";
                        }
                    }
                    Owner_Name = Regex.Replace(Owner_Name, "[0-9]{2,}", "").Replace("&", " ").Replace(":", "");
                    if (Parcel_ID.Contains(":"))
                    {
                        Parcel_ID = Parcel_ID.Replace(":", "");
                    }
                    gc.CreatePdf_Chrome(orderNumber, Parcel_ID, "Property Details information", driver, "UT", "Utah");
                    //OwnerName = Owner_Name.Substring(OwnerName.Length - 1,1);
                    string prop = Owner_Name + "~" + Property_Address + "~" + Legal_Description + "~" + Mailing_Address;
                    gc.insert_date(orderNumber, Parcel_ID, 122, prop, 1, DateTime.Now);

                    //assessment details
                    string Tax_Year = "-";
                    Thread.Sleep(4000);
                    driver.FindElement(By.XPath("//*[@id='TabbedPanels1']/ul/li[2]")).SendKeys(Keys.Enter);
                    Thread.Sleep(3000);
                    try
                    {
                        driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/div/div/div[2]/table/tbody/tr[3]/td[1]/a")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        Tax_Year = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/p[1]")).Text;
                        Tax_Year = WebDriverTest.After(Tax_Year, "Tax Year: ");
                        Tax_Year = WebDriverTest.Before(Tax_Year, "   Tax District:").Trim();
                    }
                    catch { }
                    string              RealEstate_Residential = "", RealEstate_Agricultural = "", RealEstate_Commercial = "", RealEstate_Totals = "";
                    string              Improvements_Residential = "", Improvements_Agricultural = "", Improvements_Commercial = "", Improvements_Totals = "";
                    string              Greenbelt_Residential = "", Greenbelt_RealEstate = "", Greenbelt_HomeSite = "", Greenbelt_Totals = "", Greenbelt_TotalsRealProperty = "", Greenbelt_AttachedPersonalProperty = "", Greenbelt_ToatalValuation = "";
                    string              Ok = "";
                    IWebElement         tbassess = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table[1]/tbody"));
                    IList <IWebElement> trassess = tbassess.FindElements(By.TagName("tr"));
                    IList <IWebElement> tdassess;
                    foreach (IWebElement row in trassess)
                    {
                        tdassess = row.FindElements(By.TagName("td"));


                        if (Ok == "Real Estate" && tdassess[3].Text.Trim() != "")
                        {
                            RealEstate_Residential = tdassess[1].Text + "~" + tdassess[3].Text + "~" + tdassess[5].Text + "~" + RealEstate_Residential;
                        }
                        if (tdassess.Count != 0 && row.Text.Contains("* * Real Estate"))
                        {
                            Ok = "Real Estate";
                        }
                        if (Ok == "Improvements" && tdassess[3].Text.Trim() != "")
                        {
                            Improvements_Residential = tdassess[1].Text + "~" + tdassess[3].Text + "~" + tdassess[5].Text + "~" + Improvements_Residential;


                            //RealEstate_Residential = new string(RealEstate_Residential.Reverse().ToArray());
                        }
                        if (tdassess.Count != 0 && row.Text.Contains("* * Improvements"))
                        {
                            Ok = "Improvements";
                        }
                        if (Ok == "Greenbelt as of")
                        {
                            Greenbelt_Residential = tdassess[1].Text + "~" + tdassess[3].Text + "~" + tdassess[5].Text + "~" + Greenbelt_Residential;


                            //RealEstate_Residential = new string(RealEstate_Residential.Reverse().ToArray());
                        }
                        if (tdassess.Count != 0 && row.Text.Contains("* * Greenbelt as of "))
                        {
                            Ok = "Greenbelt as of";
                        }

                        //if (tdassess.Count != 0 && !row.Text.Contains("* * Real Estate"))
                        //{
                        //    string assessment = Tax_Year + "~" + tdassess[1].Text.Trim() + "~" + tdassess[3].Text.Trim() + "~" + tdassess[5].Text.Trim(); ;
                        //    gc.insert_date(orderNumber, Parcel_ID, 123, assessment, 1,DateTime.Now);
                        //}
                    }
                    RealEstate_Residential = RealEstate_Residential + "Ert";
                    RealEstate_Residential = RealEstate_Residential.Replace("~Ert", "");



                    Greenbelt_Residential = Greenbelt_Residential + "Ert";
                    Greenbelt_Residential = Greenbelt_Residential.Replace("~Ert", "");



                    Improvements_Residential = Improvements_Residential + "Ert";
                    Improvements_Residential = Improvements_Residential.Replace("~Ert", "");

                    string   Overall = RealEstate_Residential + "~" + Improvements_Residential + "~" + Greenbelt_Residential;
                    string[] Real = Overall.Split('~');
                    //for (int i = RealSplit.Count() - 1; i >= 0; i--)
                    //{
                    //    string assessment = RealSplit[i] + "~" + tdassess[1].Text.Trim() + "~" + tdassess[3].Text.Trim() + "~" + tdassess[5].Text.Trim(); ;
                    //    gc.insert_date(orderNumber, Parcel_ID, 123, assessment, 1,DateTime.Now);
                    //}
                    int    K = 0;
                    string FirstHalf = "";
                    try
                    {
                        FirstHalf = Real[K + 10] + "~" + Real[K + 11] + "~" + Real[K + 7] + "~" + Real[K + 8] + "~" + Real[K + 4] + "~" + Real[K + 5] + "~" + Real[K + 1] + "~" + Real[K + 2] + "~" + Real[K + 22] + "~" + Real[K + 23] + "~" + Real[K + 19] + "~" + Real[K + 20] + "~" + Real[K + 16] + "~" + Real[K + 17] + "~" + Real[K + 13] + "~" + Real[K + 14] + "~" + Real[K + 40] + "~" + Real[K + 41] + "~" + Real[K + 37] + "~" + Real[K + 38] + "~" + Real[K + 34] + "~" + Real[K + 35] + "~" + Real[K + 31] + "~" + Real[K + 32] + "~" + Real[K + 28] + "~" + Real[K + 29] + "~" + Real[K + 25] + "~" + Real[K + 26];
                    }
                    catch { }
                    gc.insert_date(orderNumber, Parcel_ID, 123, FirstHalf, 1, DateTime.Now);
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.CreatePdf_Chrome(orderNumber, Parcel_ID, "Assessment Details information", driver, "UT", "Utah");

                    driver.Navigate().GoToUrl(pathurl);
                    Thread.Sleep(3000);

                    //Tax history details

                    driver.FindElement(By.XPath("//*[@id='TabbedPanels1']/ul/li[3]")).SendKeys(Keys.Enter);
                    gc.CreatePdf_Chrome(orderNumber, Parcel_ID, "Tax History Details information", driver, "UT", "Utah");
                    IWebElement         tbtaxHist = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/div/div/div[3]/table/tbody"));
                    IList <IWebElement> trtaxhist = tbtaxHist.FindElements(By.TagName("tr"));
                    IList <IWebElement> tdtaxhist;

                    foreach (IWebElement row in trtaxhist)
                    {
                        tdtaxhist = row.FindElements(By.TagName("td"));
                        if (tdtaxhist.Count != 0 && !row.Text.Contains("Year"))
                        {
                            string taxhist = tdtaxhist[0].Text + "~" + tdtaxhist[1].Text + "~" + tdtaxhist[2].Text + "~" + tdtaxhist[3].Text + "~" + tdtaxhist[4].Text + "~" + tdtaxhist[5].Text + "~" + tdtaxhist[6].Text + "~" + tdtaxhist[7].Text + "~" + tdtaxhist[8].Text;
                            gc.insert_date(orderNumber, Parcel_ID, 128, taxhist, 1, DateTime.Now);
                        }
                    }

                    try
                    {
                        IWebElement         taxdetailtable    = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/div/div/div[3]/table/tbody"));
                        IList <IWebElement> taxdetailtableRow = taxdetailtable.FindElements(By.TagName("tr"));
                        int taxrowcount = taxdetailtableRow.Count;
                        IList <IWebElement> taxdetailrowTD;
                        int c = 0;
                        foreach (IWebElement rowid1 in taxdetailtableRow)
                        {
                            taxdetailrowTD = rowid1.FindElements(By.TagName("td"));
                            if (taxdetailrowTD.Count != 0 && c <= taxrowcount && c > 2)
                            {
                                IWebElement taxhistory = driver.FindElement(By.XPath("//*[@id='TabbedPanels1']/div/div[3]/table/tbody/tr[" + c + "]/td[1]/a"));
                                string      taxurl     = taxhistory.GetAttribute("href");
                                taxurllist.Add(taxurl);
                                //Thread.Sleep(2000);
                                //string year = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[1]/td/strong[2]")).Text;
                                //gc.CreatePdf_Chrome(orderNumber, Parcel_ID, "TaxDeailInformation" + year, driver);
                                //IWebElement URL= driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[17]/td/a"));
                                //string Url = URL.GetAttribute("href");
                                //gc.downloadfile(Url, orderNumber, Parcel_ID, "TaxBill" + year);
                                ////driver.Navigate().GoToUrl("http://www.utahcounty.gov/LandRecords/Property.asp?av_serial="+Parcel_ID);
                                //driver.Navigate().Back();
                            }

                            // Thread.Sleep(3000);
                            c++;
                        }
                    }
                    catch { }
                    int    i1 = 0;
                    string Delinquent = "", Paymentdetails = "";
                    foreach (string URL in taxurllist)
                    {
                        if (i1 < 3)
                        {
                            driver.Navigate().GoToUrl(URL);
                            Thread.Sleep(4000);
                            string SerialNo   = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[1]/td/strong[1]")).Text.Trim();
                            string year       = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[1]/td/strong[2]")).Text.Trim();
                            string Nettax     = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[9]/td[2]")).Text.Trim();
                            string Payments   = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[12]/td[2]")).Text.Trim();
                            string Taxbalance = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[14]/td[2]")).Text.Trim();
                            try
                            {
                                Delinquent = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[10]/td[4]/table/tbody/tr[1]/td")).Text.Trim();
                            }
                            catch { }
                            try
                            {
                                Paymentdetails = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[16]/td[1]/table/tbody")).Text;
                            }
                            catch { }
                            if (i1 == 0)
                            {
                                amck.TaxId           = SerialNo.Replace(":", "").Trim();
                                amck.TaxYear         = year;
                                amck.Instamount1     = Nettax;
                                amck.Instamountpaid1 = Payments;

                                if (Delinquent.Contains("Delinquent Tax Information"))
                                {
                                    amck.IsDelinquent = "Yes";
                                }
                                else
                                {
                                    //amck.IsDelinquent = "No";
                                    if (Taxbalance == "$0.00" && Paymentdetails.Contains("None"))
                                    {
                                    }
                                    else
                                    {
                                        if (amck.Instamount1 == amck.Instamountpaid1)
                                        {
                                            amck.InstPaidDue1 = "Paid";
                                            amck.IsDelinquent = "No";
                                        }
                                        else
                                        {
                                            amck.IsDelinquent = "Yes";
                                        }
                                        if (Nettax == Taxbalance)
                                        {
                                            amck.InstPaidDue1 = "Due";
                                            amck.IsDelinquent = "No";
                                        }
                                    }
                                }



                                if (amck.IsDelinquent != "Yes")
                                {
                                    gc.InsertAmrockTax(orderNumber, amck.TaxId, amck.Instamount1, amck.Instamount2, amck.Instamount3, amck.Instamount4, amck.Instamountpaid1, amck.Instamountpaid2, amck.Instamountpaid3, amck.Instamountpaid4, amck.InstPaidDue1, amck.InstPaidDue2, amck.instPaidDue3, amck.instPaidDue4, amck.IsDelinquent);
                                }
                                else
                                {
                                    gc.InsertAmrockTax(orderNumber, amck.TaxId, null, null, null, null, null, null, null, null, null, null, null, null, amck.IsDelinquent);
                                }
                            }

                            gc.CreatePdf_Chrome(orderNumber, Parcel_ID, "TaxDeailInformation" + year, driver, "UT", "Utah");
                            IWebElement URL1 = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[17]/td/a"));
                            string      Url  = URL1.GetAttribute("href");
                            driver.Navigate().GoToUrl(Url);
                            Thread.Sleep(6000);
                            driver.SwitchTo().Window(driver.WindowHandles.Last());
                            Thread.Sleep(2000);
                            gc.CreatePdf_Chrome(orderNumber, Parcel_ID, "Tax Bill" + year, driver, "UT", "Utah");
                            driver.SwitchTo().Window(driver.WindowHandles.First());
                            Thread.Sleep(2000);
                            //gc.downloadfile(Url, orderNumber, Parcel_ID, "TaxBill" + year);
                            i1++;
                        }
                    }


                    driver.Navigate().GoToUrl("http://www.utahcounty.gov/LandRecords/Property.asp?av_serial=" + Parcel_ID);
                    driver.FindElement(By.XPath("//*[@id='TabbedPanels1']/ul/li[3]")).SendKeys(Keys.Enter);
                    //Tax payment details
                    string      Taxing_Authority = "", Good_PThrough_Date = "", date = "", deleiquent = "";
                    IWebElement tax_pay;
                    try
                    {
                        tax_pay    = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/div/div/div[3]/table/tbody/tr[3]/td[8]/a"));
                        deleiquent = tax_pay.Text;

                        if (deleiquent.Contains("Click for Payoff"))
                        {
                            tax_pay.SendKeys(Keys.Enter);
                            Thread.Sleep(3000);

                            IWebElement td = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td"));
                            date = td.Text;
                            date = WebDriverTest.After(date, "Total amount if paid as of").Trim();
                            date = WebDriverTest.Before(date, ".  .  .").Trim();

                            DateTime G_Date       = Convert.ToDateTime(date);
                            string   dateChecking = DateTime.Now.ToString("MM") + "/15/" + DateTime.Now.ToString("yyyy");

                            if (G_Date < Convert.ToDateTime(dateChecking))
                            {
                                //end of the month
                                date = new DateTime(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM"))), DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(DateTime.Now.ToString("MM")))).ToString("MM/dd/yyyy");
                            }

                            else if (G_Date > Convert.ToDateTime(dateChecking))
                            {
                                // nextEndOfMonth
                                if ((Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM"))) < 12))
                                {
                                    date = new DateTime(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM")) + 1), DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(DateTime.Now.ToString("MM")) + 1)).ToString("MM/dd/yyyy");
                                }
                                else
                                {
                                    int nxtYr = Convert.ToInt16(DateTime.Now.ToString("yyyy")) + 1;
                                    date = new DateTime(nxtYr, 1, DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), 1)).ToString("MM/dd/yyyy");
                                }
                            }
                            string   Mon   = "";
                            string[] da    = date.Split('/');
                            string   month = da[0];
                            string   Date  = da[1];
                            string   year  = da[2];

                            switch (month)
                            {
                            case "01":
                                Mon = "January";
                                break;

                            case "02":
                                Mon = "February";
                                break;

                            case "03":
                                Mon = "March";
                                break;

                            case "04":
                                Mon = "April";
                                break;

                            case "05":
                                Mon = "May";
                                break;

                            case "06":
                                Mon = "June";
                                break;

                            case "07":
                                Mon = "July";
                                break;

                            case "08":
                                Mon = "August";
                                break;

                            case "09":
                                Mon = "September";
                                break;

                            case "10":
                                Mon = "October";
                                break;

                            case "11":
                                Mon = "November";
                                break;

                            case "12":
                                Mon = "December";
                                break;
                            }
                            driver.FindElement(By.XPath("//*[@id='av_date_btn']")).Click();


                            //select month
                            for (int i = 1; i < 12; i++)
                            {
                                string   calmy     = driver.FindElement(By.XPath("/html/body/div[2]/table/thead/tr[1]/td[2]")).Text;
                                string[] my        = calmy.Split(',');
                                string   cal_month = my[0];
                                string   cal_year  = my[1];

                                if (cal_month.Contains(Mon))
                                {
                                    break;
                                }
                                else
                                {
                                    driver.FindElement(By.XPath("/html/body/div[2]/table/thead/tr[2]/td[4]")).Click();
                                }
                            }

                            //select year
                            for (int j = 1; j <= 5; j++)
                            {
                                string   calmy     = driver.FindElement(By.XPath("/html/body/div[2]/table/thead/tr[1]/td[2]")).Text;
                                string[] my        = calmy.Split(',');
                                string   cal_month = my[0];
                                string   cal_year  = my[1];

                                if (cal_year.Contains(year))
                                {
                                    break;
                                }
                                else
                                {
                                    driver.FindElement(By.XPath("/html/body/div[2]/table/thead/tr[2]/td[5]")).Click();
                                }
                            }

                            //select date
                            IWebElement         tbdate = driver.FindElement(By.XPath("/html/body/div[2]/table/tbody"));
                            IList <IWebElement> trdate = tbdate.FindElements(By.TagName("tr"));
                            IList <IWebElement> tddate;
                            foreach (IWebElement row in trdate)
                            {
                                tddate = row.FindElements(By.TagName("td"));
                                for (int a = 1; a <= 5; a++)
                                {
                                    if (row.Text.Contains(Date))
                                    {
                                        for (int b = 1; b <= 8; b++)
                                        {
                                            if (tddate[b].Text.Contains(Date))
                                            {
                                                driver.FindElement(By.XPath("/html/body/div[2]/table/tbody/tr[" + a + "]/td[" + b + "]")).Click();
                                                break;
                                            }
                                        }
                                    }
                                }
                            }

                            driver.FindElement(By.XPath("//*[@id='button']")).SendKeys(Keys.Enter);
                            Thread.Sleep(3000);
                            gc.CreatePdf_Chrome(orderNumber, Parcel_ID, "Deliquent Tax", driver, "UT", "Utah");
                            Taxing_Authority = driver.FindElement(By.XPath("//p[contains(text(),'The Treasurer')]/following-sibling::p")).Text;
                            if (Taxing_Authority.Contains("\r\n"))
                            {
                                Taxing_Authority = Taxing_Authority.Replace("\r\n", " ");
                            }
                            IWebElement         deliTB = driver.FindElement(By.XPath("//p[contains(text(),'Serial Number:')]/following-sibling::table/tbody"));
                            IList <IWebElement> trdeli = deliTB.FindElements(By.TagName("tr"));
                            IList <IWebElement> tddeli;
                            foreach (IWebElement row in trdeli)
                            {
                                tddeli = row.FindElements(By.TagName("td"));
                                if (tddeli.Count != 0 && !row.Text.Contains("Year") && !row.Text.Contains("amount if paid as") && !row.Text.Contains("--") && (row.Text != "         "))
                                {
                                    string deliq = tddeli[0].Text + "~" + tddeli[1].Text + "~" + tddeli[2].Text + "~" + tddeli[3].Text + "~" + tddeli[4].Text + "~" + tddeli[5].Text + "~" + date + "~" + Taxing_Authority;
                                    if (deliq.Contains("\r\n"))
                                    {
                                        deliq = deliq.Replace("\r\n", "");
                                    }
                                    gc.insert_date(orderNumber, Parcel_ID, 143, deliq, 1, DateTime.Now);
                                }
                            }
                            TaxTime = DateTime.Now.ToString("HH:mm:ss");
                            driver.Navigate().GoToUrl(pathurl);
                            Thread.Sleep(3000);
                            driver.FindElement(By.XPath("//*[@id='TabbedPanels1']/ul/li[3]")).SendKeys(Keys.Enter);
                            Thread.Sleep(3000);

                            driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/div/div/div[3]/table/tbody/tr[3]/td[6]/div/a")).SendKeys(Keys.Enter);
                            gc.CreatePdf_Chrome(orderNumber, Parcel_ID, "Tax Payment Details information", driver, "UT", "Utah");
                            try
                            {
                                IWebElement         tbtax = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody"));
                                IList <IWebElement> trtax = tbtax.FindElements(By.TagName("tr"));
                                IList <IWebElement> tdtax;
                                foreach (IWebElement row in trtax)
                                {
                                    tdtax = row.FindElements(By.TagName("td"));
                                    if (tdtax.Count != 0 && !row.Text.Contains("Tax Year"))
                                    {
                                        string tax = tdtax[0].Text + "~" + tdtax[2].Text + "~" + tdtax[4].Text + "~" + tdtax[6].Text + "~" + tdtax[8].Text + "~" + tdtax[10].Text + "~" + tdtax[12].Text + "~" + tdtax[14].Text + "~" + tdtax[16].Text;
                                        gc.insert_date(orderNumber, Parcel_ID, 129, tax, 1, DateTime.Now);
                                    }
                                }
                            }
                            catch { }
                        }
                    }

                    catch { }


                    if (deleiquent == "")
                    {
                        //
                        driver.FindElement(By.XPath("//*[@id='TabbedPanels1']/div/div[3]/table/tbody/tr[2]/td[1]/a")).SendKeys(Keys.Enter);
                        gc.CreatePdf_Chrome(orderNumber, Parcel_ID, "Tax Payment Details information", driver, "UT", "Utah");

                        try
                        {
                            IWebElement         tbtax = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody"));
                            IList <IWebElement> trtax = tbtax.FindElements(By.TagName("tr"));
                            IList <IWebElement> tdtax;
                            foreach (IWebElement row in trtax)
                            {
                                tdtax = row.FindElements(By.TagName("td"));
                                if (tdtax.Count > 1 && tdtax[0].Text.Trim() != "")
                                {
                                    string tax = tdtax[0].Text + "~" + tdtax[1].Text;
                                    gc.insert_date(orderNumber, Parcel_ID, 129, tax, 1, DateTime.Now);
                                }
                            }
                        }
                        catch
                        { }
                    }
                    driver.Navigate().GoToUrl(pathurl);
                    Thread.Sleep(3000);

                    //driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/div/ul/li[3]")).SendKeys(Keys.Enter);
                    //driver.FindElement(By.XPath("//*[@id='TabbedPanels1']/div/div[3]/table/tbody/tr[3]/td[1]/a")).SendKeys(Keys.Enter);
                    //IWebElement URL= driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[17]/td/a"));
                    //string Url = URL.GetAttribute("href");
                    //// URL.SendKeys(Keys.Enter);
                    //// driver.SwitchTo().Window(driver.WindowHandles.Last());
                    // driver.Navigate().GoToUrl(Url);
                    //string billpdf = outputPath + Parcel_ID.Replace(":", "") + "tax_bill.pdf";
                    //System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                    //WebClient downloadpdf = new WebClient();
                    //downloadpdf.DownloadFile(Url, billpdf);

                    // CreatePdf_WOP(orderNumber, "Tax Bill");
                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "UT", "Utah", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);
                    driver.Quit();
                    gc.mergpdf(orderNumber, "UT", "Utah");
                    return("Data Inserted Successfully");
                }

                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw ex;
                }
            }
        }
        public string FTP_CASanDiego(string address, string assessment_id, string parcelNumber, string searchType, string orderNumber, string directParcel, string ownername)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";

            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");

                    if (searchType == "titleflex")
                    {
                        titleaddress = address;
                        gc.TitleFlexSearch(orderNumber, parcelNumber, ownername, titleaddress, "CA", "San Diego");

                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_CASanDiego"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "parcel")
                    {
                        ParcelSearch(orderNumber, parcelNumber);

                        try
                        {
                            IWebElement         Securedtable = driver.FindElement(By.XPath("//*[@id='PaymentApplicationContent_gvSecured']/tbody"));
                            IList <IWebElement> SecuredRow   = Securedtable.FindElements(By.TagName("tr"));
                            IList <IWebElement> SecuredTD;
                            int           Securedcount = SecuredRow.Count;
                            List <string> strSecured   = new List <string>();

                            foreach (IWebElement Secured in SecuredRow)
                            {
                                SecuredTD = Secured.FindElements(By.TagName("td"));
                                if (SecuredTD.Count != 0 && SecuredTD.Count == 13 && Secured.Text.Contains("View Bill"))
                                {
                                    strSecured.Add("https://iwr.sdtreastax.com/SanDiegoTTCPaymentApplication/SecuredDetails.aspx?parcelNumber=" + SecuredTD[1].Text.Trim().Replace("-", ""));
                                }
                            }
                            foreach (string SecuredURL in strSecured)
                            {
                                driver.Navigate().GoToUrl(SecuredURL);
                                securedDetais(orderNumber, parcelNumber);
                                try
                                {
                                    IWebElement         AssessmentTB = driver.FindElement(By.XPath("//*[@id='bp7']/div[2]/table/tbody"));
                                    IList <IWebElement> AssessmentTR = AssessmentTB.FindElements(By.TagName("tr"));
                                    IList <IWebElement> AssessmentTD;

                                    foreach (IWebElement Assessment in AssessmentTR)
                                    {
                                        AssessmentTD = Assessment.FindElements(By.TagName("td"));
                                        if (AssessmentTD.Count != 0)
                                        {
                                            Land_Desrip = AssessmentTD[0].Text;
                                            Value_Exemp = AssessmentTD[2].Text;

                                            Assessment_details = Land_Desrip + "~" + Value_Exemp;
                                            gc.insert_date(orderNumber, Parcel_No, 958, Assessment_details, 1, DateTime.Now);
                                        }
                                    }
                                }
                                catch
                                { }
                                try
                                {
                                    Tax_authority        = driver.FindElement(By.XPath("//*[@id='PaymentApplicationContent_footer']/div[2]")).Text;
                                    Tax_authority        = WebDriverTest.After(Tax_authority, "payment to:");
                                    TaxAuthotity_details = Tax_authority;
                                    gc.insert_date(orderNumber, Parcel_No, 955, TaxAuthotity_details, 1, DateTime.Now);
                                }
                                catch
                                { }
                                driver.FindElement(By.Id("PaymentApplicationContent_btnSearchResults")).SendKeys(Keys.Enter);
                                Thread.Sleep(2000);
                            }
                        }
                        catch
                        { }

                        AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                        try
                        {
                            IWebElement         Supplementaltable = driver.FindElement(By.XPath("//*[@id='PaymentApplicationContent_gvSupplemental']/tbody"));
                            IList <IWebElement> SupplementalRow   = Supplementaltable.FindElements(By.TagName("tr"));
                            IList <IWebElement> SupplementalTD;
                            int           rowcount        = SupplementalRow.Count;
                            List <string> strSupplemental = new List <string>();

                            foreach (IWebElement Supplemental in SupplementalRow)
                            {
                                SupplementalTD = Supplemental.FindElements(By.TagName("td"));
                                if (SupplementalTD.Count != 0 && SupplementalTD.Count == 13 && Supplemental.Text.Contains("View Bill"))
                                {
                                    strSupplemental.Add("https://iwr.sdtreastax.com/SanDiegoTTCPaymentApplication/SupplementalDetails.aspx?parcelNumber=" + SupplementalTD[1].Text.Trim().Replace("-", ""));
                                }
                            }
                            foreach (string SupplementalURL in strSupplemental)
                            {
                                driver.Navigate().GoToUrl(SupplementalURL);
                                securedDetais(orderNumber, parcelNumber);
                                ExcemptionDetais(orderNumber, parcelNumber);
                            }
                        }
                        catch
                        { }
                    }
                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "CA", "San Diego", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderNumber, "CA", "San Diego");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw;
                }
            }
        }
        public string FTP_Baltimore(string houseno, string sname, string stype, string unitno, string ownername, string parcelNumber, string searchType, string orderNumber, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";

            string Tax_Year = "", Paid_Date = "", Discount = "", Paid_Amount = "", Total_Due = "", b = "";
            var    driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");

                    driver.Navigate().GoToUrl("https://sdat.dat.maryland.gov/RealProperty/Pages/default.aspx");
                    Thread.Sleep(3000);
                    var Select         = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucSearchType_ddlCounty"));
                    var selectElement1 = new SelectElement(Select);
                    selectElement1.SelectByText("BALTIMORE CITY");
                    if (searchType == "address")
                    {
                        var Select1         = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucSearchType_ddlSearchType"));
                        var selectElement11 = new SelectElement(Select1);
                        selectElement11.SelectByText("STREET ADDRESS");
                        gc.CreatePdf_WOP(orderNumber, "Address", driver, "MD", "Baltimore City");
                        driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_StartNavigationTemplateContainerID_btnContinue")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtStreenNumber")).SendKeys(houseno);
                        driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtStreetName")).SendKeys(sname);
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "MD", "Baltimore City");
                        driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_StepNavigationTemplateContainerID_btnStepNextButton")).SendKeys(Keys.Enter);

                        Thread.Sleep(4000);
                        try
                        {
                            if (driver.FindElement(By.XPath(" //*[@id='MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucSearchResult_gv_SearchResult']/tbody")).Displayed)
                            {
                                gc.CreatePdf_WOP(orderNumber, "MultiParcel search result", driver, "MD", "Baltimore City");
                                IWebElement         multitableElement11 = driver.FindElement(By.XPath("//*[@id='MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucSearchResult_gv_SearchResult']/tbody"));
                                IList <IWebElement> multitableRow11     = multitableElement11.FindElements(By.TagName("tr"));
                                IList <IWebElement> multirowTD11;
                                int k = 0;
                                foreach (IWebElement row in multitableRow11)
                                {
                                    if (k <= 25)
                                    {
                                        if (!row.Text.Contains("Name"))
                                        {
                                            multirowTD11 = row.FindElements(By.TagName("td"));
                                            if (multirowTD11.Count != 1 && multirowTD11[0].Text.Trim() != "")
                                            {
                                                string p_no = multirowTD11[1].Text.Trim();
                                                p_no = p_no.Replace(" ", "");
                                                string multi_parcel = multirowTD11[0].Text.Trim() + "~" + multirowTD11[1].Text.Trim() + "~" + multirowTD11[2].Text.Trim() + "~" + multirowTD11[3].Text.Trim() + "~" + multirowTD11[4].Text.Trim() + "~" + multirowTD11[5].Text.Trim();
                                                gc.insert_date(orderNumber, p_no, 210, multi_parcel, 1, DateTime.Now);
                                            }
                                        }
                                        k++;
                                    }
                                }
                                if (multitableRow11.Count > 25)
                                {
                                    HttpContext.Current.Session["multiParcel_Baltimore_Multicount"] = "Maximum";
                                }
                                else
                                {
                                    HttpContext.Current.Session["multiParcel_Baltimore"] = "Yes";
                                }

                                driver.Quit();
                                // gc.mergpdf(orderNumber);
                                return("MultiParcel");
                            }
                        }
                        catch { }
                    }

                    if (searchType == "titleflex")
                    {
                        string titleaddress = houseno + " " + sname + " " + stype + " " + unitno;
                        gc.TitleFlexSearch(orderNumber, "", ownername, titleaddress.Trim(), "MD", "Baltimore City");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_MDBaltimore"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }
                    if (searchType == "parcel")
                    {
                        //if ((HttpContext.Current.Session["titleflex_alternateAPN"] == null))
                        //{
                        //    gc.TitleFlexSearch(orderNumber, parcelNumber, "", "", "MD", "Baltimore City");
                        //    string strParcelNumber = HttpContext.Current.Session["titleflex_alternateAPN"].ToString();
                        //    if (strParcelNumber.Trim().Length == 13 || strParcelNumber.Trim().Length == 12 || strParcelNumber.Trim().Length == 9)
                        //    {
                        //        parcelNumber = strParcelNumber.Replace("-", "").Replace(" ", "");
                        //    }
                        //    HttpContext.Current.Session["titleflex_alternateAPN"] = null;
                        //}
                        //if (HttpContext.Current.Session["titleparcel"] != null && HttpContext.Current.Session["titleflex_alternateAPN"] != null)
                        //{
                        //    string strParcelNumber = HttpContext.Current.Session["titleflex_alternateAPN"].ToString();
                        //    if (strParcelNumber.Trim().Length == 13 || strParcelNumber.Trim().Length == 12 || strParcelNumber.Trim().Length == 9)
                        //    {
                        //        parcelNumber = strParcelNumber.Replace("-", "").Replace(" ", "");
                        //    }
                        //}
                        var Select11         = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucSearchType_ddlSearchType"));
                        var selectElement111 = new SelectElement(Select11);
                        selectElement111.SelectByText("PROPERTY ACCOUNT IDENTIFIER");
                        gc.CreatePdf_WOP(orderNumber, "Parcel search", driver, "MD", "Baltimore City");
                        driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_StartNavigationTemplateContainerID_btnContinue")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        if (parcelNumber.Contains("-"))
                        {
                            parcelNumber = parcelNumber.Replace("-", "");
                        }
                        if (parcelNumber.Length == 12)
                        {
                            string ward = parcelNumber.Substring(0, 2);
                            driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtWard")).SendKeys(ward);
                            string section1 = parcelNumber.Substring(2, 2);
                            driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtSection")).SendKeys(section1);
                            string block = parcelNumber.Substring(4, 5);
                            driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtBlock")).SendKeys(block);
                            string lot = parcelNumber.Substring(9, 3);
                            driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtLot")).SendKeys(lot);
                        }
                        else
                        {
                            string ward1 = parcelNumber.Substring(0, 2);
                            driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtWard")).SendKeys(ward1);
                            string section11 = parcelNumber.Substring(2, 2);
                            driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtSection")).SendKeys(section11);

                            string block1 = parcelNumber.Substring(4, 4);
                            driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtBlock")).SendKeys(block1);
                            string lot1 = parcelNumber.Substring(8, 3);
                            driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtLot")).SendKeys(lot1);
                        }
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search result", driver, "MD", "Baltimore City");
                        driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_StepNavigationTemplateContainerID_btnStepNextButton")).SendKeys(Keys.Enter);
                        Thread.Sleep(5000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search result1", driver, "MD", "Baltimore City");
                    }

                    try
                    {
                        IWebElement INodata = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_lblErr"));
                        if (INodata.Text.Contains("no records that match your criteria"))
                        {
                            HttpContext.Current.Session["Nodata_MDBaltimore"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }

                    //property details
                    gc.CreatePdf(orderNumber, parcelNumber, "Assessment details", driver, "MD", "Baltimore City");
                    string Account_id_number = "", Owner_name = "", Address = "", Legal_Description = "", Year_Built = "", use = "", Principal_Residence = "", Map = "", Sections = "", Land = "", Building = "", Total_Assessed_Value = "";
                    string Grid = "", Parcel = "", Sub_District = "", Subdivision = "", Block = "", Lot = "", Assessment_Year = "", Homestead_Application_Status = "", Homeowners_Tax_Credit_Application_Status = "", Homeowners_Tax_Credit_Application_Date = "";
                    Account_id_number = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblDetailsStreetHeader_0")).Text.Trim();
                    string value = Account_id_number.Replace("Ward", "").Replace("Section", "").Replace("Block", "").Replace("Lot", "");
                    Account_id_number = value.Replace(" ", "").Replace("-", "");


                    Owner_name = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblOwnerName_0")).Text.Trim();
                    Address    = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblPremisesAddress_0")).Text.Trim();
                    Address    = Address.Replace("\r\n", " ");

                    string Mail_Address = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblMailingAddress_0")).Text.Trim();
                    Mail_Address = Mail_Address.Replace("\r\n", " ");

                    Legal_Description = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblLegalDescription_0")).Text.Trim();
                    Year_Built        = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label18_0")).Text.Trim();
                    use = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblUse_0")).Text.Trim();
                    Principal_Residence = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblPrinResidence_0")).Text.Trim();
                    Map             = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label5_0")).Text.Trim();
                    Grid            = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label6_0")).Text.Trim();
                    Parcel          = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label7_0")).Text.Trim();
                    Sub_District    = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label8_0")).Text.Trim();
                    Subdivision     = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label9_0")).Text.Trim();
                    Sections        = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label10_0")).Text.Trim();
                    Block           = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label11_0")).Text.Trim();
                    Lot             = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label12_0")).Text.Trim();
                    Assessment_Year = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label13_0")).Text.Trim();
                    Homestead_Application_Status             = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblHomeStatus_0")).Text.Trim();
                    Homeowners_Tax_Credit_Application_Status = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblHTC_Status_0")).Text.Trim();
                    Homeowners_Tax_Credit_Application_Date   = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblHTC_StatusDate_0")).Text.Trim();

                    string property_details = Account_id_number + "~" + Owner_name + "~" + Address + "~" + Mail_Address + "~" + Legal_Description + "~" + Year_Built + "~" + use + "~" + Principal_Residence + "~" + Map + "~" + Grid + "~" + Parcel + "~" + Sub_District + "~" + Subdivision + "~" + Sections + "~" + Block + "~" + Lot + "~" + Assessment_Year + "~" + Homestead_Application_Status + "~" + Homeowners_Tax_Credit_Application_Status + "~" + Homeowners_Tax_Credit_Application_Date;
                    gc.insert_date(orderNumber, Account_id_number, 206, property_details, 1, DateTime.Now);

                    //Assessment Details Table:

                    Land                 = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblBaseLand_0")).Text.Trim();
                    Building             = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblBaseImprove_0")).Text.Trim();
                    Total_Assessed_Value = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblBaseTotal_0")).Text.Trim();

                    string Assessment_details = Land + "~" + Building + "~" + Total_Assessed_Value;
                    gc.insert_date(orderNumber, Account_id_number, 207, Assessment_details, 1, DateTime.Now);
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    driver.Navigate().GoToUrl("http://cityservices.baltimorecity.gov/realproperty/default.aspx");
                    Thread.Sleep(3000);
                    driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_txtBlock")).SendKeys(Block);
                    driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_txtLot")).SendKeys(Lot);
                    gc.CreatePdf(orderNumber, Account_id_number, "Tax_info", driver, "MD", "Baltimore City");
                    driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_btnSearch")).SendKeys(Keys.Enter);
                    Thread.Sleep(3000);
                    gc.CreatePdf(orderNumber, Account_id_number, "Tax_info1", driver, "MD", "Baltimore City");
                    driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_DataGrid1_ctl02_lnkBtnSelect")).Click();
                    Thread.Sleep(3000);
                    gc.CreatePdf(orderNumber, Account_id_number, "Tax_info2", driver, "MD", "Baltimore City");
                    string other_charges = "";
                    Tax_Year = driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_LabelEndFY")).Text;
                    string other = "";
                    try
                    {
                        other = driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_Other2")).Text;
                    }
                    catch
                    {
                        other = "";
                    }

                    try
                    {
                        if (other != "OTHER CHARGES")
                        {
                            Paid_Date = driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_Paid")).Text;
                            Paid_Date = Regex.Replace(Paid_Date, "[A-Za-z ]", "").Trim();
                            string a1 = Paid_Date.Substring(0, 8);
                            Discount    = Paid_Date.Substring(8, 4);
                            Paid_Date   = a1;
                            Paid_Amount = driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_AmtPaid")).Text;
                        }
                        else
                        {
                            Paid_Date   = " ";
                            Discount    = " ";
                            Paid_Date   = driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_Other")).Text;
                            Paid_Amount = driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_OtherAmt")).Text;
                            Paid_Date   = Regex.Replace(Paid_Date, "[A-Za-z ]", "").Trim();
                            string a1 = Paid_Date.Substring(0, 8);
                            Discount      = Paid_Date.Substring(8, 4);
                            Paid_Date     = a1;
                            other_charges = driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_Other2Amt")).Text;
                        }
                    }
                    catch { }

                    Total_Due = driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_AmountDue")).Text;
                    if (!Total_Due.Contains("0.00"))
                    {
                        other_charges = driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_OtherAmt")).Text;
                    }
                    IWebElement         multitableElement1 = driver.FindElement(By.XPath("//*[@id='ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_Table1']/tbody"));
                    IList <IWebElement> multitableRow1     = multitableElement1.FindElements(By.TagName("tr"));
                    IList <IWebElement> multirowTD1;
                    foreach (IWebElement row in multitableRow1)
                    {
                        if (!row.Text.Contains("ASSESSMENT"))
                        {
                            if (!row.Text.Contains("PAID"))
                            {
                                multirowTD1 = row.FindElements(By.TagName("td"));
                                if (multirowTD1.Count != 1)
                                {
                                    if (multirowTD1.Count == 4)
                                    {
                                        string tax_info = Tax_Year + "~" + "" + "~" + multirowTD1[0].Text.Trim() + "~" + multirowTD1[1].Text.Trim() + "~" + multirowTD1[2].Text.Trim() + "~" + multirowTD1[3].Text.Trim() + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-";
                                        gc.insert_date(orderNumber, Account_id_number, 208, tax_info, 1, DateTime.Now);
                                    }
                                }
                            }
                        }
                    }



                    string tax_info1 = Tax_Year + "~" + Paid_Date + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + other_charges + "~" + Discount + "~" + Paid_Amount + "~" + Total_Due;
                    gc.insert_date(orderNumber, Account_id_number, 208, tax_info1, 1, DateTime.Now);

                    string Taxing_authority_address1 = driver.FindElement(By.XPath("//*[@id='ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_tblDetail']/tbody/tr[2]/td[2]")).Text.Trim();
                    Taxing_authority_address1 = Taxing_authority_address1.Replace("\r\n", " ");
                    string Taxing_authority_address = WebDriverTest.Before(Taxing_authority_address1, "TELEPHONE").Trim();

                    string telephone = WebDriverTest.After(Taxing_authority_address1, "BILLING").Trim();
                    telephone = WebDriverTest.Before(telephone, "IVR   REFERENCE").Trim();

                    string tax_info2 = "Taxing Authority  :" + "~" + Taxing_authority_address + "~" + "Phone Number  :" + "~" + telephone + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-";
                    gc.insert_date(orderNumber, Account_id_number, 208, tax_info2, 1, DateTime.Now);

                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

                    //Tax Due / Delinquent Details
                    if (!Total_Due.Contains("0.00"))
                    {
                        string              install             = "";
                        IWebElement         multitableElement11 = driver.FindElement(By.XPath("//*[@id='ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_Table2']/tbody"));
                        IList <IWebElement> multitableRow11     = multitableElement11.FindElements(By.TagName("tr"));
                        IList <IWebElement> multirowTD11;
                        foreach (IWebElement row in multitableRow11)
                        {
                            if (!row.Text.Contains("SEMIANNUAL PAYMENT"))
                            {
                                if (row.Text.Contains("1ST INSTALLMENT"))
                                {
                                    install = "1ST INSTALLMENT";
                                }
                                if (row.Text.Contains("2ND INSTALLMENT"))
                                {
                                    install = "2ND INSTALLMENT";
                                }
                                if (row.Text.Contains("ANNUAL PAYMENT SCHEDULE"))
                                {
                                    install = "ANNUAL PAYMENT SCHEDULE";
                                }
                                if (!row.Text.Contains("IF PAID BY"))
                                {
                                    if (!row.Text.Contains("  "))
                                    {
                                        multirowTD11 = row.FindElements(By.TagName("td"));
                                        if (multirowTD11.Count == 3)
                                        {
                                            string tax_info = "-" + "~" + install + "~" + multirowTD11[0].Text.Trim() + "~" + multirowTD11[1].Text.Trim() + "~" + multirowTD11[2].Text.Trim();
                                            gc.insert_date(orderNumber, Account_id_number, 209, tax_info, 1, DateTime.Now);
                                        }
                                    }
                                }
                            }
                        }
                        string service_fee = driver.FindElement(By.XPath("//*[@id='ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_Table2']/tbody/tr[14]/td[1]")).Text;
                        tax_info1 = service_fee + "~" + "" + "~" + "" + "~" + "" + "~" + "";
                        gc.insert_date(orderNumber, Account_id_number, 209, tax_info1, 1, DateTime.Now);
                        string fee = driver.FindElement(By.XPath("//*[@id='ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_Table2']/tbody/tr[14]/td[2]")).Text;
                        tax_info2 = fee + "~" + "" + "~" + "" + "~" + "" + "~" + "";
                        gc.insert_date(orderNumber, Account_id_number, 209, tax_info2, 1, DateTime.Now);
                    }

                    CitytaxTime = DateTime.Now.ToString("HH:mm:ss");

                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "MD", "Baltimore City", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderNumber, "MD", "Baltimore City");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw ex;
                }
            }
        }
Example #24
0
        public string FTP_GAClayton(string houseno, string sname, string unitno, string parcelNumber, string searchType, string orderNumber, string ownername, string directParcel)
        {
            string        StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "", AssessTakenTime = "", TaxTakentime = "", CityTaxtakentime = "";
            string        TotaltakenTime = "";
            string        OwnerName = "", JointOwnerName = "", PropertyAddress = "", MailingAddress = "", Municipality = "", PropertyUse = "", YearBuilt = "", LegalDescription = "", parcel_id = "";
            List <string> strTaxRealestate  = new List <string>();
            List <string> strTaxRealestate1 = new List <string>();

            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            //IWebElement iframeElement1;
            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");

                    if (searchType == "titleflex")
                    {
                        string address = houseno + " " + sname + " " + unitno;
                        gc.TitleFlexSearch(orderNumber, parcelNumber, "", address, "GA", "Clayton");

                        if (HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes")
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_GAClayton"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    driver.Navigate().GoToUrl("https://www.claytoncountyga.gov/government/tax-assessor/property-search-information/real-property-records-search");
                    Thread.Sleep(3000);
                    if (searchType == "address")
                    {
                        IWebElement frame12 = driver.FindElement(By.XPath("//*[@id='Clayton County']"));
                        driver.SwitchTo().Frame(frame12);
                        driver.FindElement(By.Name("StreetName")).SendKeys(sname);
                        driver.FindElement(By.Id("qLocn")).SendKeys(houseno);
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "GA", "Clayton");
                        driver.FindElement(By.Id("btnSrchAddress")).SendKeys(Keys.Enter);
                        Thread.Sleep(4000);
                        gc.CreatePdf_WOP(orderNumber, "Address search result", driver, "GA", "Clayton");
                        afterclick(houseno, sname);
                        if (searchcount1 == 0)
                        {
                            driver.FindElement(By.LinkText("NEXT")).Click();
                            Thread.Sleep(4000);
                            afterclick(houseno, sname);
                            if (searchcount1 == 0)
                            {
                                driver.FindElement(By.LinkText("NEXT")).Click();
                                Thread.Sleep(4000);
                                afterclick(houseno, sname);
                            }
                        }
                    }
                    if (searchType == "parcel")
                    {
                        HttpContext.Current.Session["parcel_GAClayton"] = "Yes";
                        driver.Quit();
                        return("No parcel Search");
                    }
                    if (searchType == "ownername")
                    {
                        HttpContext.Current.Session["owner_GAClayton"] = "Yes";
                        driver.Quit();
                        return("No ownername Search");
                    }
                    //property_details

                    string location = "", district = "", county = "", totalparcel = "", landovr = "", improvementovr = "", value1 = "", value2 = "", comments = "";
                    parcel_id = driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr/td/table[1]/tbody/tr[6]/td[2]")).Text.Trim().Replace("PARCEL ID . . ", "").Replace("-", "");

                    gc.CreatePdf(orderNumber, parcel_id, "property details", driver, "GA", "Clayton");

                    location = driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr/td/table[1]/tbody/tr[7]/td[2]")).Text.Trim().Replace("LOCATION . . ", "");
                    district = driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr/td/table[2]/tbody/tr[1]/td[4]")).Text.Trim().Replace("DISTRICT", "");
                    county   = driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr/td/table[2]/tbody/tr[1]/td[5]")).Text.Trim();
                    if (county.Contains("COUNTY"))
                    {
                        county = county.Replace("COUNTY - ", "");
                    }
                    if (county.Contains("CONELY") || county.Contains("FOREST PARK") || county.Contains("JONESBORO") || county.Contains("LOVEJOY") || county.Contains("MORROW") || county.Contains("REX") || county.Contains("RIVERDALE"))
                    {
                        comments = "Please call to specific city tax collector";
                    }
                    else
                    {
                        comments = "Non City Tax";
                    }
                    string owner1 = driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr/td/table[1]/tbody/tr[6]/td[1]")).Text.Trim();
                    string owner2 = driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr/td/table[1]/tbody/tr[7]/td[1]")).Text.Trim();
                    string owner3 = driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr/td/table[1]/tbody/tr[8]/td[1]")).Text.Trim();
                    OwnerName = owner1 + " " + owner2 + " " + owner3;
                    string Legal1 = driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr/td/table[2]/tbody/tr[1]/td[3]")).Text.Trim();
                    string Legal2 = driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr/td/table[2]/tbody/tr[2]/td[3]")).Text.Trim();
                    string Legal3 = driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr/td/table[2]/tbody/tr[3]/td[3]")).Text.Trim();
                    string Legal4 = driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr/td/table[2]/tbody/tr[3]/td[5]")).Text.Trim();
                    LegalDescription = Legal1 + " " + Legal2 + " " + Legal3 + " " + Legal4;
                    //        Location~Legal Description~District~County~Owner Name~Total Parcel Values~Comments

                    //    assessment details


                    try
                    {
                        //int c = 0;//*[@id="content"]/table/tbody/tr/td/table[9]/tbody
                        for (int c = 1; c < 10; c++)
                        {
                            try
                            {
                                IWebElement         tables1       = driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr/td/table[" + c + "]/tbody"));
                                IList <IWebElement> ITaxRealRowQ1 = tables1.FindElements(By.TagName("tr"));
                                IList <IWebElement> ITaxRealTdQ1;
                                if (tables1.Text.Contains("TOTAL PARCEL VALUES"))
                                {
                                    foreach (IWebElement ItaxReal1 in ITaxRealRowQ1)
                                    {
                                        ITaxRealTdQ1 = ItaxReal1.FindElements(By.TagName("td"));
                                        if (ITaxRealTdQ1.Count == 7 && !ItaxReal1.Text.Contains("TOTAL PARCEL VALUES"))
                                        {
                                            try
                                            {
                                                totalparcel    = ITaxRealTdQ1[0].Text;
                                                landovr        = ITaxRealTdQ1[1].Text;
                                                improvementovr = ITaxRealTdQ1[3].Text;
                                                value1         = ITaxRealTdQ1[5].Text;
                                                value2         = ITaxRealTdQ1[6].Text;
                                            }
                                            catch { }
                                        }
                                    }
                                }
                            }
                            catch { }
                        }
                    }
                    catch (Exception e)
                    {
                    }


                    string property_details = location + "~" + LegalDescription + "~" + district + "~" + county + "~" + OwnerName + "~" + totalparcel + "~" + comments;
                    gc.insert_date(orderNumber, parcel_id, 490, property_details, 1, DateTime.Now);
                    string assessment_details = landovr + "~" + improvementovr + "~" + value1 + "~" + value2;
                    gc.insert_date(orderNumber, parcel_id, 491, assessment_details, 1, DateTime.Now);
                    //Land / OVR~Improvements / OVR~Current Year Value~Prior Year Value

                    IWebElement         element = driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr/td/table[1]/tbody/tr[2]/td/a[3]"));
                    IJavaScriptExecutor js      = driver as IJavaScriptExecutor;
                    js.ExecuteScript("arguments[0].click();", element);
                    Thread.Sleep(6000);
                    gc.CreatePdf(orderNumber, parcel_id, "sales data", driver, "GA", "Clayton");

                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    driver.Navigate().GoToUrl("http://weba.co.clayton.ga.us/tcmsvr/htdocs/indextcm.shtml");

                    Thread.Sleep(4000);
                    driver.FindElement(By.Name("StreetName")).SendKeys(sname);
                    driver.FindElement(By.Id("qLocn")).SendKeys(houseno);
                    gc.CreatePdf(orderNumber, parcel_id, "tax input", driver, "GA", "Clayton");
                    driver.FindElement(By.Id("btnSrchAddress")).SendKeys(Keys.Enter);
                    Thread.Sleep(4000);
                    gc.CreatePdf(orderNumber, parcel_id, "tax info", driver, "GA", "Clayton");
                    aftertaxclick(houseno, sname);
                    if (searchcount == 0)
                    {
                        driver.FindElement(By.LinkText("NEXT")).Click();
                        Thread.Sleep(4000);
                        aftertaxclick(houseno, sname);
                        if (searchcount == 0)
                        {
                            driver.FindElement(By.LinkText("NEXT")).Click();
                            Thread.Sleep(4000);
                            aftertaxclick(houseno, sname);
                        }
                    }


                    //   Tax Payment Details Table:
                    gc.CreatePdf(orderNumber, parcel_id, "Tax Payment Details", driver, "GA", "Clayton");
                    List <string>       data    = new List <string>();
                    IWebElement         tbmulti = driver.FindElement(By.ClassName("apps10"));
                    IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                    IList <IWebElement> TDmulti;
                    int j = 0;
                    foreach (IWebElement row in TRmulti)
                    {
                        if (!row.Text.Contains("TAX YEAR"))
                        {
                            TDmulti = row.FindElements(By.TagName("td"));
                            if (TDmulti.Count == 5 && TDmulti[0].Text.Trim() != "")
                            {
                                j++;
                                string      year          = TDmulti[0].Text;
                                IWebElement ITaxBillCount = TDmulti[0].FindElement(By.TagName("a"));
                                string      strTaxReal    = ITaxBillCount.GetAttribute("href");
                                strTaxRealestate1.Add(strTaxReal);
                                //Tax Year~Bill No~Property Owner~Due Date~Date Paid
                                string tax_payment = TDmulti[0].Text + "~" + TDmulti[1].Text + "~" + TDmulti[2].Text + "~" + TDmulti[3].Text + "~" + TDmulti[4].Text;

                                gc.insert_date(orderNumber, parcel_id, 492, tax_payment, 1, DateTime.Now);
                            }
                        }
                    }
                    //
                    int k = 0;
                    foreach (string real in strTaxRealestate1)
                    {
                        k++;
                        if (k == j)
                        {
                            //current year data
                            string property_location = "", Tax_year = "", billno = "", Date_paid = "", Tax_District = "", Due_date = "", FairMarketValue = "", AssessedValue = "", Exemptions = "", TaxAuthority = "";
                            driver.Navigate().GoToUrl(real);
                            Thread.Sleep(4000);
                            gc.CreatePdf(orderNumber, parcel_id, "Tax Bill Details", driver, "GA", "Clayton");
                            //Tax Bill Details Table:

                            property_location = driver.FindElement(By.XPath(" //*[@id='content']/table/tbody/tr[3]/td/span/em/strong")).Text.Trim();
                            Tax_year          = driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr[5]/td[1]/p[2]")).Text.Trim();
                            billno            = driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr[5]/td[2]/p[2]")).Text.Trim();
                            Date_paid         = driver.FindElement(By.XPath(" //*[@id='content']/table/tbody/tr[5]/td[4]/p[2]")).Text.Trim();
                            Tax_District      = driver.FindElement(By.XPath(" //*[@id='content']/table/tbody/tr[5]/td[5]/p[2]")).Text.Trim();
                            Due_date          = driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr[5]/td[6]/p[2]")).Text.Trim();
                            FairMarketValue   = driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr[8]/td[1]")).Text.Trim();
                            FairMarketValue   = WebDriverTest.After(FairMarketValue, "FAIR MARKET VALUE ").Trim();
                            AssessedValue     = driver.FindElement(By.XPath(" //*[@id='content']/table/tbody/tr[8]/td[2]")).Text.Trim();
                            AssessedValue     = WebDriverTest.After(AssessedValue, "ASSESSED VALUE").Trim();
                            Exemptions        = driver.FindElement(By.XPath(" //*[@id='content']/table/tbody/tr[10]/td[1]")).Text.Trim();
                            Exemptions        = WebDriverTest.After(Exemptions, "EXEMPTIONS").Trim();
                            TaxAuthority      = "Clayton County Administration Annex 3, 2nd Floor 121 South McDonough St. Jonesboro, GA 30236 Tax: (770) 477-3311";

                            //Property located at~Tax Year~Bill No~Date Paid~Tax District~Due date~Fair Market Value~Assessed Value~Exemptions~Tax Authority
                            string tax_bill = property_location + "~" + Tax_year + "~" + billno + "~" + Date_paid + "~" + Tax_District + "~" + Due_date + "~" + FairMarketValue + "~" + AssessedValue + "~" + Exemptions + "~" + TaxAuthority;
                            gc.insert_date(orderNumber, parcel_id, 493, tax_bill, 1, DateTime.Now);
                            //Current Tax Statement Details Table:
                            //Tax Statement~Millage Rate~Tax
                            string balance = "";
                            balance = driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr[41]")).Text;

                            if (!balance.Contains("Delinquent Penalities"))
                            {
                                balance = WebDriverTest.After(balance, "Total balance due:").Trim();
                            }
                            else
                            {
                                string date = DateTime.Now.ToString("MM/dd/yyyy");
                                driver.FindElement(By.Id("date2")).SendKeys(date);
                                driver.FindElement(By.XPath("//*[@id='content']/table/tbody/tr[43]/td[2]/form/input[2]")).SendKeys(Keys.Enter);
                                Thread.Sleep(3000);
                                gc.CreatePdf(orderNumber, parcel_id, "Pay off Details", driver, "GA", "Clayton");
                                string countytax = "", interest = "", deliqpenality = "", fifa = "", amsfee = "", legalfee = "", totaldue = "", payoffdate = "";
                                payoffdate = driver.FindElement(By.XPath("//*[@id='content']/table[2]/tbody/tr[6]/td[3]")).Text;
                                IWebElement         tbmulti12 = driver.FindElement(By.XPath("//*[@id='content']/table[3]/tbody/tr/td[1]/table/tbody"));
                                IList <IWebElement> TRmulti12 = tbmulti12.FindElements(By.TagName("tr"));
                                IList <IWebElement> TDmulti12;
                                int m = 0;
                                foreach (IWebElement row in TRmulti12)
                                {
                                    TDmulti12 = row.FindElements(By.TagName("td"));
                                    if (TDmulti12.Count == 2 && TDmulti12[0].Text.Trim() != "")
                                    {
                                        if (m == 1)
                                        {
                                            countytax = TDmulti12[1].Text;
                                        }
                                        if (m == 2)
                                        {
                                            interest = TDmulti12[1].Text;
                                        }
                                        if (m == 3)
                                        {
                                            deliqpenality = TDmulti12[1].Text;
                                        }
                                        if (m == 4)
                                        {
                                            fifa = TDmulti12[1].Text;
                                        }
                                        if (m == 5)
                                        {
                                            amsfee = TDmulti12[1].Text;
                                        }
                                        if (m == 6)
                                        {
                                            legalfee = TDmulti12[1].Text;
                                        }
                                        if (m == 7)
                                        {
                                            totaldue = TDmulti12[1].Text;
                                        }

                                        m++;
                                    }
                                }
                                //PayOff Date~Due Date~Tax District~County Tax~Interest~Deliquent Penalty~FIFA~AMS Fee~Legal Fee~Total Due
                                string tax_deli = payoffdate + "~" + countytax + "~" + interest + "~" + deliqpenality + "~" + fifa + "~" + amsfee + "~" + legalfee + "~" + totaldue;
                                gc.insert_date(orderNumber, parcel_id, 494, tax_deli, 1, DateTime.Now);
                                driver.Navigate().Back();
                                Thread.Sleep(4000);
                            }
                            IWebElement         tbmulti1 = driver.FindElement(By.ClassName("apps10"));
                            IList <IWebElement> TRmulti1 = tbmulti1.FindElements(By.TagName("tr"));
                            IList <IWebElement> TDmulti1;
                            foreach (IWebElement row in TRmulti1)
                            {
                                TDmulti1 = row.FindElements(By.TagName("td"));
                                if (!row.Text.Contains("Millage Rate") && !row.Text.Contains("FAIR MARKET VALUE"))
                                {
                                    if (TDmulti1.Count == 4 && TDmulti1[0].Text.Trim() != "")
                                    {
                                        string tax_info11 = TDmulti1[0].Text + "~" + TDmulti1[1].Text + "~" + TDmulti1[2].Text;
                                        gc.insert_date(orderNumber, parcel_id, 495, tax_info11, 1, DateTime.Now);
                                    }
                                }
                            }
                            string tax_info1 = "Total Due" + "~" + "" + "~" + balance;
                            gc.insert_date(orderNumber, parcel_id, 495, tax_info1, 1, DateTime.Now);
                        }
                        if (k == (j - 1))
                        {
                            driver.Navigate().GoToUrl(real);
                            Thread.Sleep(2000);
                            gc.CreatePdf(orderNumber, parcel_id, "tax info year", driver, "GA", "Clayton");
                            driver.Navigate().Back();
                            Thread.Sleep(2000);
                        }
                        if (k == (j - 2))
                        {
                            driver.Navigate().GoToUrl(real);
                            Thread.Sleep(2000);
                            gc.CreatePdf(orderNumber, parcel_id, "tax info year1", driver, "GA", "Clayton");
                            driver.Navigate().Back();
                            Thread.Sleep(2000);
                        }
                    }

                    if (county == "RIVERDALE")
                    {
                        driver.Navigate().GoToUrl("https://wipp.edmundsassoc.com/Wipp/?wippid=RDGA");
                        Thread.Sleep(4000);
                        string address = houseno + " " + sname;
                        driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td/div/table/tbody/tr/td/table/tbody/tr[2]/td/table/tbody/tr[2]/td[5]/input")).SendKeys(address);
                        gc.CreatePdf(orderNumber, parcel_id, "city search", driver, "GA", "Clayton");
                        //  gc.CreatePdf_WOP(orderNumber, "city Address search", driver, "GA", "Clayton");
                        driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td/div/table/tbody/tr/td/table/tbody/tr[2]/td/table/tbody/tr[2]/td[6]/button")).SendKeys(Keys.Enter);
                        Thread.Sleep(4000);
                        gc.CreatePdf(orderNumber, parcel_id, "search result", driver, "GA", "Clayton");
                        IWebElement         searchtableElement1 = driver.FindElement(By.XPath("/html/body/div[2]/div/table/tbody/tr[2]/td[2]/div/table/tbody/tr[1]/td/table/tbody"));
                        IList <IWebElement> searchtableRow1     = searchtableElement1.FindElements(By.TagName("tr"));
                        IList <IWebElement> searchrowTD1;
                        // List<string> searchlist1 = new List<string>();
                        // int i1 = 1, p = 0;
                        // string[] parcel = new string[3];
                        foreach (IWebElement row in searchtableRow1)
                        {
                            searchrowTD1 = row.FindElements(By.TagName("td"));
                            if (searchrowTD1.Count != 0)
                            {
                                if (!row.Text.Contains("Property Location"))
                                {
                                    if (row.Text.Contains(address.ToUpper()))
                                    {
                                        IWebElement city = searchrowTD1[0].FindElement(By.TagName("input"));
                                        city.Click();
                                        break;
                                    }
                                }
                            }
                        }
                        Thread.Sleep(4000);
                        gc.CreatePdf(orderNumber, parcel_id, "tax info city", driver, "GA", "Clayton");
                        //Block/Lot/Qual: 1315.1C D 018. Tax Account Id: 2301 Property Location: 6765 POWERS ST Zoning Code: Owner Name/Address: MARTIN HEIDEMARLE Land Value: 4,400 284 HIGHAM HILL RD Improvement Value: 13,715 E175RG Exempt Value: 0 LONDON, . . Total Assessed Value: 18,115 Deductions: None
                        //Block/Lot/Qual~Property Location~Owner Name~Owner Address~Tax Account Id~Zoning Code~Land Value~Improvement Value~Exempt Value~Total Assessed Value~Deductions~City Tax Authority
                        string fulltext = driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td/table/tbody/tr[1]/td/table/tbody/tr/td/table/tbody")).Text.Replace("\r\n", " ");

                        string block = "", PropertyLocation = "", OwnerNameCity = "", OwnerAddress1 = "", OwnerAddress2 = "", OwnerAddress3 = "", TaxAccountId = "", ZoningCode = "", LandValue = "", ImprovementValue = "", ExemptValue = "", TotalAssessedValue = "", Deductions = "", taxaddress = "";

                        block              = gc.Between(fulltext, "Block/Lot/Qual:", "Tax Account Id:");
                        PropertyLocation   = gc.Between(fulltext, "Property Location:", "Zoning Code:");
                        OwnerNameCity      = gc.Between(fulltext, "Owner Name/Address:", "Land Value:");
                        OwnerAddress1      = driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td/table/tbody/tr[1]/td/table/tbody/tr/td/table/tbody/tr[4]/td[2]")).Text;
                        OwnerAddress2      = driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td/table/tbody/tr[1]/td/table/tbody/tr/td/table/tbody/tr[5]/td[2]")).Text;
                        OwnerAddress3      = driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td/table/tbody/tr[1]/td/table/tbody/tr/td/table/tbody/tr[6]/td[2]")).Text;
                        TaxAccountId       = gc.Between(fulltext, "Tax Account Id:", "Property Location:");
                        ZoningCode         = gc.Between(fulltext, "Zoning Code:", "Owner Name/Address:");
                        LandValue          = gc.Between(fulltext, "Land Value:", "Improvement Value:").Split(' ')[1];
                        ImprovementValue   = gc.Between(fulltext, "Improvement Value:", "Exempt Value:").Split(' ')[1];
                        ExemptValue        = gc.Between(fulltext, "Exempt Value:", "Total Assessed Value").Split(' ')[1];
                        TotalAssessedValue = gc.Between(fulltext, "Total Assessed Value:", "Deductions:");
                        Deductions         = GlobalClass.After(fulltext, "Deductions:");
                        OwnerAddress1      = OwnerAddress1 + " " + OwnerAddress2 + " " + OwnerAddress3;
                        string tax_infoCity = block + "~" + PropertyLocation + "~" + OwnerNameCity + "~" + OwnerAddress1 + "~" + TaxAccountId + "~" + ZoningCode + "~" + LandValue + "~" + ImprovementValue + "~" + ExemptValue + "~" + TotalAssessedValue + "~" + Deductions + "~" + "City of Riverdale 6690 Church Street Riverdale, GA 30274 Telephone 770 - 909 - 5501";
                        gc.insert_date(orderNumber, parcel_id, 496, tax_infoCity, 1, DateTime.Now);
                        //
                        //Year~Due Date~Type~Billed~Balance~Interest~Total Due~Status
                        string msg         = "";
                        string lastpayment = driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td/table/tbody/tr[3]/td/table/tbody/tr[2]/td/div/div/table/tbody/tr[3]/td/table/tbody")).Text.Replace("\r\n", " ");
                        lastpayment = GlobalClass.After(lastpayment, "Last Payment:");
                        IWebElement         tbmulti1 = driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td/table/tbody/tr[3]/td/table/tbody/tr[2]/td/div/div/table/tbody/tr[2]/td/table/tbody"));
                        IList <IWebElement> TRmulti1 = tbmulti1.FindElements(By.TagName("tr"));
                        IList <IWebElement> TDmulti1;
                        foreach (IWebElement row in TRmulti1)
                        {
                            TDmulti1 = row.FindElements(By.TagName("td"));
                            if (!row.Text.Contains("Year"))
                            {
                                if (TDmulti1.Count != 0 && TDmulti1[0].Text.Trim() != "")
                                {
                                    string tax_city1 = TDmulti1[0].Text + "~" + TDmulti1[1].Text + "~" + TDmulti1[2].Text + "~" + TDmulti1[3].Text + "~" + TDmulti1[5].Text + "~" + TDmulti1[6].Text + "~" + TDmulti1[7].Text + "~" + TDmulti1[8].Text;
                                    gc.insert_date(orderNumber, parcel_id, 834, tax_city1, 1, DateTime.Now);
                                    if (!TDmulti1[6].Text.Contains("0.00"))
                                    {
                                        msg = "For tax amount due, you must call the Collector's Office";
                                    }
                                }
                            }
                        }
                        string tax_city = "Last Payment" + "~" + lastpayment + "~" + msg + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "";
                        gc.insert_date(orderNumber, parcel_id, 834, tax_city, 1, DateTime.Now);
                    }


                    TaxTime     = DateTime.Now.ToString("HH:mm:ss");
                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "GA", "Clayton", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    GlobalClass.titleparcel = "";
                    gc.mergpdf(orderNumber, "GA", "Clayton");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    throw ex;
                }
            }
        }
Example #25
0
        public string FTP_placer(string houseno, string sname, string assessment_id, string parcelNumber, string searchType, string orderNumber, string directParcel)
        {
            string address1 = "", Assess = "", fee_parcel = "", Tra = "";
            string Assessment = "", Parcel_Number = "", Roll_Category = "", Address = "", Tax_year = "", First_Installment_Paid_Status = "", First_Installment_Paid_Date = "", First_Installment_Total_Due = "", First_Installment_Total_Paid = "", First_Installment_Balance = "", Second_Installment_Paid_Status = "", Second_Installment_Paid_Date = "", Second_Installment_Total_Due = "", Second_Installment_Total_Paid = "", Second_Installment_Balance = "", FirstandSecondInstallment_Total_Due = "", FirstandSecondInstallment_Total_Paid = "", FirstandSecondInstallment_Total_Balance = "";
            string roll_cat = "";
            string Assessor_ID_Number = "", Tax_Rate_Area = "", Situs_Address = "", Acres = "", Lot_Size = "", Asmt_Description = "", Year_Built = "";
            string ASMT = "", PARCEL = "", YEAR = "", Default_Number = "", Pay_Plan_in_Effect = "", Annual_Payment = "", Balance = "";
            string tax_add1, tax_add2, tax_add3, tax_add;

            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";
            string address       = houseno + " " + sname;
            var    driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            //driver = new PhantomJSDriver();
            //driver = new ChromeDriver();
            using (driver = new PhantomJSDriver())
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");

                    driver.Navigate().GoToUrl("https://www.placer.ca.gov/departments/assessor/assessment-inquiry");
                    Thread.Sleep(4000);
                    driver.FindElement(By.Id("agreeyes")).Click();
                    Thread.Sleep(4000);

                    IWebElement iframeElement = driver.FindElement(By.XPath("//*[@id='remoteform']/iframe"));
                    driver.SwitchTo().Frame(iframeElement);
                    Thread.Sleep(2000);


                    if (searchType == "titleflex")
                    {
                        gc.TitleFlexSearch(orderNumber, parcelNumber, "", address, "CA", "Placer");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_CAPlacer"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }


                    if (searchType == "address")
                    {
                        var Select         = driver.FindElement(By.Id("idSitus"));
                        var selectElement1 = new SelectElement(Select);
                        selectElement1.SelectByText("Begins with");
                        driver.FindElement(By.XPath("/html/body/form/table/tbody/tr[4]/td[3]/input")).SendKeys(address);
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "CA", "Placer");
                        driver.FindElement(By.XPath("/html/body/form/p/input[1]")).SendKeys(Keys.Enter);
                        gc.CreatePdf_WOP(orderNumber, "Address search result", driver, "CA", "Placer");
                        Thread.Sleep(6000);

                        IWebElement         tbmulti = driver.FindElement(By.XPath("/html/body/form/table/tbody"));
                        IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                        int l = 0;
                        if (TRmulti.Count > 6)
                        {
                            IList <IWebElement> TDmulti;
                            foreach (IWebElement row in TRmulti)
                            {
                                if (l <= 25)
                                {
                                    if (!row.Text.Contains("Asmt"))
                                    {
                                        TDmulti = row.FindElements(By.TagName("td"));
                                        if (TDmulti.Count == 3 && TDmulti[0].Text.Trim() != "")
                                        {
                                            Assess     = TDmulti[0].Text;
                                            fee_parcel = TDmulti[1].Text;
                                            Tra        = TDmulti[2].Text;
                                        }
                                        if (TDmulti.Count == 1 && TDmulti[0].Text.Trim() != "")
                                        {
                                            address1 = TDmulti[0].Text;
                                            string multi1 = Assess + "~" + fee_parcel + "~" + Tra + "~" + address1;
                                            gc.insert_date(orderNumber, fee_parcel, 180, multi1, 1, DateTime.Now);
                                        }
                                    }
                                    l++;
                                }
                            }

                            if (TRmulti.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_Placer_Multicount"] = "Maximum";
                            }
                            else
                            {
                                HttpContext.Current.Session["multiParcel_Placer"] = "Yes";
                            }
                            driver.Quit();
                            gc.mergpdf(orderNumber, "CA", "Placer");
                            return("MultiParcel");
                        }
                    }


                    else if (searchType == "parcel")
                    {
                        var Select         = driver.FindElement(By.Id("idfeeparcel"));
                        var selectElement1 = new SelectElement(Select);
                        selectElement1.SelectByText("Begins with");

                        if (parcelNumber.Contains("-"))
                        {
                            parcelNumber = parcelNumber.Replace("-", "");
                        }

                        string a = parcelNumber.Substring(0, 3);
                        string b = parcelNumber.Substring(3, 3);
                        string c = parcelNumber.Substring(6, 3);
                        string d = parcelNumber.Substring(9, 3);
                        parcelNumber = a + "-" + b + "-" + c + "-" + d;
                        driver.FindElement(By.XPath("/html/body/form/table/tbody/tr[2]/td[3]/input")).SendKeys(parcelNumber);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search", driver, "CA", "Placer");
                        driver.FindElement(By.XPath("/html/body/form/p/input[1]")).SendKeys(Keys.Enter);
                    }

                    else if (searchType == "block")
                    {
                        var Select         = driver.FindElement(By.Id("idasmt"));
                        var selectElement1 = new SelectElement(Select);
                        selectElement1.SelectByText("Begins with");


                        if (assessment_id.Contains("-"))
                        {
                            assessment_id = assessment_id.Replace("-", "");
                        }

                        string a = assessment_id.Substring(0, 3);
                        string b = assessment_id.Substring(3, 3);
                        string c = assessment_id.Substring(6, 3);
                        string d = assessment_id.Substring(9, 3);
                        assessment_id = a + "-" + b + "-" + c + "-" + d;
                        driver.FindElement(By.XPath("/html/body/form/table/tbody/tr[3]/td[3]/input")).SendKeys(assessment_id);
                        gc.CreatePdf_WOP(orderNumber, "Assessment search result", driver, "CA", "Placer");
                        driver.FindElement(By.XPath("/html/body/form/p/input[1]")).SendKeys(Keys.Enter);
                    }

                    Thread.Sleep(6000);


                    IWebElement runButton = driver.FindElement(By.XPath("/html/body/form/table/tbody/tr[2]/td[1]/a"));
                    runButton.Click();
                    Thread.Sleep(4000);

                    //property details

                    string fulltabletext = driver.FindElement(By.XPath(" /html/body/form/table/tbody")).Text.Trim().Replace("\r\n", " ");
                    string Land = "", Structure = "", Fixtures = "", Growing = "", TotalLand_and_Improvements = "", Manufactured_Home = "", Personal_Property = "", Homeowners_Exemption = "", Other_Exemption = "", Net_Assessment = "";

                    Assessor_ID_Number = gc.Between(fulltabletext, "Assessor ID Number", "Tax Rate Area").Trim();
                    gc.CreatePdf(orderNumber, Assessor_ID_Number, "Assessment search result", driver, "CA", "Placer");
                    Tax_Rate_Area = gc.Between(fulltabletext, "Tax Rate Area (TRA)", "Last Recording Date").Trim();
                    Situs_Address = gc.Between(fulltabletext, "Situs Address", "Acres").Trim();

                    Acres            = gc.Between(fulltabletext, "Acres", "Lot Size").Trim();
                    Lot_Size         = gc.Between(fulltabletext, "Lot Size(SqFt)", "Asmt Description").Trim();
                    Asmt_Description = gc.Between(fulltabletext, "Asmt Description", "Asmt Status").Trim();
                    Year_Built       = gc.Between(fulltabletext, "Year Built", "Bedrooms").Trim();


                    string prop = Tax_Rate_Area + "~" + Situs_Address + "~" + Acres + "~" + Lot_Size + "~" + Asmt_Description + "~" + Year_Built;

                    gc.insert_date(orderNumber, Assessor_ID_Number, 155, prop, 1, DateTime.Now);

                    //Assessment details
                    Land = gc.Between(fulltabletext, "Land", "Structure").Trim();

                    Structure = gc.Between(fulltabletext, "Structure", "Fixtures").Trim();
                    Fixtures  = gc.Between(fulltabletext, "Fixtures", "Growing").Trim();
                    Growing   = gc.Between(fulltabletext, "Growing", "Total Land and Improvements").Trim();
                    TotalLand_and_Improvements = gc.Between(fulltabletext, "Total Land and Improvements", "Manufactured Home").Trim();
                    Manufactured_Home          = gc.Between(fulltabletext, "Manufactured Home", "Personal Property").Trim();
                    Personal_Property          = gc.Between(fulltabletext, "Personal Property", "Homeowners Exemption").Trim();
                    Homeowners_Exemption       = gc.Between(fulltabletext, "Homeowners Exemption", "Other Exemption").Trim();
                    Other_Exemption            = gc.Between(fulltabletext, "Other Exemption", "Net Assessment").Trim();
                    Net_Assessment             = gc.Between(fulltabletext, "Net Assessment", "Building Description(s)").Trim();

                    string assess = Land + "~" + Structure + "~" + Fixtures + "~" + Growing + "~" + TotalLand_and_Improvements + "~" + Manufactured_Home + "~" + Personal_Property + "~" + Homeowners_Exemption + "~" + Other_Exemption + "~" + Net_Assessment;
                    gc.insert_date(orderNumber, Assessor_ID_Number, 157, assess, 1, DateTime.Now);
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    //Tax details
                    driver.Navigate().GoToUrl("https://common3.mptsweb.com/mbc/placer/tax/search");

                    for (int k = 1; k < 4; k++)
                    {
                        if (k == 1)
                        {
                            //select year
                            var year           = driver.FindElement(By.Id("SelTaxYear"));
                            var selectElement1 = new SelectElement(year);
                            selectElement1.SelectByIndex(0);
                            //searchBy
                            var searchby       = driver.FindElement(By.Id("SearchVal"));
                            var selectElement2 = new SelectElement(searchby);
                            selectElement2.SelectByText("FEE PARCEL");
                            driver.FindElement(By.XPath("//*[@id='SearchValue']")).SendKeys(Assessor_ID_Number);
                            driver.FindElement(By.XPath("//*[@id='SearchSubmit']")).SendKeys(Keys.Enter);
                            Thread.Sleep(3000);
                            gc.CreatePdf(orderNumber, Assessor_ID_Number, "Tax search", driver, "CA", "Placer");
                        }

                        else if (k == 2)
                        {
                            //select year
                            var year           = driver.FindElement(By.Id("SelTaxYear"));
                            var selectElement1 = new SelectElement(year);
                            selectElement1.SelectByIndex(1);
                            //searchBy
                            var searchby       = driver.FindElement(By.Id("SearchVal"));
                            var selectElement2 = new SelectElement(searchby);
                            selectElement2.SelectByText("FEE PARCEL");
                            driver.FindElement(By.XPath("//*[@id='SearchSubmit']")).SendKeys(Keys.Enter);
                            Thread.Sleep(3000);
                            gc.CreatePdf(orderNumber, Assessor_ID_Number, "Tax search1", driver, "CA", "Placer");
                        }

                        else if (k == 3)
                        {
                            //select year
                            var year           = driver.FindElement(By.Id("SelTaxYear"));
                            var selectElement1 = new SelectElement(year);
                            selectElement1.SelectByIndex(2);
                            //searchBy
                            var searchby       = driver.FindElement(By.Id("SearchVal"));
                            var selectElement2 = new SelectElement(searchby);
                            selectElement2.SelectByText("FEE PARCEL");
                            driver.FindElement(By.XPath("//*[@id='SearchSubmit']")).SendKeys(Keys.Enter);
                            Thread.Sleep(3000);
                            gc.CreatePdf(orderNumber, Assessor_ID_Number, "Tax search2", driver, "CA", "Placer");
                        }

                        int j;
                        //Current Tax Details Table
                        try
                        {
                            int divCount = driver.FindElements(By.XPath("//*[@id='ResultDiv']/div")).Count;
                            for (j = 1; j <= divCount; j++)
                            {
                                IWebElement Itaxstmt = driver.FindElement(By.XPath("//*[@id='ResultDiv']/div[" + j + "]/div/div/div/a"));
                                string      stmt1    = Itaxstmt.GetAttribute("href");
                                strTaxRealestate1.Add(stmt1);
                            }
                        }
                        catch { }
                    }
                    foreach (string real in strTaxRealestate1)
                    {
                        driver.Navigate().GoToUrl(real);
                        Thread.Sleep(4000);
                        tax_add1 = driver.FindElement(By.XPath(" //*[@id='footer']/div[1]/div/div[1]/div[2]/div/ul/li[2]")).Text;
                        tax_add2 = driver.FindElement(By.XPath("//*[@id='footer']/div[1]/div/div[1]/div[2]/div/ul/li[3]")).Text;
                        tax_add3 = driver.FindElement(By.XPath("//*[@id='footer']/div[1]/div/div[1]/div[2]/div/ul/li[4]")).Text;
                        tax_add  = tax_add1 + " " + tax_add2 + " " + tax_add3;

                        string pdfassess         = driver.FindElement(By.XPath(" /html/body/div[2]/section/div/div/div/div[6]/div/div[1]/div[1]/div[2]")).Text;
                        string pdfyear           = driver.FindElement(By.XPath("/html/body/div[2]/section/div/div/div/div[6]/div/div[1]/div[3]/div[2]")).Text;
                        string pdf               = pdfassess + " " + pdfyear;
                        string fulltabletextTax1 = driver.FindElement(By.XPath("//*[@id='h2tab1']/div[1]/div[1]/dl")).Text.Trim().Replace("\r\n", "");
                        if (fulltabletextTax1.Contains("Delinq. Date"))
                        {
                            First_Installment_Paid_Status = gc.Between(fulltabletextTax1, "Paid Status", "Delinq. Date").Trim();
                            First_Installment_Paid_Date   = gc.Between(fulltabletextTax1, "Delinq. Date", "Total Due").Trim();
                        }
                        else
                        {
                            First_Installment_Paid_Status = gc.Between(fulltabletextTax1, "Paid Status", "Paid Date").Trim();
                            First_Installment_Paid_Date   = gc.Between(fulltabletextTax1, "Paid Date", "Total Due").Trim();
                        }
                        First_Installment_Total_Due  = gc.Between(fulltabletextTax1, "Total Due", "Total Paid").Trim();
                        First_Installment_Total_Paid = gc.Between(fulltabletextTax1, "Total Paid", "Balance").Trim();
                        First_Installment_Balance    = WebDriverTest.After(fulltabletextTax1, "Balance");

                        string fulltabletextTax2 = driver.FindElement(By.XPath("//*[@id='h2tab1']/div[1]/div[2]/dl")).Text.Trim().Replace("\r\n", "");
                        if (fulltabletextTax2.Contains("Delinq. Date"))
                        {
                            Second_Installment_Paid_Status = gc.Between(fulltabletextTax2, "Paid Status", "Delinq. Date").Trim();
                            Second_Installment_Paid_Date   = gc.Between(fulltabletextTax2, "Delinq. Date", "Total Due").Trim();
                        }
                        else
                        {
                            Second_Installment_Paid_Status = gc.Between(fulltabletextTax2, "Paid Status", "Paid Date").Trim();
                            Second_Installment_Paid_Date   = gc.Between(fulltabletextTax2, "Paid Date", "Total Due").Trim();
                        }
                        Second_Installment_Total_Due  = gc.Between(fulltabletextTax2, "Total Due", "Total Paid").Trim();
                        Second_Installment_Total_Paid = gc.Between(fulltabletextTax2, "Total Paid", "Balance").Trim();
                        Second_Installment_Balance    = WebDriverTest.After(fulltabletextTax2, "Balance");

                        string fulltabletextTax3 = driver.FindElement(By.XPath("//*[@id='h2tab1']/div[2]/dl")).Text.Trim().Replace("\r\n", "");
                        FirstandSecondInstallment_Total_Due     = gc.Between(fulltabletextTax3, "Total Due", "Total Paid").Trim();
                        FirstandSecondInstallment_Total_Paid    = gc.Between(fulltabletextTax3, "Total Paid", "Total Balance").Trim();
                        FirstandSecondInstallment_Total_Balance = WebDriverTest.After(fulltabletextTax3, "Total Balance");

                        gc.CreatePdf(orderNumber, Assessor_ID_Number, "Taxes" + pdf, driver, "CA", "Placer");
                        driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/ul/li[2]/a")).Click();
                        Thread.Sleep(3000);
                        gc.CreatePdf(orderNumber, Assessor_ID_Number, "Assess info" + pdf, driver, "CA", "Placer");
                        string fulltabletextTax4 = driver.FindElement(By.XPath("//*[@id='h2tab2']/dl")).Text.Trim().Replace("\r\n", "");
                        string assessment        = gc.Between(fulltabletextTax4, "Assessment", "Taxyear").Trim();
                        Tax_year      = gc.Between(fulltabletextTax4, "Taxyear", "Parcel Number").Trim();
                        Roll_Category = gc.Between(fulltabletextTax4, "Roll Category", "Doc Num").Trim();
                        Address       = WebDriverTest.After(fulltabletextTax4, "Address");

                        string tax = assessment + "~" + Roll_Category + "~" + Address + "~" + Tax_year + "~" + First_Installment_Paid_Status + "~" + First_Installment_Paid_Date + "~" + First_Installment_Total_Due + "~" + First_Installment_Total_Paid + "~" + First_Installment_Balance + "~" + Second_Installment_Paid_Status + "~" + Second_Installment_Paid_Date + "~" + Second_Installment_Total_Due + "~" + Second_Installment_Total_Paid + "~" + Second_Installment_Balance + "~" + FirstandSecondInstallment_Total_Due + "~" + FirstandSecondInstallment_Total_Paid + "~" + FirstandSecondInstallment_Total_Balance + "~" + tax_add;
                        gc.insert_date(orderNumber, Assessor_ID_Number, 165, tax, 1, DateTime.Now);

                        //      Assessment~Roll Category~Address~Tax year~First Installment Paid Status~First Installment Paid Date~First Installment Total Due~First Installment Total Paid~First Installment Balance~Second Installment Paid Status~Second Installment Paid Date~Second Installment Total Due~Second Installment Total Paid~Second Installment Balance~First and Second Installment Total Due~First and Second Installment Total Paid~First and Second Installment Total Balance

                        //download taxbill

                        IWebElement Itaxbill = driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/div/div[1]/div[4]/div/a"));
                        string      URL1     = Itaxbill.GetAttribute("href");
                        gc.downloadfile(URL1, orderNumber, Assessor_ID_Number, "TaxBill" + pdf, "CA", "Placer");


                        //Tax Year~Tax Code~Description~Rate~1st Installment~2nd Installment~Total~Phone

                        //Default Tax
                        try
                        {
                            driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/ul/li[4]/a")).Click();
                            Thread.Sleep(3000);
                            gc.CreatePdf(orderNumber, Assessor_ID_Number, "Default Tax" + pdf, driver, "CA", "Placer");

                            Default_Number     = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[1]/div[2]")).Text;
                            Pay_Plan_in_Effect = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[2]/div[2]")).Text;
                            Annual_Payment     = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[3]/div[2]")).Text;
                            Balance            = driver.FindElement(By.XPath("//*[@id='h2tab4']/div[2]/div[4]/div[2]")).Text;
                            string default_tax = assessment + "~" + Tax_year + "~" + Default_Number + "~" + Pay_Plan_in_Effect + "~" + Annual_Payment + "~" + Balance;
                            //  string default_tax = Tax_year + "~" + Default_Number + "~" + Pay_Plan_in_Effect + "~" + Annual_Payment + "~" + Balance;
                            gc.insert_date(orderNumber, Assessor_ID_Number, 166, default_tax, 1, DateTime.Now);
                        }
                        //Tax Year~Default Number~Pay Plan in Effect~Annual Payment~Balance
                        catch { }
                    }

                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "CA", "Placer", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    driver.Dispose();
                    gc.mergpdf(orderNumber, "CA", "Placer");
                    return("Data Inserted Successfully");
                }

                catch (Exception ex)
                {
                    driver.Quit();
                    driver.Dispose();
                    throw ex;
                }
            }
        }
        public string FTP_Douglas(string houseno, string sname, string ownername, string assessment_id, string parcelNumber, string searchType, string orderNumber, string directParcel)
        {
            GlobalClass gc = new GlobalClass();
            string      Parcel_ID = "", Account_Number = "", Owner_Name = "", Property_Address = "", Mailing_Address = "", Property_Type = "", Year_Built = "", Legal_Description = "";
            string      IstInstallment = "", IIndInstallment = "";

            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            string Account = "", Owner = "", Address = "";

            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";
            string address       = houseno + " " + sname;
            var    driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            //driver = new PhantomJSDriver();
            var option = new ChromeOptions();

            option.AddArgument("No-Sandbox");
            using (driver = new ChromeDriver(option))
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");

                    if (searchType == "titleflex")
                    {
                        gc.TitleFlexSearch(orderNumber, parcelNumber, "", address, "CO", "Douglas");

                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Douglas_Zero"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    driver.Navigate().GoToUrl("https://www.douglas.co.us/assessor/#/");
                    Thread.Sleep(4000);
                    if (searchType == "address")
                    {
                        //*[@id="#SearchBar"]/div[1]/div[1]/button

                        IWebElement         ISpan112 = driver.FindElement(By.XPath("//*[@id='#SearchBar']/div[1]/div[1]/button"));
                        IJavaScriptExecutor js112    = driver as IJavaScriptExecutor;
                        js112.ExecuteScript("arguments[0].click();", ISpan112);
                        //*[@id="#SearchBar"]/div[1]/div[1]/ul/li[2]/a
                        IWebElement         ISpan12 = driver.FindElement(By.XPath("//*[@id='#SearchBar']/div[1]/div[1]/ul/li[2]/a"));
                        IJavaScriptExecutor js12    = driver as IJavaScriptExecutor;
                        js12.ExecuteScript("arguments[0].click();", ISpan12);

                        //driver.FindElement(By.XPath("//*[@id='#SearchBar']/div[1]/div[1]/button")).SendKeys(Keys.Enter);
                        //Thread.Sleep(3000);
                        //driver.FindElement(By.XPath("//*[@id='#SearchBar']/div[1]/div[1]/ul/li[2]")).Click();
                        //Thread.Sleep(1000);

                        driver.FindElement(By.XPath("//*[@id='SearchBar']/input")).Clear();
                        driver.FindElement(By.XPath("//*[@id='SearchBar']/input")).SendKeys(address);
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "CO", "Douglas");

                        IWebElement         ISpan13 = driver.FindElement(By.XPath("//*[@id='#SearchBar']/div[1]/div[3]/button[2]"));
                        IJavaScriptExecutor js13    = driver as IJavaScriptExecutor;
                        js13.ExecuteScript("arguments[0].click();", ISpan13);
                        Thread.Sleep(10000);
                        //driver.FindElement(By.XPath("//*[@id='#SearchBar']/div[1]/div[3]/button[2]")).Click();
                        //    Thread.Sleep(8000);
                        try
                        {
                            string Nodata1 = driver.FindElement(By.XPath("//*[@id='assessor-search']/div/wp/app-home/div[1]/div")).Text;
                            if (Nodata1.Contains("There were no results"))
                            {
                                HttpContext.Current.Session["Douglas_Zero"] = "Zero";
                                return("No Data Found");
                            }
                        }
                        catch { }
                        gc.CreatePdf_WOP(orderNumber, "Address search result1", driver, "CO", "Douglas");

                        try
                        {
                            string multi      = driver.FindElement(By.XPath("//*[@id='assessor-search']/div/wp/home/div[2]/div[3]")).Text;
                            string multiCount = gc.Between(multi, "\r\n", " results");


                            if (multiCount != "1")
                            {
                                //multi parcel
                                IWebElement         tbmulti2 = driver.FindElement(By.XPath("//*[@id='assessor-search']/div/wp/home/div[1]/div[1]"));
                                IList <IWebElement> TRmulti2 = tbmulti2.FindElements(By.TagName("a"));
                                int maxCheck = 0;
                                IList <IWebElement> TDmulti2;
                                string[]            parcel = new string[3]; int p = 0;
                                foreach (IWebElement row in TRmulti2)
                                {
                                    if (maxCheck <= 25)
                                    {
                                        if (row.Text.Contains(address.ToUpper()))
                                        {
                                            TDmulti2 = row.FindElements(By.TagName("div"));
                                            if (TDmulti2.Count != 0)
                                            {
                                                if (p == 0)
                                                {
                                                    parcel[0] = TDmulti2[0].Text;
                                                }
                                                if (p == 1)
                                                {
                                                    parcel[1] = TDmulti2[0].Text;
                                                }
                                                if (p == 2)
                                                {
                                                    parcel[2] = TDmulti2[0].Text;
                                                }
                                                p++;
                                                string multi1 = TDmulti2[1].Text + "~" + TDmulti2[2].Text;
                                                gc.insert_date(orderNumber, TDmulti2[0].Text, 283, multi1, 1, DateTime.Now);
                                                maxCheck++;
                                            }
                                        }
                                    }
                                }
                                if (maxCheck == 0)
                                {
                                    if (Convert.ToInt32(multiCount) > 25)
                                    {
                                        HttpContext.Current.Session["multiParcel_Douglas_Count"] = "Maximum";
                                        return("Maximum");
                                    }
                                }


                                if (maxCheck == 1)
                                {
                                    IWebElement         element5 = driver.FindElement(By.XPath("//*[@id='assessor-search']/div/wp/home/div[1]/div[1]/a[1]"));
                                    IJavaScriptExecutor js5      = driver as IJavaScriptExecutor;
                                    js5.ExecuteScript("arguments[0].click();", element5);
                                    Thread.Sleep(3000);
                                }

                                try
                                {
                                    driver.FindElement(By.XPath("//*[@id='assessor-search']/div/wp/home/div[2]/div[1]/button")).Click();
                                    driver.FindElement(By.XPath("//*[@id='assessor-search']/div/wp/home/div[2]/div[1]/ul/li[3]/a")).Click();
                                }
                                catch { }
                            }
                        }
                        catch { }

                        try
                        {
                            if (driver.FindElement(By.XPath("//*[@id='assessor-search']/div/wp/home/div[2]/div[3]")).Displayed)
                            {
                                for (int i = 1; i <= 25; i++)
                                {
                                    try
                                    {
                                        Account = driver.FindElement(By.XPath("//*[@id='assessor-search']/div/wp/home/div[1]/div[1]/a[" + i + "]/div[1]")).Text;
                                        Owner   = driver.FindElement(By.XPath("//*[@id='assessor-search']/div/wp/home/div[1]/div[1]/a[" + i + "]/div[2]")).Text;
                                        Address = driver.FindElement(By.XPath("//*[@id='assessor-search']/div/wp/home/div[1]/div[1]/a[" + i + "]/div[3]")).Text;
                                        string multi_parcel = Owner + "~" + Address;
                                        gc.insert_date(orderNumber, Account, 231, multi_parcel, 1, DateTime.Now);
                                    }
                                    catch { }
                                }
                                HttpContext.Current.Session["multiParcel_Douglas"] = "Yes";

                                driver.Quit();
                                //gc.mergpdf(orderNumber, "CO", "Douglas");
                                return("MultiParcel");
                            }
                        }
                        catch { }
                    }
                    else if (searchType == "parcel")
                    {
                        driver.FindElement(By.XPath("//*[@id='#SearchBar']/div[1]/div[1]/button")).Click();
                        Thread.Sleep(3000);
                        driver.FindElement(By.XPath("//*[@id='#SearchBar']/div[1]/div[1]/ul/li[5]")).Click();
                        Thread.Sleep(1000);

                        if (parcelNumber.Contains("-"))
                        {
                            parcelNumber = parcelNumber.Replace("-", "");
                        }
                        driver.FindElement(By.XPath("//*[@id='SearchBar']/input")).SendKeys(parcelNumber);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search", driver, "CO", "Douglas");
                        driver.FindElement(By.XPath("//*[@id='#SearchBar']/div[1]/div[3]/button[2]")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search result", driver, "CO", "Douglas");
                    }
                    else if (searchType == "block")
                    {
                        driver.FindElement(By.XPath("//*[@id='#SearchBar']/div[1]/div[1]/button")).Click();
                        Thread.Sleep(3000);
                        driver.FindElement(By.XPath("//*[@id='#SearchBar']/div[1]/div[1]/ul/li[4]")).Click();
                        Thread.Sleep(1000);
                        driver.FindElement(By.XPath("//*[@id='SearchBar']/input")).SendKeys(assessment_id);
                        gc.CreatePdf_WOP(orderNumber, "Account search", driver, "CO", "Douglas");
                        driver.FindElement(By.XPath("//*[@id='#SearchBar']/div[1]/div[3]/button[2]")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        gc.CreatePdf_WOP(orderNumber, "Account search result", driver, "CO", "Douglas");
                    }
                    else if (searchType == "ownername")
                    {
                        driver.FindElement(By.XPath("//*[@id='#SearchBar']/div[1]/div[1]/button")).Click();
                        Thread.Sleep(3000);
                        driver.FindElement(By.XPath("//*[@id='#SearchBar']/div[1]/div[1]/ul/li[3]")).Click();
                        Thread.Sleep(1000);
                        driver.FindElement(By.XPath("//*[@id='SearchBar']/input")).SendKeys(ownername);
                        gc.CreatePdf_WOP(orderNumber, "Owner search", driver, "CO", "Douglas");
                        driver.FindElement(By.XPath("//*[@id='#SearchBar']/div[1]/div[3]/button[2]")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        gc.CreatePdf_WOP(orderNumber, "Owner search result", driver, "CO", "Douglas");

                        try
                        {
                            string multi      = driver.FindElement(By.XPath("//*[@id='assessor-search']/div/wp/home/div[2]/div[3]")).Text;
                            string multiCount = gc.Between(multi, "\r\n", " results");
                            if (Convert.ToInt32(multiCount) > 25)
                            {
                                HttpContext.Current.Session["multiParcel_Douglas_Count"] = "Maximum";
                                return("Maximum");
                            }


                            try
                            {
                                driver.FindElement(By.XPath("//*[@id='assessor-search']/div/wp/home/div[2]/div[1]/button")).Click();
                                driver.FindElement(By.XPath("//*[@id='assessor-search']/div/wp/home/div[2]/div[1]/ul/li[3]/a")).Click();
                            }
                            catch { }
                        }
                        catch { }


                        try
                        {
                            if (driver.FindElement(By.XPath("//*[@id='assessor-search']/div/wp/home/div[2]/div[3]")).Displayed)
                            {
                                for (int i = 1; i <= 25; i++)
                                {
                                    try
                                    {
                                        Account = driver.FindElement(By.XPath("//*[@id='assessor-search']/div/wp/home/div[1]/div[1]/a[" + i + "]/div[1]")).Text;
                                        Owner   = driver.FindElement(By.XPath("//*[@id='assessor-search']/div/wp/home/div[1]/div[1]/a[" + i + "]/div[2]")).Text;
                                        Address = driver.FindElement(By.XPath("//*[@id='assessor-search']/div/wp/home/div[1]/div[1]/a[" + i + "]/div[3]")).Text;
                                        string multi_parcel = Owner + "~" + Address;
                                        gc.insert_date(orderNumber, Account, 231, multi_parcel, 1, DateTime.Now);
                                    }
                                    catch { }
                                }
                                HttpContext.Current.Session["multiParcel_Douglas"] = "Yes";

                                driver.Quit();
                                //gc.mergpdf(orderNumber, "CO", "Douglas");
                                return("MultiParcel");
                            }
                        }
                        catch { }
                    }

                    //property details
                    Owner_Name = driver.FindElement(By.XPath("/html/body/app-root/div/div[3]/app-details/div[2]/div[1]/div[1]/overview/div[1]/div/div[1]/div/div[2]")).Text;

                    Parcel_ID = driver.FindElement(By.XPath("//*[@id='StickyInfo']/span[2]")).Text;
                    Parcel_ID = WebDriverTest.After(Parcel_ID, "Parcel #:").Trim();
                    //  Parcel_ID = Parcel_ID.Replace("-", "");
                    Account_Number = driver.FindElement(By.XPath("//*[@id='StickyInfo']/span[1]")).Text;
                    Account_Number = WebDriverTest.After(Account_Number, "Account #:").Trim();
                    //Owner_Name = driver.FindElement(By.XPath("/html/body/app/div/div[3]/parceldetails/div[2]/div[1]/div[1]/overview/div[1]/div/div[1]/div/div[2]")).Text;
                    ///html/body/app/div/div[3]/parceldetails/div[2]/div[1]/div[1]/overview/div[1]/div/div[1]/h3
                    Property_Address = driver.FindElement(By.XPath("/html/body/app-root/div/div[3]/app-details/div[2]/div[1]/div[1]/overview/div[1]/div/div[1]/div/div[3]/span")).Text;
                    Property_Address = Property_Address.Replace("\r\n", " ");
                    try
                    {
                        Mailing_Address = driver.FindElement(By.XPath("/html/body/app/div/div[3]/parceldetails/div[2]/div[1]/div[1]/overview/div[1]/div/div[1]/div/div[3]/span")).Text;
                        Mailing_Address = Mailing_Address.Replace("\r\n", " ");
                    }
                    catch
                    { }
                    IWebElement         ISpan1 = driver.FindElement(By.XPath("/html/body/app-root/div/div[3]/app-details/div[2]/div[3]/div[1]/span[1]"));
                    IJavaScriptExecutor js1    = driver as IJavaScriptExecutor;
                    js1.ExecuteScript("arguments[0].click();", ISpan1);

                    ByVisibleElement(driver.FindElement(By.XPath("//*[@id='SummaryAccountInfo']/span")));

                    gc.CreatePdf(orderNumber, Parcel_ID, "assessment1", driver, "CO", "Douglas");

                    ByVisibleElement(driver.FindElement(By.XPath("//*[@id='ValuationInfo']/span")));

                    gc.CreatePdf(orderNumber, Parcel_ID, "Expand All", driver, "CO", "Douglas");

                    ByVisibleElement(driver.FindElement(By.XPath("//*[@id='SalesAndTrans']/span")));

                    gc.CreatePdf(orderNumber, Parcel_ID, "assement2", driver, "CO", "Douglas");
                    Property_Type = driver.FindElement(By.XPath("//*[@id='SummaryAccountInfo']/div/account-summary/div[1]/div[3]/div[2]")).Text;
                    try
                    {
                        Year_Built = driver.FindElement(By.XPath("/html/body/app/div/div[3]/parceldetails/div[2]/div[3]/div[2]/div[4]/div/building-details/div/div/div[2]/div[2]/div[1]/div[1]/div/div[2]/div[2]")).Text;
                    }
                    catch { }
                    Legal_Description = driver.FindElement(By.XPath("//*[@id='SummaryAccountInfo']/div/account-summary/div[2]/div[7]")).Text;
                    string property_details = Account_Number + "~" + Owner_Name + "~" + Property_Address + "~" + Mailing_Address + "~" + Property_Type + "~" + Year_Built + "~" + Legal_Description;
                    gc.insert_date(orderNumber, Parcel_ID, 223, property_details, 1, DateTime.Now);

                    //Assessment details
                    string class_code = "", description = "", actual_value = "", assessed_value;
                    string year = "", Tax_rate = "", EstTax_amount;
                    int    iRowsCount = driver.FindElements(By.XPath("//*[@id='ValuationInfo']/div/valuation/div[2]/table/tbody")).Count;
                    for (int i = 2; i <= iRowsCount; i++)
                    {
                        //*[@id="ValuationInfo"]/div/valuation/div[2]/table/tbody[2]/tr[1]/td[1]
                        //*[@id="ValuationInfo"]/div/valuation/div[2]/table/tbody[3]/tr[1]/td[1]
                        IWebElement         ISpan113 = driver.FindElement(By.XPath("//*[@id='ValuationInfo']/div/valuation/div[2]/table/tbody[" + i + "]/tr[1]/td[1]"));
                        IJavaScriptExecutor js113    = driver as IJavaScriptExecutor;
                        js113.ExecuteScript("arguments[0].click();", ISpan113);
                        Thread.Sleep(1000);
                        year = driver.FindElement(By.XPath("//*[@id='ValuationInfo']/div/valuation/div[2]/table/tbody[" + i + "]/tr[1]/td[1] ")).Text;
                        string actual_value1   = driver.FindElement(By.XPath("//*[@id='ValuationInfo']/div/valuation/div[2]/table/tbody[" + i + "]/tr[1]/td[2] ")).Text;
                        string assessed_value1 = driver.FindElement(By.XPath("//*[@id='ValuationInfo']/div/valuation/div[2]/table/tbody[" + i + "]/tr[1]/td[3] ")).Text;
                        Tax_rate      = driver.FindElement(By.XPath("//*[@id='ValuationInfo']/div/valuation/div[2]/table/tbody[" + i + "]/tr[1]/td[4] ")).Text;
                        EstTax_amount = driver.FindElement(By.XPath("//*[@id='ValuationInfo']/div/valuation/div[2]/table/tbody[" + i + "]/tr[1]/td[5] ")).Text;
                        if (i == 2)
                        {
                            ByVisibleElement(driver.FindElement(By.XPath("//*[@id='ValuationInfo']/div/valuation/div[2]/table/tbody[" + i + "]/tr[1]/td[1] ")));
                            gc.CreatePdf(orderNumber, Parcel_ID, "current year", driver, "CO", "Douglas");
                        }
                        if (i == 3)
                        {
                            ByVisibleElement(driver.FindElement(By.XPath("//*[@id='ValuationInfo']/div/valuation/div[2]/table/tbody[" + i + "]/tr[1]/td[1] ")));
                            gc.CreatePdf(orderNumber, Parcel_ID, "prior year", driver, "CO", "Douglas");
                        }
                        if (i == 4)
                        {
                            ByVisibleElement(driver.FindElement(By.XPath("//*[@id='ValuationInfo']/div/valuation/div[2]/table/tbody[" + i + "]/tr[1]/td[1] ")));
                            gc.CreatePdf(orderNumber, Parcel_ID, "2 year before", driver, "CO", "Douglas");
                        }
                        for (int j = 1; j <= 2; j++)
                        {
                            for (int k = 2; k <= 4; k++)
                            {
                                try
                                {
                                    class_code     = driver.FindElement(By.XPath("//*[@id='ValuationInfo']/div/valuation/div[2]/table/tbody[" + i + "]/tr[3]/td/div/div[" + j + "]/div[" + k + "]/div[1]")).Text;
                                    description    = driver.FindElement(By.XPath("//*[@id='ValuationInfo']/div/valuation/div[2]/table/tbody[" + i + "]/tr[3]/td/div/div[" + j + "]/div[" + k + "]/div[2]")).Text;
                                    actual_value   = driver.FindElement(By.XPath("//*[@id='ValuationInfo']/div/valuation/div[2]/table/tbody[" + i + "]/tr[3]/td/div/div[" + j + "]/div[" + k + "]/div[3]")).Text;
                                    assessed_value = driver.FindElement(By.XPath("//*[@id='ValuationInfo']/div/valuation/div[2]/table/tbody[" + i + "]/tr[3]/td/div/div[" + j + "]/div[" + k + "]/div[4]")).Text;
                                    //     Year~Class_code~Description~actual_value~assessed_value~Tax_rate~EstTax_amount
                                    string assessment_details = year + "~" + class_code + "~" + description + "~" + actual_value + "~" + assessed_value + "~" + "-" + "~" + "-";
                                    gc.insert_date(orderNumber, Parcel_ID, 224, assessment_details, 1, DateTime.Now);
                                }
                                catch { }
                            }
                        }
                        string assessment_details1 = year + "~" + "-" + "~" + "Grand Total :" + "~" + actual_value1 + "~" + assessed_value1 + "~" + Tax_rate + "~" + EstTax_amount;
                        gc.insert_date(orderNumber, Parcel_ID, 224, assessment_details1, 1, DateTime.Now);
                    }
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    //Tax details
                    driver.Navigate().GoToUrl("http://apps.douglas.co.us/treasurer/web/login.jsp");
                    Thread.Sleep(4000);

                    //Tax information
                    driver.FindElement(By.XPath("//*[@id='middle_left']/form/input[1]")).Click();
                    Thread.Sleep(3000);
                    driver.FindElement(By.Id("TaxAccountID")).SendKeys(Account_Number);
                    gc.CreatePdf(orderNumber, Parcel_ID, "Tax search", driver, "CO", "Douglas");
                    driver.FindElement(By.XPath("//*[@id='middle']/form/table[3]/tbody/tr/td[1]/input")).SendKeys(Keys.Enter);
                    Thread.Sleep(3000);
                    gc.CreatePdf(orderNumber, Parcel_ID, "Tax search result", driver, "CO", "Douglas");
                    driver.FindElement(By.XPath("//*[@id='searchResultsTable']/tbody/tr/td[1]/strong/a")).Click();
                    Thread.Sleep(3000);


                    string date     = "";
                    string fulltext = driver.FindElement(By.XPath("//*[@id='totals']/table/tbody")).Text.Trim().Replace("\r\n", "");
                    if (!fulltext.Contains("Interest Due"))
                    {
                        IWebElement Idate1 = driver.FindElement(By.Id("paymentDate"));
                        date = Idate1.GetAttribute("value");
                    }
                    else
                    {
                        IWebElement dt = driver.FindElement(By.XPath("//*[@id='paymentDate']"));
                        date = dt.GetAttribute("value");
                        DateTime G_Date       = Convert.ToDateTime(date);
                        string   dateChecking = DateTime.Now.ToString("MM") + "/15/" + DateTime.Now.ToString("yyyy");
                        if (G_Date < Convert.ToDateTime(dateChecking))
                        {
                            //end of the month
                            date = new DateTime(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM"))), DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(DateTime.Now.ToString("MM")))).ToString("MM/dd/yyyy");
                        }

                        else if (G_Date > Convert.ToDateTime(dateChecking))
                        {
                            // nextEndOfMonth
                            if ((Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM"))) < 12))
                            {
                                date = new DateTime(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM")) + 1), DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(DateTime.Now.ToString("MM")) + 1)).ToString("MM/dd/yyyy");
                            }
                            else
                            {
                                int nxtYr = Convert.ToInt16(DateTime.Now.ToString("yyyy")) + 1;
                                date = new DateTime(nxtYr, 1, DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), 1)).ToString("MM/dd/yyyy");
                            }
                        }

                        Thread.Sleep(2000);
                        dt.Clear();



                        driver.FindElement(By.Id("paymentDate")).SendKeys(date);
                        Thread.Sleep(3000);
                    }

                    driver.FindElement(By.Id("paymentTypeFirst")).Click();
                    Thread.Sleep(4000);

                    ByVisibleElement(driver.FindElement(By.XPath("//*[@id='taxAccountSummary']/table")));
                    gc.CreatePdf(orderNumber, Parcel_ID, "Tax info result first", driver, "CO", "Douglas");
                    IstInstallment = driver.FindElement(By.XPath("//*[@id='inquiryForm']/table/tbody/tr[2]/td[2]/label[1]")).Text;
                    IWebElement         multitableElement4 = driver.FindElement(By.XPath("//*[@id='totals']/table/tbody"));
                    IList <IWebElement> multitableRow4     = multitableElement4.FindElements(By.TagName("tr"));
                    IList <IWebElement> multirowTD4;
                    foreach (IWebElement row in multitableRow4)
                    {
                        multirowTD4 = row.FindElements(By.TagName("td"));
                        string tax_infodeli = Account_Number + "~" + IstInstallment + "~" + multirowTD4[0].Text.Trim() + "~" + multirowTD4[1].Text.Trim();
                        gc.insert_date(orderNumber, Parcel_ID, 225, tax_infodeli, 1, DateTime.Now);
                    }

                    try
                    {
                        driver.FindElement(By.Id("paymentTypeSecond")).Click();
                        Thread.Sleep(3000);
                        ByVisibleElement(driver.FindElement(By.XPath("//*[@id='taxAccountSummary']/table")));
                        gc.CreatePdf(orderNumber, Parcel_ID, "Tax info result second", driver, "CO", "Douglas");
                    }
                    catch
                    {
                        driver.FindElement(By.Id("paymentTypeFull")).Click();
                        Thread.Sleep(3000);
                        ByVisibleElement(driver.FindElement(By.XPath("//*[@id='taxAccountSummary']/table")));
                        gc.CreatePdf(orderNumber, Parcel_ID, "Tax info result full", driver, "CO", "Douglas");
                    }
                    IIndInstallment = driver.FindElement(By.XPath("//*[@id='inquiryForm']/table/tbody/tr[2]/td[2]/label[2]")).Text;
                    IWebElement         multitableElement3 = driver.FindElement(By.XPath("//*[@id='totals']/table/tbody"));
                    IList <IWebElement> multitableRow3     = multitableElement3.FindElements(By.TagName("tr"));
                    IList <IWebElement> multirowTD3;
                    foreach (IWebElement row in multitableRow3)
                    {
                        multirowTD3 = row.FindElements(By.TagName("td"));

                        string tax_infodeli1 = Account_Number + "~" + IIndInstallment + "~" + multirowTD3[0].Text.Trim() + "~" + multirowTD3[1].Text.Trim();
                        gc.insert_date(orderNumber, Parcel_ID, 225, tax_infodeli1, 1, DateTime.Now);
                    }
                    string tax_infodeli2 = Account_Number + "~" + "Good Through Date :" + "~" + date + "~" + "-";
                    gc.insert_date(orderNumber, Parcel_ID, 225, tax_infodeli2, 1, DateTime.Now);

                    //Tax Distribution Table:

                    driver.FindElement(By.XPath("//*[@id='accountLinks']/a[2]")).Click();
                    Thread.Sleep(4000);

                    ByVisibleElement(driver.FindElement(By.XPath(" //*[@id='middle']/table[1]/tbody/tr/td[1]")));
                    gc.CreatePdf(orderNumber, Parcel_ID, "Account value", driver, "CO", "Douglas");
                    IWebElement         multitableElement1 = driver.FindElement(By.XPath("//*[@id='middle']/table[3]/tbody"));
                    IList <IWebElement> multitableRow1     = multitableElement1.FindElements(By.TagName("tr"));
                    IList <IWebElement> multirowTD1;
                    foreach (IWebElement row in multitableRow1)
                    {
                        if (!row.Text.Contains("Authority"))
                        {
                            multirowTD1 = row.FindElements(By.TagName("td"));
                            if (multirowTD1.Count == 4)
                            {
                                string tax_distri = multirowTD1[0].Text.Trim() + "~" + multirowTD1[1].Text.Trim() + "~" + multirowTD1[2].Text.Trim() + "~" + multirowTD1[3].Text.Trim();
                                gc.insert_date(orderNumber, Parcel_ID, 226, tax_distri, 1, DateTime.Now);
                            }
                        }
                    }

                    //Due Date Details Table:


                    driver.FindElement(By.XPath("//*[@id='accountLinks']/a[3]")).Click();
                    Thread.Sleep(4000);
                    gc.CreatePdf(orderNumber, Parcel_ID, "Transaction detail1", driver, "CO", "Douglas");
                    try
                    {
                        ByVisibleElement(driver.FindElement(By.XPath(" //*[@id='middle']/table[2]/tbody/tr[11]")));
                    }
                    catch { }
                    gc.CreatePdf(orderNumber, Parcel_ID, "Transaction detail", driver, "CO", "Douglas");
                    IWebElement         multitableElement = driver.FindElement(By.XPath("//*[@id='middle']/table[1]/tbody"));
                    IList <IWebElement> multitableRow     = multitableElement.FindElements(By.TagName("tr"));
                    IList <IWebElement> multirowTD;
                    foreach (IWebElement row in multitableRow)
                    {
                        multirowTD = row.FindElements(By.TagName("td"));

                        string tax_duedate = multirowTD[0].Text.Trim() + "~" + multirowTD[1].Text.Trim() + "~" + multirowTD[2].Text.Trim() + "~" + multirowTD[3].Text.Trim() + "~" + multirowTD[4].Text.Trim() + "~" + multirowTD[5].Text.Trim() + "~" + multirowTD[6].Text.Trim() + "~" + multirowTD[7].Text.Trim();
                        gc.insert_date(orderNumber, Parcel_ID, 227, tax_duedate, 1, DateTime.Now);
                    }

                    //Tax History Details Table
                    IWebElement         multitableElement2 = driver.FindElement(By.XPath("//*[@id='middle']/table[2]/tbody"));
                    IList <IWebElement> multitableRow2     = multitableElement2.FindElements(By.TagName("tr"));
                    IList <IWebElement> multirowTD2;
                    foreach (IWebElement row in multitableRow2)
                    {
                        multirowTD2 = row.FindElements(By.TagName("td"));
                        string tax_duedate = multirowTD2[0].Text.Trim() + "~" + multirowTD2[1].Text.Trim() + "~" + multirowTD2[2].Text.Trim() + "~" + multirowTD2[3].Text.Trim() + "~" + multirowTD2[4].Text.Trim();
                        gc.insert_date(orderNumber, Parcel_ID, 228, tax_duedate, 1, DateTime.Now);
                    }
                    //*[@id="plugin"]


                    //webtax
                    //   *[@id = "left"] / em / div[1] / a[1]
                    // IWebElement ISpan = driver.FindElement(By.LinkText("Web Tax Notice"));
                    //IJavaScriptExecutor js = driver as IJavaScriptExecutor;
                    //js.ExecuteScript("arguments[0].click();", ISpan);
                    ////download taxbill


                    //try
                    //{
                    //    IWebElement ISpan11 = driver.FindElement(By.LinkText("Web Tax Notice"));
                    //    IJavaScriptExecutor js11 = driver as IJavaScriptExecutor;
                    //    js11.ExecuteScript("arguments[0].click();", ISpan11);

                    //    gc.CreatePdf(orderNumber, Parcel_ID, "Tax BillScreen", driver, "CO", "Douglas");

                    //    ByVisibleElement(driver.FindElement(By.XPath("//*[@id='plugin']")));
                    //    gc.CreatePdf(orderNumber, Parcel_ID, "Tax BillScreen1", driver, "CO", "Douglas");
                    //}
                    //catch { }
                    TaxTime     = DateTime.Now.ToString("HH:mm:ss");
                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "CO", "Douglas", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderNumber, "CO", "Douglas");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    throw ex;
                }
        }
Example #27
0
        public string FTP_Collier(string Address, string parcelNumber, string ownername, string searchType, string orderNumber, string directParcel)
        {
            string strBill = "-", strBalance = "-", strBillDate = "-", strBillPaid = "-", strFBill = "-", strFBalance = "-", strFBillDate = "-", strFBillPaid = "-";
            string TaxYear = "", TaxAmount = "", PaidAmount = "", ReceiptNumber = "", Account_number = "", Millage_Code = "", Millage_rate = "";

            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            string        StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "", AssessTakenTime = "", TaxTakentime = "", CityTaxtakentime = "";
            string        TotaltakenTime   = "";
            List <string> strTaxRealestate = new List <string>();
            var           driverService    = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())
            {
                string   AlterNateID = "", PropertyAddress = "", owner = "";
                string[] stringSeparators1 = new string[] { "\r\n" };

                List <string> listurl = new List <string>();


                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");
                    //if (searchType == "titleflex")
                    //{
                    //    gc.TitleFlexSearch(orderNumber, parcelNumber, ownername, Address, "IN", "Hamilton");
                    //    if (GlobalClass.TitleFlex_Search == "Yes")
                    //    {
                    //        return "MultiParcel";
                    //    }
                    //    else
                    //    {
                    //        string strTitleAssess = GlobalClass.TitleFlexAssess;
                    //        parcelNumber = GlobalClass.titleparcel;

                    //        searchType = "parcel";
                    //    }
                    //}

                    if (searchType == "titleflex")
                    {
                        gc.TitleFlexSearch(orderNumber, parcelNumber, "", Address, "FL", "Collier");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_FLCollier"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "address")
                    {
                        driver.Navigate().GoToUrl("http://www.collierappraiser.com/");
                        Thread.Sleep(2000);


                        IWebElement iframeElement = driver.FindElement(By.XPath("/html/frameset/frame"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement);

                        IWebElement iframeElement1 = driver.FindElement(By.XPath("/html/frameset/frame[2]"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement1);

                        driver.FindElement(By.XPath("//*[@id='AutoNumber3']/tbody/tr/td[3]/table/tbody/tr[4]/td/a")).Click();
                        Thread.Sleep(10000);
                        driver.SwitchTo().DefaultContent();
                        Thread.Sleep(2000);

                        IWebElement iframeElement2 = driver.FindElement(By.XPath("//*[@id='rbottom']"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement2);
                        Thread.Sleep(2000);
                        //now use the switch command

                        driver.FindElement(By.XPath("//*[@id='a_searchlink']")).Click();
                        Thread.Sleep(5000);
                        driver.FindElement(By.XPath("//*[@id='ui-id-16']")).Click();
                        Thread.Sleep(5000);
                        driver.FindElement(By.XPath("//*[@id='FullAddress']")).SendKeys(Address);
                        Thread.Sleep(1000);
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "FL", "Collier");
                        driver.FindElement(By.XPath("//*[@id='SearchFullAddress']")).Click();
                        Thread.Sleep(6000);
                        gc.CreatePdf_WOP(orderNumber, "Address search Result", driver, "FL", "Collier");


                        try
                        {
                            IWebElement         MultiOwnerTable = driver.FindElement(By.Id("flex1"));
                            IList <IWebElement> MultiOwnerRow   = MultiOwnerTable.FindElements(By.TagName("tr"));
                            IList <IWebElement> MultiOwnerTD;
                            //string AlterNateID = "", PropertyAddress = "", LegalDescriptoin = "", YearBuilt = "";
                            foreach (IWebElement row1 in MultiOwnerRow)
                            {
                                MultiOwnerTD = row1.FindElements(By.TagName("td"));
                                if (MultiOwnerTD.Count != 0 && MultiOwnerTD.Count != 2 && MultiOwnerTD.Count != 1 && !row1.Text.Contains("Parcel No.") && MultiOwnerTD[1].Text.Trim() != "")
                                {
                                    parcelNumber    = MultiOwnerTD[1].Text;
                                    ownername       = MultiOwnerTD[3].Text;
                                    PropertyAddress = MultiOwnerTD[5].Text;
                                    string Multi = PropertyAddress + "~" + ownername;
                                    gc.insert_date(orderNumber, parcelNumber, 488, Multi, 1, DateTime.Now);
                                }
                            }
                            //GlobalClass.multiParcel_MiamiDade = "Yes";
                            HttpContext.Current.Session["multiParcel_Collier"] = "Yes";
                            driver.Quit();
                            return("MultiParcel");
                        }
                        catch { }
                    }
                    if (searchType == "ownername")
                    {
                        driver.Navigate().GoToUrl("http://www.collierappraiser.com/");
                        Thread.Sleep(2000);
                        IWebElement iframeElement = driver.FindElement(By.XPath("/html/frameset/frame"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement);

                        IWebElement iframeElement1 = driver.FindElement(By.XPath("/html/frameset/frame[2]"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement1);

                        driver.FindElement(By.XPath("//*[@id='AutoNumber3']/tbody/tr/td[3]/table/tbody/tr[4]/td/a")).Click();
                        Thread.Sleep(10000);
                        driver.SwitchTo().DefaultContent();
                        Thread.Sleep(2000);

                        IWebElement iframeElement2 = driver.FindElement(By.XPath("//*[@id='rbottom']"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement2);
                        Thread.Sleep(2000);
                        //now use the switch command

                        driver.FindElement(By.XPath("//*[@id='a_searchlink']")).Click();
                        Thread.Sleep(6000);
                        driver.FindElement(By.XPath("//*[@id='ui-id-15']")).Click();
                        Thread.Sleep(6000);
                        driver.FindElement(By.XPath("//*[@id='Name1']")).SendKeys(ownername);
                        Thread.Sleep(1000);
                        gc.CreatePdf_WOP(orderNumber, "Owner search", driver, "FL", "Collier");
                        driver.FindElement(By.XPath("//*[@id='SearchName1']")).Click();
                        Thread.Sleep(6000);

                        gc.CreatePdf_WOP(orderNumber, "Owner search Result", driver, "FL", "Collier");
                        try
                        {
                            IWebElement         MultiOwnerTable = driver.FindElement(By.Id("flex1"));
                            IList <IWebElement> MultiOwnerRow   = MultiOwnerTable.FindElements(By.TagName("tr"));
                            IList <IWebElement> MultiOwnerTD;

                            //string AlterNateID = "", PropertyAddress = "", LegalDescriptoin = "", YearBuilt = "";
                            foreach (IWebElement row1 in MultiOwnerRow)
                            {
                                MultiOwnerTD = row1.FindElements(By.TagName("td"));
                                if (MultiOwnerTD.Count != 0 && MultiOwnerTD.Count != 2 && MultiOwnerTD.Count != 1 && !row1.Text.Contains("Parcel No.") && MultiOwnerTD[1].Text.Trim() != "")
                                {
                                    parcelNumber = MultiOwnerTD[1].Text;

                                    ownername       = MultiOwnerTD[3].Text;
                                    PropertyAddress = MultiOwnerTD[5].Text;


                                    string Multi = PropertyAddress + "~" + ownername;
                                    gc.insert_date(orderNumber, parcelNumber, 488, Multi, 1, DateTime.Now);
                                }
                            }

                            //GlobalClass.multiParcel_MiamiDade = "Yes";
                            HttpContext.Current.Session["multiParcel_Collier"] = "Yes";
                            driver.Quit();
                            return("MultiParcel");
                        }
                        catch { }
                    }

                    if (searchType == "parcel")
                    {
                        driver.Navigate().GoToUrl("http://www.collierappraiser.com/");
                        Thread.Sleep(2000);


                        IWebElement iframeElement = driver.FindElement(By.XPath("/html/frameset/frame"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement);

                        IWebElement iframeElement1 = driver.FindElement(By.XPath("/html/frameset/frame[2]"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement1);

                        driver.FindElement(By.XPath("//*[@id='AutoNumber3']/tbody/tr/td[3]/table/tbody/tr[4]/td/a")).Click();
                        Thread.Sleep(10000);
                        driver.SwitchTo().DefaultContent();
                        Thread.Sleep(2000);

                        IWebElement iframeElement2 = driver.FindElement(By.XPath("//*[@id='rbottom']"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement2);
                        Thread.Sleep(2000);
                        //now use the switch command

                        driver.FindElement(By.XPath("//*[@id='a_searchlink']")).Click();
                        Thread.Sleep(6000);
                        driver.FindElement(By.XPath("//*[@id='ui-id-17']")).Click();
                        Thread.Sleep(6000);
                        driver.FindElement(By.XPath("//*[@id='ParcelID']")).SendKeys(parcelNumber);
                        Thread.Sleep(1000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel Search", driver, "FL", "Collier");
                        driver.FindElement(By.XPath("//*[@id='SearchParcelID']")).Click();
                        Thread.Sleep(6000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel Search Result", driver, "FL", "Collier");
                    }
                    try
                    {
                        IAlert alert = driver.SwitchTo().Alert();
                        if (alert.Text.Contains("No Parcels Found"))
                        {
                            HttpContext.Current.Session["Nodata_FLCollier"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }
                    string SiteAdr = "", MapNo = "", Strapno = "", Section = "", Township = "", Range = "", Acres = "", MillageArea = "", Condo = "", UseCode = "", School = "", Other = "", Total = "", YearBuilt = "";

                    gc.CreatePdf(orderNumber, parcelNumber, "Property Deatil", driver, "FL", "Collier");
                    parcelNumber = driver.FindElement(By.XPath("//*[@id='ParcelID']")).Text;
                    ownername    = driver.FindElement(By.XPath("//*[@id='Name1']")).Text;
                    try
                    {
                        ownername = driver.FindElement(By.XPath("//*[@id='Name1']")).Text + " " + driver.FindElement(By.XPath("//*[@id='Name2']")).Text;
                    }
                    catch { }
                    try
                    {
                        SiteAdr = driver.FindElement(By.XPath("//*[@id='FullAddress']")).Text + " " + driver.FindElement(By.XPath("//*[@id='City']")).Text + " " + driver.FindElement(By.XPath("//*[@id='State']")).Text;
                    }
                    catch { }
                    MapNo       = driver.FindElement(By.XPath("//*[@id='MapNumber']")).Text;
                    Strapno     = driver.FindElement(By.XPath("//*[@id='StrapNumber']")).Text;
                    Section     = driver.FindElement(By.XPath("//*[@id='Section']")).Text;
                    Township    = driver.FindElement(By.XPath("//*[@id='Township']")).Text;
                    Range       = driver.FindElement(By.XPath("//*[@id='Range']")).Text;
                    Acres       = driver.FindElement(By.XPath("//*[@id='TotalAcres']")).Text;
                    MillageArea = driver.FindElement(By.XPath("//*[@id='MillageArea']")).Text;
                    Condo       = driver.FindElement(By.XPath("//*[@id='scDescription']")).Text;
                    UseCode     = driver.FindElement(By.XPath("//*[@id='ucDescription']")).Text;
                    School      = driver.FindElement(By.XPath("//*[@id='School']")).Text;
                    Other       = driver.FindElement(By.XPath("//*[@id='Other']")).Text;
                    Total       = driver.FindElement(By.XPath("//*[@id='Total']")).Text;

                    driver.FindElement(By.XPath("//*[@id='ui-id-2']")).Click();
                    Thread.Sleep(4000);
                    gc.CreatePdf(orderNumber, parcelNumber, "Property Summary", driver, "FL", "Collier");
                    try
                    {
                        YearBuilt = driver.FindElement(By.XPath("//*[@id='trBuilding1']/td[2]")).Text;
                    }
                    catch { }
                    string property = ownername + "~" + SiteAdr + "~" + MapNo + "~" + Strapno + "~" + Section + "~" + Township + "~" + Range + "~" + Acres + "~" + MillageArea + "~" + Condo + "~" + UseCode + "~" + School + "~" + Other + "~" + Total + "~" + YearBuilt;

                    gc.insert_date(orderNumber, parcelNumber, 469, property, 1, DateTime.Now);
                    driver.FindElement(By.XPath("//*[@id='ui-id-1']")).Click();
                    Thread.Sleep(4000);

                    string              LandValue = "", ImprovedValue = "", Marketvalue = "", SaveOurHome = "", AssessedValue = "", Homestead = "", SchoolTaxableValue = "", AdditionalHomestead = "", TaxableValue = "";
                    IWebElement         TaxHisTBD = driver.FindElement(By.XPath("//*[@id='PropSum']/table[6]/tbody/tr/td[3]/table/tbody"));
                    IList <IWebElement> TaxHisTRD = TaxHisTBD.FindElements(By.TagName("tr"));
                    IList <IWebElement> TaxHisTDD;

                    foreach (IWebElement row1 in TaxHisTRD)
                    {
                        TaxHisTDD = row1.FindElements(By.TagName("td"));
                        if (!row1.Text.Contains("Certified Tax Roll") && !row1.Text.Contains("(Subject") && row1.Text.Trim() != "" && TaxHisTDD.Count != 1)
                        {
                            LandValue     = TaxHisTDD[0].Text + "~" + LandValue;
                            ImprovedValue = TaxHisTDD[1].Text + "~" + ImprovedValue;
                        }
                    }

                    LandValue     = LandValue + "lk";
                    ImprovedValue = ImprovedValue + "lk";

                    LandValue     = LandValue.Replace("~lk", "");
                    ImprovedValue = ImprovedValue.Replace("~lk", "");
                    DBconnection dbconn = new DBconnection();
                    dbconn.ExecuteQuery("update  data_field_master set Data_Fields_Text='" + LandValue + "' where Id = '" + 470 + "'");
                    gc.insert_date(orderNumber, parcelNumber, 470, ImprovedValue, 1, DateTime.Now);
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    driver.Navigate().GoToUrl("https://collier.county-taxes.com/public");
                    Thread.Sleep(2000);

                    driver.FindElement(By.XPath("//*[@id='search-controls']/div/form[1]/div[1]/div/input")).SendKeys(parcelNumber);
                    gc.CreatePdf(orderNumber, parcelNumber, "Taxinfo", driver, "FL", "Collier");
                    driver.FindElement(By.XPath("//*[@id='search-controls']/div/form[1]/div[1]/div/span/button")).SendKeys(Keys.Enter);
                    Thread.Sleep(3000);
                    try
                    {
                        IWebElement ITaxSearch    = driver.FindElement(By.LinkText("Full bill history"));
                        string      strITaxSearch = ITaxSearch.GetAttribute("href");
                        driver.Navigate().GoToUrl(strITaxSearch);
                        Thread.Sleep(3000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Full bill history", driver, "FL", "Collier");
                    }
                    catch { }

                    try
                    {
                        IWebElement         ITaxReal    = driver.FindElement(By.XPath("//*[@id='content']/div[1]/table"));
                        IList <IWebElement> ITaxRealRow = ITaxReal.FindElements(By.TagName("tr"));
                        IList <IWebElement> ITaxRealTd;
                        int k = 0;
                        foreach (IWebElement ItaxReal in ITaxRealRow)
                        {
                            ITaxRealTd = ItaxReal.FindElements(By.TagName("td"));
                            if ((k <= 2 && ItaxReal.Text.Contains("Annual Bill")) || ItaxReal.Text.Contains("Pay this bill:"))
                            {
                                string      yearbill      = ITaxRealTd[0].Text;
                                IWebElement ITaxBillCount = ITaxRealTd[0].FindElement(By.TagName("a"));
                                string      strTaxReal    = ITaxBillCount.GetAttribute("href");
                                strTaxRealestate.Add(strTaxReal);
                                try
                                {
                                    IWebElement ITaxBill = ITaxRealTd[3].FindElement(By.TagName("a"));
                                    string      BillTax  = ITaxBill.GetAttribute("href");
                                    gc.downloadfile(BillTax, orderNumber, parcelNumber, "Taxbill.pdf" + yearbill, "FL", "Collier");
                                }
                                catch
                                {
                                    IWebElement ITaxBill = ITaxRealTd[4].FindElement(By.TagName("a"));
                                    string      BillTax  = ITaxBill.GetAttribute("href");
                                    gc.downloadfile(BillTax, orderNumber, parcelNumber, "Taxbill.pdf" + yearbill, "FL", "Collier");
                                }
                                k++;
                            }
                        }

                        //Tax History Details

                        IWebElement         IBillHistorytable = driver.FindElement(By.XPath("//*[@id='content']/div[1]/table"));
                        IList <IWebElement> IBillHistoryRow   = IBillHistorytable.FindElements(By.TagName("tr"));
                        IList <IWebElement> IBillHistoryTD;
                        foreach (IWebElement bill in IBillHistoryRow)
                        {
                            IBillHistoryTD = bill.FindElements(By.TagName("td"));
                            if (IBillHistoryTD.Count != 0)
                            {
                                try
                                {
                                    strBill     = IBillHistoryTD[0].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                    strBalance  = IBillHistoryTD[1].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                    strBillDate = IBillHistoryTD[2].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                    strBillPaid = IBillHistoryTD[3].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                }
                                catch
                                {
                                    strBillDate = "";
                                    strBillPaid = "";
                                }
                                if (strBillPaid.Contains("Print (PDF)"))
                                {
                                    strBillPaid = "";
                                }
                                string strTaxHistory = strBill + "~" + strBalance + "~" + strBillDate + "~" + strBillPaid;
                                gc.insert_date(orderNumber, parcelNumber, 471, strTaxHistory, 1, DateTime.Now);
                            }
                        }

                        IWebElement         IBillHistoryfoottable = driver.FindElement(By.XPath("//*[@id='content']/div[1]/table/tfoot"));
                        IList <IWebElement> IBillHistoryfootRow   = IBillHistoryfoottable.FindElements(By.TagName("tr"));
                        IList <IWebElement> IBillHistoryfootTD;
                        foreach (IWebElement bill in IBillHistoryRow)
                        {
                            IBillHistoryfootTD = bill.FindElements(By.TagName("th"));
                            if (IBillHistoryfootTD.Count != 0 && bill.Text.Contains("Total"))
                            {
                                try
                                {
                                    strFBill     = IBillHistoryfootTD[0].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                    strFBalance  = IBillHistoryfootTD[1].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                    strFBillDate = IBillHistoryfootTD[2].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                    strFBillPaid = IBillHistoryfootTD[3].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                }
                                catch
                                {
                                    strFBillDate = "";
                                    strFBillPaid = "";
                                }
                                if (strBillPaid.Contains("Print (PDF)"))
                                {
                                    strBillPaid = "";
                                }
                                string strTaxHistory = strFBill + "~" + strFBalance + "~" + strFBillDate + "~" + strFBillPaid;
                                gc.insert_date(orderNumber, parcelNumber, 471, strTaxHistory, 1, DateTime.Now);
                            }
                        }
                        foreach (string real in strTaxRealestate)
                        {
                            driver.Navigate().GoToUrl(real);
                            Thread.Sleep(4000);

                            try
                            {
                                TaxYear = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/div[1]")).Text;
                                TaxYear = WebDriverTest.After(TaxYear, "Real Estate").Trim();
                                string   s     = TaxYear;
                                string[] words = TaxYear.Split(' ');
                                TaxYear = words[0];
                            }
                            catch
                            {
                                TaxYear = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/div[1]")).Text;
                                TaxYear = WebDriverTest.After(TaxYear, "Real Estate").Trim();
                                string   s     = TaxYear;
                                string[] words = TaxYear.Split(' ');
                                TaxYear = words[0];
                            }

                            gc.CreatePdf(orderNumber, parcelNumber, "Tax details" + TaxYear, driver, "FL", "Collier");
                            IWebElement multitableElement3;
                            try
                            {
                                multitableElement3 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/table[2]/tbody"));
                            }
                            catch
                            {
                                multitableElement3 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/table[2]/tbody"));
                            }
                            IList <IWebElement> multitableRow3 = multitableElement3.FindElements(By.TagName("tr"));

                            IList <IWebElement> multirowTD3;
                            foreach (IWebElement row in multitableRow3)
                            {
                                multirowTD3 = row.FindElements(By.TagName("td"));
                                if (multirowTD3.Count != 1 && multirowTD3[1].Text.Trim() != "")
                                {
                                    string tax_distri = TaxYear + "~" + multirowTD3[0].Text.Trim() + "~" + "Ad Valorem" + "~" + multirowTD3[1].Text.Trim() + "~" + multirowTD3[2].Text.Trim() + "~" + multirowTD3[3].Text.Trim() + "~" + multirowTD3[4].Text.Trim() + "~" + "" + "~" + multirowTD3[5].Text.Trim();
                                    gc.insert_date(orderNumber, parcelNumber, 472, tax_distri, 1, DateTime.Now);
                                }
                            }

                            //total advalorem
                            IWebElement multitableElement31;
                            try
                            {
                                multitableElement31 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/table[2]/tfoot"));
                            }
                            catch
                            {
                                multitableElement31 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/table[2]/tfoot"));
                            }
                            IList <IWebElement> multitableRow31 = multitableElement31.FindElements(By.TagName("tr"));

                            IList <IWebElement> multirowTD31;
                            foreach (IWebElement row in multitableRow31)
                            {
                                multirowTD31 = row.FindElements(By.TagName("td"));
                                if (multirowTD31.Count != 1)
                                {
                                    string tax_distri1 = TaxYear + "~" + "Total:" + "~" + "Ad Valorem" + "~" + multirowTD31[0].Text.Trim() + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + multirowTD31[1].Text.Trim();
                                    gc.insert_date(orderNumber, parcelNumber, 472, tax_distri1, 1, DateTime.Now);
                                }
                            }
                            //  Non - Ad Valorem
                            try
                            {
                                IWebElement multitableElement32;
                                try
                                {
                                    multitableElement32 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/table[3]/tbody"));
                                }
                                catch
                                {
                                    multitableElement32 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/table[3]/tbody"));
                                }
                                IList <IWebElement> multitableRow32 = multitableElement32.FindElements(By.TagName("tr"));
                                IList <IWebElement> multirowTD32;
                                foreach (IWebElement row in multitableRow32)
                                {
                                    multirowTD32 = row.FindElements(By.TagName("td"));
                                    if (multirowTD32.Count != 1 && multirowTD32[0].Text.Trim() != "")
                                    {
                                        string tax_distri2 = TaxYear + "~" + multirowTD32[0].Text.Trim() + "~" + "Non-Ad Valorem " + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + multirowTD32[1].Text.Trim() + "~" + multirowTD32[2].Text.Trim();
                                        gc.insert_date(orderNumber, parcelNumber, 472, tax_distri2, 1, DateTime.Now);
                                    }
                                }
                                //total non-advalorem

                                IWebElement multitableElement33;
                                try
                                {
                                    multitableElement33 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/table[3]/tfoot"));
                                }
                                catch
                                {
                                    multitableElement33 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/table[3]/tfoot"));
                                }
                                IList <IWebElement> multitableRow33 = multitableElement33.FindElements(By.TagName("tr"));
                                IList <IWebElement> multirowTD33;
                                foreach (IWebElement row in multitableRow33)
                                {
                                    multirowTD33 = row.FindElements(By.TagName("td"));
                                    if (multirowTD33.Count != 0)
                                    {
                                        string tax_distri1 = TaxYear + "~" + "Total:" + "~" + "Non-Ad Valorem " + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + multirowTD33[0].Text.Trim();
                                        gc.insert_date(orderNumber, parcelNumber, 472, tax_distri1, 1, DateTime.Now);
                                    }
                                }
                            }
                            catch { }
                            //  Taxing_authority~Tax_type~Millage~Assessed~Exemption~Taxable~Rate~Tax
                            //Tax info
                            try
                            {
                                TaxAmount  = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/p")).Text.Replace("Combined taxes and assessments:", "");
                                PaidAmount = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/div[6]/div/div[1]/div/div")).Text;
                                PaidAmount = PaidAmount.Replace("\r\n", "&");
                                PaidAmount = WebDriverTest.Before(PaidAmount, "&");
                                PaidAmount = WebDriverTest.After(PaidAmount, "$").Trim();

                                ReceiptNumber = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/div[6]/div/div[1]/div/div/div")).Text.Replace("Receipt", "");
                                IWebElement         tbmulti = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/table[1]/tbody"));
                                IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                                IList <IWebElement> TDmulti;
                                foreach (IWebElement row in TRmulti)
                                {
                                    TDmulti = row.FindElements(By.TagName("td"));
                                    if (TDmulti.Count != 0)
                                    {
                                        Account_number = TDmulti[0].Text;
                                        string Escro_Code = TDmulti[2].Text;
                                        Millage_Code = TDmulti[3].Text;

                                        string tax_info1 = Account_number + "~" + Millage_Code + "~" + Escro_Code + "~" + TaxYear + "~" + TaxAmount + "~" + PaidAmount + "~" + ReceiptNumber + "~" + "Doug Belden, Tax Collector P.O. Box 30012 Tampa, Florida 33630-3012";

                                        gc.insert_date(orderNumber, parcelNumber, 473, tax_info1, 1, DateTime.Now);
                                    }
                                }
                            }
                            catch
                            {
                                TaxAmount = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/p")).Text.Replace("Combined taxes and assessments:", "");

                                PaidAmount = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/div[3]")).Text;
                                if (PaidAmount.Contains("Pay this bill"))
                                {
                                    PaidAmount    = "";
                                    ReceiptNumber = "";
                                }
                                else
                                {
                                    PaidAmount = PaidAmount.Replace("\r\n", "&");
                                    var PaidAmount1 = PaidAmount.Split('&');
                                    PaidAmount    = PaidAmount1[0];
                                    PaidAmount    = WebDriverTest.After(PaidAmount, "$").Trim();
                                    ReceiptNumber = PaidAmount1[1];
                                }

                                IWebElement         tbmulti = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/table[1]/tbody"));
                                IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));

                                IList <IWebElement> TDmulti;
                                foreach (IWebElement row in TRmulti)
                                {
                                    TDmulti = row.FindElements(By.TagName("td"));
                                    if (TDmulti.Count != 0)
                                    {
                                        Account_number = TDmulti[0].Text;
                                        string Escro_Code = TDmulti[2].Text;
                                        Millage_Code = TDmulti[3].Text;
                                        string tax_info1 = Account_number + "~" + Millage_Code + "~" + Escro_Code + "~" + TaxYear + "~" + TaxAmount + "~" + PaidAmount + "~" + ReceiptNumber + "~" + "Doug Belden, Tax Collector P.O. Box 30012 Tampa, Florida 33630-3012";
                                        gc.insert_date(orderNumber, parcelNumber, 473, tax_info1, 1, DateTime.Now);
                                    }
                                }
                            }
                            string IfPaidBy = "", PlesePay = "", DueDate = "", deli = "";
                            try
                            {
                                IWebElement         multitableElement26 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/table[4]/tbody"));
                                IList <IWebElement> multitableRow26     = multitableElement26.FindElements(By.TagName("tr"));

                                IList <IWebElement> multirowTD26;
                                foreach (IWebElement row in multitableRow26)
                                {
                                    multirowTD26 = row.FindElements(By.TagName("td"));
                                    int iRowsCount = multirowTD26.Count;
                                    for (int n = 0; n < iRowsCount; n++)
                                    {
                                        if ((!multirowTD26[n].Text.Contains("Face Amt")) && (!multirowTD26[n].Text.Contains("Certificate")))
                                        {
                                            IfPaidBy = multirowTD26[n].Text.Replace("\r\n", "~");
                                            var IfpaySplit = IfPaidBy.Split('~');
                                            IfPaidBy = IfpaySplit[0];
                                            PlesePay = IfpaySplit[1];
                                            if (PlesePay == "$0.00")
                                            {
                                                deli = "paid";
                                            }
                                            else
                                            {
                                                deli = "deliquent";
                                            }
                                            DueDate = TaxYear + "~" + deli + "~" + IfPaidBy + "~" + PlesePay;
                                            gc.insert_date(orderNumber, parcelNumber, 474, DueDate, 1, DateTime.Now);
                                        }
                                    }
                                }
                            }
                            //If_paid_by~Please_Pay
                            catch
                            {
                                IWebElement         multitableElement26 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/table[4]/tbody"));
                                IList <IWebElement> multitableRow26     = multitableElement26.FindElements(By.TagName("tr"));

                                IList <IWebElement> multirowTD26;
                                foreach (IWebElement row in multitableRow26)
                                {
                                    multirowTD26 = row.FindElements(By.TagName("td"));
                                    int iRowsCount = multirowTD26.Count;
                                    for (int n = 0; n < iRowsCount; n++)
                                    {
                                        if ((!multirowTD26[n].Text.Contains("Face Amt")) && (!multirowTD26[n].Text.Contains("Certificate")))
                                        {
                                            IfPaidBy = multirowTD26[n].Text.Replace("\r\n", "~");
                                            var IfpaySplit = IfPaidBy.Split('~');
                                            IfPaidBy = IfpaySplit[0];
                                            PlesePay = IfpaySplit[1];
                                            if (PlesePay == "$0.00")
                                            {
                                                deli = "paid";
                                            }
                                            else
                                            {
                                                deli = "deliquent";
                                            }
                                            DueDate = TaxYear + "~" + deli + "~" + IfPaidBy + "~" + PlesePay;
                                            gc.insert_date(orderNumber, parcelNumber, 474, DueDate, 1, DateTime.Now);
                                        }
                                    }
                                }
                            }

                            //*[@id="content"]/div[1]/div[3]/div[1]/ul/li[1]/a
                            driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[3]/div[1]/ul/li[1]/a")).Click();
                            Thread.Sleep(5000);
                            gc.CreatePdf(orderNumber, parcelNumber, "parcel details" + TaxYear, driver, "FL", "Collier");
                        }
                    }
                    catch { }
                    TaxTime     = DateTime.Now.ToString("HH:mm:ss");
                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "FL", "Collier", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderNumber, "FL", "Collier");
                    //gc.MMREM_Template(orderNumber, parcelNumber, "", driver, "FL", "Collier", "138", "4");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw ex;
                }
            }
        }
Example #28
0
        public string FTP_Mecklenburg(string address, string ownername, string parcelNumber, string searchType, string orderNumber, string directParcel)
        {
            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "", AssessTakenTime = "", TaxTakentime = "", CityTaxtakentime = "";
            string TotaltakenTime = "";

            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            string Parcel_No = "-", Account_No = "-", Location_Address = "-", Owner_Name = "-", Mailing_Address = "-", Land_Use_Code = "-", Land_Use_Desc = "-", Legal_Description = "-", Year_Built = "-";
            string Land_Value = "-", Building_Value = "-", Extra_Features = "-", Total_Appraised_Value = "-", Exemption_Deferment = "-";
            string owner_name = "-", Propertytax_Bill = "-", Bill_Status = "-", Bill_Flag = "-", Due_Date = "-", Interest_Begins = "-", Total_Billed = "-", Interest = "-", Paid_Date = "-", Type = "-", Paid_By = "-", Receipt_No = "-", Paid_Amount = "-", current_due = "-", Good_through_date = "-";
            string strAddress = "", strparcel = "", strOwner = "";
            var    driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            //driver = new PhantomJSDriver();
            // driver = new ChromeDriver();
            using (driver = new PhantomJSDriver())
            {
                try
                {
                    try
                    {
                        StartTime = DateTime.Now.ToString("HH:mm:ss");

                        if (searchType == "titleflex")
                        {
                            gc.TitleFlexSearch(orderNumber, "", "", address, "NC", "Mecklenburg");
                            if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                            {
                                driver.Quit();
                                return("MultiParcel");
                            }
                            else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                            {
                                HttpContext.Current.Session["Nodata_CAMecklenburg"] = "Yes";
                                driver.Quit();
                                return("No Data Found");
                            }
                            searchType   = "parcel";
                            parcelNumber = HttpContext.Current.Session["titleparcel"].ToString().Replace(".", "").Replace("-", "");
                        }

                        if (searchType == "address")
                        {
                            driver.Navigate().GoToUrl("https://property.spatialest.com/nc/mecklenburg/#/");
                            Thread.Sleep(2000);
                            driver.FindElement(By.Id("primary_search")).SendKeys(address);
                            gc.CreatePdf_WOP(orderNumber, "Address search", driver, "NC", "Mecklenburg");
                            driver.FindElement(By.Id("primary_search")).SendKeys(Keys.Enter);
                            Thread.Sleep(7000);

                            gc.CreatePdf_WOP(orderNumber, "Address search Result", driver, "NC", "Mecklenburg");
                            Thread.Sleep(3000);

                            //multi parcel
                            int Max = 0;
                            try
                            {
                                IWebElement         Assessment   = driver.FindElement(By.XPath("//*[@id='main-app']/div/div[1]/div[2]/div/div/div/div[2]"));
                                IList <IWebElement> TRAssessment = Assessment.FindElements(By.TagName("div"));

                                IList <IWebElement> TDAssessment;
                                foreach (IWebElement row in TRAssessment)
                                {
                                    TDAssessment = row.FindElements(By.TagName("p"));
                                    string strmulti = row.GetAttribute("class");
                                    if (TDAssessment.Count != 0 && !row.Text.Contains("Assessed Total Value") && strmulti == "tile")
                                    {
                                        strAddress = TDAssessment[1].Text;
                                        strparcel  = TDAssessment[4].Text.Replace("Parcel:", "").Trim();
                                        strOwner   = TDAssessment[5].Text.Replace("Owners:", "").Trim();
                                        string multidetails = strOwner + "~" + strAddress;
                                        gc.insert_date(orderNumber, strparcel, 57, multidetails, 1, DateTime.Now);
                                        Max++;
                                    }

                                    if (TDAssessment.Count != 0 && TDAssessment.Count > 25)
                                    {
                                        HttpContext.Current.Session["multiParcel_mecklenberg_count"] = "Maximum";
                                        driver.Quit();
                                        return("Maximum");
                                    }
                                }
                                if (Max > 1 && Max < 26)
                                {
                                    HttpContext.Current.Session["multiParcel_mecklenberg"] = "Yes";
                                    driver.Quit();
                                    return("MultiParcel");
                                }
                                if (Max == 0)
                                {
                                    HttpContext.Current.Session["Nodata_CAMecklenburg"] = "Zero";
                                    driver.Quit();
                                    return("No Data Found");
                                }
                            }
                            catch { }
                        }



                        if (searchType == "parcel")
                        {
                            if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                            {
                                parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                            }
                            driver.Navigate().GoToUrl("https://property.spatialest.com/nc/mecklenburg/#/");
                            Thread.Sleep(2000);
                            driver.FindElement(By.Id("primary_search")).SendKeys(parcelNumber);

                            gc.CreatePdf(orderNumber, parcelNumber, "Parcel Search", driver, "NC", "Mecklenburg");
                            Thread.Sleep(5000);

                            driver.FindElement(By.Id("primary_search")).SendKeys(Keys.Enter);
                            Thread.Sleep(5000);
                            gc.CreatePdf(orderNumber, parcelNumber, "Parcel Search Result", driver, "NC", "Mecklenburg");
                        }

                        if (searchType == "ownername")
                        {
                            driver.Navigate().GoToUrl("https://property.spatialest.com/nc/mecklenburg/#/");
                            Thread.Sleep(2000);
                            driver.FindElement(By.Id("primary_search")).SendKeys(ownername);
                            gc.CreatePdf_WOP(orderNumber, "Owner search", driver, "NC", "Mecklenburg");
                            driver.FindElement(By.Id("primary_search")).SendKeys(Keys.Enter);
                            Thread.Sleep(5000);
                            gc.CreatePdf_WOP(orderNumber, "Owner search Result", driver, "NC", "Mecklenburg");

                            //multi parcel
                            int Max = 0;
                            try
                            {
                                IWebElement         Assessment   = driver.FindElement(By.XPath("//*[@id='main-app']/div/div[1]/div[2]/div/div/div/div[2]"));
                                IList <IWebElement> TRAssessment = Assessment.FindElements(By.TagName("div"));

                                IList <IWebElement> TDAssessment;
                                foreach (IWebElement row in TRAssessment)
                                {
                                    TDAssessment = row.FindElements(By.TagName("p"));
                                    string strmulti = row.GetAttribute("class");
                                    if (TDAssessment.Count != 0 && !row.Text.Contains("Assessed Total Value") && strmulti == "tile")
                                    {
                                        strAddress = TDAssessment[1].Text;
                                        strparcel  = TDAssessment[4].Text.Replace("Parcel:", "").Trim();
                                        strOwner   = TDAssessment[5].Text.Replace("Owners:", "").Trim();
                                        string multidetails = strOwner + "~" + strAddress;
                                        gc.insert_date(orderNumber, strparcel, 57, multidetails, 1, DateTime.Now);
                                        Max++;
                                    }

                                    if (TDAssessment.Count != 0 && TDAssessment.Count > 25)
                                    {
                                        HttpContext.Current.Session["multiParcel_mecklenberg_count"] = "Maximum";
                                        driver.Quit();
                                        return("Maximum");
                                    }
                                }
                                if (Max > 1 && Max < 26)
                                {
                                    HttpContext.Current.Session["multiParcel_mecklenberg"] = "Yes";
                                    driver.Quit();
                                    return("MultiParcel");
                                }
                                if (Max == 0)
                                {
                                    HttpContext.Current.Session["Nodata_CAMecklenburg"] = "Zero";
                                    driver.Quit();
                                    return("No Data Found");
                                }
                            }

                            catch (NoSuchElementException ex1)
                            {
                                driver.Quit();
                                throw ex1;
                            }
                        }
                    }
                    catch (NoSuchElementException ex1)
                    {
                        driver.Quit();
                        throw ex1;
                    }


                    //Property details
                    Parcel_No        = driver.FindElement(By.XPath("//*[@id='prccontent']/div/section/div/div[1]/div[2]/header/div/div/div[1]/div[1]/span")).Text.Replace("PARCEL ID:", "").Trim();
                    Location_Address = driver.FindElement(By.XPath("//*[@id='prccontent']/div/section/div/div[1]/div[2]/header/div/div/div[1]/div[2]/span")).Text;
                    try
                    {
                        Owner_Name = driver.FindElement(By.XPath("//*[@id='prccontent']/div/section/div/div[1]/div[2]/header/div/div/div[2]/div/div")).Text;
                        Owner_Name = GlobalClass.Before(Owner_Name, "\r\n");
                    }
                    catch { }
                    Land_Use_Code     = driver.FindElement(By.XPath("//*[@id='keyinformation']/div[1]/div[2]/div/ul/li[1]/p[1]/span[2]")).Text;
                    Land_Use_Desc     = driver.FindElement(By.XPath("//*[@id='keyinformation']/div[1]/div[2]/div/ul/li[2]/p[1]/span[2]")).Text;
                    Legal_Description = driver.FindElement(By.XPath("//*[@id='keyinformation']/div[1]/div[2]/div/ul/li[6]/p/span[2]")).Text;
                    try
                    {
                        Year_Built = driver.FindElement(By.XPath("//*[@id='BuildingSection_residential_0']/div/div[1]/div/div/ul/li[2]/p/span[2]")).Text;
                    }
                    catch { }

                    string prop_details = Owner_Name + "~" + Location_Address + "~" + Legal_Description + "~" + Land_Use_Code + "~" + Land_Use_Desc + "~" + Year_Built;

                    prop_details = prop_details.Replace("\r\n", ",");
                    gc.insert_date(orderNumber, Parcel_No, 58, prop_details, 1, DateTime.Now);


                    //Assessment details
                    Land_Value            = driver.FindElement(By.XPath("//*[@id='keyinformation']/div[2]/div/div/ul/li[2]/p/span[2]")).Text;
                    Building_Value        = driver.FindElement(By.XPath("//*[@id='keyinformation']/div[2]/div/div/ul/li[3]/p/span[2]")).Text;
                    Extra_Features        = driver.FindElement(By.XPath("//*[@id='keyinformation']/div[2]/div/div/ul/li[4]/p/span[2]")).Text;
                    Total_Appraised_Value = driver.FindElement(By.XPath("//*[@id='keyinformation']/div[2]/div/div/ul/li[5]/p/span[2]")).Text;

                    string ass_details = Land_Value + "~" + Building_Value + "~" + Extra_Features + "~" + Total_Appraised_Value;
                    gc.insert_date(orderNumber, Parcel_No, 59, ass_details, 1, DateTime.Now);

                    gc.CreatePdf(orderNumber, Parcel_No, "Assessment and property details", driver, "NC", "Mecklenburg");
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");
                    //Tax Details
                    driver.Navigate().GoToUrl("https://taxbill.co.mecklenburg.nc.us/publicwebaccess/");
                    //select parcel number from drop down
                    var SerachBy      = driver.FindElement(By.Id("lookupCriterion"));
                    var selectElement = new SelectElement(SerachBy);
                    selectElement.SelectByText("Parcel Number");

                    //select tax type from drop down
                    var SerachTax      = driver.FindElement(By.Id("taxYear"));
                    var selectElement1 = new SelectElement(SerachTax);
                    selectElement1.SelectByText("ALL");

                    driver.FindElement(By.Id("txtSearchString")).SendKeys(Parcel_No);
                    gc.CreatePdf(orderNumber, Parcel_No, "Tax Details Result", driver, "NC", "Mecklenburg");
                    driver.FindElement(By.Id("btnGo")).SendKeys(Keys.Enter);
                    gc.CreatePdf(orderNumber, Parcel_No, "Tax information", driver, "NC", "Mecklenburg");
                    //Tax History
                    string              Bill = "-", Old_Bill = "-", Parcel = "-", Name = "-", location = "-", Bill_Flags = "-", Current_Due = "-", Taxyear = "";
                    IWebElement         TBTax = driver.FindElement(By.XPath("//*[@id='G_dgResults']/tbody"));
                    IList <IWebElement> TRTax = TBTax.FindElements(By.TagName("tr"));
                    IList <IWebElement> TDTax;
                    int count = TRTax.Count() - 1;
                    int j     = 1;
                    foreach (IWebElement row1 in TRTax)
                    {
                        if (j <= count)
                        {
                            TDTax    = row1.FindElements(By.TagName("td"));
                            Bill     = TDTax[0].Text;
                            Old_Bill = TDTax[1].Text;
                            if (Old_Bill == " ")
                            {
                                Old_Bill = "-";
                            }
                            Parcel     = TDTax[2].Text;
                            Name       = TDTax[3].Text;
                            location   = TDTax[4].Text;
                            Bill_Flags = TDTax[5].Text;
                            if (Bill_Flags == " ")
                            {
                                Bill_Flags = "-";
                            }
                            Current_Due = TDTax[6].Text;
                            string Tax_History = Bill + "~ " + Old_Bill + "~" + Name + "~" + location + "~" + Bill_Flags + "~" + Current_Due;
                            gc.insert_date(orderNumber, Parcel_No, 60, Tax_History, 1, DateTime.Now);
                        }

                        if (j > count)
                        {
                            string amount      = WebDriverTest.After(row1.Text, "Total:");
                            string Tax_History = "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "Total:" + "~" + amount;
                            gc.insert_date(orderNumber, Parcel_No, 60, Tax_History, 1, DateTime.Now);
                        }
                        j++;
                    }

                    //Tax iformation table
                    int           k       = 0;
                    List <string> Taxlist = new List <string>();
                    string        taxbill = "";
                    for (int l = 0; l < 5; l++)
                    {
                        try
                        {
                            IWebElement         TaxInfo   = driver.FindElement(By.Id("G_dgResults"));
                            IList <IWebElement> TRTaxInfo = TaxInfo.FindElements(By.TagName("tr"));
                            IList <IWebElement> THTaxInfo = TaxInfo.FindElements(By.TagName("th"));
                            IList <IWebElement> TDTaxInfo;
                            foreach (IWebElement row in TRTaxInfo)
                            {
                                TDTaxInfo = row.FindElements(By.TagName("td"));
                                if (TDTaxInfo.Count != 0 && !row.Text.Contains("Bill Flags") && !Taxlist.Contains(TDTaxInfo[0].Text.Trim()))
                                {
                                    taxbill = TDTaxInfo[0].Text.Trim();
                                    Taxlist.Add(taxbill);
                                    IWebElement Iclick = TDTaxInfo[0].FindElement(By.TagName("a"));
                                    Iclick.Click();
                                    Thread.Sleep(4000);
                                    k++;
                                    break;
                                }
                                try
                                {
                                    if (TDTaxInfo.Count != 0 && !row.Text.Contains("Bill Flags") && Taxlist.Contains(TDTaxInfo[0].Text.Trim()) && k != 1 && k != 2)
                                    {
                                        taxbill = TDTaxInfo[0].Text.Trim();
                                        Taxlist.Add(taxbill);
                                        IWebElement Iclick = TDTaxInfo[0].FindElement(By.TagName("a"));
                                        Iclick.Click();
                                        Thread.Sleep(4000);
                                        // break;
                                    }
                                }
                                catch { }
                            }
                        }
                        catch { }


                        //driver.FindElement(By.XPath("//*[@id='dgResults_r_0']/td[1]/a")).SendKeys(Keys.Enter);
                        gc.CreatePdf(orderNumber, Parcel_No, "Tax iformation Result" + l, driver, "NC", "Mecklenburg");
                        try
                        {
                            owner_name = driver.FindElement(By.Id("txtName")).Text;
                        }
                        catch { }
                        try
                        {
                            owner_name = driver.FindElement(By.Id("lblPriOwner")).Text;
                        }
                        catch { }
                        try
                        {
                            Propertytax_Bill = driver.FindElement(By.XPath("//*[@id='lblBill']")).Text;
                        }
                        catch { }
                        try
                        {
                            Propertytax_Bill = driver.FindElement(By.Id("lblNewAccount")).Text;
                        }
                        catch { }
                        try
                        {
                            Bill_Status = driver.FindElement(By.XPath("//*[@id='lblBillStatus']")).Text;
                        }
                        catch { }
                        Bill_Flag = driver.FindElement(By.XPath("//*[@id='lblBillFlag']")).Text;
                        if (Bill_Flag == "")
                        {
                            Bill_Flag = "-";
                        }
                        try
                        {
                            Due_Date = driver.FindElement(By.XPath("//*[@id='lblDueDate']")).Text;
                        }
                        catch { }
                        try
                        {
                            Interest_Begins = driver.FindElement(By.XPath("//*[@id='lblInterest']")).Text;
                        }
                        catch { }
                        try
                        {
                            Interest_Begins = driver.FindElement(By.Id("lblIntBegins")).Text;
                        }
                        catch { }
                        string paidbydate = "";
                        try
                        {
                            paidbydate = driver.FindElement(By.Id("interestCalDate_input")).Text;
                        }
                        catch { }

                        if (Bill_Flag == "DELINQUENT")
                        {
                            good_date         = driver.FindElement(By.XPath("//*[@id='interestCalDate_input']"));
                            Good_through_date = good_date.GetAttribute("value");
                            if (Good_through_date.Contains("Select A Date"))
                            {
                                Good_through_date = "-";
                                Total_Billed      = driver.FindElement(By.XPath("//*[@id='lblTotalAmountDue']")).Text;
                                Interest          = driver.FindElement(By.XPath("//*[@id='lblInterestAmt']")).Text;
                                current_due       = driver.FindElement(By.XPath("//*[@id='lblCurrentDue']")).Text;
                            }
                        }
                        else
                        {
                            if (Bill_Flag == "DELINQUENT")
                            {
                                DateTime G_Date       = Convert.ToDateTime(Good_through_date);
                                string   dateChecking = DateTime.Now.ToString("MM") + "/15/" + DateTime.Now.ToString("yyyy");

                                if (G_Date < Convert.ToDateTime(dateChecking))
                                {
                                    //end of the month
                                    Good_through_date = new DateTime(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM"))), DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(DateTime.Now.ToString("MM")))).ToString("MM/dd/yyyy");
                                }

                                else if (G_Date > Convert.ToDateTime(dateChecking))
                                {
                                    // nextEndOfMonth
                                    if ((Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM"))) < 12))
                                    {
                                        Good_through_date = new DateTime(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM")) + 1), DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(DateTime.Now.ToString("MM")) + 1)).ToString("MM/dd/yyyy");
                                    }
                                    else
                                    {
                                        int nxtYr = Convert.ToInt16(DateTime.Now.ToString("yyyy")) + 1;
                                        Good_through_date = new DateTime(nxtYr, 1, DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), 1)).ToString("MM/dd/yyyy");
                                    }
                                }

                                //recalculate interest
                                good_date.Clear();
                                good_date.SendKeys(Good_through_date);
                                driver.FindElement(By.Id("btnRecalInterest")).SendKeys(Keys.Enter);
                                gc.CreatePdf(orderNumber, Parcel_No, "After Good Through Date Calculate" + l, driver, "NC", "Mecklenburg");
                                Total_Billed = driver.FindElement(By.XPath("//*[@id='lblTotalAmountDue']")).Text;
                                Interest     = driver.FindElement(By.XPath("//*[@id='lblInterestAmt']")).Text;
                                current_due  = driver.FindElement(By.XPath("//*[@id='lblCurrentDue']")).Text;
                            }
                        }


                        //transcation history
                        string strtaxyear1 = "", strtaxyear2 = "", strtaxyear3 = "", Pdate = "";
                        try
                        {
                            Pdate = driver.FindElement(By.Id("lblDueDate")).Text;
                            string[] Tax_year = Pdate.Split('/');
                            strtaxyear1 = Tax_year[0];
                            strtaxyear2 = Tax_year[1];
                            strtaxyear3 = Tax_year[2];
                        }
                        catch { }
                        IWebElement         tb_trans = driver.FindElement(By.XPath("//*[@id='dgShowResultHistory']/tbody"));
                        IList <IWebElement> TR_trans = tb_trans.FindElements(By.TagName("tr"));
                        IList <IWebElement> TD_trans;

                        foreach (IWebElement row2 in TR_trans)
                        {
                            if (TR_trans.Count == 1)
                            {
                                string tax = strtaxyear3 + "~ " + owner_name + "~ " + Propertytax_Bill + "~ " + Bill_Status + "~ " + Bill_Flag + "~ " + Due_Date + "~ " + Interest_Begins + "~ " + Total_Billed + "~ " + Interest + "~ " + current_due + "~ " + Good_through_date + "~ " + Paid_Date + "~ " + Type + "~ " + Paid_By + "~ " + Receipt_No + "~ " + Paid_Amount;
                                // tax = tax.Replace("\r\n", "");
                                gc.insert_date(orderNumber, Parcel_No, 61, tax, 1, DateTime.Now);
                            }
                            if (!row2.Text.Contains("Date"))
                            {
                                TD_trans = row2.FindElements(By.TagName("td"));
                                try
                                {
                                    Type        = TD_trans[1].Text;
                                    Paid_By     = TD_trans[2].Text;
                                    Receipt_No  = TD_trans[3].Text;
                                    Paid_Amount = TD_trans[4].Text;
                                }
                                catch { }
                                string tax = strtaxyear3 + "~ " + owner_name + "~ " + Propertytax_Bill + "~ " + Bill_Status + "~ " + Bill_Flag + "~ " + Due_Date + "~ " + Interest_Begins + "~ " + Total_Billed + "~ " + Interest + "~ " + current_due + "~ " + Good_through_date + "~ " + Paid_Date + "~ " + Type + "~ " + Paid_By + "~ " + Receipt_No + "~ " + Paid_Amount;
                                if (tax.Contains("\r\n"))
                                {
                                    tax = tax.Replace("\r\n", "");
                                    gc.insert_date(orderNumber, Parcel_No, 61, tax, 1, DateTime.Now);
                                }
                                else
                                {
                                    gc.insert_date(orderNumber, Parcel_No, 61, tax, 1, DateTime.Now);
                                }
                            }
                        }


                        //Tax/Fee Distribution Table:
                        string Rate = "-", Tax_Districts = "-", Description = "-", Amount = "-";
                        try
                        {
                            IWebElement         TBTaxFee = driver.FindElement(By.XPath("//*[@id='dgShowResultRate']/tbody"));
                            IList <IWebElement> TRTaxFee = TBTaxFee.FindElements(By.TagName("tr"));
                            IList <IWebElement> TDTaxFee;

                            foreach (IWebElement row2 in TRTaxFee)
                            {
                                if (!row2.Text.Contains("Rate"))
                                {
                                    TDTaxFee = row2.FindElements(By.TagName("td"));
                                    Rate     = TDTaxFee[0].Text;
                                    if (Rate == "")
                                    {
                                        Rate = "-";
                                    }
                                    Tax_Districts = TDTaxFee[1].Text;
                                    Description   = TDTaxFee[2].Text;
                                    Amount        = TDTaxFee[3].Text;
                                    string taxfee = strtaxyear3 + "~ " + Rate + "~ " + Tax_Districts + "~ " + Description + "~ " + Amount;
                                    gc.insert_date(orderNumber, Parcel_No, 64, taxfee, 1, DateTime.Now);
                                }
                            }
                        }
                        catch { }
                        driver.Navigate().Back();
                        Thread.Sleep(4000);
                        l++;
                    }
                    TaxTime     = DateTime.Now.ToString("HH:mm:ss");
                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "NC", "Mecklenburg", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderNumber, "NC", "Mecklenburg");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw ex;
                }
            }
        }
Example #29
0
        public string FTP_Harrison(string houseno, string sname, string sttype, string parcelNumber, string searchType, string orderNumber, string ownername, string directParcel, string account)
        {
            string        NAME = "", PROPERTY = "", ADDRESS = "", PARCEL = "";
            string        Parcel_No = "-", Owner_Name = "-", Property_Address = "-", Legal_Description = "-", Exempt_Code = "-", Homestead_Code = "-", PPIN = "-", Section = "-", Township = "-", Range = "-";
            string        Tax_Year = "-", Assessed_Land_Value = "-", Assessed_Improvement_Value = "-", Total_Value = "-", Assessed = "-";
            List <string> Li = new List <string>();
            IWebElement   link;
            string        mp = "";

            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";
            string addr    = sname + " " + sttype;
            string address = houseno + addr;

            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");
                    if (HttpContext.Current.Session["MobileTax_harrison"] == null)
                    {
                        if (searchType == "titleflex")
                        {
                            gc.TitleFlexSearch(orderNumber, parcelNumber, "", address, "MS", "Harrison");
                            if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                            {
                                driver.Quit();
                                return("MultiParcel");
                            }
                            else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                            {
                                HttpContext.Current.Session["Nodata_HarrisonMS"] = "Yes";
                                driver.Quit();
                                return("No Data Found");
                            }
                            parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                            searchType   = "parcel";
                        }

                        if (searchType == "address")
                        {
                            driver.Navigate().GoToUrl("http://www.deltacomputersystems.com/MS/MS24DELTA/plinkquerym.html");
                            driver.FindElement(By.XPath("/html/body/table/tbody/tr[5]/td[2]/form/table/tbody/tr[2]/td[2]/input[1]")).SendKeys(houseno);

                            driver.FindElement(By.XPath("/html/body/table/tbody/tr[5]/td[2]/form/table/tbody/tr[2]/td[2]/input[2]")).SendKeys(addr);
                            gc.CreatePdf_WOP(orderNumber, "Address Search", driver, "MS", "Harrison");
                            driver.FindElement(By.XPath("/html/body/table/tbody/tr[5]/td[2]/form/input[1]")).SendKeys(Keys.Enter);
                            gc.CreatePdf_WOP(orderNumber, "Address Search Result", driver, "MS", "Harrison");
                            Thread.Sleep(3000);

                            IWebElement         tb = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody"));
                            IList <IWebElement> TR = tb.FindElements(By.TagName("tr"));
                            string Address         = houseno + " " + addr;
                            int    a     = 1;
                            bool   value = false;

                            foreach (IWebElement row1 in TR)

                            {
                                if ((row1.Text.Contains(Address.ToUpper().Trim())) && (!row1.Text.Contains("PROPERTY")))

                                {
                                    mp = "/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + a + "]/td[1]/a";

                                    value = true;
                                    //multiparcel
                                    NAME    = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + a + "]/td[3]/font")).Text;
                                    ADDRESS = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + a + "]/td[1]/a/font")).Text;
                                    PARCEL  = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + a + "]/td[2]/font")).Text;

                                    Li.Add(NAME);
                                    string multi = NAME + "~" + ADDRESS;
                                    gc.insert_date(orderNumber, PARCEL, 87, multi, 1, DateTime.Now);

                                    //break;
                                }
                                a++;
                            }

                            //Multi parcel
                            if (Li.Count > 1)
                            {
                                HttpContext.Current.Session["multiparcel_harrison"] = "Yes";
                                gc.CreatePdf_WOP(orderNumber, "Address MultiParcel", driver, "MS", "Harrison");
                                driver.Quit();
                                return("MultiParcel");
                            }
                            else if (mp != "")
                            {
                                link = driver.FindElement(By.XPath(mp));
                                link.SendKeys(Keys.Enter);
                            }
                            if (!value)
                            {
                                int b = 1;
                                driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/a[1]")).SendKeys(Keys.Enter);
                                IWebElement         tb1 = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody"));
                                IList <IWebElement> TR1 = tb1.FindElements(By.TagName("tr"));
                                foreach (IWebElement row2 in TR1)
                                {
                                    if ((row2.Text.Contains(Address.ToUpper().Trim())) && (!row2.Text.Contains("PROPERTY")))

                                    {
                                        driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + b + "]/td[1]/a")).SendKeys(Keys.Enter);

                                        break;
                                    }
                                    b++;
                                }
                            }
                        }

                        else if (searchType == "parcel")
                        {
                            driver.Navigate().GoToUrl("http://www.deltacomputersystems.com/MS/MS24DELTA/plinkquerym.html");
                            gc.CreatePdf(orderNumber, parcelNumber, "Parcel search", driver, "MS", "Harrison");


                            if (parcelNumber.Contains("-"))
                            {
                                parcelNumber = parcelNumber.Replace("-", "").Trim();
                            }
                            if (parcelNumber.Contains("."))
                            {
                                parcelNumber = parcelNumber.Replace(".", "").Trim();
                            }

                            string first  = parcelNumber.Substring(0, 5);
                            string second = parcelNumber.Substring(5, 2);
                            string third  = parcelNumber.Substring(7, 3);
                            string fourth = parcelNumber.Substring(10, 3);
                            parcelNumber = first + "-" + second + "-" + third + "." + fourth;
                            driver.FindElement(By.XPath("/html/body/table/tbody/tr[5]/td[2]/form/table/tbody/tr[3]/td[2]/input")).SendKeys(parcelNumber);
                            gc.CreatePdf(orderNumber, parcelNumber, "Parcel search result", driver, "MS", "Harrison");
                            Thread.Sleep(3000);
                            driver.FindElement(By.XPath("/html/body/table/tbody/tr[5]/td[2]/form/input[1]")).SendKeys(Keys.Enter);
                            Thread.Sleep(3000);
                            IWebElement         tb = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody"));
                            IList <IWebElement> TR = tb.FindElements(By.TagName("tr"));

                            int a = 1;

                            foreach (IWebElement row1 in TR)
                            {
                                if ((row1.Text.Contains(parcelNumber.Trim())) && (!row1.Text.Contains("PROPERTY")))
                                {
                                    driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + a + "]/td[1]/a")).SendKeys(Keys.Enter);
                                    break;
                                }
                                a++;
                            }
                        }

                        else if (searchType == "ownername")
                        {
                            HttpContext.Current.Session["multiparcel_harrison"] = "Yes";
                            driver.Navigate().GoToUrl("http://www.deltacomputersystems.com/MS/MS24DELTA/plinkquerym.html");
                            gc.CreatePdf_WOP(orderNumber, "Owner Search", driver, "MS", "Harrison");
                            string[] on     = ownername.Split(' ');
                            string   first  = on[0];
                            string   second = on[1];
                            ownername = first + " " + second;

                            driver.FindElement(By.XPath("/html/body/table/tbody/tr[5]/td[2]/form/table/tbody/tr[1]/td[2]/input[4]")).SendKeys(ownername);
                            Thread.Sleep(3000);
                            driver.FindElement(By.XPath("/html/body/table/tbody/tr[5]/td[2]/form/input[1]")).SendKeys(Keys.Enter);
                            gc.CreatePdf_WOP(orderNumber, "Owner Search result", driver, "MS", "Harrison");
                            Thread.Sleep(3000);
                            IWebElement         tb = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody"));
                            IList <IWebElement> TR = tb.FindElements(By.TagName("tr"));

                            int a = 1;

                            foreach (IWebElement row1 in TR)

                            {
                                if ((row1.Text.Contains(ownername.ToUpper().Trim())) && (!row1.Text.Contains("PROPERTY")))

                                {
                                    NAME     = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + a + "]/td[1]/a/font")).Text;
                                    PROPERTY = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + a + "]/td[2]/font")).Text;
                                    ADDRESS  = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + a + "]/td[3]/font")).Text;
                                    PARCEL   = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + a + "]/td[4]/font")).Text;

                                    ADDRESS = PROPERTY + ADDRESS;
                                    string multi = NAME + "~" + ADDRESS;
                                    gc.insert_date(orderNumber, PARCEL, 87, multi, 1, DateTime.Now);
                                }
                                a++;
                            }

                            driver.Quit();
                            return("MultiParcel");
                        }
                        Thread.Sleep(3000);

                        gc.CreatePdf_WOP(orderNumber, "Property and Tax details result", driver, "MS", "Harrison");
                        //Property Details
                        Parcel_No         = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[2]/td/table/tbody/tr[6]/td[2]/font")).Text.Trim();
                        Owner_Name        = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[2]/td/table/tbody/tr[1]/td[2]/font")).Text.Trim();
                        Property_Address  = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[2]/td/table/tbody/tr[7]/td[2]/font")).Text.Trim();
                        Legal_Description = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[1]/td[4]/font")).Text.Trim();
                        string ab = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[2]/td[4]/font")).Text.Trim();
                        string ac = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[3]/td[4]/font")).Text.Trim();
                        string ad = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[4]/td[4]/font")).Text.Trim();
                        Legal_Description = Legal_Description + ab + ac + ad.Trim();
                        Exempt_Code       = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[2]/td[2]/font")).Text.Trim();
                        Homestead_Code    = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[3]/td[2]/font")).Text.Trim();
                        PPIN     = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[4]/td[2]/font")).Text.Trim();
                        Section  = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[5]/td[2]/font")).Text.Trim();
                        Township = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[6]/td[2]/font")).Text.Trim();
                        Range    = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[7]/td[2]/font")).Text.Trim();

                        string prop = Owner_Name + "~" + Property_Address + "~" + Legal_Description + "~" + Exempt_Code + "~" + Homestead_Code + "~" + PPIN + "~" + Section + "~" + Township + "~" + Range;
                        gc.insert_date(orderNumber, Parcel_No, 88, prop, 1, DateTime.Now);

                        //Assessment details
                        Tax_Year                   = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[1]/tbody/tr[3]/td[2]/font[1]/b")).Text;
                        Tax_Year                   = WebDriverTest.After(Tax_Year, "Year ");
                        Assessed_Land_Value        = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[2]/td/table/tbody/tr[2]/td[4]/font")).Text;
                        Assessed_Improvement_Value = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[2]/td/table/tbody/tr[3]/td[4]/font")).Text;
                        Total_Value                = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[2]/td/table/tbody/tr[4]/td[4]/font")).Text;
                        Assessed                   = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[2]/td/table/tbody/tr[5]/td[4]/font")).Text;

                        string assessment = Tax_Year + "~" + Assessed_Land_Value + "~" + Assessed_Improvement_Value + "~" + Total_Value + "~" + Assessed;
                        gc.insert_date(orderNumber, Parcel_No, 89, assessment, 1, DateTime.Now);
                        AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                        //Tax details

                        string YEAR_2017 = "-", TAX_DUE = "-", PAID = "-", BALANCE = "-", Mail_Payments_To = "-", LAST_PAYMENT_DATE = "-";
                        try
                        {
                            Mail_Payments_To = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[4]/td/table/tbody/tr[6]/td[4]/font/b/p")).Text;
                        }
                        catch { }
                        try
                        {
                            LAST_PAYMENT_DATE = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[4]/td/table/tbody/tr[7]/td[2]/font")).Text;
                        }
                        catch { }
                        try
                        {
                            if (Mail_Payments_To.Trim() == "")
                            {
                                Mail_Payments_To = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[4]/td/table/tbody/tr[7]/td[4]/font/b/p")).Text;
                            }
                        }
                        catch { }
                        try
                        {
                            if (LAST_PAYMENT_DATE.Trim() == "")
                            {
                                LAST_PAYMENT_DATE = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[4]/td/table/tbody/tr[8]/td[2]/font")).Text;
                            }
                        }
                        catch { }

                        if (Mail_Payments_To.Contains("\r\n"))
                        {
                            Mail_Payments_To = Mail_Payments_To.Replace("\r\n", "");
                        }


                        IWebElement         TBTax = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[4]/td/table/tbody"));
                        IList <IWebElement> TRTax = TBTax.FindElements(By.TagName("tr"));
                        IList <IWebElement> TDTax;
                        //  int count = TRTax.Count - 2;
                        // int i = 1;
                        foreach (IWebElement row1 in TRTax)
                        {
                            if (!row1.Text.Contains("YEAR") && !row1.Text.Contains("Mail") && !row1.Text.Contains("LAST PAYMENT DATE") && !row1.Text.Contains("DELINQUENT PRIOR"))
                            {
                                TDTax     = row1.FindElements(By.TagName("td"));
                                YEAR_2017 = TDTax[0].Text;
                                TAX_DUE   = TDTax[1].Text;
                                PAID      = TDTax[2].Text;
                                BALANCE   = TDTax[3].Text;
                                string tax = Owner_Name + "~" + Tax_Year + "~" + YEAR_2017 + "~" + TAX_DUE + "~" + PAID + "~" + BALANCE + "~" + Mail_Payments_To + "~" + LAST_PAYMENT_DATE;
                                gc.insert_date(orderNumber, Parcel_No, 90, tax, 1, DateTime.Now);
                            }
                            // i++;
                        }

                        //tax history details
                        string Year = "-", Owner = "-", Total_Tax = "=", PaidYN = "-", Last_Payment_Date = "-";

                        IWebElement         TBTax_History = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table"));
                        IList <IWebElement> TRTax_History = TBTax_History.FindElements(By.TagName("tr"));
                        IList <IWebElement> TDTax_History;
                        foreach (IWebElement row1 in TRTax_History)
                        {
                            if (row1.Text.Contains("LAST PAYMENT DATE"))
                            {
                                TDTax_History     = row1.FindElements(By.TagName("td"));
                                Year              = TDTax_History[0].Text;
                                Owner             = TDTax_History[1].Text;
                                Total_Tax         = TDTax_History[2].Text;
                                PaidYN            = TDTax_History[3].Text;
                                Last_Payment_Date = WebDriverTest.After(PaidYN, "DATE ");
                                PaidYN            = WebDriverTest.Before(PaidYN, "LAST");
                                if (PaidYN.Contains("\r\n"))
                                {
                                    PaidYN = PaidYN.Replace("\r\n", "").Trim();
                                }

                                string tax_history = Year + "~" + Owner + "~" + Total_Tax + "~" + PaidYN + "~" + Last_Payment_Date;
                                gc.insert_date(orderNumber, Parcel_No, 91, tax_history, 1, DateTime.Now);
                            }
                        }
                    }

                    //Mobile tax
                    string ACCOUNT = "", Mobile_tax_Onwer_NAME = "", MAKE = "", strTaxesFees = "";
                    string Account = "-", Receipt = "-", Due_Date = "-", Landroll_PPIN = "-", Court_Code = "-", Court_Lot = "-", Trailer_Make = "-", Number_of_Stories = "-", Number_of_Owners = "-", Width = "-", Length = "-", Model_Year = "-", Color = "-", MobileTax_Owner_Name = "-", MobileTax_Address = "-";
                    string Millage_Tax_Year = "-", Value_Table_Year = "-", Tax_District1 = "-", Tax_District2 = "-", Tax_District3 = "-", Judicial_District = "-", Full_Value = "-", MobileTax_Total_Value = "-", Prorated_Value = "-", County_Tax_Rate = "-", County_Tax_Due = "-", City_Tax_Rate = "-", City_Tax_Due = "-", School_Tax_Due = "-", School_Tax_Rate = "-", Total_Due = "-", TAXES_PAID = "-", Estimated_Balance_Due = "-";
                    driver.Navigate().GoToUrl("http://www.deltacomputersystems.com/MS/MS24DELTA/mhinquirym2.html");
                    gc.CreatePdf_WOP(orderNumber, "Mobile Tax", driver, "MS", "Harrison");
                    if (Parcel_No == "-")
                    {
                        driver.FindElement(By.XPath("//*[@id='HTMPARCEL']")).SendKeys(parcelNumber);
                    }
                    else
                    {
                        driver.FindElement(By.XPath("//*[@id='HTMPARCEL']")).SendKeys(Parcel_No);
                    }

                    driver.FindElement(By.XPath("/html/body/table/tbody/tr[5]/td[2]/form/div/table/tbody/tr[9]/td[2]/input[1]")).SendKeys(Keys.Enter);
                    gc.CreatePdf_WOP(orderNumber, "Mobile Homes Result", driver, "MS", "Harrison");

                    IWebElement         TB_mobiletax = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody"));
                    IList <IWebElement> TRmobiletax  = TB_mobiletax.FindElements(By.TagName("tr"));
                    IList <IWebElement> TDmobiletax;
                    if (account == "")
                    {
                        foreach (IWebElement row2 in TRmobiletax)
                        {
                            if (!row2.Text.Contains("ACCOUNT") && row2.Text.Contains(Parcel_No))
                            {
                                TDmobiletax           = row2.FindElements(By.TagName("td"));
                                ACCOUNT               = TDmobiletax[0].Text;
                                Mobile_tax_Onwer_NAME = TDmobiletax[1].Text;
                                MAKE = TDmobiletax[2].Text;

                                HttpContext.Current.Session["MobileTax_harrison"] = "Yes";
                                string mb = ACCOUNT + "~" + Mobile_tax_Onwer_NAME + "~" + MAKE;
                                gc.insert_date(orderNumber, Parcel_No, 92, mb, 1, DateTime.Now);
                                try
                                {
                                    string deli = TDmobiletax[7].Text;
                                    if (deli.Contains("Delinquent"))
                                    {
                                        HttpContext.Current.Session["deliquent_harrison"] = "Yes";
                                    }
                                }
                                catch { }
                            }
                        }
                    }

                    else
                    {
                        int    d           = 1;
                        string mobile_Prop = "";
                        string mobile_tax  = "";
                        foreach (IWebElement row2 in TRmobiletax)
                        {
                            if (row2.Text.Contains(account))
                            {
                                IWebElement         element = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + d + "]/td[1]/a/font"));
                                IJavaScriptExecutor js      = driver as IJavaScriptExecutor;
                                js.ExecuteScript("arguments[0].click();", element);
                                gc.CreatePdf_WOP(orderNumber, "Mobile Homes Tax and property Result", driver, "MS", "Harrison");
                                Thread.Sleep(3000);

                                //Mobile tax property details

                                IWebElement         TB_mobile = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody"));
                                IList <IWebElement> TRmobile  = TB_mobile.FindElements(By.TagName("tr"));
                                IList <IWebElement> TDmobile;

                                foreach (IWebElement row3 in TRmobile)
                                {
                                    TDmobile = row3.FindElements(By.TagName("td"));
                                    if (row3.Text.Contains("Account"))
                                    {
                                        Account = TDmobile[2].Text.ToString();
                                        Account = WebDriverTest.Before(Account, " Year");
                                    }
                                    if (row3.Text.Contains("Receipt"))
                                    {
                                        Receipt = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Due Date"))
                                    {
                                        Due_Date = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Landroll PPIN"))
                                    {
                                        Landroll_PPIN = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Court Code"))
                                    {
                                        Court_Code = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Court Lot"))
                                    {
                                        Court_Lot = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Trailer Make"))
                                    {
                                        Trailer_Make = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Number of Stories"))
                                    {
                                        Number_of_Stories = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Number of Owners"))
                                    {
                                        Number_of_Owners = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Width"))
                                    {
                                        Width = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Length"))
                                    {
                                        Length = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Model Year"))
                                    {
                                        Model_Year = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Color"))
                                    {
                                        Color = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Name"))
                                    {
                                        MobileTax_Owner_Name = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Address 1"))
                                    {
                                        MobileTax_Address = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Zip"))
                                    {
                                        string city1 = TDmobile[2].Text.ToString();
                                        MobileTax_Address = MobileTax_Address + city1;
                                    }


                                    mobile_Prop = Account + "~" + Receipt + "~" + Due_Date + "~" + Landroll_PPIN + "~" + Court_Code + "~" + Court_Lot + "~" + Trailer_Make + "~" + Number_of_Stories + "~" + Number_of_Owners + "~" + Width + "~" + Length + "~" + Model_Year + "~" + Color + "~" + MobileTax_Owner_Name + "~" + MobileTax_Address;

                                    //Mobile Home Current Tax & Fees Details
                                    if (row3.Text.Contains("TAXES & FEES"))
                                    {
                                        strTaxesFees = "TAXES & FEES";
                                    }
                                    if (row3.Text.Contains("Millage"))
                                    {
                                        Millage_Tax_Year = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Value Table Year"))
                                    {
                                        Value_Table_Year = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Tax District 1"))
                                    {
                                        Tax_District1 = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Tax District 2"))
                                    {
                                        Tax_District2 = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Tax District 3"))
                                    {
                                        Tax_District3 = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Judicial District"))
                                    {
                                        Judicial_District = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Full Value"))
                                    {
                                        Full_Value = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Total Value"))
                                    {
                                        MobileTax_Total_Value = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Prorated Value"))
                                    {
                                        Prorated_Value = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("County"))
                                    {
                                        County_Tax_Rate = TDmobile[2].Text.ToString();
                                        County_Tax_Due  = TDmobile[3].Text.ToString();
                                    }

                                    if (row3.Text.Contains("City") && strTaxesFees == "TAXES & FEES")
                                    {
                                        City_Tax_Rate = TDmobile[2].Text.ToString();
                                        City_Tax_Due  = TDmobile[3].Text.ToString();
                                    }

                                    if (row3.Text.Contains("School"))
                                    {
                                        School_Tax_Due  = TDmobile[2].Text.ToString();
                                        School_Tax_Rate = TDmobile[3].Text.ToString();
                                    }

                                    if (row3.Text.Contains("Total Due"))
                                    {
                                        Total_Due = TDmobile[3].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Taxes Paid"))
                                    {
                                        TAXES_PAID = TDmobile[3].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Estimated Balance Due"))
                                    {
                                        Estimated_Balance_Due = TDmobile[3].Text.ToString();
                                    }

                                    mobile_tax = Millage_Tax_Year + "~" + Value_Table_Year + "~" + Tax_District1 + "~" + Tax_District2 + "~" + Tax_District3 + "~" + Judicial_District + "~" + Full_Value + "~" + MobileTax_Total_Value + "~" + Prorated_Value + "~" + County_Tax_Rate + "~" + County_Tax_Due + "~" + City_Tax_Rate + "~" + City_Tax_Due + "~" + School_Tax_Due + "~" + School_Tax_Rate + "~" + Total_Due + "~" + TAXES_PAID + "~" + Estimated_Balance_Due;
                                }

                                gc.insert_date(orderNumber, parcelNumber, 94, mobile_Prop, 1, DateTime.Now);
                                gc.insert_date(orderNumber, parcelNumber, 95, mobile_tax, 1, DateTime.Now);
                                break;
                            }
                            d++;
                        }
                    }

                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "MS", "Harrison", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderNumber, "MS", "Harrison");
                    return("Data Inserted Successfully");
                }

                catch (NoSuchElementException ex1)
                {
                    driver.Quit();
                    throw ex1;
                }
            }
        }
        public string FTP_Charlotte(string houseno, string housetype, string sname, string direction, string unitno, string ownername, string parcelNumber, string searchType, string orderNumber, string directParcel)
        {
            string      StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "", AssessTakenTime = "", TaxTakentime = "", CityTaxtakentime = "";
            string      TotaltakenTime = "";
            GlobalClass gc             = new GlobalClass();

            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            string owner = "", folio_parcel_no = "-", Legal_desc = "", property_use = "", Tax_district = "", Year_built = "", Neighbourhood = "", subdivision = "", situs_address = "", pin = "";

            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            //driver = new PhantomJSDriver();
            //driver = new ChromeDriver();
            using (driver = new PhantomJSDriver())
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");
                    driver.Navigate().GoToUrl("https://www.ccappraiser.com/rp_real_search.asp");

                    Thread.Sleep(4000);
                    if (searchType == "titleflex")
                    {
                        string titleaddress = houseno + " " + sname + " " + housetype + " " + unitno;
                        gc.TitleFlexSearch(orderNumber, "", "", titleaddress, "FL", "Charlotte");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Charlotte_Zero"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "address")
                    {
                        driver.FindElement(By.Id("PropertyAddressNumber")).SendKeys(houseno);
                        driver.FindElement(By.Id("PropertyAddressStreetName")).SendKeys(sname);
                        gc.CreatePdf_WOP(orderNumber, "Address Search", driver, "FL", "Charlotte");
                        driver.FindElement(By.Id("Button3")).SendKeys(Keys.Enter);
                        Thread.Sleep(5000);
                        gc.CreatePdf_WOP(orderNumber, "Address Search result", driver, "FL", "Charlotte");

                        int trCount = driver.FindElements(By.XPath("/html/body/table/tbody/tr[2]/td/table/tbody/tr")).Count;
                        try
                        {
                            string NOdata = driver.FindElement(By.XPath("/html/body/p[1]")).Text;
                            if (NOdata.Contains("Sorry, your selection"))
                            {
                                HttpContext.Current.Session["Charlotte_Zero"] = "Zero";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                        if (trCount > 2)
                        {   //multi parcel
                            IWebElement         tbmulti2 = driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td/table/tbody"));
                            IList <IWebElement> TRmulti2 = tbmulti2.FindElements(By.TagName("tr"));
                            IList <IWebElement> TDmulti2;
                            int k = 0;
                            foreach (IWebElement row in TRmulti2)
                            {
                                if (k < 25)
                                {
                                    TDmulti2 = row.FindElements(By.TagName("td"));
                                    if (TDmulti2.Count != 0 && TDmulti2[1].Text.Trim() != "")
                                    {
                                        string multi1 = TDmulti2[1].Text + "~" + TDmulti2[2].Text;
                                        gc.insert_date(orderNumber, TDmulti2[0].Text, 687, multi1, 1, DateTime.Now);
                                        //  Owner~address
                                    }
                                    k++;
                                }
                            }
                            HttpContext.Current.Session["multiParcel_Charlotte"] = "Yes";
                            if (TRmulti2.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_Charlotte_Multicount"] = "Maximum";
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else
                        {
                            Thread.Sleep(2000);
                            IWebElement Multisingle = driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td[1]")).FindElement(By.TagName("a"));
                            string      Multiclick  = Multisingle.GetAttribute("href");
                            driver.Navigate().GoToUrl(Multiclick);
                            //driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td/table/tbody/tr[2]/td[1]/a")).Click();
                            Thread.Sleep(3000);
                        }
                    }
                    if (searchType == "parcel")
                    {
                        driver.FindElement(By.Id("ParcelID_number")).SendKeys(parcelNumber);

                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel Search", driver, "FL", "Charlotte");
                        driver.FindElement(By.Id("Button3")).SendKeys(Keys.Enter);
                        Thread.Sleep(5000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel Search result", driver, "FL", "Charlotte");
                        try
                        {
                            driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td[1]/a")).Click();
                            Thread.Sleep(3000);
                        }
                        catch { }
                    }

                    if (searchType == "ownername")
                    {
                        string   lastname = "", firstname = "";
                        string   s     = ownername;
                        string[] words = s.Split(' ');
                        if (words.Count() == 1)
                        {
                            lastname = words[0];
                            driver.FindElement(By.Id("owner")).SendKeys(lastname);
                        }
                        else
                        {
                            lastname  = words[0];
                            firstname = words[1];

                            driver.FindElement(By.Id("owner")).SendKeys(lastname + " " + firstname);
                        }

                        gc.CreatePdf_WOP(orderNumber, "Owner Search", driver, "FL", "Charlotte");
                        driver.FindElement(By.Id("Button3")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        gc.CreatePdf_WOP(orderNumber, "owner Search result", driver, "FL", "Charlotte");
                        int trCount = driver.FindElements(By.XPath("/html/body/table/tbody/tr[2]/td/table/tbody/tr")).Count;

                        if (trCount > 2)
                        {   //multi parcel
                            IWebElement         tbmulti2 = driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td/table/tbody"));
                            IList <IWebElement> TRmulti2 = tbmulti2.FindElements(By.TagName("tr"));
                            IList <IWebElement> TDmulti2;
                            int k = 0;
                            foreach (IWebElement row in TRmulti2)
                            {
                                if (k < 25)
                                {
                                    TDmulti2 = row.FindElements(By.TagName("td"));
                                    if (TDmulti2.Count != 0 && TDmulti2[1].Text.Trim() != "")
                                    {
                                        string multi1 = TDmulti2[1].Text + "~" + TDmulti2[2].Text;
                                        gc.insert_date(orderNumber, TDmulti2[0].Text, 687, multi1, 1, DateTime.Now);
                                        //  Owner~address
                                    }
                                    k++;
                                }
                            }
                            HttpContext.Current.Session["multiParcel_Charlotte"] = "Yes";
                            if (TRmulti2.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_Charlotte_Multicount"] = "Maximum";
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else
                        {
                            try
                            {
                                Thread.Sleep(2000);
                                // /html/body/table/tbody/tr[2]/td[1]/a
                                driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td[1]/a")).Click();
                                Thread.Sleep(3000);
                            }
                            catch { }
                        }
                    }

                    try
                    {
                        IWebElement INodata = driver.FindElement(By.XPath("/html/body/p[1]"));
                        if (INodata.Text.Contains("Sorry, your selection returned"))
                        {
                            HttpContext.Current.Session["Charlotte_Zero"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }
                    //property details


                    //Parcel ID~Old Parcel ID Number~Owner Name~Owner Address~Property Address~Business Name~Year Built~Map Number~Current Use~Future Land Use (Comp.Plan)~Property Zip Code~Section-Township-Range~Taxing District~Market Area / Neighborhood / Subneighborhood~SOH Base Year~Short Legal~Legal Description
                    string parcel_no = "", OldParcelID = "", OwnerAddress = "", PropertyAddress = "", BusinessName = "", YearBuilt = "", MapNumber = "", CurrentUse = "", FutureLandUse = "", PropertyZipCode = "", section = "", TaxingDistrict = "", MarketArea = "", SOHBaseYear = "", legal1 = "", legal2 = "";

                    string bulkpropertytext = "", property_details = "";
                    // driver.FindElement(By.Id("Year1")).Click();
                    //Thread.Sleep(2000);

                    bulkpropertytext = driver.FindElement(By.XPath("/html/body/main/section/div/h1")).Text.Replace("\r\n", "");
                    parcel_no        = gc.Between(bulkpropertytext, "Information for", "for the").Trim();
                    gc.CreatePdf(orderNumber, parcel_no, "Property details last", driver, "FL", "Charlotte");
                    string   Ownersplit = driver.FindElement(By.XPath("/html/body/main/section/div/div[2]/div/div[1]/div[1]")).Text;
                    string[] Ownerarray = Ownersplit.Split('\r');
                    owner = Ownerarray[0];
                    string MilingAddress    = Ownerarray[1] + " " + Ownerarray[2];
                    string propertyaddress1 = driver.FindElement(By.XPath("/html/body/main/section/div/div[2]/div/div[2]/div[1]/div[2]")).Text;
                    string propertyaddress2 = driver.FindElement(By.XPath("/html/body/main/section/div/div[2]/div/div[2]/div[2]/div[2]")).Text;
                    PropertyAddress = propertyaddress1 + " " + propertyaddress2;
                    BusinessName    = driver.FindElement(By.XPath("/html/body/main/section/div/div[2]/div/div[2]/div[3]/div[2]")).Text;
                    MapNumber       = driver.FindElement(By.XPath("/html/body/main/section/div/div[3]/div/div[1]/div/div[6]/div[2]")).Text;
                    CurrentUse      = driver.FindElement(By.XPath("/html/body/main/section/div/div[3]/div/div[1]/div/div[2]/div[2]")).Text;
                    // string SectionTownship =
                    //PropertyZipCode = gc.Between(bulkpropertytext, "Property Zip Code:", "Business Name:").Trim();
                    section        = driver.FindElement(By.XPath("/html/body/main/section/div/div[3]/div/div[1]/div/div[7]/div[2]")).Text;
                    TaxingDistrict = driver.FindElement(By.XPath("/html/body/main/section/div/div[3]/div/div[1]/div/div[1]/div[2]")).Text;
                    // MarketArea = gc.Between(bulkpropertytext, "Market Area/Neighborhood/Subneighborhood:", "Waterfront:").Trim();
                    // SOHBaseYear = GlobalClass.After(bulkpropertytext, "SOH Base Year:").Trim();
                    try
                    {
                        YearBuilt = driver.FindElement(By.XPath("/html/body/main/section/div/div[11]/div/table/tbody/tr[2]/td[5]")).Text;
                    }
                    catch { }

                    try
                    {
                        legal1 = driver.FindElement(By.XPath("/html/body/main/section/div/div[13]/div[2]")).Text;
                        legal2 = GlobalClass.After(legal1, "Long Legal:");
                    }
                    catch
                    {
                    }
                    //Old Parcel ID Number~Owner Name & Address~Property Address~Business Name~Year Built~Map Number~Current Use~Future Land Use (Comp.Plan)~Property Zip Code~Section-Township-Range~Taxing District~Market Area / Neighborhood / Subneighborhood~SOH Base Year~Short Legal~Legal Description

                    property_details = owner + "~" + PropertyAddress + "~" + MilingAddress + "~" + BusinessName + "~" + YearBuilt + "~" + MapNumber + "~" + CurrentUse + "~" + section + "~" + TaxingDistrict + "~" + legal2;
                    gc.insert_date(orderNumber, parcel_no, 680, property_details, 1, DateTime.Now);


                    //Assessment details

                    //2017 Value Summary Details Table:
                    //2017 Value Summary~Land~Land Improvements~Building~Damage~Total
                    IWebElement         tbmulti216 = driver.FindElement(By.XPath("/html/body/main/section/div/div[5]/div/table/tbody"));
                    IList <IWebElement> TRmulti216 = tbmulti216.FindElements(By.TagName("tr"));
                    IList <IWebElement> TDmulti216;

                    foreach (IWebElement row in TRmulti216)
                    {
                        TDmulti216 = row.FindElements(By.TagName("td"));
                        if (TDmulti216.Count == 6 && !row.Text.Contains("Building"))
                        {
                            string multi1 = TDmulti216[0].Text + "~" + TDmulti216[1].Text + "~" + TDmulti216[2].Text + "~" + TDmulti216[3].Text + "~" + TDmulti216[4].Text + "~" + TDmulti216[5].Text;
                            gc.insert_date(orderNumber, parcel_no, 681, multi1, 1, DateTime.Now);
                        }
                    }

                    //2017 Certified Tax Roll Values Details Table:
                    //2017 Certified Tax Roll Values~Non-School~School
                    string current = driver.CurrentWindowHandle;
                    driver.FindElement(By.Id("Year1")).Click();
                    Thread.Sleep(2000);
                    driver.SwitchTo().Window(driver.WindowHandles.Last());
                    IWebElement         tbmulti226 = driver.FindElement(By.XPath("/html/body/main/section/div/div[2]/div/table/tbody"));
                    IList <IWebElement> TRmulti226 = tbmulti226.FindElements(By.TagName("tr"));
                    IList <IWebElement> TDmulti226;

                    foreach (IWebElement row in TRmulti226)
                    {
                        TDmulti226 = row.FindElements(By.TagName("td"));
                        if (TDmulti226.Count != 0 && !row.Text.Contains("School"))
                        {
                            string multi1 = TDmulti226[0].Text + "~" + TDmulti226[1].Text + "~" + TDmulti226[2].Text + "~" + TDmulti226[3].Text + "~" + TDmulti226[4].Text;
                            gc.insert_date(orderNumber, parcel_no, 682, multi1, 1, DateTime.Now);
                        }
                    }
                    gc.CreatePdf(orderNumber, parcel_no, "Property details current", driver, "FL", "Charlotte");
                    driver.Close();
                    driver.SwitchTo().Window(current);
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    driver.Navigate().GoToUrl("https://charlotte.county-taxes.com/public");
                    Thread.Sleep(5000);
                    IWebElement         IParcelClick = driver.FindElement(By.Id("search-text form-control"));
                    IJavaScriptExecutor js           = driver as IJavaScriptExecutor;
                    js.ExecuteScript("arguments[0].setAttribute('value', '" + parcel_no + "')", IParcelClick);

                    gc.CreatePdf(orderNumber, parcel_no, "Taxinfo", driver, "FL", "Charlotte");
                    IWebElement IParcelNoClick = driver.FindElement(By.XPath("//*[@id='search-controls']/div/form[1]/div[1]/div/span/button"));
                    js.ExecuteScript("arguments[0].click();", IParcelNoClick);
                    Thread.Sleep(3000);
                    try
                    {
                        IWebElement         ITaxSearch    = driver.FindElement(By.XPath("//*[@id='results']"));
                        IList <IWebElement> ITaxSearchRow = ITaxSearch.FindElements(By.TagName("li"));
                        //IList<IWebElement> ITaxSearchTD;
                        foreach (IWebElement search in ITaxSearchRow)
                        {
                            IWebElement ITaxSearchTD  = search.FindElement(By.TagName("a"));
                            string      strTaxDetails = ITaxSearchTD.GetAttribute("innerHTML");
                            if (strTaxDetails.Contains("Full bill history"))
                            {
                                js.ExecuteScript("arguments[0].click();", ITaxSearchTD);
                            }
                        }
                        //IWebElement ITaxSearch = driver.FindElement(By.PartialLinkText("Full bill history"));
                        //js.ExecuteScript("arguments[0].click();", ITaxSearch);
                        //IWebElement ITaxSearch = driver.FindElement(By.LinkText("Full bill history"));
                        //string strITaxSearch = ITaxSearch.GetAttribute("href");
                        //driver.Navigate().GoToUrl(strITaxSearch);
                        Thread.Sleep(3000);
                        gc.CreatePdf(orderNumber, parcel_no, "Full bill history", driver, "FL", "Charlotte");
                    }
                    catch { }

                    try
                    {
                        IWebElement         ITaxReal    = driver.FindElement(By.XPath("//*[@id='content']/div[1]/table"));
                        IList <IWebElement> ITaxRealRow = ITaxReal.FindElements(By.TagName("tr"));
                        IList <IWebElement> ITaxRealTd;
                        int k = 0;
                        foreach (IWebElement ItaxReal in ITaxRealRow)
                        {
                            ITaxRealTd = ItaxReal.FindElements(By.TagName("td"));
                            if ((k <= 2 && ItaxReal.Text.Contains("Annual Bill")) || ItaxReal.Text.Contains("Pay this bill:"))
                            {
                                string      yearbill      = ITaxRealTd[0].Text;
                                IWebElement ITaxBillCount = ITaxRealTd[0].FindElement(By.TagName("a"));
                                string      strTaxReal    = ITaxBillCount.GetAttribute("href");
                                strTaxRealestate.Add(strTaxReal);
                                try
                                {
                                    IWebElement ITaxBill = ITaxRealTd[3].FindElement(By.TagName("a"));
                                    string      BillTax  = ITaxBill.GetAttribute("href");
                                    gc.downloadfile(BillTax, orderNumber, parcel_no, "Taxbill.pdf" + yearbill, "FL", "Charlotte");
                                }
                                catch
                                {
                                    IWebElement ITaxBill = ITaxRealTd[4].FindElement(By.TagName("a"));
                                    string      BillTax  = ITaxBill.GetAttribute("href");
                                    gc.downloadfile(BillTax, orderNumber, parcel_no, "Taxbill.pdf" + yearbill, "FL", "Charlotte");
                                }
                                k++;
                            }
                        }


                        //Tax History Details

                        IWebElement         IBillHistorytable = driver.FindElement(By.XPath("//*[@id='content']/div[1]/table"));
                        IList <IWebElement> IBillHistoryRow   = IBillHistorytable.FindElements(By.TagName("tr"));
                        IList <IWebElement> IBillHistoryTD;
                        foreach (IWebElement bill in IBillHistoryRow)
                        {
                            IBillHistoryTD = bill.FindElements(By.TagName("td"));
                            if (IBillHistoryTD.Count != 0)
                            {
                                try
                                {
                                    strBill     = IBillHistoryTD[0].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                    strBalance  = IBillHistoryTD[1].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                    strBillDate = IBillHistoryTD[2].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                    strBillPaid = IBillHistoryTD[3].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                }
                                catch
                                {
                                    strBillDate = "";
                                    strBillPaid = "";
                                }
                                if (strBillPaid.Contains("Print (PDF)"))
                                {
                                    strBillPaid = "";
                                }
                                string strTaxHistory = strBill + "~" + strBalance + "~" + strBillDate + "~" + strBillPaid;
                                gc.insert_date(orderNumber, parcel_no, 685, strTaxHistory, 1, DateTime.Now);
                            }
                        }
                        IWebElement         IBillHistoryfoottable = driver.FindElement(By.XPath("//*[@id='content']/div[1]/table/tfoot"));
                        IList <IWebElement> IBillHistoryfootRow   = IBillHistoryfoottable.FindElements(By.TagName("tr"));
                        IList <IWebElement> IBillHistoryfootTD;
                        foreach (IWebElement bill in IBillHistoryRow)
                        {
                            IBillHistoryfootTD = bill.FindElements(By.TagName("th"));
                            if (IBillHistoryfootTD.Count != 0 && bill.Text.Contains("Total"))
                            {
                                try
                                {
                                    strFBill     = IBillHistoryfootTD[0].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                    strFBalance  = IBillHistoryfootTD[1].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                    strFBillDate = IBillHistoryfootTD[2].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                    strFBillPaid = IBillHistoryfootTD[3].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                }
                                catch
                                {
                                    strFBillDate = "";
                                    strFBillPaid = "";
                                }
                                if (strBillPaid.Contains("Print (PDF)"))
                                {
                                    strBillPaid = "";
                                }
                                string strTaxHistory = strFBill + "~" + strFBalance + "~" + strFBillDate + "~" + strFBillPaid;
                                gc.insert_date(orderNumber, parcel_no, 685, strTaxHistory, 1, DateTime.Now);
                            }
                        }
                    }
                    catch { }
                    foreach (string real in strTaxRealestate)
                    {
                        driver.Navigate().GoToUrl(real);
                        Thread.Sleep(4000);

                        try
                        {
                            TaxYear = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/div[1]")).Text;
                            TaxYear = WebDriverTest.After(TaxYear, "Real Estate").Trim();
                            string   s     = TaxYear;
                            string[] words = TaxYear.Split(' ');
                            TaxYear = words[0];
                        }
                        catch
                        {
                            TaxYear = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/div[1]")).Text;
                            TaxYear = WebDriverTest.After(TaxYear, "Real Estate").Trim();
                            string   s     = TaxYear;
                            string[] words = TaxYear.Split(' ');
                            TaxYear = words[0];
                        }

                        gc.CreatePdf(orderNumber, parcel_no, "Tax details" + TaxYear, driver, "FL", "Charlotte");
                        IWebElement multitableElement3;
                        try
                        {
                            multitableElement3 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/table[2]/tbody"));
                        }
                        catch
                        {
                            multitableElement3 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/table[2]/tbody"));
                        }
                        IList <IWebElement> multitableRow3 = multitableElement3.FindElements(By.TagName("tr"));

                        IList <IWebElement> multirowTD3;
                        foreach (IWebElement row in multitableRow3)
                        {
                            multirowTD3 = row.FindElements(By.TagName("td"));
                            if (multirowTD3.Count != 1 && multirowTD3[1].Text.Trim() != "")
                            {
                                string tax_distri = TaxYear + "~" + multirowTD3[0].Text.Trim() + "~" + "Ad Valorem" + "~" + multirowTD3[1].Text.Trim() + "~" + multirowTD3[2].Text.Trim() + "~" + multirowTD3[3].Text.Trim() + "~" + multirowTD3[4].Text.Trim() + "~" + "" + "~" + multirowTD3[5].Text.Trim();
                                gc.insert_date(orderNumber, parcel_no, 683, tax_distri, 1, DateTime.Now);
                            }
                        }

                        //total advalorem
                        IWebElement multitableElement31;
                        try
                        {
                            multitableElement31 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/table[2]/tfoot"));
                        }
                        catch
                        {
                            multitableElement31 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/table[2]/tfoot"));
                        }
                        IList <IWebElement> multitableRow31 = multitableElement31.FindElements(By.TagName("tr"));

                        IList <IWebElement> multirowTD31;
                        foreach (IWebElement row in multitableRow31)
                        {
                            multirowTD31 = row.FindElements(By.TagName("td"));
                            if (multirowTD31.Count != 1)
                            {
                                string tax_distri1 = TaxYear + "~" + "Total:" + "~" + "Ad Valorem" + "~" + multirowTD31[0].Text.Trim() + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + multirowTD31[1].Text.Trim();
                                gc.insert_date(orderNumber, parcel_no, 683, tax_distri1, 1, DateTime.Now);
                            }
                        }
                        //  Non - Ad Valorem
                        try
                        {
                            IWebElement multitableElement32;
                            try
                            {
                                multitableElement32 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/table[3]/tbody"));
                            }
                            catch
                            {
                                multitableElement32 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/table[3]/tbody"));
                            }
                            IList <IWebElement> multitableRow32 = multitableElement32.FindElements(By.TagName("tr"));
                            IList <IWebElement> multirowTD32;
                            foreach (IWebElement row in multitableRow32)
                            {
                                multirowTD32 = row.FindElements(By.TagName("td"));
                                if (multirowTD32.Count != 1 && multirowTD32[0].Text.Trim() != "")
                                {
                                    string tax_distri2 = TaxYear + "~" + multirowTD32[0].Text.Trim() + "~" + "Non-Ad Valorem " + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + multirowTD32[1].Text.Trim() + "~" + multirowTD32[2].Text.Trim();
                                    gc.insert_date(orderNumber, parcel_no, 683, tax_distri2, 1, DateTime.Now);
                                }
                            }
                            //total non-advalorem

                            IWebElement multitableElement33;
                            try
                            {
                                multitableElement33 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/table[3]/tfoot"));
                            }
                            catch
                            {
                                multitableElement33 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/table[3]/tfoot"));
                            }
                            IList <IWebElement> multitableRow33 = multitableElement33.FindElements(By.TagName("tr"));
                            IList <IWebElement> multirowTD33;
                            foreach (IWebElement row in multitableRow33)
                            {
                                multirowTD33 = row.FindElements(By.TagName("td"));
                                if (multirowTD33.Count != 0)
                                {
                                    string tax_distri1 = TaxYear + "~" + "Total:" + "~" + "Non-Ad Valorem " + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + multirowTD33[0].Text.Trim();
                                    gc.insert_date(orderNumber, parcel_no, 683, tax_distri1, 1, DateTime.Now);
                                }
                            }
                        }
                        catch { }
                        try
                        {
                            TaxAmount = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/p")).Text.Replace("Combined taxes and assessments:", "");
                        }
                        catch { }
                        string IfPaidBy = "", PlesePay = "", DueDate = "", deli = "";
                        try
                        {
                            IWebElement         multitableElement26 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/table[4]/tbody"));
                            IList <IWebElement> multitableRow26     = multitableElement26.FindElements(By.TagName("tr"));

                            IList <IWebElement> multirowTD26;
                            foreach (IWebElement row in multitableRow26)
                            {
                                multirowTD26 = row.FindElements(By.TagName("td"));
                                int iRowsCount = multirowTD26.Count;
                                for (int n = 0; n < iRowsCount; n++)
                                {
                                    if ((!multirowTD26[n].Text.Contains("Face Amt")) && (!multirowTD26[n].Text.Contains("Certificate")))
                                    {
                                        IfPaidBy = multirowTD26[n].Text.Replace("\r\n", "~");
                                        var IfpaySplit = IfPaidBy.Split('~');
                                        if (Convert.ToInt16(IfpaySplit.Count()) > 1)
                                        {
                                            IfPaidBy = IfpaySplit[0];
                                            PlesePay = IfpaySplit[1];
                                            if (PlesePay == "$0.00")
                                            {
                                                deli = "paid";
                                            }
                                            else
                                            {
                                                deli = "deliquent";
                                            }
                                            DueDate = TaxYear + "~" + deli + "~" + TaxAmount + "~" + IfPaidBy + "~" + PlesePay;
                                            gc.insert_date(orderNumber, parcel_no, 686, DueDate, 1, DateTime.Now);
                                        }
                                    }
                                }
                            }
                        }
                        //If_paid_by~Please_Pay
                        catch
                        {
                        }
                        try
                        {
                            IWebElement         multitableElement26 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/table[4]/tbody"));
                            IList <IWebElement> multitableRow26     = multitableElement26.FindElements(By.TagName("tr"));

                            IList <IWebElement> multirowTD26;
                            foreach (IWebElement row in multitableRow26)
                            {
                                multirowTD26 = row.FindElements(By.TagName("td"));
                                int iRowsCount = multirowTD26.Count;
                                for (int n = 0; n < iRowsCount; n++)
                                {
                                    if ((!multirowTD26[n].Text.Contains("Face Amt")) && (!multirowTD26[n].Text.Contains("Certificate")))
                                    {
                                        IfPaidBy = multirowTD26[n].Text.Replace("\r\n", "~");
                                        string[] IfpaySplit = IfPaidBy.Split('~');
                                        if (Convert.ToInt16(IfpaySplit.Count()) > 1)
                                        {
                                            IfPaidBy = IfpaySplit[0];
                                            PlesePay = IfpaySplit[1];
                                            if (PlesePay == "$0.00")
                                            {
                                                deli = "paid";
                                            }
                                            else
                                            {
                                                deli = "deliquent";
                                            }
                                            DueDate = TaxYear + "~" + deli + "~" + TaxAmount + "~" + IfPaidBy + "~" + PlesePay;
                                            gc.insert_date(orderNumber, parcel_no, 686, DueDate, 1, DateTime.Now);
                                        }
                                    }
                                }
                            }
                        }
                        catch { }
                        //*[@id="content"]/div[1]/div[3]/div[1]/ul/li[1]/a
                        try
                        {
                            //driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[3]/div[1]/ul/li[1]/a")).Click();
                            //Thread.Sleep(5000);
                            IWebElement         IBasicDetails    = driver.FindElement(By.XPath("//*[@id='content']"));
                            IList <IWebElement> IBasicDetailsRow = IBasicDetails.FindElements(By.TagName("li"));
                            IWebElement         IBasicDetailsTD  = null;
                            foreach (IWebElement basic in IBasicDetailsRow)
                            {
                                string strClick = basic.GetAttribute("innerHTML");
                                if (strClick.Contains("Parcel details"))
                                {
                                    IBasicDetailsTD = basic.FindElement(By.TagName("img"));
                                    js.ExecuteScript("arguments[0].click();", IBasicDetailsTD);
                                    Thread.Sleep(5000);
                                }
                            }
                        }
                        catch { }
                        gc.CreatePdf(orderNumber, parcel_no, "parcel details" + TaxYear, driver, "FL", "Charlotte");
                        string charitable = "";
                        string ownertax = "", situs = "", alternate_key = "", legal = "", total_aces = "", AssessedValue = "", School_AssessedValue = "", homestead_exemption = "", homestead_school = "", additional_homestead = "", advalorem = "", nonadvalorem = "", total_discount = "", noDiscount = "", total_tax = "", paiddate = "";
                        string taxinfodetails1 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[3]/div[2]")).Text.Replace("\r\n", "");

                        ownertax       = gc.Between(taxinfodetails1, "Owner", "Situs").Trim();
                        situs          = gc.Between(taxinfodetails1, "Situs", "Account number").Trim();
                        Account_number = gc.Between(taxinfodetails1, "Account number", "Alternate Key").Trim();
                        alternate_key  = gc.Between(taxinfodetails1, "Alternate Key", "Millage code").Trim();
                        Millage_Code   = gc.Between(taxinfodetails1, "Millage code", "Millage rate").Trim();
                        try
                        {
                            Millage_rate = gc.Between(taxinfodetails1, "Millage rate", "Escrow").Trim();
                        }
                        catch
                        {
                            Millage_rate = gc.Between(taxinfodetails1, "Millage rate", "Assessed value").Trim();
                        }
                        try
                        {
                            AssessedValue = gc.Between(taxinfodetails1, "Assessed value", "School assessed value").Trim();
                        }
                        catch { }
                        try
                        {
                            School_AssessedValue = gc.Between(taxinfodetails1, "School assessed value", "Flags").Trim();
                        }
                        catch
                        {
                        }
                        try
                        {
                            School_AssessedValue = gc.Between(taxinfodetails1, "School assessed value", "Exemptions").Trim();
                        }
                        catch
                        {
                            School_AssessedValue = GlobalClass.After(taxinfodetails1, "School assessed value").Trim();
                        }
                        try
                        {
                            homestead_exemption  = gc.Between(taxinfodetails1, "HOMESTEAD EXEMPTION", "HOMESTEAD SCHOOL").Trim();
                            homestead_school     = gc.Between(taxinfodetails1, "HOMESTEAD SCHOOL", "ADDITIONAL HOMESTEAD").Trim();
                            additional_homestead = GlobalClass.After(taxinfodetails1, "ADDITIONAL HOMESTEAD").Trim();
                        }
                        catch { }

                        try
                        {
                            charitable = GlobalClass.After(taxinfodetails1, "CHARITABLE").Trim();
                        }
                        catch { }
                        string taxinfodetails2 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[4]")).Text.Replace("\r\n", "");
                        advalorem      = gc.Between(taxinfodetails2, "Ad valorem", "Non-ad valorem").Trim();
                        nonadvalorem   = gc.Between(taxinfodetails2, "Non-ad valorem", "Total Discountable").Trim();
                        total_discount = gc.Between(taxinfodetails2, "Total Discountable", "No Discount").Trim();
                        noDiscount     = gc.Between(taxinfodetails2, "No Discount NAVA", "Total tax").Trim();
                        total_tax      = gc.Between(taxinfodetails2, "Total tax", "Legal description").Trim();
                        legal          = gc.Between(taxinfodetails2, "Legal description", "Location").Trim();
                        total_aces     = GlobalClass.After(taxinfodetails2, "Total acres").Trim();
                        string taxinfodetails3 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[3]/div[1]")).Text;
                        if (taxinfodetails3.Contains("Pay this bill"))
                        {
                            PaidAmount = taxinfodetails3.Replace("Pay this bill:", "&");
                            var PaidAmount1 = PaidAmount.Split('&');
                            PaidAmount = PaidAmount1[1];
                            try
                            {
                                paiddate = gc.Between(PaidAmount, "PAID", "$").Trim();
                            }
                            catch
                            {
                                paiddate = "";
                            }
                            PaidAmount = WebDriverTest.After(PaidAmount, "$").Trim();
                            try
                            {
                                ReceiptNumber = PaidAmount1[2].Replace("Receipt", "");
                            }
                            catch { }
                        }
                        else
                        {
                            PaidAmount    = "";
                            ReceiptNumber = "";
                            paiddate      = "";
                        }
                        //         Owner Information~Situs Address~Tax Year~Account number~Alternate Key~Millage code~Millage rate~Legal description~Total acres~Assessed value~School assessed value~HOMESTEAD EXEMPTION~HOMESTEAD SCHOOL~ADDITIONAL HOMESTEAD~Ad valorem~Non - ad valorem~Total Discountable~No Discount NAVA~Total tax~PaidDate~Paid Amount~Receipt #~Tax Authority

                        string tax_info1 = ownertax + "~" + situs + "~" + TaxYear + "~" + Account_number + "~" + alternate_key + "~" + Millage_Code + "~" + Millage_rate + "~" + legal + "~" + total_aces + "~" + AssessedValue + "~" + School_AssessedValue + "~" + homestead_exemption + "~" + homestead_school + "~" + additional_homestead + "~" + charitable + "~" + advalorem + "~" + nonadvalorem + "~" + total_discount + "~" + noDiscount + "~" + total_tax + "~" + paiddate + "~" + PaidAmount + "~" + ReceiptNumber + "~" + "Charlotte County Tax Collector 18500 Murdock Circle Port Charlotte, FL 33948 Phone: (941)743-1350 -or- (941)681-3710";
                        gc.insert_date(orderNumber, parcel_no, 684, tax_info1, 1, DateTime.Now);
                    }

                    TaxTime     = DateTime.Now.ToString("HH:mm:ss");
                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "FL", "Charlotte", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderNumber, "FL", "Charlotte");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    throw ex;
                }
            }
        }