/// <summary> /// Edited by Hadish on 28-Oct-2016 /// Purpose: To make search functionality available /// </summary> protected void Search_Worklist() { try { //UpdateWorklistChecklist(); SaveItemsSelection(); DataTable dtStatus = new DataTable(); dtStatus.Columns.Add("All", typeof(int)); dtStatus.Columns.Add("Pending", typeof(int)); dtStatus.Columns.Add("Completed", typeof(int)); dtStatus.Columns.Add("Reworked", typeof(int)); dtStatus.Columns.Add("Verified", typeof(int)); dtStatus.Columns.Add("Overdue", typeof(int)); dtStatus.Rows.Add(rblJobStaus.Items[0].Selected == true ? 1 : 0, rblJobStaus.Items[1].Selected == true ? 1 : 0, 0, rblJobStaus.Items[2].Selected == true ? 1 : 0, rblJobStaus.Items[3].Selected == true ? 1 : 0, rblJobStaus.Items[4].Selected == true ? 1 : 0); DataTable dtFilter = new DataTable(); dtFilter.Columns.Add("PRM_NAME", typeof(string)); dtFilter.Columns.Add("PRM_VALUE", typeof(object)); dtFilter.Rows.Add(new object[] { "@FLEET_ID", UDFLib.ConvertIntegerToNull(null) }); dtFilter.Rows.Add(new object[] { "@VESSEL_ID", UDFLib.ConvertIntegerToNull(Request.QueryString["VesselID"].ToString()) }); dtFilter.Rows.Add(new object[] { "@ASSIGNOR", UDFLib.ConvertIntegerToNull(null) }); dtFilter.Rows.Add(new object[] { "@DEPT_SHIP", UDFLib.ConvertIntegerToNull(null) }); dtFilter.Rows.Add(new object[] { "@DEPT_OFFICE", UDFLib.ConvertIntegerToNull(null) }); dtFilter.Rows.Add(new object[] { "@PRIORITY", UDFLib.ConvertIntegerToNull(null) }); dtFilter.Rows.Add(new object[] { "@CATEGORY_NATURE", UDFLib.ConvertIntegerToNull(null) }); dtFilter.Rows.Add(new object[] { "@CATEGORY_PRIMARY", UDFLib.ConvertIntegerToNull(null) }); dtFilter.Rows.Add(new object[] { "@CATEGORY_SECONDARY", UDFLib.ConvertIntegerToNull(null) }); dtFilter.Rows.Add(new object[] { "@CATEGORY_MINOR", null, }); dtFilter.Rows.Add(new object[] { "@JOB_DESCRIPTION", UDFLib.ConvertStringToNull(txtDescription.Text.Trim()) }); dtFilter.Rows.Add(new object[] { "@JOB_STATUS", UDFLib.ConvertStringToNull(rblJobStaus.SelectedValue) }); dtFilter.Rows.Add(new object[] { "@dtJOB_Status", dtStatus }); dtFilter.Rows.Add(new object[] { "@JOB_TYPE", UDFLib.ConvertIntegerToNull(null) }); dtFilter.Rows.Add(new object[] { "@PIC", UDFLib.ConvertIntegerToNull(null) }); dtFilter.Rows.Add(new object[] { "@JOB_MODIFIED_IN", UDFLib.ConvertIntegerToNull(null) }); dtFilter.Rows.Add(new object[] { "@DATE_RAISED_FROM", UDFLib.ConvertDateToNull(null) }); dtFilter.Rows.Add(new object[] { "@DATE_RAISED_TO", UDFLib.ConvertDateToNull(null) }); dtFilter.Rows.Add(new object[] { "@DATE_CMPLTN_FROM", UDFLib.ConvertDateToNull(null) }); dtFilter.Rows.Add(new object[] { "@DATE_CMPLTN_TO", UDFLib.ConvertDateToNull(null) }); dtFilter.Rows.Add(new object[] { "@DEFER_TO_DD", (null) }); dtFilter.Rows.Add(new object[] { "@SENT_TO_SHIP", (null) }); dtFilter.Rows.Add(new object[] { "@HAVING_REQ_NO", (null) }); dtFilter.Rows.Add(new object[] { "@FLAGGED_FOR_MEETING", (null) }); dtFilter.Rows.Add(new object[] { "@INSPECTOR", UDFLib.ConvertIntegerToNull(null) }); dtFilter.Rows.Add(new object[] { "@PAGE_INDEX", ucCustomPagerctp.CurrentPageIndex }); dtFilter.Rows.Add(new object[] { "@PAGE_SIZE", ucCustomPagerctp.PageSize }); int Record_Count = 0; DataTable taskTable = objInsp.INSP_GET_WORKLIST_JOB(dtFilter, ref Record_Count); grdJoblist.DataSource = taskTable; grdJoblist.DataBind(); ucCustomPagerctp.CountTotalRec = Record_Count.ToString(); ucCustomPagerctp.BuildPager(); DataTable dtPKIDs = taskTable.DefaultView.ToTable(true, new string[] { "WORKLIST_ID", "VESSEL_ID", "OFFICE_ID" }); dtPKIDs.PrimaryKey = new DataColumn[] { dtPKIDs.Columns["WORKLIST_ID"], dtPKIDs.Columns["VESSEL_ID"], dtPKIDs.Columns["OFFICE_ID"] }; Session["WORKLIST_PKID_NAV"] = dtPKIDs; lblRecordCount.Text = Record_Count.ToString(); DataSet dsCheckListWorklist; if (hdnLocationNodeID.Value.ToString() != "") { dsCheckListWorklist = objInsp.Get_CheckList_Worklist_DL(UDFLib.ConvertToInteger(Request.QueryString["VesselID"]), Convert.ToInt32(hdnLocationNodeID.Value)); } else { dsCheckListWorklist = objInsp.Get_CheckList_Worklist_DL_Direct(UDFLib.ConvertToInteger(Request.QueryString["VesselID"]), UDFLib.ConvertToInteger(Request.QueryString["InspID"])); } foreach (GridViewRow gr in grdJoblist.Rows) { string WORKLIST_ID = Convert.ToString(grdJoblist.DataKeys[gr.RowIndex]["WORKLIST_ID"]); string OFFICE_ID = Convert.ToString(grdJoblist.DataKeys[gr.RowIndex]["OFFICE_ID"]); DataRow[] drchk = dsCheckListWorklist.Tables[0].Select("WORKLIST_ID=" + WORKLIST_ID + " and OFFICE_ID=" + OFFICE_ID); if (drchk.Length > 0) { if (hdnLocationNodeID.Value.ToString() == "") { if (drchk[0]["InspectionDetailID"].ToString() != Request.QueryString["InspID"]) { (gr.FindControl("checkRow") as CheckBox).Checked = false; (gr.FindControl("checkRow") as CheckBox).Enabled = false; } else { if (UDFLib.ConvertToInteger(drchk[0]["LocationNodeID"]) > 0) { (gr.FindControl("checkRow") as CheckBox).Checked = true; (gr.FindControl("checkRow") as CheckBox).Enabled = false; } else { (gr.FindControl("checkRow") as CheckBox).Checked = true; if (Convert.ToInt32(drchk[0]["ISCURRENT"]) == 0) { (gr.FindControl("checkRow") as CheckBox).Enabled = false; } } } } else { if (drchk[0]["InspectionDetailID"].ToString() != Request.QueryString["InspID"]) { (gr.FindControl("checkRow") as CheckBox).Checked = false; (gr.FindControl("checkRow") as CheckBox).Enabled = false; } else { if (drchk[0]["LocationNodeID"].ToString() != "0" && drchk[0]["LocationNodeID"].ToString() != "") { (gr.FindControl("checkRow") as CheckBox).Checked = true; if (Convert.ToInt32(drchk[0]["ISCURRENT"]) == 0) { (gr.FindControl("checkRow") as CheckBox).Enabled = false; } } } } } } SaveItemsSelection(); string js = "GridWorkFlow();"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } catch (Exception ex) { string js = "alert('Error in loading data!! Error: " + UDFLib.ReplaceSpecialCharacter(ex.Message) + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }