コード例 #1
0
    /// <summary>
    /// Bind Oil Majors
    /// </summary>
    public void BindOilMajorsRules()
    {
        try
        {
            int rowcount = ucCustomPagerItems.isCountRecord;

            string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }


            DataSet ds = objBLL.CRUD_OilMajorsRules("", "R", 0, 0, txtfilter.Text != "" ? txtfilter.Text : null, sortbycoloumn, sortdirection
                                                    , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount, ref Result);


            if (ucCustomPagerItems.isCountRecord == 1)
            {
                ucCustomPagerItems.CountTotalRec = rowcount.ToString();
                ucCustomPagerItems.BuildPager();
            }

            if (ds != null)
            {
                #region Bind Rules
                if (ds.Tables[0].Rows.Count > 0)
                {
                    gvOilMajorsRules.DataSource = ds.Tables[0];
                    gvOilMajorsRules.DataBind();
                    ImgExpExcel.Visible = true;
                }
                else
                {
                    gvOilMajorsRules.DataSource = null;
                    gvOilMajorsRules.DataBind();
                    ImgExpExcel.Visible = false;
                }
                #endregion
            }
        }
        catch (Exception ex) { UDFLib.WriteExceptionLog(ex); }
    }