示例#1
0
    private void BindDrillAttachments()
    {
        DataTable dt = BLL_SCM_Report.SCMGetDrillAttachment(Convert.ToInt32(Request.QueryString["DRILLID"].ToString()), Convert.ToInt32(Request.QueryString["Vessel_ID"].ToString()));

        if (dt.Rows.Count > 0)
        {
            //Bind the header
            txtVessel.Text    = dt.Rows[0]["Vessel_Name"].ToString();
            txtDrillDate.Text = dt.Rows[0]["DRILL_DATE"].ToString();
            txtDrillType.Text = dt.Rows[0]["DRILLTYPE"].ToString();
            txtImproSugg.Text = dt.Rows[0]["IMPROVEMENTSSUGGESTED"].ToString();

            //Bind the Photos
            rptDrillImages.DataSource = dt;
            rptDrillImages.DataBind();

            string FileName = dt.Rows[0]["PhotoUrl"].ToString();
            string FilePath = "../../Uploads/SCM/" + Path.GetFileName(dt.Rows[0]["PhotoUrl"].ToString());

            if (System.IO.File.Exists(Server.MapPath(FilePath)) == true)
            {
                Random r   = new Random();
                string ver = r.Next().ToString();
                frmContract.Attributes.Add("src", FilePath + "?ver=" + ver);
            }
        }
    }
    public void FillDDLYear()
    {
        try
        {
            DataTable dtyears = BLL_SCM_Report.GetVesselIssuesYears();


            int minyear = int.MaxValue;
            int maxyear = int.MinValue;
            if (dtyears.Rows.Count > 0)
            {
                foreach (DataRow dr in dtyears.Rows)
                {
                    int year = dr.Field <int>("ISSUE_CREATED_YEAR");
                    minyear = Math.Min(minyear, year);
                    maxyear = Math.Max(maxyear, year);
                }

                Session["maxYear"] = maxyear.ToString();
            }

            ddlYear.Items.Clear();
            ddlYear.DataSource     = dtyears;
            ddlYear.DataTextField  = "ISSUE_CREATED_YEAR";
            ddlYear.DataValueField = "ISSUE_CREATED_YEAR";
            ddlYear.DataBind();
            ListItem li = new ListItem("--SELECT ALL--", "0");
            ddlYear.Items.Insert(0, li);
        }
        catch (Exception ex)
        {
        }
    }
示例#3
0
    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());
    }
示例#4
0
    protected void divReleasebtnOk_Click(object sender, EventArgs e)
    {
        int rowscount = gvRelease.Rows.Count;

        for (int i = 0; i < rowscount; i++)
        {
            CheckBox chk      = (CheckBox)gvRelease.Rows[i].FindControl("chkRelease");
            Label    lblmonth = (Label)gvRelease.Rows[i].FindControl("lblMonthNumber");
            Label    lblyear  = (Label)gvRelease.Rows[i].FindControl("lblReleaseYear");

            if (chk.Checked)
            {
                BLL_SCM_Report.SCMReportRealeaseResponseToShip(Convert.ToInt32(Session["userid"].ToString()), Convert.ToInt32(lblyear.Text), Convert.ToInt32(lblmonth.Text));
            }
        }


        string msgDivReleaseHide = string.Format("hideModal('divRelease');");

        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgDivReleaseHide", msgDivReleaseHide, true);

        BindSCMResponseSearch();

        UpdPnlFilter.Update();
        UpdPnlGrid.Update();
    }
    protected void btnUnMarkSMSReview_Click(object sender, EventArgs e)
    {
        int rowscount     = gvIssueAssign.Rows.Count;
        int?responseid    = null;
        int?smsreviewflag = null;


        for (int i = 0; i < rowscount; i++)
        {
            CheckBox chk         = (CheckBox)gvIssueAssign.Rows[i].FindControl("ChkSMSReview");
            Label    lblResponse = (Label)gvIssueAssign.Rows[i].FindControl("lblResponseID");

            if (chk.Checked)
            {
                if (lblResponse.Text != "")
                {
                    responseid    = Convert.ToInt32(lblResponse.Text);
                    smsreviewflag = 1;
                    BLL_SCM_Report.SCMReportSMSReviewFlagUpdate(responseid, smsreviewflag);
                }
            }
            else
            {
                if (lblResponse.Text != "")
                {
                    responseid    = Convert.ToInt32(lblResponse.Text);
                    smsreviewflag = null;
                    BLL_SCM_Report.SCMReportSMSReviewFlagUpdate(responseid, smsreviewflag);
                }
            }
        }
    }
    public void BindSCMOfficeRespresentativeSearch()
    {
        DataSet ds = BLL_SCM_Report.SCMOfficeRepresentativeSearch(null, null, null, null);

        if (ds.Tables[0].Rows.Count > 0)
        {
            gvOffRespresentative.DataSource = ds.Tables[0];
            gvOffRespresentative.DataBind();
        }
    }
示例#7
0
    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;
        }
    }
示例#8
0
    protected void divResponsebtnResponse_Click(object sender, EventArgs e)
    {
        BLL_SCM_Report.SCMReportOfficeResponseSave(Convert.ToInt32(Session["userid"].ToString()), Convert.ToInt32(ViewState["ResponseID"].ToString()), divResponsetxtOfficeResponse.Text);

        string msgDivResponseHide = string.Format("hideModal('divResponse');");

        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgDivResponseHide", msgDivResponseHide, true);

        BindSCMResponseSearch();

        UpdPnlFilter.Update();
        UpdPnlGrid.Update();
    }
    protected void btnExport_Click(object sender, ImageClickEventArgs e)
    {
        DataSet ds = BLL_SCM_Report.SCMReportDetailsSearch(Convert.ToInt32(Request.QueryString["SCMID"]), TabSCM.ActiveTab.TabIndex, Convert.ToInt32(Request.QueryString["VesselID"]));

        string[] HeaderCaptions  = { "Staff Code", "Staff Name", "Staff Rank", "Sigature" };
        string[] DataColumnsName = { "STAFF_CODE", "Staff_Name", "Rank_Short_Name", "Sigature" };
        ds.Tables[0].Columns.Add("Sigature");
        foreach (DataRow item in ds.Tables[0].Rows)
        {
            item["Sigature"] = "";
        }
        GridViewExportUtil.ShowExcel(ds.Tables[0], HeaderCaptions, DataColumnsName, "SCM", "Safety Committee Meeting Attendance");
    }
    public void IssueAssignToDepartment(string deptid, string tabname, string strresponseid, string tabpkid, string vesselid, string link)
    {
        int?responseid = null;

        if (strresponseid != "")
        {
            responseid = Convert.ToInt32(strresponseid);
        }


        int retval = BLL_SCM_Report.SCMReportOfficeIssueAssigned(Convert.ToInt32(Session["userid"].ToString())
                                                                 , Convert.ToInt32(deptid), tabname
                                                                 , responseid, Convert.ToInt32(tabpkid)
                                                                 , Convert.ToInt32(vesselid), Convert.ToInt32(link));
    }
    protected void BindSCMList()
    {
        DataSet ds = BLL_SCM_Report.SCMReportList(Convert.ToInt32(Request.QueryString["SCMID"]), Convert.ToInt32(Request.QueryString["VesselID"]));

        if (ds.Tables[0].Rows.Count > 0)
        {
            DataRow dr = ds.Tables[0].Rows[0];
            txtVessel.Text         = dr["Vessel_Name"].ToString();
            txtVesselPosition.Text = dr["PRESENT_POSITION"].ToString();
            txtMeetingDate.Text    = Request.QueryString["MeetingDate"].ToString();

            ViewState["Fleet_ID"]  = dr["FleetCode"].ToString();
            ViewState["Vessel_ID"] = dr["Vessel_ID"].ToString();
        }
    }
