コード例 #1
0
    protected void btnbind_Click(object sender, ImageClickEventArgs e)
    {
        if (ddlOption.SelectedIndex != 0)
        {
            string condition = string.Empty;


            if (ddlOption.SelectedIndex == 1)
            {
                condition = "convert(" + ddlFieldName.SelectedValue + ",System.String)='" + txtValue.Text.Trim() + "'";
            }
            else if (ddlOption.SelectedIndex == 2)
            {
                condition = "convert(" + ddlFieldName.SelectedValue + ",System.String) like '%" + txtValue.Text.Trim() + "%'";
            }
            else
            {
                condition = "convert(" + ddlFieldName.SelectedValue + ",System.String) Like '" + txtValue.Text.Trim() + "%'";
            }
            DataTable dtCust = (DataTable)Session["DtPurchaseInvocie"];


            DataView view = new DataView(dtCust, condition, "", DataViewRowState.CurrentRows);
            Session["dtFilter"]  = view.ToTable();
            lblTotalRecords.Text = Resources.Attendance.Total_Records + ": " + view.ToTable().Rows.Count.ToString() + "";

            GvPurchaseInvocie.DataSource = view.ToTable();
            GvPurchaseInvocie.DataBind();
            AllPageCode();

            btnbind.Focus();
        }
    }
コード例 #2
0
    protected void GvPurchaseInvocie_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gvInvoice.PageIndex = e.NewPageIndex;

        DataTable dt = (DataTable)Session["dtFilter"];

        GvPurchaseInvocie.DataSource = dt;
        GvPurchaseInvocie.DataBind();
        AllPageCode();
        GvPurchaseInvocie.BottomPagerRow.Focus();
    }
コード例 #3
0
    protected void GvPurchaseInvocie_OnSorting(object sender, GridViewSortEventArgs e)
    {
        HDFSort.Value = HDFSort.Value == "ASC" ? "DESC" : "ASC";
        DataTable dt = new DataTable();

        dt = (DataTable)Session["dtFilter"];
        DataView dv    = new DataView(dt);
        string   Query = "" + e.SortExpression + " " + HDFSort.Value + "";

        dv.Sort                      = Query;
        dt                           = dv.ToTable();
        Session["dtFilter"]          = dt;
        GvPurchaseInvocie.DataSource = dt;
        GvPurchaseInvocie.DataBind();
        AllPageCode();
        GvPurchaseInvocie.HeaderRow.Focus();
    }
コード例 #4
0
    public void fillGrid()
    {
        DataTable dt = ObjPurchaseInvoice.GetPurchaseInvoiceTrueAll(StrCompId.ToString(), StrBrandId.ToString(), StrLocationId.ToString());
        int       i  = 0;

        foreach (DataRow dr in dt.Rows)
        {
            DataTable dtInvDetail = ObjPurchaseInvoiceDetail.GetPurchaseInvoiceDetailByInvoiceNo(StrCompId.ToString(), StrBrandId.ToString(), StrLocationId.ToString(), dr["TransID"].ToString());
            bool      b           = false;
            foreach (DataRow drChild in dtInvDetail.Rows)
            {
                if (drChild["RecQty"].ToString() == "")
                {
                    drChild["RecQty"] = "0";
                }
                if (float.Parse(drChild["RecQty"].ToString()) == float.Parse(drChild["InvoiceQty"].ToString()))
                {
                    b = true;
                }
                else
                {
                    b = false;
                    break;
                }
            }
            if (b)
            {
                dr.Delete();
                i++;
            }
        }
        GvPurchaseInvocie.DataSource = dt;
        GvPurchaseInvocie.DataBind();
        lblTotalRecords.Text         = Resources.Attendance.Total_Records + " : " + (dt.Rows.Count - i);
        Session["DtPurchaseInvocie"] = dt;
        Session["dtFilter"]          = dt;
        AllPageCode();
    }