Exemple #1
0
        protected void gvPass_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                if (e.NewPageIndex >= 0)
                {
                    // OffleaveTable.PageIndex = e.NewPageIndex;

                    DataSet dspenalty = dal.getdataset("Select * from OffleaveSetting");
                    if (dspenalty.Tables[0].Rows.Count > 0)
                    {
                        int pageSize = ContextKeys.GRID_PAGE_SIZE;
                        OffleaveTable.PageSize   = 25;
                        OffleaveTable.DataSource = dspenalty.Tables[0];
                        OffleaveTable.DataBind();
                    }
                }
            }

            catch (Exception ex)
            {
                logger.Info(ex.Message);
            }
        }
Exemple #2
0
        //private string ReturnWhere()
        //{
        ////    string str = string.Empty;
        ////    string makeWhereClause = string.Empty;
        ////    log4net.ILog logger = log4net.LogManager.GetLogger("File");
        ////    try
        ////    {
        ////        List<String> arr = new List<String>();
        ////        arr.Add("test");

        ////        if (txtdateto.Text != "" && txtdatefrom.Text != "")
        ////        {
        ////            if (arr.Count == 1)
        ////            {
        ////                str += " where DateFrom BETWEEN '" + txtdatefrom.Text + "' AND '" + txtdateto.Text + "'";
        ////                arr.Add("1");
        ////            }
        ////            else
        ////            {
        ////                str += " and DateFrom BETWEEN '" + txtdatefrom.Text + "' AND '" + txtdateto.Text + "'";
        ////            }
        ////        }
        ////        if (txtdatefrom.Text != "" && txtdateto.Text == "")
        ////        {
        ////            if (arr.Count == 1)
        ////            {
        ////                str += " where DateFrom ='" + txtdatefrom.Text + "'";
        ////                arr.Add("2");
        ////            }
        ////            else
        ////            {
        ////                str += " and DateFrom ='" + txtdatefrom.Text + "'";
        ////            }
        ////        }
        ////        if (ddlTypeOfLeave.Text != "")
        ////        {
        ////            if (arr.Count == 1)
        ////            {
        ////                str += " where LeaveType ='" + ddlTypeOfLeave.Text.Trim() + "'";
        ////                arr.Add("3");
        ////            }
        ////            else
        ////            {
        ////                str += " and LeaveType ='" + ddlTypeOfLeave.Text.Trim() + "'";
        ////            }
        ////        }
        ////        if (ddlStaffname.Text != "")
        ////        {
        ////            if (arr.Count == 1)
        ////            {
        ////                str += " where StaffName ='" + ddlStaffname.Text.Trim() + "'";
        ////                arr.Add("4");
        ////            }
        ////            else
        ////            {
        ////                str += " and StaffName ='" + ddlStaffname.Text.Trim() + "'";
        ////            }
        ////        }

        ////    }
        ////    catch (Exception ex)
        ////    {
        ////        logger.Info(ex.Message);
        ////    }
        ////    return (str);
        //}
        private void BindGrid()
        {
            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                // string where = ReturnWhere();
                DataSet ds = dal.getdataset("Select * from OffleaveSetting with(nolock) ");
                //if (ds.Tables[0].Rows.Count > 0)
                //{
                int pageSize = ContextKeys.GRID_PAGE_SIZE;
                OffleaveTable.PageSize   = 25;
                OffleaveTable.DataSource = ds.Tables[0];
                OffleaveTable.DataBind();
                //}
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
            }
        }