示例#12
0
 public void FillDDLYear()
 {
     try
     {
         DataTable dtyears = BLL_SCM_Report.GetVesselIssuesYears();
         ddlYear.Items.Clear();
         ddlYear.DataSource     = dtyears;
         ddlYear.DataTextField  = "ISSUE_CREATED_YEAR";
         ddlYear.DataValueField = "ISSUE_CREATED_YEAR";
         ddlYear.DataBind();
         ListItem li = new ListItem("--SELECT ALL--", "0");
         ddlYear.Items.Insert(0, li);
     }
     catch (Exception ex)
     {
     }
 }
示例#13
0
 public void BindDrillTypeDDL()
 {
     try
     {
         DataTable dt = BLL_SCM_Report.SCMGetDrillTYPE();
         DDLDrillType.Items.Clear();
         DDLDrillType.DataSource     = dt;
         DDLDrillType.DataTextField  = "DRILL_NAME";
         DDLDrillType.DataValueField = "ID";
         DDLDrillType.DataBind();
         ListItem li = new ListItem("--SELECT ALL--", "0");
         DDLDrillType.Items.Insert(0, li);
     }
     catch (Exception ex)
     {
     }
 }
    protected void btnExport_Click(object sender, ImageClickEventArgs e)
    {
        int rowcount = ucCustomPagerItems.isCountRecord;

        string vesselcode = (ViewState["VesselCode"] == null) ? null : (ViewState["VesselCode"].ToString());

        int?deptcode = null; if (DDLOfficeDept.SelectedValue != "0")
        {
            deptcode = Int32.Parse(DDLOfficeDept.SelectedValue);
        }
        int?year = null; if (ddlYear.SelectedValue != "0")
        {
            year = Int32.Parse(ddlYear.SelectedValue.ToString());
        }
        int?month = null; if (ddlMonth.SelectedValue != "0")
        {
            month = Int32.Parse(ddlMonth.SelectedValue.ToString());
        }


        int?assigndeptstatus = null; if (optAssignDept.SelectedValue != "2")
        {
            assigndeptstatus = Int32.Parse(optAssignDept.SelectedValue);
        }
        int?smsnextreview = null; if (optSMSReview.SelectedValue != "2")
        {
            smsnextreview = Int32.Parse(optSMSReview.SelectedValue);
        }
        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.SCMReportIssueAssignmentSearch(UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(vesselcode)
                                                                   , null, deptcode, year, month, txtSearchBy.Text.Trim(), assigndeptstatus, smsnextreview
                                                                   , sortbycoloumn, sortdirection, null, null, ref rowcount);


        string[] HeaderCaptions  = { "Vessel", "Month", "Year", "Assign Dept.", "SCM Tab", "Vessel Issue", "Created By", "SMS Review" };
        string[] DataColumnsName = { "Vessel_Name", "Month", "Year", "Department", "TAB_NAME", "VESSEL_ISSUE", "Issue_Created_By", "SMS_NEXT_REVIEW" };

        GridViewExportUtil.ShowExcel(ds.Tables[0], HeaderCaptions, DataColumnsName, "Vessel Issue Assignment", "Vessel Issue Assignment", HtmlFilterTable());
    }
    protected void btnRqstUptResponse_Click(object sender, EventArgs e)
    {
        BLL_Crew_CrewDetails      objBLLCrew = new BLL_Crew_CrewDetails();
        BLL_Infra_UserCredentials ojbInfra   = new BLL_Infra_UserCredentials();

        string sToEmailAddress = "", strEmailAddCc = "", strFormatSubject = "Update response";

        DataTable dtEmailAdd = BLL_SCM_Report.SCMReportGetEmailAddToSendMailForResponse(Convert.ToInt32(ddlYear.SelectedValue), Convert.ToInt32(ddlMonth.SelectedValue));

        foreach (DataRow dr in dtEmailAdd.Rows)
        {
            sToEmailAddress += dr["EMAIL_ADD"].ToString() + ";";
        }

        if (dtEmailAdd.Rows.Count > 0)
        {
            DataTable dtRequesterDetails = ojbInfra.Get_UserDetails(Convert.ToInt32(Session["userid"].ToString()));

            StringBuilder sbEmailbody = new StringBuilder();
            string        path        = System.Configuration.ConfigurationManager.AppSettings["APP_URL"].ToString() + "/QMS/SCM/SCM_Response.aspx";
            //string path = "http://seachange.dyndns.info/smslog/QMS/SCM/SCM_Response.aspx";

            sbEmailbody.Append("Dear All,");
            sbEmailbody.AppendLine("<br><br>");
            sbEmailbody.AppendLine("Please click on below link to update the response.");
            sbEmailbody.Append("<a href=" + path + ">" + path + "</a>");
            sbEmailbody.AppendLine("<br><br>");
            sbEmailbody.AppendLine("<br>");
            sbEmailbody.AppendLine("<br>");
            sbEmailbody.AppendLine("Best Regards,");
            sbEmailbody.AppendLine("<br>");
            sbEmailbody.AppendLine(dtRequesterDetails.Rows[0]["User_name"].ToString().ToUpper() + " " + dtRequesterDetails.Rows[0]["Last_Name"].ToString().ToUpper());
            sbEmailbody.AppendLine("<br>");
            sbEmailbody.AppendLine(dtRequesterDetails.Rows[0]["Designation"].ToString());
            sbEmailbody.AppendLine(Convert.ToString(Session["Company_Address_GL"]));
            sbEmailbody.AppendLine("<br>");


            int MailID = objBLLCrew.Send_CrewNotification(0, 0, 0, 0, sToEmailAddress, strEmailAddCc, "", strFormatSubject, sbEmailbody.ToString(), "", "MAIL", "", UDFLib.ConvertToInteger(Session["USERID"].ToString()), "DRAFT");

            string URL = String.Format("window.open('/" + System.Configuration.ConfigurationManager.AppSettings["APP_NAME"].ToString() + "/crew/EmailEditor.aspx?ID=+" + MailID.ToString() + "');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "k" + MailID.ToString(), URL, true);
        }
    }
示例#16
0
    protected void btnRelease_Click(object sender, EventArgs e)
    {
        DataTable dtGetResponseRelease = BLL_SCM_Report.GetSCMReportResponseRelease();

        if (dtGetResponseRelease.Rows.Count > 0)
        {
            gvRelease.DataSource = dtGetResponseRelease;
            gvRelease.DataBind();

            string msgdiv = string.Format("showModal('divRelease');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgdiv", msgdiv, true);

            UpdatePnlSCMRelease.Update();
        }
        else
        {
            string js = "alert('There is no response to be released!');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alertUser", js, true);
        }
    }
