protected void btnExport_Click(object sender, ImageClickEventArgs e) { int rowcount = ucCustomPagerItems.isCountRecord; string vesselcode = (ViewState["VesselCode"] == null) ? null : (ViewState["VesselCode"].ToString()); string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataSet ds = BLL_SCM_Report.SCMReportMainSearch(UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(vesselcode) , UDFLib.ConvertDateToNull(txtFromDate.Text), UDFLib.ConvertDateToNull(txtToDate.Text), sortbycoloumn, sortdirection , ucCustomPagerItems.CurrentPageIndex, null, ref rowcount); string[] HeaderCaptions = { "Vessel", "Meeting Date", "Present Position", "Verified" }; string[] DataColumnsName = { "Vessel_Name", "MEETING_DATE_S", "PRESENT_POSITION", "IsVerified" }; ds.Tables[0].Columns.Add("MEETING_DATE_S"); foreach (DataRow item in ds.Tables[0].Rows) { item["MEETING_DATE_S"] = UDFLib.ConvertDateToNull(item["MEETING_DATE"]).Value.ToString("dd/MMM/yyyy"); } GridViewExportUtil.ShowExcel(ds.Tables[0], HeaderCaptions, DataColumnsName, "SCM", "Safety Committee Meetings", HtmlFilterTable()); }
public void BindSCMReport() { int rowcount = ucCustomPagerItems.isCountRecord; string vesselcode = (ViewState["VesselCode"] == null) ? null : (ViewState["VesselCode"].ToString()); string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataSet ds = BLL_SCM_Report.SCMReportMainSearch(UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(vesselcode) , UDFLib.ConvertDateToNull(txtFromDate.Text), UDFLib.ConvertDateToNull(txtToDate.Text), sortbycoloumn, sortdirection , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); if (ucCustomPagerItems.isCountRecord == 1) { ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); } if (ds.Tables[0].Rows.Count > 0) { gvSCMReport.DataSource = ds.Tables[0]; gvSCMReport.DataBind(); if (ViewState["ID"] == null) { ViewState["ID"] = ds.Tables[0].Rows[0]["ID"].ToString(); gvSCMReport.SelectedIndex = 0; } SetRowSelection(); } else { gvSCMReport.DataSource = ds.Tables[0]; gvSCMReport.DataBind(); } if (ds.Tables[0].Rows.Count == 0) { btnExport.Visible = false; } else { btnExport.Visible = true; } }