private void GetMRFAgingForOpenPosition(string SortExpressionAndDirection) { Rave.HR.BusinessLayer.MRF.MRFDetail MRFAgingForOpenPositionBL = new Rave.HR.BusinessLayer.MRF.MRFDetail(); try { DataSet ds = new DataSet(); ds = MRFAgingForOpenPositionBL.GetMRFAgingForOpenPosition(SortExpressionAndDirection); if (ds.Tables[0].Rows.Count != CommonConstants.ZERO) { btnExport.Visible = true; GVMRFAgingForOpenPositionReport.DataSource = ds.Tables[0]; Session["MRFAgingReportCountForOpenPositions"] = Convert.ToInt32(ds.Tables[0].Rows.Count); GVMRFAgingForOpenPositionReport.DataBind(); } else { btnExport.Visible = false; ShowHeaderWhenEmptyGrid(ds); } } catch (RaveHRException ex) { throw ex; } catch (Exception ex) { RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "GetMRFAgingForOpenPosition", EventIDConstants.RAVE_HR_MRF_PRESENTATION_LAYER); LogErrorMessage(objEx); } }
private void ShowHeaderWhenEmptyGrid(DataSet ds) { try { GVMRFAgingForOpenPositionReport.ShowHeader = true; GVMRFAgingForOpenPositionReport.AllowSorting = false; DataTable dt = new DataTable(); dt.Clear(); dt = ds.Tables[0]; DataRow dr = dt.NewRow(); dt.Rows.Add(dr); GVMRFAgingForOpenPositionReport.DataSource = dt; GVMRFAgingForOpenPositionReport.DataBind(); GVMRFAgingForOpenPositionReport.Rows[0].Cells.Clear(); GVMRFAgingForOpenPositionReport.Rows[0].Cells.Add(new TableCell()); GVMRFAgingForOpenPositionReport.Rows[0].Cells[0].Text = CommonConstants.NO_RECORDS_FOUND_MESSAGE; GVMRFAgingForOpenPositionReport.Rows[0].Cells[0].Wrap = false; GVMRFAgingForOpenPositionReport.Rows[0].Cells[0].Width = Unit.Percentage(10); } catch (Exception ex) { RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "ShowHeaderWhenEmptyGrid", EventIDConstants.RAVE_HR_MRF_PRESENTATION_LAYER); LogErrorMessage(objEx); } }