示例#17
0
    public void FillDivDDLOfficeDept()
    {
        int?companyid = null;

        if ((Session["USERCOMPANYID"].ToString() != "") || (Session["USERCOMPANYID"] == null))
        {
            companyid = Convert.ToInt32(Session["USERCOMPANYID"].ToString());
        }

        DataTable dtOfficeDept = BLL_SCM_Report.SCMGetOfficeDepartment(companyid);

        DivResponseDDLDeptpartment.Items.Clear();
        DivResponseDDLDeptpartment.DataSource     = dtOfficeDept;
        DivResponseDDLDeptpartment.DataTextField  = "VALUE";
        DivResponseDDLDeptpartment.DataValueField = "ID";
        DivResponseDDLDeptpartment.DataBind();
        ListItem lid = new ListItem("--SELECT ALL--", "0");

        DivResponseDDLDeptpartment.Items.Insert(0, lid);
    }
示例#18
0
    protected void BindGrid()
    {
        DateTime?iniDate = null;

        if (txtToDate.Text != "")
        {
            iniDate = Convert.ToDateTime(txtToDate.Text);
        }
        DateTime?tempdate = null;

        if (txtToDate.Text != "")
        {
            tempdate = UDFLib.ConvertDateToNull(txtToDate.Text).Value.AddMonths(1);
        }
        DataSet ds = BLL_SCM_Report.Get_Absentees_Report(tempdate, UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue), UDFLib.ConvertIntegerToNull(DDLVessel.Text));

        if (ds.Tables[0].Rows.Count > 0)
        {
            txtToDate.Text         = UDFLib.ConvertDateToNull(ds.Tables[0].Rows[0]["Meet_date"]).Value.ToString("dd/MM/yyyy");
            gvAbsentees.DataSource = ds.Tables[0];
            gvAbsentees.DataBind();
        }
        else
        {
            ds.Tables[0].Clear();
            gvAbsentees.DataSource = ds.Tables[0];
            gvAbsentees.DataBind();
        }
        if (iniDate != null)
        {
            if (Convert.ToDateTime(txtToDate.Text).Month != iniDate.Value.Month)
            {
                txtToDate.Text = iniDate.Value.ToString("dd/MM/yyyy");
                ds.Tables[0].Clear();
                gvAbsentees.DataSource = ds.Tables[0];
                gvAbsentees.DataBind();
            }
        }
    }
