Example #1
0
    public void BindChargeData(string BranchNumber, string RcptType, string POL, string ChargeType)
    {
        DataSet dsChargeDetail = new DataSet();
        string  WhereClause    = "";

        if (BranchNumber != "-")
        {
            WhereClause += "DestBranch='" + BranchNumber + "' ";
        }
        else
        {
            WhereClause += " 1=1 ";
        }
        if (RcptType != "-")
        {
            WhereClause += " and RcptTypeDesc='" + RcptType + "' ";
        }
        else
        {
            WhereClause += " and 1=1 ";
        }
        if (POL != "-")
        {
            WhereClause += " and PortofLading='" + POL + "' ";
        }
        else
        {
            WhereClause += " and 1=1 ";
        }
        if (ChargeType != "-")
        {
            WhereClause += " and ChrgType='" + ChargeType + "' ";
        }
        else
        {
            WhereClause += " and 1=1 ";
        }
        WhereClause += " order by DestBranch, RcptTypeDesc, PortofLading, ChrgType, QtyMin ";
        // get the detail data
        dsChargeDetail = SqlHelper.ExecuteDataset(ConfigurationManager.AppSettings["ReportsConnectionString"].ToString(), "UGEN_SP_Select",
                                                  new SqlParameter("@tableName", "GERCharges"),
                                                  new SqlParameter("@columnNames", "*"),
                                                  new SqlParameter("@whereClause", WhereClause));

        if ((dsChargeDetail.Tables[0] != null) && (dsChargeDetail.Tables[0].Rows.Count > 0))
        {
            dtCharges = dsChargeDetail.Tables[0];
            ChargeDetailGrid.DataSource = dtCharges;
            ChargeDetailGrid.DataBind();
            DetailPanel.Visible = true;
            // Create a DataView and specify the field to sort by.
            GridView      = new DataView(dtCharges);
            GridView.Sort = "pGERChargesID";
        }
        else
        {
            lblErrorMessage.Text = "No matching records on file";
            DetailPanel.Visible  = false;
        }
    }
Example #2
0
    //public void GridCancelHandler(Object sender, DataGridCommandEventArgs e)
    //{

    //    // Set the EditItemIndex property to -1 to exit editing mode.
    //    // Be sure to rebind the DateGrid to the data source to refresh
    //    // the control.
    //    ChargeDetailGrid.EditItemIndex = -1;
    //    ChargeDetailGrid.DataBind();

    //}

    public void SortGrid(Object sender, GridViewSortEventArgs e)
    {
        // Retrieve the data source from session state.
        //DataTable dt = (DataTable)Session["Source"];

        // Create a DataView from the DataTable.
        DataView dv = new DataView(dtCharges);

        // The DataView provides an easy way to sort. Simply set the
        // Sort property with the name of the field to sort by.
        dv.Sort = e.SortExpression;

        // Re-bind the data source and specify that it should be sorted
        // by the field specified in the SortExpression property.
        ChargeDetailGrid.DataSource = dv;
        ChargeDetailGrid.DataBind();
    }
Example #3
0
    void DeleteItem(string item)
    {
        // Remove the selected item from the data source.
        GridView.RowFilter = "pGERChargesID=" + item + "";
        if (GridView.Count > 0)
        {
            GridView.Delete(0);
            SqlHelper.ExecuteDataset(ConfigurationManager.AppSettings["ReportsConnectionString"].ToString(), "[pVMI_delete]",
                                     new SqlParameter("@tableName", "GERCharges"),
                                     new SqlParameter("@whereClause", "pGERChargesID=" + item + ""));
            lblErrorMessage.Text = "Record Deleted";
        }
        GridView.RowFilter = "";

        // Rebind the data source to refresh the DataGrid control.
        ChargeDetailGrid.DataBind();
    }