Beispiel #1
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            ManageUserSVC.ManageUserClient Client = new ManageUserSVC.ManageUserClient();
            DataSet Data = new DataSet();
            lblsrcerror.Text = "";
            lblgrd.Text = "";
            if (txtSerchDate.Visible == false)
            {
                if (txtSearch.Text != "")
                {
                    if (ddlSearchBy.SelectedItem.Text.Equals("All Users"))
                        CustomerBind();

                    if (ddlSearchBy.SelectedItem.Text.Equals("Application Number"))
                    {
                        Data = Client.SearchCustomers(txtSearch.Text, "", "", "", null);
                    }

                    if (ddlSearchBy.SelectedItem.Text.Equals("Name"))
                    {
                        Data = Client.SearchCustomers("", txtSearch.Text, "", "", null);
                    }

                    if (ddlSearchBy.SelectedItem.Text.Equals("Email-ID"))
                    {
                        Data = Client.SearchCustomers("", "", txtSearch.Text, "", null);
                    }

                    if (ddlSearchBy.SelectedItem.Text.Equals("User ID"))
                    {
                        Data = Client.SearchCustomers("", "", "", txtSearch.Text, null);
                    }


                    if (Data != null && Data.Tables.Count > 0 && Data.Tables[0].Rows.Count > 0)
                    {
                        grdCustomers.Visible = true;
                        grdCustomers.DataSource = Data;
                        grdCustomers.DataBind();
                    }
                    else
                    {
                        grdCustomers.Visible = false;
                        lblgrd.Text = "No Data Found";
                    }
                }
                else
                {
                    lblsrcerror.Text = "Please Enter Search Text.";
                }
            }
            else
            {
                if (ddlSearchBy.SelectedItem.Text.Equals("Coverage Start Date"))
                {
                    if (txtSerchDate.Text != "")
                    {
                        DateTime strDate = DateTime.ParseExact(
                              txtSerchDate.Text,
                               "mm-dd-yyyy",
                               System.Globalization.CultureInfo.InvariantCulture);
                        Data = Client.SearchCustomers("", "", "", "", strDate);


                        if (Data != null && Data.Tables.Count > 0 && Data.Tables[0].Rows.Count > 0)
                        {
                            grdCustomers.Visible = true;
                            grdCustomers.DataSource = Data;
                            grdCustomers.DataBind();
                        }
                        else
                        {
                            grdCustomers.Visible = false;
                            lblgrd.Text = "No Data Found";
                        }
                    }
                    else
                    {
                        lblsrcerror.Text = "Please Select Date.";
                    }
                }
            }
        }