Beispiel #1
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;
                }
            }
        }
        public string FTP_MarinCA(string address, string parcelNumber, string searchType, string orderNumber, string ownername, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;

            GlobalClass.global_parcelNo = parcelNumber;
            List <string> taxinformation = new List <string>();
            string        StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";
            var           driverService = PhantomJSDriverService.CreateDefaultService();

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

                {
                    if (searchType == "titleflex")
                    {
                        gc.TitleFlexSearch(orderNumber, "", ownername, address, "CA", "Marin");
                        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_MarinCA"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }


                    //Tax Authority
                    try
                    {
                        string Taxauthority1 = "";
                        driver.Navigate().GoToUrl("https://www.marincounty.org/depts/df/property-tax-information");
                        Taxauthority1 = driver.FindElement(By.XPath("//*[@id='main-content']/div[4]/p[5]")).Text.Trim();
                        Taxauthority  = gc.Between(Taxauthority1, "Mail:", "Office:").Trim();
                        gc.CreatePdf(orderNumber, parcelNumber, "Tax Authority PDF", driver, "CA", "Marin");
                    }
                    catch { }


                    driver.Navigate().GoToUrl("https://www.marincounty.org/depts/ar/divisions/assessor/search-assessor-records");
                    try
                    {
                        try
                        {
                            IWebElement         IPropertySearch1 = driver.FindElement(By.XPath("//*[@id='main-content']/div[2]/div[10]/input[1]"));
                            IJavaScriptExecutor js1 = driver as IJavaScriptExecutor;
                            js1.ExecuteScript("arguments[0].click();", IPropertySearch1);
                        }
                        catch { }
                        try
                        {
                            driver.FindElement(By.XPath("//*[@id='main-content']/div[2]/div[10]/input[1]")).Click();
                        }
                        catch { }


                        if (searchType == "parcel")
                        {
                            driver.FindElement(By.Id("PP")).Clear();
                            IWebElement         text = driver.FindElement(By.Id("PP"));
                            IJavaScriptExecutor js   = (IJavaScriptExecutor)driver;
                            js.ExecuteScript("document.getElementById('PP').value='" + parcelNumber + "'");
                            driver.FindElement(By.XPath("//*[@id='P']/div[2]/div/div/input[1]")).SendKeys(Keys.Enter);
                            Thread.Sleep(2000);
                            gc.CreatePdf(orderNumber, parcelNumber, "Enter The Address After", driver, "CA", "Marin");

                            try
                            {
                                int                 count = 0;
                                string              Multiparcelnumber = "", Singlerowclick = "";
                                IWebElement         Multiaddresstable1add = driver.FindElement(By.XPath("//*[@id='app-ext']/div[1]/div[1]/table/tbody"));
                                IList <IWebElement> multiaddressrows      = Multiaddresstable1add.FindElements(By.TagName("tr"));
                                IList <IWebElement> Multiaddressid;
                                foreach (IWebElement Multiaddress in multiaddressrows)
                                {
                                    Multiaddressid = Multiaddress.FindElements(By.TagName("td"));
                                    if (Multiaddressid.Count == 4 && !Multiaddress.Text.Contains("Parcel#") && Multiparcelnumber != Multiaddressid[0].Text)
                                    {
                                        Multiparcelnumber = Multiaddressid[0].Text;
                                        IWebElement Singleclick = Multiaddressid[0].FindElement(By.TagName("a"));
                                        Singlerowclick = Singleclick.GetAttribute("href");
                                        string Ownername          = Multiaddressid[1].Text;
                                        string multiaddressresult = Multiparcelnumber + "~" + Ownername;
                                        gc.insert_date(orderNumber, Multiparcelnumber, 1201, multiaddressresult, 1, DateTime.Now);
                                        count++;
                                    }
                                }

                                if (count < 2)
                                {
                                    driver.Navigate().GoToUrl(Singlerowclick);
                                }
                                if (count > 1 && count < 26)
                                {
                                    HttpContext.Current.Session["multiparcel_Marin"] = "Yes";
                                    driver.Quit();
                                    return("MultiParcel");
                                }
                                if (count > 25)
                                {
                                    HttpContext.Current.Session["multiparcel_Marin_Maximum"] = "Maximum";
                                    driver.Quit();
                                    return("Maximum");
                                }
                            }
                            catch { }
                            try
                            {
                                //No Data Found
                                string nodata = driver.FindElement(By.XPath("//*[@id='main-content']/div[2]/h3")).Text;
                                if (nodata.Contains("No records were found."))
                                {
                                    HttpContext.Current.Session["Nodata_MarinCA"] = "Yes";
                                    driver.Quit();
                                    return("No Data Found");
                                }
                            }
                            catch { }
                        }
                    }
                    catch
                    {
                    }

                    //Property Details
                    string ParcelNumber = "", OwnerName = "", UseCode = "", UseCodeDefinition = "", ConstructionYear = "", TaxRateArea = "", AssessmentCity = "", TotalAssessedValueforTaxRollYear = "", TotalAssessedValueforTaxRollYear1 = "", Land = "", Improvements = "", TotalAssessedvalue = "", Homeowner = "", NetAssessedValueforTaxRollYear = "", NetAssessedValueforTaxRollYear1 = "", TotalAssessedvalue1 = "", LessTotalExemptions = "", NetAssessedvalue = "";
                    //IWebElement propertyinfo0 = driver.FindElement(By.XPath("//*[@id='app-ext']/div[2]/div[2]/div[2]/table/tbody"));
                    //IList<IWebElement> propertyinfo0TR = propertyinfo0.FindElements(By.TagName("tr"));
                    //IList<IWebElement> propertyinfo0TD;


                    IList <IWebElement> propertyinfo0TR0 = driver.FindElements(By.TagName("table"));// table list of Payment History Table

                    foreach (IWebElement Taxinfor00 in propertyinfo0TR0)
                    {
                        if (Taxinfor00.Text.Contains("Parcel Number") /*&& tab.Text.Contains("Land Value:")&& tab.Text.Contains("Levy Name")*/)
                        {
                            IList <IWebElement> ITaxRealRowQ0 = Taxinfor00.FindElements(By.TagName("tr"));
                            IList <IWebElement> ITaxRealTdQ0;
                            foreach (IWebElement ItaxReal0 in ITaxRealRowQ0)
                            {
                                ITaxRealTdQ0 = ItaxReal0.FindElements(By.TagName("td"));
                                if (ITaxRealTdQ0.Count == 3 && !ItaxReal0.Text.Contains("Parcel Number"))
                                {
                                    ParcelNumber = ITaxRealTdQ0[0].Text;
                                }
                            }
                        }

                        if (Taxinfor00.Text.Contains("Owner Name") /*&& tab.Text.Contains("Land Value:")&& tab.Text.Contains("Levy Name")*/)
                        {
                            IList <IWebElement> ITaxRealRowQ1 = Taxinfor00.FindElements(By.TagName("tr"));
                            IList <IWebElement> ITaxRealTdQ1;
                            foreach (IWebElement ItaxReal1 in ITaxRealRowQ1)
                            {
                                ITaxRealTdQ1 = ItaxReal1.FindElements(By.TagName("td"));
                                if (ITaxRealTdQ1.Count == 1 && !ItaxReal1.Text.Contains("Owner Name"))
                                {
                                    OwnerName += ITaxRealTdQ1[0].Text + " ";
                                }
                            }
                        }

                        if (Taxinfor00.Text.Contains("Land") && !Taxinfor00.Text.Contains("Land Sq. Ft.") /* && tab.Text.Contains("Levy Name")*/)
                        {
                            IList <IWebElement> ITaxRealRowQ2 = Taxinfor00.FindElements(By.TagName("tr"));
                            IList <IWebElement> ITaxRealTdQ2;
                            foreach (IWebElement ItaxReal2 in ITaxRealRowQ2)
                            {
                                ITaxRealTdQ2 = ItaxReal2.FindElements(By.TagName("td"));
                                if (ITaxRealTdQ2.Count == 2 && ItaxReal2.Text.Contains("Land"))
                                {
                                    Land = ITaxRealTdQ2[1].Text;
                                    //Improvements = ITaxRealTdQ2[0].Text;
                                    //TotalAssessedvalue = ITaxRealTdQ2[0].Text;
                                }
                                if (ITaxRealTdQ2.Count == 2 && ItaxReal2.Text.Contains("Improvements"))
                                {
                                    //Land = ITaxRealTdQ2[0].Text;
                                    Improvements = ITaxRealTdQ2[1].Text;
                                    //TotalAssessedvalue = ITaxRealTdQ2[0].Text;
                                }
                                if (ITaxRealTdQ2.Count == 2 && ItaxReal2.Text.Contains("Total Assessed Value"))
                                {
                                    //Land = ITaxRealTdQ2[0].Text;
                                    //Improvements = ITaxRealTdQ2[0].Text;
                                    TotalAssessedvalue = ITaxRealTdQ2[1].Text;
                                }
                            }
                        }
                        if (Taxinfor00.Text.Contains("Total Exemptions") && !Taxinfor00.Text.Contains("Less Total Exemptions") /*&& tab.Text.Contains("Land Value:")&& tab.Text.Contains("Levy Name")*/)
                        {
                            IList <IWebElement> ITaxRealRowQ3 = Taxinfor00.FindElements(By.TagName("tr"));
                            IList <IWebElement> ITaxRealTdQ3;
                            foreach (IWebElement ItaxReal3 in ITaxRealRowQ3)
                            {
                                ITaxRealTdQ3 = ItaxReal3.FindElements(By.TagName("td"));
                                if (ITaxRealTdQ3.Count == 2 && ItaxReal3.Text.Contains("Total Exemptions"))
                                {
                                    Homeowner = ITaxRealTdQ3[1].Text;
                                }
                            }
                        }
                        if (Taxinfor00.Text.Contains("Total Assessed Value") && !Taxinfor00.Text.Contains("Land") /*&& tab.Text.Contains("Levy Name")*/)
                        {
                            IList <IWebElement> ITaxRealRowQ4 = Taxinfor00.FindElements(By.TagName("tr"));
                            IList <IWebElement> ITaxRealTdQ4;
                            foreach (IWebElement ItaxReal4 in ITaxRealRowQ4)
                            {
                                ITaxRealTdQ4 = ItaxReal4.FindElements(By.TagName("td"));
                                if (ITaxRealTdQ4.Count == 2 && ItaxReal4.Text.Contains("Total Assessed Value"))
                                {
                                    TotalAssessedvalue1 = ITaxRealTdQ4[1].Text;
                                }
                                if (ITaxRealTdQ4.Count == 2 && ItaxReal4.Text.Contains("Less Total Exemptions"))
                                {
                                    LessTotalExemptions = ITaxRealTdQ4[1].Text;
                                }
                                if (ITaxRealTdQ4.Count == 2 && ItaxReal4.Text.Contains("Net Assessed Value"))
                                {
                                    NetAssessedvalue = ITaxRealTdQ4[1].Text;
                                }
                            }
                        }
                        if (Taxinfor00.Text.Contains("Use Code Definition") /* && tab.Text.Contains("Levy Name")*/)
                        {
                            IList <IWebElement> ITaxRealRowQ5 = Taxinfor00.FindElements(By.TagName("tr"));
                            IList <IWebElement> ITaxRealTdQ5;
                            foreach (IWebElement ItaxReal5 in ITaxRealRowQ5)
                            {
                                ITaxRealTdQ5 = ItaxReal5.FindElements(By.TagName("td"));
                                if (ITaxRealTdQ5.Count == 2 && ITaxRealRowQ5.Count > 6 && ItaxReal5.Text.Contains("Use Code") && !ItaxReal5.Text.Contains("Definition"))
                                {
                                    UseCode = ITaxRealTdQ5[1].Text;
                                }
                                if (ITaxRealTdQ5.Count == 2 && ITaxRealRowQ5.Count > 6 && ItaxReal5.Text.Contains("Use Code Definition"))
                                {
                                    UseCodeDefinition = ITaxRealTdQ5[1].Text;
                                }
                                if (ITaxRealTdQ5.Count == 2 && ITaxRealRowQ5.Count > 6 && ItaxReal5.Text.Contains("Construction Year"))
                                {
                                    ConstructionYear = ITaxRealTdQ5[1].Text;
                                }
                            }
                        }

                        if (Taxinfor00.Text.Contains("Tax Rate Area") /* && tab.Text.Contains("Levy Name")*/)
                        {
                            IList <IWebElement> ITaxRealRowQ6 = Taxinfor00.FindElements(By.TagName("tr"));
                            IList <IWebElement> ITaxRealTdQ6;
                            foreach (IWebElement ItaxReal6 in ITaxRealRowQ6)
                            {
                                ITaxRealTdQ6 = ItaxReal6.FindElements(By.TagName("td"));
                                if (ITaxRealTdQ6.Count == 2 && ItaxReal6.Text.Contains("Tax Rate Area"))
                                {
                                    TaxRateArea = ITaxRealTdQ6[1].Text;
                                }
                                if (ITaxRealTdQ6.Count == 2 && ItaxReal6.Text.Contains("Assessment City"))
                                {
                                    AssessmentCity = ITaxRealTdQ6[1].Text;
                                }
                            }
                        }
                    }
                    try
                    {
                        TotalAssessedValueforTaxRollYear1 = driver.FindElement(By.XPath("//*[@id='main-content']/div[2]/div[12]/div[1]/span")).Text.Trim();
                        TotalAssessedValueforTaxRollYear  = GlobalClass.After(TotalAssessedValueforTaxRollYear1, "Total Assessed Value for Tax Roll Year:").Trim();
                    }
                    catch { }
                    try
                    {
                        NetAssessedValueforTaxRollYear1 = driver.FindElement(By.XPath("//*[@id='main-content']/div[2]/div[16]/div[1]/span")).Text.Trim();
                        NetAssessedValueforTaxRollYear  = GlobalClass.After(NetAssessedValueforTaxRollYear1, "Net Assessed Value for Tax Roll Year:").Trim();
                    }
                    catch { }
                    //Property Details
                    string PropertyDetails = ParcelNumber.Trim() + "~" + OwnerName.Trim() + "~" + UseCode.Trim() + "~" + UseCodeDefinition.Trim() + "~" + ConstructionYear.Trim() + "~" + TaxRateArea.Trim() + "~" + AssessmentCity.Trim();
                    gc.insert_date(orderNumber, parcelNumber, 1213, PropertyDetails, 1, DateTime.Now);

                    //Assessment Details
                    string AssessmentDetails             = TotalAssessedValueforTaxRollYear.Trim() + "~" + Land.Trim() + "~" + Improvements.Trim() + "~" + TotalAssessedvalue.Trim() + "~" + Homeowner.Trim() + "~" + NetAssessedValueforTaxRollYear.Trim() + "~" + TotalAssessedvalue1.Trim() + "~" + LessTotalExemptions.Trim() + "~" + NetAssessedvalue.Trim() + "~" + Taxauthority.Trim();
                    gc.insert_date(orderNumber, parcelNumber, 1215, AssessmentDetails, 1, DateTime.Now);

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


                    //Property Tax Bills Details
                    //Last Three Years All Tax Bills Details Information With Screeshot
                    //Tax Values Assessment Details Table
                    string TaxRollYear = "", LandValue = "", Improvements1 = "", BusinessProperty = "", PersonalProperty = "", TotalValue = "", HomeExemption = "", OtherExemption = "", NetValue = "", Taxassesmentvaluebind = "";
                    string Owner = "", ParcelNumber1 = "", BillNumber = "", BillDate = "", TaxRateArea1 = "", TaxRollYear1 = "", BillType = "";
                    string Overallassessmentdetails = "", Taxassesmentvaluebind1 = "", Taxsummaryassesmentvaluebind2 = "";
                    string Levy = "", Name = "", Ratefund = "", Install1 = "", Install2 = "", Total = "";
                    string DefaultYear = "", BillNumber1 = "", BillDate1 = "", BillType1 = "", TaxesandAssmnts = "", DelinqPenalty = "", DelinqCost = "", RedemptionPenalty = "";
                    string Taxyear = "", Billnumber = "", PaymentOwnername = "", Billtype = "", Installpay1 = "", Installpay2 = "";
                    try
                    {
                        driver.Navigate().GoToUrl("http://apps.marincounty.org/taxbillonline");

                        try
                        {
                            driver.FindElement(By.XPath("//*[@id='compwa']/div[4]/input[1]")).Click();
                        }
                        catch { }
                        try
                        {
                            driver.FindElement(By.XPath("//*[@id='main-content']/div[2]/div[5]/input[1]")).Click();
                        }
                        catch { }
                        try
                        {
                            IWebElement         IPropertySearch1 = driver.FindElement(By.XPath("//*[@id='compwa']/div[4]/input[1]"));
                            IJavaScriptExecutor js1 = driver as IJavaScriptExecutor;
                            js1.ExecuteScript("arguments[0].click();", IPropertySearch1);
                            Thread.Sleep(5000);
                        }
                        catch { }
                        try
                        {
                            IWebElement         IPropertySearch1 = driver.FindElement(By.XPath("//*[@id='main-content']/div[2]/div[5]/input[1]"));
                            IJavaScriptExecutor js1 = driver as IJavaScriptExecutor;
                            js1.ExecuteScript("arguments[0].click();", IPropertySearch1);
                            Thread.Sleep(5000);
                        }
                        catch { }

                        driver.FindElement(By.Id("PropertyId")).Click();
                        driver.FindElement(By.Id("PropertyId")).Clear();
                        driver.Navigate().GoToUrl("http://apps.marincounty.org/TaxBillOnline/?" + ParcelNumber);
                        driver.FindElement(By.Id("PropertyId")).Clear();
                        IWebElement         text = driver.FindElement(By.Id("PropertyId"));
                        IJavaScriptExecutor js   = (IJavaScriptExecutor)driver;
                        js.ExecuteScript("document.getElementById('PropertyId').value='" + ParcelNumber + "'");
                        driver.FindElement(By.XPath("//*[@id='main-content']/div[2]/form/div[2]/div[2]/div/input[1]")).SendKeys(Keys.Enter);

                        gc.CreatePdf(orderNumber, ParcelNumber, "Property Tax Bill Details PDF", driver, "CA", "Marin");
                        //Delinquent Details
                        string delinquenttax = "", InformationComments = "";
                        try
                        {
                            try
                            {
                                delinquenttax = driver.FindElement(By.XPath("//*[@id='compwa']/div[12]/div[1]/div[1]/span")).Text.Trim();
                            }
                            catch { }
                            if (delinquenttax.Contains("Delinquent Unpaid Tax Bills"))
                            {
                                InformationComments = "For tax amount due, you must call the Collector's Office.";
                                string alertmessage = InformationComments;
                                gc.insert_date(orderNumber, ParcelNumber, 1239, alertmessage, 1, DateTime.Now);
                            }
                        }
                        catch { }
                        IWebElement         Taxbillclick   = driver.FindElement(By.Id("content"));
                        IList <IWebElement> taxpay         = Taxbillclick.FindElements(By.TagName("table"));
                        List <string>       Singlerowclick = new List <string>();
                        foreach (IWebElement taxpament in taxpay)
                        {
                            if (taxpament.Text.Contains("Tax Year") && !taxpament.Text.Contains("To Pay Online") && !taxpament.Text.Contains("Default Nbr") /*&& tab.Text.Contains("Land Value:")&& tab.Text.Contains("Levy Name")*/)
                            {
                                IList <IWebElement> ITaxRealRowQ = taxpament.FindElements(By.TagName("tr"));
                                IList <IWebElement> ITaxRealTdQ;

                                foreach (IWebElement taxpamentHistory in ITaxRealRowQ)
                                {
                                    ITaxRealTdQ = taxpamentHistory.FindElements(By.TagName("td"));

                                    if (ITaxRealTdQ.Count != 0 && ITaxRealTdQ.Count != 3 && ITaxRealTdQ.Count == 6 && taxpamentHistory.Text.Trim() != "")
                                    {
                                        Taxyear          = ITaxRealTdQ[0].Text;
                                        Billnumber       = ITaxRealTdQ[1].Text;
                                        PaymentOwnername = ITaxRealTdQ[2].Text;
                                        Billtype         = ITaxRealTdQ[3].Text;
                                        Installpay1      = ITaxRealTdQ[4].Text;
                                        Installpay2      = ITaxRealTdQ[5].Text;
                                        //Overall Secured Property Tax Charges
                                        string PaymentHistorydetails = Taxyear.Trim() + "~" + Billnumber.Trim() + "~" + PaymentOwnername.Trim() + "~" + Billtype.Trim() + "~" + Installpay1.Trim() + "~" + Installpay2.Trim();
                                        gc.insert_date(orderNumber, ParcelNumber, 1231, PaymentHistorydetails, 1, DateTime.Now);
                                    }
                                }
                                IList <IWebElement> Taxbillclickrows = taxpament.FindElements(By.TagName("a"));
                                foreach (IWebElement propertytaxclick in Taxbillclickrows)
                                {
                                    if (propertytaxclick.Text != "")
                                    {
                                        Singlerowclick.Add(propertytaxclick.GetAttribute("href"));
                                    }
                                }
                            }
                        }
                        int p = 0;
                        foreach (string Properclick in Singlerowclick)
                        {
                            driver.Navigate().GoToUrl(Properclick);
                            try
                            {
                                driver.FindElement(By.XPath("//*[@id='compwa']/div[4]/input[1]")).Click();
                            }
                            catch { }

                            string Billtypedval = "", TaxBillNumber = "";
                            IList <IWebElement> tableList = driver.FindElements(By.TagName("table"));// table list of Payment History Table

                            foreach (IWebElement tab in tableList)
                            {
                                if (tab.Text.Contains("Owner:") /*&& tab.Text.Contains("Land Value:")&& tab.Text.Contains("Levy Name")*/)
                                {
                                    IList <IWebElement> ITaxRealRowQ = tab.FindElements(By.TagName("tr"));
                                    IList <IWebElement> ITaxRealTdQ;
                                    foreach (IWebElement ItaxReal in ITaxRealRowQ)
                                    {
                                        ITaxRealTdQ = ItaxReal.FindElements(By.TagName("td"));
                                        if (ITaxRealTdQ.Count != 0 && ItaxReal.Text.Trim() != "" && ItaxReal.Text.Contains("Tax Roll Year:"))
                                        {
                                            TaxRollYear = ITaxRealTdQ[1].Text;
                                        }
                                        if (ITaxRealTdQ.Count != 0 && ItaxReal.Text.Trim() != "" && ItaxReal.Text.Contains("Bill Type:"))
                                        {
                                            Billtypedval = ITaxRealTdQ[1].Text;
                                        }
                                        if (ITaxRealTdQ.Count != 0 && ITaxRealTdQ.Count != 2 && ItaxReal.Text.Trim() != "" && ItaxReal.Text.Contains("Bill Number:"))
                                        {
                                            TaxBillNumber = ITaxRealTdQ[1].Text;
                                        }
                                        if (ITaxRealTdQ.Count != 0 && ItaxReal.Text.Trim() != "" && tab.Text.Contains("Owner:"))
                                        {
                                            Overallassessmentdetails += ITaxRealTdQ[1].Text + "~";
                                        }
                                    }
                                    //Overall Secured Property Tax Bill Details Table1
                                    string OverallTaxValuesAssessmentDetails = Overallassessmentdetails.TrimEnd('~').Trim();
                                    gc.insert_date(orderNumber, ParcelNumber, 1221, OverallTaxValuesAssessmentDetails, 1, DateTime.Now);
                                }
                            }
                            gc.CreatePdf(orderNumber, ParcelNumber, "Property Tax Bill Details Yearwise PDF" + p, driver, "CA", "Marin");



                            IList <IWebElement> tableList1 = driver.FindElements(By.TagName("table"));// table list of Payment History Table

                            foreach (IWebElement tab1 in tableList1)
                            {
                                if (tab1.Text.Contains("Land Value:") /*&& tab.Text.Contains("Land Value:")&& tab.Text.Contains("Levy Name")*/)
                                {
                                    IList <IWebElement> ITaxRealRowQ1 = tab1.FindElements(By.TagName("tr"));
                                    IList <IWebElement> ITaxRealTdQ1;
                                    foreach (IWebElement ItaxReal1 in ITaxRealRowQ1)
                                    {
                                        ITaxRealTdQ1 = ItaxReal1.FindElements(By.TagName("td"));

                                        if (ITaxRealTdQ1.Count != 0 && ItaxReal1.Text.Trim() != "" && tab1.Text.Contains("Land Value:"))
                                        {
                                            Taxassesmentvaluebind += ITaxRealTdQ1[1].Text + "~";
                                        }
                                    }
                                    //Tax Values Assessment Details Table:
                                    string TaxValuesAssessmentDetails = TaxRollYear.Trim() + "~" + Taxassesmentvaluebind.TrimEnd('~').Trim();
                                    gc.insert_date(orderNumber, ParcelNumber, 1220, TaxValuesAssessmentDetails, 1, DateTime.Now);
                                }
                            }
                            IList <IWebElement> tableList2 = driver.FindElements(By.TagName("table"));// table list of Payment History Table

                            foreach (IWebElement tab2 in tableList2)
                            {
                                if (tab2.Text.Contains("Levy Name Rate/Fund Install 1 Install 2 Total") /*&& tab.Text.Contains("Land Value:")&& tab.Text.Contains("Levy Name")*/)
                                {
                                    IList <IWebElement> ITaxRealRowQ2 = tab2.FindElements(By.TagName("tr"));
                                    IList <IWebElement> ITaxRealTdQ2;
                                    foreach (IWebElement ItaxReal2 in ITaxRealRowQ2)
                                    {
                                        ITaxRealTdQ2 = ItaxReal2.FindElements(By.TagName("td"));

                                        if (ITaxRealTdQ2.Count != 0 && ItaxReal2.Text.Trim() != "" && ITaxRealTdQ2.Count == 6)
                                        {
                                            Levy = ITaxRealTdQ2[0].Text;
                                            Name = ITaxRealTdQ2[1].Text;
                                            if (!Name.Contains("BASIC TAX") && !Name.Contains("Total Tax:") && !Name.Contains("Penalty:") && !Name.Contains("Additional Penalty:") && !Name.Contains("Amount Paid:") && !Name.Contains("Delinquent Date:") && !Name.Contains("Paid Date:") && !Name.Contains("Total Due:"))
                                            {
                                                Name = Name.Remove(0, 1);
                                            }
                                            Ratefund = ITaxRealTdQ2[2].Text;
                                            Install1 = ITaxRealTdQ2[3].Text;
                                            Install2 = ITaxRealTdQ2[4].Text;
                                            Total    = ITaxRealTdQ2[5].Text;
                                            //Overall Secured Property Tax Charges
                                            string OverallTaxValuesAssessmentDetails2 = TaxRollYear + "~" + Billtypedval + "~" + Levy.Trim() + "~" + Name.Trim() + "~" + Ratefund.Trim() + "~" + Install1.Trim() + "~" + Install2.Trim() + "~" + Total.Trim();
                                            gc.insert_date(orderNumber, ParcelNumber, 1230, OverallTaxValuesAssessmentDetails2, 1, DateTime.Now);
                                        }
                                    }
                                }
                            }
                            //Tax Summary of Prior Years Details
                            IList <IWebElement> tableList3 = driver.FindElements(By.TagName("table"));// table list of Payment History Table

                            foreach (IWebElement tab3 in tableList3)
                            {
                                if (tab3.Text.Contains("Default Year") /*&& tab.Text.Contains("Land Value:")&& tab.Text.Contains("Levy Name")*/)
                                {
                                    IList <IWebElement> ITaxRealRowQ3 = tab3.FindElements(By.TagName("tr"));
                                    IList <IWebElement> ITaxRealTdQ3;
                                    foreach (IWebElement ItaxReal3 in ITaxRealRowQ3)
                                    {
                                        ITaxRealTdQ3 = ItaxReal3.FindElements(By.TagName("td"));

                                        if (ITaxRealTdQ3.Count != 0 && ItaxReal3.Text.Trim() != "" && ITaxRealTdQ3.Count == 8)
                                        {
                                            DefaultYear       = ITaxRealTdQ3[0].Text;
                                            BillNumber1       = ITaxRealTdQ3[1].Text;
                                            BillDate1         = ITaxRealTdQ3[2].Text;
                                            BillType1         = ITaxRealTdQ3[3].Text;
                                            TaxesandAssmnts   = ITaxRealTdQ3[4].Text;
                                            DelinqPenalty     = ITaxRealTdQ3[5].Text;
                                            DelinqCost        = ITaxRealTdQ3[6].Text;
                                            RedemptionPenalty = ITaxRealTdQ3[7].Text;

                                            //Tax Summary Prior Year Detaisl
                                            string Taxsummaryofprioryeardetails = DefaultYear.Trim() + "~" + BillNumber1.Trim() + "~" + BillDate1.Trim() + "~" + BillType1.Trim() + "~" + TaxesandAssmnts.Trim() + "~" + DelinqPenalty.Trim() + "~" + DelinqCost.Trim() + "~" + RedemptionPenalty.Trim();
                                            gc.insert_date(orderNumber, ParcelNumber, 1227, Taxsummaryofprioryeardetails, 1, DateTime.Now);
                                        }
                                    }
                                }
                            }

                            //Delinquent Tax Details
                            IList <IWebElement> tableList4 = driver.FindElements(By.TagName("table"));
                            foreach (IWebElement tab4 in tableList4)
                            {
                                if (tableList4.Count != 2 && tab4.Text.Contains("Owner:") && !tab4.Text.Contains("Delinquent Details") && !tab4.Text.Contains("Bill"))
                                {
                                    IList <IWebElement> ITaxRealRowQ4 = tab4.FindElements(By.TagName("tr"));
                                    IList <IWebElement> ITaxRealTdQ4;
                                    foreach (IWebElement ItaxReal4 in ITaxRealRowQ4)
                                    {
                                        ITaxRealTdQ4 = ItaxReal4.FindElements(By.TagName("td"));

                                        if (ITaxRealTdQ4.Count != 0 && ItaxReal4.Text.Trim() != "" && ITaxRealTdQ4.Count == 2 /*&& !ItaxReal4.Text.Contains("Default")*/)
                                        {
                                            string Totaldelinquent = ITaxRealTdQ4[0].Text + "~" + ITaxRealTdQ4[1].Text;

                                            gc.insert_date(orderNumber, ParcelNumber, 1350, Totaldelinquent, 1, DateTime.Now);
                                        }
                                    }
                                }
                            }
                            IList <IWebElement> tableList5 = driver.FindElements(By.TagName("table"));
                            foreach (IWebElement tab5 in tableList5)
                            {
                                if (!tab5.Text.Contains("Payment Due") && tab5.Text.Contains("Description"))
                                {
                                    IList <IWebElement> ITaxRealRowQ5 = tab5.FindElements(By.TagName("tr"));
                                    IList <IWebElement> ITaxRealTdQ5;
                                    foreach (IWebElement ItaxReal5 in ITaxRealRowQ5)
                                    {
                                        ITaxRealTdQ5 = ItaxReal5.FindElements(By.TagName("td"));

                                        if (ITaxRealTdQ5.Count != 0 && ItaxReal5.Text.Trim() != "" && ITaxRealTdQ5.Count == 2)
                                        {
                                            string Totaldelinquent = ITaxRealTdQ5[0].Text + "~" + ITaxRealTdQ5[1].Text;

                                            gc.insert_date(orderNumber, ParcelNumber, 1350, Totaldelinquent, 1, DateTime.Now);
                                        }
                                    }
                                }
                            }
                            TaxRollYear = ""; LandValue = ""; Improvements1 = ""; BusinessProperty = ""; PersonalProperty = ""; TotalValue = ""; HomeExemption = ""; OtherExemption = ""; NetValue = ""; Taxassesmentvaluebind = "";
                            Owner       = ""; ParcelNumber1 = ""; BillNumber = ""; BillDate = ""; TaxRateArea1 = ""; TaxRollYear1 = ""; BillType = "";
                            Overallassessmentdetails = ""; Taxassesmentvaluebind1 = "";
                            Levy        = ""; Name = ""; Ratefund = ""; Install1 = ""; Install2 = ""; Total = "";
                            DefaultYear = ""; BillNumber1 = ""; BillDate1 = ""; BillType1 = ""; TaxesandAssmnts = ""; DelinqPenalty = ""; DelinqCost = ""; RedemptionPenalty = "";

                            p++;
                        }
                    }
                    catch { }

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

                    driver.Quit();
                    GlobalClass.titleparcel = "";
                    gc.mergpdf(orderNumber, "CA", "Marin");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    throw ex;
                }
            }
        }
        public string FTP_Orange_Ca(string Address, string unitnumber, string ownernm, string parcelNumber, string searchType, string orderNumber, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            int    b = 1;
            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";
            int    i = 0, j = 0, k = 0, a = 1;
            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");

                    driver.Navigate().GoToUrl("http://tax.ocgov.com/tcweb/search_page.asp");
                    if (searchType == "titleflex")
                    {
                        gc.TitleFlexSearch(orderNumber, "", ownernm, Address, "CA", "Orange");
                        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["Zero_Orange"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }
                    if (searchType == "address")
                    {//*[@id="col2"]/div[2]/table/tbody/tr[2]/td/div/table/tbody/tr[6]/td/table/tbody/tr[10]/td[2]/input
                        driver.FindElement(By.Name("streetname")).SendKeys(Address);
                        gc.CreatePdf_WOP(orderNumber, "AddressSearch", driver, "CA", "Orange");
                        driver.FindElement(By.Name("s_address")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        try
                        {
                            string Nodata = driver.FindElement(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[2]/td/div/table/tbody/tr[1]/td/strong/font/text()[1]")).Text;
                            if (Nodata.Contains("No address was found"))
                            {
                                HttpContext.Current.Session["Zero_Orange"] = "Zero";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                        gc.CreatePdf_WOP(orderNumber, "AddressSearchResult", driver, "CA", "Orange");
                        try
                        {//*[@id="col2"]/div[2]/table/tbody/tr[3]/td/table/tbody/tr[6]/td/table/tbody/tr[3]/td[1]
                            string Pay_review_result = driver.FindElement(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[3]/td/table/tbody/tr[6]/td/table/tbody/tr[3]/td[1]")).Text;
                            if (Pay_review_result.Contains("Search Results: 1-1 of 1 records"))
                            {
                                driver.FindElement(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[3]/td/table/tbody/tr[7]/td/table/tbody/tr[2]/td[2]/a")).SendKeys(Keys.Enter);
                                Thread.Sleep(3000);
                            }
                            multicount = gc.Between(Pay_review_result, "of ", " records");
                        }
                        catch { }
                        try
                        {
                            if (Pay_review_result.Trim() != "Search Results: 1-1 of 1 records" && Convert.ToInt32(multicount) <= 20)
                            {
                                IWebElement         MProperty_addrs = driver.FindElement(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[3]/td/table/tbody/tr[7]/td/table/tbody"));
                                IList <IWebElement> Mproperty       = MProperty_addrs.FindElements(By.TagName("tr"));
                                IList <IWebElement> Mpropertyid;
                                foreach (IWebElement Mpropertyrow in Mproperty)
                                {
                                    Mpropertyid = Mpropertyrow.FindElements(By.TagName("td"));
                                    if (Mpropertyid.Count != 0 && !Mpropertyrow.Text.Contains("Property or Business Address") && Mpropertyid[0].Text.Contains(Address.ToUpper()))
                                    {
                                        if (Mcount < 20)
                                        {
                                            Address     = Mpropertyid[0].Text;
                                            parcelno    = Mpropertyid[1].Text;
                                            Parcelclick = Mpropertyid[1].FindElement(By.TagName("a"));
                                            Parcelhref  = Parcelclick.GetAttribute("href");
                                            gc.insert_date(orderNumber, parcelno, 553, Address, 1, DateTime.Now);
                                        }
                                        Mcount++;
                                    }
                                }
                            }
                            if (Mcount == 1)
                            {
                                driver.Navigate().GoToUrl(Parcelhref);
                                Thread.Sleep(2000);
                            }
                            if (Mcount > 20 || Convert.ToInt32(multicount) > 20)
                            {
                                HttpContext.Current.Session["multiParcel_Orange_Multicount"] = "Maximum";
                                driver.Quit();
                                return("Maximum");
                            }
                            if (Mcount > 1 && Mcount < 20)
                            {
                                HttpContext.Current.Session["multiparcel_Orange"] = "Yes";
                                driver.Quit();
                                return("MultiParcel");
                            }
                            gc.CreatePdf_WOP(orderNumber, "MultiAddressSearch", driver, "CA", "Orange");
                        }
                        catch { }
                    }
                    if (searchType == "parcel")
                    {
                        if ((HttpContext.Current.Session["titleparcel"] != null))
                        {
                            parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        }
                        driver.FindElement(By.Name("t_parcel_no")).SendKeys(parcelNumber);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcelsearch", driver, "CA", "Orange");
                        driver.FindElement(By.Name("s_parcel")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                    }
                    string Parcel = driver.FindElement(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[3]/td/table/tbody/tr[2]/td/table/tbody/tr[3]/td[1]")).Text;
                    Parcel = GlobalClass.After(Parcel, "Parcel Number :").Trim();
                    gc.CreatePdf(orderNumber, Parcel, "property details", driver, "CA", "Orange");
                    IList <IWebElement> tables = driver.FindElements(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[3]/td/table/tbody/tr[2]/td/table/tbody/tr"));
                    int count = tables.Count;
                    foreach (IWebElement tab in tables)
                    {
                        if (tab.Text.Contains("Current Year and Unpaid Non-Delinquent Tax Bills"))
                        {
                            IList <IWebElement> ITaxRealRowQ = tab.FindElements(By.TagName("tr"));
                            IList <IWebElement> ITaxRealTdQ;
                            foreach (IWebElement ItaxReal in ITaxRealRowQ)
                            {
                                ITaxRealTdQ = ItaxReal.FindElements(By.TagName("td"));
                                if (!ItaxReal.Text.Contains("Current Year and Unpaid Non-Delinquent Tax Bills") && !ItaxReal.Text.Contains("Parcel Number") && ITaxRealTdQ[0].Text.Trim() != "")
                                {
                                    IWebElement ITaxBillCount = ITaxRealTdQ[0].FindElement(By.TagName("a"));
                                    string      strTaxReal    = ITaxBillCount.GetAttribute("href");
                                    strTaxRealestate.Add(strTaxReal);
                                }
                            }
                        }
                    }
                    IList <IWebElement> tables1 = driver.FindElements(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[3]/td/table/tbody/tr[2]/td/table/tbody/tr"));
                    int count1 = tables.Count;
                    foreach (IWebElement tab in tables1)
                    {
                        if (tab.Text.Contains("Previous Year Tax Payment Information"))
                        {
                            IList <IWebElement> ITaxRealRowQ1 = tab.FindElements(By.TagName("tr"));
                            IList <IWebElement> ITaxRealTdQ1;
                            foreach (IWebElement ItaxReal1 in ITaxRealRowQ1)
                            {
                                ITaxRealTdQ1 = ItaxReal1.FindElements(By.TagName("td"));
                                if (ITaxRealTdQ1.Count == 4)
                                {
                                    try
                                    {
                                        IWebElement ITaxBillCount = ITaxRealTdQ1[0].FindElement(By.TagName("a"));
                                        string      strTaxReal    = ITaxBillCount.GetAttribute("href");
                                        strTaxRealestate.Add(strTaxReal);
                                    }
                                    catch { }
                                }
                            }
                        }
                    }
                    IList <IWebElement> tables2 = driver.FindElements(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[3]/td/table/tbody/tr[2]/td/table/tbody/tr"));
                    int count2 = tables.Count;
                    foreach (IWebElement tab in tables2)
                    {
                        if (tab.Text.Contains("Parcel Number Tax Default No."))
                        {
                            IList <IWebElement> ITaxRealRowQ2 = tab.FindElements(By.TagName("tr"));
                            IList <IWebElement> ITaxRealTdQ2;
                            foreach (IWebElement ItaxReal1 in ITaxRealRowQ2)
                            {
                                ITaxRealTdQ2 = ItaxReal1.FindElements(By.TagName("td"));
                                if (ITaxRealTdQ2.Count == 4 && !ItaxReal1.Text.Contains("Tax Default No") && ITaxRealTdQ2[0].Text.Trim() != "" && ITaxRealTdQ2[1].Text.Trim() != "")
                                {
                                    IWebElement ITaxBillCount = ITaxRealTdQ2[1].FindElement(By.TagName("a"));
                                    string      strTaxReal    = ITaxBillCount.GetAttribute("href");
                                    strTaxRealestate1.Add(strTaxReal);
                                }
                            }
                        }
                    }
                    //deliquent tax
                    foreach (string real1 in strTaxRealestate1)
                    {
                        driver.Navigate().GoToUrl(real1);
                        Thread.Sleep(4000);
                        gc.CreatePdf(orderNumber, Parcel, "Deliquent tax", driver, "CA", "Orange");
                        string tax_no = "", deli_year = "", status = "";
                        tax_no    = driver.FindElement(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[3]/td/table/tbody/tr[2]/td/table/tbody/tr[2]/td[2]")).Text;
                        deli_year = driver.FindElement(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[3]/td/table/tbody/tr[2]/td/table/tbody/tr[3]/td[2] ")).Text;
                        status    = driver.FindElement(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[3]/td/table/tbody/tr[2]/td/table/tbody/tr[4]/td[2] ")).Text;

                        IWebElement         multitableElement11 = driver.FindElement(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[4]/td/form/table/tbody"));
                        IList <IWebElement> multitableRow11 = multitableElement11.FindElements(By.TagName("tr"));
                        IList <IWebElement> multirowTD11;
                        //   Tax Default No.(TDN)~First Year of Delinquency~Tax Status~TDN Parcels~Roll Year~Taxes~Basic Penalties~Cost~Additional Penalties~Total
                        foreach (IWebElement row in multitableRow11)
                        {
                            try
                            {
                                multirowTD11 = row.FindElements(By.TagName("td"));
                                if (multirowTD11[0].Text.Trim() != "" && !row.Text.Contains("TDN Parcels"))
                                {
                                    if (multirowTD11.Count == 7)
                                    {
                                        string tax_deli1 = tax_no + "~" + deli_year + "~" + status + "~" + multirowTD11[0].Text + "~" + multirowTD11[1].Text + "~" + multirowTD11[2].Text + "~" + multirowTD11[3].Text + "~" + multirowTD11[4].Text + "~" + multirowTD11[5].Text + "~" + multirowTD11[6].Text;
                                        gc.insert_date(orderNumber, Parcel, 565, tax_deli1, 1, DateTime.Now);
                                    }
                                    if (multirowTD11.Count == 4)
                                    {
                                        string tax_deli1 = tax_no + "~" + deli_year + "~" + status + "~" + multirowTD11[0].Text + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + multirowTD11[3].Text;
                                        gc.insert_date(orderNumber, Parcel, 565, tax_deli1, 1, DateTime.Now);
                                    }
                                    if (multirowTD11.Count == 6)
                                    {
                                        string tax_deli1 = tax_no + "~" + deli_year + "~" + status + "~" + multirowTD11[0].Text + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + multirowTD11[5].Text;
                                        gc.insert_date(orderNumber, Parcel, 565, tax_deli1, 1, DateTime.Now);
                                    }
                                }
                            }
                            catch { }
                        }
                    }
                    string address = "", taxrate = "", rolltype = "", parcelnumber = "", fiscal = "", fiscal_year = "";
                    //property,assessment,taxinfo
                    int c = 1;
                    foreach (string real in strTaxRealestate)
                    {
                        driver.Navigate().GoToUrl(real);
                        Thread.Sleep(4000);
                        gc.CreatePdf(orderNumber, Parcel, "taxinfo details" + c, driver, "CA", "Orange");
                        c++;
                        try
                        {
                            try
                            {
                                fiscal = driver.FindElement(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[1]/td")).Text;
                                if (fiscal == "Property Tax Information")
                                {
                                }
                                else
                                {
                                    fiscal_year = GlobalClass.After(fiscal, "FISCAL YEAR").Trim();
                                }
                            }
                            catch { }
                            try
                            {
                                rolltype = driver.FindElement(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[3]/td/table/tbody/tr[5]/td[2]")).Text;
                            }
                            catch
                            {
                                rolltype = "";
                            }
                            if (rolltype == "Secured")
                            {
                                if (a == 1)
                                {
                                    try
                                    {
                                        IWebElement         multitableElement1 = driver.FindElement(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[3]/td/table/tbody"));
                                        IList <IWebElement> multitableRow1     = multitableElement1.FindElements(By.TagName("tr"));
                                        IList <IWebElement> multirowTD1;

                                        foreach (IWebElement row in multitableRow1)
                                        {
                                            multirowTD1 = row.FindElements(By.TagName("td"));
                                            if (multirowTD1[0].Text.Trim() != "")
                                            {
                                                if (i == 0)
                                                {
                                                    parcelnumber = multirowTD1[1].Text;
                                                    parcelnumber = GlobalClass.Before(parcelnumber, "View Original Bill").Trim();
                                                }
                                                if (i == 1)
                                                {
                                                    address = multirowTD1[1].Text;
                                                }
                                                if (i == 2)
                                                {
                                                    taxrate = multirowTD1[1].Text;
                                                }
                                                if (i == 3)
                                                {
                                                    rolltype = multirowTD1[1].Text;
                                                }
                                                i++;
                                            }
                                        }
                                    }
                                    catch { }
                                    //property
                                    gc.insert_date(orderNumber, Parcel, 548, address + "~" + taxrate, 1, DateTime.Now);
                                    //Assessment
                                    string              Land_Value = "", Mineral_Rights = "", Improvement_Value = "", Personal_Property = "", Others = "", Total_Assessed_Value = "", Homeowner_Exemption = "", Net_Assessed_Value = "";
                                    IWebElement         multitableElement = driver.FindElement(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[7]/td/table/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 == 4)
                                        {
                                            if ((multirowTD[2].Text.Trim() != "") && !row.Text.Contains("Assessed Values and Exemptions") && !row.Text.Contains("Description") && multirowTD.Count == 4 && !row.Text.Contains("Total Due and Payable"))
                                            {
                                                if (k == 0)
                                                {
                                                    Land_Value = multirowTD[2].Text;
                                                }
                                                if (k == 1)
                                                {
                                                    Mineral_Rights = multirowTD[2].Text;
                                                }
                                                if (k == 2)
                                                {
                                                    Improvement_Value = multirowTD[2].Text;
                                                }
                                                if (k == 3)
                                                {
                                                    Personal_Property = multirowTD[2].Text;
                                                }
                                                if (k == 4)
                                                {
                                                    Others = multirowTD[2].Text;
                                                }
                                                if (k == 5)
                                                {
                                                    Total_Assessed_Value = multirowTD[2].Text;
                                                }
                                                if (k == 6)
                                                {
                                                    Homeowner_Exemption = multirowTD[2].Text;
                                                }
                                                if (k == 7)
                                                {
                                                    Net_Assessed_Value = multirowTD[2].Text;
                                                }
                                                k++;
                                            }
                                        }
                                    }
                                    string assessment_details = Land_Value + "~" + Mineral_Rights + "~" + Improvement_Value + "~" + Personal_Property + "~" + Others + "~" + Total_Assessed_Value + "~" + Homeowner_Exemption + "~" + Net_Assessed_Value;
                                    gc.insert_date(orderNumber, Parcel, 549, assessment_details, 1, DateTime.Now);
                                }
                                a++;
                            }
                            else
                            {
                                try
                                {
                                    IWebElement         multitableElement = driver.FindElement(By.XPath("//*[@id='col2']/div[2]/table/tbody"));
                                    IList <IWebElement> multitableRow     = multitableElement.FindElements(By.TagName("tr"));
                                    IList <IWebElement> multirowTD;
                                    j = 0;
                                    foreach (IWebElement row in multitableRow)
                                    {
                                        multirowTD = row.FindElements(By.TagName("td"));
                                        if (multirowTD[0].Text.Trim() != "" && !row.Text.Contains("Current Year and Unpaid Non-Delinquent Tax Bills") && multirowTD.Count == 2)
                                        {
                                            if (j == 0)
                                            {
                                                parcelnumber = multirowTD[1].Text;
                                                parcelnumber = GlobalClass.Before(parcelnumber, "View Bill").Trim();
                                            }
                                            if (j == 1)
                                            {
                                                address = multirowTD[1].Text;
                                            }
                                            if (j == 2)
                                            {
                                                taxrate = multirowTD[1].Text;
                                            }
                                            if (j == 3)
                                            {
                                                rolltype = multirowTD[1].Text;
                                                if (rolltype.Contains("("))
                                                {
                                                    rolltype = GlobalClass.Before(rolltype, "(").Trim();
                                                }
                                            }
                                            j++;
                                        }
                                    }
                                }
                                catch { }
                            }
                            IWebElement tbmulti;
                            //Parcel Number~Tax Year~Tax Type~Installment Type~Due Date~Tax Status~Amount Due~Remarks~Total Due Amount~Total Amt Paid~Paid Date~Paid Amount
                            string InstallmentType = "", Due_Date = "", Tax_Status = "", Amount_Due = "", Remarks = "", Total_Due_Amount = "", Total_Amt_Paid = "", Paid_Amount = "", Paid_Date = "";
                            string taxinfo = "", taxinfo1 = "", taxinfo2 = "";
                            try
                            {
                                tbmulti = driver.FindElement(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[4]/td/table/tbody"));
                            }
                            catch
                            {
                                tbmulti = driver.FindElement(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[9]/td/table/tbody"));
                            }
                            IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                            IList <IWebElement> TDmulti;
                            int l = 0;
                            foreach (IWebElement row in TRmulti)
                            {
                                TDmulti = row.FindElements(By.TagName("td"));
                                if (!row.Text.Contains("Installments") && !row.Text.Contains("Total Due and Payable"))
                                {
                                    if (TDmulti.Count == 6)
                                    {
                                        if (l == 0)
                                        {
                                            InstallmentType = TDmulti[1].Text;
                                            Due_Date        = TDmulti[2].Text;
                                            Tax_Status      = TDmulti[3].Text;
                                            Amount_Due      = TDmulti[4].Text;
                                            Remarks         = TDmulti[5].Text;
                                            taxinfo         = parcelnumber + "~" + fiscal_year + "~" + rolltype + "~" + InstallmentType + "~" + Due_Date + "~" + Tax_Status + "~" + Amount_Due + "~" + Remarks + "~" + "" + "~" + "";
                                        }
                                        if (l == 1)
                                        {
                                            InstallmentType = TDmulti[1].Text;
                                            Due_Date        = TDmulti[2].Text;
                                            Tax_Status      = TDmulti[3].Text;
                                            Amount_Due      = TDmulti[4].Text;
                                            Remarks         = TDmulti[5].Text;
                                            taxinfo1        = parcelnumber + "~" + fiscal_year + "~" + rolltype + "~" + InstallmentType + "~" + Due_Date + "~" + Tax_Status + "~" + Amount_Due + "~" + Remarks;
                                        }
                                        l++;
                                    }
                                }
                                if (row.Text.Contains("Total Due and Payable"))
                                {
                                    Total_Due_Amount = TDmulti[3].Text;
                                    taxinfo2         = taxinfo1 + "~" + Total_Due_Amount;
                                }
                            }
                            string      taxinfoNew = "";
                            IWebElement tbmulti1;
                            try
                            {
                                tbmulti1 = driver.FindElement(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[6]/td/table/tbody"));
                            }
                            catch
                            {
                                tbmulti1 = driver.FindElement(By.XPath("//*[@id='col2']/div[2]/table/tbody/tr[12]/td/table/tbody"));
                            }
                            IList <IWebElement> TRmulti1 = tbmulti1.FindElements(By.TagName("tr"));
                            IList <IWebElement> TDmulti1;
                            int m = 0;
                            foreach (IWebElement row in TRmulti1)
                            {
                                TDmulti1 = row.FindElements(By.TagName("td"));
                                if (!row.Text.Contains("Payment Summary") && !row.Text.Contains("Installments"))
                                {
                                    if (TDmulti1.Count == 6)
                                    {
                                        if (m == 0)
                                        {
                                            Paid_Date   = TDmulti1[2].Text;
                                            Paid_Amount = TDmulti1[4].Text;
                                            taxinfo     = taxinfo + "~" + Paid_Date + "~" + Paid_Amount + "~" + "Orange County Tax Collector, P.O.Box 1438 Santa Ana, CA 92702-1438";
                                            gc.insert_date(orderNumber, Parcel, 556, taxinfo, 1, DateTime.Now);
                                        }//ATTN: Orange County Tax Collector P.O.Box 1438 Santa Ana, CA 92702-1438
                                        if (m == 1)
                                        {
                                            Paid_Date   = TDmulti1[2].Text;
                                            Paid_Amount = TDmulti1[4].Text;
                                            taxinfoNew  = Paid_Date + "~" + Paid_Amount;
                                        }
                                        m++;
                                    }
                                }
                                if (row.Text.Contains("Total Amt Paid") && TDmulti1.Count == 5)
                                {
                                    string total_amount_due = TDmulti1[3].Text;
                                    taxinfo2 = taxinfo2 + "~" + total_amount_due + "~" + taxinfoNew + "~" + "";
                                    gc.insert_date(orderNumber, Parcel, 556, taxinfo2, 1, DateTime.Now);
                                }
                            }
                        }
                        catch { }
                    }
                    //download bill
                    try
                    {
                        foreach (string real2 in strTaxRealestate)
                        {
                            var           chDriver = new ChromeDriver();
                            WebDriverWait waittime = new WebDriverWait(chDriver, TimeSpan.FromSeconds(5));
                            chDriver.Navigate().GoToUrl(real2);
                            Thread.Sleep(4000);
                            try
                            {
                                IWebElement Itaxstmt = chDriver.FindElement(By.LinkText("View Original Bill"));
                                string      stmt1    = Itaxstmt.GetAttribute("href");
                                Itaxstmt.Click();
                            }
                            catch
                            {
                                IWebElement Itaxstmt = chDriver.FindElement(By.LinkText("View Bill"));
                                string      stmt1    = Itaxstmt.GetAttribute("href");
                                Itaxstmt.Click();
                            }
                            chDriver.SwitchTo().Window(chDriver.WindowHandles.Last());
                            string currentURL = chDriver.Url;
                            gc.downloadfile(currentURL, orderNumber, Parcel, "Billdown" + b, "CA", "Orange");
                            b++;
                            chDriver.Quit();
                        }
                    }
                    catch
                    { }
                    TaxTime     = DateTime.Now.ToString("HH:mm:ss");
                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "CA", "Orange", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);
                    driver.Quit();
                    gc.mergpdf(orderNumber, "CA", "Orange");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw ex;
                }
            }
        }