Exemplo n.º 1
0
    protected void BtnSearch_Click(object sender, EventArgs e)
    {
        Employee emp = (Employee)Session["emp"];

        searchWord = txtSearch.Text;
        if (txtSearch.Text == String.Empty)
        {
            ClientScript.RegisterStartupScript(Page.GetType(),
                                               "MessageBox",
                                               "<script language='javascript'>alert('" + "Please enter value to search!" + "');</script>");
        }
        else
        {
            if (ddlStatus.SelectedItem.ToString() == "Select Status")
            {
                gvRequisitionList.DataSource = RequisitionControl.SearchForRepRequisitionWithoutStatus(searchWord.Trim(), emp.EmpID);
                gvRequisitionList.DataBind();
                ViewState["DataSource"] = "displaySearch";
                ViewState["searchWord"] = searchWord;
                showEmptyLabel();
            }
            else
            {
                gvRequisitionList.DataSource = RequisitionControl.SearchForRepRequisitionWithStatus(searchWord.Trim(), emp.EmpID, ddlStatus.SelectedItem.ToString());
                gvRequisitionList.DataBind();
                ViewState["DataSource"] = "displaySearchStatus";
                ViewState["searchWord"] = searchWord;
                showEmptyLabel();
            }
        }
    }
Exemplo n.º 2
0
    protected void GVRequisitionList_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        Employee emp = (Employee)Session["emp"];

        gvRequisitionList.PageIndex = e.NewPageIndex;
        if (((string)ViewState["DataSource"]).Equals("displayAll"))
        {
            gvRequisitionList.DataSource = RequisitionControl.getRequisitionListByID(emp.EmpID);
        }
        else if (((string)ViewState["DataSource"]).Equals("displayStatusSearch"))
        {
            gvRequisitionList.DataSource = RequisitionControl.getRequisitionListByEmpIDAndStatus(emp.EmpID, ddlStatus.SelectedItem.ToString());
        }
        else if (((string)ViewState["DataSource"]).Equals("displaySearch"))
        {
            gvRequisitionList.DataSource = RequisitionControl.SearchForRepRequisitionWithoutStatus(((string)ViewState["searchWord"]).Trim(), emp.EmpID);
        }
        else
        {
            gvRequisitionList.DataSource = RequisitionControl.SearchForRepRequisitionWithStatus(((string)ViewState["searchWord"]).Trim(), emp.EmpID, ddlStatus.SelectedItem.ToString());
        }
        gvRequisitionList.DataBind();
    }