コード例 #1
0
ファイル: frmMain.cs プロジェクト: brentscheidt/inboard
        private void btn_SaveCampaignScraper_Click(object sender, EventArgs e)
        {
            string Location = string.Empty;
            string LocationArea = string.Empty;
            string Country = string.Empty;
            string PostalCode = string.Empty;
            string IndustryType = string.Empty;
            string CompanySize = string.Empty;
            string Group = string.Empty;
            string SeniorLevel = string.Empty;
            string Language = string.Empty;
            string Relationship = string.Empty;
            string Function = string.Empty;
            string IntrestedIn = string.Empty;
            string YearsOfExperience = string.Empty;
            string RecentlyJoined = string.Empty;
            string Fortune1000 = string.Empty;
            string within = string.Empty;
            string TitleValue = string.Empty;
            string CompanyValue = string.Empty;
            string FileName = string.Empty;
            string FirstName = string.Empty;
            string LastName = string.Empty;
            string Keyword = string.Empty;
            string Title = string.Empty;
            string Company = string.Empty;

            string CampaignName = string.Empty;
            CheckNetConn = System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();
            if (CheckNetConn)
            {
                try
                {
                    try
                    {
                        SearchCriteria.starter = true;
                        if (comboBoxemail.Items.Count <= 0)
                        {
                            AddLoggerScrapeUsers("[ " + DateTime.Now + " ] => [ Load The account From Menu and switch the tab and again come to InBoardProGetData Tab ]");
                            lbGeneralLogs.Items.Clear();
                            frmAccounts FrmAccount = new frmAccounts();
                            FrmAccount.Show();
                            return;
                        }

                        if (comboBoxemail.SelectedIndex < 0)
                        {
                            AddLoggerScrapeUsers("[ " + DateTime.Now + " ] => [ Select The Email Id From The Dropdown and Fill All Mandatory (*) Fields  ]");
                        }

                        if (string.IsNullOrEmpty(txtScraperExportFilename.Text))
                        {
                            MessageBox.Show("Please Add any Name to Export File Name");
                            return;
                        }

                        AddLoggerScrapeUsers("[ " + DateTime.Now + " ] => [ Starting Scraping ]");
                        IsStop_InBoardProGetDataThread = false;
                        lstInBoardProGetDataThraed.Clear();

                        if (string.IsNullOrEmpty(txtBoxCampaignScraperName.Text))
                        {
                            MessageBox.Show("Please write the Campaign Name and then click on Save Campaign button.");
                            return;
                        }

                        if (combScraperLocation.SelectedIndex == 0)
                        {
                            Location = "I";
                            lblScraperCountry.Visible = true;
                            CombScraperCountry.Visible = true;
                        }
                        else if (combScraperLocation.SelectedIndex == 1)
                        {
                            Location = "Y";
                            lblScraperCountry.Visible = false;
                            CombScraperCountry.Visible = false;
                        }

                        foreach (KeyValuePair<string, string> item in CountryCode)
                        {
                            try
                            {
                                if (item.Value == CombScraperCountry.SelectedItem.ToString())
                                {
                                    Country = item.Key;
                                    break;
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> getting CountryCode ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->  getting CountryCode ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPreScrapperErrorLogs);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPreScrapperErrorLogs);
                    }

                    #region AreaWiseLocation

                    foreach (var item in listAreaLocation)
                    {
                        string getAreWiseCode = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/ta/region?query=" + item.ToString()));

                        int startindex = getAreWiseCode.IndexOf("\"id\":");
                        int startindex1 = getAreWiseCode.IndexOf("displayName");
                        //{"resultList":[{"id":"in:6498","headLine":"<strong>Bhilai<\/strong> Area, India","displayName":"Bhilai Area, India","subLine":""}]}

                        if (startindex > 0)
                        {
                            try
                            {
                                string start = getAreWiseCode.Substring(startindex).Replace("\"id\":", string.Empty);
                                int endindex = start.IndexOf(",");
                                string end = start.Substring(0, endindex).Replace(":", "%3A").Replace("\"", "");
                                //SearchCriteria.LocationAreaCode = end.Replace(":", "%").Replace("\"", "");

                                string start1 = getAreWiseCode.Substring(startindex1).Replace("displayName", string.Empty);
                                int endindex1 = start1.IndexOf("\",\"");
                                string end1 = start1.Substring(0, endindex1).Replace(":", "").Replace("\"", "");

                                if (string.IsNullOrEmpty(LocationArea))
                                {
                                    LocationArea = end;
                                }
                                else
                                {
                                    LocationArea = LocationArea + "," + end;
                                }

                                string contrycd = end.Split('%')[0].Replace("3A", string.Empty);
                                if (contrycd != Country)
                                {
                                    AddLoggerScrapeUsers("[ " + DateTime.Now + " ] => [ Wrong Selection of Country or Your Area Location is not matched the country ]");
                                    return;
                                }
                                else
                                {
                                    AddLoggerScrapeUsers("[ " + DateTime.Now + " ] => [ Added Area Location: " + end1.ToString() + " ]");

                                }

                            }
                            catch { }

                        }
                    }

                    #endregion

                    #region Industry List
                    string Industryvalue = string.Empty;
                    string[] arrIndustry = Regex.Split(IndustryList, ",");

                    foreach (string Industry in checkedListBoxIndustry.CheckedItems)
                    {
                        foreach (string itemIndustry in arrIndustry)
                        {
                            try
                            {
                                if (itemIndustry.Contains(Industry))
                                {
                                    string[] arryIndustry = Regex.Split(itemIndustry, ";");
                                    if (arryIndustry.Length == 2)
                                    {
                                        if (!string.IsNullOrEmpty(arryIndustry[1]))
                                        {
                                            if (string.IsNullOrEmpty(Industryvalue))
                                            {
                                                Industryvalue = arryIndustry[1];
                                            }
                                            else
                                            {
                                                Industryvalue = Industryvalue + "," + arryIndustry[1];
                                            }
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> arrIndustry 1 ---2--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> arrIndustry 1 ---2--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPreScrapperErrorLogs);
                            }
                        }
                    }
                    //if (string.IsNullOrEmpty(Industryvalue))
                    //{
                    //    Industryvalue = "select-all";
                    //}
                    IndustryType = Industryvalue;
                    #endregion

                    #region Company size List
                    string companysizevalue = string.Empty;
                    string[] arraycompnaysize = Regex.Split(companysizelist, ",");
                    foreach (string companysize in checkedListBoxCompanySize.CheckedItems)
                    {
                        foreach (string item in arraycompnaysize)
                        {
                            try
                            {
                                if (item.Split(':')[1] == companysize)
                                {
                                    string[] ArrayCompnay = Regex.Split(item, ":");
                                    if (!string.IsNullOrEmpty(ArrayCompnay[0]))
                                    {
                                        if (string.IsNullOrEmpty(companysizevalue))
                                        {
                                            companysizevalue = ArrayCompnay[0];
                                        }
                                        else
                                        {
                                            companysizevalue = companysizevalue + "," + ArrayCompnay[0];
                                        }
                                    }
                                    //break;
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---3--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---3--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPreScrapperErrorLogs);
                            }
                        }
                        //break;
                    }

                    if (companysizevalue == "all")
                    {
                        CompanySize = string.Empty;
                    }
                    else
                    {
                        CompanySize = companysizevalue;
                    }
                    #endregion

                    #region Group List
                    string Groupsvalue = string.Empty;
                    foreach (string Groups in checkedListGroups.CheckedItems)
                    {
                        //foreach (var item1 in GroupStatus.GroupMemUrl)
                        //{
                        //    string[] grp = item1.Split(':');
                        //    if (SelUser[1] == grp[0])
                        //    {
                        //        SpeGroupId = grp[2];
                        //        break;
                        //    }
                        //}

                        foreach (var item in GroupStatus.GroupMemUrl)
                        {
                            try
                            {
                                string[] grp = item.Split(':');
                                if (grp[0].Equals(Groups))
                                {
                                    if (!string.IsNullOrEmpty(grp[2]))
                                    {
                                        if (string.IsNullOrEmpty(Groupsvalue))
                                        {
                                            Groupsvalue = grp[2];
                                        }
                                        else
                                        {
                                            Groupsvalue = Groupsvalue + "," + grp[2];
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---4--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---4--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPreScrapperErrorLogs);
                            }
                        }
                    }
                    Group = Groupsvalue;
                    #endregion

                    #region Senority List
                    string Seniorlevelvalue = string.Empty;
                    string[] senoirLevelList = Regex.Split(senioritylevel, ",");
                    foreach (string Seniorlevel in checkedListBoxSeniorlevel.CheckedItems)
                    {
                        foreach (string itemSeniorLevel in senoirLevelList)
                        {
                            try
                            {
                                if (itemSeniorLevel.Contains(Seniorlevel))
                                {
                                    string[] arrysenoirLevel = Regex.Split(itemSeniorLevel, ":");
                                    if (arrysenoirLevel.Length == 2)
                                    {
                                        if (!string.IsNullOrEmpty(arrysenoirLevel[0]))
                                        {
                                            if (string.IsNullOrEmpty(Seniorlevelvalue))
                                            {
                                                Seniorlevelvalue = arrysenoirLevel[0];
                                            }
                                            else
                                            {
                                                Seniorlevelvalue = Seniorlevelvalue + "," + arrysenoirLevel[0];
                                            }
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> arrIndustry 1 ---2--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> arrIndustry 1 ---2--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPreScrapperErrorLogs);
                            }
                        }
                    }

                    if (Seniorlevelvalue == "all")
                    {
                        SeniorLevel = string.Empty;
                    }
                    else
                    {
                        SeniorLevel = Seniorlevelvalue;
                    }
                    #endregion

                    #region Language List
                    string language = string.Empty;
                    string[] arrLang = Regex.Split(Language, ",");
                    foreach (string LanguageL in checkedListBoxLanguage.CheckedItems)
                    {
                        foreach (string item in arrLang)
                        {
                            try
                            {
                                if (item.Contains(LanguageL))
                                {
                                    string[] arryLang = Regex.Split(item, ";");
                                    if (arryLang.Length == 2)
                                    {
                                        if (!string.IsNullOrEmpty(arryLang[1]))
                                        {
                                            if (string.IsNullOrEmpty(language))
                                            {
                                                language = arryLang[1];
                                            }
                                            else
                                            {
                                                language = language + "," + arryLang[1];
                                            }
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---6--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---6--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPreScrapperErrorLogs);
                            }
                        }
                    }
                    if (string.IsNullOrEmpty(language))
                    {
                        //language = "select-all";
                        language = "";
                    }
                    language = language;
                    #endregion

                    #region Relationship List
                    string Relationships = string.Empty;
                    string[] arrRelation = Regex.Split(RelationshipList, ",");
                    foreach (string RelationL in checkedListRelationship.CheckedItems)
                    {
                        foreach (string item in arrRelation)
                        {
                            try
                            {
                                if (item.Contains(RelationL))
                                {
                                    string[] arryRelat = Regex.Split(item, ":");
                                    if (arryRelat.Length == 2)
                                    {
                                        if (!string.IsNullOrEmpty(arryRelat[0]))
                                        {
                                            if (string.IsNullOrEmpty(Relationships))
                                            {
                                                Relationships = arryRelat[0];
                                            }
                                            else
                                            {
                                                Relationships = arryRelat[0] + "," + Relationships;
                                            }
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---7--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---7--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPreScrapperErrorLogs);
                            }
                        }
                    }

                    if (Relationships == "N")
                    {
                        Relationship = string.Empty;
                    }
                    else
                    {
                        Relationship = Relationships;
                    }
                    #endregion

                    #region Function List
                    string Functions = string.Empty;
                    string[] FunctionList = Regex.Split(Functionlist, ",");
                    foreach (string FunctionL in checkedListFunction.CheckedItems)
                    {
                        foreach (string itemFunction in FunctionList)
                        {
                            try
                            {
                                if (itemFunction.Contains(FunctionL))
                                {
                                    string[] functionItem = Regex.Split(itemFunction, ":");
                                    if (!string.IsNullOrEmpty(functionItem[0]))
                                    {
                                        if (string.IsNullOrEmpty(Functions))
                                        {
                                            Functions = functionItem[0];
                                        }
                                        else
                                        {
                                            Functions = Functions + "," + functionItem[0];
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---8--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---8--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPreScrapperErrorLogs);
                            }
                        }
                    }
                    if (Functions == "all")
                    {
                        Function = string.Empty;
                    }
                    else
                    {
                        Function = Functions;
                    }
                    #endregion

                    #region IntrestedIn
                    string Interested_In = string.Empty;
                    string[] IntrestesList = Regex.Split(IntrestedinList, ",");
                    foreach (string InterestedL in checkedListBoxInterestedIN.CheckedItems)
                    {
                        foreach (string Intresteditem in IntrestesList)
                        {
                            try
                            {
                                if (Intresteditem.Contains(InterestedL))
                                {
                                    string[] arrayIntrst = Regex.Split(Intresteditem, ":");
                                    if (!string.IsNullOrEmpty(Intresteditem))
                                    {
                                        if (string.IsNullOrEmpty(Interested_In))
                                        {
                                            Interested_In = arrayIntrst[0];
                                        }
                                        else
                                        {
                                            Interested_In = Interested_In + "," + arrayIntrst[0];
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---9--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---9--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPreScrapperErrorLogs);
                            }
                        }
                    }
                    if (Interested_In == "select-all")
                    {
                        IntrestedIn = string.Empty;
                    }
                    else
                    {
                        IntrestedIn = Interested_In;
                    }

                    #endregion

                    #region Explerience list
                    string TotalExperience = string.Empty;
                    string[] arratExpericne = Regex.Split(expList, ",");
                    foreach (string YearOfExperienceL in GetDataForPrimiumAccount.CheckedItems)
                    {
                        foreach (string itemExp in arratExpericne)
                        {
                            try
                            {
                                if (itemExp.Contains(YearOfExperienceL))
                                {
                                    string[] arrayitem = Regex.Split(itemExp, ":");
                                    if (!string.IsNullOrEmpty(arrayitem[1]))
                                    {
                                        if (string.IsNullOrEmpty(TotalExperience))
                                        {
                                            TotalExperience = arrayitem[0];
                                        }
                                        else
                                        {
                                            TotalExperience = TotalExperience + "," + arrayitem[0];
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---10--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---10--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPreScrapperErrorLogs);
                            }
                        }
                    }

                    if (TotalExperience == "select-all")
                    {
                        YearsOfExperience = string.Empty;
                    }
                    else
                    {
                        YearsOfExperience = TotalExperience;
                    }
                    #endregion

                    #region Recently Joined
                    string Recently_Joined = string.Empty;
                    string[] RecetlyJoinedArr = Regex.Split(RecentlyjoinedList, ",");
                    foreach (string RecentlyJoinedL in checkedListBoxRecentlyJoined.CheckedItems)
                    {
                        foreach (string item in RecetlyJoinedArr)
                        {
                            try
                            {
                                string[] arrayitem = Regex.Split(item, ":");
                                if (item.Contains(RecentlyJoinedL))
                                {
                                    if (!string.IsNullOrEmpty(arrayitem[0]))
                                    {
                                        if (string.IsNullOrEmpty(Recently_Joined))
                                        {
                                            Recently_Joined = arrayitem[0];
                                        }
                                        else
                                        {
                                            Recently_Joined = Recently_Joined + "," + arrayitem[0];
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---11--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---11--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPreScrapperErrorLogs);
                            }
                        }
                    }
                    if (Recently_Joined == "select-all")
                    {
                        Recently_Joined = string.Empty;
                    }
                    else
                    {
                        RecentlyJoined = Recently_Joined.Trim();
                    }
                    #endregion

                    #region Fortune List
                    string Fortune_1000 = string.Empty;
                    string[] FortuneArr = Regex.Split(fortuneList, ",");
                    foreach (string Fortune1000L in checkedListBoxFortune1000.CheckedItems)
                    {
                        foreach (string item in FortuneArr)
                        {
                            try
                            {
                                string[] arrayItem = Regex.Split(item, ":");
                                if (item.Contains(Fortune1000L))
                                {
                                    if (!string.IsNullOrEmpty(arrayItem[0]))
                                    {
                                        if (string.IsNullOrEmpty(Fortune_1000))
                                        {
                                            Fortune_1000 = arrayItem[0];
                                        }
                                        else
                                        {
                                            Fortune_1000 = Fortune_1000 + "," + arrayItem[0];
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---12--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---12--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPreScrapperErrorLogs);
                            }
                        }
                    }
                    if (RecentlyJoined == "select-all")
                    {
                        Fortune1000 = string.Empty;
                    }
                    else
                    {
                        Fortune1000 = Fortune_1000;
                    }
                    #endregion

                    #region Within the PostalCode
                    try
                    {
                        string[] arraywithinList = Regex.Split(WithingList, ",");
                        foreach (string item in arraywithinList)
                        {
                            if (item.Contains(cmbboxWithin.SelectedItem.ToString()))
                            {
                                string[] arrayWithin = Regex.Split(item, ":");
                                within = arrayWithin[0];
                            }
                        }
                    }
                    catch (Exception ex)
                    {

                    }
                    #endregion

                    #region within Title value
                    try
                    {
                        string[] arrayTitleList = Regex.Split(TitleValue, ",");
                        foreach (string item in arrayTitleList)
                        {
                            string[] arrayTitleValue = Regex.Split(item, ":");
                            if (arrayTitleValue[1] == cmbboxTitle.SelectedItem.ToString())
                            {
                                TitleValue = arrayTitleValue[0];
                            }
                        }
                    }
                    catch (Exception ex)
                    {

                    }
                    #endregion

                    #region within Companyvalue
                    try
                    {
                        if (cmbboxCompanyValue.Enabled == true)
                        {
                            string[] arrayTitleList = Regex.Split(TitleValue, ",");
                            foreach (string item in arrayTitleList)
                            {
                                string[] arrayTitleValue = Regex.Split(item, ":");

                                if (arrayTitleValue[1] == cmbboxCompanyValue.SelectedItem.ToString())
                                {
                                    CompanyValue = arrayTitleValue[0];
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {

                    }
                    #endregion

                    FileName = (txtScraperExportFilename.Text).Replace("\"", string.Empty).Replace(",", string.Empty).ToString();
                    FirstName = txtScrperFirstname.Text;
                    LastName = txtScrperlastname.Text;
                    Keyword = txtKeyword.Text;
                    Title = txtTitle.Text;
                    if (Keyword.Contains("or") || (Keyword.Contains("and")) || (Keyword.Contains("not")))
                    {
                        try
                        {
                            Keyword = Keyword.Replace(" or ", " OR ");
                            Keyword = Keyword.Replace(" and ", " AND ");
                            Keyword = Keyword.Replace(" not ", " NOT ");
                        }
                        catch { }
                    }
                    if (Title.Contains("or") || (Title.Contains("and")) || (Title.Contains("not")))
                    {
                        try
                        {
                            Title = Title.Replace(" or ", " OR ");
                            Title = Title.Replace(" and ", " AND ");
                            Title = Title.Replace(" not ", " NOT ");
                        }
                        catch { }
                    }
                    if (!string.IsNullOrEmpty(txtPostalcode.Text))
                    {
                        PostalCode = txtPostalcode.Text;
                    }
                    if (!string.IsNullOrEmpty(txtCompnayName.Text))
                    {
                        Company = txtCompnayName.Text;
                    }

                    if (CombScraperCountry.SelectedItem.ToString() != null && CombScraperCountry.SelectedIndex > 0)
                    {
                        try
                        {
                            if (!string.IsNullOrEmpty(CombScraperCountry.SelectedItem.ToString()))
                            {
                                string countryValue = string.Empty;
                                string temCOuntry = CombScraperCountry.SelectedItem.ToString();
                                GetCountryNameValue(ref temCOuntry, ref countryValue);
                                Country = countryValue;
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---13--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---13--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPreScrapperErrorLogs);
                        }
                    }
                    CampaignName = txtBoxCampaignScraperName.Text;
                    string Account = comboBoxemail.SelectedItem.ToString();
                    clsDBQueryManager obj_clsDBQueryManager = new clsDBQueryManager();
                    DataTable DT = new DataTable();
                    DataSet DS = new DataSet();
                    DS = obj_clsDBQueryManager.getDataFromAccountsTable(Account);
                    DT = DS.Tables[0];
                    string Password = string.Empty;
                    string ProxyAddress = string.Empty;
                    string ProxyPort = string.Empty;
                    string ProxyUserName = string.Empty;
                    string ProxyPassword = string.Empty;
                    foreach (DataRow itemAccount in DT.Rows)
                    {
                        try
                        {
                            Password = itemAccount["Password"].ToString();
                            ProxyAddress = itemAccount["ProxyAddress"].ToString();
                            ProxyPort = itemAccount["ProxyPort"].ToString();
                            ProxyUserName = itemAccount["ProxyUserName"].ToString();
                            ProxyPassword = itemAccount["ProxyPassword"].ToString();
                        }
                        catch
                        { }
                    }

                    //database query to insert data
                    string query = "Insert into tb_CampaignScraper (CampaignName, Account, FirstName, LastName, Location, Country, AreaWiseLocation, PostalCode, Company, Keyword, Title, Industry, Relationship, Language, Groups, ExportedFileName, TitleValue, CompanyValue, within, YearsOfExperience, Function, SeniorLevel, IntrestedIn, CompanySize, Fortune1000, RecentlyJoined) Values ('" + CampaignName + "','" + Account + ":" + Password + ":" + ProxyAddress + ":" + ProxyPort + ":" + ":" + ProxyUserName + ":" + ProxyPassword + "','" + FirstName + "','" + LastName + "','" + Location + "','" + Country + "','" + LocationArea + "','" + PostalCode + "','" + Company + "','" + Keyword + "','" + Title + "','" + IndustryType + "','" + Relationship + "','" + language + "','" + Group + "','" + FileName + "','" + TitleValue + "','" + CompanyValue + "','" + within + "','" + YearsOfExperience + "','" + Function + "','" + SeniorLevel + "','" + IntrestedIn + "','" + CompanySize + "','" + Fortune1000 + "','" + RecentlyJoined + "');";

                    obj_clsDBQueryManager.InsertCampaignScraperData(query, "tb_CampaignScraper");

                    frmCampaignScraper obj_frmCampaignScraper = new frmCampaignScraper();
                    obj_frmCampaignScraper.Show();

                    AddLoggerScrapeUsers("[ " + DateTime.Now + " ] => [ Campaign Details saved with the campaign name :" + CampaignName + " ]");
                }
                catch (Exception ex)
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---13--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> btnSearchScraper_Click() ---13--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinPreScrapperErrorLogs);
                }
            }
            else
            {
                MessageBox.Show("Your Internet Connection is disabled ! or not working, Please Check Your Internet Connection...");
                AddLoggerScrapeUsers("[ " + DateTime.Now + " ] => [ Your Internet Connection is disabled ! or not working, Please Check Your Internet Connection... ]");
            }
        }