public string FTP_Baltimore(string houseno, string sname, string stype, string unitno, string ownername, string parcelNumber, string searchType, string orderNumber, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

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

            string Tax_Year = "", Paid_Date = "", Discount = "", Paid_Amount = "", Total_Due = "", b = "";
            var    driverService = PhantomJSDriverService.CreateDefaultService();

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

                    driver.Navigate().GoToUrl("https://sdat.dat.maryland.gov/RealProperty/Pages/default.aspx");
                    Thread.Sleep(3000);
                    var Select         = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucSearchType_ddlCounty"));
                    var selectElement1 = new SelectElement(Select);
                    selectElement1.SelectByText("BALTIMORE CITY");
                    if (searchType == "address")
                    {
                        var Select1         = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucSearchType_ddlSearchType"));
                        var selectElement11 = new SelectElement(Select1);
                        selectElement11.SelectByText("STREET ADDRESS");
                        gc.CreatePdf_WOP(orderNumber, "Address", driver, "MD", "Baltimore City");
                        driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_StartNavigationTemplateContainerID_btnContinue")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtStreenNumber")).SendKeys(houseno);
                        driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtStreetName")).SendKeys(sname);
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "MD", "Baltimore City");
                        driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_StepNavigationTemplateContainerID_btnStepNextButton")).SendKeys(Keys.Enter);

                        Thread.Sleep(4000);
                        try
                        {
                            if (driver.FindElement(By.XPath(" //*[@id='MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucSearchResult_gv_SearchResult']/tbody")).Displayed)
                            {
                                gc.CreatePdf_WOP(orderNumber, "MultiParcel search result", driver, "MD", "Baltimore City");
                                IWebElement         multitableElement11 = driver.FindElement(By.XPath("//*[@id='MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucSearchResult_gv_SearchResult']/tbody"));
                                IList <IWebElement> multitableRow11     = multitableElement11.FindElements(By.TagName("tr"));
                                IList <IWebElement> multirowTD11;
                                int k = 0;
                                foreach (IWebElement row in multitableRow11)
                                {
                                    if (k <= 25)
                                    {
                                        if (!row.Text.Contains("Name"))
                                        {
                                            multirowTD11 = row.FindElements(By.TagName("td"));
                                            if (multirowTD11.Count != 1 && multirowTD11[0].Text.Trim() != "")
                                            {
                                                string p_no = multirowTD11[1].Text.Trim();
                                                p_no = p_no.Replace(" ", "");
                                                string multi_parcel = multirowTD11[0].Text.Trim() + "~" + multirowTD11[1].Text.Trim() + "~" + multirowTD11[2].Text.Trim() + "~" + multirowTD11[3].Text.Trim() + "~" + multirowTD11[4].Text.Trim() + "~" + multirowTD11[5].Text.Trim();
                                                gc.insert_date(orderNumber, p_no, 210, multi_parcel, 1, DateTime.Now);
                                            }
                                        }
                                        k++;
                                    }
                                }
                                if (multitableRow11.Count > 25)
                                {
                                    HttpContext.Current.Session["multiParcel_Baltimore_Multicount"] = "Maximum";
                                }
                                else
                                {
                                    HttpContext.Current.Session["multiParcel_Baltimore"] = "Yes";
                                }

                                driver.Quit();
                                // gc.mergpdf(orderNumber);
                                return("MultiParcel");
                            }
                        }
                        catch { }
                    }

                    if (searchType == "titleflex")
                    {
                        string titleaddress = houseno + " " + sname + " " + stype + " " + unitno;
                        gc.TitleFlexSearch(orderNumber, "", ownername, titleaddress.Trim(), "MD", "Baltimore City");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_MDBaltimore"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }
                    if (searchType == "parcel")
                    {
                        //if ((HttpContext.Current.Session["titleflex_alternateAPN"] == null))
                        //{
                        //    gc.TitleFlexSearch(orderNumber, parcelNumber, "", "", "MD", "Baltimore City");
                        //    string strParcelNumber = HttpContext.Current.Session["titleflex_alternateAPN"].ToString();
                        //    if (strParcelNumber.Trim().Length == 13 || strParcelNumber.Trim().Length == 12 || strParcelNumber.Trim().Length == 9)
                        //    {
                        //        parcelNumber = strParcelNumber.Replace("-", "").Replace(" ", "");
                        //    }
                        //    HttpContext.Current.Session["titleflex_alternateAPN"] = null;
                        //}
                        //if (HttpContext.Current.Session["titleparcel"] != null && HttpContext.Current.Session["titleflex_alternateAPN"] != null)
                        //{
                        //    string strParcelNumber = HttpContext.Current.Session["titleflex_alternateAPN"].ToString();
                        //    if (strParcelNumber.Trim().Length == 13 || strParcelNumber.Trim().Length == 12 || strParcelNumber.Trim().Length == 9)
                        //    {
                        //        parcelNumber = strParcelNumber.Replace("-", "").Replace(" ", "");
                        //    }
                        //}
                        var Select11         = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucSearchType_ddlSearchType"));
                        var selectElement111 = new SelectElement(Select11);
                        selectElement111.SelectByText("PROPERTY ACCOUNT IDENTIFIER");
                        gc.CreatePdf_WOP(orderNumber, "Parcel search", driver, "MD", "Baltimore City");
                        driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_StartNavigationTemplateContainerID_btnContinue")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        if (parcelNumber.Contains("-"))
                        {
                            parcelNumber = parcelNumber.Replace("-", "");
                        }
                        if (parcelNumber.Length == 12)
                        {
                            string ward = parcelNumber.Substring(0, 2);
                            driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtWard")).SendKeys(ward);
                            string section1 = parcelNumber.Substring(2, 2);
                            driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtSection")).SendKeys(section1);
                            string block = parcelNumber.Substring(4, 5);
                            driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtBlock")).SendKeys(block);
                            string lot = parcelNumber.Substring(9, 3);
                            driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtLot")).SendKeys(lot);
                        }
                        else
                        {
                            string ward1 = parcelNumber.Substring(0, 2);
                            driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtWard")).SendKeys(ward1);
                            string section11 = parcelNumber.Substring(2, 2);
                            driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtSection")).SendKeys(section11);

                            string block1 = parcelNumber.Substring(4, 4);
                            driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtBlock")).SendKeys(block1);
                            string lot1 = parcelNumber.Substring(8, 3);
                            driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucEnterData_txtLot")).SendKeys(lot1);
                        }
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search result", driver, "MD", "Baltimore City");
                        driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_StepNavigationTemplateContainerID_btnStepNextButton")).SendKeys(Keys.Enter);
                        Thread.Sleep(5000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search result1", driver, "MD", "Baltimore City");
                    }

                    try
                    {
                        IWebElement INodata = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_lblErr"));
                        if (INodata.Text.Contains("no records that match your criteria"))
                        {
                            HttpContext.Current.Session["Nodata_MDBaltimore"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }

                    //property details
                    gc.CreatePdf(orderNumber, parcelNumber, "Assessment details", driver, "MD", "Baltimore City");
                    string Account_id_number = "", Owner_name = "", Address = "", Legal_Description = "", Year_Built = "", use = "", Principal_Residence = "", Map = "", Sections = "", Land = "", Building = "", Total_Assessed_Value = "";
                    string Grid = "", Parcel = "", Sub_District = "", Subdivision = "", Block = "", Lot = "", Assessment_Year = "", Homestead_Application_Status = "", Homeowners_Tax_Credit_Application_Status = "", Homeowners_Tax_Credit_Application_Date = "";
                    Account_id_number = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblDetailsStreetHeader_0")).Text.Trim();
                    string value = Account_id_number.Replace("Ward", "").Replace("Section", "").Replace("Block", "").Replace("Lot", "");
                    Account_id_number = value.Replace(" ", "").Replace("-", "");


                    Owner_name = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblOwnerName_0")).Text.Trim();
                    Address    = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblPremisesAddress_0")).Text.Trim();
                    Address    = Address.Replace("\r\n", " ");

                    string Mail_Address = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblMailingAddress_0")).Text.Trim();
                    Mail_Address = Mail_Address.Replace("\r\n", " ");

                    Legal_Description = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblLegalDescription_0")).Text.Trim();
                    Year_Built        = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label18_0")).Text.Trim();
                    use = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblUse_0")).Text.Trim();
                    Principal_Residence = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblPrinResidence_0")).Text.Trim();
                    Map             = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label5_0")).Text.Trim();
                    Grid            = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label6_0")).Text.Trim();
                    Parcel          = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label7_0")).Text.Trim();
                    Sub_District    = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label8_0")).Text.Trim();
                    Subdivision     = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label9_0")).Text.Trim();
                    Sections        = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label10_0")).Text.Trim();
                    Block           = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label11_0")).Text.Trim();
                    Lot             = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label12_0")).Text.Trim();
                    Assessment_Year = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_Label13_0")).Text.Trim();
                    Homestead_Application_Status             = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblHomeStatus_0")).Text.Trim();
                    Homeowners_Tax_Credit_Application_Status = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblHTC_Status_0")).Text.Trim();
                    Homeowners_Tax_Credit_Application_Date   = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblHTC_StatusDate_0")).Text.Trim();

                    string property_details = Account_id_number + "~" + Owner_name + "~" + Address + "~" + Mail_Address + "~" + Legal_Description + "~" + Year_Built + "~" + use + "~" + Principal_Residence + "~" + Map + "~" + Grid + "~" + Parcel + "~" + Sub_District + "~" + Subdivision + "~" + Sections + "~" + Block + "~" + Lot + "~" + Assessment_Year + "~" + Homestead_Application_Status + "~" + Homeowners_Tax_Credit_Application_Status + "~" + Homeowners_Tax_Credit_Application_Date;
                    gc.insert_date(orderNumber, Account_id_number, 206, property_details, 1, DateTime.Now);

                    //Assessment Details Table:

                    Land                 = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblBaseLand_0")).Text.Trim();
                    Building             = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblBaseImprove_0")).Text.Trim();
                    Total_Assessed_Value = driver.FindElement(By.Id("MainContent_MainContent_cphMainContentArea_ucSearchType_wzrdRealPropertySearch_ucDetailsSearch_dlstDetaisSearch_lblBaseTotal_0")).Text.Trim();

                    string Assessment_details = Land + "~" + Building + "~" + Total_Assessed_Value;
                    gc.insert_date(orderNumber, Account_id_number, 207, Assessment_details, 1, DateTime.Now);
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    driver.Navigate().GoToUrl("http://cityservices.baltimorecity.gov/realproperty/default.aspx");
                    Thread.Sleep(3000);
                    driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_txtBlock")).SendKeys(Block);
                    driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_txtLot")).SendKeys(Lot);
                    gc.CreatePdf(orderNumber, Account_id_number, "Tax_info", driver, "MD", "Baltimore City");
                    driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_btnSearch")).SendKeys(Keys.Enter);
                    Thread.Sleep(3000);
                    gc.CreatePdf(orderNumber, Account_id_number, "Tax_info1", driver, "MD", "Baltimore City");
                    driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_DataGrid1_ctl02_lnkBtnSelect")).Click();
                    Thread.Sleep(3000);
                    gc.CreatePdf(orderNumber, Account_id_number, "Tax_info2", driver, "MD", "Baltimore City");
                    string other_charges = "";
                    Tax_Year = driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_LabelEndFY")).Text;
                    string other = "";
                    try
                    {
                        other = driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_Other2")).Text;
                    }
                    catch
                    {
                        other = "";
                    }

                    try
                    {
                        if (other != "OTHER CHARGES")
                        {
                            Paid_Date = driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_Paid")).Text;
                            Paid_Date = Regex.Replace(Paid_Date, "[A-Za-z ]", "").Trim();
                            string a1 = Paid_Date.Substring(0, 8);
                            Discount    = Paid_Date.Substring(8, 4);
                            Paid_Date   = a1;
                            Paid_Amount = driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_AmtPaid")).Text;
                        }
                        else
                        {
                            Paid_Date   = " ";
                            Discount    = " ";
                            Paid_Date   = driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_Other")).Text;
                            Paid_Amount = driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_OtherAmt")).Text;
                            Paid_Date   = Regex.Replace(Paid_Date, "[A-Za-z ]", "").Trim();
                            string a1 = Paid_Date.Substring(0, 8);
                            Discount      = Paid_Date.Substring(8, 4);
                            Paid_Date     = a1;
                            other_charges = driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_Other2Amt")).Text;
                        }
                    }
                    catch { }

                    Total_Due = driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_AmountDue")).Text;
                    if (!Total_Due.Contains("0.00"))
                    {
                        other_charges = driver.FindElement(By.Id("ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_OtherAmt")).Text;
                    }
                    IWebElement         multitableElement1 = driver.FindElement(By.XPath("//*[@id='ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_Table1']/tbody"));
                    IList <IWebElement> multitableRow1     = multitableElement1.FindElements(By.TagName("tr"));
                    IList <IWebElement> multirowTD1;
                    foreach (IWebElement row in multitableRow1)
                    {
                        if (!row.Text.Contains("ASSESSMENT"))
                        {
                            if (!row.Text.Contains("PAID"))
                            {
                                multirowTD1 = row.FindElements(By.TagName("td"));
                                if (multirowTD1.Count != 1)
                                {
                                    if (multirowTD1.Count == 4)
                                    {
                                        string tax_info = Tax_Year + "~" + "" + "~" + multirowTD1[0].Text.Trim() + "~" + multirowTD1[1].Text.Trim() + "~" + multirowTD1[2].Text.Trim() + "~" + multirowTD1[3].Text.Trim() + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-";
                                        gc.insert_date(orderNumber, Account_id_number, 208, tax_info, 1, DateTime.Now);
                                    }
                                }
                            }
                        }
                    }



                    string tax_info1 = Tax_Year + "~" + Paid_Date + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + other_charges + "~" + Discount + "~" + Paid_Amount + "~" + Total_Due;
                    gc.insert_date(orderNumber, Account_id_number, 208, tax_info1, 1, DateTime.Now);

                    string Taxing_authority_address1 = driver.FindElement(By.XPath("//*[@id='ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_tblDetail']/tbody/tr[2]/td[2]")).Text.Trim();
                    Taxing_authority_address1 = Taxing_authority_address1.Replace("\r\n", " ");
                    string Taxing_authority_address = WebDriverTest.Before(Taxing_authority_address1, "TELEPHONE").Trim();

                    string telephone = WebDriverTest.After(Taxing_authority_address1, "BILLING").Trim();
                    telephone = WebDriverTest.Before(telephone, "IVR   REFERENCE").Trim();

                    string tax_info2 = "Taxing Authority  :" + "~" + Taxing_authority_address + "~" + "Phone Number  :" + "~" + telephone + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-";
                    gc.insert_date(orderNumber, Account_id_number, 208, tax_info2, 1, DateTime.Now);

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

                    //Tax Due / Delinquent Details
                    if (!Total_Due.Contains("0.00"))
                    {
                        string              install             = "";
                        IWebElement         multitableElement11 = driver.FindElement(By.XPath("//*[@id='ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_Table2']/tbody"));
                        IList <IWebElement> multitableRow11     = multitableElement11.FindElements(By.TagName("tr"));
                        IList <IWebElement> multirowTD11;
                        foreach (IWebElement row in multitableRow11)
                        {
                            if (!row.Text.Contains("SEMIANNUAL PAYMENT"))
                            {
                                if (row.Text.Contains("1ST INSTALLMENT"))
                                {
                                    install = "1ST INSTALLMENT";
                                }
                                if (row.Text.Contains("2ND INSTALLMENT"))
                                {
                                    install = "2ND INSTALLMENT";
                                }
                                if (row.Text.Contains("ANNUAL PAYMENT SCHEDULE"))
                                {
                                    install = "ANNUAL PAYMENT SCHEDULE";
                                }
                                if (!row.Text.Contains("IF PAID BY"))
                                {
                                    if (!row.Text.Contains("  "))
                                    {
                                        multirowTD11 = row.FindElements(By.TagName("td"));
                                        if (multirowTD11.Count == 3)
                                        {
                                            string tax_info = "-" + "~" + install + "~" + multirowTD11[0].Text.Trim() + "~" + multirowTD11[1].Text.Trim() + "~" + multirowTD11[2].Text.Trim();
                                            gc.insert_date(orderNumber, Account_id_number, 209, tax_info, 1, DateTime.Now);
                                        }
                                    }
                                }
                            }
                        }
                        string service_fee = driver.FindElement(By.XPath("//*[@id='ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_Table2']/tbody/tr[14]/td[1]")).Text;
                        tax_info1 = service_fee + "~" + "" + "~" + "" + "~" + "" + "~" + "";
                        gc.insert_date(orderNumber, Account_id_number, 209, tax_info1, 1, DateTime.Now);
                        string fee = driver.FindElement(By.XPath("//*[@id='ctl00_ctl00_rootMasterContent_LocalContentPlaceHolder_Table2']/tbody/tr[14]/td[2]")).Text;
                        tax_info2 = fee + "~" + "" + "~" + "" + "~" + "" + "~" + "";
                        gc.insert_date(orderNumber, Account_id_number, 209, tax_info2, 1, DateTime.Now);
                    }

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

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

                    driver.Quit();
                    gc.mergpdf(orderNumber, "MD", "Baltimore City");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw ex;
                }
            }
        }
Esempio n. 2
0
        public string FTP_Utah(string houseno, string direction, string sname, string sttype, string parcelNumber, string searchType, string orderNumber, string ownername, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            // driver = new PhantomJSDriver();
            //driver = new ChromeDriver();
            IJavaScriptExecutor js = driver as IJavaScriptExecutor;
            string        pathurl = "", Owner_Name = "";
            string        StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";
            List <string> taxurllist = new List <string>();

            using (driver = new PhantomJSDriver())
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");
                    if (searchType == "titleflex")
                    {
                        string address = houseno + " " + direction + " " + sname + " " + sttype;
                        gc.TitleFlexSearch(orderNumber, parcelNumber, "", address, "UT", "Utah");
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Utah_Zero"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    driver.Navigate().GoToUrl("http://www.utahcountyonline.org/LandRecords/Index.asp");
                    if (searchType == "address")
                    {
                        driver.Navigate().GoToUrl("http://www.utahcountyonline.org/LandRecords/AddressSearchForm.asp");
                        Thread.Sleep(2000);
                        //driver.FindElement(By.XPath("/html/body/div/div[6]/div[2]/table/tbody/tr/td/table/tbody/tr/td[1]/ul[1]/li[2]/a")).SendKeys(Keys.Enter);
                        //gc.CreatePdf_WOP_Chrome(orderNumber, "Address Search",driver, "UT", "Utah");
                        driver.FindElement(By.Id("av_house")).SendKeys(houseno);
                        driver.FindElement(By.Id("av_dir")).SendKeys(direction);
                        driver.FindElement(By.Id("av_street")).SendKeys(sname);
                        driver.FindElement(By.Id("street_type")).SendKeys(sttype);
                        //IWebElement rdio = driver.FindElement(By.XPath("//*[@id='form1']/table/tbody/tr/td/p[2]/label[2]/label/input"));
                        //js.ExecuteScript("arguments[0].click();", rdio);
                        driver.FindElement(By.XPath("//*[@id='form1']/table/tbody/tr/td/p[3]/input")).SendKeys(Keys.Enter);
                        gc.CreatePdf_WOP_Chrome(orderNumber, "Address Search result", driver, "UT", "Utah");
                        //multi parcel
                        IWebElement         multitableElement = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table[1]/tbody"));
                        IList <IWebElement> multitableRow     = multitableElement.FindElements(By.TagName("tr"));
                        if (multitableRow.Count > 2)
                        {
                            IList <IWebElement> multirowTD;
                            foreach (IWebElement row in multitableRow)
                            {
                                multirowTD = row.FindElements(By.TagName("td"));
                                if (multirowTD.Count != 0 && !row.Text.Contains("Serial Number"))
                                {
                                    string multi = multirowTD[1].Text.Trim() + "~" + "-";
                                    gc.insert_date(orderNumber, multirowTD[0].Text.Trim(), 119, multi, 1, DateTime.Now);
                                }
                            }
                            HttpContext.Current.Session["multiparcel_Utah"] = "Yes";
                            if (multitableRow.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_Utah_Multicount"] = "Maximum";
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                        if (multitableRow.Count == 1)
                        {
                            HttpContext.Current.Session["Utah_Zero"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                        else
                        {
                            driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table[1]/tbody/tr[2]/td[1]/a")).SendKeys(Keys.Enter);
                            IWebElement url = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[2]/td[1]/a"));
                            pathurl    = url.GetAttribute("href");
                            Owner_Name = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[2]/td[1]")).Text;
                            driver.Navigate().GoToUrl(pathurl);
                            gc.CreatePdf_WOP_Chrome(orderNumber, "Address Search result page", driver, "UT", "Utah");
                        }
                    }

                    else if (searchType == "parcel")
                    {
                        driver.FindElement(By.XPath("/html/body/div/div[6]/div[2]/table/tbody/tr/td/table/tbody/tr/td[1]/ul[1]/li[3]/a")).SendKeys(Keys.Enter);
                        if (parcelNumber.Contains(":") || parcelNumber.Contains(" "))
                        {
                            parcelNumber = parcelNumber.Replace(":", "").Trim();
                            parcelNumber = parcelNumber.Replace(" ", "").Trim();
                        }
                        gc.CreatePdf_Chrome(orderNumber, parcelNumber, "Parcel Search", driver, "UT", "Utah");
                        driver.FindElement(By.Id("av_serial")).SendKeys(parcelNumber);
                        IWebElement rdio = driver.FindElement(By.XPath("//*[@id='form1']/table/tbody/tr/td/p[2]/label[2]/label/input"));
                        js.ExecuteScript("arguments[0].click();", rdio);
                        driver.FindElement(By.XPath("//*[@id='form1']/table/tbody/tr/td/p[3]/input")).SendKeys(Keys.Enter);
                        gc.CreatePdf_Chrome(orderNumber, parcelNumber, "Parcel Search result", driver, "UT", "Utah");

                        IList <IWebElement> TRserial = driver.FindElements(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr"));
                        int count = TRserial.Count;
                        for (int i = 2; i <= count; i++)
                        {
                            try
                            {
                                string selectedvalue = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[" + i + "]/td[3]/select/option[1]")).Text;
                                selectedvalue = selectedvalue.Replace(":", "");
                                if (selectedvalue == parcelNumber)
                                {
                                    IWebElement propinfo = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[" + i + "]/td[3]/select/option[2]"));
                                    string      url      = propinfo.GetAttribute("value");
                                    Owner_Name = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[2]/td[1]")).Text;
                                    gc.CreatePdf_Chrome(orderNumber, parcelNumber, "Parcel Search - select parcel number page", driver, "UT", "Utah");
                                    pathurl = "http://www.utahcounty.gov/LandRecords/" + url;
                                    driver.Navigate().GoToUrl(pathurl);
                                    //  break;
                                }
                            }
                            catch { }
                        }
                    }
                    else if (searchType == "ownername")
                    {
                        driver.FindElement(By.XPath("/html/body/div/div[6]/div[2]/table/tbody/tr/td/table/tbody/tr/td[1]/ul[1]/li[1]/a")).SendKeys(Keys.Enter);
                        gc.CreatePdf_WOP_Chrome(orderNumber, "Owner name Search", driver, "UT", "Utah");
                        driver.FindElement(By.Id("av_name")).SendKeys(ownername);
                        IWebElement rdio = driver.FindElement(By.XPath("//*[@id='av_valid_0']"));
                        //js.ExecuteScript("arguments[0].click();", rdio);
                        rdio.Click();
                        driver.FindElement(By.XPath("//*[@id='form1']/div/table/tbody/tr[1]/td/p[3]/input")).SendKeys(Keys.Enter);
                        gc.CreatePdf_WOP_Chrome(orderNumber, "Owner name Search result", driver, "UT", "Utah");

                        try
                        {
                            //multi parcel
                            IWebElement         multitableElement = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table[1]/tbody"));
                            IList <IWebElement> multitableRow     = multitableElement.FindElements(By.TagName("tr"));
                            IList <IWebElement> multirowTD;
                            foreach (IWebElement row in multitableRow)
                            {
                                multirowTD = row.FindElements(By.TagName("td"));
                                if (multirowTD.Count != 0 && !row.Text.Contains("Owner"))
                                {
                                    string multi = multirowTD[0].Text.Trim() + "~" + multirowTD[4].Text.Trim();
                                    gc.insert_date(orderNumber, multirowTD[1].Text.Trim(), 119, multi, 1, DateTime.Now);
                                }
                            }

                            HttpContext.Current.Session["multiparcel_Utah"] = "Yes";
                            if (multitableRow.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_Utah_Multicount"] = "Maximum";
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                        catch { }
                        try
                        {
                            IWebElement Nodata = driver.FindElement(By.XPath("/html/body/table"));
                            if (!Nodata.Text.Contains("Property Address") && !Nodata.Text.Contains("Owner Name"))
                            {
                                HttpContext.Current.Session["Utah_Zero"] = "Zero";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                    }


                    Thread.Sleep(3000);
                    //Property details

                    string Parcel_ID = "-", Property_Address = "-", Mailing_Address = "-", Legal_Description = "-";
                    Parcel_ID         = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[1]/td[1]")).Text;
                    Parcel_ID         = WebDriverTest.After(Parcel_ID, "Serial Number:");
                    Property_Address  = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[3]/td[1]")).Text;
                    Property_Address  = WebDriverTest.After(Property_Address, "Property Address:");
                    Mailing_Address   = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[4]/td[1]")).Text;
                    Mailing_Address   = WebDriverTest.After(Mailing_Address, "Mailing Address:");
                    Legal_Description = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[8]/td[1]")).Text;
                    Legal_Description = WebDriverTest.After(Legal_Description, "Legal Description:");

                    IList <IWebElement> tron = driver.FindElements(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/div/div/div[1]/table[2]/tbody/tr"));
                    for (int trcount = 1; trcount <= tron.Count; trcount++)
                    {
                        IWebElement on       = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/div/div/div[1]/table[2]/tbody/tr[" + trcount + "]/td[1]/span"));
                        string      greentag = on.GetAttribute("class");

                        if (greentag == "style1yv")
                        {
                            Owner_Name += driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/div/div/div[1]/table[2]/tbody/tr[" + trcount + "]/ td[3]")).Text + "&";
                        }
                    }
                    Owner_Name = Regex.Replace(Owner_Name, "[0-9]{2,}", "").Replace("&", " ").Replace(":", "");
                    if (Parcel_ID.Contains(":"))
                    {
                        Parcel_ID = Parcel_ID.Replace(":", "");
                    }
                    gc.CreatePdf_Chrome(orderNumber, Parcel_ID, "Property Details information", driver, "UT", "Utah");
                    //OwnerName = Owner_Name.Substring(OwnerName.Length - 1,1);
                    string prop = Owner_Name + "~" + Property_Address + "~" + Legal_Description + "~" + Mailing_Address;
                    gc.insert_date(orderNumber, Parcel_ID, 122, prop, 1, DateTime.Now);

                    //assessment details
                    string Tax_Year = "-";
                    Thread.Sleep(4000);
                    driver.FindElement(By.XPath("//*[@id='TabbedPanels1']/ul/li[2]")).SendKeys(Keys.Enter);
                    Thread.Sleep(3000);
                    try
                    {
                        driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/div/div/div[2]/table/tbody/tr[3]/td[1]/a")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        Tax_Year = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/p[1]")).Text;
                        Tax_Year = WebDriverTest.After(Tax_Year, "Tax Year: ");
                        Tax_Year = WebDriverTest.Before(Tax_Year, "   Tax District:").Trim();
                    }
                    catch { }
                    string              RealEstate_Residential = "", RealEstate_Agricultural = "", RealEstate_Commercial = "", RealEstate_Totals = "";
                    string              Improvements_Residential = "", Improvements_Agricultural = "", Improvements_Commercial = "", Improvements_Totals = "";
                    string              Greenbelt_Residential = "", Greenbelt_RealEstate = "", Greenbelt_HomeSite = "", Greenbelt_Totals = "", Greenbelt_TotalsRealProperty = "", Greenbelt_AttachedPersonalProperty = "", Greenbelt_ToatalValuation = "";
                    string              Ok = "";
                    IWebElement         tbassess = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table[1]/tbody"));
                    IList <IWebElement> trassess = tbassess.FindElements(By.TagName("tr"));
                    IList <IWebElement> tdassess;
                    foreach (IWebElement row in trassess)
                    {
                        tdassess = row.FindElements(By.TagName("td"));


                        if (Ok == "Real Estate" && tdassess[3].Text.Trim() != "")
                        {
                            RealEstate_Residential = tdassess[1].Text + "~" + tdassess[3].Text + "~" + tdassess[5].Text + "~" + RealEstate_Residential;
                        }
                        if (tdassess.Count != 0 && row.Text.Contains("* * Real Estate"))
                        {
                            Ok = "Real Estate";
                        }
                        if (Ok == "Improvements" && tdassess[3].Text.Trim() != "")
                        {
                            Improvements_Residential = tdassess[1].Text + "~" + tdassess[3].Text + "~" + tdassess[5].Text + "~" + Improvements_Residential;


                            //RealEstate_Residential = new string(RealEstate_Residential.Reverse().ToArray());
                        }
                        if (tdassess.Count != 0 && row.Text.Contains("* * Improvements"))
                        {
                            Ok = "Improvements";
                        }
                        if (Ok == "Greenbelt as of")
                        {
                            Greenbelt_Residential = tdassess[1].Text + "~" + tdassess[3].Text + "~" + tdassess[5].Text + "~" + Greenbelt_Residential;


                            //RealEstate_Residential = new string(RealEstate_Residential.Reverse().ToArray());
                        }
                        if (tdassess.Count != 0 && row.Text.Contains("* * Greenbelt as of "))
                        {
                            Ok = "Greenbelt as of";
                        }

                        //if (tdassess.Count != 0 && !row.Text.Contains("* * Real Estate"))
                        //{
                        //    string assessment = Tax_Year + "~" + tdassess[1].Text.Trim() + "~" + tdassess[3].Text.Trim() + "~" + tdassess[5].Text.Trim(); ;
                        //    gc.insert_date(orderNumber, Parcel_ID, 123, assessment, 1,DateTime.Now);
                        //}
                    }
                    RealEstate_Residential = RealEstate_Residential + "Ert";
                    RealEstate_Residential = RealEstate_Residential.Replace("~Ert", "");



                    Greenbelt_Residential = Greenbelt_Residential + "Ert";
                    Greenbelt_Residential = Greenbelt_Residential.Replace("~Ert", "");



                    Improvements_Residential = Improvements_Residential + "Ert";
                    Improvements_Residential = Improvements_Residential.Replace("~Ert", "");

                    string   Overall = RealEstate_Residential + "~" + Improvements_Residential + "~" + Greenbelt_Residential;
                    string[] Real = Overall.Split('~');
                    //for (int i = RealSplit.Count() - 1; i >= 0; i--)
                    //{
                    //    string assessment = RealSplit[i] + "~" + tdassess[1].Text.Trim() + "~" + tdassess[3].Text.Trim() + "~" + tdassess[5].Text.Trim(); ;
                    //    gc.insert_date(orderNumber, Parcel_ID, 123, assessment, 1,DateTime.Now);
                    //}
                    int    K = 0;
                    string FirstHalf = "";
                    try
                    {
                        FirstHalf = Real[K + 10] + "~" + Real[K + 11] + "~" + Real[K + 7] + "~" + Real[K + 8] + "~" + Real[K + 4] + "~" + Real[K + 5] + "~" + Real[K + 1] + "~" + Real[K + 2] + "~" + Real[K + 22] + "~" + Real[K + 23] + "~" + Real[K + 19] + "~" + Real[K + 20] + "~" + Real[K + 16] + "~" + Real[K + 17] + "~" + Real[K + 13] + "~" + Real[K + 14] + "~" + Real[K + 40] + "~" + Real[K + 41] + "~" + Real[K + 37] + "~" + Real[K + 38] + "~" + Real[K + 34] + "~" + Real[K + 35] + "~" + Real[K + 31] + "~" + Real[K + 32] + "~" + Real[K + 28] + "~" + Real[K + 29] + "~" + Real[K + 25] + "~" + Real[K + 26];
                    }
                    catch { }
                    gc.insert_date(orderNumber, Parcel_ID, 123, FirstHalf, 1, DateTime.Now);
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.CreatePdf_Chrome(orderNumber, Parcel_ID, "Assessment Details information", driver, "UT", "Utah");

                    driver.Navigate().GoToUrl(pathurl);
                    Thread.Sleep(3000);

                    //Tax history details

                    driver.FindElement(By.XPath("//*[@id='TabbedPanels1']/ul/li[3]")).SendKeys(Keys.Enter);
                    gc.CreatePdf_Chrome(orderNumber, Parcel_ID, "Tax History Details information", driver, "UT", "Utah");
                    IWebElement         tbtaxHist = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/div/div/div[3]/table/tbody"));
                    IList <IWebElement> trtaxhist = tbtaxHist.FindElements(By.TagName("tr"));
                    IList <IWebElement> tdtaxhist;

                    foreach (IWebElement row in trtaxhist)
                    {
                        tdtaxhist = row.FindElements(By.TagName("td"));
                        if (tdtaxhist.Count != 0 && !row.Text.Contains("Year"))
                        {
                            string taxhist = tdtaxhist[0].Text + "~" + tdtaxhist[1].Text + "~" + tdtaxhist[2].Text + "~" + tdtaxhist[3].Text + "~" + tdtaxhist[4].Text + "~" + tdtaxhist[5].Text + "~" + tdtaxhist[6].Text + "~" + tdtaxhist[7].Text + "~" + tdtaxhist[8].Text;
                            gc.insert_date(orderNumber, Parcel_ID, 128, taxhist, 1, DateTime.Now);
                        }
                    }

                    try
                    {
                        IWebElement         taxdetailtable    = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/div/div/div[3]/table/tbody"));
                        IList <IWebElement> taxdetailtableRow = taxdetailtable.FindElements(By.TagName("tr"));
                        int taxrowcount = taxdetailtableRow.Count;
                        IList <IWebElement> taxdetailrowTD;
                        int c = 0;
                        foreach (IWebElement rowid1 in taxdetailtableRow)
                        {
                            taxdetailrowTD = rowid1.FindElements(By.TagName("td"));
                            if (taxdetailrowTD.Count != 0 && c <= taxrowcount && c > 2)
                            {
                                IWebElement taxhistory = driver.FindElement(By.XPath("//*[@id='TabbedPanels1']/div/div[3]/table/tbody/tr[" + c + "]/td[1]/a"));
                                string      taxurl     = taxhistory.GetAttribute("href");
                                taxurllist.Add(taxurl);
                                //Thread.Sleep(2000);
                                //string year = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[1]/td/strong[2]")).Text;
                                //gc.CreatePdf_Chrome(orderNumber, Parcel_ID, "TaxDeailInformation" + year, driver);
                                //IWebElement URL= driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[17]/td/a"));
                                //string Url = URL.GetAttribute("href");
                                //gc.downloadfile(Url, orderNumber, Parcel_ID, "TaxBill" + year);
                                ////driver.Navigate().GoToUrl("http://www.utahcounty.gov/LandRecords/Property.asp?av_serial="+Parcel_ID);
                                //driver.Navigate().Back();
                            }

                            // Thread.Sleep(3000);
                            c++;
                        }
                    }
                    catch { }
                    int    i1 = 0;
                    string Delinquent = "", Paymentdetails = "";
                    foreach (string URL in taxurllist)
                    {
                        if (i1 < 3)
                        {
                            driver.Navigate().GoToUrl(URL);
                            Thread.Sleep(4000);
                            string SerialNo   = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[1]/td/strong[1]")).Text.Trim();
                            string year       = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[1]/td/strong[2]")).Text.Trim();
                            string Nettax     = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[9]/td[2]")).Text.Trim();
                            string Payments   = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[12]/td[2]")).Text.Trim();
                            string Taxbalance = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[14]/td[2]")).Text.Trim();
                            try
                            {
                                Delinquent = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[10]/td[4]/table/tbody/tr[1]/td")).Text.Trim();
                            }
                            catch { }
                            try
                            {
                                Paymentdetails = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[16]/td[1]/table/tbody")).Text;
                            }
                            catch { }
                            if (i1 == 0)
                            {
                                amck.TaxId           = SerialNo.Replace(":", "").Trim();
                                amck.TaxYear         = year;
                                amck.Instamount1     = Nettax;
                                amck.Instamountpaid1 = Payments;

                                if (Delinquent.Contains("Delinquent Tax Information"))
                                {
                                    amck.IsDelinquent = "Yes";
                                }
                                else
                                {
                                    //amck.IsDelinquent = "No";
                                    if (Taxbalance == "$0.00" && Paymentdetails.Contains("None"))
                                    {
                                    }
                                    else
                                    {
                                        if (amck.Instamount1 == amck.Instamountpaid1)
                                        {
                                            amck.InstPaidDue1 = "Paid";
                                            amck.IsDelinquent = "No";
                                        }
                                        else
                                        {
                                            amck.IsDelinquent = "Yes";
                                        }
                                        if (Nettax == Taxbalance)
                                        {
                                            amck.InstPaidDue1 = "Due";
                                            amck.IsDelinquent = "No";
                                        }
                                    }
                                }



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

                            gc.CreatePdf_Chrome(orderNumber, Parcel_ID, "TaxDeailInformation" + year, driver, "UT", "Utah");
                            IWebElement URL1 = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[17]/td/a"));
                            string      Url  = URL1.GetAttribute("href");
                            driver.Navigate().GoToUrl(Url);
                            Thread.Sleep(6000);
                            driver.SwitchTo().Window(driver.WindowHandles.Last());
                            Thread.Sleep(2000);
                            gc.CreatePdf_Chrome(orderNumber, Parcel_ID, "Tax Bill" + year, driver, "UT", "Utah");
                            driver.SwitchTo().Window(driver.WindowHandles.First());
                            Thread.Sleep(2000);
                            //gc.downloadfile(Url, orderNumber, Parcel_ID, "TaxBill" + year);
                            i1++;
                        }
                    }


                    driver.Navigate().GoToUrl("http://www.utahcounty.gov/LandRecords/Property.asp?av_serial=" + Parcel_ID);
                    driver.FindElement(By.XPath("//*[@id='TabbedPanels1']/ul/li[3]")).SendKeys(Keys.Enter);
                    //Tax payment details
                    string      Taxing_Authority = "", Good_PThrough_Date = "", date = "", deleiquent = "";
                    IWebElement tax_pay;
                    try
                    {
                        tax_pay    = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/div/div/div[3]/table/tbody/tr[3]/td[8]/a"));
                        deleiquent = tax_pay.Text;

                        if (deleiquent.Contains("Click for Payoff"))
                        {
                            tax_pay.SendKeys(Keys.Enter);
                            Thread.Sleep(3000);

                            IWebElement td = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td"));
                            date = td.Text;
                            date = WebDriverTest.After(date, "Total amount if paid as of").Trim();
                            date = WebDriverTest.Before(date, ".  .  .").Trim();

                            DateTime G_Date       = Convert.ToDateTime(date);
                            string   dateChecking = DateTime.Now.ToString("MM") + "/15/" + DateTime.Now.ToString("yyyy");

                            if (G_Date < Convert.ToDateTime(dateChecking))
                            {
                                //end of the month
                                date = new DateTime(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM"))), DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(DateTime.Now.ToString("MM")))).ToString("MM/dd/yyyy");
                            }

                            else if (G_Date > Convert.ToDateTime(dateChecking))
                            {
                                // nextEndOfMonth
                                if ((Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM"))) < 12))
                                {
                                    date = new DateTime(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM")) + 1), DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(DateTime.Now.ToString("MM")) + 1)).ToString("MM/dd/yyyy");
                                }
                                else
                                {
                                    int nxtYr = Convert.ToInt16(DateTime.Now.ToString("yyyy")) + 1;
                                    date = new DateTime(nxtYr, 1, DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), 1)).ToString("MM/dd/yyyy");
                                }
                            }
                            string   Mon   = "";
                            string[] da    = date.Split('/');
                            string   month = da[0];
                            string   Date  = da[1];
                            string   year  = da[2];

                            switch (month)
                            {
                            case "01":
                                Mon = "January";
                                break;

                            case "02":
                                Mon = "February";
                                break;

                            case "03":
                                Mon = "March";
                                break;

                            case "04":
                                Mon = "April";
                                break;

                            case "05":
                                Mon = "May";
                                break;

                            case "06":
                                Mon = "June";
                                break;

                            case "07":
                                Mon = "July";
                                break;

                            case "08":
                                Mon = "August";
                                break;

                            case "09":
                                Mon = "September";
                                break;

                            case "10":
                                Mon = "October";
                                break;

                            case "11":
                                Mon = "November";
                                break;

                            case "12":
                                Mon = "December";
                                break;
                            }
                            driver.FindElement(By.XPath("//*[@id='av_date_btn']")).Click();


                            //select month
                            for (int i = 1; i < 12; i++)
                            {
                                string   calmy     = driver.FindElement(By.XPath("/html/body/div[2]/table/thead/tr[1]/td[2]")).Text;
                                string[] my        = calmy.Split(',');
                                string   cal_month = my[0];
                                string   cal_year  = my[1];

                                if (cal_month.Contains(Mon))
                                {
                                    break;
                                }
                                else
                                {
                                    driver.FindElement(By.XPath("/html/body/div[2]/table/thead/tr[2]/td[4]")).Click();
                                }
                            }

                            //select year
                            for (int j = 1; j <= 5; j++)
                            {
                                string   calmy     = driver.FindElement(By.XPath("/html/body/div[2]/table/thead/tr[1]/td[2]")).Text;
                                string[] my        = calmy.Split(',');
                                string   cal_month = my[0];
                                string   cal_year  = my[1];

                                if (cal_year.Contains(year))
                                {
                                    break;
                                }
                                else
                                {
                                    driver.FindElement(By.XPath("/html/body/div[2]/table/thead/tr[2]/td[5]")).Click();
                                }
                            }

                            //select date
                            IWebElement         tbdate = driver.FindElement(By.XPath("/html/body/div[2]/table/tbody"));
                            IList <IWebElement> trdate = tbdate.FindElements(By.TagName("tr"));
                            IList <IWebElement> tddate;
                            foreach (IWebElement row in trdate)
                            {
                                tddate = row.FindElements(By.TagName("td"));
                                for (int a = 1; a <= 5; a++)
                                {
                                    if (row.Text.Contains(Date))
                                    {
                                        for (int b = 1; b <= 8; b++)
                                        {
                                            if (tddate[b].Text.Contains(Date))
                                            {
                                                driver.FindElement(By.XPath("/html/body/div[2]/table/tbody/tr[" + a + "]/td[" + b + "]")).Click();
                                                break;
                                            }
                                        }
                                    }
                                }
                            }

                            driver.FindElement(By.XPath("//*[@id='button']")).SendKeys(Keys.Enter);
                            Thread.Sleep(3000);
                            gc.CreatePdf_Chrome(orderNumber, Parcel_ID, "Deliquent Tax", driver, "UT", "Utah");
                            Taxing_Authority = driver.FindElement(By.XPath("//p[contains(text(),'The Treasurer')]/following-sibling::p")).Text;
                            if (Taxing_Authority.Contains("\r\n"))
                            {
                                Taxing_Authority = Taxing_Authority.Replace("\r\n", " ");
                            }
                            IWebElement         deliTB = driver.FindElement(By.XPath("//p[contains(text(),'Serial Number:')]/following-sibling::table/tbody"));
                            IList <IWebElement> trdeli = deliTB.FindElements(By.TagName("tr"));
                            IList <IWebElement> tddeli;
                            foreach (IWebElement row in trdeli)
                            {
                                tddeli = row.FindElements(By.TagName("td"));
                                if (tddeli.Count != 0 && !row.Text.Contains("Year") && !row.Text.Contains("amount if paid as") && !row.Text.Contains("--") && (row.Text != "         "))
                                {
                                    string deliq = tddeli[0].Text + "~" + tddeli[1].Text + "~" + tddeli[2].Text + "~" + tddeli[3].Text + "~" + tddeli[4].Text + "~" + tddeli[5].Text + "~" + date + "~" + Taxing_Authority;
                                    if (deliq.Contains("\r\n"))
                                    {
                                        deliq = deliq.Replace("\r\n", "");
                                    }
                                    gc.insert_date(orderNumber, Parcel_ID, 143, deliq, 1, DateTime.Now);
                                }
                            }
                            TaxTime = DateTime.Now.ToString("HH:mm:ss");
                            driver.Navigate().GoToUrl(pathurl);
                            Thread.Sleep(3000);
                            driver.FindElement(By.XPath("//*[@id='TabbedPanels1']/ul/li[3]")).SendKeys(Keys.Enter);
                            Thread.Sleep(3000);

                            driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/div/div/div[3]/table/tbody/tr[3]/td[6]/div/a")).SendKeys(Keys.Enter);
                            gc.CreatePdf_Chrome(orderNumber, Parcel_ID, "Tax Payment Details information", driver, "UT", "Utah");
                            try
                            {
                                IWebElement         tbtax = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody"));
                                IList <IWebElement> trtax = tbtax.FindElements(By.TagName("tr"));
                                IList <IWebElement> tdtax;
                                foreach (IWebElement row in trtax)
                                {
                                    tdtax = row.FindElements(By.TagName("td"));
                                    if (tdtax.Count != 0 && !row.Text.Contains("Tax Year"))
                                    {
                                        string tax = tdtax[0].Text + "~" + tdtax[2].Text + "~" + tdtax[4].Text + "~" + tdtax[6].Text + "~" + tdtax[8].Text + "~" + tdtax[10].Text + "~" + tdtax[12].Text + "~" + tdtax[14].Text + "~" + tdtax[16].Text;
                                        gc.insert_date(orderNumber, Parcel_ID, 129, tax, 1, DateTime.Now);
                                    }
                                }
                            }
                            catch { }
                        }
                    }

                    catch { }


                    if (deleiquent == "")
                    {
                        //
                        driver.FindElement(By.XPath("//*[@id='TabbedPanels1']/div/div[3]/table/tbody/tr[2]/td[1]/a")).SendKeys(Keys.Enter);
                        gc.CreatePdf_Chrome(orderNumber, Parcel_ID, "Tax Payment Details information", driver, "UT", "Utah");

                        try
                        {
                            IWebElement         tbtax = driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody"));
                            IList <IWebElement> trtax = tbtax.FindElements(By.TagName("tr"));
                            IList <IWebElement> tdtax;
                            foreach (IWebElement row in trtax)
                            {
                                tdtax = row.FindElements(By.TagName("td"));
                                if (tdtax.Count > 1 && tdtax[0].Text.Trim() != "")
                                {
                                    string tax = tdtax[0].Text + "~" + tdtax[1].Text;
                                    gc.insert_date(orderNumber, Parcel_ID, 129, tax, 1, DateTime.Now);
                                }
                            }
                        }
                        catch
                        { }
                    }
                    driver.Navigate().GoToUrl(pathurl);
                    Thread.Sleep(3000);

                    //driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr/td/div/ul/li[3]")).SendKeys(Keys.Enter);
                    //driver.FindElement(By.XPath("//*[@id='TabbedPanels1']/div/div[3]/table/tbody/tr[3]/td[1]/a")).SendKeys(Keys.Enter);
                    //IWebElement URL= driver.FindElement(By.XPath("/html/body/table/tbody/tr/td/table/tbody/tr[17]/td/a"));
                    //string Url = URL.GetAttribute("href");
                    //// URL.SendKeys(Keys.Enter);
                    //// driver.SwitchTo().Window(driver.WindowHandles.Last());
                    // driver.Navigate().GoToUrl(Url);
                    //string billpdf = outputPath + Parcel_ID.Replace(":", "") + "tax_bill.pdf";
                    //System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                    //WebClient downloadpdf = new WebClient();
                    //downloadpdf.DownloadFile(Url, billpdf);

                    // CreatePdf_WOP(orderNumber, "Tax Bill");
                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "UT", "Utah", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);
                    driver.Quit();
                    gc.mergpdf(orderNumber, "UT", "Utah");
                    return("Data Inserted Successfully");
                }

                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw ex;
                }
            }
        }
Esempio n. 3
0
        public void FTP_LA(string address, string parcelNumber, string searchType, string orderNumber, string directParcel, string treasurerCaptcha)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

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

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

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

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

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

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

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

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

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

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

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

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



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

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

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

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

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

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

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

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


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

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

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

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

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


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

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

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

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

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


                        //installment1....

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

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



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

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

                GlobalClass.sDriver.Quit();

                //}
                ////catch (Exception ex)
                ////{
                //    GlobalClass.sDriver.Quit();
                //    throw ex;
                //}
            }
        }
Esempio n. 4
0
        public string FTP_TXGuadalupe(string streetno, string direction, string streetname, string city, string streettype, string unitnumber, string ownernm, string parcelNumber, string searchType, string orderNumber, string Account_id)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

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

            var driverService = PhantomJSDriverService.CreateDefaultService();

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

                    if (searchType == "titleflex")
                    {
                        string titleaddress = streetno + " " + streetname + " " + unitnumber;
                        gc.TitleFlexSearch(orderNumber, parcelNumber, "", titleaddress, "TX", "Guadalupe");
                        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_TXGuadalupe"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "address")
                    {
                        driver.Navigate().GoToUrl("http://property.co.guadalupe.tx.us/");
                        Thread.Sleep(3000);

                        string Adderss = streetno + " " + streetname;
                        driver.FindElement(By.Id("SearchText")).SendKeys(Adderss);
                        Thread.Sleep(2000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Address Search", driver, "TX", "Guadalupe");
                        driver.FindElement(By.Id("dnn_PropertySearch_SearchButtonDiv")).Click();
                        Thread.Sleep(2000);
                    }

                    if (searchType == "parcel")
                    {
                        driver.Navigate().GoToUrl("http://property.co.guadalupe.tx.us/");
                        Thread.Sleep(2000);

                        driver.FindElement(By.Id("SearchText")).SendKeys(parcelNumber);
                        Thread.Sleep(2000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel Search", driver, "TX", "Guadalupe");
                        driver.FindElement(By.Id("dnn_PropertySearch_SearchButtonDiv")).Click();
                        Thread.Sleep(2000);
                    }

                    if (searchType == "ownername")
                    {
                        driver.Navigate().GoToUrl("http://property.co.guadalupe.tx.us/");
                        Thread.Sleep(2000);

                        driver.FindElement(By.Id("SearchText")).SendKeys(ownernm);
                        Thread.Sleep(2000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Owner Search", driver, "TX", "Guadalupe");
                        driver.FindElement(By.Id("dnn_PropertySearch_SearchButtonDiv")).Click();
                        Thread.Sleep(2000);
                    }

                    else if (searchType == "block")
                    {
                        driver.Navigate().GoToUrl("http://property.co.guadalupe.tx.us/");
                        Thread.Sleep(2000);

                        driver.FindElement(By.Id("SearchText")).SendKeys(Account_id);
                        Thread.Sleep(2000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Account Search", driver, "TX", "Guadalupe");
                        driver.FindElement(By.Id("dnn_PropertySearch_SearchButtonDiv")).Click();
                        Thread.Sleep(2000);
                    }

                    try
                    {
                        int trCount = driver.FindElements(By.XPath("//*[@id='grid']/div[2]/table/tbody/tr")).Count;
                        if (trCount > 1)
                        {
                            int         maxCheck = 0;
                            IWebElement tbmulti  = driver.FindElement(By.XPath("//*[@id='grid']/div[2]/table/tbody"));
                            gc.CreatePdf_Chrome(orderNumber, parcelNumber, "Multi Address Search", driver, "TX", "Guadalupe");
                            IList <IWebElement> TRmulti5 = tbmulti.FindElements(By.TagName("tr"));
                            IList <IWebElement> TDmulti5;
                            foreach (IWebElement row in TRmulti5)
                            {
                                if (maxCheck <= 25)
                                {
                                    TDmulti5 = row.FindElements(By.TagName("td"));
                                    if (TDmulti5.Count != 0)
                                    {
                                        string multi1 = TDmulti5[1].Text + "~" + TDmulti5[3].Text + "~" + TDmulti5[4].Text;
                                        gc.insert_date(orderNumber, TDmulti5[0].Text, 1025, multi1, 1, DateTime.Now);
                                    }
                                    maxCheck++;
                                }
                            }
                            if (TRmulti5.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_TXGuadalupe_Multicount"] = "Maximum";
                            }
                            else
                            {
                                HttpContext.Current.Session["multiParcel_TXGuadalupe"] = "Yes";
                            }

                            driver.Quit();
                            return("MultiParcel");
                        }
                        else
                        {
                            driver.FindElement(By.XPath("//*[@id='grid']/div[2]/table/tbody/tr/td[1]")).Click();
                            Thread.Sleep(2000);
                        }
                    }
                    catch { }

                    try
                    {
                        //No Data Found
                        string nodata = driver.FindElement(By.XPath("//*[@id='grid']/div[2]/table")).Text;
                        if (nodata.Contains("No properties found"))
                        {
                            HttpContext.Current.Session["Nodata_TXGuadalupe"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }
                    //property details
                    try
                    {
                        driver.FindElement(By.Id("tabDetails")).Click();
                        Thread.Sleep(2000);

                        ParcelID = driver.FindElement(By.Id("dnn_ctr368_View_tdPropertyID")).Text;
                        gc.CreatePdf(orderNumber, ParcelID, "Property details", driver, "TX", "Guadalupe");
                        OwnerName        = driver.FindElement(By.Id("dnn_ctr368_View_tdOwnerName")).Text;
                        PropertyAddress  = driver.FindElement(By.Id("dnn_ctr368_View_tdPropertyAddress")).Text;
                        PropertyStatus   = driver.FindElement(By.Id("dnn_ctr368_View_tdGIPropertyStatus")).Text;
                        PropertyType     = driver.FindElement(By.Id("dnn_ctr368_View_tdGIPropertyType")).Text;
                        LegalDescription = driver.FindElement(By.Id("dnn_ctr368_View_tdGILegalDescription")).Text;
                        Neighborhood     = driver.FindElement(By.Id("dnn_ctr368_View_tdGINeighborhood")).Text;
                        Account          = driver.FindElement(By.Id("dnn_ctr368_View_tdGIAccount")).Text;
                        MapNumber        = driver.FindElement(By.Id("dnn_ctr368_View_tdGIMapNumber")).Text;
                        OwnerID          = driver.FindElement(By.Id("dnn_ctr368_View_tdOIPartyQuickRefID")).Text;
                        Exemptions       = driver.FindElement(By.Id("dnn_ctr368_View_tdOIExemptions")).Text;
                        PercentOwnership = driver.FindElement(By.Id("dnn_ctr368_View_tdOIPercentOwnership")).Text;
                        MailingAddress   = driver.FindElement(By.Id("dnn_ctr368_View_tdOIMailingAddress")).Text;

                        property_details = OwnerName + "~" + PropertyAddress + "~" + PropertyStatus + "~" + PropertyType + "~" + LegalDescription + "~" + Neighborhood + "~" + Account + "~" + MapNumber + "~" + OwnerID + "~" + Exemptions + "~" + PercentOwnership + "~" + MailingAddress;
                        gc.insert_date(orderNumber, ParcelID, 1026, property_details, 1, DateTime.Now);
                    }
                    catch
                    { }

                    //Assessment Details
                    try
                    {
                        Year = driver.FindElement(By.Id("dnn_ctr368_View_tdGITitle")).Text;
                        Year = WebDriverTest.Before(Year, " GENERAL INFORMATION");
                        ImprovementHomesiteValue    = driver.FindElement(By.Id("dnn_ctr368_View_tdVIImprovementHS")).Text;
                        ImprovementNonHomesite      = driver.FindElement(By.Id("dnn_ctr368_View_tdVIImprovementNonHS")).Text;
                        TotalImprovementMarketValue = driver.FindElement(By.Id("dnn_ctr368_View_tdVITotalImprovementMV")).Text;
                        LandHomesiteValue           = driver.FindElement(By.Id("dnn_ctr368_View_tdVILandHS")).Text;
                        LandNonHomesite             = driver.FindElement(By.Id("dnn_ctr368_View_tdVILandNonHS")).Text;
                        LandAgriculturalMarketValue = driver.FindElement(By.Id("dnn_ctr368_View_tdVILandAgMV")).Text;
                        TotalLandMarketValue        = driver.FindElement(By.Id("dnn_ctr368_View_tdVITotalLandMV")).Text;
                        TotalMarketValue            = driver.FindElement(By.Id("dnn_ctr368_View_tdVITotalMV")).Text;
                        AgriculturalUse             = driver.FindElement(By.Id("dnn_ctr368_View_tdVIAgUse")).Text;
                        TotalAppraisedValue         = driver.FindElement(By.Id("dnn_ctr368_View_tdVITotalAppraisedValue")).Text;
                        HomesteadCapLoss            = driver.FindElement(By.Id("dnn_ctr368_View_tdVIHomesteadCapLoss")).Text;
                        TotalAssessedValue          = driver.FindElement(By.Id("dnn_ctr368_View_tdVITotalAssessedValueRP")).Text;

                        assessment_details = Year + "~" + ImprovementHomesiteValue + "~" + ImprovementNonHomesite + "~" + TotalImprovementMarketValue + "~" + LandHomesiteValue + "~" + LandNonHomesite + "~" + LandAgriculturalMarketValue + "~" + TotalLandMarketValue + "~" + TotalMarketValue + "~" + AgriculturalUse + "~" + TotalAppraisedValue + "~" + HomesteadCapLoss + "~" + TotalAssessedValue;
                        gc.insert_date(orderNumber, ParcelID, 1027, assessment_details, 1, DateTime.Now);
                    }
                    catch
                    { }

                    //Entity Details
                    try
                    {
                        IWebElement         EntityTable = driver.FindElement(By.XPath("//*[@id='dnn_ctr368_View_divEntitiesAndExemptionsData']/table/tbody"));
                        IList <IWebElement> EntityTR    = EntityTable.FindElements(By.TagName("tr"));
                        IList <IWebElement> EntityTD;
                        foreach (IWebElement Entity in EntityTR)
                        {
                            if (!Entity.Text.Contains("TAXING ENTITY"))
                            {
                                EntityTD = Entity.FindElements(By.TagName("td"));
                                if (EntityTD.Count != 0)
                                {
                                    EntityDetails = EntityTD[0].Text.Trim() + "~" + EntityTD[1].Text.Trim() + "~" + EntityTD[2].Text.Trim() + "~" + EntityTD[3].Text.Trim() + "~" + EntityTD[4].Text.Trim() + "~" + EntityTD[5].Text.Trim();
                                    gc.insert_date(orderNumber, ParcelID, 1028, EntityDetails, 1, DateTime.Now);
                                }
                            }
                        }
                    }
                    catch { }

                    //Assessment History Details
                    try
                    {
                        IWebElement         AssementHistoryTable = driver.FindElement(By.XPath("//*[@id='dnn_ctr368_View_tblValueHistoryDataRP']/tbody"));
                        IList <IWebElement> AssementHistoryTR    = AssementHistoryTable.FindElements(By.TagName("tr"));
                        IList <IWebElement> AssementHistoryTD;
                        foreach (IWebElement AssementHistory in AssementHistoryTR)
                        {
                            if (!AssementHistory.Text.Contains("YEAR"))
                            {
                                AssementHistoryTD = AssementHistory.FindElements(By.TagName("td"));
                                if (AssementHistoryTD.Count != 0)
                                {
                                    AssessmentHistory = AssementHistoryTD[0].Text.Trim() + "~" + AssementHistoryTD[1].Text.Trim() + "~" + AssementHistoryTD[2].Text.Trim() + "~" + AssementHistoryTD[3].Text.Trim() + "~" + AssementHistoryTD[4].Text.Trim() + "~" + AssementHistoryTD[5].Text.Trim() + "~" + AssementHistoryTD[6].Text.Trim() + "~" + AssementHistoryTD[7].Text.Trim() + "~" + AssementHistoryTD[8].Text.Trim();
                                    gc.insert_date(orderNumber, ParcelID, 1029, AssessmentHistory, 1, DateTime.Now);
                                }
                            }
                        }
                    }
                    catch { }

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

                    //Tax Distribution Details
                    driver.FindElement(By.Id("tabBills")).Click();
                    Thread.Sleep(2000);
                    try
                    {
                        int Ulcount = driver.FindElements(By.XPath("//*[@id='dnn_ctr368_View_divBillDetails']/div")).Count;

                        for (int i = 1; i <= Ulcount; i++)
                        {
                            driver.FindElement(By.XPath("//*[@id='dnn_ctr368_View_divBillDetails']/div[" + i + "]/table[1]/tbody/tr/td[3]")).Click();
                            Thread.Sleep(2000);
                            year = driver.FindElement(By.XPath("//*[@id='dnn_ctr368_View_divBillDetails']/div[" + i + "]/table[1]/tbody/tr/td[1]")).Text;

                            IWebElement         TaxDistributionTable = driver.FindElement(By.XPath("//*[@id='dnn_ctr368_View_divBillDetails']/div[" + i + "]/table[2]/tbody"));
                            IList <IWebElement> TaxDistributionTR    = TaxDistributionTable.FindElements(By.TagName("tr"));
                            IList <IWebElement> TaxDistributionTD;
                            foreach (IWebElement TaxDistribution in TaxDistributionTR)
                            {
                                if (!TaxDistribution.Text.Contains("TAXING ENTITY"))
                                {
                                    TaxDistributionTD = TaxDistribution.FindElements(By.TagName("td"));
                                    if (TaxDistributionTD.Count == 5 && TaxDistributionTD[0].Text.Trim() != "")
                                    {
                                        TaxingEntity = TaxDistributionTD[0].Text.Trim();
                                        TotalTaxes   = TaxDistributionTD[1].Text.Trim();
                                        PaidDate     = TaxDistributionTD[2].Text.Trim();
                                        PaidAmount   = TaxDistributionTD[3].Text.Trim();
                                        Balance      = TaxDistributionTD[4].Text.Trim();
                                    }
                                    if (TaxDistribution.Text.Contains("Levy") && TaxDistributionTD.Count == 13)
                                    {
                                        taxdet = TaxDistributionTD[1].Text.Replace("\r\n", "~");
                                        string[] words = taxdet.Split('~');
                                        levy = words[0].Replace("Levy", "");

                                        PI = words[1].Replace("P&I", "");
                                        if (i == 1)
                                        {
                                            levynew = PI;
                                        }
                                        Att_fee   = words[2].Replace("Att. Fee", "");
                                        credits   = words[3].Replace("Credits/Disc.", "");
                                        taxdistri = year + "~" + TaxingEntity + "~" + levy + "~" + PI + "~" + Att_fee + "~" + credits + "~" + TotalTaxes + "~" + PaidDate + "~" + PaidAmount + "~" + Balance;
                                        gc.insert_date(orderNumber, ParcelID, 1030, taxdistri, 1, DateTime.Now);
                                    }
                                    if (TaxDistribution.Text.Contains("TOTALS"))
                                    {
                                        taxdistri1 = year + "~" + TaxingEntity + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + TotalTaxes + "~" + "" + "~" + PaidAmount + "~" + Balance;
                                        gc.insert_date(orderNumber, ParcelID, 1030, taxdistri1, 1, DateTime.Now);
                                    }
                                }
                            }
                        }
                    }
                    catch { }

                    try
                    {
                        if (!levynew.Contains("$0.00"))
                        {
                            IWebElement dt = driver.FindElement(By.Id("effectiveDatePicker"));
                            date = dt.GetAttribute("value");

                            DateTime G_Date = Convert.ToDateTime(date);
                            dateChecking = DateTime.Now.ToString("MM") + "/15/" + DateTime.Now.ToString("yyyy");

                            if (G_Date < Convert.ToDateTime(dateChecking))
                            {
                                //end of the month
                                date = new DateTime(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM"))), DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(DateTime.Now.ToString("MM")))).ToString("MM/dd/yyyy");
                            }
                            else if (G_Date > Convert.ToDateTime(dateChecking))
                            {
                                // nextEndOfMonth
                                if ((Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM"))) < 12))
                                {
                                    date = new DateTime(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM")) + 1), DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(DateTime.Now.ToString("MM")) + 1)).ToString("MM/dd/yyyy");
                                }
                                else
                                {
                                    int nxtYr = Convert.ToInt16(DateTime.Now.ToString("yyyy")) + 1;
                                    date = new DateTime(nxtYr, 1, DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), 1)).ToString("MM/dd/yyyy");
                                }
                            }
                            Thread.Sleep(2000);
                            dt.Clear();
                            driver.FindElement(By.Id("effectiveDatePicker")).SendKeys(date);
                        }
                        gc.CreatePdf(orderNumber, ParcelID, "Tax Distribution", driver, "TX", "Guadalupe");

                        IWebElement dt1 = driver.FindElement(By.Id("effectiveDatePicker"));
                        goodthrough = dt1.GetAttribute("value");

                        CurrentAmountDue = driver.FindElement(By.Id("dnn_ctr368_View_tdPMCurrentAmountDue")).Text;
                        PastYearsDue     = driver.FindElement(By.Id("dnn_ctr368_View_tdPMPastYearsDue")).Text;
                        TotalDue         = driver.FindElement(By.Id("dnn_ctr368_View_tdPMTotalDue")).Text;
                        taxinfo          = goodthrough + "~" + CurrentAmountDue + "~" + PastYearsDue + "~" + TotalDue + "~" + TaxingAuthority;
                        gc.insert_date(orderNumber, ParcelID, 1031, taxinfo, 1, DateTime.Now);
                    }
                    catch
                    { }

                    //Payment History Details
                    try
                    {
                        driver.FindElement(By.Id("dnn_ctr368_View_divPaymentHistoryExpandCollapse")).Click();
                        Thread.Sleep(2000);
                        gc.CreatePdf(orderNumber, ParcelID, "Payment History", driver, "TX", "Guadalupe");

                        int licount = driver.FindElements(By.XPath(" //*[@id='dnn_ctr368_View_divPaymentHistoryInfo']/ul/li")).Count;
                        for (int j = 1; j <= licount; j++)
                        {
                            year1 = driver.FindElement(By.XPath("//*[@id='dnn_ctr368_View_divPaymentHistoryInfo']/ul/li[" + j + "]/table/tbody/tr/td[2]")).Text;
                            IWebElement         PaymentHistoryTable = driver.FindElement(By.XPath("//*[@id='dnn_ctr368_View_divPaymentHistoryInfo']/ul/li[" + j + "]/div/table/tbody"));
                            IList <IWebElement> PaymentHistoryTR    = PaymentHistoryTable.FindElements(By.TagName("tr"));
                            IList <IWebElement> PaymentHistoryTD;
                            foreach (IWebElement row in PaymentHistoryTR)
                            {
                                if (!row.Text.Contains("Transaction Date"))
                                {
                                    PaymentHistoryTD = row.FindElements(By.TagName("td"));
                                    if (PaymentHistoryTD.Count == 4)
                                    {
                                        taxHistory = year1 + "~" + PaymentHistoryTD[0].Text.Trim() + "~" + PaymentHistoryTD[1].Text.Trim() + "~" + PaymentHistoryTD[2].Text.Trim() + "~" + PaymentHistoryTD[3].Text.Trim().Replace("View", "");
                                        gc.insert_date(orderNumber, ParcelID, 1032, taxHistory, 1, DateTime.Now);
                                    }
                                }
                            }
                        }
                    }
                    catch
                    { }

                    try
                    {
                        var chromeOptions     = new ChromeOptions();
                        var downloadDirectory = ConfigurationManager.AppSettings["AutoPdf"];
                        chromeOptions.AddUserProfilePreference("download.default_directory", downloadDirectory);
                        chromeOptions.AddUserProfilePreference("download.prompt_for_download", false);
                        chromeOptions.AddUserProfilePreference("disable-popup-blocking", "true");
                        chromeOptions.AddUserProfilePreference("plugins.always_open_pdf_externally", true);
                        var chDriver = new ChromeDriver(chromeOptions);
                        chDriver.Navigate().GoToUrl(driver.Url);
                        Thread.Sleep(4000);

                        int Billcount = driver.FindElements(By.XPath("//*[@id='dnn_ctr368_View_divBillDetails']/div")).Count;
                        for (int j1 = 1; j1 <= Billcount; j1++)
                        {
                            year1 = chDriver.FindElement(By.XPath("//*[@id='dnn_ctr368_View_divBillDetails']/div[" + j1 + "]/table[1]/tbody/tr/td[1]")).Text;
                            Thread.Sleep(2000);
                            try
                            {
                                IWebElement btnclick = chDriver.FindElement(By.XPath("//*[@id='btnPrintTaxStatement" + year1 + "']"));
                                btnclick.Click();
                                Thread.Sleep(4000);

                                fileName = "download";
                                gc.AutoDownloadFileSpokane(orderNumber, ParcelID, "Guadalupe", "TX", fileName + ".pdf");
                                Thread.Sleep(6000);
                            }
                            catch
                            { }
                        }
                        chDriver.Quit();
                    }
                    catch
                    { }

                    try
                    {
                        IWebElement CurrentBill    = driver.FindElement(By.XPath("//*[@id='tdIconLinks']/table/tbody/tr/td[2]/a"));
                        string      CurrentTaxBill = CurrentBill.GetAttribute("href");
                        gc.downloadfile(CurrentTaxBill, orderNumber, ParcelID, "Current Tax Bill", "TX", "Guadalupe");
                    }
                    catch
                    { }

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

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

                    driver.Quit();
                    gc.mergpdf(orderNumber, "TX", "Guadalupe");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw;
                }
            }
        }
Esempio n. 5
0
        public string FTP_Stark(string houseno, string housedir, string sname, string unitno, string parcelNumber, string searchType, string orderNumber, string ownername, string directParcel)

        {
            GlobalClass gc = new GlobalClass();

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

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

            var driverService = PhantomJSDriverService.CreateDefaultService();

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

                    driver.Navigate().GoToUrl("http://ddti.starkcountyohio.gov/disclaimer.aspx");
                    Thread.Sleep(4000);
                    driver.FindElement(By.Name("ctl00$ContentPlaceHolder1$btnDisclaimerAccept")).Click();
                    driver.FindElement(By.Name("ctl00$ContentPlaceHolder1$btnDisclaimerAccept")).Click();
                    Thread.Sleep(5000);
                    if (searchType == "titleflex")
                    {
                        string titleaddress = houseno + " " + sname + " " + housedir + " " + unitno;
                        gc.TitleFlexSearch(orderNumber, "", "", titleaddress, "OH", "Stark");
                        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_OHStark"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "address")
                    {
                        //    Owner~Property_Address~Land_Use

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


                        driver.FindElement(By.Id("ContentPlaceHolder1_Address_tbAddressNumber")).SendKeys(houseno);
                        driver.FindElement(By.Id("ContentPlaceHolder1_Address_tbAddressDirection")).SendKeys(housedir);
                        driver.FindElement(By.Id("ContentPlaceHolder1_Address_tbAddressStreet")).SendKeys(sname);

                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "OH", "Stark");
                        driver.FindElement(By.Id("ContentPlaceHolder1_Address_btnSearchAddress")).SendKeys(Keys.Enter);
                        Thread.Sleep(4000);

                        gc.CreatePdf_WOP(orderNumber, "Address search result", driver, "OH", "Stark");
                        try
                        {
                            mul = driver.FindElement(By.Id("ContentPlaceHolder1_lblNumberOfResults")).Text.Trim();
                            mul = WebDriverTest.Before(mul, " Results");
                            if (mul != "1")
                            {
                                //multi parcel
                                IWebElement         tbmulti = driver.FindElement(By.XPath("//*[@id='ContentPlaceHolder1_gvSearchResults']/tbody"));
                                IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                                IList <IWebElement> TDmulti;
                                foreach (IWebElement row in TRmulti)
                                {
                                    if (!row.Text.Contains("Parcel"))
                                    {
                                        TDmulti = row.FindElements(By.TagName("td"));
                                        if (TDmulti.Count != 0)
                                        {
                                            string multi1 = TDmulti[1].Text + "~" + TDmulti[2].Text + "~" + TDmulti[3].Text;
                                            gc.insert_date(orderNumber, TDmulti[0].Text, 302, multi1, 1, DateTime.Now);
                                        }
                                    }
                                }
                                HttpContext.Current.Session["multiparcel_Stark"] = "Yes";

                                driver.Quit();
                                return("MultiParcel");
                            }
                            else
                            {
                                driver.FindElement(By.XPath("//*[@id='ContentPlaceHolder1_gvSearchResults']/tbody/tr[2]/td[1]/a")).Click();
                                gc.CreatePdf_WOP(orderNumber, "Address search result1", driver, "OH", "Stark");
                                Thread.Sleep(4000);
                            }
                        }
                        catch { }
                    }
                    if (searchType == "parcel")
                    {
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        }
                        driver.FindElement(By.XPath("//*[@id='ContentPlaceHolder1_mnuSearchn0']/table/tbody/tr/td/a")).Click();
                        Thread.Sleep(3000);

                        if (parcelNumber.Contains("-"))
                        {
                            parcelNumber = parcelNumber.Replace("-", "");
                        }
                        driver.FindElement(By.Id("ContentPlaceHolder1_Parcel_tbParcelNumber")).SendKeys(parcelNumber);
                        gc.CreatePdf_WOP(orderNumber, "Parcel search", driver, "OH", "Stark");
                        driver.FindElement(By.Id("ContentPlaceHolder1_Parcel_btnSearchParcel")).Click();
                        Thread.Sleep(3000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search result", driver, "OH", "Stark");

                        try
                        {
                            mul = driver.FindElement(By.XPath("//*[@id='ContentPlaceHolder1_lblNumberOfResults']")).Text.Trim();

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

                                IList <IWebElement> TDmulti;
                                foreach (IWebElement row in TRmulti)
                                {
                                    if (!row.Text.Contains("Parcel"))
                                    {
                                        TDmulti = row.FindElements(By.TagName("td"));
                                        if (TDmulti.Count != 0)
                                        {
                                            string multi1 = TDmulti[1].Text + "~" + TDmulti[2].Text + "~" + TDmulti[3].Text;
                                            gc.insert_date(orderNumber, TDmulti[0].Text, 302, multi1, 1, DateTime.Now);
                                        }
                                    }
                                }
                                HttpContext.Current.Session["multiparcel_Stark"] = "Yes";
                                driver.Quit();
                                return("MultiParcel");
                            }
                            else
                            {
                                driver.FindElement(By.XPath("//*[@id='ContentPlaceHolder1_gvSearchResults']/tbody/tr[2]/td[1]/a")).Click();
                                gc.CreatePdf(orderNumber, parcelNumber, "Parcel search result", driver, "OH", "Stark");
                                Thread.Sleep(3000);
                            }
                        }
                        catch { }
                    }
                    else if (searchType == "ownername")
                    {
                        string   s = ownername;
                        string[] words = s.Split(' ');
                        string   lastname = "", firstname = "";
                        try
                        {
                            lastname  = words[0];
                            firstname = words[1];
                        }
                        catch { }


                        driver.FindElement(By.Id("ContentPlaceHolder1_Owner_tbOwnerLastName")).SendKeys(lastname);
                        driver.FindElement(By.Id("ContentPlaceHolder1_Owner_tbOwnerFirstName")).SendKeys(firstname);
                        gc.CreatePdf_WOP(orderNumber, "Owner search", driver, "OH", "Stark");
                        driver.FindElement(By.XPath("//*[@id='ContentPlaceHolder1_Owner_btnSearchOwner']")).Click();
                        Thread.Sleep(3000);
                        gc.CreatePdf_WOP(orderNumber, "Owner search result", driver, "OH", "Stark");

                        try
                        {
                            mul = driver.FindElement(By.Id("ContentPlaceHolder1_lblNumberOfResults")).Text.Trim();
                            mul = WebDriverTest.Before(mul, " Results");
                            if (mul != "1")
                            {
                                //multi parcel
                                IWebElement         tbmulti = driver.FindElement(By.XPath("//*[@id='ContentPlaceHolder1_gvSearchResults']/tbody"));
                                IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));

                                IList <IWebElement> TDmulti;
                                foreach (IWebElement row in TRmulti)
                                {
                                    if (!row.Text.Contains("Parcel"))
                                    {
                                        TDmulti = row.FindElements(By.TagName("td"));
                                        if (TDmulti.Count != 0)
                                        {
                                            string multi1 = TDmulti[1].Text + "~" + TDmulti[2].Text + "~" + TDmulti[3].Text;
                                            gc.insert_date(orderNumber, TDmulti[0].Text, 302, multi1, 1, DateTime.Now);
                                        }
                                    }
                                }
                                HttpContext.Current.Session["multiparcel_Stark"] = "Yes";
                                driver.Quit();
                                return("MultiParcel");
                            }
                            else
                            {
                                driver.FindElement(By.XPath("//*[@id='ContentPlaceHolder1_gvSearchResults']/tbody/tr[2]/td[1]/a")).Click();
                                gc.CreatePdf_WOP(orderNumber, "Owner search result1", driver, "OH", "Stark");
                                Thread.Sleep(3000);
                            }
                        }
                        catch { }
                    }

                    try
                    {
                        IWebElement INodata = driver.FindElement(By.Id("ContentPlaceHolder1_lblNumberOfResults"));
                        if (INodata.Text.Contains("No results"))
                        {
                            HttpContext.Current.Session["Nodata_OHStark"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }

                    //property details

                    string Parcel_ID = "", Owner_Name = "", Property_Address = "", Property_Type = "", Year_Built = "", Legal_Description = "";
                    Parcel_ID         = driver.FindElement(By.Id("ContentPlaceHolder1_Base_fvDataProfile_ParcelLabel")).Text.Trim();
                    Owner_Name        = driver.FindElement(By.Id("ContentPlaceHolder1_Base_fvDataProfile_OwnerLabel")).Text.Trim();
                    Property_Address  = driver.FindElement(By.Id("ContentPlaceHolder1_Base_fvDataProfile_AddressLabel")).Text.Trim();
                    Property_Type     = driver.FindElement(By.Id("ContentPlaceHolder1_Base_fvDataLegal_PropertyClassLabel")).Text.Trim();
                    Legal_Description = driver.FindElement(By.Id("ContentPlaceHolder1_Base_fvDataLegal_LegalDescriptionLabel")).Text.Trim();

                    driver.FindElement(By.XPath("//*[@id='ContentPlaceHolder1_mnuDatan5']/table/tbody/tr/td/a")).Click();
                    Thread.Sleep(4000);
                    gc.CreatePdf(orderNumber, Parcel_ID, "Building", driver, "OH", "Stark");
                    try
                    {
                        Year_Built = driver.FindElement(By.XPath("//*[@id='ContentPlaceHolder1_Residential_gvDataBuildings']/tbody/tr[2]/td[5]")).Text.Trim();
                    }
                    catch { }
                    string property_details = Owner_Name + "~" + Property_Address + "~" + Property_Type + "~" + Year_Built + "~" + Legal_Description;
                    gc.insert_date(orderNumber, Parcel_ID, 303, property_details, 1, DateTime.Now);

                    //         Owner_Name~Property_Address~Property_Type~Year_Built~Legal_Description
                    //assessment details
                    driver.FindElement(By.XPath(" //*[@id='ContentPlaceHolder1_mnuDatan2']/table/tbody/tr/td/a")).Click();
                    gc.CreatePdf(orderNumber, Parcel_ID, "Assessment", driver, "OH", "Stark");
                    Thread.Sleep(4000);
                    IWebElement         multitableElement11 = driver.FindElement(By.XPath("//*[@id='ContentPlaceHolder1_Valuation_gvDataValuation']/tbody"));
                    IList <IWebElement> multitableRow11     = multitableElement11.FindElements(By.TagName("tr"));
                    int iRowsCount = driver.FindElements(By.XPath("//*[@id='ContentPlaceHolder1_Valuation_gvDataValuation']/tbody/tr")).Count;
                    IList <IWebElement> multirowTD11;
                    int i = 0;

                    foreach (IWebElement row in multitableRow11)
                    {
                        if (!row.Text.Contains("Year"))
                        {
                            multirowTD11 = row.FindElements(By.TagName("td"));
                            if (multirowTD11.Count != 1 && multirowTD11[0].Text.Trim() != "")
                            {
                                //Year~Appraised_Land_Value~Assessed_Land_Value~Appraised_Building_Value~Assessed_Building_Value~Appraised_Total_Value~Assessed_Total_Value~Override
                                string assessment_details = multirowTD11[0].Text.Trim() + "~" + multirowTD11[1].Text.Trim() + "~" + multirowTD11[2].Text.Trim() + "~" + multirowTD11[3].Text.Trim() + "~" + multirowTD11[4].Text.Trim() + "~" + multirowTD11[5].Text.Trim() + "~" + multirowTD11[6].Text.Trim() + "~" + multirowTD11[7].Text.Trim();
                                gc.insert_date(orderNumber, Parcel_ID, 304, assessment_details, 1, DateTime.Now);
                                i++;
                            }
                            if (i == 3)
                            {
                                break;
                            }
                        }
                    }
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");


                    //tax details

                    driver.FindElement(By.XPath("//*[@id='ContentPlaceHolder1_mnuDatan4']/table/tbody/tr/td/a")).Click();
                    gc.CreatePdf(orderNumber, Parcel_ID, "Tax details", driver, "OH", "Stark");

                    Thread.Sleep(3000);

                    string taxdet = driver.FindElement(By.XPath("//*[@id='ContentPlaceHolder1_Tax_fvDataTax']/tbody/tr/td/table/tbody")).Text.Trim();

                    string Bill_Number = gc.Between(taxdet, "Bill Number: ", "Installment Number:").Trim();
                    string Owner_Occupancy_Discount = driver.FindElement(By.XPath(" //*[@id='ContentPlaceHolder1_Tax_fvDataTax_ResidentialDiscountLabel']")).Text.Trim();

                    string CAUV_Recoupment     = gc.Between(taxdet, "CAUV Recoupment:", "Recoupment Amount:").Trim();
                    string Homestead_Deduction = gc.Between(taxdet, "Homestead Deduction:", "Tax Abatement:").Trim();

                    string Homestead_Reduction    = gc.Between(taxdet, "Homestead Reduction:", "CAUV Recoupment:").Trim();
                    string Recoupment_Amount      = gc.Between(taxdet, "Recoupment Amount:", "Homestead Deduction:").Trim();
                    string Tax_Abatement          = driver.FindElement(By.XPath("//*[@id='ContentPlaceHolder1_Tax_fvDataTax_TaxAbatementLabel']")).Text.Trim();
                    string Property_Destruction   = gc.Between(taxdet, "Property Destruction:", "Homestead Deduction Year:").Trim();
                    string Agricultural_Use_Value = gc.Between(taxdet, "Agricultural Use Value:", "Tax Year:").Trim();
                    string tax_year = driver.FindElement(By.XPath("//*[@id='ContentPlaceHolder1_Tax_fvDataTax_TaxYearLabel']")).Text.Trim();

                    string tax_info_det = Bill_Number + "~" + Owner_Occupancy_Discount + "~" + CAUV_Recoupment + "~" + Homestead_Deduction + "~" + Homestead_Reduction + "~" + Recoupment_Amount + "~" + Tax_Abatement + "~" + Property_Destruction + "~" + Agricultural_Use_Value + "~" + tax_year;
                    gc.insert_date(orderNumber, Parcel_ID, 390, tax_info_det, 1, DateTime.Now);

                    //      Bill_Number~Owner_Occupancy_Discount~CAUV_Recoupment~Homestead_Deduction~Homestead_Reduction~Recoupment_Amount~Tax_Abatement~Property_Destruction~Agricultural_Use_Value~tax_year


                    IWebElement         multitableElement2 = driver.FindElement(By.XPath(" //*[@id='ContentPlaceHolder1_Tax_gvDataTaxBilling']/tbody"));
                    IList <IWebElement> multitableRow2     = multitableElement2.FindElements(By.TagName("tr"));

                    IList <IWebElement> multirowTD2;
                    foreach (IWebElement row in multitableRow2)
                    {
                        if (!row.Text.Contains("Section"))
                        {
                            multirowTD2 = row.FindElements(By.TagName("td"));
                            if (multirowTD2.Count != 1 && multirowTD2[1].Text.Trim() != "")
                            {
                                string tax_info = multirowTD2[0].Text.Trim() + "~" + multirowTD2[1].Text.Trim() + "~" + multirowTD2[2].Text.Trim() + "~" + multirowTD2[3].Text.Trim() + "~" + multirowTD2[4].Text.Trim() + "~" + multirowTD2[5].Text.Trim();
                                gc.insert_date(orderNumber, Parcel_ID, 305, tax_info, 1, DateTime.Now);
                                //Section~Label~Tax_Amount~Paid_Amount~Due_Amount~Deliquent_Due
                            }
                        }
                    }



                    //tax payment


                    IWebElement         multitableElement3 = driver.FindElement(By.XPath("//*[@id='ContentPlaceHolder1_Tax_gvDataTaxPayments']/tbody"));
                    IList <IWebElement> multitableRow3     = multitableElement3.FindElements(By.TagName("tr"));

                    IList <IWebElement> multirowTD3;
                    foreach (IWebElement row in multitableRow3)
                    {
                        if (!row.Text.Contains("Payment Date"))
                        {
                            multirowTD3 = row.FindElements(By.TagName("td"));
                            if (multirowTD3.Count != 1 && multirowTD3[0].Text.Trim() != "")
                            {
                                string tax_payment = multirowTD3[0].Text.Trim() + "~" + multirowTD3[1].Text.Trim() + "~" + multirowTD3[2].Text.Trim();
                                gc.insert_date(orderNumber, Parcel_ID, 306, tax_payment, 1, DateTime.Now);

                                //Payment_Date~Installment~Paid_Amount
                            }
                        }
                    }

                    //Special Assessments Table:
                    IWebElement         multitableElement4 = driver.FindElement(By.XPath(" //*[@id='ContentPlaceHolder1_Tax_gvSpecials']/tbody"));
                    IList <IWebElement> multitableRow4     = multitableElement4.FindElements(By.TagName("tr"));

                    IList <IWebElement> multirowTD4;
                    foreach (IWebElement row in multitableRow4)
                    {
                        if (!row.Text.Contains("Agency"))
                        {
                            multirowTD4 = row.FindElements(By.TagName("td"));
                            if (multirowTD4.Count != 1)
                            {
                                string special_assessment = multirowTD4[0].Text.Trim() + "~" + multirowTD4[1].Text.Trim() + "~" + multirowTD4[2].Text.Trim() + "~" + multirowTD4[3].Text.Trim() + "~" + multirowTD4[4].Text.Trim() + "~" + multirowTD4[5].Text.Trim();
                                gc.insert_date(orderNumber, Parcel_ID, 307, special_assessment, 1, DateTime.Now);
                                //Agency~Code~Amount~Status~Type~Due
                            }
                        }
                    }

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

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

                    driver.Quit();
                    gc.mergpdf(orderNumber, "OH", "Stark");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    throw ex;
                }
            }
        }
        public string FTP_Forsyth(string streetno, string direction, string streetname, string streetype, string unitno, string ownername, string parcelNumber, string searchType, string orderNumber, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            List <string> multiparcel = new List <string>();
            string        StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";

            var driverService = PhantomJSDriverService.CreateDefaultService();

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

                driver.Navigate().GoToUrl("http://tellus.co.forsyth.nc.us/lrcpwa/SearchProperty.aspx");
                Thread.Sleep(2000);

                try
                {
                    if (searchType == "titleflex")
                    {
                        string address = streetno + " " + direction + " " + streetname + " " + streetype + " " + unitno;
                        gc.TitleFlexSearch(orderNumber, parcelNumber, "", address, "NC", "Forsyth");
                        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_NCForsyth"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "address")
                    {
                        driver.FindElement(By.XPath("//*[@id='panelSummary']/li[2]/a")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);
                        driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_StreetNumberTextBox")).SendKeys(streetno);
                        driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_StreetNameTextBox")).SendKeys(streetname);
                        gc.CreatePdf_WOP(orderNumber, "SearchAddressBefore", driver, "NC", "Forsyth");
                        driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_AddressButton")).SendKeys(Keys.Enter);
                        gc.CreatePdf_WOP(orderNumber, "SearchAddressAfter", driver, "NC", "Forsyth");
                        Thread.Sleep(2000);

                        string mul = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/span")).Text;
                        mul = WebDriverTest.Before(mul, "Records").Trim();

                        int i, j = 2;
                        if ((mul != "1") && (mul != "0"))
                        {
                            int iRowsCount = driver.FindElements(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_streetDictionaryResultsGridView']/tbody/tr")).Count;
                            for (i = 2; i <= iRowsCount; i++)
                            {
                                if (j >= 2 && i != 2)
                                {
                                    IWebElement checkbox1 = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_streetDictionaryResultsGridView_ctl0" + j + "_CheckBox1']"));
                                    // checkbox.Clear();
                                    checkbox1.Click();
                                    Thread.Sleep(1000);
                                    j++;
                                }
                                IWebElement checkbox = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_streetDictionaryResultsGridView_ctl0" + i + "_CheckBox1']"));
                                // checkbox.Clear();
                                checkbox.Click();
                                Thread.Sleep(1000);
                                driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_StreetDictionarySearchButton")).SendKeys(Keys.Enter);
                                Thread.Sleep(1000);
                                string mul1 = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/span")).Text;
                                mul1 = GlobalClass.Before(mul1, " Records Matched Search Criteria").Trim();
                                int count = Convert.ToInt32(mul1);
                                if (count > 0)
                                {   //multi parcel
                                    gc.CreatePdf_WOP(orderNumber, "Multiparcel Result", driver, "NC", "Forsyth");
                                    IWebElement         tbmulti2 = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_ParcelStreetsGridView']/tbody"));
                                    IList <IWebElement> TRmulti2 = tbmulti2.FindElements(By.TagName("tr"));
                                    IList <IWebElement> TDmulti2;
                                    int rescount = TRmulti2.Count;

                                    foreach (IWebElement row in TRmulti2)
                                    {
                                        TDmulti2 = row.FindElements(By.TagName("td"));

                                        if (TDmulti2.Count != 0 && TDmulti2[1].Text.Trim() != "" && !row.Text.Contains("Pfx") && TDmulti2.Count == 9)
                                        {
                                            IWebElement multiparcellink = TDmulti2[0].FindElement(By.TagName("a"));
                                            string      strmulti        = multiparcellink.GetAttribute("href");
                                            multiparcel.Add(strmulti);
                                            string multi1 = TDmulti2[1].Text + " " + TDmulti2[4].Text + "~" + TDmulti2[8].Text;

                                            if (TDmulti2[1].Text == streetno || streetno == "0")
                                            {
                                                gc.insert_date(orderNumber, TDmulti2[0].Text, 616, multi1, 1, DateTime.Now);
                                            }
                                            //  Owner~address
                                        }
                                    }
                                }
                                driver.Navigate().Back();
                                Thread.Sleep(1000);
                            }

                            if (multiparcel.Count > 1)
                            {
                                HttpContext.Current.Session["multiparcel_Forsyth"] = "Yes";
                                driver.Quit();
                                return("MultiParcel");
                            }
                            else
                            {
                                foreach (string real in multiparcel)
                                {
                                    driver.Navigate().GoToUrl(real);
                                    Thread.Sleep(4000);
                                }
                            }
                        }

                        else
                        {
                            try
                            {
                                driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_ParcelStreetsGridView']/tbody/tr[2]/td[1]/a")).SendKeys(Keys.Enter);
                                Thread.Sleep(2000);
                            }
                            catch { }
                        }

                        try
                        {
                            //No Data Found
                            string nodata = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/span")).Text;
                            if (nodata.Contains("0 Records Matched Search Criteria"))
                            {
                                HttpContext.Current.Session["Nodata_NCForsyth"] = "Yes";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                    }

                    if (searchType == "parcel")
                    {
                        driver.FindElement(By.XPath("//*[@id='panelSummary']/li[4]/a")).Click();
                        Thread.Sleep(4000);
                        IWebElement text = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_PINNumberTextBox']"));
                        parcelNumber = parcelNumber.Replace("-", "");
                        text.Clear();
                        IWebElement         add           = driver.FindElement(By.XPath("//*[@id='PIN']/div/div/div/center/table/tbody/tr[2]/td/div/div"));
                        IList <IWebElement> MultiOwnerRow = add.FindElements(By.TagName("input"));
                        foreach (IWebElement row1 in MultiOwnerRow)
                        {
                            row1.SendKeys(parcelNumber);
                        }
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel Search Input Passed", driver, "NC", "Forsyth");
                        // text.SendKeys(parcelNumber);
                        driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_PinButton']")).Click();
                        Thread.Sleep(3000);
                        gc.CreatePdf_WOP(orderNumber, "Parcel Search Result", driver, "NC", "Forsyth");
                        try
                        {
                            //No Data Found
                            string nodata = driver.FindElement(By.Id("ctl00_PageHeader1_ErrorMessageLabel")).Text;
                            if (nodata.Contains("No Records Found"))
                            {
                                HttpContext.Current.Session["Nodata_NCForsyth"] = "Yes";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                    }
                    if (searchType == "ownername")
                    {
                        string firstname = "", lastname = "";
                        if (ownername.Contains(' '))
                        {
                            string[] name = ownername.Split(' ');
                            firstname = name[0]; lastname = name[1];
                            if (!ownername.Contains(','))
                            {
                                ownername = firstname + "," + lastname;
                            }
                        }
                        driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_OwnerTextBox']")).SendKeys(ownername);
                        driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_OwnerButton")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);
                        string mul = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/span")).Text;
                        mul = WebDriverTest.Before(mul, "Records").Trim();

                        if ((mul != "1") && (mul != "0"))
                        {
                            //multi parcel
                            gc.CreatePdf_WOP(orderNumber, "Multiparcel Result", driver, "NC", "Forsyth");
                            IWebElement         tbmulti = driver.FindElement(By.XPath(" //*[@id='ctl00_ContentPlaceHolder1_OwnerSearchResultsGridView']/tbody"));
                            IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                            int TRmulticount            = TRmulti.Count;
                            int maxCheck = 0;
                            IList <IWebElement> TDmulti;
                            foreach (IWebElement row in TRmulti)
                            {
                                if (maxCheck <= 25)
                                {
                                    TDmulti = row.FindElements(By.TagName("td"));
                                    if (TDmulti.Count != 0)
                                    {
                                        if (maxCheck <= 15)
                                        {
                                            string multi1 = TDmulti[3].Text + "~" + TDmulti[2].Text;
                                            gc.insert_date(orderNumber, TDmulti[1].Text, 616, multi1, 1, DateTime.Now);
                                        }
                                    }
                                    maxCheck++;
                                }
                            }

                            if (TRmulti.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_Forsyth_Multicount"] = "Maximum";
                                driver.Quit();
                                return("Maximum");
                            }
                            else
                            {
                                HttpContext.Current.Session["multiparcel_Forsyth"] = "Yes";
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                        try
                        {
                            //No Data Found
                            string nodata = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/span")).Text;
                            if (nodata.Contains("0 Records Matched Search Criteria"))
                            {
                                HttpContext.Current.Session["Nodata_NCForsyth"] = "Yes";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                    }

                    //Property Details

                    string TaxYear = "", REID = "", ParcelID = "", PropertyOwner = "", PropertyAddress = "", LegalDescription = "", MailingAddress = "", OldMapNumber = "", MarketArea = "", Township = "", PlanningJurisdiction = "", City = "", FireDistrict = "", SpecialDistrict = "", PropertyClass = "", YearBuilt = "";
                    //driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_ParcelStreetsGridView']/tbody/tr[2]/td[1]/a")).SendKeys(Keys.Enter);
                    //Thread.Sleep(2000);

                    string propbulktext = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div[1]/div/div/div[2]/div[1]/div[1]/table/tbody/tr[1]/td/table")).Text;

                    TaxYear  = driver.FindElement(By.Id("ctl00_PageHeader1_TaxYear")).Text;
                    REID     = driver.FindElement(By.Id("ctl00_PageHeader1_ReidLabelInfo")).Text;
                    ParcelID = driver.FindElement(By.Id("ctl00_PageHeader1_PinLabelInfo")).Text;

                    PropertyOwner    = driver.FindElement(By.XPath("//*[@id='ctl00_PageHeader1_DetailsView1']/tbody/tr/td")).Text;
                    PropertyAddress  = driver.FindElement(By.Id("ctl00_PageHeader1_LocationAddressLabelInfo")).Text;
                    LegalDescription = driver.FindElement(By.Id("ctl00_PageHeader1_PropertyDescriptionLabelInfo")).Text;
                    MailingAddress   = driver.FindElement(By.Id("ctl00_PageHeader1_DetailsView4")).Text.Replace("\r\n", " ").Trim();
                    gc.CreatePdf(orderNumber, ParcelID, "Property  and Assessment Details", driver, "NC", "Forsyth");

                    string bulktext = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_DetailsView5")).Text;
                    OldMapNumber         = gc.Between(bulktext, "Old Map# ", "Market Area ").Trim();
                    MarketArea           = gc.Between(bulktext, "Market Area ", "Township ").Trim();
                    Township             = gc.Between(bulktext, "Township ", "Planning Jurisdiction").Trim();
                    PlanningJurisdiction = gc.Between(bulktext, "Planning Jurisdiction", "City").Trim();
                    City            = gc.Between(bulktext, "City", "Fire District").Trim();
                    FireDistrict    = gc.Between(bulktext, "Fire District", "Spec District").Trim();
                    SpecialDistrict = gc.Between(bulktext, "Spec District", "Land Class").Trim();
                    PropertyClass   = gc.Between(bulktext, "Land Class", "History REID 1").Replace("\r\n", " ").Trim();


                    driver.FindElement(By.Id("ctl00_PageHeader1_BuildingsHyperLink")).SendKeys(Keys.Enter);
                    Thread.Sleep(2000);
                    gc.CreatePdf(orderNumber, ParcelID, "Building Details", driver, "NC", "Forsyth");
                    string yearbuilt = "";
                    try
                    {
                        yearbuilt = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_DetailsView4")).Text;
                        YearBuilt = gc.Between(yearbuilt, "Year Built", "Additions").Replace("\r\n", "").Trim();
                    }
                    catch { }
                    string propertydetails = TaxYear + "~" + REID + "~" + PropertyOwner + "~" + PropertyAddress + "~" + LegalDescription + "~" + MailingAddress + "~" + OldMapNumber + "~" + MarketArea + "~" + Township + "~" + PlanningJurisdiction + "~" + City + "~" + FireDistrict + "~" + SpecialDistrict + "~" + PropertyClass + "~" + YearBuilt;
                    gc.insert_date(orderNumber, ParcelID, 603, propertydetails, 1, DateTime.Now);

                    //Assessment Details

                    string            currentHandle     = driver.CurrentWindowHandle;
                    IWebElement       element           = driver.FindElement(By.LinkText("Print Property Info"));
                    PopupWindowFinder finder            = new PopupWindowFinder(driver);
                    string            popupWindowHandle = finder.Click(element);
                    driver.SwitchTo().Window(popupWindowHandle);
                    gc.CreatePdf(orderNumber, ParcelID, "Assessment Details", driver, "NC", "Forsyth");
                    Thread.Sleep(3000);
                    IWebElement         asstableElement    = driver.FindElement(By.XPath("//*[@id='headerPlaceholder']/div/div[4]/div/table/tbody"));
                    IList <IWebElement> asstableElementRow = asstableElement.FindElements(By.TagName("tr"));
                    IList <IWebElement> asstableElementRowTD;
                    IList <IWebElement> asstableElementRowTH;
                    var assesscolumn = ""; var assessvalue = "";
                    foreach (IWebElement rowid in asstableElementRow)
                    {
                        asstableElementRowTD = rowid.FindElements(By.TagName("td"));
                        asstableElementRowTH = rowid.FindElements(By.TagName("th"));
                        if (asstableElementRowTD.Count != 0 && !rowid.Text.Contains("Property Value") && rowid.Text != "")
                        {
                            if (asstableElementRowTD[0].Text != " ")
                            {
                                assesscolumn += asstableElementRowTH[0].Text + "~";
                                assessvalue  += asstableElementRowTD[0].Text + "~";
                            }
                        }
                    }
                    assesscolumn = assesscolumn.TrimEnd('~');
                    assessvalue  = assessvalue.TrimEnd('~');

                    DBconnection dbconn = new DBconnection();
                    dbconn.ExecuteQuery("update data_field_master set Data_Fields_Text='" + assesscolumn + "' where Id = '" + 605 + "'");
                    gc.insert_date(orderNumber, ParcelID, 605, assessvalue, 1, DateTime.Now);



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

                    //Tax Information Details
                    driver.Navigate().GoToUrl("http://tellus.co.forsyth.nc.us/PublicWebAccess/BillSearchResults.aspx?");
                    Thread.Sleep(2000);

                    string Par = ".000";
                    parcelNumber = ParcelID + Par;

                    IWebElement   ISelect = driver.FindElement(By.Id("lookupCriterion"));
                    SelectElement sSelect = new SelectElement(ISelect);
                    sSelect.SelectByText("Parcel Number");
                    driver.FindElement(By.Id("txtSearchString")).SendKeys(parcelNumber);
                    gc.CreatePdf(orderNumber, ParcelID, "Tax Search  Input Passed", driver, "NC", "Forsyth");
                    driver.FindElement(By.XPath("//*[@id='btnGo']")).SendKeys(Keys.Enter);
                    Thread.Sleep(2000);
                    gc.CreatePdf(orderNumber, ParcelID, "Tax Search Result", driver, "NC", "Forsyth");


                    //Tax Histry Details
                    IWebElement         tdHistry = driver.FindElement(By.XPath("//*[@id='tblSearchResults']"));
                    IList <IWebElement> TrHistry = tdHistry.FindElements(By.TagName("tr"));
                    IList <IWebElement> TDHistry;
                    IList <IWebElement> TDHistryth;
                    foreach (IWebElement row in TrHistry)
                    {
                        TDHistry   = row.FindElements(By.TagName("td"));
                        TDHistryth = row.FindElements(By.TagName("tr"));
                        if (!row.Text.Contains("Bill #"))
                        {
                            if (TDHistry.Count == 7)
                            {
                                string TaxHistryDetails = TDHistry[0].Text + "~" + TDHistry[1].Text + "~" + TDHistry[2].Text + "~" + TDHistry[3].Text + "~" + TDHistry[4].Text + "~" + TDHistry[5].Text + "~" + TDHistry[6].Text;
                                gc.insert_date(orderNumber, ParcelID, 612, TaxHistryDetails, 1, DateTime.Now);
                            }
                            else if (row.Text.Contains("Total"))
                            {
                                string total            = GlobalClass.After(row.Text, "Total:");
                                string TaxHistryDetails = "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "Total" + "~" + total;
                                gc.insert_date(orderNumber, ParcelID, 612, TaxHistryDetails, 1, DateTime.Now);
                            }
                        }
                    }

                    List <string> strTaxRealestate = new List <string>();
                    try
                    {
                        IWebElement         ITaxinfoDetails = driver.FindElement(By.XPath("//*[@id='G_dgResults']/tbody"));
                        IList <IWebElement> ITaxinfoRealRow = ITaxinfoDetails.FindElements(By.TagName("tr"));
                        IList <IWebElement> ITaxinfoRealTd;
                        foreach (IWebElement ItaxinfoReal in ITaxinfoRealRow)
                        {
                            ITaxinfoRealTd = ItaxinfoReal.FindElements(By.TagName("td"));
                            if (ITaxinfoRealTd.Count != 0 && strTaxRealestate.Count < 3)
                            {
                                IWebElement ITaxBillCount = ITaxinfoRealTd[0].FindElement(By.TagName("a"));
                                string      strTaxReal    = ITaxBillCount.GetAttribute("href");
                                strTaxRealestate.Add(strTaxReal);
                            }
                        }
                    }
                    catch
                    {
                    }

                    foreach (string real in strTaxRealestate)
                    {
                        string TaxMailingAddress = "", RealValue = "", DeferredValue = "", UseValue = "", PersonalValue = "", ExemptExclusion = "", TotalAssessedValue = "", BillTaxYear = "", PropertyTax = "", BillStatus = "", BillFlag = "", BillNumber = "", OldBillNumber = "", OldAccountNumber = "", DueDate = "", InterestBegins = ""
                        , InterestAmount = "", TotalBilled = "", GoodThroughDate = "", LastPaymentDate = "", CurrentDue = "", TaxAuthority = "", DiscountPeriod = "";

                        driver.Navigate().GoToUrl(real);
                        Thread.Sleep(4000);
                        if (strTaxRealestate.Count != 0 && strTaxRealestate.Count == 3)
                        {
                            try
                            {
                                BillFlag = driver.FindElement(By.Id("lblBillFlag")).Text;
                                if (BillFlag.Contains("DELINQUENT"))
                                {
                                    IWebElement dt   = driver.FindElement(By.Id("interestCalDate_input"));
                                    string      date = dt.GetAttribute("value");

                                    DateTime G_Date       = Convert.ToDateTime(date);
                                    string   dateChecking = DateTime.Now.ToString("MM") + "/15/" + DateTime.Now.ToString("yyyy");

                                    if (G_Date < Convert.ToDateTime(dateChecking))
                                    {
                                        //end of the month
                                        date = new DateTime(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM"))), DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(DateTime.Now.ToString("MM")))).ToString("MM/dd/yyyy");
                                    }

                                    else if (G_Date > Convert.ToDateTime(dateChecking))
                                    {
                                        // nextEndOfMonth
                                        if ((Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM"))) < 12))
                                        {
                                            date = new DateTime(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM")) + 1), DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(DateTime.Now.ToString("MM")) + 1)).ToString("MM/dd/yyyy");
                                        }
                                        else
                                        {
                                            int nxtYr = Convert.ToInt16(DateTime.Now.ToString("yyyy")) + 1;
                                            date = new DateTime(nxtYr, 1, DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), 1)).ToString("MM/dd/yyyy");
                                        }
                                    }

                                    Thread.Sleep(2000);
                                    dt.Clear();
                                    GoodThroughDate = date;
                                    driver.FindElement(By.Id("interestCalDate_input")).SendKeys(date);
                                    driver.FindElement(By.Id("btnRecalInterest")).SendKeys(Keys.Enter);
                                    //*[@id=""]
                                }
                                else
                                {
                                    GoodThroughDate = "";
                                }
                                TaxMailingAddress  = driver.FindElement(By.Id("lblMailingAddr")).Text;
                                RealValue          = driver.FindElement(By.Id("lblRealOriginal")).Text;
                                DeferredValue      = driver.FindElement(By.Id("lblDeferredOriginal")).Text;
                                UseValue           = driver.FindElement(By.Id("lblUseOriginal")).Text;
                                PersonalValue      = driver.FindElement(By.Id("lblPersonalOriginal")).Text;
                                ExemptExclusion    = driver.FindElement(By.Id("lblExemptOriginal")).Text;
                                TotalAssessedValue = driver.FindElement(By.Id("lblTotalValue")).Text;
                                BillTaxYear        = driver.FindElement(By.Id("lblBill")).Text;
                                BillTaxYear        = BillTaxYear.Substring(11, 4);
                                gc.CreatePdf(orderNumber, ParcelID, "Tax" + BillTaxYear, driver, "NC", "Forsyth");
                                PropertyTax      = driver.FindElement(By.Id("lblPropertyType")).Text;
                                BillStatus       = driver.FindElement(By.Id("lblBillStatus")).Text;
                                BillNumber       = driver.FindElement(By.Id("lblBill")).Text;
                                OldBillNumber    = driver.FindElement(By.Id("lblLegacyBillNum")).Text;
                                OldAccountNumber = driver.FindElement(By.Id("lblLegacyAccountNum")).Text;
                                DueDate          = driver.FindElement(By.Id("lblDueDate")).Text;
                                InterestBegins   = driver.FindElement(By.Id("lblInterest")).Text;
                                InterestAmount   = driver.FindElement(By.Id("lblInterestAmt")).Text;
                                TotalBilled      = driver.FindElement(By.Id("lblTotalAmountDue")).Text;
                                LastPaymentDate  = driver.FindElement(By.Id("lblLastPaymentDate")).Text;
                                CurrentDue       = driver.FindElement(By.Id("lblCurrentDue")).Text;

                                string discounttext = driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td[2]/table[4]/tbody/tr/td/table")).Text;
                                if (discounttext.Contains("Discount Period"))
                                {
                                    DiscountPeriod = gc.Between(discounttext, "Discount Period:", "Correct if paid by").Replace("\r\n", "").Trim();
                                }
                                //DiscountPeriod= driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td[2]/table[4]/tbody/tr/td/table/tbody/tr[1]/td[2]/font")).Text;
                                TaxAuthority = "Forsyth County Tax Collector P.O.Box 82 Winston - Salem, NC 27102";
                                string TaxInformationdetails = TaxMailingAddress + "~" + RealValue + "~" + DeferredValue + "~" + UseValue + "~" + PersonalValue + "~" + ExemptExclusion + "~" + TotalAssessedValue + "~" + BillTaxYear + "~" + PropertyTax + "~" + BillStatus + "~" + BillFlag + "~" + BillNumber + "~" + OldBillNumber + "~" + OldAccountNumber + "~" + DueDate + "~" + InterestBegins + "~" + InterestAmount + "~" + TotalBilled + "~" + LastPaymentDate + "~" + CurrentDue + "~" + DiscountPeriod + "~" + GoodThroughDate + "~" + TaxAuthority;
                                gc.insert_date(orderNumber, ParcelID, 610, TaxInformationdetails, 1, DateTime.Now);
                            }
                            catch { }
                        }

                        //Tax/Fee Distribution Details
                        IWebElement         tbmulti = driver.FindElement(By.XPath("//*[@id='dgShowResultRate']/tbody"));
                        IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));

                        IList <IWebElement> TDmulti;
                        foreach (IWebElement row in TRmulti)
                        {
                            TDmulti = row.FindElements(By.TagName("td"));
                            if (!row.Text.Contains("Rate"))
                            {
                                if (TDmulti.Count == 4)
                                {
                                    string TaxDistribution = BillTaxYear + "~" + TDmulti[0].Text + "~" + TDmulti[1].Text + "~" + TDmulti[2].Text + "~" + TDmulti[3].Text;
                                    gc.insert_date(orderNumber, ParcelID, 611, TaxDistribution, 1, DateTime.Now);
                                }
                            }
                        }
                    }
                    TaxTime = DateTime.Now.ToString("HH:mm:ss");
                    driver.Quit();
                    gc.mergpdf(orderNumber, "NC", "Forsyth");
                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "NC", "Forsyth", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw ex;
                }
            }
        }
Esempio n. 7
0
        public string FTP_TXTravis(string streetno, string direction, string streetname, string city, string streettype, string unitnumber, string ownernm, string parcelNumber, string searchType, string orderNumber, string Account_id)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

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

            var driverService = PhantomJSDriverService.CreateDefaultService();

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

                    if (searchType == "titleflex")
                    {
                        string titleaddress = streetno + " " + streetname + " " + unitnumber;
                        gc.TitleFlexSearch(orderNumber, parcelNumber, "", titleaddress, "TX", "Travis");
                        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_TXTravis"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "address")
                    {
                        driver.Navigate().GoToUrl("http://propaccess.traviscad.org/clientdb/?cid=1");
                        Thread.Sleep(2000);
                        //var Select1 = driver.FindElement(By.Id("propertySearchOptions_taxyear"));
                        //var selectElement11 = new SelectElement(Select1);
                        //selectElement11.SelectByIndex(1);
                        //Thread.Sleep(2000);
                        driver.FindElement(By.Id("propertySearchOptions_advanced")).Click();
                        Thread.Sleep(2000);

                        //Address = streetno + " " + streetname;
                        driver.FindElement(By.Id("propertySearchOptions_streetNumber")).SendKeys(streetno);
                        driver.FindElement(By.Id("propertySearchOptions_streetName")).SendKeys(streetname);
                        //driver.FindElement(By.Id("propertySearchOptions_searchText")).SendKeys(Address);
                        gc.CreatePdf_WOP(orderNumber, "address search", driver, "TX", "Travis");
                        driver.FindElement(By.Id("propertySearchOptions_searchAdv")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);

                        try
                        {
                            ChkMulti = driver.FindElement(By.XPath("//*[@id='pageTitle']/h2")).Text;
                            ChkMulti = WebDriverTest.Between(ChkMulti, "Property Search Results > ", " for");

                            if (ChkMulti == "1 - 1 of 1")
                            {
                                driver.FindElement(By.XPath("//*[@id='propertySearchResults_resultsTable']/tbody/tr[2]/td[10]/a")).Click();
                                Thread.Sleep(2000);
                                gc.CreatePdf_WOP(orderNumber, "Single Address search", driver, "TX", "Travis");
                            }
                            else
                            {
                                try
                                {
                                    IWebElement         MultiAddressTB = driver.FindElement(By.XPath("//*[@id='propertySearchResults_resultsTable']/tbody"));
                                    IList <IWebElement> MultiAddressTR = MultiAddressTB.FindElements(By.TagName("tr"));
                                    IList <IWebElement> MultiAddressTD;
                                    gc.CreatePdf_WOP(orderNumber, "Multi Address search", driver, "TX", "Travis");
                                    int AddressmaxCheck = 0;
                                    foreach (IWebElement MultiAddress in MultiAddressTR)
                                    {
                                        if (AddressmaxCheck <= 25 && MultiAddressTR.Count > 2)
                                        {
                                            MultiAddressTD = MultiAddress.FindElements(By.TagName("td"));
                                            if (MultiAddressTD.Count != 0 && !MultiAddress.Text.Contains("Mobile Home") && !MultiAddress.Text.Contains("     ") && !MultiAddress.Text.Contains("Page:   1"))
                                            {
                                                Parcelno         = MultiAddressTD[1].Text;
                                                Multi_Type       = MultiAddressTD[3].Text;
                                                Property_Address = MultiAddressTD[4].Text;
                                                Owner            = MultiAddressTD[6].Text;

                                                MultiAddress_details = Multi_Type + "~" + Property_Address + "~" + Owner;
                                                gc.insert_date(orderNumber, Parcelno, 1058, MultiAddress_details, 1, DateTime.Now);
                                            }
                                            AddressmaxCheck++;
                                        }
                                    }
                                    if (MultiAddressTR.Count <= 2)
                                    {
                                        HttpContext.Current.Session["Nodata_TXTravis"] = "Yes";
                                        driver.Quit();
                                        return("No Data Found");
                                    }
                                    if (MultiAddressTR.Count > 25)
                                    {
                                        HttpContext.Current.Session["multiParcel_TXTravis_Multicount"] = "Maximum";
                                    }
                                    else
                                    {
                                        HttpContext.Current.Session["multiParcel_TXTravis"] = "Yes";
                                    }
                                    driver.Quit();
                                    return("MultiParcel");
                                }
                                catch
                                { }
                            }
                        }
                        catch { }
                    }

                    if (searchType == "parcel")
                    {
                        driver.Navigate().GoToUrl("http://propaccess.traviscad.org/clientdb/?cid=1");
                        Thread.Sleep(2000);
                        //driver.FindElement(By.Id("propertySearchOptions_advanced")).Click();
                        //Thread.Sleep(2000);
                        driver.FindElement(By.Id("propertySearchOptions_searchText")).SendKeys(parcelNumber);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search", driver, "TX", "Travis");

                        driver.FindElement(By.Id("propertySearchOptions_search")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);
                        try
                        {
                            driver.FindElement(By.XPath("//*[@id='propertySearchResults_resultsTable']/tbody/tr[2]/td[10]/a")).Click();
                            Thread.Sleep(2000);
                        }
                        catch { }
                    }

                    if (searchType == "ownername")
                    {
                        driver.Navigate().GoToUrl("http://propaccess.traviscad.org/clientdb/?cid=1");
                        Thread.Sleep(2000);
                        driver.FindElement(By.Id("propertySearchOptions_advanced")).Click();
                        Thread.Sleep(2000);
                        driver.FindElement(By.Id("propertySearchOptions_ownerName")).SendKeys(ownernm);
                        gc.CreatePdf_WOP(orderNumber, "owner search", driver, "TX", "Travis");

                        driver.FindElement(By.Id("propertySearchOptions_searchAdv")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);
                        try
                        {
                            ChkMulti = driver.FindElement(By.XPath("//*[@id='pageTitle']/h2")).Text;
                            ChkMulti = WebDriverTest.Between(ChkMulti, "Property Search Results > ", " for");

                            if (ChkMulti == "1 - 1 of 1")
                            {
                                driver.FindElement(By.XPath("//*[@id='propertySearchResults_resultsTable']/tbody/tr[2]/td[10]/a")).Click();
                                Thread.Sleep(2000);
                                gc.CreatePdf_WOP(orderNumber, "Single Owner search", driver, "TX", "Travis");
                            }
                            else
                            {
                                try
                                {
                                    IWebElement         MultiAddressTB = driver.FindElement(By.XPath("//*[@id='propertySearchResults_resultsTable']/tbody"));
                                    IList <IWebElement> MultiAddressTR = MultiAddressTB.FindElements(By.TagName("tr"));
                                    IList <IWebElement> MultiAddressTD;
                                    gc.CreatePdf_WOP(orderNumber, "Multi Owner search", driver, "TX", "Travis");
                                    int AddressmaxCheck = 0;
                                    foreach (IWebElement MultiAddress in MultiAddressTR)
                                    {
                                        if (AddressmaxCheck <= 25)
                                        {
                                            MultiAddressTD = MultiAddress.FindElements(By.TagName("td"));
                                            if (MultiAddressTD.Count != 0 && !MultiAddress.Text.Contains("Mobile Home") && !MultiAddress.Text.Contains("     ") && !MultiAddress.Text.Contains("Page:   1"))
                                            {
                                                Parcelno         = MultiAddressTD[1].Text;
                                                Multi_Type       = MultiAddressTD[3].Text;
                                                Property_Address = MultiAddressTD[4].Text;
                                                Owner            = MultiAddressTD[6].Text;

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

                    else if (searchType == "block")
                    {
                        driver.Navigate().GoToUrl("http://propaccess.traviscad.org/clientdb/?cid=1");
                        Thread.Sleep(2000);

                        driver.FindElement(By.Id("propertySearchOptions_searchText")).SendKeys(Account_id);
                        gc.CreatePdf_WOP(orderNumber, "Account Number Search ", driver, "TX", "Travis");

                        driver.FindElement(By.Id("propertySearchOptions_search")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);
                        try
                        {
                            driver.FindElement(By.XPath("//*[@id='propertySearchResults_resultsTable']/tbody/tr[2]/td[10]/a")).Click();
                            Thread.Sleep(2000);
                        }
                        catch { }
                    }

                    try
                    {
                        IWebElement INodata = driver.FindElement(By.Id("propertySearchResults_pageHeading"));
                        if (INodata.Text.Contains("None found"))
                        {
                            HttpContext.Current.Session["Nodata_TXTravis"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }

                    //property details
                    try
                    {
                        fulltext         = driver.FindElement(By.XPath("//*[@id='propertyDetails']/table/tbody")).Text.Replace("\r\n", " ");
                        PropertyID       = gc.Between(fulltext, "Account Property ID: ", " Legal Description: ");
                        GeographicID     = gc.Between(fulltext, "Geographic ID: ", " Zoning: ");
                        Type             = gc.Between(fulltext, "Type: ", " Agent Code: ");
                        LegalDescription = gc.Between(fulltext, " Legal Description: ", " Geographic ID: ");
                        ProAddress       = gc.Between(fulltext, "Location Address: ", " Mapsco: ");
                        try
                        {
                            Neighborhood = gc.Between(fulltext, "Neighborhood: ", " Map ID: ");
                        }
                        catch
                        { }
                        NeighborhoodCD = gc.Between(fulltext, " Neighborhood CD: ", " Owner Name: ");
                        MapID          = gc.Between(fulltext, "Map ID: ", " Neighborhood CD: ");
                        Name           = gc.Between(fulltext, "Owner Name: ", " Owner ID: ");
                        MailingAddress = gc.Between(fulltext, "Mailing Address: ", " % Ownership:");
                        OwnerID        = gc.Between(fulltext, "Owner ID: ", " Mailing Address: ");
                        Exemptions     = GlobalClass.After(fulltext, "Exemptions: ");
                        gc.CreatePdf(orderNumber, PropertyID, "Property Info1", driver, "TX", "Travis");
                        try
                        {
                            driver.FindElement(By.XPath("//*[@id='improvementBuilding']")).Click();
                            Thread.Sleep(2000);
                            YearBuilt = driver.FindElement(By.XPath("//*[@id='improvementBuildingDetails']/table[2]/tbody/tr[2]/td[6]")).Text;
                            gc.CreatePdf(orderNumber, PropertyID, "Property Info2", driver, "TX", "Travis");
                        }
                        catch { }

                        try
                        {
                            driver.FindElement(By.Id("land")).Click();
                            Thread.Sleep(2000);
                            Acres = driver.FindElement(By.XPath("//*[@id='landDetails']/table/tbody/tr[2]/td[4]")).Text;
                            gc.CreatePdf(orderNumber, PropertyID, "Property Info3", driver, "TX", "Travis");
                        }
                        catch { }

                        property_details = GeographicID + "~" + Type + "~" + LegalDescription + "~" + ProAddress + "~" + Neighborhood + "~" + NeighborhoodCD + "~" + MapID + "~" + Name + "~" + MailingAddress + "~" + OwnerID + "~" + Exemptions + "~" + YearBuilt + "~" + Acres;
                        gc.insert_date(orderNumber, PropertyID, 1074, property_details, 1, DateTime.Now);
                    }
                    catch
                    { }

                    //Assessment Details
                    try
                    {
                        driver.FindElement(By.Id("values")).Click();
                        Thread.Sleep(2000);
                        gc.CreatePdf(orderNumber, PropertyID, "Value Info", driver, "TX", "Travis");
                        IWebElement         AssessmentTable = driver.FindElement(By.XPath("//*[@id='valuesDetails']/table/tbody"));
                        IList <IWebElement> AssessmentTR    = AssessmentTable.FindElements(By.TagName("tr"));
                        IList <IWebElement> AssessmentTD;
                        foreach (IWebElement Assessment in AssessmentTR)
                        {
                            AssessmentTD = Assessment.FindElements(By.TagName("td"));
                            if (AssessmentTD.Count != 0 && AssessmentTD[0].Text != " ")
                            {
                                ValueDetails = AssessmentTD[0].Text.Trim() + "~" + AssessmentTD[1].Text.Trim() + "~" + AssessmentTD[2].Text.Trim() + "~" + AssessmentTD[3].Text.Trim();
                                gc.insert_date(orderNumber, PropertyID, 1076, ValueDetails, 1, DateTime.Now);
                            }
                        }
                    }
                    catch
                    { }

                    //Taxing Jurisdiction Details
                    try
                    {
                        driver.FindElement(By.Id("taxingJurisdiction")).Click();
                        Thread.Sleep(2000);

                        fulltext1     = driver.FindElement(By.XPath("//*[@id='taxingJurisdictionDetails']/table[1]/tbody")).Text.Replace("\r\n", " ");
                        owner         = gc.Between(fulltext1, "Owner:", "% Ownership:");
                        Ownership     = gc.Between(fulltext1, "% Ownership:", "Total Value:");
                        TotalValue    = GlobalClass.After(fulltext1, "Total Value:");
                        ValueDetails1 = owner + "~" + Ownership + "~" + TotalValue + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "";
                        gc.insert_date(orderNumber, PropertyID, 1078, ValueDetails1, 1, DateTime.Now);
                        gc.CreatePdf(orderNumber, PropertyID, "Jurisdiction Info", driver, "TX", "Travis");
                        IWebElement         JurisdictionTable = driver.FindElement(By.XPath("//*[@id='taxingJurisdictionDetails']/table[2]/tbody"));
                        IList <IWebElement> JurisdictionTR    = JurisdictionTable.FindElements(By.TagName("tr"));
                        IList <IWebElement> JurisdictionTD;
                        foreach (IWebElement row in JurisdictionTR)
                        {
                            JurisdictionTD = row.FindElements(By.TagName("td"));
                            if (JurisdictionTD.Count != 0)
                            {
                                ValueDetails1 = " " + "~" + " " + "~" + " " + "~" + JurisdictionTD[0].Text.Trim() + "~" + JurisdictionTD[1].Text.Trim() + "~" + JurisdictionTD[2].Text.Trim() + "~" + JurisdictionTD[3].Text.Trim() + "~" + JurisdictionTD[4].Text.Trim() + "~" + JurisdictionTD[5].Text.Trim();
                                gc.insert_date(orderNumber, PropertyID, 1078, ValueDetails1, 1, DateTime.Now);
                            }
                        }
                    }
                    catch
                    { }

                    //Roll Value History Details
                    try
                    {
                        driver.FindElement(By.Id("rollHistory")).Click();
                        Thread.Sleep(2000);
                        IWebElement         RollTable = driver.FindElement(By.XPath("//*[@id='rollHistoryDetails']/table/tbody"));
                        IList <IWebElement> RollTR    = RollTable.FindElements(By.TagName("tr"));
                        IList <IWebElement> RollTD;

                        foreach (IWebElement Roll in RollTR)
                        {
                            RollTD = Roll.FindElements(By.TagName("td"));
                            if (RollTD.Count != 0)
                            {
                                rollDetails = RollTD[0].Text.Trim() + "~" + RollTD[1].Text.Trim() + "~" + RollTD[2].Text.Trim() + "~" + RollTD[3].Text.Trim() + "~" + RollTD[4].Text.Trim() + "~" + RollTD[5].Text.Trim() + "~" + RollTD[6].Text.Trim();
                                gc.insert_date(orderNumber, PropertyID, 1077, rollDetails, 1, DateTime.Now);
                                gc.CreatePdf(orderNumber, PropertyID, "Roll Info", driver, "TX", "Travis");
                            }
                        }
                    }
                    catch
                    { }
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    driver.Navigate().GoToUrl("https://travis.go2gov.net/cart/search/quickSearch.do");
                    Thread.Sleep(2000);

                    driver.FindElement(By.XPath("//*[@id='quickSearchForm']/input[6]")).SendKeys(GeographicID);
                    gc.CreatePdf(orderNumber, GeographicID, "Tax Search Info", driver, "TX", "Travis");
                    driver.FindElement(By.XPath("//*[@id='quickSearchForm']/button")).SendKeys(Keys.Enter);
                    Thread.Sleep(2000);

                    driver.FindElement(By.XPath("/html/body/div[3]/form[1]/div/table/tbody/tr/td/center/table/tbody/tr[3]/td[3]/span/a")).Click();
                    Thread.Sleep(2000);
                    gc.CreatePdf(orderNumber, GeographicID, "Tax Info", driver, "TX", "Travis");
                    try
                    {
                        //Tax Bill Details
                        Account       = driver.FindElement(By.XPath("//*[@id='accountSummarySubView:accountSummaryForm']/table/tbody/tr[1]/td/table/tbody/tr[2]/td/table/tbody/tr/td[1]")).Text;
                        Tax_Owner     = driver.FindElement(By.XPath("//*[@id='accountSummarySubView:accountSummaryForm']/table/tbody/tr[1]/td/table/tbody/tr[2]/td/table/tbody/tr/td[2]")).Text;
                        Tax_Mailing   = driver.FindElement(By.XPath("//*[@id='accountSummarySubView:accountSummaryForm']/table/tbody/tr[1]/td/table/tbody/tr[2]/td/table/tbody/tr/td[3]")).Text;
                        Tax_LegalDesp = driver.FindElement(By.XPath("//*[@id='accountSummarySubView:accountSummaryForm']/table/tbody/tr[1]/td/table/tbody/tr[2]/td/table/tbody/tr/td[4]")).Text;

                        try
                        {
                            Tax_Year        = driver.FindElement(By.XPath("//*[@id='accountSummarySubView:accountSummaryForm']/table/tbody/tr[4]/td/table/tbody/tr[2]/td/table/tbody/tr/td[1]")).Text;
                            Base_Due        = driver.FindElement(By.XPath("//*[@id='accountSummarySubView:accountSummaryForm']/table/tbody/tr[4]/td/table/tbody/tr[2]/td/table/tbody/tr/td[2]")).Text;
                            Penalty_Interst = driver.FindElement(By.XPath("//*[@id='accountSummarySubView:accountSummaryForm']/table/tbody/tr[4]/td/table/tbody/tr[2]/td/table/tbody/tr/td[3]")).Text;
                            OtherFee        = driver.FindElement(By.XPath("//*[@id='accountSummarySubView:accountSummaryForm']/table/tbody/tr[4]/td/table/tbody/tr[2]/td/table/tbody/tr/td[4]")).Text;
                            Tax_Total       = driver.FindElement(By.XPath("//*[@id='accountSummarySubView:accountSummaryForm']/table/tbody/tr[4]/td/table/tbody/tr[2]/td/table/tbody/tr/td[5]")).Text;
                        }
                        catch
                        { }

                        try
                        {
                            string Previous_Year = driver.FindElement(By.XPath("//*[@id='accountSummarySubView:accountSummaryForm']/table/tbody/tr[3]/td/table/thead/tr/th")).Text;
                            Previous_Year = WebDriverTest.After(Previous_Year, "Previous Tax Year ");

                            if (Previous_Year == "Taxes Due")
                            {
                                try
                                {
                                    Tax_Year        = driver.FindElement(By.XPath("//*[@id='accountSummarySubView:accountSummaryForm']/table/tbody/tr[5]/td/table/tbody/tr[2]/td/table/tbody/tr/td[1]")).Text;
                                    Base_Due        = driver.FindElement(By.XPath("//*[@id='accountSummarySubView:accountSummaryForm']/table/tbody/tr[5]/td/table/tbody/tr[2]/td/table/tbody/tr/td[2]")).Text;
                                    Penalty_Interst = driver.FindElement(By.XPath("//*[@id='accountSummarySubView:accountSummaryForm']/table/tbody/tr[5]/td/table/tbody/tr[2]/td/table/tbody/tr/td[3]")).Text;
                                    OtherFee        = driver.FindElement(By.XPath("//*[@id='accountSummarySubView:accountSummaryForm']/table/tbody/tr[5]/td/table/tbody/tr[2]/td/table/tbody/tr/td[4]")).Text;
                                    Tax_Total       = driver.FindElement(By.XPath("//*[@id='accountSummarySubView:accountSummaryForm']/table/tbody/tr[5]/td/table/tbody/tr[2]/td/table/tbody/tr/td[5]")).Text;
                                }
                                catch
                                { }

                                //Deliquent Details
                                driver.FindElement(By.XPath("//*[@id='accountSummarySubView:accountSummaryForm:_idJsp89']")).Click();
                                Thread.Sleep(2000);

                                IWebElement         DeliquentTB = driver.FindElement(By.XPath("//*[@id='accountYearDetailSubView:accountYearDetailForm:_idJsp81']/tbody"));
                                IList <IWebElement> DeliquentTR = DeliquentTB.FindElements(By.TagName("tr"));
                                IList <IWebElement> DeliquentTD;
                                gc.CreatePdf(orderNumber, GeographicID, "Deliquent Info", driver, "TX", "Travis");
                                foreach (IWebElement Deliquent in DeliquentTR)
                                {
                                    DeliquentTD = Deliquent.FindElements(By.TagName("td"));
                                    if (DeliquentTD.Count != 0)
                                    {
                                        Deliquent_Year    = DeliquentTD[0].Text;
                                        Deliquent_Base    = DeliquentTD[1].Text;
                                        Deliquent_Intrest = DeliquentTD[2].Text;
                                        Deliquent_Fees    = DeliquentTD[3].Text;
                                        Deliquent_Total   = DeliquentTD[4].Text;

                                        Deliquent_Details = Deliquent_Year + "~" + Deliquent_Base + "~" + Deliquent_Intrest + "~" + Deliquent_Fees + "~" + Deliquent_Total;
                                        gc.insert_date(orderNumber, GeographicID, 1095, Deliquent_Details, 1, DateTime.Now);
                                    }
                                }

                                IWebElement         DeliquentTB1 = driver.FindElement(By.XPath("//*[@id='accountYearDetailSubView:accountYearDetailForm:_idJsp81']/tfoot/tr/td/table/tbody/tr[2]/td/table/tbody"));
                                IList <IWebElement> DeliquentTR1 = DeliquentTB1.FindElements(By.TagName("tr"));
                                IList <IWebElement> DeliquentTD1;

                                foreach (IWebElement Deliquent1 in DeliquentTR1)
                                {
                                    DeliquentTD1 = Deliquent1.FindElements(By.TagName("td"));
                                    if (DeliquentTD1.Count != 0)
                                    {
                                        Deliquent_Year1    = DeliquentTD1[0].Text;
                                        Deliquent_Base1    = DeliquentTD1[1].Text;
                                        Deliquent_Intrest1 = DeliquentTD1[2].Text;
                                        Deliquent_Fees1    = DeliquentTD1[3].Text;
                                        Deliquent_Total1   = DeliquentTD1[4].Text;

                                        Deliquent_Details1 = Deliquent_Year1 + "~" + Deliquent_Base1 + "~" + Deliquent_Intrest1 + "~" + Deliquent_Fees1 + "~" + Deliquent_Total1;
                                        gc.insert_date(orderNumber, GeographicID, 1095, Deliquent_Details1, 1, DateTime.Now);
                                    }
                                }
                                driver.Navigate().Back();
                                Thread.Sleep(2000);
                            }

                            Deliquent_Comments = "For prior year tax amount due, you must call the Collector's Office.";
                        }
                        catch
                        { }
                    }
                    catch
                    { }

                    //Taxing Unit Details
                    try
                    {
                        driver.FindElement(By.XPath("//*[@id='accountSummarySubView:accountSummaryForm:_idJsp73']")).Click();
                        Thread.Sleep(2000);

                        try
                        {
                            Taxyear_detail  = driver.FindElement(By.XPath("//*[@id='accountYearDetailSubView:accountYearDetailForm']/table/tbody/tr[3]/td")).Text;
                            TaxYear_Details = Taxyear_detail + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "";
                            gc.insert_date(orderNumber, GeographicID, 1089, TaxYear_Details, 1, DateTime.Now);
                        }
                        catch
                        { }
                        IWebElement         TaxUnitTB = driver.FindElement(By.XPath("//*[@id='accountYearDetailSubView:accountYearDetailForm:_idJsp83']/tbody"));
                        IList <IWebElement> TaxUnitTR = TaxUnitTB.FindElements(By.TagName("tr"));
                        IList <IWebElement> TaxUnitTD;
                        gc.CreatePdf(orderNumber, GeographicID, "Tax Unit Info", driver, "TX", "Travis");
                        foreach (IWebElement TaxUnit in TaxUnitTR)
                        {
                            TaxUnitTD = TaxUnit.FindElements(By.TagName("td"));
                            if (TaxUnitTD.Count != 0)
                            {
                                Tax_Unit    = TaxUnitTD[0].Text;
                                Assed_Value = TaxUnitTD[1].Text;
                                NetTaxb_Val = TaxUnitTD[2].Text;
                                Basedue_Val = TaxUnitTD[3].Text;
                                Penalty_Val = TaxUnitTD[4].Text;
                                Attrney_Val = TaxUnitTD[5].Text;
                                Total_Val   = TaxUnitTD[6].Text;

                                TaxUnit_Details = "" + "~" + Tax_Unit + "~" + Assed_Value + "~" + NetTaxb_Val + "~" + Basedue_Val + "~" + Penalty_Val + "~" + Attrney_Val + "~" + Total_Val;
                                gc.insert_date(orderNumber, GeographicID, 1089, TaxUnit_Details, 1, DateTime.Now);
                            }
                        }

                        IWebElement         TaxUnitTB1 = driver.FindElement(By.XPath("//*[@id='accountYearDetailSubView:accountYearDetailForm:_idJsp83']/tfoot/tr/td/table/tbody/tr[2]/td/table/tbody"));
                        IList <IWebElement> TaxUnitTR1 = TaxUnitTB1.FindElements(By.TagName("tr"));
                        IList <IWebElement> TaxUnitTD1;

                        foreach (IWebElement TaxUnit1 in TaxUnitTR1)
                        {
                            TaxUnitTD1 = TaxUnit1.FindElements(By.TagName("td"));
                            if (TaxUnitTD1.Count != 0)
                            {
                                Tax_Unit1    = TaxUnitTD1[0].Text;
                                Assed_Value1 = TaxUnitTD1[1].Text;
                                NetTaxb_Val1 = TaxUnitTD1[2].Text;
                                Basedue_Val1 = TaxUnitTD1[3].Text;
                                Penalty_Val1 = TaxUnitTD1[4].Text;
                                Attrney_Val1 = TaxUnitTD1[5].Text;
                                Total_Val1   = TaxUnitTD1[6].Text;

                                TaxUnit_Details1 = "" + "~" + Tax_Unit1 + "~" + Assed_Value1 + "~" + NetTaxb_Val1 + "~" + Basedue_Val1 + "~" + Penalty_Val1 + "~" + Attrney_Val1 + "~" + Total_Val1;
                                gc.insert_date(orderNumber, GeographicID, 1089, TaxUnit_Details1, 1, DateTime.Now);
                            }
                        }
                    }
                    catch
                    { }

                    //Tax Payment Details
                    try
                    {
                        driver.FindElement(By.XPath("//*[@id='quickSearchSubView:quickSearchForm:_idJsp38']")).Click();
                        Thread.Sleep(2000);

                        IWebElement         TaxPaymentTB = driver.FindElement(By.XPath("//*[@id='legalPaymentHistorySubView:legalPaymentHistoryForm:data']/tbody"));
                        IList <IWebElement> TaxPaymentTR = TaxPaymentTB.FindElements(By.TagName("tr"));
                        IList <IWebElement> TaxPaymentTD;
                        gc.CreatePdf(orderNumber, GeographicID, "Tax Payment Info", driver, "TX", "Travis");
                        foreach (IWebElement TaxPayment in TaxPaymentTR)
                        {
                            TaxPaymentTD = TaxPayment.FindElements(By.TagName("td"));
                            if (TaxPaymentTD.Count != 0)
                            {
                                Receipt               = TaxPaymentTD[0].Text;
                                Receipt_Taxyear       = TaxPaymentTD[1].Text;
                                Receipt_PaymentDate   = TaxPaymentTD[2].Text;
                                Receipt_PaymentAmount = TaxPaymentTD[3].Text;

                                TaxPayment_Details = Receipt + "~" + Receipt_Taxyear + "~" + Receipt_PaymentDate + "~" + Receipt_PaymentAmount;
                                gc.insert_date(orderNumber, GeographicID, 1094, TaxPayment_Details, 1, DateTime.Now);
                            }
                        }
                    }
                    catch
                    { }

                    List <string> ReceiptInfoTab = new List <string>();
                    try
                    {
                        var chromeOptions     = new ChromeOptions();
                        var downloadDirectory = ConfigurationManager.AppSettings["AutoPdf"];
                        chromeOptions.AddUserProfilePreference("download.default_directory", downloadDirectory);
                        chromeOptions.AddUserProfilePreference("download.prompt_for_download", false);
                        chromeOptions.AddUserProfilePreference("disable-popup-blocking", "true");
                        chromeOptions.AddUserProfilePreference("plugins.always_open_pdf_externally", true);
                        var driver1 = new ChromeDriver(chromeOptions);
                        driver1.Navigate().GoToUrl(driver.Url);

                        for (int j = 0; j < 3; j++)
                        {
                            IWebElement Receipttable = driver1.FindElement(By.XPath("//*[@id='legalPaymentHistorySubView:legalPaymentHistoryForm:data:" + j + ":_idJsp87']"));
                            string      BillTax2     = Receipttable.GetAttribute("href");
                            Receipttable.Click();
                            Thread.Sleep(3000);
                            var      files       = new DirectoryInfo(downloadDirectory).GetFiles("*.*");
                            string   latestfile  = "";
                            DateTime lastupdated = DateTime.MinValue;
                            foreach (FileInfo file in files)
                            {
                                if (file.LastWriteTime > lastupdated)
                                {
                                    lastupdated = file.LastWriteTime;
                                    latestfile  = file.Name;
                                }
                            }
                            gc.AutoDownloadFile(orderNumber, parcelNumber, "Travis", "TX", latestfile);
                        }

                        //Bill Download
                        try
                        {
                            IWebElement OriginalTaxBill = driver1.FindElement(By.Id("quickSearchSubView:quickSearchForm:_idJsp41"));
                            OriginalTax = OriginalTaxBill.GetAttribute("href");
                            string Original_Tax = gc.Between(OriginalTax, ".net/", "?").Trim();
                            OriginalTaxBill.Click();
                            Thread.Sleep(3000);
                            gc.AutoDownloadFileSpokane(orderNumber, parcelNumber, "Travis", "TX", Original_Tax + ".pdf");
                        }
                        catch
                        { }

                        try
                        {
                            IWebElement PriceTaxBill = driver1.FindElement(By.Id("quickSearchSubView:quickSearchForm:_idJsp47"));
                            PriceTax = PriceTaxBill.GetAttribute("href");
                            string priceTax_Bill = gc.Between(PriceTax, ".net/", "?").Trim();
                            PriceTaxBill.Click();
                            Thread.Sleep(3000);
                            gc.AutoDownloadFileSpokane(orderNumber, parcelNumber, "Travis", "TX", priceTax_Bill + ".pdf");
                        }
                        catch
                        { }

                        try
                        {
                            IWebElement CurrentTaxBill = driver1.FindElement(By.Id("quickSearchSubView:quickSearchForm:_idJsp50"));
                            CurrentTax = CurrentTaxBill.GetAttribute("href");
                            string Current_TaxBill = gc.Between(CurrentTax, ".net/", "?").Trim();
                            CurrentTaxBill.Click();
                            Thread.Sleep(3000);
                            gc.AutoDownloadFileSpokane(orderNumber, parcelNumber, "Travis", "TX", Current_TaxBill + ".pdf");
                        }
                        catch
                        { }

                        driver1.Quit();
                    }
                    catch
                    { }

                    try
                    {
                        driver.Navigate().GoToUrl("https://tax-office.traviscountytx.gov/contact");
                        Thread.Sleep(2000);

                        MainNumber = driver.FindElement(By.XPath("//*[@id='tab1']/div/div/p[1]")).Text;
                        MainNumber = WebDriverTest.Before(MainNumber, " Monday - Friday");

                        driver.FindElement(By.XPath("//*[@id='container']/div/div[2]/div/ul/li[2]/a")).Click();
                        Thread.Sleep(1000);
                        gc.CreatePdf(orderNumber, GeographicID, "Tax Authority", driver, "TX", "Travis");
                        Authotity     = driver.FindElement(By.XPath("//*[@id='tab2']/div/div/p[3]")).Text;
                        Tax_Authority = Authotity + " " + MainNumber;
                    }
                    catch
                    { }

                    ValueDetails1 = Tax_Year + "~" + Account + "~" + Tax_Owner + "~" + Tax_Mailing + "~" + Tax_LegalDesp + "~" + Base_Due + "~" + Penalty_Interst + "~" + OtherFee + "~" + Tax_Total + "~" + Tax_Authority + "~" + Deliquent_Comments;
                    gc.insert_date(orderNumber, GeographicID, 1079, ValueDetails1, 1, DateTime.Now);
                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

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

                    driver.Quit();
                    gc.mergpdf(orderNumber, "TX", "Travis");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw;
                }
            }
        }
Esempio n. 8
0
        public string FTP_Anoka(string address, string ownername, string assessment_id, string parcelNumber, string searchType, string orderNumber, string directParcel)
        {
            GlobalClass gc = new GlobalClass();
            string      mul;

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

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

            var driverService = PhantomJSDriverService.CreateDefaultService();

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

                    driver.Navigate().GoToUrl("https://prtinfo.co.anoka.mn.us/(kxx2oxebgw01e1450i1kvc3m)/search.aspx");
                    Thread.Sleep(4000);
                    if (searchType == "address")
                    {
                        driver.FindElement(By.Id("mSearchControl_mStreetAddress")).SendKeys(address);
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "MN", "Anoka");
                        driver.FindElement(By.Id("mSearchControl_mSubmit")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        //   gc.CreatePdf_WOP(orderNumber, "Address search result", driver, "MN", "Anoka");
                        mul = driver.FindElement(By.Id("mResultscontrol_mMessage")).Text.Trim();
                        mul = WebDriverTest.Before(mul, " records");
                        if (mul != "1")
                        {
                            //multi parcel
                            IWebElement         tbmulti2 = driver.FindElement(By.XPath("//*[@id='mResultscontrol_mResultGrid_RealDataGrid']/tbody"));
                            IList <IWebElement> TRmulti2 = tbmulti2.FindElements(By.TagName("tr"));
                            int maxCheck = 0;
                            IList <IWebElement> TDmulti2;
                            string[]            parcel = new string[3]; int p = 0;
                            foreach (IWebElement row in TRmulti2)
                            {
                                if (maxCheck <= 25)
                                {
                                    if (!row.Text.Contains("Parcel Number"))
                                    {
                                        TDmulti2 = row.FindElements(By.TagName("td"));
                                        if (TDmulti2.Count != 0 && TDmulti2.Count > 1)
                                        {
                                            if (p == 0)
                                            {
                                                parcel[0] = TDmulti2[0].Text;
                                            }
                                            if (p == 1)
                                            {
                                                parcel[1] = TDmulti2[0].Text;
                                            }
                                            if (p == 2)
                                            {
                                                parcel[2] = TDmulti2[0].Text;
                                            }
                                            p++;
                                            string multi1 = TDmulti2[1].Text + "~" + TDmulti2[2].Text;
                                            gc.insert_date(orderNumber, TDmulti2[0].Text, 283, multi1, 1, DateTime.Now);
                                        }
                                    }
                                    maxCheck++;
                                }
                            }


                            if (TRmulti2.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_Anoka_Multicount"] = "Maximum";
                                driver.Quit();
                                gc.mergpdf(orderNumber, "MN", "Anoka");
                                return("Maximum");
                            }
                            else
                            {
                                if (maxCheck == 3)
                                {
                                    if (parcel[0] == parcel[1])
                                    {
                                        IWebElement         element5 = driver.FindElement(By.XPath("//*[@id='mResultscontrol_mResultGrid_RealDataGrid']/tbody/tr[2]/td[1]/a"));
                                        IJavaScriptExecutor js5      = driver as IJavaScriptExecutor;
                                        js5.ExecuteScript("arguments[0].click();", element5);
                                        Thread.Sleep(3000);
                                    }
                                }
                                else if (maxCheck == 4)
                                {
                                    if ((parcel[0] == parcel[1]) && (parcel[1] == parcel[2]))
                                    {
                                        IWebElement         element5 = driver.FindElement(By.XPath("//*[@id='mResultscontrol_mResultGrid_RealDataGrid']/tbody/tr[2]/td[1]/a"));
                                        IJavaScriptExecutor js5      = driver as IJavaScriptExecutor;
                                        js5.ExecuteScript("arguments[0].click();", element5);
                                        Thread.Sleep(3000);
                                    }
                                }

                                else if (maxCheck > 2)
                                {
                                    HttpContext.Current.Session["multiparcel_Anoka"] = "Yes";
                                    driver.Quit();
                                    gc.mergpdf(orderNumber, "MN", "Anoka");
                                    return("MultiParcel");
                                }
                            }
                        }
                        else
                        {
                            driver.FindElement(By.XPath("//*[@id='mResultscontrol_mResultGrid_RealDataGrid']/tbody/tr[2]/td[1]/a")).Click();
                            Thread.Sleep(3000);
                            //Thread.Sleep(3000);
                        }
                    }
                    if (searchType == "titleflex")
                    {
                        gc.TitleFlexSearch(orderNumber, "", ownername, address, "MN", "Anoka");
                        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_MNAnoka"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }
                    if (searchType == "parcel")
                    {
                        //if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        //{
                        //    parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();

                        //}
                        driver.FindElement(By.Id("mSearchControl_mParcelID")).SendKeys(parcelNumber);


                        if (parcelNumber.Contains("-"))
                        {
                            parcelNumber = parcelNumber.Replace("-", "");
                        }
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search", driver, "MN", "Anoka");
                        driver.FindElement(By.Id("mSearchControl_mSubmit")).SendKeys(Keys.Enter);
                        Thread.Sleep(1000);
                        Thread.Sleep(3000);
                        // gc.CreatePdf(orderNumber, parcelNumber, "Parcel search result", driver, "MN", "Anoka");
                        try
                        {
                            mul = driver.FindElement(By.Id("mResultscontrol_mMessage")).Text.Trim();
                            mul = WebDriverTest.Before(mul, " records");
                            if (mul != "1")
                            {
                                IWebElement         tbmulti2 = driver.FindElement(By.XPath("//*[@id='mResultscontrol_mResultGrid_RealDataGrid']/tbody"));
                                IList <IWebElement> TRmulti2 = tbmulti2.FindElements(By.TagName("tr"));
                                IList <IWebElement> TDmulti2;
                                int maxCheck = 0;
                                foreach (IWebElement row in TRmulti2)
                                {
                                    if (maxCheck <= 25)
                                    {
                                        if (!row.Text.Contains("Parcel Number"))
                                        {
                                            TDmulti2 = row.FindElements(By.TagName("td"));
                                            if (TDmulti2.Count != 0 && (TDmulti2.Count > 1))
                                            {
                                                string multi1 = TDmulti2[1].Text + "~" + TDmulti2[2].Text;
                                                gc.insert_date(orderNumber, TDmulti2[0].Text, 283, multi1, 1, DateTime.Now);
                                            }
                                        }
                                        maxCheck++;
                                    }
                                }
                                if (TRmulti2.Count > 25)
                                {
                                    HttpContext.Current.Session["multiParcel_Anoka_Multicount"] = "Maximum";
                                    driver.Quit();
                                    gc.mergpdf(orderNumber, "MN", "Anoka");
                                    return("Maximum");
                                }
                                else if ((TRmulti2.Count > 2) && (TRmulti2.Count <= 25))
                                {
                                    HttpContext.Current.Session["multiparcel_Anoka"] = "Yes";
                                    driver.Quit();
                                    gc.mergpdf(orderNumber, "MN", "Anoka");
                                    return("MultiParcel");
                                }
                            }
                        }
                        catch { }
                    }

                    try
                    {
                        IWebElement INodata = driver.FindElement(By.Id("Table1"));
                        if (INodata.Text.Contains("0 records returned") && INodata.Text.Contains("No Records Found"))
                        {
                            HttpContext.Current.Session["Nodata_MNAnoka"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        IWebElement Ino = driver.FindElement(By.Id("mSearchControl_mSearchFieldsValidator"));
                        if (INodata.Text.Contains("does not exist"))
                        {
                            HttpContext.Current.Session["Nodata_MNAnoka"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }

                    //property details
                    string Property_ID = "", Situs_Address = "", Property_Description = "", Status = "", Abstract_Torrens = "", Owner = "", Lot_Size = "", Year_Built = "", City_Name = "", School_District_Number_Name = "", Property_classification_2018 = "", Property_classification_2017;
                    Property_ID = driver.FindElement(By.XPath("//*[@id='mGeneralInformation_mGrid_RealDataGrid']/tbody/tr[1]/td[2]/a")).Text.Trim();
                    if (Property_ID.Contains("-"))
                    {
                        Property_ID = Property_ID.Replace("-", "");
                    }
                    gc.CreatePdf(orderNumber, Property_ID, "information", driver, "MN", "Anoka");
                    Situs_Address        = driver.FindElement(By.XPath(" //*[@id='mGeneralInformation_mGrid_RealDataGrid']/tbody/tr[2]/td[2] ")).Text.Trim();
                    Property_Description = driver.FindElement(By.XPath(" //*[@id='mGeneralInformation_mGrid_RealDataGrid']/tbody/tr[3]/td[2] ")).Text.Trim();
                    Status           = driver.FindElement(By.XPath("//*[@id='mGeneralInformation_mGrid_RealDataGrid']/tbody/tr[8]/td[2] ")).Text.Trim();
                    Abstract_Torrens = driver.FindElement(By.XPath(" //*[@id='mGeneralInformation_mGrid_RealDataGrid']/tbody/tr[9]/td[2] ")).Text.Trim();
                    string owner1 = driver.FindElement(By.XPath("//*[@id='mParties_mGrid_RealDataGrid']/tbody/tr[2]/td[2] ")).Text.Trim();
                    string owner2 = "";
                    try
                    {
                        owner2 = driver.FindElement(By.XPath("//*[@id='mParties_mGrid_RealDataGrid']/tbody/tr[3]/td[2] ")).Text.Trim();
                    }
                    catch { }
                    if (owner2 == "")
                    {
                        Owner = owner1;
                    }
                    else
                    {
                        Owner = owner1 + " & " + owner2;
                    }
                    try
                    {
                        Lot_Size   = driver.FindElement(By.XPath("//*[@id='mPropertyCharacteristics_mPropertyCharacteristics_RealDataGrid']/tbody/tr[1]/td[2] ")).Text.Trim();
                        Year_Built = driver.FindElement(By.XPath("//*[@id='mPropertyCharacteristics_mPropertyCharacteristics_RealDataGrid']/tbody/tr[2]/td[2] ")).Text.Trim();
                    }
                    catch
                    {
                    }
                    try
                    {
                        Lot_Size   = "";
                        Year_Built = driver.FindElement(By.XPath("//*[@id='mPropertyCharacteristics_mPropertyCharacteristics_RealDataGrid']/tbody/tr[1]/td[2] ")).Text.Trim();
                    }
                    catch { }
                    City_Name = driver.FindElement(By.XPath(" //*[@id='mTaxDistrictInformation_mGrid_RealDataGrid']/tbody/tr[2]/td[2] ")).Text.Trim();
                    School_District_Number_Name = driver.FindElement(By.XPath("//*[@id='mTaxDistrictInformation_mGrid_RealDataGrid']/tbody/tr[1]/td[2] ")).Text.Trim();
                    // Property_classification_2018 = driver.FindElement(By.XPath("//*[@id='mPropertyClassification_mGrid_RealDataGrid']/tbody/tr[2]/td[2] ")).Text.Trim();
                    Property_classification_2017 = "";
                    string property_details = Situs_Address + "~" + Property_Description + "~" + Status + "~" + Abstract_Torrens + "~" + Owner + "~" + Lot_Size + "~" + Year_Built + "~" + City_Name + "~" + School_District_Number_Name + "~" + Property_classification_2018 + "~" + "";
                    gc.insert_date(orderNumber, Property_ID, 284, property_details, 1, DateTime.Now);

                    //assessment details
                    IWebElement         Assessmenttable = driver.FindElement(By.XPath("//*[@id='mValues_mGrid_RealDataGrid']/tbody"));
                    IList <IWebElement> Assessmentrow   = Assessmenttable.FindElements(By.TagName("tr"));
                    IList <IWebElement> AssessmentTD;
                    foreach (IWebElement Assessment in Assessmentrow)
                    {
                        AssessmentTD = Assessment.FindElements(By.TagName("td"));
                        if (!Assessment.Text.Contains("Tax Year"))
                        {
                            string Assessmentresult = AssessmentTD[0].Text + "~" + AssessmentTD[1].Text + "~" + AssessmentTD[2].Text;
                            gc.insert_date(orderNumber, Property_ID, 285, Assessmentresult, 1, DateTime.Now);
                        }
                    }



                    //IWebElement valuetableElement = driver.FindElement(By.XPath("//*[@id='mValues_mGrid_RealDataGrid']/tbody"));
                    //IList<IWebElement> valuetableRow = valuetableElement.FindElements(By.TagName("tr"));
                    //IList<IWebElement> valuerowTD;
                    //string year = "", Est_Market_Land = "";
                    //foreach (IWebElement row in valuetableRow)
                    //{
                    //    valuerowTD = row.FindElements(By.TagName("td"));
                    //    if (valuerowTD.Count != 0 && valuerowTD[0].Text.Trim() != "Tax Year")
                    //    {
                    //        year = valuerowTD[0].Text + "~" + year;
                    //        Est_Market_Land = valuerowTD[2].Text + "~" + Est_Market_Land;
                    //    }
                    //}
                    //year = year + "fe";
                    //string currentyear = "", prioryear = "";
                    //year = year.Replace("~fe", "");
                    //Est_Market_Land = Est_Market_Land + "fe";
                    //Est_Market_Land = Est_Market_Land.Replace("~fe", "");
                    //string[] Split1 = year.Split('~');
                    //string[] Split2 = Est_Market_Land.Split('~');
                    //for (int K = Split1.Length - 1; K >= 0; K--)
                    //{
                    //    string assessment2 = Split1[K] + "~" + Split2[K] + "~" + Split2[K - 1] + "~" + Split2[K - 2] + "~" + Split2[K - 3] + "~" + Split2[K - 4];
                    //    gc.insert_date(orderNumber, Property_ID, 285, assessment2, 1, DateTime.Now);
                    //    currentyear = Split1[K];
                    //    break;
                    //}
                    //for (int K = Split1.Length - 1; K >= 0; K--)
                    //{
                    //    if (Split1[K] != currentyear)
                    //    {
                    //        prioryear = Split1[K];
                    //        string assessment2 = Split1[K] + "~" + "-" + "~" + "-" + "~" + Split2[K] + "~" + Split2[K - 1] + "~" + Split2[K - 2];
                    //        gc.insert_date(orderNumber, Property_ID, 285, assessment2, 1, DateTime.Now);
                    //        break;
                    //    }
                    //}
                    //for (int K = Split1.Length - 1; K >= 0; K--)
                    //{
                    //    if (Split1[K] != prioryear && Split1[K] != currentyear)
                    //    {
                    //        string assessment2 = Split1[K] + "~" + "-" + "~" + "-" + "~" + Split2[K] + "~" + Split2[K - 1] + "~" + Split2[K - 2];
                    //        gc.insert_date(orderNumber, Property_ID, 285, assessment2, 1, DateTime.Now);
                    //        break;
                    //    }
                    //}
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    //tax details
                    try
                    {
                        IWebElement         tbmulti1 = driver.FindElement(By.XPath("//*[@id='mPropertyClassification_mGrid_RealDataGrid']/tbody"));
                        IList <IWebElement> TRmulti1 = tbmulti1.FindElements(By.TagName("tr"));

                        IList <IWebElement> TDmulti1;
                        foreach (IWebElement row in TRmulti1)
                        {
                            if (!row.Text.Contains("Tax Year"))
                            {
                                TDmulti1 = row.FindElements(By.TagName("td"));
                                if (TDmulti1.Count != 0)
                                {
                                    string multi1 = TDmulti1[0].Text + "~" + TDmulti1[1].Text + "~" + TDmulti1[2].Text + "~" + "Anoka County, Minnesota 2100 3rd Ave.| Anoka, MN  55303 Ph: 763-324-4000(switchboard)";
                                    gc.insert_date(orderNumber, Property_ID, 286, multi1, 1, DateTime.Now);
                                }
                            }
                        }
                    }
                    catch { }
                    //tax payment
                    try
                    {
                        IWebElement         tbmulti4 = driver.FindElement(By.XPath("//*[@id='mPaymentHistoryAnoka_mGrid_RealDataGrid']/tbody"));
                        IList <IWebElement> TRmulti4 = tbmulti4.FindElements(By.TagName("tr"));
                        IList <IWebElement> TDmulti4;
                        foreach (IWebElement row in TRmulti4)
                        {
                            if (!row.Text.Contains("Date Paid"))
                            {
                                TDmulti4 = row.FindElements(By.TagName("td"));
                                if (TDmulti4.Count != 0)
                                {
                                    string multi1 = TDmulti4[0].Text + "~" + TDmulti4[1].Text + "~" + TDmulti4[2].Text + "~" + TDmulti4[3].Text + "~" + TDmulti4[4].Text;
                                    gc.insert_date(orderNumber, Property_ID, 287, multi1, 1, DateTime.Now);
                                }
                            }
                        }
                    }
                    catch { }
                    //  Tax Installments Payable Details Table:
                    try
                    {
                        string deliquent_amount = "";
                        driver.FindElement(By.XPath("//*[@id='mTaxChargesBalancePaymentInjected_mIncludeInstallmentsCheckbox']")).Click();
                        Thread.Sleep(3000);
                        IWebElement         tbmulti5 = driver.FindElement(By.XPath("//*[@id='mGridInstallments_RealDataGrid']/tbody"));
                        IList <IWebElement> TRmulti5 = tbmulti5.FindElements(By.TagName("tr"));
                        IList <IWebElement> TDmulti5;
                        foreach (IWebElement row in TRmulti5)
                        {
                            if (!row.Text.Contains("Tax Year"))
                            {
                                TDmulti5 = row.FindElements(By.TagName("td"));
                                if (TDmulti5.Count != 0)
                                {
                                    string multi13 = TDmulti5[0].Text + "~" + TDmulti5[1].Text + "~" + TDmulti5[2].Text + "~" + TDmulti5[3].Text + "~" + TDmulti5[4].Text + "~" + TDmulti5[5].Text + "~" + TDmulti5[6].Text + "~" + TDmulti5[6].Text + "~" + "-";
                                    gc.insert_date(orderNumber, Property_ID, 288, multi13, 1, DateTime.Now);
                                }
                            }
                        }
                        try
                        {
                            string date = "";
                            int    counttd;
                            driver.FindElement(By.XPath("//*[@id='mTaxChargesBalancePaymentInjected_mIncludeDelinquentTaxYearsCheckbox']")).Click();
                            deliquent_amount = driver.FindElement(By.XPath("//*[@id='mTaxChargesBalancePaymentInjected_mDelinquentAmount']")).Text.Trim();
                            IWebElement         tbmulti6 = driver.FindElement(By.XPath(" //*[@id='mGridDelinquent_RealDataGrid']/tbody"));
                            IList <IWebElement> TRmulti6 = tbmulti6.FindElements(By.TagName("tr"));
                            IList <IWebElement> TDmulti6;
                            foreach (IWebElement row in TRmulti6)
                            {
                                if (!row.Text.Contains("Tax Year"))
                                {
                                    TDmulti6 = row.FindElements(By.TagName("td"));
                                    counttd  = TDmulti6.Count;
                                    if (TDmulti6.Count == 1)
                                    {
                                        string multi1 = "No records" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "$0.00";
                                        gc.insert_date(orderNumber, Property_ID, 288, multi1, 1, DateTime.Now);
                                    }
                                    else
                                    {
                                        string multi1 = TDmulti6[0].Text + "~" + TDmulti6[1].Text + "~" + TDmulti6[2].Text + "~" + TDmulti6[3].Text + "~" + TDmulti6[4].Text + "~" + TDmulti6[5].Text + "~" + TDmulti6[6].Text + "~" + "-" + "~" + TDmulti6[6].Text;
                                        gc.insert_date(orderNumber, Property_ID, 288, multi1, 1, DateTime.Now);
                                        driver.FindElement(By.XPath("//*[@id='mTaxChargesBalancePaymentInjected_mFuturePayoff']")).Click();
                                        Thread.Sleep(4000);

                                        IWebElement dt = driver.FindElement(By.XPath("//*[@id='mFuturePayoff_mDate']"));
                                        date = dt.GetAttribute("value");

                                        DateTime G_Date       = Convert.ToDateTime(date);
                                        string   dateChecking = DateTime.Now.ToString("MM") + "/15/" + DateTime.Now.ToString("yyyy");

                                        if (G_Date < Convert.ToDateTime(dateChecking))
                                        {
                                            //end of the month
                                            date = new DateTime(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM"))), DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(DateTime.Now.ToString("MM")))).ToString("MM/dd/yyyy");
                                        }

                                        else if (G_Date > Convert.ToDateTime(dateChecking))
                                        {
                                            // nextEndOfMonth
                                            if ((Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM"))) < 12))
                                            {
                                                date = new DateTime(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM")) + 1), DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(DateTime.Now.ToString("MM")) + 1)).ToString("MM/dd/yyyy");
                                            }
                                            else
                                            {
                                                int nxtYr = Convert.ToInt16(DateTime.Now.ToString("yyyy")) + 1;
                                                date = new DateTime(nxtYr, 1, DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), 1)).ToString("MM/dd/yyyy");
                                            }
                                        }

                                        Thread.Sleep(2000);
                                        dt.Clear();
                                        driver.FindElement(By.Id("mFuturePayoff_mDate")).SendKeys(date);
                                    }
                                    driver.FindElement(By.XPath("//*[@id='mFuturePayoff_mCalculate']")).Click();
                                    Thread.Sleep(7000);
                                    gc.CreatePdf(orderNumber, Property_ID, "Futurepayoff", driver, "MN", "Anoka");
                                    IWebElement         tbmulti51 = driver.FindElement(By.XPath("//*[@id='mFuturePayoff_mGrid_RealDataGrid']/tbody"));
                                    IList <IWebElement> TRmulti51 = tbmulti51.FindElements(By.TagName("tr"));
                                    IList <IWebElement> TDmulti51;
                                    foreach (IWebElement row1 in TRmulti51)
                                    {
                                        if (!row1.Text.Contains("Principal"))
                                        {
                                            TDmulti51 = row1.FindElements(By.TagName("td"));
                                            if (TDmulti51.Count != 0)
                                            {
                                                string fututepay = date + "~" + TDmulti51[0].Text + "~" + TDmulti51[1].Text + "~" + TDmulti51[2].Text;
                                                gc.insert_date(orderNumber, Property_ID, 289, fututepay, 1, DateTime.Now);
                                                //AsOfDate~Principal~Interest_Penalties_Costs~InstallmentTotal
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                    catch { }
                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

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

                    driver.Quit();
                    gc.mergpdf(orderNumber, "MN", "Anoka");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    throw ex;
                }
            }
        }
Esempio n. 9
0
        public string FTP_STLouis(string houseno, string sname, string sttype, string parcelNumber, string searchType, string orderNumber, string ownername, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            IWebElement iframeElement1;
            var         driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())
            {
                string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";
                string locator_no = "-", owner_name = "-", taxing_address = "-", city_name = "-", subdivison_name = "-", legal_description = "-", year_built = "-";
                string locator_num = "-", prop_location = "-", tax_authority = "St. Louis County Government,41 South Central, Clayton, Missouri 63105", dele_status = "-";


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

                    if (searchType == "titleflex")
                    {
                        string address = houseno + " " + sname;
                        gc.TitleFlexSearch(orderNumber, parcelNumber, "", address, "SC", "Charleston");
                        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_WilliamsonTX"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "address")
                    {
                        driver.Navigate().GoToUrl("http://revenue.stlouisco.com/IAS/");

                        //find ifram using xpath

                        IWebElement iframeElement = driver.FindElement(By.XPath("/html/frameset/frameset/frame[1]"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement);
                        Thread.Sleep(3000);
                        driver.FindElement(By.XPath("/html/body/form/table/tbody/tr[2]/td[1]/div[3]/span/label")).Click();
                        Thread.Sleep(3000);
                        driver.FindElement(By.XPath("//*[@id='tboxAddrNum']")).SendKeys(houseno);
                        driver.FindElement(By.XPath("//*[@id='tboxStreet']")).SendKeys(sname);
                        driver.FindElement(By.XPath("//*[@id='butFind']")).SendKeys(Keys.Enter);

                        gc.CreatePdf_WOP(orderNumber, "Address Search", driver, "MO", "Saint Louis");

                        //multi parecl
                        driver.SwitchTo().DefaultContent();
                        iframeElement1 = driver.FindElement(By.XPath("/html/frameset/frameset/frame[2]"));
                        driver.SwitchTo().Frame(iframeElement1);
                        Thread.Sleep(3000);
                        string count = driver.FindElement(By.XPath("//*[@id='labelTotalRows']")).Text.Trim();
                        if (count != "1 Record Found")
                        {
                            Multi_Parcel_Search(orderNumber);
                            driver.Quit();
                            return("MultiParcel");
                        }

                        try
                        {
                            //No Data Found
                            string nodata = driver.FindElement(By.XPath("//*[@id='panelData']")).Text;
                            if (nodata.Contains("No records were found"))
                            {
                                HttpContext.Current.Session["Nodata_StLouis"] = "Yes";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                    }
                    else if (searchType == "parcel")
                    {
                        driver.Navigate().GoToUrl("http://revenue.stlouisco.com/IAS/");
                        //find ifram using xpath
                        IWebElement iframeElement = driver.FindElement(By.XPath("/html/frameset/frameset/frame[1]"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement);
                        Thread.Sleep(3000);
                        driver.FindElement(By.XPath("//*[@id='tboxLocatorNum']")).SendKeys(parcelNumber);
                        driver.FindElement(By.XPath("//*[@id='butFind']")).SendKeys(Keys.Enter);

                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search", driver, "MO", "Saint Louis");

                        driver.SwitchTo().DefaultContent();
                        iframeElement1 = driver.FindElement(By.XPath("/html/frameset/frameset/frame[2]"));
                        driver.SwitchTo().Frame(iframeElement1);
                        try
                        {
                            //No Data Found
                            string nodata = driver.FindElement(By.XPath("//*[@id='panelData']")).Text;
                            if (nodata.Contains("No records were found"))
                            {
                                HttpContext.Current.Session["Nodata_StLouis"] = "Yes";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                    }

                    else if (searchType == "ownername")
                    {
                        driver.Navigate().GoToUrl("http://revenue.stlouisco.com/IAS/");
                        //find ifram using xpath
                        IWebElement iframeElement = driver.FindElement(By.Name("SearchInput"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement);
                        Thread.Sleep(3000);
                        driver.FindElement(By.Id("rbutName")).Click();
                        Thread.Sleep(3000);
                        string firstname = "", lastname = "";
                        if (ownername.Contains(" "))
                        {
                            string[] name = ownername.Split(' ');
                            firstname = name[0];
                            lastname  = name[1];
                            driver.FindElement(By.XPath("//*[@id='tboxLastName']")).SendKeys(firstname);
                            driver.FindElement(By.XPath("//*[@id='tboxFirstName']")).SendKeys(lastname);
                            driver.FindElement(By.XPath("//*[@id='butFind']")).SendKeys(Keys.Enter);
                        }
                        else
                        {
                            driver.FindElement(By.XPath("//*[@id='tboxLastName']")).SendKeys(ownername);
                            driver.FindElement(By.XPath("//*[@id='butFind']")).SendKeys(Keys.Enter);
                        }
                        gc.CreatePdf_WOP(orderNumber, "Owner Search", driver, "MO", "Saint Louis");

                        driver.SwitchTo().DefaultContent();
                        iframeElement1 = driver.FindElement(By.XPath("/html/frameset/frameset/frame[2]"));
                        driver.SwitchTo().Frame(iframeElement1);
                        Thread.Sleep(3000);
                        try
                        {
                            string count     = driver.FindElement(By.XPath("//*[@id='labelTotalRows']")).Text.Trim();
                            string getcount  = WebDriverTest.Before(count, "Record Found").Trim();
                            int    igetcount = Convert.ToInt16(getcount);
                            if (igetcount <= 10)
                            {
                                if (count != "1 Record Found")
                                {
                                    Multi_Parcel_Search(orderNumber);
                                    driver.Quit();
                                    return("MultiParcel");
                                }
                            }
                            else
                            {
                                HttpContext.Current.Session["multiparcel_StLouis_count"] = "Maximum";
                                return("Maximum");
                            }
                        }
                        catch
                        { }

                        try
                        {
                            string count     = driver.FindElement(By.XPath("//*[@id='labelTotalRows']")).Text.Trim();
                            string getcount  = WebDriverTest.Before(count, "Records Found").Trim();
                            int    igetcount = Convert.ToInt16(getcount);
                            if (igetcount <= 10)
                            {
                                if (count != "1 Records Found")
                                {
                                    Multi_Parcel_Search(orderNumber);
                                    driver.Quit();
                                    return("MultiParcel");
                                }
                            }
                            else
                            {
                                HttpContext.Current.Session["multiparcel_StLouis_count"] = "Maximum";
                                return("Maximum");
                            }
                        }
                        catch
                        { }


                        try
                        {
                            //No Data Found
                            string nodata = driver.FindElement(By.XPath("//*[@id='panelData']")).Text;
                            if (nodata.Contains("No records were found"))
                            {
                                HttpContext.Current.Session["Nodata_StLouis"] = "Yes";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                    }

                    //Amrock Mapping
                    Amrock amc = new Amrock();

                    //Thread.Sleep(3000);
                    //driver.SwitchTo().DefaultContent();
                    //iframeElement1 = driver.FindElement(By.XPath("/html/frameset/frameset/frame[2]"));
                    //driver.SwitchTo().Frame(iframeElement1);
                    driver.FindElement(By.XPath("/html/body/form/div[3]/center/table/tbody/tr[3]/td/table/tbody/tr[2]/td[3]/img")).Click();
                    driver.SwitchTo().DefaultContent();
                    Thread.Sleep(1000);

                    //owner ship and legal information
                    // Property Details Table.
                    IWebElement iframeElement2 = driver.FindElement(By.XPath("/html/frameset/frame"));
                    driver.SwitchTo().Frame(iframeElement2);

                    Thread.Sleep(3000);
                    //assessment details
                    locator_no = driver.FindElement(By.XPath("//*[@id='ctl00_MainContent_OwnLeg_labLocatorNum']")).Text;
                    amc.TaxId  = locator_no;
                    int                 k = 0, j = 0;
                    IWebElement         TBAssessment = driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td/table/tbody/tr[3]/td/form/table/tbody/tr/td[2]/div[3]/div[4]/div[2]/div[1]/div[2]/table/tbody"));
                    IList <IWebElement> TRAssessment = TBAssessment.FindElements(By.TagName("tr"));
                    IList <IWebElement> TDAssessment;
                    foreach (IWebElement row1 in TRAssessment)
                    {
                        TDAssessment = row1.FindElements(By.TagName("td"));
                        if (TDAssessment.Count != 0 && !row1.Text.Contains("Appraised Values") && !row1.Text.Contains("Year"))
                        {
                            try
                            {
                                //click expnad the year
                                IList <IWebElement> expand = TBAssessment.FindElements(By.XPath("//tr[contains(@id,'trAsmt')]/td[1]/img"));

                                foreach (IWebElement exe in expand)
                                {
                                    if (j > 0 && j < 3)
                                    {
                                        IJavaScriptExecutor js = driver as IJavaScriptExecutor;
                                        js.ExecuteScript("arguments[0].click();", exe);
                                        Thread.Sleep(1000);
                                    }
                                    j++;
                                }
                            }
                            catch { }

                            //store the values
                            IList <IWebElement> residential_values = TBAssessment.FindElements(By.XPath("//tr[contains(@id,'trAsmt')]"));
                            foreach (IWebElement rv in residential_values)
                            {
                                try
                                {
                                    if (k > 0 && k < 4)
                                    {
                                        //insert details
                                        TDAssessment = rv.FindElements(By.TagName("td"));
                                        string assessment_details = TDAssessment[1].Text.Trim() + "~" + TDAssessment[3].Text.Trim() + "~" + TDAssessment[4].Text.Trim() + "~" + TDAssessment[5].Text.Trim() + "~" + TDAssessment[7].Text.Trim() + "~" + TDAssessment[8].Text.Trim() + "~" + TDAssessment[9].Text.Trim();
                                        gc.insert_date(orderNumber, locator_no, 23, assessment_details, 1, DateTime.Now);
                                    }
                                    k++;
                                }
                                catch (Exception e)
                                { }
                            }

                            gc.CreatePdf(orderNumber, locator_no, "Assessment Details", driver, "MO", "Saint Louis");
                        }
                    }



                    // Property Details Table.

                    owner_name        = driver.FindElement(By.XPath("//*[@id='ctl00_MainContent_OwnLeg_labOwnerName']")).Text;
                    taxing_address    = driver.FindElement(By.XPath("//*[@id='ctl00_MainContent_OwnLeg_labTaxAddr']")).Text;
                    city_name         = driver.FindElement(By.XPath("//*[@id='ctl00_MainContent_OwnLeg_labCityName']")).Text;
                    subdivison_name   = driver.FindElement(By.XPath("//*[@id='ctl00_MainContent_OwnLeg_labSubdivisionName']")).Text;
                    legal_description = driver.FindElement(By.XPath("//*[@id='ctl00_MainContent_OwnLeg_labLegalDesc']")).Text;

                    driver.FindElement(By.ClassName("RevDeptContentLink")).SendKeys(Keys.Enter);
                    Thread.Sleep(3000);
                    gc.CreatePdf(orderNumber, locator_no, "PropertyDetails", driver, "MO", "Saint Louis");
                    Thread.Sleep(2000);
                    try
                    {
                        year_built = driver.FindElement(By.XPath("//*[@id='ctl00_MainContent_DwellingDataRes_labYearBuilt']")).Text;
                    }
                    catch { }

                    string property_details = owner_name + "~" + taxing_address + "~" + city_name + "~" + subdivison_name + "~" + legal_description + "~" + year_built;
                    if (property_details.Contains("\r\n"))
                    {
                        property_details = property_details.Replace("\r\n", "");
                        gc.insert_date(orderNumber, locator_no, 22, property_details, 1, DateTime.Now);
                        //db.ExecuteQuery("insert into data_value_master (Order_no,parcel_no,Data_Field_Text_Id,Data_Field_value,Is_Table) values ('" + orderNumber + "','" + multirowTD[0].Text.Trim() + "',19 ,'" + multi + "',1)");
                    }
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");


                    Thread.Sleep(2000);
                    //Tax amount due
                    driver.FindElement(By.XPath("//*[@id='ctl00_LeftMargin_MarginLinks_aTaxDue']")).SendKeys(Keys.Enter);
                    Thread.Sleep(3000);
                    //need to add tax authority
                    try
                    {
                        IWebElement         TBTaxDue = driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td/table/tbody/tr[3]/td/form/table/tbody/tr/td[2]/div[5]/div[2]/div[1]/table/tbody/tr[2]/td/table/tbody"));
                        IList <IWebElement> TRTaxDue = TBTaxDue.FindElements(By.TagName("tr"));
                        IList <IWebElement> TDTaxDue;
                        int i     = 0;
                        int count = TRTaxDue.Count;
                        //Amcrock
                        int assess = 0;

                        //if condition used for display two tables

                        foreach (IWebElement row1 in TRTaxDue)
                        {
                            if (!row1.Text.Contains("Locator Number") && !row1.Text.Contains("Tax Year"))
                            {
                                TDTaxDue = row1.FindElements(By.TagName("td"));
                                int TDcount = TDTaxDue.Count();
                                if (TDcount == 8)
                                {
                                    //insert details
                                    string Tax_details = TDTaxDue[0].Text.Trim() + "~" + TDTaxDue[1].Text.Trim() + "~" + TDTaxDue[2].Text.Trim() + "~" + TDTaxDue[3].Text.Trim() + "~" + TDTaxDue[4].Text.Trim() + "~" + TDTaxDue[5].Text.Trim() + "~" + TDTaxDue[6].Text.Trim() + "~" + TDTaxDue[7].Text.Trim() + "~" + "-" + "~" + "-";
                                    gc.insert_date(orderNumber, locator_no, 24, Tax_details, 1, DateTime.Now);
                                    //Amcrock
                                    if (assess < 2 && row1.Text.Contains("Total:"))
                                    {
                                        assess++;
                                        if (assess == 1)
                                        {
                                            //amc.Land = TDTaxDue[5].Text.Trim();
                                            //amc.Building = TDTaxDue[6].Text.Trim();
                                            //amc.Assess = TDTaxDue[7].Text.Trim();
                                        }
                                    }
                                }

                                if (TDcount == 6 || TDcount == 2)
                                {
                                    if (i < count - 3)
                                    {
                                        //insert details
                                        string Tax_details = TDTaxDue[0].Text.Trim() + "~" + TDTaxDue[1].Text.Trim() + "~" + TDTaxDue[2].Text.Trim() + "~" + TDTaxDue[3].Text.Trim() + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + TDTaxDue[4].Text.Trim() + "~" + TDTaxDue[5].Text.Trim();
                                        gc.insert_date(orderNumber, locator_no, 24, Tax_details, 1, DateTime.Now);
                                    }
                                    if (i == count - 3)
                                    {
                                        //insert details
                                        string Tax_details = TDTaxDue[0].Text.Replace(">>", "").Trim() + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + TDTaxDue[1].Text.Trim();
                                        gc.insert_date(orderNumber, locator_no, 24, Tax_details, 1, DateTime.Now);
                                    }

                                    i++;
                                }
                            }
                        }

                        gc.CreatePdf(orderNumber, locator_no, "tax Details", driver, "MO", "Saint Louis");
                    }
                    catch (Exception e) { }

                    driver.Navigate().Back();
                    Thread.Sleep(3000);
                    //Tax History
                    driver.SwitchTo().DefaultContent();
                    Thread.Sleep(3000);
                    IWebElement iframeElement21 = driver.FindElement(By.XPath("/html/frameset/frame"));
                    driver.SwitchTo().Frame(iframeElement21);
                    Thread.Sleep(3000);
                    driver.FindElement(By.Id("ctl00_LeftMargin_MarginLinks_aTaxHistory")).SendKeys(Keys.Enter);
                    Thread.Sleep(3000);
                    locator_num   = driver.FindElement(By.XPath("//*[@id='ctl00_MainContent_RealEstateHistoryData1_labelLocatorNum']")).Text;
                    owner_name    = driver.FindElement(By.XPath("//*[@id='ctl00_MainContent_RealEstateHistoryData1_labelOwner']")).Text;
                    prop_location = driver.FindElement(By.XPath("//*[@id='ctl00_MainContent_RealEstateHistoryData1_labelLocation']")).Text;

                    IWebElement         TBTax_History = driver.FindElement(By.XPath("//*[@id='ctl00_MainContent_RealEstateHistoryData1_tableTaxHistory']/tbody"));
                    IList <IWebElement> TRTax_History = TBTax_History.FindElements(By.TagName("tr"));
                    IList <IWebElement> TDTax_History;
                    int a = 0;
                    foreach (IWebElement row1 in TRTax_History)
                    {
                        if (!row1.Text.Contains("Tax Year"))
                        {
                            if (a < 3)
                            {
                                TDTax_History = row1.FindElements(By.TagName("td"));
                                //insert details
                                string TaxHistory_details = owner_name + "~" + prop_location + "~" + TDTax_History[0].Text.Trim() + "~" + TDTax_History[2].Text.Trim() + "~" + TDTax_History[3].Text.Trim() + "~" + TDTax_History[4].Text.Trim() + "~" + TDTax_History[5].Text.Trim() + "~" + TDTax_History[6].Text.Trim() + "~" + TDTax_History[7].Text.Trim() + "~" + tax_authority + "~" + "-";
                                gc.insert_date(orderNumber, locator_num, 25, TaxHistory_details, 1, DateTime.Now);
                            }

                            a++;
                        }
                    }

                    driver.Navigate().Back();
                    Thread.Sleep(3000);
                    //Tax Due
                    driver.SwitchTo().DefaultContent();
                    Thread.Sleep(3000);
                    IWebElement iframeEle = driver.FindElement(By.XPath("/html/frameset/frame"));
                    driver.SwitchTo().Frame(iframeEle);
                    Thread.Sleep(3000);
                    driver.FindElement(By.Id("ctl00_LeftMargin_MarginLinks_aTaxDue")).SendKeys(Keys.Enter);
                    Thread.Sleep(3000);
                    //Amcrock Tax Details
                    string      TaxesDueStatus = driver.FindElement(By.Id("ctl00_MainContent_TaxesDueData1_labelPageHeader")).Text;
                    int         countdue       = 0;
                    IWebElement ITaxes         = null;
                    try
                    {
                        ITaxes = driver.FindElement(By.XPath("//*[@id='ctl00_MainContent_TaxesDueData1_tableTaxPaidRE']/tbody"));
                    }
                    catch { }
                    try
                    {
                        ITaxes = driver.FindElement(By.Id("ctl00_MainContent_TaxesDueData1_panelTaxesDueRE"));
                    }
                    catch { }
                    IList <IWebElement> TRITaxes = ITaxes.FindElements(By.TagName("tr"));
                    IList <IWebElement> TDITaxes;
                    foreach (IWebElement row1 in TRITaxes)
                    {
                        TDITaxes = row1.FindElements(By.XPath("td"));
                        if (!row1.Text.Contains("Tax Year") && TDITaxes.Count != 0 && TDITaxes.Count == 8 && TRITaxes.Count == 3)
                        {
                            string taxyear  = TDITaxes[0].Text;
                            string Interest = TDITaxes[2].Text;
                            string penality = TDITaxes[3].Text;
                            if (Interest == ("$0.00") && penality == ("$0.00"))
                            {
                                amc.Instamount1     = TDITaxes[5].Text; //Total Tax
                                amc.Instamountpaid1 = TDITaxes[6].Text; //Amount Paid
                            }
                            if (TaxesDueStatus.Contains("No Taxes Are Due"))
                            {
                                amc.InstPaidDue1 = "Paid";
                                amc.IsDelinquent = "No";
                            }
                        }
                        if (!row1.Text.Contains("Tax Year") && TDITaxes.Count != 0 && TDITaxes.Count == 6 && TRITaxes.Count >= 3)
                        {
                            string Interest = TDITaxes[2].Text;
                            string penality = TDITaxes[3].Text;
                            string total    = TDITaxes[5].Text;
                            if (Interest != ("$0.00") && penality != ("$0.00") && !total.Contains("$0.00"))
                            {
                                countdue++;
                            }
                        }
                        if (!row1.Text.Contains("Tax Year") && TDITaxes.Count != 0 && TDITaxes.Count == 6 && TRITaxes.Count == 3)
                        {
                            string Interest = TDITaxes[2].Text;
                            string penality = TDITaxes[3].Text;
                            string total    = TDITaxes[5].Text;
                            if (Interest == ("$0.00") && penality == ("$0.00") && !total.Contains("$0.00"))
                            {
                                amc.Instamountpaid1 = TDITaxes[6].Text; //Amount Paid
                                amc.InstPaidDue1    = "Due";
                                amc.IsDelinquent    = "No";
                            }
                        }
                        if (!row1.Text.Contains("Tax Year") && TDITaxes.Count != 0 && TDITaxes.Count == 8 && TRITaxes.Count == 3)
                        {
                            string Interest = TDITaxes[2].Text;
                            string penality = TDITaxes[3].Text;
                            if (Interest != ("$0.00") && penality != ("$0.00") && TaxesDueStatus.Contains("No Taxes Are Due"))
                            {
                                amc.IsDelinquent = "Yes";
                            }
                        }
                    }

                    if (countdue > 0)
                    {
                        amc.IsDelinquent = "Yes";
                    }

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

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


                    gc.CreatePdf(orderNumber, locator_no, "Tax_History", driver, "MO", "Saint Louis");

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

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

                    gc.insert_TakenTime(orderNumber, "MO", "Saint Louis", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);


                    driver.Quit();
                    gc.mergpdf(orderNumber, "MO", "Saint Louis");
                    return("Data Inserted Successfully");
                }

                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw ex;
                }
            }
        }
Esempio n. 10
0
        public string FTP_CAYolo(string address, string assessment_id, string parcelNumber, string searchType, string orderNumber, string directParcel, string ownername)
        {
            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "", AssessTakenTime = "", TaxTakentime = "", CityTaxtakentime = "";
            string TotaltakenTime = "";

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

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

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

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

                    try
                    {
                        IWebElement Inodata = driver.FindElement(By.XPath("/html/body/form/center/table/tbody"));
                        if (Inodata.Text.Contains("Field") && Inodata.Text.Contains("Search Type") && Inodata.Text.Contains("Value") && Inodata.Text.Contains("Assessor Inquiry: Please enter search criteria"))
                        {
                            HttpContext.Current.Session["Nodata_CAYolo"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }
                    IWebElement runButton = driver.FindElement(By.XPath("/html/body/form/center/table/tbody/tr[2]/td[1]/a"));
                    runButton.Click();
                    Thread.Sleep(4000);

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

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

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

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

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

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

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

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

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

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

                        driver.FindElement(By.XPath("/html/body/div[2]/section/div/div[1]/div/div[6]/ul/li[3]/a")).Click();
                        Thread.Sleep(3000);
                        gc.CreatePdf(orderNumber, Parcel_id, "Tax code" + pdf, driver, "CA", "Yolo");
                        driver.SwitchTo().Window(driver.WindowHandles.Last());
                        int      count       = driver.FindElements(By.XPath("//*[@id='h2tab3']/div")).Count;
                        int      divCount2   = count + 1;
                        string[] TaxCode     = new string[divCount2];
                        string[] description = new string[divCount2];
                        string[] rate        = new string[divCount2];
                        string[] Istinstall  = new string[divCount2];
                        string[] IIndinstall = new string[divCount2];
                        string[] total       = new string[divCount2];
                        string[] phone       = new string[divCount2];
                        for (int i = 1; i <= count; i++)
                        {
                            string Description1 = driver.FindElement(By.XPath(" //*[@id='h2tab3']/div[" + i + "]/div/div/dl")).Text.Trim().Replace("\r\n", "");
                            TaxCode[i]     = gc.Between(Description1, "Tax Code", "Description").Trim();
                            description[i] = gc.Between(Description1, "Description", "Rate").Trim();
                            rate[i]        = gc.Between(Description1, "Rate", "1st Installment").Trim();
                            Istinstall[i]  = gc.Between(Description1, "1st Installment", "2nd Installment").Trim();
                            IIndinstall[i] = gc.Between(Description1, "2nd Installment", "Total").Trim();
                            total[i]       = gc.Between(Description1, "Total", "Phone").Trim();
                            phone[i]       = WebDriverTest.After(Description1, "Phone");
                            string taxcode = Tax_year + "~" + TaxCode[i] + "~" + description[i] + "~" + rate[i] + "~" + Istinstall[i] + "~" + IIndinstall[i] + "~" + total[i] + "~" + phone[i];
                            gc.insert_date(orderNumber, Parcel_id, 516, taxcode, 1, DateTime.Now);
                        }
                        //Tax Year~Tax Code~Description~Rate~1st Installment~2nd Installment~Total~Phone

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

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

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

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

                catch (Exception ex)
                {
                    driver.Quit();
                    throw ex;
                }
            }
        }
Esempio n. 11
0
        public string FTP_WVBerkeley(string houseno, string housedir, string sname, string sttype, string unitno, string parcelNumber, string searchType, string orderno, string ownername, string directParcel)
        {
            GlobalClass.global_orderNo             = orderno;
            HttpContext.Current.Session["orderNo"] = orderno;
            GlobalClass.global_parcelNo            = parcelNumber;
            string District = "", Map = "", Pacel = "", SubParcel = "";

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

            var driverService = PhantomJSDriverService.CreateDefaultService();

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

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

                    if (searchType == "titleflex")
                    {
                        string titleaddress = houseno + " " + sname;
                        gc.TitleFlexSearch(orderno, "", "", titleaddress, "WV", "Berkeley");

                        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_WVBerkeley"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "parcel")
                    {
                        driver.Navigate().GoToUrl("http://taxinq.berkeleywv.org/index.html");
                        Thread.Sleep(3000);

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

                        string CommonParcel = parcelNumber;

                        if (CommonParcel.Length == 11)
                        {
                            District  = parcelNumber.Substring(0, 2);
                            Map       = parcelNumber.Substring(2, 1);
                            Pacel     = parcelNumber.Substring(3, 4);
                            SubParcel = parcelNumber.Substring(7, 4);
                        }
                        if (CommonParcel.Length == 12)
                        {
                            District  = parcelNumber.Substring(0, 2);
                            Map       = parcelNumber.Substring(2, 2);
                            Pacel     = parcelNumber.Substring(4, 4);
                            SubParcel = parcelNumber.Substring(8, 4);
                        }
                        if (CommonParcel.Length == 13)
                        {
                            District  = parcelNumber.Substring(0, 2);
                            Map       = parcelNumber.Substring(2, 3);
                            Pacel     = parcelNumber.Substring(5, 4);
                            SubParcel = parcelNumber.Substring(9, 4);
                        }
                        if (CommonParcel.Length == 14)
                        {
                            District  = parcelNumber.Substring(0, 2);
                            Map       = parcelNumber.Substring(2, 4);
                            Pacel     = parcelNumber.Substring(6, 4);
                            SubParcel = parcelNumber.Substring(10, 4);
                        }
                        if (CommonParcel.Length == 17)
                        {
                            District  = parcelNumber.Substring(0, 2);
                            Map       = parcelNumber.Substring(2, 3);
                            Pacel     = parcelNumber.Substring(5, 4);
                            SubParcel = parcelNumber.Substring(9, 4);
                            try
                            {
                                string SubParcel1 = parcelNumber.Substring(13, 4);
                            }
                            catch
                            { }
                        }

                        var SelectDistrict  = driver.FindElement(By.Name("DIST"));
                        var SelectDistrict1 = new SelectElement(SelectDistrict);
                        SelectDistrict1.SelectByValue(District);

                        var SelectMap  = driver.FindElement(By.Name("MAP"));
                        var SelectMap1 = new SelectElement(SelectMap);
                        SelectMap1.SelectByText(Map);

                        var SelectParcel  = driver.FindElement(By.Name("PARC"));
                        var SelectParcel1 = new SelectElement(SelectParcel);
                        SelectParcel1.SelectByText(Pacel);

                        var SelectSubParcel  = driver.FindElement(By.Name("SPAR"));
                        var SelectSubParcel1 = new SelectElement(SelectSubParcel);
                        SelectSubParcel1.SelectByText(SubParcel);
                        gc.CreatePdf(orderno, parcelNumber, "Parcel search", driver, "WV", "Berkeley");

                        driver.FindElement(By.XPath("/html/body/center/table[2]/tbody/tr[4]/td[2]/form/input[4]")).Click();
                        Thread.Sleep(2000);
                        gc.CreatePdf(orderno, parcelNumber, "Multi Parcel search", driver, "WV", "Berkeley");

                        //Parcel Search
                        List <string> ParcelSearch = new List <string>();

                        try
                        {
                            IWebElement         ParcelTB = driver.FindElement(By.XPath("//*[@id='inside']/div/div[1]/table[1]/tbody"));
                            IList <IWebElement> ParcelTR = ParcelTB.FindElements(By.TagName("tr"));
                            IList <IWebElement> ParcelTD;
                            gc.CreatePdf_WOP(orderno, "Parcel MultiParcel search", driver, "WV", "Berkeley");

                            int i = 0;
                            foreach (IWebElement Parcel in ParcelTR)
                            {
                                if (i > 2)
                                {
                                    ParcelTD = Parcel.FindElements(By.TagName("td"));
                                    if (ParcelTD.Count != 0 && !Parcel.Text.Contains("PP"))
                                    {
                                        IWebElement ParcelBill_link = ParcelTD[0].FindElement(By.TagName("a"));
                                        string      Parcelurl       = ParcelBill_link.GetAttribute("href");
                                        ParcelSearch.Add(Parcelurl);
                                    }
                                }
                                i++;
                            }

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

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

                                //Tax Information
                                try
                                {
                                    Tax_Authority = driver.FindElement(By.XPath("/html/body/div[1]/center/div[1]/table/tbody/tr[4]/td/table/tbody/tr/td/font")).Text.Replace("\r\n", "");

                                    Tax_Year      = driver.FindElement(By.XPath("//*[@id='body']/div[1]/div")).Text;
                                    Ticket_Numbet = driver.FindElement(By.XPath("//*[@id='body']/table[1]/tbody/tr[1]/td[2]")).Text;
                                    try
                                    {
                                        Tax_Class = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[3]/td/table/tbody/tr/td[2]")).Text;
                                        Spl_Desp  = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[3]/td/table/tbody/tr/td[12]")).Text;

                                        if (Spl_Desp == "Delinquent")
                                        {
                                            Home_Exp    = "Yes";
                                            Back_Tax    = "Yes";
                                            Exoneration = "Yes";
                                            Propr_del   = "Yes";
                                        }
                                        else
                                        {
                                            Home_Exp    = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[3]/td/table/tbody/tr/td[4]")).Text;
                                            Back_Tax    = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[3]/td/table/tbody/tr/td[6]")).Text;
                                            Exoneration = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[3]/td/table/tbody/tr/td[8]")).Text;
                                            Propr_del   = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[3]/td/table/tbody/tr/td[10]")).Text;
                                        }
                                    }
                                    catch
                                    { }

                                    First_Half  = driver.FindElement(By.XPath("//*[@id='body']/div[2]/table/tbody/tr/td[3]")).Text.Replace("\r\n", "");
                                    Second_Half = driver.FindElement(By.XPath("//*[@id='body']/div[2]/table/tbody/tr/td[5]")).Text.Replace("\r\n", "");
                                    Total_Due   = driver.FindElement(By.XPath("//*[@id='body']/div[2]/table/tbody/tr/td[7]")).Text.Replace("\r\n", "");

                                    Tax_Details = Tax_Year + "~" + Ticket_Numbet + "~" + Tax_Class + "~" + Home_Exp + "~" + Back_Tax + "~" + Exoneration + "~" + Propr_del + "~" + Spl_Desp + "~" + First_Half + "~" + Second_Half + "~" + Total_Due + "~" + Tax_Authority;
                                    gc.insert_date(orderno, parcelNumber, 571, Tax_Details, 1, DateTime.Now);
                                }
                                catch
                                { }

                                //Payment Details
                                try
                                {
                                    IWebElement         PaymentTB = driver.FindElement(By.XPath("//*[@id='body']/table[3]/tbody/tr/td[3]/table/tbody"));
                                    IList <IWebElement> PaymentTR = PaymentTB.FindElements(By.TagName("tr"));
                                    IList <IWebElement> PaymentTD;

                                    foreach (IWebElement Payment in PaymentTR)
                                    {
                                        PaymentTD = Payment.FindElements(By.TagName("td"));
                                        if (PaymentTD.Count != 0 && !Payment.Text.Contains("First Half"))
                                        {
                                            Installment = PaymentTD[0].Text;
                                            FirstHlf    = PaymentTD[1].Text;
                                            Scndhlf     = PaymentTD[2].Text;

                                            Payment_details = Installment + "~" + FirstHlf + "~" + Scndhlf;
                                            gc.insert_date(orderno, parcelNumber, 572, Payment_details, 1, DateTime.Now);
                                        }
                                    }
                                }
                                catch
                                { }
                            }
                        }
                        catch
                        { }
                    }

                    else if (searchType == "ownername")
                    {
                        driver.Navigate().GoToUrl("http://taxinq.berkeleywv.org/index.html");
                        Thread.Sleep(2000);

                        driver.FindElement(By.Name("TPNAME")).SendKeys(ownername);
                        driver.FindElement(By.XPath("/html/body/center/table[2]/tbody/tr[1]/td[2]/form/input")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);

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

                        try
                        {
                            IWebElement         OwnerTB = driver.FindElement(By.XPath("//*[@id='inside']/div/div[1]/table[1]/tbody"));
                            IList <IWebElement> OwnerTR = OwnerTB.FindElements(By.TagName("tr"));
                            IList <IWebElement> OwnerTD;
                            gc.CreatePdf_WOP(orderno, "Multi Owner search", driver, "WV", "Berkeley");

                            int maxCheck = 0;

                            foreach (IWebElement Owner in OwnerTR)
                            {
                                OwnerTD = Owner.FindElements(By.TagName("td"));
                                if (OwnerTD.Count != 0 && !Owner.Text.Contains("PP"))
                                {
                                    IWebElement Bill_link = OwnerTD[0].FindElement(By.TagName("a"));
                                    string      url       = Bill_link.GetAttribute("href");
                                    OwnerSearch.Add(url);
                                }
                            }

                            foreach (string bill in OwnerSearch)
                            {
                                if (maxCheck <= 25)
                                {
                                    driver.Navigate().GoToUrl(bill);
                                    Thread.Sleep(3000);

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

                                    string Dis = driver.FindElement(By.XPath("//*[@id='body']/table[1]/tbody/tr[2]/td[2]")).Text;
                                    Dis = WebDriverTest.Before(Dis, "-").Replace(" ", "");

                                    string mp = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[2]/td/table/tbody/tr[1]/td[2]")).Text;

                                    string Pa = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[2]/td/table/tbody/tr[1]/td[4]")).Text;

                                    string a = Pa.Substring(0, 4);
                                    string b = Pa.Substring(5, 5);
                                    string c = Pa.Substring(11, 5);

                                    Pa           = a + b + c;
                                    parcelNumber = Dis + "-" + mp + "-" + Pa;

                                    TaxPyrName = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[1]/td[1]/table/tbody/tr[1]/td[2]")).Text;
                                    Address    = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[1]/td[1]/table/tbody/tr[3]/td[2]")).Text;
                                    Type       = "RE";

                                    string MultiOwner_details = Type + "~" + TaxPyrName + "~" + Address;
                                    gc.insert_date(orderno, parcelNumber, 573, MultiOwner_details, 1, DateTime.Now);
                                }
                                maxCheck++;
                            }
                            if (OwnerTR.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_Berkeley_Multicount"] = "Maximum";
                            }
                            else
                            {
                                HttpContext.Current.Session["multiparcel_Berkeley"] = "Yes";
                            }
                            driver.Quit();

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

                    else if (searchType == "block")
                    {
                        driver.Navigate().GoToUrl("http://taxinq.berkeleywv.org/index.html");
                        Thread.Sleep(2000);

                        driver.FindElement(By.Name("TPACCT")).SendKeys(unitno);
                        driver.FindElement(By.XPath("/html/body/center/table[2]/tbody/tr[2]/td[2]/form/input")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);

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

                        try
                        {
                            IWebElement         AccountTB = driver.FindElement(By.XPath("//*[@id='inside']/div/div[1]/table[1]/tbody"));
                            IList <IWebElement> AccountTR = AccountTB.FindElements(By.TagName("tr"));
                            IList <IWebElement> AccountTD;
                            gc.CreatePdf_WOP(orderno, "Account Owner search", driver, "WV", "Berkeley");

                            int maxCheck = 0;

                            foreach (IWebElement Account in AccountTR)
                            {
                                AccountTD = Account.FindElements(By.TagName("td"));
                                if (AccountTD.Count != 0 && !Account.Text.Contains("PP"))
                                {
                                    IWebElement AccountBill_link = AccountTD[0].FindElement(By.TagName("a"));
                                    string      Accounturl       = AccountBill_link.GetAttribute("href");
                                    AccountSearch.Add(Accounturl);
                                }
                            }

                            foreach (string Accountbill in AccountSearch)
                            {
                                if (maxCheck <= 25)
                                {
                                    driver.Navigate().GoToUrl(Accountbill);
                                    Thread.Sleep(3000);

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

                                    string Dis1 = driver.FindElement(By.XPath("//*[@id='body']/table[1]/tbody/tr[2]/td[2]")).Text;
                                    Dis1 = WebDriverTest.Before(Dis1, "-").Replace(" ", "");

                                    string mp1 = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[2]/td/table/tbody/tr[1]/td[2]")).Text;

                                    string Pa1 = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[2]/td/table/tbody/tr[1]/td[4]")).Text;

                                    string a1 = Pa1.Substring(0, 4);
                                    string b1 = Pa1.Substring(5, 5);
                                    string c1 = Pa1.Substring(11, 5);

                                    Pa1          = a1 + b1 + c1;
                                    parcelNumber = Dis1 + "-" + mp1 + "-" + Pa1;

                                    TaxPyrName = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[1]/td[1]/table/tbody/tr[1]/td[2]")).Text;
                                    Address    = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[1]/td[1]/table/tbody/tr[3]/td[2]")).Text;
                                    Type       = "RE";

                                    string MultiAccount_details = Type + "~" + TaxPyrName + "~" + Address;
                                    gc.insert_date(orderno, parcelNumber, 573, MultiAccount_details, 1, DateTime.Now);
                                }
                                maxCheck++;
                            }

                            if (AccountTR.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_Berkeley_Multicount"] = "Maximum";
                                driver.Quit();
                                return("Maximum");
                            }
                            else if (AccountTR.Count <= 25 && AccountTR.Count > 1)
                            {
                                HttpContext.Current.Session["multiparcel_Berkeley"] = "Yes";
                                driver.Quit();
                                return("MultiParcel");
                            }
                        }
                        catch { }
                    }

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

                    try
                    {
                        IWebElement         INodata    = driver.FindElement(By.XPath("//*[@id='inside']/div/div[1]/table[1]"));
                        IList <IWebElement> INodataRow = INodata.FindElements(By.TagName("td"));
                        foreach (IWebElement data in INodataRow)
                        {
                            if (data.Text.Contains("No matches found."))
                            {
                                HttpContext.Current.Session["Nodata_WVBerkeley"] = "Zero";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        if (INodataRow.Count <= 1)
                        {
                            HttpContext.Current.Session["Nodata_WVBerkeley"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }

                    //Property Details
                    try
                    {
                        Account_Number = driver.FindElement(By.XPath("//*[@id='body']/table[1]/tbody/tr[1]/td[4]")).Text;
                        Pro_District   = driver.FindElement(By.XPath("//*[@id='body']/table[1]/tbody/tr[2]/td[2]")).Text;
                        Owner_Name     = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[1]/td[1]/table/tbody/tr[1]/td[2]")).Text;
                        Pro_Address    = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[1]/td[1]/table/tbody/tr[3]/td[2]")).Text;
                        Legel_Desp1    = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[1]/td[2]/table/tbody/tr[1]/td[2]")).Text;
                        Legel_Desp2    = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[1]/td[2]/table/tbody/tr[2]/td")).Text;
                        Legel_Desp     = Legel_Desp1 + Legel_Desp2;
                        Pro_Map        = driver.FindElement(By.XPath("//*[@id='body']/table[2]/tbody/tr[2]/td/table/tbody/tr[1]/td[2]")).Text;

                        Property_Details = Account_Number + "~" + Pro_District + "~" + Pro_Map + "~" + Owner_Name + "~" + Pro_Address + "~" + Legel_Desp;
                        gc.CreatePdf(orderno, parcelNumber, "Property Details", driver, "WV", "Berkeley");
                        gc.insert_date(orderno, parcelNumber, 569, Property_Details, 1, DateTime.Now);
                    }
                    catch
                    { }

                    //Assessment Details
                    try
                    {
                        IWebElement         PropertyTB = driver.FindElement(By.XPath("//*[@id='body']/table[3]/tbody/tr/td[1]/table/tbody"));
                        IList <IWebElement> PropertyTR = PropertyTB.FindElements(By.TagName("tr"));
                        IList <IWebElement> PropertyTD;

                        foreach (IWebElement Property in PropertyTR)
                        {
                            PropertyTD = Property.FindElements(By.TagName("td"));
                            if (PropertyTD.Count != 0 && !Property.Text.Contains("Assessment"))
                            {
                                Assessment = PropertyTD[0].Text;
                                Gross      = PropertyTD[1].Text;
                                Net        = PropertyTD[2].Text;

                                Assessment_details = Assessment + "~" + Gross + "~" + Net;
                                gc.insert_date(orderno, parcelNumber, 570, Assessment_details, 1, DateTime.Now);
                            }
                        }
                    }
                    catch
                    { }
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

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

                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderno, "WV", "Berkeley", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderno, "WV", "Berkeley");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderno);
                    throw;
                }
            }
        }
Esempio n. 12
0
        public void taxdetails_previousyear(string orderno, string parcelno)
        {
            //*[@id="Table5"]
            IWebElement         taxbilltable    = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_tblBills']"));
            IList <IWebElement> taxbilltableRow = taxbilltable.FindElements(By.TagName("tr"));
            int rowcount = taxbilltableRow.Count;
            IList <IWebElement> taxbillrowTD;
            List <string>       listurl = new List <string>();

            foreach (IWebElement rownew in taxbilltableRow)
            {
                taxbillrowTD = rownew.FindElements(By.TagName("a"));
                if (taxbillrowTD.Count != 0 && !rownew.Text.Contains("Installment"))
                {
                    string url = taxbillrowTD[0].GetAttribute("href");
                    if (!url.Contains("pdf"))
                    {
                        listurl.Add(url);
                    }
                }
            }

            foreach (string URL in listurl)
            {
                driver.Navigate().GoToUrl(URL);
                Thread.Sleep(2000);
                string bill_number = "", fiscal_year = "", tax_rate_area1 = "", total_amount_due = "", bill_type = "", prop_address1 = "";
                string inst = "", delinq_date = "", amount = "", statuss = "", paid_amount = "", paid_date = "", penalty1 = "", penalty = "";
                string inst1 = "", delinq_date1 = "", amount1 = "", status1 = "", paid_amount1 = "", paid_date1 = "", comment = "";
                try
                {
                    bill_number      = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblBillNumber")).Text.Trim();
                    fiscal_year      = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblTaxYear")).Text.Trim();
                    fiscal_year      = WebDriverTest.After(fiscal_year, "For the fiscal year").Trim();
                    tax_rate_area1   = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblTaxRateArea")).Text.Trim();
                    total_amount_due = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblTotalAmountDue")).Text.Trim();
                    bill_type        = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblBillType")).Text.Trim();
                    prop_address1    = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblAddress")).Text.Trim();
                    if (prop_address1.Contains("\r\n"))
                    {
                        prop_address1 = prop_address1.Replace("\r\n", ",");
                    }

                    gc.CreatePdf(orderno, parcelno, "TaxSummary_" + fiscal_year + "_" + bill_number, driver, "CA", "Kern");
                    IWebElement         insttable    = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_tblInstallments']"));
                    IList <IWebElement> insttableRow = insttable.FindElements(By.TagName("tr"));
                    int instrowcount = insttableRow.Count;
                    IList <IWebElement> instrowTD;
                    int i = 1;
                    foreach (IWebElement rownew1 in insttableRow)
                    {
                        instrowTD = rownew1.FindElements(By.TagName("td"));
                        if (instrowTD.Count != 0)
                        {
                            try
                            {
                                if (instrowTD[0].Text.Contains("Please note"))
                                {
                                }
                                if (instrowTD[1].Text.Contains("Bill was cancelled"))
                                {
                                    comment = instrowTD[1].Text.Trim();
                                    if (comment.Contains("\r\n"))
                                    {
                                        comment = comment.Replace("\r\n", "");
                                    }
                                }
                                if (instrowTD[1].Text.Contains("Bill has been redeemed"))
                                {
                                    comment = instrowTD[1].Text.Trim();
                                    if (comment.Contains("\r\n"))
                                    {
                                        comment = comment.Replace("\r\n", "");
                                    }
                                }
                                if (instrowTD[1].Text.Contains("This property has had multiple owners during the year"))
                                {
                                    comment = instrowTD[1].Text.Trim();
                                    if (comment.Contains("\r\n"))
                                    {
                                        comment = comment.Replace("\r\n", "");
                                    }
                                }
                                if (instrowTD[1].Text.Contains("First"))
                                {
                                    string bulk_status = instrowTD[4].Text.Trim();
                                    statuss = WebDriverTest.Before(bulk_status, "$").Trim();
                                    if (statuss.Contains("Paid"))
                                    {
                                        inst        = instrowTD[1].Text.Trim(); delinq_date = instrowTD[2].Text.Trim(); amount = instrowTD[3].Text.Trim();
                                        paid_amount = gc.Between(bulk_status, "Paid", "on").Trim();
                                        paid_date   = WebDriverTest.After(bulk_status, "on").Trim();
                                    }
                                    inst        = instrowTD[1].Text.Trim();
                                    delinq_date = instrowTD[2].Text.Trim();
                                    amount      = instrowTD[3].Text.Trim();
                                }

                                if (instrowTD[1].Text.Contains("Second"))
                                {
                                    string bulk_status1 = instrowTD[4].Text.Trim();
                                    status1 = WebDriverTest.Before(bulk_status1, "$").Trim();
                                    if (status1.Contains("Paid"))
                                    {
                                        inst1        = instrowTD[1].Text.Trim(); delinq_date1 = instrowTD[2].Text.Trim(); amount1 = instrowTD[3].Text.Trim();
                                        paid_amount1 = gc.Between(bulk_status1, "Paid", "on").Trim();
                                        paid_date1   = WebDriverTest.After(bulk_status1, "on").Trim();
                                    }
                                    inst1 = instrowTD[1].Text.Trim(); delinq_date1 = instrowTD[2].Text.Trim(); amount1 = instrowTD[3].Text.Trim();
                                }
                                if (instrowTD[1].Text.Contains("Second") && instrowTD[4].Text.Contains("Unpaid"))
                                {
                                    inst1        = instrowTD[1].Text.Trim();
                                    delinq_date1 = instrowTD[2].Text.Trim();
                                    amount1      = instrowTD[3].Text.Trim();
                                    string bulk_stat = instrowTD[4].Text.Trim();
                                    status1 = WebDriverTest.Before(bulk_stat, "$").Trim();
                                }
                                if (instrowTD[0].Text.Contains("Penalty if Delinquent"))
                                {
                                    delinq_date1 = delinq_date1 + "(Penalty if Delinquent)";
                                    penalty1     = instrowTD[1].Text.Trim();
                                }
                                if (instrowTD[1].Text.Contains("Includes Late Penalty"))
                                {
                                    delinq_date1 = delinq_date1 + "(Includes Late Penalty)";
                                    penalty1     = instrowTD[1].Text.Trim();
                                }
                                try
                                {
                                    if (instrowTD[2].Text.Contains("Single"))
                                    {
                                        inst        = instrowTD[1].Text.Trim();
                                        delinq_date = instrowTD[2].Text.Trim();
                                        amount      = instrowTD[3].Text.Trim();
                                    }
                                }
                                catch { }
                                i++;
                            }
                            catch { }
                        }
                    }
                    //Property Address~TRA~Bill Number~Tax Year~total_amount_due~Bill Type~Installment1~Due Dat1e~Amount Due1~Penalty1~Paid Amount1~Paid Date1~Total Due1~Installment2~Due Dat2e~Amount Due2~Penalty2~Paid Amount2~Paid Date2~Total Due2~Comments
                    string inst_details = prop_address1 + "~" + tax_rate_area1 + "~" + bill_number + "~" + fiscal_year + "~" + total_amount_due + "~" + bill_type + "~" + inst + "~" + delinq_date + "~" + amount + "~" + penalty + "~" + statuss + "~" + paid_amount + "~" + paid_date + "~" + inst1 + "~" + delinq_date1 + "~" + amount1 + "~" + penalty1 + "~" + status1 + "~" + paid_amount1 + "~" + paid_date1 + "~" + comment;
                    gc.insert_date(orderno, parcelno, 79, inst_details, 1, DateTime.Now);
                }
                catch { }
            }
        }
Esempio n. 13
0
        public void taxdetails(string orderno, string parcelno)
        {
            //*[@id="Table5"]
            IWebElement         taxbilltable    = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_tblBills']"));
            IList <IWebElement> taxbilltableRow = taxbilltable.FindElements(By.TagName("tr"));
            int rowcount = taxbilltableRow.Count;
            IList <IWebElement> taxbillrowTD;
            List <string>       listurl = new List <string>();

            foreach (IWebElement rownew in taxbilltableRow)
            {
                taxbillrowTD = rownew.FindElements(By.TagName("a"));
                if (taxbillrowTD.Count != 0 && !rownew.Text.Contains("Installment"))
                {
                    string url = taxbillrowTD[0].GetAttribute("href");
                    listurl.Add(url);
                }
            }
            int a = 0;

            foreach (string URL in listurl)
            {
                driver.Navigate().GoToUrl(URL);
                Thread.Sleep(2000);
                string bill_number = "", fiscal_year = "", tax_rate_area1 = "", total_amount_due = "", bill_type = "", prop_address1 = "";
                string inst = "", delinq_date = "", amount = "", statuss = "", paid_amount = "", paid_date = "", penalty = "", penalty1 = "";
                string inst1 = "", delinq_date1 = "", amount1 = "", status1 = "", paid_amount1 = "", paid_date1 = "", comment = "";
                try
                {
                    bill_number      = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblBillNumber")).Text.Trim();
                    fiscal_year      = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblTaxYear")).Text.Trim();
                    fiscal_year      = WebDriverTest.After(fiscal_year, "For the fiscal year").Trim();
                    tax_rate_area1   = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblTaxRateArea")).Text.Trim();
                    total_amount_due = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblTotalAmountDue")).Text.Trim();
                    bill_type        = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblBillType")).Text.Trim();
                    prop_address1    = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblAddress")).Text.Trim();
                    if (prop_address1.Contains("\r\n"))
                    {
                        prop_address1 = prop_address1.Replace("\r\n", ",");
                    }
                    string land = "", imp = "", minerals = "", perprop = "", otherimp = "", exem = "", netassvalue = "";
                    if (a == 0)
                    {
                        land        = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblLand")).Text.Trim();
                        imp         = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblImprovements")).Text.Trim();
                        minerals    = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblMinerals")).Text.Trim();
                        perprop     = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblPersonalProperty")).Text.Trim();
                        otherimp    = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblOtherImprovements")).Text.Trim();
                        exem        = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblExemptions")).Text.Trim();
                        netassvalue = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblNetAssessedValue")).Text.Trim();
                        string ass = fiscal_year + "~" + land + "~" + imp + "~" + minerals + "~" + perprop + "~" + otherimp + "~" + exem + "~" + netassvalue;
                        gc.insert_date(orderno, parcelno, 77, ass, 1, DateTime.Now);
                        string prop = prop_address1 + "~" + tax_rate_area1;
                        gc.insert_date(orderno, parcelno, 75, prop, 1, DateTime.Now);
                    }
                    gc.CreatePdf(orderno, parcelno, "TaxSummary_" + fiscal_year + "_" + bill_number, driver, "CA", "Kern");
                    IWebElement         insttable    = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_tblInstallments']"));
                    IList <IWebElement> insttableRow = insttable.FindElements(By.TagName("tr"));
                    int instrowcount = insttableRow.Count;
                    IList <IWebElement> instrowTD;
                    int i = 1;
                    foreach (IWebElement rownew1 in insttableRow)
                    {
                        instrowTD = rownew1.FindElements(By.TagName("td"));
                        if (instrowTD.Count != 0)
                        {
                            try
                            {
                                if (instrowTD[1].Text.Contains("Bill was cancelled"))
                                {
                                    comment = instrowTD[1].Text.Trim();
                                    if (comment.Contains("\r\n"))
                                    {
                                        comment = comment.Replace("\r\n", "");
                                    }
                                }
                                if (instrowTD[1].Text.Contains("Bill has been redeemed"))
                                {
                                    comment = instrowTD[1].Text.Trim();
                                    if (comment.Contains("\r\n"))
                                    {
                                        comment = comment.Replace("\r\n", "");
                                    }
                                }
                                if (instrowTD[1].Text.Contains("Please note"))
                                {
                                }
                                //This property has had multiple owners during the year
                                if (instrowTD[1].Text.Contains("This property has had multiple owners during the year"))
                                {
                                    comment = instrowTD[1].Text.Trim();
                                    if (comment.Contains("\r\n"))
                                    {
                                        comment = comment.Replace("\r\n", "");
                                    }
                                }
                                if (instrowTD[1].Text.Contains("First"))
                                {
                                    string bulk_status = instrowTD[4].Text.Trim();
                                    statuss = WebDriverTest.Before(bulk_status, "$").Trim();
                                    if (statuss.Contains("Paid"))
                                    {
                                        inst        = instrowTD[1].Text.Trim(); delinq_date = instrowTD[2].Text.Trim(); amount = instrowTD[3].Text.Trim();
                                        paid_amount = gc.Between(bulk_status, "Paid", "on").Trim();
                                        paid_date   = WebDriverTest.After(bulk_status, "on").Trim();
                                    }
                                    inst        = instrowTD[1].Text.Trim();
                                    delinq_date = instrowTD[2].Text.Trim();
                                    amount      = instrowTD[3].Text.Trim();
                                }

                                if (instrowTD[1].Text.Contains("Second"))
                                {
                                    string bulk_status1 = instrowTD[4].Text.Trim();
                                    status1 = WebDriverTest.Before(bulk_status1, "$").Trim();
                                    if (status1.Contains("Paid"))
                                    {
                                        inst1        = instrowTD[1].Text.Trim(); delinq_date1 = instrowTD[2].Text.Trim(); amount1 = instrowTD[3].Text.Trim();
                                        paid_amount1 = gc.Between(bulk_status1, "Paid", "on").Trim();
                                        paid_date1   = WebDriverTest.After(bulk_status1, "on").Trim();
                                    }
                                    inst1 = instrowTD[1].Text.Trim(); delinq_date1 = instrowTD[2].Text.Trim(); amount1 = instrowTD[3].Text.Trim();
                                }
                                if (instrowTD[1].Text.Contains("Second") && instrowTD[4].Text.Contains("Unpaid"))
                                {
                                    inst1        = instrowTD[1].Text.Trim();
                                    delinq_date1 = instrowTD[2].Text.Trim();
                                    amount1      = instrowTD[3].Text.Trim();
                                    string bulk_stat = instrowTD[4].Text.Trim();
                                    status1 = WebDriverTest.Before(bulk_stat, "$").Trim();
                                }
                                if (instrowTD[0].Text.Contains("Penalty if Delinquent"))
                                {
                                    delinq_date1 = delinq_date1 + "(Penalty if Delinquent)";
                                    penalty1     = instrowTD[1].Text.Trim();
                                }
                                if (instrowTD[1].Text.Contains("Includes Late Penalty"))
                                {
                                    delinq_date1 = delinq_date1 + "(Includes Late Penalty)";
                                    penalty1     = instrowTD[1].Text.Trim();
                                }
                                try
                                {
                                    if (instrowTD[2].Text.Contains("Single"))
                                    {
                                        inst        = instrowTD[1].Text.Trim();
                                        delinq_date = instrowTD[2].Text.Trim();
                                        amount      = instrowTD[3].Text.Trim();
                                    }
                                }
                                catch { }
                                i++;
                            }
                            catch { }
                        }
                    }

                    //Property Address~TRA~Bill Number~Tax Year~total_amount_due~Bill Type~Installment1~Due Dat1e~Amount Due1~Penalty1~Paid Amount1~Paid Date1~Total Due1~Installment2~Due Dat2e~Amount Due2~Penalty2~Paid Amount2~Paid Date2~Total Due2~Comments
                    string inst_details = prop_address1 + "~" + tax_rate_area1 + "~" + bill_number + "~" + fiscal_year + "~" + total_amount_due + "~" + bill_type + "~" + inst + "~" + delinq_date + "~" + amount + "~" + penalty + "~" + statuss + "~" + paid_amount + "~" + paid_date + "~" + inst1 + "~" + delinq_date1 + "~" + amount1 + "~" + penalty1 + "~" + status1 + "~" + paid_amount1 + "~" + paid_date1 + "~" + comment;
                    gc.insert_date(orderno, parcelno, 79, inst_details, 1, DateTime.Now);
                }

                catch { } //bill details
                a++;
                driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_btnDetails")).SendKeys(Keys.Enter);
                Thread.Sleep(2000);
                gc.CreatePdf(orderno, parcelno, "TaxBreakdowns_" + fiscal_year + "_" + bill_number, driver, "CA", "Kern");
                IWebElement         breaktable    = driver.FindElement(By.XPath("//*[@id='Table5']/tbody/tr[2]/td/table"));
                IList <IWebElement> breaktableRow = breaktable.FindElements(By.TagName("tr"));
                int breakrowcount                 = breaktableRow.Count;
                IList <IWebElement> breakrowTD;
                int j = 0;
                try
                {
                    foreach (IWebElement rowneww in breaktableRow)
                    {
                        breakrowTD = rowneww.FindElements(By.TagName("td"));
                        if (breakrowTD.Count != 0 && !rowneww.Text.Contains("Taxing Agency"))
                        {
                            //Taxing Agency~Telephone~Rate~Amount
                            if (j < breakrowcount - 3)
                            {
                                string breakdet = breakrowTD[0].Text.Trim() + "~" + breakrowTD[1].Text.Trim() + "~" + breakrowTD[2].Text.Trim() + "~" + breakrowTD[3].Text.Trim();
                                gc.insert_date(orderno, parcelno, 80, breakdet, 1, DateTime.Now);
                            }
                            else if (j == breakrowcount - 3)
                            {
                                string breakdet = breakrowTD[0].Text.Trim() + "~" + "-" + "~" + breakrowTD[1].Text.Trim() + "~" + "-";
                                gc.insert_date(orderno, parcelno, 80, breakdet, 1, DateTime.Now);
                            }
                            else if (j == breakrowcount - 2)
                            {
                                string breakdet = breakrowTD[0].Text.Trim() + "~" + "-" + "~" + "-" + "~" + breakrowTD[1].Text.Trim();
                                gc.insert_date(orderno, parcelno, 80, breakdet, 1, DateTime.Now);
                            }
                            else if (j == breakrowcount - 1)
                            {
                                string breakdet = breakrowTD[0].Text.Trim() + "~" + "-" + "~" + "-" + "~" + breakrowTD[1].Text.Trim();
                                gc.insert_date(orderno, parcelno, 80, breakdet, 1, DateTime.Now);
                            }
                        }
                        j++;
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
Esempio n. 14
0
        public string FTP_ARPinal(string houseno, string housedir, string sname, string sttype, string unitno, string parcelNumber, string searchType, string orderNumber, string ownername, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

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

            //IWebElement iframeElement1;
            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())
            {
                // driver = new ChromeDriver();
                string Owner_name = "-", parcel_no = "-", property_Address = "-", Legal_Description = "-", UseCode = "-", TaxAreaCode = "-", TaxYear = "-", Mailing_address = "-", prop_use = "-", year_built = "-";
                string FullCashValue = "-", RealPropertyRatio = "-", LimitedValue = "-", AssessedFCV = "-", AssessedLPV = "-";
                string tax_amountIst = "-", tax_amountIInd = "-", tax_amountTotal = "-", interest_feesIst = "-", interest_feesIInd = "-", interest_feesTotal = "-";
                string paid_amountIst = "-", paid_amountIInd = "-", paid_amountTotal = "-", total_dueIst = "-", total_dueIInd = "-", total_duetTotal = "-";
                string status = "-", applied_interest = "-", year = "-", multi = "-", total = "-", amount = "-";
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");

                    driver.Navigate().GoToUrl("http://www.pinalcountyaz.gov/Assessor/Pages/ParcelSearch.aspx");

                    if (searchType == "address")
                    {
                        driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl02_txt_Number")).SendKeys(houseno);
                        driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl02_ddl_Direction")).SendKeys(housedir);
                        driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl02_txt_Name")).SendKeys(sname);
                        driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl02_ddl_Suffix")).SendKeys(sttype);
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "AZ", "Pinal");
                        driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl02_btn_GoPA")).SendKeys(Keys.Enter);
                        Thread.Sleep(4000);

                        gc.CreatePdf_WOP(orderNumber, "Address search result", driver, "AZ", "Pinal");

                        string mul = "";
                        //  string mul = driver.FindElement(By.XPath("//*[@id='ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl03_lbl_SearchResults']")).Text;
                        //*[@id="tblTitle"]/tbody/tr/td[2]
                        try
                        {
                            mul = driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl03_lbl_SearchResults")).Text;

                            mul = WebDriverTest.Before(mul, " Entries");
                            mul = WebDriverTest.After(mul, "(").Trim();
                        }
                        catch { }

                        if ((mul != "1") && (mul != "0") && (mul != ""))
                        {
                            //multi parcel
                            IWebElement         tbmulti = driver.FindElement(By.XPath("/html/body/form/placeholder/table/tbody/tr[3]/td/table[2]/tbody/tr[2]/td/table/tbody/tr/td[2]/table/tbody/tr/td/table/tbody/tr[2]/td/table/tbody/tr/td/table/tbody/tr/td/div/div[2]/div[1]/div/div[2]/div/div/div[2]/div/table/tbody"));
                            IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                            int maxCheck = 0;
                            IList <IWebElement> TDmulti;
                            foreach (IWebElement row in TRmulti)
                            {
                                if (maxCheck <= 25)
                                {
                                    TDmulti = row.FindElements(By.TagName("td"));
                                    if (TDmulti.Count != 0)
                                    {
                                        string multi1 = TDmulti[0].Text + "~" + TDmulti[1].Text + "~" + TDmulti[2].Text;
                                        gc.insert_date(orderNumber, TDmulti[0].Text, 149, multi1, 1, DateTime.Now);
                                    }
                                    maxCheck++;
                                }
                            }

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

                        // CreatePdf_WOP(orderNumber, "Multiparcel Address Search");
                    }
                    if (searchType == "titleflex")
                    {
                        string titleaddress = houseno + " " + housedir + " " + sname + " " + sttype + " " + unitno;
                        gc.TitleFlexSearch(orderNumber, "", "", titleaddress, "AZ", "Pinal");
                        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_AZPinal"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "parcel")
                    {
                        Thread.Sleep(3000);
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        }
                        if (GlobalClass.titleparcel.Contains(".") || GlobalClass.titleparcel.Contains("-"))
                        {
                            parcelNumber = GlobalClass.titleparcel.Replace(".", "").Replace("-", "");
                        }

                        if (parcelNumber.Replace(" ", "").Replace("-", "").Count() == 9)
                        {
                            string strparcelNumber = parcelNumber.Replace(" ", "").Replace("-", "");
                            string strParcelBook   = strparcelNumber.Substring(0, 3);
                            string strParcelMap    = strparcelNumber.Substring(3, 2);
                            string strParcelNo     = strparcelNumber.Substring(5, 4);
                            driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl02_txt_Book")).SendKeys(strParcelBook);
                            driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl02_txt_Map")).SendKeys(strParcelMap);
                            driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl02_txt_Parcel")).SendKeys(strParcelNo);
                        }
                        else if (parcelNumber.Replace(" ", "").Replace("-", "").Count() == 8)
                        {
                            string strparcelNumber = parcelNumber.Replace(" ", "").Replace("-", "");
                            string strParcelBook   = strparcelNumber.Substring(0, 3);
                            string strParcelMap    = strparcelNumber.Substring(3, 2);
                            string strParcelNo     = strparcelNumber.Substring(5, 3);
                            driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl02_txt_Book")).SendKeys(strParcelBook);
                            driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl02_txt_Map")).SendKeys(strParcelMap);
                            driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl02_txt_Parcel")).SendKeys(strParcelNo);
                        }

                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search", driver, "AZ", "Pinal");
                        driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl02_btn_GoParcel")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                    }
                    if (searchType == "ownername")
                    {
                        Thread.Sleep(3000);
                        driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl02_txt_Owner")).SendKeys(ownername);
                        gc.CreatePdf_WOP(orderNumber, "Owner Name search", driver, "AZ", "Pinal");
                        driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl02_btn_GoOwner")).SendKeys(Keys.Enter);
                        Thread.Sleep(3000);
                        gc.CreatePdf_WOP(orderNumber, "Owner Name search result", driver, "AZ", "Pinal");
                        string mul = "";
                        try
                        {
                            mul = driver.FindElement(By.XPath("//*[@id='ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl03_lbl_SearchResults']")).Text;
                            mul = WebDriverTest.Before(mul, " Entries");
                            mul = WebDriverTest.After(mul, "(").Trim();
                        }
                        catch { }

                        if ((mul != "1") && (mul != "0") && (mul != ""))
                        {
                            //multi parcel
                            IWebElement         tbmulti = driver.FindElement(By.XPath("/html/body/form/placeholder/table/tbody/tr[3]/td/table[2]/tbody/tr[2]/td/table/tbody/tr/td[2]/table/tbody/tr/td/table/tbody/tr[2]/td/table/tbody/tr/td/table/tbody/tr/td/div/div[2]/div[1]/div/div[2]/div/div/div[2]"));
                            IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                            // int iRowsCount = driver.FindElements(By.XPath("//*[@id='ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl04_gv_Results']/tbody/tr")).Count;
                            IList <IWebElement> TDmulti;
                            int maxCheck = 0;
                            foreach (IWebElement row in TRmulti)
                            {
                                if (maxCheck <= 25)
                                {
                                    TDmulti = row.FindElements(By.TagName("td"));
                                    if (TDmulti.Count == 4 && TDmulti[0].Text.Trim() != "")
                                    {
                                        string multi1 = TDmulti[0].Text + "~" + TDmulti[1].Text + "~" + TDmulti[2].Text;
                                        gc.insert_date(orderNumber, TDmulti[0].Text, 149, multi1, 1, DateTime.Now);
                                    }
                                    maxCheck++;
                                }
                            }

                            if (TRmulti.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_Pinal_Multicount"] = "Maximum";
                            }
                            else
                            {
                                HttpContext.Current.Session["multiparcel_Pinal"] = "Yes";
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                        gc.CreatePdf_WOP(orderNumber, "Owner Name search result", driver, "AZ", "Pinal");
                    }

                    try
                    {
                        IWebElement Inodata = driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl02_lbl_NoResults"));
                        if (Inodata.Text.Contains("Your search returned 0 results, please try again."))
                        {
                            HttpContext.Current.Session["Nodata_AZPinal"] = "Zero";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }
                    //property_details

                    Thread.Sleep(5000);
                    // gc.CreatePdf_WOP(orderNumber, "Parcel search result", driver, "AZ", "Pinal");
                    // Thread.Sleep(3000);
                    parcel_no = driver.FindElement(By.XPath("//*[@id='ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl06_lbl_ParcelNumber']")).Text.Trim();
                    gc.CreatePdf(orderNumber, parcel_no, "Parcel search result", driver, "AZ", "Pinal");
                    Owner_name = driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl06_lbl_Owner1")).Text.Trim();

                    property_Address = driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl06_lbl_PropertyAddress")).Text.Trim().Replace("\r\n", "");
                    property_Address = WebDriverTest.Before(property_Address, "Property Address refers to");
                    string address = driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl06_lbl_Address")).Text.Trim();
                    string city    = driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl06_lbl_City")).Text.Trim();
                    string state   = driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl06_lbl_State")).Text.Trim();
                    string zipcode = driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl06_lbl_ZipCode")).Text.Trim();
                    Mailing_address   = address + " " + city + " " + state + " " + zipcode.Trim();
                    Legal_Description = driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl06_lbl_LegalInformation")).Text.Trim();

                    year_built  = driver.FindElement(By.XPath("//*[@id='ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_acc_Search']/div[4]/div/div[3]/table[4]/tbody/tr/td/table[1]/tbody/tr[2]/td/table/tbody/tr[1]/td[2]/span/span")).Text.Trim();
                    TaxAreaCode = driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl06_hyp_TaxAreaCode")).Text.Trim();
                    UseCode     = driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl06_hyp_UseCode")).Text.Trim();

                    string property_details = Owner_name + "~" + property_Address + "~" + Mailing_address + "~" + Legal_Description + "~" + year_built + "~" + TaxAreaCode + "~" + UseCode;
                    gc.insert_date(orderNumber, parcel_no, 140, property_details, 1, DateTime.Now);


                    //Assessment Details

                    //select tax type from drop down
                    var SerachTax      = driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl06_ddl_TaxYear"));
                    var selectElement1 = new SelectElement(SerachTax);
                    selectElement1.SelectByIndex(2);



                    try
                    {
                        IAlert alert = driver.SwitchTo().Alert();
                        alert.Accept();
                    }
                    catch
                    {
                    }
                    gc.CreatePdf(orderNumber, parcel_no, "Assessment search result1", driver, "AZ", "Pinal");
                    TaxYear           = driver.FindElement(By.XPath("//*[@id='ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl06_ddl_TaxYear']/option[@selected='selected']")).Text.Trim();
                    FullCashValue     = driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl06_lbl_FullCashValue")).Text.Trim();
                    LimitedValue      = driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl06_lbl_LimitedValue")).Text.Trim();
                    RealPropertyRatio = driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl06_lbl_RealPropertyRatio")).Text.Trim();
                    AssessedFCV       = driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl06_lbl_AssessedFCV")).Text.Trim();
                    AssessedLPV       = driver.FindElement(By.Id("ctl00_m_g_e7e24a7d_b298_4c40_8411_c65d5498a997_ctl00_ctl06_lbl_AssessLPV")).Text.Trim();

                    string assessment = TaxYear + "~" + FullCashValue + "~" + LimitedValue + "~" + RealPropertyRatio + "~" + AssessedFCV + "~" + AssessedLPV;
                    gc.insert_date(orderNumber, parcel_no, 141, assessment, 1, DateTime.Now);
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    //Tax Details
                    driver.Navigate().GoToUrl("https://treasurer.pinalcountyaz.gov/ParcelInquiry/");
                    Thread.Sleep(3000);

                    string strparcelNumber1 = parcel_no.Replace(" ", "").Replace("-", "");
                    driver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/div/div[1]/form/div/div/span/span/input")).SendKeys(strparcelNumber1);
                    gc.CreatePdf(orderNumber, parcel_no, "Tax iformation", driver, "AZ", "Pinal");
                    driver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/div/div[1]/form/div/input[1]")).SendKeys(Keys.Enter);
                    Thread.Sleep(3000);
                    //tax history or tax summary
                    gc.CreatePdf(orderNumber, parcel_no, "Tax iformation result", driver, "AZ", "Pinal");
                    List <string>       lstrAZ            = new List <string>();
                    IWebElement         multitableElement = driver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/form/div[1]/table/tbody"));
                    IList <IWebElement> multitableRow     = multitableElement.FindElements(By.TagName("tr"));
                    IList <IWebElement> multirowTD;
                    foreach (IWebElement row in multitableRow)
                    {
                        multirowTD       = row.FindElements(By.TagName("td"));
                        status           = multirowTD[2].Text.Trim();
                        applied_interest = multirowTD[4].Text.Trim();
                        year             = multirowTD[1].Text.Trim();
                        multi            = multirowTD[1].Text.Trim() + "~" + multirowTD[2].Text.Trim() + "~" + multirowTD[3].Text.Trim() + "~" + multirowTD[4].Text.Trim() + "~" + multirowTD[5].Text.Trim() + "~" + multirowTD[6].Text.Trim();
                        gc.insert_date(orderNumber, multirowTD[0].Text.Trim(), 145, multi, 1, DateTime.Now);
                        total  = driver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/form/div[1]/table/tfoot/tr/td[6]")).Text.Trim();
                        amount = driver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/form/div[1]/table/tfoot/tr/td[7]")).Text.Trim();

                        IWebElement dt11          = driver.FindElement(By.XPath("//*[@id='interestDate']"));
                        string      interest_date = dt11.GetAttribute("value");
                        string      date1         = interest_date.Substring(0, 2);
                        string      date2         = interest_date.Substring(3, 2);
                        string      date3         = interest_date.Substring(6, 4);

                        if (status.Contains("AZ") || status.Contains("SBPU") || status.Contains("REDC") || status.Contains("PUR"))
                        {
                            if (!applied_interest.Contains("$0.00"))
                            {
                                string strAZURL = "https://treasurer.pinalcountyaz.gov/ParcelInquiry/Parcel/TaxYearDue?parcelNumber=" + parcelNumber + "&taxYear=" + year + "&interestDate=" + date1 + "%2F" + date2 + "%2F" + date3 + "%2000%3A00%3A00";

                                lstrAZ.Add(strAZURL);
                            }
                        }
                    }
                    //Thread.Sleep(4000);
                    foreach (string URL in lstrAZ)
                    {
                        driver.Navigate().GoToUrl(URL);
                        Thread.Sleep(3000);

                        IWebElement dt1           = driver.FindElement(By.XPath("//*[@id='interestDate']"));
                        string      interest_date = dt1.GetAttribute("value");

                        string year1 = driver.FindElement(By.XPath("//*[@id='main']/table/tbody/tr/td[2]/form/table/tbody/tr/td[2]/span/span/span[1]")).Text;
                        gc.CreatePdf(orderNumber, parcel_no, "Tax certificate" + year1, driver, "AZ", "Pinal");

                        IWebElement multitableElement2 = driver.FindElement(By.XPath("//*[@id='CertificateGrid']/table/tbody"));

                        IList <IWebElement> multitableRow2 = multitableElement2.FindElements(By.TagName("tr"));
                        IList <IWebElement> multirowTD2;
                        foreach (IWebElement row1 in multitableRow2)
                        {
                            multirowTD2 = row1.FindElements(By.TagName("td"));
                            string tax_certificate = year1 + "~" + multirowTD2[0].Text.Trim() + "~" + interest_date + "~" + multirowTD2[1].Text.Trim() + "~" + multirowTD2[2].Text.Trim() + "~" + multirowTD2[3].Text.Trim();
                            gc.insert_date(orderNumber, strparcelNumber1, 150, tax_certificate, 1, DateTime.Now);
                        }
                        // display text

                        //  string certificate = driver.FindElement(By.XPath("//*[@id='CertificateGrid']/table/tfoot/tr/td[3]/div")).Text.Trim();

                        //  certificate = certificate.Replace("\r\n", "");
                        //  certificate = WebDriverTest.Before(certificate, ":** 2016 Total Due:");
                        //  certificate = WebDriverTest.After(certificate, "* ").Trim();

                        //  string total_due = driver.FindElement(By.XPath("//*[@id='CertificateGrid']/table/tfoot/tr/td[3]/div")).Text.Trim();
                        //  total_due = total_due.Replace("\r\n", "");
                        //  total_due = WebDriverTest.After(total_due, ":** 2016");

                        //values
                        string certificate_due_amount = driver.FindElement(By.XPath("//*[@id='CertificateGrid']/table/tfoot/tr/td[4]/div")).Text.Trim();
                        certificate_due_amount = certificate_due_amount.Replace("\r\n", ",");
                        string   s = certificate_due_amount;
                        string[] words = s.Split(',');
                        string   first = "", second = "";
                        first  = words[0];
                        second = words[1];

                        //  certificate_due_amount = certificate_due_amount.Replace("\r\n", "");
                        string certificate_value            = first;
                        string certificate_due_amount_value = second;



                        string certificate_amount = year1 + "~" + "Certificate " + "~" + interest_date + "~" + " " + "~" + " " + "~" + certificate_value;
                        gc.insert_date(orderNumber, strparcelNumber1, 150, certificate_amount, 1, DateTime.Now);

                        string total_amount = year1 + "~" + "Total Due: " + "~" + interest_date + "~" + " " + "~" + " " + "~" + certificate_due_amount_value;
                        gc.insert_date(orderNumber, strparcelNumber1, 150, total_amount, 1, DateTime.Now);
                    }

                    string multi_amount = " " + "~" + " " + "~" + " " + "~" + " " + "~" + total + "~" + amount;
                    gc.insert_date(orderNumber, strparcelNumber1, 145, multi_amount, 1, DateTime.Now);



                    //tax year due
                    driver.FindElement(By.XPath(" /html/body/div[1]/section/table/tbody/tr/td[1]/ul/li[1]/ul/li[3]/a")).Click();
                    Thread.Sleep(2000);
                    gc.CreatePdf(orderNumber, parcel_no, "Tax year due", driver, "AZ", "Pinal");
                    string deli = driver.FindElement(By.XPath("//*[@id='Grid']/table/tbody/tr[2]/td[4]/a")).Text;

                    if (deli == "$0.00")
                    {
                        IWebElement dt   = driver.FindElement(By.XPath("//*[@id='interestDate']"));
                        string      date = dt.GetAttribute("value");

                        DateTime G_Date       = Convert.ToDateTime(date);
                        string   dateChecking = DateTime.Now.ToString("MM") + "/15/" + DateTime.Now.ToString("yyyy");

                        if (G_Date < Convert.ToDateTime(dateChecking))
                        {
                            //end of the month
                            date = new DateTime(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM"))), DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(DateTime.Now.ToString("MM")))).ToString("MM/dd/yyyy");
                        }

                        else if (G_Date > Convert.ToDateTime(dateChecking))
                        {
                            // nextEndOfMonth
                            if ((Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM"))) < 12))
                            {
                                date = new DateTime(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM")) + 1), DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(DateTime.Now.ToString("MM")) + 1)).ToString("MM/dd/yyyy");
                            }
                            else
                            {
                                int nxtYr = Convert.ToInt16(DateTime.Now.ToString("yyyy")) + 1;
                                date = new DateTime(nxtYr, 1, DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), 1)).ToString("MM/dd/yyyy");
                            }
                        }

                        Thread.Sleep(2000);
                        dt.Clear();
                        driver.FindElement(By.Id("interestDate")).SendKeys(date);
                    }

                    Thread.Sleep(2000);
                    tax_amountIst   = driver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/form/div/table/tbody/tr[1]/td[2]")).Text.Trim();
                    tax_amountIInd  = driver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/form/div/table/tbody/tr[1]/td[3]")).Text.Trim();
                    tax_amountTotal = driver.FindElement(By.XPath(" /html/body/div[1]/section/table/tbody/tr/td[2]/form/div/table/tbody/tr[1]/td[4]")).Text.Trim();

                    interest_feesIst   = driver.FindElement(By.XPath(" /html/body/div[1]/section/table/tbody/tr/td[2]/form/div/table/tbody/tr[2]/td[2]")).Text.Trim();
                    interest_feesIInd  = driver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/form/div/table/tbody/tr[2]/td[3]")).Text.Trim();
                    interest_feesTotal = driver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/form/div/table/tbody/tr[2]/td[4]")).Text.Trim();


                    paid_amountIst   = driver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/form/div/table/tbody/tr[3]/td[2]")).Text.Trim();
                    paid_amountIInd  = driver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/form/div/table/tbody/tr[3]/td[3]")).Text.Trim();
                    paid_amountTotal = driver.FindElement(By.XPath(" /html/body/div[1]/section/table/tbody/tr/td[2]/form/div/table/tbody/tr[3]/td[4]")).Text.Trim();


                    total_dueIst    = driver.FindElement(By.XPath(" /html/body/div[1]/section/table/tbody/tr/td[2]/form/div/table/tfoot/tr/td[2]")).Text.Trim();
                    total_dueIInd   = driver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/form/div/table/tfoot/tr/td[3]")).Text.Trim();
                    total_duetTotal = driver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/form/div/table/tfoot/tr/td[4]")).Text.Trim();
                    string tax_info = Owner_name + "~" + tax_amountIst + "~" + tax_amountIInd + "~" + tax_amountTotal + "~" + interest_feesIst + "~" + interest_feesIInd + "~" + interest_feesTotal + "~" + paid_amountIst + "~" + paid_amountIInd + "~" + paid_amountTotal + "~" + total_dueIst + "~" + total_dueIInd + "~" + total_duetTotal;

                    gc.insert_date(orderNumber, strparcelNumber1, 144, tax_info, 1, DateTime.Now);



                    // View Bill
                    var chromeOptions     = new ChromeOptions();
                    var downloadDirectory = ConfigurationManager.AppSettings["AutoPdf"];

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

                    var chDriver = new ChromeDriver(chromeOptions);
                    try
                    {
                        chDriver.Navigate().GoToUrl("https://treasurer.pinalcountyaz.gov/ParcelInquiry/");
                        chDriver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/div/div[1]/form/div/div/span/span/input")).SendKeys(strparcelNumber1);
                        chDriver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/div/div[1]/form/div/input[1]")).SendKeys(Keys.Enter);
                        Thread.Sleep(1000);
                        chDriver.FindElement(By.XPath("//*[@id='PanelBar']/li[1]/ul/li[3]/a")).Click();
                        Thread.Sleep(1000);
                        string parcelURL = chDriver.FindElement(By.XPath("//*[@id='main']/table/tbody/tr/td[2]/form/table/tbody/tr/td[5]/a")).GetAttribute("href");
                        string parNo = "", yr = "", fileName = "";
                        parNo    = GlobalClass.After(parcelURL, "parcelNumber");
                        parNo    = GlobalClass.Before(parNo, "&").Replace("=", "_");
                        yr       = GlobalClass.After(parcelURL, "taxYear").Replace("=", "_");
                        fileName = "TaxBill" + parNo + yr + ".pdf";
                        chDriver.FindElement(By.XPath("//*[@id='main']/table/tbody/tr/td[2]/form/table/tbody/tr/td[5]/a")).Click();
                        Thread.Sleep(3000);
                        gc.AutoDownloadFile(orderNumber, parcelNumber, "Pinal", "AZ", fileName);
                        chDriver.Quit();
                    }
                    catch (Exception ex)
                    {
                    }


                    //  WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
                    //    wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/form/table/tbody/tr/td[5]/a"))).Click();

                    //string Url = Itaxbill.GetAttribute("href");
                    //string outputPath = ConfigurationManager.AppSettings["screenShotPath-Pinal"];
                    //outputPath = outputPath + orderNumber + "\\TaxBill.pdf";
                    //WebClient downloadTaxBills = new WebClient();
                    //downloadTaxBills.DownloadFile(Url, outputPath);



                    //IWebElement Itaxbill = driver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/form/table/tbody/tr/td[5]/a"));
                    //string URL1 = Itaxbill.GetAttribute("href");
                    //string billpdf = outputPath + "Taxpinal_PayBill.pdf";
                    //WebClient downloadpdf = new WebClient();
                    //downloadpdf.DownloadFile(URL1, billpdf);

                    //IWebElement export = driver.FindElement(By.XPath("//*[@id='main']/table/tbody/tr/td[2]/form/table/tbody/tr/td[5]/a"));
                    //Actions saction = new Actions(driver);
                    //saction.Click(export).Perform();
                    //AutoItX3 autoit = new AutoItX3();
                    //autoit.WinActivate("Opening GPO Plan.xlsx");
                    //Thread.Sleep(3000);
                    //autoit.Send("{ALTDOWN}s{ALTUP}");
                    //autoit.Send("{Enter}");
                    //Thread.Sleep(3000);
                    //autoit.WinActivate("C:\\SeleniumDownloads");
                    //autoit.Send("{Enter}");

                    //Tax Payment History Details Table

                    Thread.Sleep(2000);
                    driver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[1]/ul/li[1]/ul/li[4]/a")).Click();
                    Thread.Sleep(3000);
                    gc.CreatePdf(orderNumber, parcel_no, "Tax payment history", driver, "AZ", "Pinal");
                    driver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/form/table/tbody/tr/td[2]/span")).Click();
                    Thread.Sleep(2000);
                    driver.FindElement(By.XPath("//li[contains(text(),'All')]")).Click();
                    Thread.Sleep(2000);
                    gc.CreatePdf(orderNumber, parcel_no, "Tax payment history All", driver, "AZ", "Pinal");
                    IWebElement         multitableElement1 = driver.FindElement(By.XPath("/html/body/div[1]/section/table/tbody/tr/td[2]/form/div/table/tbody"));
                    IList <IWebElement> multitableRow1     = multitableElement1.FindElements(By.TagName("tr"));
                    IList <IWebElement> multirowTD1;
                    foreach (IWebElement row in multitableRow1)
                    {
                        multirowTD1 = row.FindElements(By.TagName("td"));

                        string tax_Payment = multirowTD1[2].Text.Trim() + "~" + multirowTD1[3].Text.Trim() + "~" + multirowTD1[4].Text.Trim() + "~" + multirowTD1[5].Text.Trim() + "~" + multirowTD1[6].Text.Trim();
                        gc.insert_date(orderNumber, strparcelNumber1, 146, tax_Payment, 1, DateTime.Now);
                    }
                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

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

                    driver.Quit();
                    GlobalClass.titleparcel = "";
                    gc.mergpdf(orderNumber, "AZ", "Pinal");
                    return("Data Inserted Successfully");
                }

                catch (Exception ex)
                {
                    driver.Quit();
                    throw ex;
                }
            }
        }
Esempio n. 15
0
        public string FTP_Collier(string Address, string parcelNumber, string ownername, string searchType, string orderNumber, string directParcel)
        {
            string strBill = "-", strBalance = "-", strBillDate = "-", strBillPaid = "-", strFBill = "-", strFBalance = "-", strFBillDate = "-", strFBillPaid = "-";
            string TaxYear = "", TaxAmount = "", PaidAmount = "", ReceiptNumber = "", Account_number = "", Millage_Code = "", Millage_rate = "";

            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            string        StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "", AssessTakenTime = "", TaxTakentime = "", CityTaxtakentime = "";
            string        TotaltakenTime   = "";
            List <string> strTaxRealestate = new List <string>();
            var           driverService    = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())
            {
                string   AlterNateID = "", PropertyAddress = "", owner = "";
                string[] stringSeparators1 = new string[] { "\r\n" };

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


                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");
                    //if (searchType == "titleflex")
                    //{
                    //    gc.TitleFlexSearch(orderNumber, parcelNumber, ownername, Address, "IN", "Hamilton");
                    //    if (GlobalClass.TitleFlex_Search == "Yes")
                    //    {
                    //        return "MultiParcel";
                    //    }
                    //    else
                    //    {
                    //        string strTitleAssess = GlobalClass.TitleFlexAssess;
                    //        parcelNumber = GlobalClass.titleparcel;

                    //        searchType = "parcel";
                    //    }
                    //}

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

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


                        IWebElement iframeElement = driver.FindElement(By.XPath("/html/frameset/frame"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement);

                        IWebElement iframeElement1 = driver.FindElement(By.XPath("/html/frameset/frame[2]"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement1);

                        driver.FindElement(By.XPath("//*[@id='AutoNumber3']/tbody/tr/td[3]/table/tbody/tr[4]/td/a")).Click();
                        Thread.Sleep(10000);
                        driver.SwitchTo().DefaultContent();
                        Thread.Sleep(2000);

                        IWebElement iframeElement2 = driver.FindElement(By.XPath("//*[@id='rbottom']"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement2);
                        Thread.Sleep(2000);
                        //now use the switch command

                        driver.FindElement(By.XPath("//*[@id='a_searchlink']")).Click();
                        Thread.Sleep(5000);
                        driver.FindElement(By.XPath("//*[@id='ui-id-16']")).Click();
                        Thread.Sleep(5000);
                        driver.FindElement(By.XPath("//*[@id='FullAddress']")).SendKeys(Address);
                        Thread.Sleep(1000);
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "FL", "Collier");
                        driver.FindElement(By.XPath("//*[@id='SearchFullAddress']")).Click();
                        Thread.Sleep(6000);
                        gc.CreatePdf_WOP(orderNumber, "Address search Result", driver, "FL", "Collier");


                        try
                        {
                            IWebElement         MultiOwnerTable = driver.FindElement(By.Id("flex1"));
                            IList <IWebElement> MultiOwnerRow   = MultiOwnerTable.FindElements(By.TagName("tr"));
                            IList <IWebElement> MultiOwnerTD;
                            //string AlterNateID = "", PropertyAddress = "", LegalDescriptoin = "", YearBuilt = "";
                            foreach (IWebElement row1 in MultiOwnerRow)
                            {
                                MultiOwnerTD = row1.FindElements(By.TagName("td"));
                                if (MultiOwnerTD.Count != 0 && MultiOwnerTD.Count != 2 && MultiOwnerTD.Count != 1 && !row1.Text.Contains("Parcel No.") && MultiOwnerTD[1].Text.Trim() != "")
                                {
                                    parcelNumber    = MultiOwnerTD[1].Text;
                                    ownername       = MultiOwnerTD[3].Text;
                                    PropertyAddress = MultiOwnerTD[5].Text;
                                    string Multi = PropertyAddress + "~" + ownername;
                                    gc.insert_date(orderNumber, parcelNumber, 488, Multi, 1, DateTime.Now);
                                }
                            }
                            //GlobalClass.multiParcel_MiamiDade = "Yes";
                            HttpContext.Current.Session["multiParcel_Collier"] = "Yes";
                            driver.Quit();
                            return("MultiParcel");
                        }
                        catch { }
                    }
                    if (searchType == "ownername")
                    {
                        driver.Navigate().GoToUrl("http://www.collierappraiser.com/");
                        Thread.Sleep(2000);
                        IWebElement iframeElement = driver.FindElement(By.XPath("/html/frameset/frame"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement);

                        IWebElement iframeElement1 = driver.FindElement(By.XPath("/html/frameset/frame[2]"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement1);

                        driver.FindElement(By.XPath("//*[@id='AutoNumber3']/tbody/tr/td[3]/table/tbody/tr[4]/td/a")).Click();
                        Thread.Sleep(10000);
                        driver.SwitchTo().DefaultContent();
                        Thread.Sleep(2000);

                        IWebElement iframeElement2 = driver.FindElement(By.XPath("//*[@id='rbottom']"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement2);
                        Thread.Sleep(2000);
                        //now use the switch command

                        driver.FindElement(By.XPath("//*[@id='a_searchlink']")).Click();
                        Thread.Sleep(6000);
                        driver.FindElement(By.XPath("//*[@id='ui-id-15']")).Click();
                        Thread.Sleep(6000);
                        driver.FindElement(By.XPath("//*[@id='Name1']")).SendKeys(ownername);
                        Thread.Sleep(1000);
                        gc.CreatePdf_WOP(orderNumber, "Owner search", driver, "FL", "Collier");
                        driver.FindElement(By.XPath("//*[@id='SearchName1']")).Click();
                        Thread.Sleep(6000);

                        gc.CreatePdf_WOP(orderNumber, "Owner search Result", driver, "FL", "Collier");
                        try
                        {
                            IWebElement         MultiOwnerTable = driver.FindElement(By.Id("flex1"));
                            IList <IWebElement> MultiOwnerRow   = MultiOwnerTable.FindElements(By.TagName("tr"));
                            IList <IWebElement> MultiOwnerTD;

                            //string AlterNateID = "", PropertyAddress = "", LegalDescriptoin = "", YearBuilt = "";
                            foreach (IWebElement row1 in MultiOwnerRow)
                            {
                                MultiOwnerTD = row1.FindElements(By.TagName("td"));
                                if (MultiOwnerTD.Count != 0 && MultiOwnerTD.Count != 2 && MultiOwnerTD.Count != 1 && !row1.Text.Contains("Parcel No.") && MultiOwnerTD[1].Text.Trim() != "")
                                {
                                    parcelNumber = MultiOwnerTD[1].Text;

                                    ownername       = MultiOwnerTD[3].Text;
                                    PropertyAddress = MultiOwnerTD[5].Text;


                                    string Multi = PropertyAddress + "~" + ownername;
                                    gc.insert_date(orderNumber, parcelNumber, 488, Multi, 1, DateTime.Now);
                                }
                            }

                            //GlobalClass.multiParcel_MiamiDade = "Yes";
                            HttpContext.Current.Session["multiParcel_Collier"] = "Yes";
                            driver.Quit();
                            return("MultiParcel");
                        }
                        catch { }
                    }

                    if (searchType == "parcel")
                    {
                        driver.Navigate().GoToUrl("http://www.collierappraiser.com/");
                        Thread.Sleep(2000);


                        IWebElement iframeElement = driver.FindElement(By.XPath("/html/frameset/frame"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement);

                        IWebElement iframeElement1 = driver.FindElement(By.XPath("/html/frameset/frame[2]"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement1);

                        driver.FindElement(By.XPath("//*[@id='AutoNumber3']/tbody/tr/td[3]/table/tbody/tr[4]/td/a")).Click();
                        Thread.Sleep(10000);
                        driver.SwitchTo().DefaultContent();
                        Thread.Sleep(2000);

                        IWebElement iframeElement2 = driver.FindElement(By.XPath("//*[@id='rbottom']"));
                        //now use the switch command
                        driver.SwitchTo().Frame(iframeElement2);
                        Thread.Sleep(2000);
                        //now use the switch command

                        driver.FindElement(By.XPath("//*[@id='a_searchlink']")).Click();
                        Thread.Sleep(6000);
                        driver.FindElement(By.XPath("//*[@id='ui-id-17']")).Click();
                        Thread.Sleep(6000);
                        driver.FindElement(By.XPath("//*[@id='ParcelID']")).SendKeys(parcelNumber);
                        Thread.Sleep(1000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel Search", driver, "FL", "Collier");
                        driver.FindElement(By.XPath("//*[@id='SearchParcelID']")).Click();
                        Thread.Sleep(6000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel Search Result", driver, "FL", "Collier");
                    }
                    try
                    {
                        IAlert alert = driver.SwitchTo().Alert();
                        if (alert.Text.Contains("No Parcels Found"))
                        {
                            HttpContext.Current.Session["Nodata_FLCollier"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }
                    string SiteAdr = "", MapNo = "", Strapno = "", Section = "", Township = "", Range = "", Acres = "", MillageArea = "", Condo = "", UseCode = "", School = "", Other = "", Total = "", YearBuilt = "";

                    gc.CreatePdf(orderNumber, parcelNumber, "Property Deatil", driver, "FL", "Collier");
                    parcelNumber = driver.FindElement(By.XPath("//*[@id='ParcelID']")).Text;
                    ownername    = driver.FindElement(By.XPath("//*[@id='Name1']")).Text;
                    try
                    {
                        ownername = driver.FindElement(By.XPath("//*[@id='Name1']")).Text + " " + driver.FindElement(By.XPath("//*[@id='Name2']")).Text;
                    }
                    catch { }
                    try
                    {
                        SiteAdr = driver.FindElement(By.XPath("//*[@id='FullAddress']")).Text + " " + driver.FindElement(By.XPath("//*[@id='City']")).Text + " " + driver.FindElement(By.XPath("//*[@id='State']")).Text;
                    }
                    catch { }
                    MapNo       = driver.FindElement(By.XPath("//*[@id='MapNumber']")).Text;
                    Strapno     = driver.FindElement(By.XPath("//*[@id='StrapNumber']")).Text;
                    Section     = driver.FindElement(By.XPath("//*[@id='Section']")).Text;
                    Township    = driver.FindElement(By.XPath("//*[@id='Township']")).Text;
                    Range       = driver.FindElement(By.XPath("//*[@id='Range']")).Text;
                    Acres       = driver.FindElement(By.XPath("//*[@id='TotalAcres']")).Text;
                    MillageArea = driver.FindElement(By.XPath("//*[@id='MillageArea']")).Text;
                    Condo       = driver.FindElement(By.XPath("//*[@id='scDescription']")).Text;
                    UseCode     = driver.FindElement(By.XPath("//*[@id='ucDescription']")).Text;
                    School      = driver.FindElement(By.XPath("//*[@id='School']")).Text;
                    Other       = driver.FindElement(By.XPath("//*[@id='Other']")).Text;
                    Total       = driver.FindElement(By.XPath("//*[@id='Total']")).Text;

                    driver.FindElement(By.XPath("//*[@id='ui-id-2']")).Click();
                    Thread.Sleep(4000);
                    gc.CreatePdf(orderNumber, parcelNumber, "Property Summary", driver, "FL", "Collier");
                    try
                    {
                        YearBuilt = driver.FindElement(By.XPath("//*[@id='trBuilding1']/td[2]")).Text;
                    }
                    catch { }
                    string property = ownername + "~" + SiteAdr + "~" + MapNo + "~" + Strapno + "~" + Section + "~" + Township + "~" + Range + "~" + Acres + "~" + MillageArea + "~" + Condo + "~" + UseCode + "~" + School + "~" + Other + "~" + Total + "~" + YearBuilt;

                    gc.insert_date(orderNumber, parcelNumber, 469, property, 1, DateTime.Now);
                    driver.FindElement(By.XPath("//*[@id='ui-id-1']")).Click();
                    Thread.Sleep(4000);

                    string              LandValue = "", ImprovedValue = "", Marketvalue = "", SaveOurHome = "", AssessedValue = "", Homestead = "", SchoolTaxableValue = "", AdditionalHomestead = "", TaxableValue = "";
                    IWebElement         TaxHisTBD = driver.FindElement(By.XPath("//*[@id='PropSum']/table[6]/tbody/tr/td[3]/table/tbody"));
                    IList <IWebElement> TaxHisTRD = TaxHisTBD.FindElements(By.TagName("tr"));
                    IList <IWebElement> TaxHisTDD;

                    foreach (IWebElement row1 in TaxHisTRD)
                    {
                        TaxHisTDD = row1.FindElements(By.TagName("td"));
                        if (!row1.Text.Contains("Certified Tax Roll") && !row1.Text.Contains("(Subject") && row1.Text.Trim() != "" && TaxHisTDD.Count != 1)
                        {
                            LandValue     = TaxHisTDD[0].Text + "~" + LandValue;
                            ImprovedValue = TaxHisTDD[1].Text + "~" + ImprovedValue;
                        }
                    }

                    LandValue     = LandValue + "lk";
                    ImprovedValue = ImprovedValue + "lk";

                    LandValue     = LandValue.Replace("~lk", "");
                    ImprovedValue = ImprovedValue.Replace("~lk", "");
                    DBconnection dbconn = new DBconnection();
                    dbconn.ExecuteQuery("update  data_field_master set Data_Fields_Text='" + LandValue + "' where Id = '" + 470 + "'");
                    gc.insert_date(orderNumber, parcelNumber, 470, ImprovedValue, 1, DateTime.Now);
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    driver.Navigate().GoToUrl("https://collier.county-taxes.com/public");
                    Thread.Sleep(2000);

                    driver.FindElement(By.XPath("//*[@id='search-controls']/div/form[1]/div[1]/div/input")).SendKeys(parcelNumber);
                    gc.CreatePdf(orderNumber, parcelNumber, "Taxinfo", driver, "FL", "Collier");
                    driver.FindElement(By.XPath("//*[@id='search-controls']/div/form[1]/div[1]/div/span/button")).SendKeys(Keys.Enter);
                    Thread.Sleep(3000);
                    try
                    {
                        IWebElement ITaxSearch    = driver.FindElement(By.LinkText("Full bill history"));
                        string      strITaxSearch = ITaxSearch.GetAttribute("href");
                        driver.Navigate().GoToUrl(strITaxSearch);
                        Thread.Sleep(3000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Full bill history", driver, "FL", "Collier");
                    }
                    catch { }

                    try
                    {
                        IWebElement         ITaxReal    = driver.FindElement(By.XPath("//*[@id='content']/div[1]/table"));
                        IList <IWebElement> ITaxRealRow = ITaxReal.FindElements(By.TagName("tr"));
                        IList <IWebElement> ITaxRealTd;
                        int k = 0;
                        foreach (IWebElement ItaxReal in ITaxRealRow)
                        {
                            ITaxRealTd = ItaxReal.FindElements(By.TagName("td"));
                            if ((k <= 2 && ItaxReal.Text.Contains("Annual Bill")) || ItaxReal.Text.Contains("Pay this bill:"))
                            {
                                string      yearbill      = ITaxRealTd[0].Text;
                                IWebElement ITaxBillCount = ITaxRealTd[0].FindElement(By.TagName("a"));
                                string      strTaxReal    = ITaxBillCount.GetAttribute("href");
                                strTaxRealestate.Add(strTaxReal);
                                try
                                {
                                    IWebElement ITaxBill = ITaxRealTd[3].FindElement(By.TagName("a"));
                                    string      BillTax  = ITaxBill.GetAttribute("href");
                                    gc.downloadfile(BillTax, orderNumber, parcelNumber, "Taxbill.pdf" + yearbill, "FL", "Collier");
                                }
                                catch
                                {
                                    IWebElement ITaxBill = ITaxRealTd[4].FindElement(By.TagName("a"));
                                    string      BillTax  = ITaxBill.GetAttribute("href");
                                    gc.downloadfile(BillTax, orderNumber, parcelNumber, "Taxbill.pdf" + yearbill, "FL", "Collier");
                                }
                                k++;
                            }
                        }

                        //Tax History Details

                        IWebElement         IBillHistorytable = driver.FindElement(By.XPath("//*[@id='content']/div[1]/table"));
                        IList <IWebElement> IBillHistoryRow   = IBillHistorytable.FindElements(By.TagName("tr"));
                        IList <IWebElement> IBillHistoryTD;
                        foreach (IWebElement bill in IBillHistoryRow)
                        {
                            IBillHistoryTD = bill.FindElements(By.TagName("td"));
                            if (IBillHistoryTD.Count != 0)
                            {
                                try
                                {
                                    strBill     = IBillHistoryTD[0].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                    strBalance  = IBillHistoryTD[1].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                    strBillDate = IBillHistoryTD[2].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                    strBillPaid = IBillHistoryTD[3].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                }
                                catch
                                {
                                    strBillDate = "";
                                    strBillPaid = "";
                                }
                                if (strBillPaid.Contains("Print (PDF)"))
                                {
                                    strBillPaid = "";
                                }
                                string strTaxHistory = strBill + "~" + strBalance + "~" + strBillDate + "~" + strBillPaid;
                                gc.insert_date(orderNumber, parcelNumber, 471, strTaxHistory, 1, DateTime.Now);
                            }
                        }

                        IWebElement         IBillHistoryfoottable = driver.FindElement(By.XPath("//*[@id='content']/div[1]/table/tfoot"));
                        IList <IWebElement> IBillHistoryfootRow   = IBillHistoryfoottable.FindElements(By.TagName("tr"));
                        IList <IWebElement> IBillHistoryfootTD;
                        foreach (IWebElement bill in IBillHistoryRow)
                        {
                            IBillHistoryfootTD = bill.FindElements(By.TagName("th"));
                            if (IBillHistoryfootTD.Count != 0 && bill.Text.Contains("Total"))
                            {
                                try
                                {
                                    strFBill     = IBillHistoryfootTD[0].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                    strFBalance  = IBillHistoryfootTD[1].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                    strFBillDate = IBillHistoryfootTD[2].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                    strFBillPaid = IBillHistoryfootTD[3].Text.Replace("\r\n", " ").TrimStart().TrimEnd();
                                }
                                catch
                                {
                                    strFBillDate = "";
                                    strFBillPaid = "";
                                }
                                if (strBillPaid.Contains("Print (PDF)"))
                                {
                                    strBillPaid = "";
                                }
                                string strTaxHistory = strFBill + "~" + strFBalance + "~" + strFBillDate + "~" + strFBillPaid;
                                gc.insert_date(orderNumber, parcelNumber, 471, strTaxHistory, 1, DateTime.Now);
                            }
                        }
                        foreach (string real in strTaxRealestate)
                        {
                            driver.Navigate().GoToUrl(real);
                            Thread.Sleep(4000);

                            try
                            {
                                TaxYear = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/div[1]")).Text;
                                TaxYear = WebDriverTest.After(TaxYear, "Real Estate").Trim();
                                string   s     = TaxYear;
                                string[] words = TaxYear.Split(' ');
                                TaxYear = words[0];
                            }
                            catch
                            {
                                TaxYear = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/div[1]")).Text;
                                TaxYear = WebDriverTest.After(TaxYear, "Real Estate").Trim();
                                string   s     = TaxYear;
                                string[] words = TaxYear.Split(' ');
                                TaxYear = words[0];
                            }

                            gc.CreatePdf(orderNumber, parcelNumber, "Tax details" + TaxYear, driver, "FL", "Collier");
                            IWebElement multitableElement3;
                            try
                            {
                                multitableElement3 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/table[2]/tbody"));
                            }
                            catch
                            {
                                multitableElement3 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/table[2]/tbody"));
                            }
                            IList <IWebElement> multitableRow3 = multitableElement3.FindElements(By.TagName("tr"));

                            IList <IWebElement> multirowTD3;
                            foreach (IWebElement row in multitableRow3)
                            {
                                multirowTD3 = row.FindElements(By.TagName("td"));
                                if (multirowTD3.Count != 1 && multirowTD3[1].Text.Trim() != "")
                                {
                                    string tax_distri = TaxYear + "~" + multirowTD3[0].Text.Trim() + "~" + "Ad Valorem" + "~" + multirowTD3[1].Text.Trim() + "~" + multirowTD3[2].Text.Trim() + "~" + multirowTD3[3].Text.Trim() + "~" + multirowTD3[4].Text.Trim() + "~" + "" + "~" + multirowTD3[5].Text.Trim();
                                    gc.insert_date(orderNumber, parcelNumber, 472, tax_distri, 1, DateTime.Now);
                                }
                            }

                            //total advalorem
                            IWebElement multitableElement31;
                            try
                            {
                                multitableElement31 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/table[2]/tfoot"));
                            }
                            catch
                            {
                                multitableElement31 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/table[2]/tfoot"));
                            }
                            IList <IWebElement> multitableRow31 = multitableElement31.FindElements(By.TagName("tr"));

                            IList <IWebElement> multirowTD31;
                            foreach (IWebElement row in multitableRow31)
                            {
                                multirowTD31 = row.FindElements(By.TagName("td"));
                                if (multirowTD31.Count != 1)
                                {
                                    string tax_distri1 = TaxYear + "~" + "Total:" + "~" + "Ad Valorem" + "~" + multirowTD31[0].Text.Trim() + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + multirowTD31[1].Text.Trim();
                                    gc.insert_date(orderNumber, parcelNumber, 472, tax_distri1, 1, DateTime.Now);
                                }
                            }
                            //  Non - Ad Valorem
                            try
                            {
                                IWebElement multitableElement32;
                                try
                                {
                                    multitableElement32 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/table[3]/tbody"));
                                }
                                catch
                                {
                                    multitableElement32 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/table[3]/tbody"));
                                }
                                IList <IWebElement> multitableRow32 = multitableElement32.FindElements(By.TagName("tr"));
                                IList <IWebElement> multirowTD32;
                                foreach (IWebElement row in multitableRow32)
                                {
                                    multirowTD32 = row.FindElements(By.TagName("td"));
                                    if (multirowTD32.Count != 1 && multirowTD32[0].Text.Trim() != "")
                                    {
                                        string tax_distri2 = TaxYear + "~" + multirowTD32[0].Text.Trim() + "~" + "Non-Ad Valorem " + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + multirowTD32[1].Text.Trim() + "~" + multirowTD32[2].Text.Trim();
                                        gc.insert_date(orderNumber, parcelNumber, 472, tax_distri2, 1, DateTime.Now);
                                    }
                                }
                                //total non-advalorem

                                IWebElement multitableElement33;
                                try
                                {
                                    multitableElement33 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/table[3]/tfoot"));
                                }
                                catch
                                {
                                    multitableElement33 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/table[3]/tfoot"));
                                }
                                IList <IWebElement> multitableRow33 = multitableElement33.FindElements(By.TagName("tr"));
                                IList <IWebElement> multirowTD33;
                                foreach (IWebElement row in multitableRow33)
                                {
                                    multirowTD33 = row.FindElements(By.TagName("td"));
                                    if (multirowTD33.Count != 0)
                                    {
                                        string tax_distri1 = TaxYear + "~" + "Total:" + "~" + "Non-Ad Valorem " + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + multirowTD33[0].Text.Trim();
                                        gc.insert_date(orderNumber, parcelNumber, 472, tax_distri1, 1, DateTime.Now);
                                    }
                                }
                            }
                            catch { }
                            //  Taxing_authority~Tax_type~Millage~Assessed~Exemption~Taxable~Rate~Tax
                            //Tax info
                            try
                            {
                                TaxAmount  = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/p")).Text.Replace("Combined taxes and assessments:", "");
                                PaidAmount = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/div[6]/div/div[1]/div/div")).Text;
                                PaidAmount = PaidAmount.Replace("\r\n", "&");
                                PaidAmount = WebDriverTest.Before(PaidAmount, "&");
                                PaidAmount = WebDriverTest.After(PaidAmount, "$").Trim();

                                ReceiptNumber = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/div[6]/div/div[1]/div/div/div")).Text.Replace("Receipt", "");
                                IWebElement         tbmulti = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/table[1]/tbody"));
                                IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                                IList <IWebElement> TDmulti;
                                foreach (IWebElement row in TRmulti)
                                {
                                    TDmulti = row.FindElements(By.TagName("td"));
                                    if (TDmulti.Count != 0)
                                    {
                                        Account_number = TDmulti[0].Text;
                                        string Escro_Code = TDmulti[2].Text;
                                        Millage_Code = TDmulti[3].Text;

                                        string tax_info1 = Account_number + "~" + Millage_Code + "~" + Escro_Code + "~" + TaxYear + "~" + TaxAmount + "~" + PaidAmount + "~" + ReceiptNumber + "~" + "Doug Belden, Tax Collector P.O. Box 30012 Tampa, Florida 33630-3012";

                                        gc.insert_date(orderNumber, parcelNumber, 473, tax_info1, 1, DateTime.Now);
                                    }
                                }
                            }
                            catch
                            {
                                TaxAmount = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/p")).Text.Replace("Combined taxes and assessments:", "");

                                PaidAmount = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/div[3]")).Text;
                                if (PaidAmount.Contains("Pay this bill"))
                                {
                                    PaidAmount    = "";
                                    ReceiptNumber = "";
                                }
                                else
                                {
                                    PaidAmount = PaidAmount.Replace("\r\n", "&");
                                    var PaidAmount1 = PaidAmount.Split('&');
                                    PaidAmount    = PaidAmount1[0];
                                    PaidAmount    = WebDriverTest.After(PaidAmount, "$").Trim();
                                    ReceiptNumber = PaidAmount1[1];
                                }

                                IWebElement         tbmulti = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/table[1]/tbody"));
                                IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));

                                IList <IWebElement> TDmulti;
                                foreach (IWebElement row in TRmulti)
                                {
                                    TDmulti = row.FindElements(By.TagName("td"));
                                    if (TDmulti.Count != 0)
                                    {
                                        Account_number = TDmulti[0].Text;
                                        string Escro_Code = TDmulti[2].Text;
                                        Millage_Code = TDmulti[3].Text;
                                        string tax_info1 = Account_number + "~" + Millage_Code + "~" + Escro_Code + "~" + TaxYear + "~" + TaxAmount + "~" + PaidAmount + "~" + ReceiptNumber + "~" + "Doug Belden, Tax Collector P.O. Box 30012 Tampa, Florida 33630-3012";
                                        gc.insert_date(orderNumber, parcelNumber, 473, tax_info1, 1, DateTime.Now);
                                    }
                                }
                            }
                            string IfPaidBy = "", PlesePay = "", DueDate = "", deli = "";
                            try
                            {
                                IWebElement         multitableElement26 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[8]/div/table[4]/tbody"));
                                IList <IWebElement> multitableRow26     = multitableElement26.FindElements(By.TagName("tr"));

                                IList <IWebElement> multirowTD26;
                                foreach (IWebElement row in multitableRow26)
                                {
                                    multirowTD26 = row.FindElements(By.TagName("td"));
                                    int iRowsCount = multirowTD26.Count;
                                    for (int n = 0; n < iRowsCount; n++)
                                    {
                                        if ((!multirowTD26[n].Text.Contains("Face Amt")) && (!multirowTD26[n].Text.Contains("Certificate")))
                                        {
                                            IfPaidBy = multirowTD26[n].Text.Replace("\r\n", "~");
                                            var IfpaySplit = IfPaidBy.Split('~');
                                            IfPaidBy = IfpaySplit[0];
                                            PlesePay = IfpaySplit[1];
                                            if (PlesePay == "$0.00")
                                            {
                                                deli = "paid";
                                            }
                                            else
                                            {
                                                deli = "deliquent";
                                            }
                                            DueDate = TaxYear + "~" + deli + "~" + IfPaidBy + "~" + PlesePay;
                                            gc.insert_date(orderNumber, parcelNumber, 474, DueDate, 1, DateTime.Now);
                                        }
                                    }
                                }
                            }
                            //If_paid_by~Please_Pay
                            catch
                            {
                                IWebElement         multitableElement26 = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[7]/div/table[4]/tbody"));
                                IList <IWebElement> multitableRow26     = multitableElement26.FindElements(By.TagName("tr"));

                                IList <IWebElement> multirowTD26;
                                foreach (IWebElement row in multitableRow26)
                                {
                                    multirowTD26 = row.FindElements(By.TagName("td"));
                                    int iRowsCount = multirowTD26.Count;
                                    for (int n = 0; n < iRowsCount; n++)
                                    {
                                        if ((!multirowTD26[n].Text.Contains("Face Amt")) && (!multirowTD26[n].Text.Contains("Certificate")))
                                        {
                                            IfPaidBy = multirowTD26[n].Text.Replace("\r\n", "~");
                                            var IfpaySplit = IfPaidBy.Split('~');
                                            IfPaidBy = IfpaySplit[0];
                                            PlesePay = IfpaySplit[1];
                                            if (PlesePay == "$0.00")
                                            {
                                                deli = "paid";
                                            }
                                            else
                                            {
                                                deli = "deliquent";
                                            }
                                            DueDate = TaxYear + "~" + deli + "~" + IfPaidBy + "~" + PlesePay;
                                            gc.insert_date(orderNumber, parcelNumber, 474, DueDate, 1, DateTime.Now);
                                        }
                                    }
                                }
                            }

                            //*[@id="content"]/div[1]/div[3]/div[1]/ul/li[1]/a
                            driver.FindElement(By.XPath("//*[@id='content']/div[1]/div[3]/div[1]/ul/li[1]/a")).Click();
                            Thread.Sleep(5000);
                            gc.CreatePdf(orderNumber, parcelNumber, "parcel details" + TaxYear, driver, "FL", "Collier");
                        }
                    }
                    catch { }
                    TaxTime     = DateTime.Now.ToString("HH:mm:ss");
                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "FL", "Collier", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

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

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

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

            var driverService = PhantomJSDriverService.CreateDefaultService();

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

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

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

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

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

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

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

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

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

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

                        string CommonParcel = parcelNumber;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            j++;
                        }
                    }

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

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

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

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

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

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

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

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

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

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

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

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

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

                        int rows_count = TaxInfoTR.Count;

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

                                int columns_count = Columns_row.Count;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    driver.Quit();
                    gc.mergpdf(orderNumber, "GA", "Fayette");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw;
                }
            }
        }
Esempio n. 17
0
        public string FTP_Jefferson(string address, string ownername, string assessment_id, string parcelNumber, string searchType, string orderNumber, string directParcel)
        {
            GlobalClass gc = new GlobalClass();

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

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

            var driverService = PhantomJSDriverService.CreateDefaultService();

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

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


                    driver.Navigate().GoToUrl("http://www.jpassessor.com/property-search");
                    Thread.Sleep(4000);
                    if (searchType == "address")
                    {
                        driver.FindElement(By.XPath("//*[@id='radio-address']")).Click();
                        Thread.Sleep(3000);
                        driver.FindElement(By.XPath("//*[@id='address']")).SendKeys(address);
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "LA", "Jefferson");
                        driver.FindElement(By.Id("btn-search-address")).Click();
                        Thread.Sleep(3000);
                        gc.CreatePdf_WOP(orderNumber, "Address search result", driver, "LA", "Jefferson");
                        mul = driver.FindElement(By.XPath("//*[@id='panel-results']/div[2]/div[3]/div/span")).Text.Trim();
                        mul = WebDriverTest.Before(mul, " of");
                        List <string> searchlist = new List <string>();

                        IWebElement         checksingle   = driver.FindElement(By.XPath("//*[@id='panel-results']/div[1]/table/tbody"));
                        IList <IWebElement> TRchecksingle = checksingle.FindElements(By.TagName("tr"));
                        int j = 1;
                        IList <IWebElement> TDchecksingle;
                        foreach (IWebElement row in TRchecksingle)
                        {
                            if (j <= 25)
                            {
                                TDchecksingle = row.FindElements(By.TagName("td"));
                                if (TDchecksingle.Count != 0 && row.Text.Contains(address.ToUpper()))
                                {
                                    if (TDchecksingle[2].Text == address.ToUpper())
                                    {
                                        driver.FindElement(By.XPath("//*[@id='panel-results']/div[1]/table/tbody/tr[" + j + "]/td[1]/a")).Click();
                                        Thread.Sleep(3000);
                                        driver.SwitchTo().Window(driver.WindowHandles.Last());
                                        Thread.Sleep(2000);
                                        break;
                                    }
                                }
                                j++;
                            }
                        }
                        try
                        {
                            if (mul != "1 - 1")
                            {
                                //multi parcel
                                IWebElement         tbmulti = driver.FindElement(By.XPath("//*[@id='panel-results']/div[1]/table/tbody"));
                                IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                                int k = 0;
                                IList <IWebElement> TDmulti;
                                foreach (IWebElement row in TRmulti)
                                {
                                    if (k <= 25)
                                    {
                                        TDmulti = row.FindElements(By.TagName("td"));
                                        if (TDmulti.Count != 0 && row.Text.Contains(address.ToUpper()))
                                        {
                                            if (TDmulti[2].Text == address.ToUpper())
                                            {
                                                driver.FindElement(By.XPath("//*[@id='panel-results']/div[1]/table/tbody/tr[" + k + "]/td[1]/a")).Click();
                                                break;
                                            }
                                            else
                                            {
                                                string multi1 = TDmulti[1].Text + "~" + TDmulti[2].Text + "~" + TDmulti[3].Text;
                                                gc.insert_date(orderNumber, TDmulti[0].Text, 245, multi1, 1, DateTime.Now);
                                            }
                                            searchlist.Add(TDmulti[0].Text);
                                        }
                                        k++;
                                    }
                                }

                                if (TRmulti.Count > 25)
                                {
                                    HttpContext.Current.Session["multiParcel_Jefferson_Multicount"] = "Maximum";
                                }
                                if (searchlist.Count > 1)
                                {
                                    HttpContext.Current.Session["multiParcel_Jefferson"] = "Yes";
                                }
                                driver.Quit();
                                return("MultiParcel");
                            }
                            else
                            {
                                try
                                {
                                    driver.FindElement(By.XPath("//*[@id='panel-results']/div[1]/table/tbody/tr/td[1]/a")).Click();
                                    Thread.Sleep(3000);
                                    driver.SwitchTo().Window(driver.WindowHandles.Last());
                                    Thread.Sleep(2000);
                                }
                                catch { }
                            }
                        }
                        catch
                        {
                        }
                    }
                    else if (searchType == "parcel")
                    {
                        driver.FindElement(By.XPath("//*[@id='radio-parcel']")).Click();
                        Thread.Sleep(3000);

                        if (parcelNumber.Contains("-"))
                        {
                            parcelNumber = parcelNumber.Replace("-", "");
                        }
                        driver.FindElement(By.XPath("//*[@id='parcel']")).SendKeys(parcelNumber);

                        driver.FindElement(By.XPath("//*[@id='btn-search-parcel']")).Click();
                        Thread.Sleep(3000);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel search result", driver, "LA", "Jefferson");

                        mul = driver.FindElement(By.XPath("//*[@id='panel-results']/div[2]/div[3]/div/span")).Text.Trim();

                        mul = WebDriverTest.Before(mul, " of");
                        if (mul != "1 - 1")
                        {
                            //multi parcel
                            IWebElement         tbmulti = driver.FindElement(By.XPath("//*[@id='panel-results']/div[1]/table/tbody"));
                            IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                            int l = 0;
                            IList <IWebElement> TDmulti;
                            foreach (IWebElement row in TRmulti)
                            {
                                if (l <= 25)
                                {
                                    TDmulti = row.FindElements(By.TagName("td"));
                                    if (TDmulti.Count != 0)
                                    {
                                        string multi1 = TDmulti[1].Text + "~" + TDmulti[2].Text + "~" + TDmulti[3].Text;
                                        gc.insert_date(orderNumber, TDmulti[0].Text, 245, multi1, 1, DateTime.Now);
                                    }
                                    l++;
                                }
                            }
                            if (TRmulti.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_Jefferson_Multicount"] = "Maximum";
                            }
                            else
                            {
                                HttpContext.Current.Session["multiParcel_Jefferson"] = "Yes";
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else
                        {
                            try
                            {
                                driver.FindElement(By.XPath("//*[@id='panel-results']/div[1]/table/tbody/tr/td[1]/a")).Click();
                                Thread.Sleep(3000);
                                driver.SwitchTo().Window(driver.WindowHandles.Last());
                                Thread.Sleep(2000);
                            }
                            catch { }
                        }
                    }
                    else if (searchType == "ownername")
                    {
                        driver.FindElement(By.XPath("//*[@id='radio-owner']")).Click();
                        Thread.Sleep(3000);

                        driver.FindElement(By.XPath("//*[@id='owner']")).SendKeys(ownername);

                        driver.FindElement(By.XPath("//*[@id='btn-search-owner']")).Click();
                        Thread.Sleep(3000);
                        gc.CreatePdf_WOP(orderNumber, "Owner search result", driver, "LA", "Jefferson");

                        mul = driver.FindElement(By.XPath("//*[@id='panel-results']/div[2]/div[3]/div/span")).Text.Trim();

                        mul = WebDriverTest.Before(mul, " of");
                        if (mul != "1 - 1")
                        {
                            //multi parcel
                            IWebElement         tbmulti = driver.FindElement(By.XPath("//*[@id='panel-results']/div[1]/table/tbody"));
                            IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));
                            int l = 0;
                            IList <IWebElement> TDmulti;
                            foreach (IWebElement row in TRmulti)
                            {
                                if (l <= 25)
                                {
                                    TDmulti = row.FindElements(By.TagName("td"));
                                    if (TDmulti.Count != 0)
                                    {
                                        string multi1 = TDmulti[1].Text + "~" + TDmulti[2].Text + "~" + TDmulti[3].Text;
                                        gc.insert_date(orderNumber, TDmulti[0].Text, 245, multi1, 1, DateTime.Now);
                                    }
                                    l++;
                                }
                            }

                            if (TRmulti.Count > 25)
                            {
                                HttpContext.Current.Session["multiParcel_Jefferson_Multicount"] = "Maximum";
                            }
                            else
                            {
                                HttpContext.Current.Session["multiParcel_Jefferson"] = "Yes";
                            }
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else
                        {
                            try
                            {
                                driver.FindElement(By.XPath("//*[@id='panel-results']/div[1]/table/tbody/tr/td[1]/a")).Click();
                                Thread.Sleep(3000);
                                driver.SwitchTo().Window(driver.WindowHandles.Last());
                                Thread.Sleep(2000);
                            }
                            catch { }
                        }
                    }

                    try
                    {
                        string nodata = driver.FindElement(By.XPath("//*[@id='panel-results']")).Text;
                        if (nodata.Contains("0 - 0 of 0 items"))
                        {
                            HttpContext.Current.Session["Nodata_LAJefferson"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }

                    //property details
                    string Parcel_no = "", Ward_no = "", Owner_Name = "", Improvement_Address = "", Homestead_Exemption_Status = "", Subdivision = "", Legal_Description = "", Land_Assessment = "", Improvement_Assessment = "", Total_Assessment = "";
                    //gc.CreatePdf_WOP(orderNumber, "propert search result", driver);
                    Parcel_no = driver.FindElement(By.XPath("/html/body/div[2]/div/div/div/table/tbody/tr[2]/td/table/tbody/tr[1]/td[2]/span")).Text.Trim();
                    gc.CreatePdf(orderNumber, Parcel_no, "property search result", driver, "LA", "Jefferson");
                    Ward_no                    = driver.FindElement(By.XPath(" /html/body/div[2]/div/div/div/table/tbody/tr[2]/td/table/tbody/tr[2]/td[2]")).Text.Trim();
                    Owner_Name                 = driver.FindElement(By.XPath("/ html/body/div[2]/div/div/div/table/tbody/tr[2]/td/table/tbody/tr[3]/td[2]")).Text.Trim();
                    Improvement_Address        = driver.FindElement(By.XPath("/ html/body/div[2]/div/div/div/table/tbody/tr[2]/td/table/tbody/tr[5]/td[2]")).Text.Trim();
                    Homestead_Exemption_Status = driver.FindElement(By.XPath("/ html/body/div[2]/div/div/div/table/tbody/tr[2]/td/table/tbody/tr[3]/td[4]")).Text.Trim();
                    Subdivision                = driver.FindElement(By.XPath(" / html/body/div[2]/div/div/div/table/tbody/tr[2]/td/table/tbody/tr[4]/td[4]")).Text.Trim();
                    Legal_Description          = driver.FindElement(By.XPath("/ html/body/div[2]/div/div/div/table/tbody/tr[2]/td/table/tbody/tr[5]/td[4]")).Text.Trim();

                    string assessment_details = Ward_no + "~" + Owner_Name + "~" + Improvement_Address + "~" + Homestead_Exemption_Status + "~" + Subdivision + "~" + Legal_Description;
                    gc.insert_date(orderNumber, Parcel_no, 246, assessment_details, 1, DateTime.Now);

                    //Assessment details

                    Land_Assessment        = driver.FindElement(By.XPath("/ html/body/div[2]/div/div/div/table/tbody/tr[3]/td/table/tbody/tr[2]/td[1]")).Text.Trim();
                    Improvement_Assessment = driver.FindElement(By.XPath(" / html/body/div[2]/div/div/div/table/tbody/tr[3]/td/table/tbody/tr[2]/td[2]")).Text.Trim();
                    Total_Assessment       = driver.FindElement(By.XPath("/ html/body/div[2]/div/div/div/table/tbody/tr[3]/td/table/tbody/tr[2]/td[3]")).Text.Trim();
                    string property_details = Land_Assessment + "~" + Improvement_Assessment + "~" + Total_Assessment;
                    gc.insert_date(orderNumber, Parcel_no, 247, property_details, 1, DateTime.Now);
                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");


                    string add1 = "200 Derbigny St.Suite 1200 Gretna, LA 70053", add2 = "504-363-5637", add3 = "504-363-5644";

                    string taxauthority_address = add1 + "  PH:" + add2 + "  FAX: " + add3;

                    driver.Navigate().GoToUrl("https://propertytax.jpso.com/PropertyTax/propsrch.aspx#result");
                    Thread.Sleep(3000);
                    var Select                  = driver.FindElement(By.Id("ContentPlaceHolder1_body_cboSearchBy"));
                    var selectElement1          = new SelectElement(Select);
                    selectElement1.SelectByText("Parcel #");
                    driver.FindElement(By.Id("ContentPlaceHolder1_body_txtParcel_In")).SendKeys(Parcel_no);
                    gc.CreatePdf(orderNumber, Parcel_no, "property tax search ", driver, "LA", "Jefferson");
                    driver.FindElement(By.Id("ContentPlaceHolder1_body_btSearch")).Click();
                    Thread.Sleep(3000);
                    gc.CreatePdf(orderNumber, Parcel_no, "property tax search result", driver, "LA", "Jefferson");
                    string Hex = "", Parcel_no1 = "", Notice_no = "", Assessment = "", Tax_Due = "", Tax_Year = "";
                    Hex        = driver.FindElement(By.Id("ContentPlaceHolder1_body_lblHEX")).Text.Trim();
                    Parcel_no1 = driver.FindElement(By.Id("ContentPlaceHolder1_body_lblParcel")).Text.Trim();
                    Notice_no  = driver.FindElement(By.Id("ContentPlaceHolder1_body_lblBillNum")).Text.Trim();
                    Assessment = driver.FindElement(By.Id("ContentPlaceHolder1_body_lblAssessAmt")).Text.Trim();
                    Tax_Due    = driver.FindElement(By.Id("ContentPlaceHolder1_body_lblTaxAmt")).Text.Trim();
                    Tax_Year   = driver.FindElement(By.Id("ContentPlaceHolder1_body_lblTaxYear")).Text.Trim();

                    string taxinfo_details = Hex + "~" + Assessment + "~" + Tax_Due + "~" + Tax_Year + "~" + taxauthority_address;
                    gc.insert_date(orderNumber, Parcel_no, 240, taxinfo_details, 1, DateTime.Now);
                    //    Tax Notices and Payments Details Table:
                    driver.FindElement(By.Id("ContentPlaceHolder1_body_btViewHistory")).Click();
                    Thread.Sleep(3000);
                    gc.CreatePdf(orderNumber, Parcel_no, "View history", driver, "LA", "Jefferson");
                    IWebElement         multitableElement1 = driver.FindElement(By.XPath("//*[@id='ContentPlaceHolder1_body_dgHistory']/tbody"));
                    IList <IWebElement> multitableRow1     = multitableElement1.FindElements(By.TagName("tr"));
                    IList <IWebElement> multirowTD1;
                    foreach (IWebElement row in multitableRow1)
                    {
                        if (!row.Text.Contains("Tax Year"))
                        {
                            multirowTD1 = row.FindElements(By.TagName("td"));

                            string tax_payment = multirowTD1[0].Text.Trim() + "~" + multirowTD1[1].Text.Trim() + "~" + multirowTD1[2].Text.Trim() + "~" + multirowTD1[3].Text.Trim() + "~" + multirowTD1[4].Text.Trim() + "~" + multirowTD1[5].Text.Trim() + "~" + multirowTD1[6].Text.Trim();
                            gc.insert_date(orderNumber, Parcel_no, 248, tax_payment, 1, DateTime.Now);
                        }
                    }
                    driver.FindElement(By.XPath("//*[@id='MAIN_OUTLINE_TABLE']/div[1]/div/div[2]/a")).Click();
                    Thread.Sleep(3000);

                    driver.FindElement(By.Id("ContentPlaceHolder1_body_btViewMilage")).Click();
                    Thread.Sleep(3000);
                    gc.CreatePdf(orderNumber, Parcel_no, "View millage", driver, "LA", "Jefferson");
                    string Bill_year = "", Bill_no = "", Tax_Due1 = "";

                    Bill_year = driver.FindElement(By.Id("ContentPlaceHolder1_body_lblYear")).Text.Trim();
                    Bill_no   = driver.FindElement(By.Id("ContentPlaceHolder1_body_lblBillnumber")).Text.Trim();
                    Tax_Due1  = driver.FindElement(By.Id("ContentPlaceHolder1_body_LblTaxDue")).Text.Trim();
                    string tax_Milege1 = Bill_year + "~" + Bill_no + "~" + Tax_Due1 + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "-";

                    gc.insert_date(orderNumber, Parcel_no, 257, tax_Milege1, 1, DateTime.Now);
                    try
                    {
                        IWebElement         multitableElement11 = driver.FindElement(By.XPath("//*[@id='ContentPlaceHolder1_body_dgMileage']/tbody"));
                        IList <IWebElement> multitableRow11     = multitableElement11.FindElements(By.TagName("tr"));
                        IList <IWebElement> multirowTD11;
                        foreach (IWebElement row in multitableRow11)
                        {
                            if (!row.Text.Contains("Category"))
                            {
                                multirowTD11 = row.FindElements(By.TagName("td"));

                                string tax_Milege = "-" + "~" + "-" + "~" + "-" + "~" + multirowTD11[0].Text.Trim() + "~" + multirowTD11[1].Text.Trim() + "~" + multirowTD11[2].Text.Trim() + "~" + multirowTD11[3].Text.Trim();
                                gc.insert_date(orderNumber, Parcel_no, 257, tax_Milege, 1, DateTime.Now);
                            }
                        }
                    }
                    catch { }

                    //  State Tax Commission information can be obtained through the link.

                    driver.Navigate().GoToUrl("http://www.latax.state.la.us/Menu_ParishTaxRolls/TaxRolls.aspx");
                    Thread.Sleep(3000);
                    //address search
                    var Select1         = driver.FindElement(By.Id("ctl00_ContentPlaceHolderMain_ddParish"));
                    var selectElement11 = new SelectElement(Select1);
                    selectElement11.SelectByText("JEFFERSON PARISH");
                    Thread.Sleep(1000);
                    var Select11        = driver.FindElement(By.Id("ctl00_ContentPlaceHolderMain_ddYear"));
                    var selectElement12 = new SelectElement(Select11);
                    selectElement12.SelectByIndex(2);
                    //  selectElement12.SelectByText("2017");
                    Thread.Sleep(1000);
                    driver.FindElement(By.Id("ctl00_ContentPlaceHolderMain_rbSearchField_0")).Click();
                    Thread.Sleep(1000);
                    driver.FindElement(By.Id("ctl00_ContentPlaceHolderMain_txtSearch")).SendKeys(Improvement_Address);
                    driver.FindElement(By.Id("ctl00_ContentPlaceHolderMain_btnSubmitSearch")).Click();
                    Thread.Sleep(3000);

                    driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolderMain_gvResults']/tbody/tr[2]/td[5]/a")).Click();
                    Thread.Sleep(3000);

                    //DOWNLOAD REPORT

                    IWebElement Itaxbill = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolderMain_lblReport']/a[1]"));
                    string      URL1     = Itaxbill.GetAttribute("href");
                    gc.downloadfile(URL1, orderNumber, Parcel_no, "REPORT.pdf", "LA", "Jefferson");

                    driver.FindElement(By.Id("ctl00_ContentPlaceHolderMain_lbReset")).Click();
                    Thread.Sleep(3000);
                    var Select13        = driver.FindElement(By.Id("ctl00_ContentPlaceHolderMain_ddParish"));
                    var selectElement13 = new SelectElement(Select13);
                    selectElement13.SelectByText("JEFFERSON PARISH");
                    Thread.Sleep(1000);
                    var Select14        = driver.FindElement(By.Id("ctl00_ContentPlaceHolderMain_ddYear"));
                    var selectElement14 = new SelectElement(Select14);
                    selectElement14.SelectByIndex(2);
                    //selectElement14.SelectByText("2017");
                    Thread.Sleep(1000);
                    driver.FindElement(By.Id("ctl00_ContentPlaceHolderMain_rbSearchField_1")).Click();
                    Thread.Sleep(1000);
                    driver.FindElement(By.Id("ctl00_ContentPlaceHolderMain_txtSearch")).SendKeys(Bill_no);
                    driver.FindElement(By.Id("ctl00_ContentPlaceHolderMain_btnSubmitSearch")).Click();
                    Thread.Sleep(3000);
                    driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolderMain_gvResults']/tbody/tr[2]/td[5]/a")).Click();
                    Thread.Sleep(3000);
                    //DOWNLOAD REPORT
                    IWebElement Itaxbill1 = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolderMain_lblReport']/a[1] "));
                    string      URL11     = Itaxbill1.GetAttribute("href");
                    gc.downloadfile(URL11, orderNumber, Parcel_no, "Assessment_REPORT.pdf", "LA", "Jefferson");

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

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

                    driver.Quit();
                    gc.mergpdf(orderNumber, "LA", "Jefferson");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    throw ex;
                }
            }
        }
Esempio n. 18
0
        public string FTP_OKTulsa(string houseno, string sname, string direction, string sttype, string parcelNumber, string searchType, string accountnumber, string orderNumber, string ownername, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

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

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

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

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

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

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

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

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

                        catch { }
                    }

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

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

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

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

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

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

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

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

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

                        catch { }
                    }

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

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

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


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

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


                    //Assessment information
                    //insert year

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



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

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

                    //}

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

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

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


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


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

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


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

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

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

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


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

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

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

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

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

                    driver.Quit();
                    gc.mergpdf(orderNumber, "OK", "Tulsa");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw ex;
                }
            }
        }
Esempio n. 19
0
        public string FTP_Harrison(string houseno, string sname, string sttype, string parcelNumber, string searchType, string orderNumber, string ownername, string directParcel, string account)
        {
            string        NAME = "", PROPERTY = "", ADDRESS = "", PARCEL = "";
            string        Parcel_No = "-", Owner_Name = "-", Property_Address = "-", Legal_Description = "-", Exempt_Code = "-", Homestead_Code = "-", PPIN = "-", Section = "-", Township = "-", Range = "-";
            string        Tax_Year = "-", Assessed_Land_Value = "-", Assessed_Improvement_Value = "-", Total_Value = "-", Assessed = "-";
            List <string> Li = new List <string>();
            IWebElement   link;
            string        mp = "";

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

            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";
            string addr    = sname + " " + sttype;
            string address = houseno + addr;

            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())
            {
                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");
                    if (HttpContext.Current.Session["MobileTax_harrison"] == null)
                    {
                        if (searchType == "titleflex")
                        {
                            gc.TitleFlexSearch(orderNumber, parcelNumber, "", address, "MS", "Harrison");
                            if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                            {
                                driver.Quit();
                                return("MultiParcel");
                            }
                            else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                            {
                                HttpContext.Current.Session["Nodata_HarrisonMS"] = "Yes";
                                driver.Quit();
                                return("No Data Found");
                            }
                            parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                            searchType   = "parcel";
                        }

                        if (searchType == "address")
                        {
                            driver.Navigate().GoToUrl("http://www.deltacomputersystems.com/MS/MS24DELTA/plinkquerym.html");
                            driver.FindElement(By.XPath("/html/body/table/tbody/tr[5]/td[2]/form/table/tbody/tr[2]/td[2]/input[1]")).SendKeys(houseno);

                            driver.FindElement(By.XPath("/html/body/table/tbody/tr[5]/td[2]/form/table/tbody/tr[2]/td[2]/input[2]")).SendKeys(addr);
                            gc.CreatePdf_WOP(orderNumber, "Address Search", driver, "MS", "Harrison");
                            driver.FindElement(By.XPath("/html/body/table/tbody/tr[5]/td[2]/form/input[1]")).SendKeys(Keys.Enter);
                            gc.CreatePdf_WOP(orderNumber, "Address Search Result", driver, "MS", "Harrison");
                            Thread.Sleep(3000);

                            IWebElement         tb = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody"));
                            IList <IWebElement> TR = tb.FindElements(By.TagName("tr"));
                            string Address         = houseno + " " + addr;
                            int    a     = 1;
                            bool   value = false;

                            foreach (IWebElement row1 in TR)

                            {
                                if ((row1.Text.Contains(Address.ToUpper().Trim())) && (!row1.Text.Contains("PROPERTY")))

                                {
                                    mp = "/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + a + "]/td[1]/a";

                                    value = true;
                                    //multiparcel
                                    NAME    = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + a + "]/td[3]/font")).Text;
                                    ADDRESS = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + a + "]/td[1]/a/font")).Text;
                                    PARCEL  = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + a + "]/td[2]/font")).Text;

                                    Li.Add(NAME);
                                    string multi = NAME + "~" + ADDRESS;
                                    gc.insert_date(orderNumber, PARCEL, 87, multi, 1, DateTime.Now);

                                    //break;
                                }
                                a++;
                            }

                            //Multi parcel
                            if (Li.Count > 1)
                            {
                                HttpContext.Current.Session["multiparcel_harrison"] = "Yes";
                                gc.CreatePdf_WOP(orderNumber, "Address MultiParcel", driver, "MS", "Harrison");
                                driver.Quit();
                                return("MultiParcel");
                            }
                            else if (mp != "")
                            {
                                link = driver.FindElement(By.XPath(mp));
                                link.SendKeys(Keys.Enter);
                            }
                            if (!value)
                            {
                                int b = 1;
                                driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/a[1]")).SendKeys(Keys.Enter);
                                IWebElement         tb1 = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody"));
                                IList <IWebElement> TR1 = tb1.FindElements(By.TagName("tr"));
                                foreach (IWebElement row2 in TR1)
                                {
                                    if ((row2.Text.Contains(Address.ToUpper().Trim())) && (!row2.Text.Contains("PROPERTY")))

                                    {
                                        driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + b + "]/td[1]/a")).SendKeys(Keys.Enter);

                                        break;
                                    }
                                    b++;
                                }
                            }
                        }

                        else if (searchType == "parcel")
                        {
                            driver.Navigate().GoToUrl("http://www.deltacomputersystems.com/MS/MS24DELTA/plinkquerym.html");
                            gc.CreatePdf(orderNumber, parcelNumber, "Parcel search", driver, "MS", "Harrison");


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

                            string first  = parcelNumber.Substring(0, 5);
                            string second = parcelNumber.Substring(5, 2);
                            string third  = parcelNumber.Substring(7, 3);
                            string fourth = parcelNumber.Substring(10, 3);
                            parcelNumber = first + "-" + second + "-" + third + "." + fourth;
                            driver.FindElement(By.XPath("/html/body/table/tbody/tr[5]/td[2]/form/table/tbody/tr[3]/td[2]/input")).SendKeys(parcelNumber);
                            gc.CreatePdf(orderNumber, parcelNumber, "Parcel search result", driver, "MS", "Harrison");
                            Thread.Sleep(3000);
                            driver.FindElement(By.XPath("/html/body/table/tbody/tr[5]/td[2]/form/input[1]")).SendKeys(Keys.Enter);
                            Thread.Sleep(3000);
                            IWebElement         tb = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody"));
                            IList <IWebElement> TR = tb.FindElements(By.TagName("tr"));

                            int a = 1;

                            foreach (IWebElement row1 in TR)
                            {
                                if ((row1.Text.Contains(parcelNumber.Trim())) && (!row1.Text.Contains("PROPERTY")))
                                {
                                    driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + a + "]/td[1]/a")).SendKeys(Keys.Enter);
                                    break;
                                }
                                a++;
                            }
                        }

                        else if (searchType == "ownername")
                        {
                            HttpContext.Current.Session["multiparcel_harrison"] = "Yes";
                            driver.Navigate().GoToUrl("http://www.deltacomputersystems.com/MS/MS24DELTA/plinkquerym.html");
                            gc.CreatePdf_WOP(orderNumber, "Owner Search", driver, "MS", "Harrison");
                            string[] on     = ownername.Split(' ');
                            string   first  = on[0];
                            string   second = on[1];
                            ownername = first + " " + second;

                            driver.FindElement(By.XPath("/html/body/table/tbody/tr[5]/td[2]/form/table/tbody/tr[1]/td[2]/input[4]")).SendKeys(ownername);
                            Thread.Sleep(3000);
                            driver.FindElement(By.XPath("/html/body/table/tbody/tr[5]/td[2]/form/input[1]")).SendKeys(Keys.Enter);
                            gc.CreatePdf_WOP(orderNumber, "Owner Search result", driver, "MS", "Harrison");
                            Thread.Sleep(3000);
                            IWebElement         tb = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody"));
                            IList <IWebElement> TR = tb.FindElements(By.TagName("tr"));

                            int a = 1;

                            foreach (IWebElement row1 in TR)

                            {
                                if ((row1.Text.Contains(ownername.ToUpper().Trim())) && (!row1.Text.Contains("PROPERTY")))

                                {
                                    NAME     = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + a + "]/td[1]/a/font")).Text;
                                    PROPERTY = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + a + "]/td[2]/font")).Text;
                                    ADDRESS  = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + a + "]/td[3]/font")).Text;
                                    PARCEL   = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + a + "]/td[4]/font")).Text;

                                    ADDRESS = PROPERTY + ADDRESS;
                                    string multi = NAME + "~" + ADDRESS;
                                    gc.insert_date(orderNumber, PARCEL, 87, multi, 1, DateTime.Now);
                                }
                                a++;
                            }

                            driver.Quit();
                            return("MultiParcel");
                        }
                        Thread.Sleep(3000);

                        gc.CreatePdf_WOP(orderNumber, "Property and Tax details result", driver, "MS", "Harrison");
                        //Property Details
                        Parcel_No         = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[2]/td/table/tbody/tr[6]/td[2]/font")).Text.Trim();
                        Owner_Name        = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[2]/td/table/tbody/tr[1]/td[2]/font")).Text.Trim();
                        Property_Address  = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[2]/td/table/tbody/tr[7]/td[2]/font")).Text.Trim();
                        Legal_Description = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[1]/td[4]/font")).Text.Trim();
                        string ab = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[2]/td[4]/font")).Text.Trim();
                        string ac = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[3]/td[4]/font")).Text.Trim();
                        string ad = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[4]/td[4]/font")).Text.Trim();
                        Legal_Description = Legal_Description + ab + ac + ad.Trim();
                        Exempt_Code       = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[2]/td[2]/font")).Text.Trim();
                        Homestead_Code    = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[3]/td[2]/font")).Text.Trim();
                        PPIN     = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[4]/td[2]/font")).Text.Trim();
                        Section  = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[5]/td[2]/font")).Text.Trim();
                        Township = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[6]/td[2]/font")).Text.Trim();
                        Range    = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table/tbody/tr[7]/td[2]/font")).Text.Trim();

                        string prop = Owner_Name + "~" + Property_Address + "~" + Legal_Description + "~" + Exempt_Code + "~" + Homestead_Code + "~" + PPIN + "~" + Section + "~" + Township + "~" + Range;
                        gc.insert_date(orderNumber, Parcel_No, 88, prop, 1, DateTime.Now);

                        //Assessment details
                        Tax_Year                   = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[1]/tbody/tr[3]/td[2]/font[1]/b")).Text;
                        Tax_Year                   = WebDriverTest.After(Tax_Year, "Year ");
                        Assessed_Land_Value        = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[2]/td/table/tbody/tr[2]/td[4]/font")).Text;
                        Assessed_Improvement_Value = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[2]/td/table/tbody/tr[3]/td[4]/font")).Text;
                        Total_Value                = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[2]/td/table/tbody/tr[4]/td[4]/font")).Text;
                        Assessed                   = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[2]/td/table/tbody/tr[5]/td[4]/font")).Text;

                        string assessment = Tax_Year + "~" + Assessed_Land_Value + "~" + Assessed_Improvement_Value + "~" + Total_Value + "~" + Assessed;
                        gc.insert_date(orderNumber, Parcel_No, 89, assessment, 1, DateTime.Now);
                        AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                        //Tax details

                        string YEAR_2017 = "-", TAX_DUE = "-", PAID = "-", BALANCE = "-", Mail_Payments_To = "-", LAST_PAYMENT_DATE = "-";
                        try
                        {
                            Mail_Payments_To = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[4]/td/table/tbody/tr[6]/td[4]/font/b/p")).Text;
                        }
                        catch { }
                        try
                        {
                            LAST_PAYMENT_DATE = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[4]/td/table/tbody/tr[7]/td[2]/font")).Text;
                        }
                        catch { }
                        try
                        {
                            if (Mail_Payments_To.Trim() == "")
                            {
                                Mail_Payments_To = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[4]/td/table/tbody/tr[7]/td[4]/font/b/p")).Text;
                            }
                        }
                        catch { }
                        try
                        {
                            if (LAST_PAYMENT_DATE.Trim() == "")
                            {
                                LAST_PAYMENT_DATE = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[4]/td/table/tbody/tr[8]/td[2]/font")).Text;
                            }
                        }
                        catch { }

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


                        IWebElement         TBTax = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[4]/td/table/tbody"));
                        IList <IWebElement> TRTax = TBTax.FindElements(By.TagName("tr"));
                        IList <IWebElement> TDTax;
                        //  int count = TRTax.Count - 2;
                        // int i = 1;
                        foreach (IWebElement row1 in TRTax)
                        {
                            if (!row1.Text.Contains("YEAR") && !row1.Text.Contains("Mail") && !row1.Text.Contains("LAST PAYMENT DATE") && !row1.Text.Contains("DELINQUENT PRIOR"))
                            {
                                TDTax     = row1.FindElements(By.TagName("td"));
                                YEAR_2017 = TDTax[0].Text;
                                TAX_DUE   = TDTax[1].Text;
                                PAID      = TDTax[2].Text;
                                BALANCE   = TDTax[3].Text;
                                string tax = Owner_Name + "~" + Tax_Year + "~" + YEAR_2017 + "~" + TAX_DUE + "~" + PAID + "~" + BALANCE + "~" + Mail_Payments_To + "~" + LAST_PAYMENT_DATE;
                                gc.insert_date(orderNumber, Parcel_No, 90, tax, 1, DateTime.Now);
                            }
                            // i++;
                        }

                        //tax history details
                        string Year = "-", Owner = "-", Total_Tax = "=", PaidYN = "-", Last_Payment_Date = "-";

                        IWebElement         TBTax_History = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[6]/td/table"));
                        IList <IWebElement> TRTax_History = TBTax_History.FindElements(By.TagName("tr"));
                        IList <IWebElement> TDTax_History;
                        foreach (IWebElement row1 in TRTax_History)
                        {
                            if (row1.Text.Contains("LAST PAYMENT DATE"))
                            {
                                TDTax_History     = row1.FindElements(By.TagName("td"));
                                Year              = TDTax_History[0].Text;
                                Owner             = TDTax_History[1].Text;
                                Total_Tax         = TDTax_History[2].Text;
                                PaidYN            = TDTax_History[3].Text;
                                Last_Payment_Date = WebDriverTest.After(PaidYN, "DATE ");
                                PaidYN            = WebDriverTest.Before(PaidYN, "LAST");
                                if (PaidYN.Contains("\r\n"))
                                {
                                    PaidYN = PaidYN.Replace("\r\n", "").Trim();
                                }

                                string tax_history = Year + "~" + Owner + "~" + Total_Tax + "~" + PaidYN + "~" + Last_Payment_Date;
                                gc.insert_date(orderNumber, Parcel_No, 91, tax_history, 1, DateTime.Now);
                            }
                        }
                    }

                    //Mobile tax
                    string ACCOUNT = "", Mobile_tax_Onwer_NAME = "", MAKE = "", strTaxesFees = "";
                    string Account = "-", Receipt = "-", Due_Date = "-", Landroll_PPIN = "-", Court_Code = "-", Court_Lot = "-", Trailer_Make = "-", Number_of_Stories = "-", Number_of_Owners = "-", Width = "-", Length = "-", Model_Year = "-", Color = "-", MobileTax_Owner_Name = "-", MobileTax_Address = "-";
                    string Millage_Tax_Year = "-", Value_Table_Year = "-", Tax_District1 = "-", Tax_District2 = "-", Tax_District3 = "-", Judicial_District = "-", Full_Value = "-", MobileTax_Total_Value = "-", Prorated_Value = "-", County_Tax_Rate = "-", County_Tax_Due = "-", City_Tax_Rate = "-", City_Tax_Due = "-", School_Tax_Due = "-", School_Tax_Rate = "-", Total_Due = "-", TAXES_PAID = "-", Estimated_Balance_Due = "-";
                    driver.Navigate().GoToUrl("http://www.deltacomputersystems.com/MS/MS24DELTA/mhinquirym2.html");
                    gc.CreatePdf_WOP(orderNumber, "Mobile Tax", driver, "MS", "Harrison");
                    if (Parcel_No == "-")
                    {
                        driver.FindElement(By.XPath("//*[@id='HTMPARCEL']")).SendKeys(parcelNumber);
                    }
                    else
                    {
                        driver.FindElement(By.XPath("//*[@id='HTMPARCEL']")).SendKeys(Parcel_No);
                    }

                    driver.FindElement(By.XPath("/html/body/table/tbody/tr[5]/td[2]/form/div/table/tbody/tr[9]/td[2]/input[1]")).SendKeys(Keys.Enter);
                    gc.CreatePdf_WOP(orderNumber, "Mobile Homes Result", driver, "MS", "Harrison");

                    IWebElement         TB_mobiletax = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody"));
                    IList <IWebElement> TRmobiletax  = TB_mobiletax.FindElements(By.TagName("tr"));
                    IList <IWebElement> TDmobiletax;
                    if (account == "")
                    {
                        foreach (IWebElement row2 in TRmobiletax)
                        {
                            if (!row2.Text.Contains("ACCOUNT") && row2.Text.Contains(Parcel_No))
                            {
                                TDmobiletax           = row2.FindElements(By.TagName("td"));
                                ACCOUNT               = TDmobiletax[0].Text;
                                Mobile_tax_Onwer_NAME = TDmobiletax[1].Text;
                                MAKE = TDmobiletax[2].Text;

                                HttpContext.Current.Session["MobileTax_harrison"] = "Yes";
                                string mb = ACCOUNT + "~" + Mobile_tax_Onwer_NAME + "~" + MAKE;
                                gc.insert_date(orderNumber, Parcel_No, 92, mb, 1, DateTime.Now);
                                try
                                {
                                    string deli = TDmobiletax[7].Text;
                                    if (deli.Contains("Delinquent"))
                                    {
                                        HttpContext.Current.Session["deliquent_harrison"] = "Yes";
                                    }
                                }
                                catch { }
                            }
                        }
                    }

                    else
                    {
                        int    d           = 1;
                        string mobile_Prop = "";
                        string mobile_tax  = "";
                        foreach (IWebElement row2 in TRmobiletax)
                        {
                            if (row2.Text.Contains(account))
                            {
                                IWebElement         element = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody/tr[" + d + "]/td[1]/a/font"));
                                IJavaScriptExecutor js      = driver as IJavaScriptExecutor;
                                js.ExecuteScript("arguments[0].click();", element);
                                gc.CreatePdf_WOP(orderNumber, "Mobile Homes Tax and property Result", driver, "MS", "Harrison");
                                Thread.Sleep(3000);

                                //Mobile tax property details

                                IWebElement         TB_mobile = driver.FindElement(By.XPath("/html/body/table/tbody/tr[4]/td[2]/table[3]/tbody"));
                                IList <IWebElement> TRmobile  = TB_mobile.FindElements(By.TagName("tr"));
                                IList <IWebElement> TDmobile;

                                foreach (IWebElement row3 in TRmobile)
                                {
                                    TDmobile = row3.FindElements(By.TagName("td"));
                                    if (row3.Text.Contains("Account"))
                                    {
                                        Account = TDmobile[2].Text.ToString();
                                        Account = WebDriverTest.Before(Account, " Year");
                                    }
                                    if (row3.Text.Contains("Receipt"))
                                    {
                                        Receipt = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Due Date"))
                                    {
                                        Due_Date = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Landroll PPIN"))
                                    {
                                        Landroll_PPIN = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Court Code"))
                                    {
                                        Court_Code = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Court Lot"))
                                    {
                                        Court_Lot = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Trailer Make"))
                                    {
                                        Trailer_Make = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Number of Stories"))
                                    {
                                        Number_of_Stories = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Number of Owners"))
                                    {
                                        Number_of_Owners = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Width"))
                                    {
                                        Width = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Length"))
                                    {
                                        Length = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Model Year"))
                                    {
                                        Model_Year = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Color"))
                                    {
                                        Color = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Name"))
                                    {
                                        MobileTax_Owner_Name = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Address 1"))
                                    {
                                        MobileTax_Address = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Zip"))
                                    {
                                        string city1 = TDmobile[2].Text.ToString();
                                        MobileTax_Address = MobileTax_Address + city1;
                                    }


                                    mobile_Prop = Account + "~" + Receipt + "~" + Due_Date + "~" + Landroll_PPIN + "~" + Court_Code + "~" + Court_Lot + "~" + Trailer_Make + "~" + Number_of_Stories + "~" + Number_of_Owners + "~" + Width + "~" + Length + "~" + Model_Year + "~" + Color + "~" + MobileTax_Owner_Name + "~" + MobileTax_Address;

                                    //Mobile Home Current Tax & Fees Details
                                    if (row3.Text.Contains("TAXES & FEES"))
                                    {
                                        strTaxesFees = "TAXES & FEES";
                                    }
                                    if (row3.Text.Contains("Millage"))
                                    {
                                        Millage_Tax_Year = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Value Table Year"))
                                    {
                                        Value_Table_Year = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Tax District 1"))
                                    {
                                        Tax_District1 = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Tax District 2"))
                                    {
                                        Tax_District2 = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Tax District 3"))
                                    {
                                        Tax_District3 = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Judicial District"))
                                    {
                                        Judicial_District = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Full Value"))
                                    {
                                        Full_Value = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Total Value"))
                                    {
                                        MobileTax_Total_Value = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Prorated Value"))
                                    {
                                        Prorated_Value = TDmobile[2].Text.ToString();
                                    }
                                    if (row3.Text.Contains("County"))
                                    {
                                        County_Tax_Rate = TDmobile[2].Text.ToString();
                                        County_Tax_Due  = TDmobile[3].Text.ToString();
                                    }

                                    if (row3.Text.Contains("City") && strTaxesFees == "TAXES & FEES")
                                    {
                                        City_Tax_Rate = TDmobile[2].Text.ToString();
                                        City_Tax_Due  = TDmobile[3].Text.ToString();
                                    }

                                    if (row3.Text.Contains("School"))
                                    {
                                        School_Tax_Due  = TDmobile[2].Text.ToString();
                                        School_Tax_Rate = TDmobile[3].Text.ToString();
                                    }

                                    if (row3.Text.Contains("Total Due"))
                                    {
                                        Total_Due = TDmobile[3].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Taxes Paid"))
                                    {
                                        TAXES_PAID = TDmobile[3].Text.ToString();
                                    }
                                    if (row3.Text.Contains("Estimated Balance Due"))
                                    {
                                        Estimated_Balance_Due = TDmobile[3].Text.ToString();
                                    }

                                    mobile_tax = Millage_Tax_Year + "~" + Value_Table_Year + "~" + Tax_District1 + "~" + Tax_District2 + "~" + Tax_District3 + "~" + Judicial_District + "~" + Full_Value + "~" + MobileTax_Total_Value + "~" + Prorated_Value + "~" + County_Tax_Rate + "~" + County_Tax_Due + "~" + City_Tax_Rate + "~" + City_Tax_Due + "~" + School_Tax_Due + "~" + School_Tax_Rate + "~" + Total_Due + "~" + TAXES_PAID + "~" + Estimated_Balance_Due;
                                }

                                gc.insert_date(orderNumber, parcelNumber, 94, mobile_Prop, 1, DateTime.Now);
                                gc.insert_date(orderNumber, parcelNumber, 95, mobile_tax, 1, DateTime.Now);
                                break;
                            }
                            d++;
                        }
                    }

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

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

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

                catch (NoSuchElementException ex1)
                {
                    driver.Quit();
                    throw ex1;
                }
            }
        }
Esempio n. 20
0
        public string FTP_NCGuilford(string houseno, string sname, string sttype, string unitno, string parcelNumber, string searchType, string orderNumber, string ownername, string directParcel)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;

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

            //IWebElement iframeElement1;
            var driverService = PhantomJSDriverService.CreateDefaultService();

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

                    driver.Navigate().GoToUrl("http://taxcama.guilfordcountync.gov/camapwa/SearchProperty.aspx");

                    if (searchType == "address")
                    {
                        driver.FindElement(By.XPath("//*[@id='panelSummary']/li[2]/a")).Click();
                        Thread.Sleep(2000);
                        driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_StreetNumberTextBox")).SendKeys(houseno);
                        driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_StreetNameTextBox")).SendKeys(sname.Trim());
                        gc.CreatePdf_WOP(orderNumber, "Address Search", driver, "NC", "Guilford");
                        driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_AddressButton")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);
                        gc.CreatePdf_WOP(orderNumber, "Address Search result", driver, "NC", "Guilford");

                        //try {
                        //    string mul = driver.FindElement(By.Id("ctl00_SearchPageHeader_SearchResultDetailsLabel")).Text;

                        //    mul = WebDriverTest.Before(mul, " Records");


                        //    if ((mul != "1") && (mul != "0"))
                        //    {
                        //        //multi parcel
                        //        try
                        //        {
                        //           tbmulti3 = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder2_ParcelStreetsGridView']/tbody"));

                        //        }
                        //        catch { }
                        //        try
                        //        {
                        //            tbmulti3 = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder2_streetDictionaryResultsGridView']/tbody"));
                        //        }
                        //        catch { }
                        //        IList<IWebElement> TRmulti3 = tbmulti3.FindElements(By.TagName("tr"));
                        //        int maxCheck = 0;
                        //        IList<IWebElement> TDmulti3;
                        //        foreach (IWebElement row in TRmulti3)
                        //        {
                        //            if (maxCheck <= 25)
                        //            {
                        //                TDmulti3 = row.FindElements(By.TagName("td"));
                        //                if (TDmulti3.Count != 0)
                        //                {//Parcel Number~Address~Owner Name
                        //                    string multi1 = TDmulti3[1].Text + " " + TDmulti3[4].Text + " " + TDmulti3[5].Text + "~" + TDmulti3[8].Text;
                        //                    gc.insert_date(orderNumber, TDmulti3[0].Text, 597, multi1, 1, DateTime.Now);
                        //                }
                        //                maxCheck++;
                        //            }
                        //        }

                        //        if (TRmulti3.Count > 25)
                        //        {
                        //            HttpContext.Current.Session["multiParcel_Guilford_Multicount"] = "Maximum";
                        //        }
                        //        else
                        //        {
                        //            HttpContext.Current.Session["multiparcel_Guilford"] = "Yes";
                        //        }
                        //        driver.Quit();
                        //        return "MultiParcel";
                        //    }
                        //    else
                        //    {
                        //        driver.FindElement(By.XPath(" //*[@id='ctl00_ContentPlaceHolder2_ParcelStreetsGridView']/tbody/tr[2]/td[1]/a")).Click();
                        //        Thread.Sleep(2000);
                        //        try
                        //        {
                        //            driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder2_streetDictionaryResultsGridView']/tbody")).Click();
                        //        }
                        //        catch { }
                        //    }
                        //}
                        //catch { }
                        // CreatePdf_WOP(orderNumber, "Multiparcel Address Search");
                        try
                        {
                            string mul = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/span")).Text;
                            mul = WebDriverTest.Before(mul, "Records").Trim();

                            int i, j = 2;
                            if ((mul != "1") && (mul != "0"))
                            {
                                int iRowsCount = driver.FindElements(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_streetDictionaryResultsGridView']/tbody/tr")).Count;
                                for (i = 2; i <= iRowsCount; i++)
                                {
                                    if (j >= 2 && i != 2)
                                    {
                                        IWebElement checkbox1 = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_streetDictionaryResultsGridView_ctl0" + j + "_CheckBox1']"));
                                        // checkbox.Clear();
                                        checkbox1.Click();
                                        Thread.Sleep(1000);
                                        j++;
                                    }
                                    IWebElement checkbox = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_streetDictionaryResultsGridView_ctl0" + i + "_CheckBox1']"));
                                    // checkbox.Clear();
                                    checkbox.Click();
                                    Thread.Sleep(1000);
                                    driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_StreetDictionarySearchButton")).SendKeys(Keys.Enter);
                                    Thread.Sleep(1000);
                                    string mul1 = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/span")).Text;
                                    mul1 = GlobalClass.Before(mul1, " Records Matched Search Criteria").Trim();
                                    int count = Convert.ToInt32(mul1);
                                    if (count > 0)
                                    {   //multi parcel
                                        gc.CreatePdf_WOP(orderNumber, "Multiparcel Result", driver, "NC", "Guilford");
                                        IWebElement         tbmulti2 = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_ParcelStreetsGridView']/tbody"));
                                        IList <IWebElement> TRmulti2 = tbmulti2.FindElements(By.TagName("tr"));
                                        IList <IWebElement> TDmulti2;
                                        int rescount = TRmulti2.Count;

                                        foreach (IWebElement row in TRmulti2)
                                        {
                                            TDmulti2 = row.FindElements(By.TagName("td"));

                                            if (TDmulti2.Count != 0 && TDmulti2[1].Text.Trim() != "" && !row.Text.Contains("Pfx") && TDmulti2.Count == 9)
                                            {
                                                IWebElement multiparcellink = TDmulti2[0].FindElement(By.TagName("a"));
                                                string      strmulti        = multiparcellink.GetAttribute("href");
                                                multiparcel.Add(strmulti);
                                                string multi1 = TDmulti2[1].Text + " " + TDmulti2[4].Text + "~" + TDmulti2[8].Text;

                                                if (TDmulti2[1].Text == houseno || houseno == "0")
                                                {
                                                    gc.insert_date(orderNumber, TDmulti2[0].Text, 597, multi1, 1, DateTime.Now);
                                                }
                                                //  Owner~address
                                            }
                                        }
                                    }
                                    driver.Navigate().Back();
                                    Thread.Sleep(1000);
                                }

                                if (multiparcel.Count > 1)
                                {
                                    HttpContext.Current.Session["multiparcel_Guilford"] = "Yes";
                                    driver.Quit();
                                    return("MultiParcel");
                                }
                                else
                                {
                                    foreach (string real in multiparcel)
                                    {
                                        driver.Navigate().GoToUrl(real);
                                        Thread.Sleep(4000);
                                    }
                                }
                            }
                            else
                            {
                                driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_ParcelStreetsGridView']/tbody/tr[2]/td[1]/a")).SendKeys(Keys.Enter);
                                Thread.Sleep(2000);
                            }
                        }
                        catch { }
                    }
                    if (searchType == "titleflex")
                    {
                        string titleaddress = houseno + " " + sname + " " + sttype + " " + unitno;
                        gc.TitleFlexSearch(orderNumber, "", "", titleaddress, "NC", "Guilford");
                        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_NCGuilford"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "parcel")
                    {
                        Thread.Sleep(3000);
                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        }

                        driver.FindElement(By.XPath("//*[@id='panelSummary']/li[3]/a")).Click();
                        Thread.Sleep(2000);
                        driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_REIDTextBox")).SendKeys(parcelNumber);
                        gc.CreatePdf(orderNumber, parcelNumber, "Parcel Search", driver, "NC", "Guilford");
                        driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_ReidButton")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);
                    }
                    if (searchType == "block")
                    {
                        driver.FindElement(By.Id("__tab_ctl00_ContentPlaceHolder1_Tabs_PinTabPanel")).Click();
                        Thread.Sleep(2000);
                        string unitNum = unitno.Replace(" ", "");
                        driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Tabs_PinTabPanel_PINNumberTextBox")).SendKeys(sttype);
                        gc.CreatePdf_WOP(orderNumber, "block Search", driver, "NC", "Guilford");
                        driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Tabs_PinTabPanel_PinButton")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);
                    }
                    if (searchType == "ownername")
                    {
                        driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_OwnerTextBox")).SendKeys(ownername);
                        gc.CreatePdf_WOP(orderNumber, "Owner Search", driver, "NC", "Guilford");
                        driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_OwnerButton")).SendKeys(Keys.Enter);
                        Thread.Sleep(2000);

                        try
                        {
                            string mul = driver.FindElement(By.Id("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/span")).Text;

                            mul = WebDriverTest.Before(mul, " Records");


                            if ((mul != "1") && (mul != "0"))
                            {
                                //multi parcel
                                //*[@id="ctl00_ContentPlaceHolder2_OwnerSearchResultsGridView"]/tbody
                                IWebElement         tbmulti4 = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder2_OwnerSearchResultsGridView']/tbody"));
                                IList <IWebElement> TRmulti4 = tbmulti4.FindElements(By.TagName("tr"));
                                int maxCheck = 0;
                                IList <IWebElement> TDmulti4;
                                foreach (IWebElement row in TRmulti4)
                                {
                                    if (maxCheck <= 25)
                                    {
                                        TDmulti4 = row.FindElements(By.TagName("td"));
                                        if (TDmulti4.Count != 0)
                                        {
                                            string multi1 = TDmulti4[1].Text + "~" + TDmulti4[2].Text;
                                            gc.insert_date(orderNumber, TDmulti4[0].Text, 597, multi1, 1, DateTime.Now);
                                        }
                                        maxCheck++;
                                    }
                                }

                                if (TRmulti4.Count > 25)
                                {
                                    HttpContext.Current.Session["multiParcel_Guilford_Multicount"] = "Maximum";
                                }
                                else
                                {
                                    HttpContext.Current.Session["multiparcel_Guilford"] = "Yes";
                                }
                                driver.Quit();
                                return("MultiParcel");
                            }
                            else
                            {
                                driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_OwnerSearchResultsGridView']/tbody/tr[2]/td[3]/a")).Click();
                            }
                        }
                        catch { }
                    }

                    try
                    {
                        IWebElement INodata = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div/div/div/div/table"));
                        if (INodata.Text.Contains("0 Records Matched Search Criteria"))
                        {
                            HttpContext.Current.Session["Nodata_NCGuilford"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                    }
                    catch { }
                    //property_details

                    //PIN #~Location Address~Property Description~Property Owner~City~Land Class~Acreage~Year Built
                    string parcel_no = "", pin = "", location_address = "", PropertyDescription = "", PropertyOwner = "";
                    string city = "", Land_class = "", Acreage = "", year_built = "";
                    string reid = driver.FindElement(By.Id("ctl00_PageHeader1_ReidLabelInfo")).Text.Trim();
                    parcel_no = driver.FindElement(By.Id("ctl00_PageHeader1_ReidLabelInfo")).Text.Trim();
                    gc.CreatePdf(orderNumber, parcel_no, "property details", driver, "NC", "Guilford");
                    pin = driver.FindElement(By.Id("ctl00_PageHeader1_PinLabelInfo")).Text.Trim();
                    location_address    = driver.FindElement(By.Id("ctl00_PageHeader1_LocationAddressLabelInfo")).Text.Trim();
                    PropertyDescription = driver.FindElement(By.Id("ctl00_PageHeader1_PropertyDescriptionLabelInfo")).Text.Trim();
                    PropertyOwner       = driver.FindElement(By.Id("ctl00_PageHeader1_DetailsView1")).Text.Trim();
                    string bulkpropertytext = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_DetailsView5']/tbody")).Text;
                    city       = gc.Between(bulkpropertytext, "City", "Fire District").Trim();
                    Land_class = gc.Between(bulkpropertytext, "Land Class", "History REID 1").Trim();
                    Acreage    = gc.Between(bulkpropertytext, "Acreage", "Permit Date").Trim();

                    driver.FindElement(By.Id("ctl00_PageHeader1_BuildingsHyperLink")).Click();
                    gc.CreatePdf(orderNumber, parcel_no, "Building details", driver, "NC", "Guilford");
                    try
                    {
                        year_built = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_DetailsView4_Label1")).Text.Trim();
                        //year_built = gc.Between(year_built, "", "").Trim();
                    }
                    catch { }

                    string Land_Value = "", Building_Value = "", Outbuilding_Value = "", Appraised_Value = "", OtherExemptions = "", UseValueDeferred = "", Historic_Value_Deferred = "", Total_Deferred_Value = "", Total_Assessed_Value = "";
                    string bulkassessmenttext = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_table8']/tbody")).Text;;


                    string            currentHandle     = driver.CurrentWindowHandle;
                    IWebElement       element           = driver.FindElement(By.LinkText("Print Property Info"));
                    PopupWindowFinder finder            = new PopupWindowFinder(driver);
                    string            popupWindowHandle = finder.Click(element);
                    driver.SwitchTo().Window(popupWindowHandle);
                    gc.CreatePdf(orderNumber, parcel_no, "Assessment Details", driver, "NC", "Guilford");
                    Thread.Sleep(3000);
                    IWebElement         asstableElement    = driver.FindElement(By.XPath("//*[@id='headerPlaceholder']/div/div[4]/div/table/tbody"));
                    IList <IWebElement> asstableElementRow = asstableElement.FindElements(By.TagName("tr"));
                    IList <IWebElement> asstableElementRowTD;
                    IList <IWebElement> asstableElementRowTH;
                    var assesscolumn = ""; var assessvalue = "";
                    foreach (IWebElement rowid in asstableElementRow)
                    {
                        asstableElementRowTD = rowid.FindElements(By.TagName("td"));
                        asstableElementRowTH = rowid.FindElements(By.TagName("th"));
                        if (asstableElementRowTD.Count != 0 && !rowid.Text.Contains("Property Value") && rowid.Text != "")
                        {
                            if (asstableElementRowTD[0].Text != " ")
                            {
                                assesscolumn += asstableElementRowTH[0].Text + "~";
                                assessvalue  += asstableElementRowTD[0].Text + "~";
                            }
                        }
                    }
                    assesscolumn = assesscolumn.TrimEnd('~');
                    assessvalue  = assessvalue.TrimEnd('~');

                    DBconnection dbconn = new DBconnection();
                    dbconn.ExecuteQuery("update data_field_master set Data_Fields_Text='" + assesscolumn + "' where Id = '" + 599 + "'");
                    gc.insert_date(orderNumber, parcel_no, 599, assessvalue, 1, DateTime.Now);



                    //     Total Appraised Land Value~Total Appraised Building Value~Total Appraised Outbuilding Value~Total Appraised Value~Other Exemptions~Use Value Deferred~Historic Value Deferred~Total Deferred Value~Total Assessed Value
                    //Land_Value = gc.Between(bulkassessmenttext, "TotalAppraisedLandValue", "TotalAppraisedBuildingValue").Trim();
                    //Building_Value = gc.Between(bulkassessmenttext, "TotalAppraisedBuildingValue", "TotalAppraisedOutbuildingValue").Trim();
                    //Outbuilding_Value = gc.Between(bulkassessmenttext, "TotalAppraisedOutbuildingValue", "TotalAppraisedValue").Trim();
                    //Appraised_Value = gc.Between(bulkassessmenttext, "TotalAppraisedValue", "OtherExemptions").Trim();
                    //OtherExemptions = gc.Between(bulkassessmenttext, "OtherExemptions", "UseValueDeferred").Trim();
                    //UseValueDeferred = gc.Between(bulkassessmenttext, "UseValueDeferred", "HistoricValueDeferred").Trim();
                    //Historic_Value_Deferred = gc.Between(bulkassessmenttext, "HistoricValueDeferred", "TotalDeferredValue").Trim();

                    //Total_Deferred_Value = gc.Between(bulkassessmenttext, "TotalDeferredValue", "TotalAssessedValue").Trim();
                    //Total_Assessed_Value = GlobalClass.After(bulkassessmenttext, "TotalAssessedValue").Trim();



                    string property_details = pin + "~" + location_address + "~" + PropertyDescription + "~" + PropertyOwner + "~" + city + "~" + Land_class + "~" + Acreage + "~" + year_built;
                    gc.insert_date(orderNumber, parcel_no, 598, property_details, 1, DateTime.Now);

                    //string assessment_details = Land_Value + "~" + Building_Value + "~" + Outbuilding_Value + "~" + Appraised_Value + "~" + OtherExemptions + "~" + UseValueDeferred + "~" + Historic_Value_Deferred + "~" + Total_Deferred_Value + "~" + Total_Assessed_Value;
                    //gc.insert_date(orderNumber, parcel_no, 599, assessment_details, 1, DateTime.Now);


                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");
                    //Tax Details
                    driver.Navigate().GoToUrl("http://taxweb.guilfordcountync.gov/publicwebaccess/BillSearchResults.aspx?ParcelNum=" + reid);

                    //IWebElement Itaxstmt = driver.FindElement(By.XPath("//*[@id='ctl00_PageHeader1_TaxBillHyperLink']"));
                    //string stmt1 = Itaxstmt.GetAttribute("href");
                    //driver.Navigate().GoToUrl(stmt1);
                    //Thread.Sleep(2000);
                    gc.CreatePdf(orderNumber, parcel_no, "Tax bill table", driver, "NC", "Guilford");

                    //Transaction payment Details Table:
                    //Bill#~Old Bill #~Parcel #~Name~Location~Bill Flags~Current Due~Total:

                    IWebElement         tbmulti = driver.FindElement(By.XPath("//*[@id='G_dgResults']/tbody"));
                    IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr"));

                    IList <IWebElement> TDmulti;
                    IList <IWebElement> THmulti;
                    int b = 0;
                    foreach (IWebElement row in TRmulti)
                    {
                        TDmulti = row.FindElements(By.TagName("td"));
                        THmulti = row.FindElements(By.TagName("th"));
                        if (b < 3 && TDmulti.Count != 0)
                        {
                            IWebElement ITaxBillCount = TDmulti[0].FindElement(By.TagName("a"));
                            string      strTaxReal    = ITaxBillCount.GetAttribute("href");
                            strTaxRealestate.Add(strTaxReal);
                            b++;
                        }
                        if (TDmulti.Count == 7)
                        {
                            string transpay1 = TDmulti[0].Text + "~" + TDmulti[1].Text + "~" + TDmulti[2].Text + "~" + TDmulti[3].Text + "~" + TDmulti[4].Text + "~" + TDmulti[5].Text + "~" + TDmulti[6].Text;
                            gc.insert_date(orderNumber, parcel_no, 601, transpay1, 1, DateTime.Now);
                        }
                        if (THmulti.Count != 0)
                        {
                            string transhistory11 = "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "Total" + "~" + THmulti[7].Text;
                            gc.insert_date(orderNumber, parcel_no, 601, transhistory11, 1, DateTime.Now);
                        }
                    }
                    int k = 1;
                    foreach (string real in strTaxRealestate)
                    {
                        driver.Navigate().GoToUrl(real);
                        Thread.Sleep(4000);
                        if (k == 1)
                        {
                            //Thread.Sleep(2000);
                            gc.CreatePdf(orderNumber, parcel_no, "Tax bill1", driver, "NC", "Guilford");
                            string owner_name = "", Description = "", Location = "", Parcel = "", Lender = "", RealValue = "", DeferredValue = "", UseValue = "", PersonalValue = "", ExemptValue = "", TotalAssessedValue = "";
                            //Owner Name~Description~Location~Lender~Real Value~Deferred Value~Use Value~Personal Value~Exempt & Exclusion Value~Total Assessed Value~Bill Status~Bill Flag~Bill Number~Old Bill Number~Old Account Number~Due Date~Interest Begins~Rate~Tax Districts~Descriptions~Amount~Interest Amount~Total Amount Due~Tax Authority
                            owner_name         = driver.FindElement(By.Id("txtName")).Text.Trim();
                            Description        = driver.FindElement(By.Id("lblDescr")).Text.Trim();
                            Location           = driver.FindElement(By.Id("lblPropAddr")).Text.Trim();
                            Parcel             = driver.FindElement(By.Id("lblParcel")).Text.Trim();
                            Lender             = driver.FindElement(By.Id("lblLender")).Text.Trim();
                            RealValue          = driver.FindElement(By.Id("lblRealOriginal")).Text.Trim();
                            DeferredValue      = driver.FindElement(By.Id("lblDeferredOriginal")).Text.Trim();
                            UseValue           = driver.FindElement(By.Id("lblUseOriginal")).Text.Trim();
                            PersonalValue      = driver.FindElement(By.Id("lblPersonalOriginal")).Text.Trim();
                            ExemptValue        = driver.FindElement(By.Id("lblExemptOriginal")).Text.Trim();
                            TotalAssessedValue = driver.FindElement(By.Id("lblTotalValue")).Text.Trim();
                            string BillStatus = "", BillFlag = "", Bill = "", OldBill = "", OldAccountNum = "", DueDate = "", InterestBegins = "", TotalAmountDue = "", InterestAmt = "";
                            BillStatus    = driver.FindElement(By.Id("lblBillStatus")).Text.Trim();
                            BillFlag      = driver.FindElement(By.Id("lblBillFlag")).Text.Trim();
                            Bill          = driver.FindElement(By.Id("lblBill")).Text.Trim();
                            OldBill       = driver.FindElement(By.Id("lblLegacyBillNum")).Text.Trim();
                            OldAccountNum = driver.FindElement(By.Id("lblLegacyAccountNum")).Text.Trim();
                            DueDate       = driver.FindElement(By.Id("lblDueDate")).Text.Trim();

                            InterestBegins = driver.FindElement(By.Id("lblInterest")).Text.Trim();
                            Thread.Sleep(5000);
                            InterestAmt    = driver.FindElement(By.Id("lblInterestAmt")).Text.Trim();
                            TotalAmountDue = driver.FindElement(By.Id("lblTotalAmountDue")).Text.Trim();
                            string TaxBill_details = owner_name + "~" + Description + "~" + Location + "~" + Lender + "~" + RealValue + "~" + DeferredValue + "~" + UseValue + "~" + PersonalValue + "~" + ExemptValue + "~" + TotalAssessedValue + "~" + BillStatus + "~" + BillFlag + "~" + Bill + "~" + OldBill + "~" + OldAccountNum + "~" + DueDate + "~" + InterestBegins + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + InterestAmt + "~" + TotalAmountDue + "~" + " 400 West Market St, Greensboro, North Carolina 27401 Phone: (336) 641 - 3363";
                            gc.insert_date(orderNumber, parcel_no, 600, TaxBill_details, 1, DateTime.Now);


                            IWebElement         tbmulti2 = driver.FindElement(By.XPath("//*[@id='dgShowResultRate']/tbody"));
                            IList <IWebElement> TRmulti2 = tbmulti2.FindElements(By.TagName("tr"));
                            IList <IWebElement> TDmulti2;

                            foreach (IWebElement row in TRmulti2)
                            {
                                TDmulti2 = row.FindElements(By.TagName("td"));
                                if (!row.Text.Contains("Rate"))
                                {
                                    if (TDmulti2.Count == 4)
                                    {
                                        string transbill = "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + TDmulti2[0].Text + "~" + TDmulti2[1].Text + "~" + TDmulti2[2].Text + "~" + TDmulti2[3].Text + "" + "~" + "" + "~" + "";
                                        gc.insert_date(orderNumber, parcel_no, 600, transbill, 1, DateTime.Now);
                                    }
                                }
                            }
                            //Transaction History Details Table:
                            //Date~Type~Paid By~Trans #~Amount~Current  Due

                            string              CurrentDue = driver.FindElement(By.Id("lblCurrentDue")).Text.Trim();
                            IWebElement         tbmulti1   = driver.FindElement(By.XPath("//*[@id='dgShowResultHistory']/tbody"));
                            IList <IWebElement> TRmulti1   = tbmulti1.FindElements(By.TagName("tr"));
                            IList <IWebElement> TDmulti1;

                            foreach (IWebElement row in TRmulti1)
                            {
                                TDmulti1 = row.FindElements(By.TagName("td"));

                                if (TDmulti1.Count == 6)
                                {
                                    string transhistory = TDmulti1[0].Text + "~" + TDmulti1[1].Text + "~" + TDmulti1[2].Text + "~" + TDmulti1[3].Text + "~" + TDmulti1[4].Text + "~" + "";
                                    gc.insert_date(orderNumber, parcel_no, 602, transhistory, 1, DateTime.Now);
                                }
                            }
                            string transhistory1 = "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + CurrentDue;
                            gc.insert_date(orderNumber, parcel_no, 602, transhistory1, 1, DateTime.Now);
                        }
                        if (k == 2)
                        {
                            gc.CreatePdf(orderNumber, parcel_no, "Tax bill2", driver, "NC", "Guilford");
                        }
                        if (k == 3)
                        {
                            gc.CreatePdf(orderNumber, parcel_no, "Tax bill3", driver, "NC", "Guilford");
                        }
                        k++;
                    }
                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

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

                    driver.Quit();
                    GlobalClass.titleparcel = "";
                    gc.mergpdf(orderNumber, "NC", "Guilford");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    throw ex;
                }
            }
        }