protected bool EnableCheckboxRank(string RankID)
    {
        int Work_Categ_ID = UDFLib.ConvertToInteger(hfWC.Value.ToString());



        //DataSet ds = objFMS.FMS_Get_ApprovarByLevel(FileID, ApprovalLevel);
        DataSet ds = BLL_JRA_Hazards.Get_ApprovarByLevel(Work_Categ_ID, 0);

        if (ds.Tables.Count > 0)
        {
            if (ds.Tables[1].Select("Approvar_Detail_ID='" + RankID + "'").Length > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
        else
        {
            return(true);
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        int     Work_Categ_ID = UDFLib.ConvertToInteger(hfWC.Value.ToString());
        int     ApprovalLevel = UDFLib.ConvertToInteger(ViewState["ApprovalLevel"].ToString());
        DataSet ds            = BLL_JRA_Hazards.Get_ApprovarByLevel(Work_Categ_ID, ApprovalLevel);
        int     CreatedBy     = GetSessionUserID();

        BLL_JRA_Hazards.UPD_Approvar(Work_Categ_ID, ApprovalLevel);
        for (int i = 0; i < grdUser.Rows.Count; i++)
        {
            if (((CheckBox)grdUser.Rows[i].Cells[2].FindControl("chkUser")).Checked == true)
            {
                DataTable table = new DataTable();
                table.Columns.Add("PID");



                BLL_JRA_Hazards.Insert_Approvar(Work_Categ_ID, ApprovalLevel, UDFLib.ConvertToInteger(grdUser.Rows[i].Cells[0].Text), CreatedBy, 1, table);
                //objFMS.FMS_Insert_FileApprovar(FileID, ApprovalLevel, UDFLib.ConvertToInteger(grdUser.Rows[i].Cells[0].Text), CreatedBy);
            }
        }
        if (!string.IsNullOrEmpty(txtSearch.Text))
        {
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                DataTable table = new DataTable();
                table.Columns.Add("PID");

                BLL_JRA_Hazards.Insert_Approvar(Work_Categ_ID, ApprovalLevel, UDFLib.ConvertToInteger(ds.Tables[0].Rows[i]["Approvar_Detail_ID"]), CreatedBy, 1, table);
            }
        }

        LoadCombos();
        string js2 = "SetWorkCategID(" + Work_Categ_ID.ToString() + ";" + "1);";

        ScriptManager.RegisterStartupScript(this, this.GetType(), "jsMsg", js2, true);
        BindApprovar(Work_Categ_ID);
        string js0 = "alert('Approver Added Successfully and Approval has been configured to office user');";

        ScriptManager.RegisterStartupScript(this, this.GetType(), "jsMsg", js0, true);

        string js1 = "hideModal('dvAppLevelUser');";

        ScriptManager.RegisterStartupScript(this, this.GetType(), "jsApprrovar", js1, true);


        // BindApprovar(Work_Categ_ID);
    }
    protected bool SelectRank(string Rank)
    {
        int Work_Categ_ID = UDFLib.ConvertToInteger(hfWC.Value.ToString());

        DataSet ds = BLL_JRA_Hazards.Get_ApprovarByLevel(Work_Categ_ID, 0);

        if (ds.Tables.Count > 0)
        {
            if (ds.Tables[0].Select("Approvar_Detail_ID='" + Rank + "'").Length > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        else
        {
            return(false);
        }
    }
    protected bool SelectCheckbox(string UserID)
    {
        int     Work_Categ_ID = UDFLib.ConvertToInteger(hfWC.Value.ToString());
        int     ApprovalLevel = UDFLib.ConvertToInteger(ViewState["ApprovalLevel"].ToString());
        DataSet ds            = BLL_JRA_Hazards.Get_ApprovarByLevel(Work_Categ_ID, ApprovalLevel);

        if (ds.Tables.Count > 0)
        {
            if (ds.Tables[0].Select("Approvar_Detail_ID='" + UserID + "'").Length > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        else
        {
            return(false);
        }
    }