protected void CalulateRisk()
    {
        if (ddlSeverity.SelectedIndex > 0 && ddlLikelihood.SelectedIndex > 0)
        {
            DataSet dsSev  = BLL_JRA_Hazards.GET_TYPE("Severity");
            DataSet dsLkhd = BLL_JRA_Hazards.GET_TYPE("Likelihood");
            string  s      = dsSev.Tables[0].Select("Type_ID=" + UDFLib.ConvertToInteger(ddlSeverity.SelectedValue))[0]["Type_Value"].ToString();
            string  l      = dsLkhd.Tables[0].Select("Type_ID=" + UDFLib.ConvertToInteger(ddlLikelihood.SelectedValue))[0]["Type_Value"].ToString();

            int     Rating = UDFLib.ConvertToInteger(s) * UDFLib.ConvertToInteger(l);
            DataSet ds     = BLL_JRA_Hazards.GET_RISK_RATINGS(Rating);
            txtInitiakRisk.Text      = ds.Tables[0].Rows[0]["Type_Display_Text"].ToString();
            txtInitiakRiskValue.Text = ds.Tables[0].Rows[0]["Type_ID"].ToString();
            txtInitialRiskColor.Text = ds.Tables[0].Rows[0]["Type_Color"].ToString();
        }
        else
        {
            txtInitiakRiskValue.Text = "";
            txtInitiakRisk.Text      = "";
            txtInitialRiskColor.Text = "";
        }
        string AddPort = String.Format("showModal('divadd',true);");

        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AddPort", AddPort, true);
    }
    protected void btnsave_Click(object sender, EventArgs e)
    {
        string ModifiedRiskColor = null;
        string ModifiedRiskValue = null;
        string ModifiedRisk      = null;

        if (ddlModifiedRisk.SelectedIndex > 0)
        {
            DataSet dsModRis = BLL_JRA_Hazards.JRA_GET_MODIFIED_RISKS();
            ModifiedRiskColor = dsModRis.Tables[0].Select("Type_ID=" + ddlModifiedRisk.SelectedValue)[0]["Type_Color"].ToString();
            ModifiedRisk      = ddlModifiedRisk.SelectedItem.Text;
            ModifiedRiskValue = ddlModifiedRisk.SelectedValue;
        }
        if (ddlSeverity.SelectedIndex > 0 && ddlLikelihood.SelectedIndex > 0)
        {
            DataSet dsSev  = BLL_JRA_Hazards.GET_TYPE("Severity");
            DataSet dsLkhd = BLL_JRA_Hazards.GET_TYPE("Likelihood");
            string  s      = dsSev.Tables[0].Select("Type_ID=" + UDFLib.ConvertToInteger(ddlSeverity.SelectedValue))[0]["Type_Value"].ToString();
            string  l      = dsLkhd.Tables[0].Select("Type_ID=" + UDFLib.ConvertToInteger(ddlLikelihood.SelectedValue))[0]["Type_Value"].ToString();

            int     Rating = UDFLib.ConvertToInteger(s) * UDFLib.ConvertToInteger(l);
            DataSet ds     = BLL_JRA_Hazards.GET_RISK_RATINGS(Rating);
            txtInitiakRisk.Text      = ds.Tables[0].Rows[0]["Type_Display_Text"].ToString();
            txtInitiakRiskValue.Text = ds.Tables[0].Rows[0]["Type_ID"].ToString();
            txtInitialRiskColor.Text = ds.Tables[0].Rows[0]["Type_Color"].ToString();
        }
        if (HiddenFlag.Value == "Add")
        {
            //BLL_JRA_Hazards.INSUPD_ASSESSMENT(UDFLib.ConvertToInteger(hfAssessment_ID.Value),
            //    null, UDFLib.ConvertToInteger(hfVessel_ID.Value),
            //    GetSessionUserID(), null, txtHazardDesc.Text,txtControlMeasure.Text,
            //    ddlSeverity.SelectedValue, ddlLikelihood.SelectedValue, ddlSeverity.SelectedItem.Text,
            //    ddlLikelihood.SelectedItem.Text, txtInitiakRisk.Text, txtInitiakRiskValue.Text, txtInitialRiskColor.Text,
            //    txtAdditionalCntrolMeasure.Text, ModifiedRisk, ModifiedRiskValue, ModifiedRiskColor, 1);
            BLL_JRA_Hazards.INSUPD_ASSESSMENT(UDFLib.ConvertToInteger(hfAssessment_ID.Value),
                                              null, UDFLib.ConvertToInteger(hfVessel_ID.Value),
                                              GetSessionUserID(), null, txtHazardDesc.Text, txtControlMeasure.Text,
                                              ddlSeverity.SelectedValue, ddlLikelihood.SelectedValue, ddlSeverity.SelectedItem.Text,
                                              ddlLikelihood.SelectedItem.Text, txtInitiakRisk.Text, txtInitiakRiskValue.Text, txtInitialRiskColor.Text,
                                              txtAdditionalCntrolMeasure.Text, ModifiedRisk, ModifiedRiskValue, ModifiedRiskColor, 1);
        }
        else
        {
            BLL_JRA_Hazards.INSUPD_ASSESSMENT(UDFLib.ConvertToInteger(hfAssessment_ID.Value),
                                              UDFLib.ConvertToInteger(ViewState["Assessment_Dtl_ID"]), UDFLib.ConvertToInteger(hfVessel_ID.Value),
                                              GetSessionUserID(), UDFLib.ConvertToInteger(ViewState["Hazard_ID"]), txtHazardDesc.Text, txtControlMeasure.Text,
                                              ddlSeverity.SelectedValue, ddlLikelihood.SelectedValue, ddlSeverity.SelectedItem.Text,
                                              ddlLikelihood.SelectedItem.Text, txtInitiakRisk.Text, txtInitiakRiskValue.Text, txtInitialRiskColor.Text,
                                              txtAdditionalCntrolMeasure.Text, ModifiedRisk, ModifiedRiskValue, ModifiedRiskColor, UDFLib.ConvertToInteger(ViewState["Office_ID"]));
        }

        BindAssessmentDetails();
        string hidemodal = String.Format("hideModal('divadd')");

        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "hidemodal", hidemodal, true);
    }