示例#19
0
    protected void divResponsebtnModifyDept_Click(object sender, EventArgs e)
    {
        int?deptid = null;

        if (DivResponseDDLDeptpartment.SelectedValue != "0")
        {
            deptid = Convert.ToInt32(DivResponseDDLDeptpartment.SelectedValue.ToString());
        }

        BLL_SCM_Report.SCMReportOfficeDepartmentUpdate(Convert.ToInt32(Session["userid"].ToString()), Convert.ToInt32(ViewState["ResponseID"].ToString()), deptid);


        string msgDivResponseHide = string.Format("hideModal('divResponse');");

        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgDivResponseHide", msgDivResponseHide, true);


        BindSCMResponseSearch();

        UpdPnlFilter.Update();
        UpdPnlGrid.Update();
    }
    protected void btnVerify_Click(object sender, EventArgs e)
    {
        string js;

        try
        {
            if (txtMessage.Text.Trim().Length == 0)
            {
                js = "alert('Verification comment is mandatory!');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "js", js, true);
                return;
            }


            int SCMID      = Convert.ToInt32(Request.QueryString["SCMID"]);
            int VESSEL_ID  = Convert.ToInt32(Request.QueryString["VesselID"]);
            int VerifiedBy = int.Parse(Session["USERID"].ToString());
            BLL_SCM_Report.ScmVerifyReport(SCMID, txtMessage.Text, VESSEL_ID, VerifiedBy);
            //btnVerify.Enabled = false;
            txtMessage.ReadOnly          = true;
            btnVerify.Visible            = false;
            lblVerificationDate.Visible  = true;
            lblVerificationDateH.Visible = true;
            lblVerifiedBy.Visible        = true;
            lblVerifiedByH.Visible       = true;
            lblVerifiedBy.Text           = Session["USERFULLNAME"].ToString();
            lblVerificationDate.Text     = DateTime.Now.ToString("dd/MMM/yyyy");

            //LoadFollowUps(iJob_OfficeID, VESSEL_ID, Worklist_ID);
        }
        catch (Exception ex)
        {
            js = "alert('Error in saving data!! Error: " + ex.Message + "');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "errorsaving", js, true);
        }
    }
 private void OfficeRepresentativeSave(string deptid, string emailAddress)
 {
     BLL_SCM_Report.SCMOfficeRepresentativeSave(Convert.ToInt32(deptid), emailAddress);
 }
 private void OfficeRepresentativeDelete(string deptid, string scmrespid)
 {
     BLL_SCM_Report.SCMOfficeRepresentativeDelete(Convert.ToInt32(deptid), UDFLib.ConvertIntegerToNull(scmrespid));
 }
示例#23
0
    public void BindVesselsDrillReport()
    {
        DataTable dt            = new DataTable();
        string    sortby        = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
        int?      sortdirection = null; if (ViewState["SORTDIRECTION"] != null)

        {
            sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
        }

        dt = BLL_SCM_Report.SCMGetVesselDrillReports(UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue), null, null, UDFLib.ConvertIntegerToNull(DDLDrillType.SelectedValue));

        if (dt.Rows.Count > 0)
        {
            DataTable dtpb = UDFLib.PivotTable("DRILL_NAME", "DRILL_DATE", "Sort_order", new string[] { "VESSEL_ID" }, new string[] { "VESSEL_ID", "ID", "Sort_order" }, dt);
            dtpb.DefaultView.Sort = "Vessel";


            gvVesselsDrill.DataSource = dtpb;
            gvVesselsDrill.DataBind();

            int[] freq = new int[10];


            GridViewRow RowHeader = gvVesselsDrill.HeaderRow;
            int         j         = 2;
            foreach (TableCell cell in RowHeader.Cells)
            {
                //string[] hrow = (cell.Controls[0] as LinkButton).Text.Split('~');
                string[] hrow = cell.Text.Split('~');

                if (hrow.Length > 1)
                {
                    cell.Text = hrow[0] + "<br>" + hrow[1];
                    freq[j]   = int.Parse(hrow[1].Split(' ')[0]);
                    j++;
                }
            }

            foreach (GridViewRow gr in gvVesselsDrill.Rows)
            {
                j = 0;
                foreach (TableCell cell in gr.Cells)
                {
                    if (cell.Text == "Not Applicable")
                    {
                        cell.ForeColor = System.Drawing.Color.Blue;
                    }
                    if (j > 1 && cell.Text != "Not Applicable" && cell.Text.Trim() != "")
                    {
                        if (Convert.ToDateTime(cell.Text).AddDays(freq[j]).CompareTo(DateTime.Now) < 1)
                        {
                            cell.BackColor = System.Drawing.Color.Tomato;
                            cell.ForeColor = System.Drawing.Color.White;
                        }
                    }
                    j++;
                }
            }
        }
        else
        {
            gvVesselsDrill.DataSource = dt;
            gvVesselsDrill.DataBind();
        }
    }
    protected void BindSCMTabs()
    {
        int p = 1;



        if (TabSCM.ActiveTab.TabIndex != 10)
        {
            DataSet ds = BLL_SCM_Report.SCMReportDetailsSearch(Convert.ToInt32(Request.QueryString["SCMID"]), TabSCM.ActiveTab.TabIndex, Convert.ToInt32(Request.QueryString["VesselID"]));
            if (ds.Tables[ds.Tables.Count - 1].Rows[0]["VerificationComment"].ToString().Length > 0)
            {
                txtMessage.Text     = ds.Tables[ds.Tables.Count - 1].Rows[0]["VerificationComment"].ToString();
                txtMessage.ReadOnly = true;
                btnVerify.Visible   = false;

                lblVerifiedBy.Text           = ds.Tables[ds.Tables.Count - 1].Rows[0]["VerifiedByName"].ToString();;
                lblVerificationDate.Text     = Convert.ToDateTime(ds.Tables[ds.Tables.Count - 1].Rows[0]["VerificationDate"].ToString()).ToString("dd/MMM/yyyy");
                lblVerificationDate.Visible  = true;
                lblVerificationDateH.Visible = true;
                lblVerifiedBy.Visible        = true;
                lblVerifiedByH.Visible       = true;
                txtMessage.Visible           = true;
                lblComment.Visible           = true;
            }
            else
            {
                if (objUA.Approve != 0)
                {
                    txtMessage.Text   = "";
                    btnVerify.Visible = true;

                    txtMessage.Visible           = true;
                    lblVerificationDate.Visible  = false;
                    lblVerificationDateH.Visible = false;
                    lblVerifiedBy.Visible        = false;
                    lblVerifiedByH.Visible       = false;
                }
            }

            switch (TabSCM.ActiveTab.TabIndex)
            {
            case 0:

                gvInjd.DataSource = ds.Tables[0];
                gvInjd.DataBind();

                gvInjdLst.DataSource = ds.Tables[1];
                gvInjdLst.DataBind();

                break;

            case 1:

                gvEmdrl.DataSource = ds.Tables[0];
                gvEmdrl.DataBind();


                gvEmdrlntdone.DataSource = ds.Tables[1];
                gvEmdrlntdone.DataBind();

                break;

            case 2:
                gvSfvs.DataSource = ds.Tables[0];
                gvSfvs.DataBind();

                break;

            case 3:
                gvSwpt.DataSource = ds.Tables[0];
                gvSwpt.DataBind();

                break;

            case 4:
                gvOrtg.DataSource = ds.Tables[0];
                gvOrtg.DataBind();

                break;

            case 5:


                break;

            case 6:
                gvMetm.DataSource = ds.Tables[0];
                gvMetm.DataBind();

                break;

            case 7:
                gvAbsn.DataSource = ds.Tables[0];
                gvAbsn.DataBind();

                break;

            case 8:
                gvCncd.DataSource = ds.Tables[0];
                gvCncd.DataBind();

                break;

            case 9:
                gvAttachments.DataSource = ds.Tables[0];
                gvAttachments.DataBind();

                break;

            case 12:
                gvEnvironmental.DataSource = ds.Tables[0];
                gvEnvironmental.DataBind();
                dlEnvironmentalAttachments.DataSource = ds.Tables[1];
                dlEnvironmentalAttachments.DataBind();
                break;

            case 13:
                gvHealthNutritionHygiene.DataSource = ds.Tables[0];
                gvHealthNutritionHygiene.DataBind();
                dtHealthAttachments.DataSource = ds.Tables[1];
                dtHealthAttachments.DataBind();
                break;

            default:
                break;
            }
        }
    }
    public void BindSCMIssueAssignmentSearch()
    {
        int rowcount = ucCustomPagerItems.isCountRecord;

        string vesselcode = (ViewState["VesselCode"] == null) ? null : (ViewState["VesselCode"].ToString());

        int?deptcode = null; if (DDLOfficeDept.SelectedValue != "0")
        {
            deptcode = Int32.Parse(DDLOfficeDept.SelectedValue);
        }
        int?year = null; if (ddlYear.SelectedValue != "0")
        {
            year = Int32.Parse(ddlYear.SelectedValue.ToString());
        }
        int?month = null; if (ddlMonth.SelectedValue != "0")
        {
            month = Int32.Parse(ddlMonth.SelectedValue.ToString());
        }


        int?assigndeptstatus = null; if (optAssignDept.SelectedValue != "2")
        {
            assigndeptstatus = Int32.Parse(optAssignDept.SelectedValue);
        }
        int?smsnextreview = null; if (optSMSReview.SelectedValue != "2")
        {
            smsnextreview = Int32.Parse(optSMSReview.SelectedValue);
        }
        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.SCMReportIssueAssignmentSearch(UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(vesselcode)
                                                                   , null, deptcode, year, month, txtSearchBy.Text.Trim(), assigndeptstatus, smsnextreview
                                                                   , 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)
        {
            gvIssueAssign.DataSource = ds.Tables[0];
            gvIssueAssign.DataBind();

            if (ViewState["ID"] == null)
            {
                ViewState["ID"] = ds.Tables[0].Rows[0]["ResponseID"].ToString();
                //gvIssueAssign.SelectedIndex = 0;
            }

            // SetRowSelection();
        }
        else
        {
            gvIssueAssign.DataSource = ds.Tables[0];
            gvIssueAssign.DataBind();
        }
    }