protected void BindCombos()
    {
        DataTable dtAllChilds = BLL_JRA_Hazards.GET_WORK_CATEGORY_LIST(null, 3, 2);

        ddlWorkCategory.DataSource     = dtAllChilds;
        ddlWorkCategory.DataTextField  = "Work_Category_Display";
        ddlWorkCategory.DataValueField = "Work_Categ_ID";
        ddlWorkCategory.DataBind();
        ddlWorkCategory.Items.Insert(0, new ListItem("-Select All-", "0"));

        DataSet dsSev = BLL_JRA_Hazards.GET_TYPE("Severity");

        ddlSeverity.DataSource     = dsSev.Tables[0];
        ddlSeverity.DataTextField  = "Type_Display_Text";
        ddlSeverity.DataValueField = "Type_ID";
        ddlSeverity.DataBind();
        ddlSeverity.Items.Insert(0, new ListItem("-Select All-", "0"));

        DataSet dsLkhd = BLL_JRA_Hazards.GET_TYPE("Likelihood");

        ddlLikelihood.DataSource     = dsLkhd.Tables[0];
        ddlLikelihood.DataTextField  = "Type_Display_Text";
        ddlLikelihood.DataValueField = "Type_ID";
        ddlLikelihood.DataBind();
        ddlLikelihood.Items.Insert(0, new ListItem("-Select All-", "0"));

        DataSet dsModRis = BLL_JRA_Hazards.JRA_GET_MODIFIED_RISKS();

        ddlModifiedRisk.DataSource     = dsModRis.Tables[0];
        ddlModifiedRisk.DataTextField  = "Type_Display_Text";
        ddlModifiedRisk.DataValueField = "Type_ID";
        ddlModifiedRisk.DataBind();
        ddlModifiedRisk.Items.Insert(0, new ListItem("-Select All-", "0"));
    }
    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);
    }
    protected void LoadCombo()
    {
        DataSet dsSev = BLL_JRA_Hazards.GET_TYPE("Severity");

        ddlSeverity.DataSource     = dsSev.Tables[0];
        ddlSeverity.DataTextField  = "Type_Display_Text";
        ddlSeverity.DataValueField = "Type_ID";
        ddlSeverity.DataBind();
        ddlSeverity.Items.Insert(0, new ListItem("-Select All-", "0"));

        DataSet dsCon = BLL_JRA_Hazards.GET_TYPE("Consequences");

        ddlCons.DataSource     = dsCon.Tables[0];
        ddlCons.DataTextField  = "Type_Display_Text";
        ddlCons.DataValueField = "Type_ID";
        ddlCons.DataBind();
        ddlCons.Items.Insert(0, new ListItem("-Select All-", "0"));
    }
Exemple #5
0
    protected void BindCombos()
    {
        JRA_Lib lObjWC = new JRA_Lib();

        lObjWC.Work_Categ_Parent_ID = null;
        lObjWC.Mode = 0;
        DataTable dt = BLL_JRA_Work_Category.JRA_GET_WORK_CATEGORY_LIST(lObjWC);

        DataView  dv       = dt.DefaultView;
        DataTable dtCloned = dt.Clone();

        dtCloned.Columns["Work_Categ_Value"].DataType = typeof(float);
        foreach (DataRow row in dt.Rows)
        {
            dtCloned.ImportRow(row);
        }
        dv = dtCloned.DefaultView;

        dv.Sort = "Work_Categ_Value";
        dt      = dv.ToTable();

        ddlParentWorkCateg.DataSource     = dt;
        ddlParentWorkCateg.DataTextField  = "Work_Category_Display";
        ddlParentWorkCateg.DataValueField = "Work_Categ_ID";
        ddlParentWorkCateg.DataBind();
        ddlParentWorkCateg.Items.Insert(0, new ListItem("-Select All-", "0"));

        lObjWC = new JRA_Lib();
        lObjWC.Work_Categ_Parent_ID = null;
        lObjWC.Mode = 3;
        DataTable dtAllChilds = BLL_JRA_Work_Category.JRA_GET_WORK_CATEGORY_LIST(lObjWC);

        DataTable dtAllChildsCloned = dtAllChilds.Clone();

        dtAllChildsCloned.Columns["Work_Categ_Value"].DataType = typeof(float);
        foreach (DataRow row in dtAllChilds.Rows)
        {
            dtAllChildsCloned.ImportRow(row);
        }



        dv          = dtAllChildsCloned.DefaultView;
        dv.Sort     = "Work_Categ_Value";
        dtAllChilds = dv.ToTable();
        ddlChildWorkCateg.DataSource     = dtAllChilds;
        ddlChildWorkCateg.DataTextField  = "Work_Category_Display";
        ddlChildWorkCateg.DataValueField = "Work_Categ_ID";
        ddlChildWorkCateg.DataBind();
        ddlChildWorkCateg.Items.Insert(0, new ListItem("-Select All-", "0"));
        ddlParentWorkCateg.SelectedIndex = 0;
        ddlChildWorkCateg.SelectedIndex  = 0;

        ddlWorkCategory.DataSource     = dtAllChilds;
        ddlWorkCategory.DataTextField  = "Work_Category_Display";
        ddlWorkCategory.DataValueField = "Work_Categ_ID";
        ddlWorkCategory.DataBind();
        ddlWorkCategory.Items.Insert(0, new ListItem("-Select All-", "0"));
        ddlWorkCategory.SelectedIndex = 0;
        DataSet dsSev = BLL_JRA_Hazards.GET_TYPE("Severity");

        ddlSeverity.DataSource     = dsSev.Tables[0];
        ddlSeverity.DataTextField  = "Type_Display_Text";
        ddlSeverity.DataValueField = "Type_ID";
        ddlSeverity.DataBind();
        ddlSeverity.Items.Insert(0, new ListItem("-Select All-", "0"));

        DataSet dsLkhd = BLL_JRA_Hazards.GET_TYPE("Likelihood");

        ddlLikelihood.DataSource     = dsLkhd.Tables[0];
        ddlLikelihood.DataTextField  = "Type_Display_Text";
        ddlLikelihood.DataValueField = "Type_ID";
        ddlLikelihood.DataBind();
        ddlLikelihood.Items.Insert(0, new ListItem("-Select All-", "0"));

        DataSet dsModRis = BLL_JRA_Hazards.JRA_GET_MODIFIED_RISKS();

        ddlModifiedRisk.DataSource     = dsModRis.Tables[0];
        ddlModifiedRisk.DataTextField  = "Type_Display_Text";
        ddlModifiedRisk.DataValueField = "Type_ID";
        ddlModifiedRisk.DataBind();
        ddlModifiedRisk.Items.Insert(0, new ListItem("-Select All-", "0"));
    }