Exemplo n.º 1
0
        protected void btnSearchCompanyKeywords_Click(object sender, EventArgs e)
        {
            if (txtCompanyKeywords.Text != "")
            {
                if (radioSearch.Checked == true)
                {
                    DataManager.DataAccess da = new DataManager.DataAccess();
                    DataSet dsCompanies       = new DataSet();
                    // int CompanyID = Convert.ToInt32(txtID.Text);


                    string KeywordValue = txtCompanyKeywords.Text;
                    dsCompanies = da.FetchCompanyKeywords(KeywordValue);
                    gvCompanyName.DataSource = dsCompanies;
                    gvCompanyName.DataBind();
                }


                if (radioAdvanced.Checked == true)
                {
                    String KeywordValue = txtCompanyKeywords.Text;
                    bool   cCompany;
                    bool   cAddress;
                    bool   cZip;
                    bool   cPhoneNumber;
                    bool   cAreaCode;

                    if (cbPhone.Checked == true)
                    {
                        cPhoneNumber = true;
                    }
                    else
                    {
                        cPhoneNumber = false;
                    }
                    if (cbPhone.Checked == false)
                    {
                        cPhoneNumber = false;
                    }
                    else
                    {
                        cPhoneNumber = true;
                    }
                    if (cbAreaCode.Checked == true)
                    {
                        cAreaCode = true;
                    }
                    else
                    {
                        cAreaCode = false;
                    }
                    if (cbAreaCode.Checked == false)
                    {
                        cPhoneNumber = false;
                    }
                    else
                    {
                        cAreaCode = true;
                    }

                    if (cbCompany.Checked == true)
                    {
                        cCompany = true;
                    }
                    else
                    {
                        cCompany = false;
                    }

                    if (cbCompany.Checked == false)
                    {
                        cCompany = false;
                    }
                    else
                    {
                        cCompany = true;
                    }

                    if (cbAddress.Checked == true)
                    {
                        cAddress = true;
                    }
                    else
                    {
                        cAddress = false;
                    }

                    if (cbAddress.Checked == false)
                    {
                        cAddress = false;
                    }
                    else
                    {
                        cCompany = true;
                    }
                    if (cbZip.Checked == true)
                    {
                        cZip = true;
                    }
                    else
                    {
                        cZip = false;
                    }

                    if (cbZip.Checked == false)
                    {
                        cZip = false;
                    }
                    else
                    {
                        cZip = true;
                    }
                    DataManager.DataAccess da = new DataManager.DataAccess();
                    DataSet dsCompanies       = new DataSet();

                    // String Name = txtCompanyKeywords.Text;
                    dsCompanies = da.FetchCompanyKeywords(KeywordValue, cCompany, cAddress, cZip, cAreaCode, cPhoneNumber);
                    gvCompanyName.DataSource = dsCompanies;
                    gvCompanyName.DataBind();
                }
            }


            if (txtCompanyKeywords.Text == "")
            {
                //I have to make the search
                // I have to make the advancedSearch
                if (radioSearch.Checked == true)
                {
                    DataManager.DataAccess da = new DataManager.DataAccess();
                    DataSet dsCompanies       = new DataSet();

                    String KeywordValue = txtCompanyKeywords.Text;
                    dsCompanies = da.FetchCompanyKeywords(KeywordValue);
                    gvCompanyName.DataSource = dsCompanies;
                    gvCompanyName.DataBind();
                }

                if (radioAdvanced.Checked == true)
                {
                    DataManager.DataAccess da = new DataManager.DataAccess();
                    DataSet dsCompanies       = new DataSet();
                    bool    cCompany;
                    bool    cAddress;
                    String  KeywordValue = txtCompanyKeywords.Text;
                    bool    cZip;
                    bool    cAreaCode;
                    bool    cPhoneNumber;


                    if (cbPhone.Checked == true)
                    {
                        cPhoneNumber = true;
                    }
                    else
                    {
                        cPhoneNumber = false;
                    }
                    if (cbPhone.Checked == false)
                    {
                        cPhoneNumber = false;
                    }
                    else
                    {
                        cPhoneNumber = true;
                    }
                    if (cbAreaCode.Checked == true)
                    {
                        cAreaCode = true;
                    }
                    else
                    {
                        cAreaCode = false;
                    }
                    if (cbAreaCode.Checked == false)
                    {
                        cPhoneNumber = false;
                    }
                    else
                    {
                        cAreaCode = true;
                    }

                    if (cbCompany.Checked == true)
                    {
                        cCompany = true;
                    }
                    else
                    {
                        cCompany = false;
                    }
                    if (cbAddress.Checked == true)
                    {
                        cAddress = true;
                    }
                    else
                    {
                        cAddress = false;
                    }

                    if (cbZip.Checked == true)
                    {
                        cZip = true;
                    }
                    else
                    {
                        cZip = false;
                    }



                    dsCompanies = da.FetchCompanyKeywords(KeywordValue, cCompany, cAddress, cZip, cAreaCode, cPhoneNumber);
                    gvCompanyName.DataSource = dsCompanies;
                    gvCompanyName.DataBind();
                }
            }
        }
        protected void btnSearchCompanyKeywords_Click(object sender, EventArgs e)
        {
            if (txtCompanyKeywords.Text != "")
            {

                if (radioSearch.Checked == true)
                {
                    DataManager.DataAccess da = new DataManager.DataAccess();
                    DataSet dsCompanies = new DataSet();
                    // int CompanyID = Convert.ToInt32(txtID.Text);

                    string KeywordValue = txtCompanyKeywords.Text;
                    dsCompanies = da.FetchCompanyKeywords(KeywordValue);
                    gvCompanyName.DataSource = dsCompanies;
                    gvCompanyName.DataBind();

                }

            if (radioAdvanced.Checked == true)
            {
                String KeywordValue = txtCompanyKeywords.Text;
                bool cCompany;
                bool cAddress;
                bool cZip;
                bool cPhoneNumber;
                bool cAreaCode;

                if (cbPhone.Checked == true)
                {
                    cPhoneNumber = true;
                }
                else
                {
                    cPhoneNumber = false;
                }
                if (cbPhone.Checked == false)
                {
                    cPhoneNumber = false;
                }
                else
                {
                    cPhoneNumber = true;
                }
                if (cbAreaCode.Checked == true)
                {
                    cAreaCode = true;
                }
                else
                {
                    cAreaCode = false;
                }
                if (cbAreaCode.Checked == false)
                {
                    cPhoneNumber = false;
                }
                else
                {
                    cAreaCode = true;
                }

                if (cbCompany.Checked == true)
                {
                    cCompany = true;
                }
                else
                {
                    cCompany = false;
                }

                if (cbCompany.Checked == false)
                {
                    cCompany = false;
                }
                else
                {
                    cCompany = true;
                }

                    if (cbAddress.Checked == true)
                    {
                        cAddress = true;
                    }
                    else
                    {
                        cAddress = false;
                    }

                    if (cbAddress.Checked == false)
                    {
                        cAddress = false;
                    }
                    else
                    {
                        cCompany = true;
                    }
                        if (cbZip.Checked == true)
                        {
                            cZip = true;
                        }
                        else
                        {
                            cZip = false;
                        }

                        if (cbZip.Checked == false)
                        {
                            cZip = false;
                        }
                        else
                        {
                            cZip = true;
                        }
                        DataManager.DataAccess da = new DataManager.DataAccess();
                        DataSet dsCompanies = new DataSet();

                        // String Name = txtCompanyKeywords.Text;
                        dsCompanies = da.FetchCompanyKeywords(KeywordValue, cCompany, cAddress, cZip, cAreaCode, cPhoneNumber);
                        gvCompanyName.DataSource = dsCompanies;
                        gvCompanyName.DataBind();
                    }
            }

                    if (txtCompanyKeywords.Text == "")
                    {
                        //I have to make the search
                        // I have to make the advancedSearch
                        if (radioSearch.Checked == true)
                        {
                            DataManager.DataAccess da = new DataManager.DataAccess();
                            DataSet dsCompanies = new DataSet();

                            String KeywordValue = txtCompanyKeywords.Text;
                            dsCompanies = da.FetchCompanyKeywords(KeywordValue);
                            gvCompanyName.DataSource = dsCompanies;
                            gvCompanyName.DataBind();
                        }

                        if (radioAdvanced.Checked == true)
                        {
                            DataManager.DataAccess da = new DataManager.DataAccess();
                            DataSet dsCompanies = new DataSet();
                            bool cCompany;
                            bool cAddress;
                            String KeywordValue = txtCompanyKeywords.Text;
                            bool cZip;
                            bool cAreaCode;
                            bool cPhoneNumber;

                            if (cbPhone.Checked == true)
                            {
                                cPhoneNumber = true;
                            }
                            else
                            {
                                cPhoneNumber = false;
                            }
                            if (cbPhone.Checked == false)
                            {
                                cPhoneNumber = false;
                            }
                            else
                            {
                                cPhoneNumber = true;
                            }
                            if (cbAreaCode.Checked == true)
                            {
                                cAreaCode = true;
                            }
                            else
                            {
                                cAreaCode = false;
                            }
                            if (cbAreaCode.Checked == false)
                            {
                                cPhoneNumber = false;
                            }
                            else
                            {
                                cAreaCode = true;
                            }

                            if (cbCompany.Checked == true)
                            {
                                cCompany = true;
                            }
                            else
                            {
                                cCompany = false;
                            }
                            if (cbAddress.Checked == true)
                            {
                                cAddress = true;
                            }
                            else
                            {

                                cAddress = false;
                            }

                            if (cbZip.Checked == true)
                            {
                                cZip = true;
                            }
                            else
                            {
                                cZip = false;
                            }

                            dsCompanies = da.FetchCompanyKeywords(KeywordValue, cCompany, cAddress, cZip, cAreaCode, cPhoneNumber);
                            gvCompanyName.DataSource = dsCompanies;
                            gvCompanyName.DataBind();

                        }
                    }
        }