protected void Load_CTM_Requests() { try { bool PendingWith = false; int? PendingWithUserID = null; if (Boolean.TryParse(Convert.ToString(ViewState["PendingWithMe"]), out PendingWith)) { if (PendingWith == true) { PendingWithUserID = PendingWith ? UDFLib.ConvertIntegerToNull(Session["userid"]) : null; } } if (ViewState["CTM_STATUS"].ToString() == "SENTTOOFFICE") { if (Boolean.TryParse(Convert.ToString(ViewState["PendingWithMe"]), out PendingWith)) { PendingWithUserID = PendingWith ? UDFLib.ConvertIntegerToNull(Session["userid"]) : null; } } int rowcount = ucCustomPagerItems.isCountRecord; DataTable dt = BLL_PB_PortageBill.Get_CTM_Requests(ddlFleet.SelectedValues, ddlVessel.SelectedValues, txtFromDate.Text == "" ? "" : UDFLib.ConvertToDate(txtFromDate.Text, UDFLib.GetDateFormat()).ToShortDateString(), txtToDate.Text == "" ? "" : UDFLib.ConvertToDate(txtToDate.Text, UDFLib.GetDateFormat()).ToShortDateString() , UDFLib.ConvertStringToNull(ViewState["CTM_STATUS"]), UDFLib.ConvertStringToNull(txtSearch.Text), PendingWithUserID , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); gvCTMRequests.DataSource = dt; gvCTMRequests.DataBind(); ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); if (ViewState["CTM_STATUS"].ToString() != "SENTTOOFFICE") //Pending with me { gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "ApproverName")].Visible = false; } else { gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "ApproverName")].Visible = true; } if (ViewState["CTM_STATUS"].ToString() == "APPROVED") { gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "ApprovedAmt")].Visible = false; gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "ApprovedOn")].Visible = false; } else { gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "ApprovedAmt")].Visible = true; gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "ApprovedOn")].Visible = true; } if (ViewState["CTM_STATUS"].ToString() == "ACKVESSEL") { gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "ReceivedAmt")].Visible = true; //Received ON gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "DateReceived")].Visible = true; //Received Amount } else { gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "ReceivedAmt")].Visible = false; gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "DateReceived")].Visible = false; } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }