protected void onUpdate(object source, CommandEventArgs e)
    {
        ddlWorkCategory.SelectedValue = ViewState["Work_Categ_ID"].ToString();
        if (hfTblMode.Value != "Edit")
        {
            BLL_JRA_Hazards.UPD_ASSESSMENT_STATUS(Convert.ToInt32(hfAssessment_ID.Value), Convert.ToInt32(hfWork_Categ_ID.Value), Convert.ToInt32(hfVessel_ID.Value), "Edit", "", GetSessionUserID());
            hfTblMode.Value = "Edit";
        }


        HiddenFlag.Value = "Edit";
        OperationMode    = "Edit Hazard Template";

        int cnt = 0;

        int AssessmentDtlID = UDFLib.ConvertToInteger(e.CommandArgument.ToString().Split(';')[0]);
        int OfficeID        = UDFLib.ConvertToInteger(e.CommandArgument.ToString().Split(';')[1]);

        ViewState["Assessment_Dtl_ID"] = AssessmentDtlID;
        ViewState["Office_ID"]         = OfficeID;


        DataSet dt = BLL_JRA_Hazards.GET_ASSESSMENT(UDFLib.ConvertToInteger(hfAssessment_ID.Value), UDFLib.ConvertToInteger(hfVessel_ID.Value), GetSessionUserID(), AssessmentDtlID, OfficeID);

        ViewState["Hazard_ID"] = txtHazardID.Text = dt.Tables[0].Rows[0]["Hazard_ID"].ToString();
        if (dt.Tables[0].Rows[0]["Hazard_ID"].ToString() == "")
        {
            txtHazardDesc.ReadOnly = false;
        }
        else
        {
            txtHazardDesc.ReadOnly = true;
        }
        txtHazardDesc.Text              = dt.Tables[0].Rows[0]["Hazard_Description"].ToString();
        txtControlMeasure.Text          = dt.Tables[0].Rows[0]["Control_Measure"].ToString();
        txtInitiakRisk.Text             = dt.Tables[0].Rows[0]["Initial_Risk"].ToString();
        txtInitiakRiskValue.Text        = dt.Tables[0].Rows[0]["Initial_Risk_Value"].ToString();
        txtAdditionalCntrolMeasure.Text = dt.Tables[0].Rows[0]["Additional_Control_Measures"].ToString();

        txtInitialRiskColor.Text = dt.Tables[0].Rows[0]["Initial_Risk_Color"].ToString();


        try
        {
            ddlSeverity.SelectedValue = dt.Tables[0].Rows[0]["Severity_ID"].ToString();
        }
        catch (Exception)
        {
            ddlSeverity.SelectedIndex = 0;
        }
        try
        {
            ddlLikelihood.SelectedValue = dt.Tables[0].Rows[0]["Likelihood_ID"].ToString();
        }
        catch (Exception)
        {
            ddlLikelihood.SelectedIndex = 0;
        }
        try
        {
            ddlWorkCategory.SelectedValue = dt.Tables[0].Rows[0]["Work_Categ_ID"].ToString();
        }
        catch (Exception)
        {
            ddlWorkCategory.SelectedIndex = 0;
        }



        try
        {
            ddlModifiedRisk.SelectedValue = dt.Tables[0].Rows[0]["Modified_Risk_Value"].ToString();
        }
        catch (Exception)
        {
            ddlModifiedRisk.SelectedIndex = 0;
        }



        string AddHazardTemplate = String.Format("showModal('divadd',true);");

        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AddHazardTemplate", AddHazardTemplate, true);
    }
    public void BindAssessmentDetails()
    {
        try
        {
            int rowcount = ucCustomPagerItems.isCountRecord;

            string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            string sortdirection = null;
            if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = ViewState["SORTDIRECTION"].ToString();
            }


            DataSet ds = BLL_JRA_Hazards.GET_ASSESSMENT(UDFLib.ConvertToInteger(hfAssessment_ID.Value), UDFLib.ConvertToInteger(hfVessel_ID.Value), GetSessionUserID());

            txtVesselName.Text            = ds.Tables[0].Rows[0]["Vessel_Name"].ToString();
            txtCurrentAssessmentDate.Text = Convert.ToDateTime(ds.Tables[0].Rows[0]["Current_Assessment_Date"].ToString()).ToString("dd/MMM/yyyy");
            txtLastAssessmentDate.Text    = ds.Tables[0].Rows[0]["Last_Assessment_Date"].ToString().Trim() != "" ? Convert.ToDateTime(ds.Tables[0].Rows[0]["Last_Assessment_Date"].ToString()).ToString("dd/MMM/yyyy") : "";
            txtJobASsessed.Text           = ds.Tables[0].Rows[0]["Work_Categ_Value"].ToString() + " " + ds.Tables[0].Rows[0]["Work_Category_Name"].ToString();
            // txtAssessmentNo.Text = ds.Tables[0].Rows[0]["Work_Categ_Value"].ToString();
            hfTblMode.Value           = ds.Tables[0].Rows[0]["Mode"].ToString();
            hfWork_Categ_ID.Value     = ds.Tables[0].Rows[0]["Work_Categ_ID"].ToString();
            hfAssessment_Status.Value = ds.Tables[0].Rows[0]["Assessment_Status"].ToString();
            lblApprovalStatus.Text    = ds.Tables[0].Rows[0]["Assessment_Status"].ToString();
            if (ds.Tables[0].Rows[0]["ValidUser"].ToString() == "True")
            {
                imgBtnApproveReject.Visible = true;
                #region access Validation
                //---access Validation

                int    CurrentUserID = GetSessionUserID();
                string PageURL       = UDFLib.GetPageURL(Request.Path.ToUpper());

                BLL_Infra_UserCredentials objUser = new BLL_Infra_UserCredentials();
                objUA = objUser.Get_UserAccessForPage(CurrentUserID, PageURL);

                if (objUA.View == 0)
                {
                    Response.Redirect("~/default.aspx?msgid=1");
                }



                if (objUA.Add == 0)
                {
                    ImgAdd.Visible  = false;
                    btnsave.Visible = false;
                }
                else
                {
                    if (hfAssessment_Status.Value == "Approval Pending")
                    {
                        ImgAdd.Visible  = true;
                        btnsave.Visible = true;
                    }
                    else
                    {
                        ImgAdd.Visible  = false;
                        btnsave.Visible = false;
                    }
                }

                if (objUA.Edit == 1)
                {
                    uaEditFlag      = true;
                    btnsave.Visible = true;
                    if (hfAssessment_Status.Value == "Approval Pending")
                    {
                        uaEditFlag      = true;
                        btnsave.Visible = true;
                    }
                    else
                    {
                        uaEditFlag      = false;
                        btnsave.Visible = false;
                    }
                }
                else
                {
                    uaEditFlag      = false;
                    btnsave.Visible = false;
                }



                if (objUA.Delete == 1)
                {
                    uaDeleteFlage = true;
                }

                //-------------
                #endregion
            }
            else
            {
                uaDeleteFlage = false;
                uaEditFlag    = false;
                imgBtnApproveReject.Visible = false;
            }
            ViewState["Work_Categ_ID"] = ds.Tables[0].Rows[0]["Work_Categ_ID"].ToString();



            LoadFollowups();



            if (ds.Tables[1].Rows.Count > 0)
            {
                gvAssessmentDetails.DataSource = ds.Tables[1];
                gvAssessmentDetails.DataBind();
            }

            if (ds.Tables[2].Rows.Count > 0)
            {
                grdActionLog.DataSource = ds.Tables[2];
                grdActionLog.DataBind();
            }
        }
        catch (Exception)
        {
        }
    }