Exemple #1
0
    protected void lstParentRanks_SelectedIndexChanged(object sender, EventArgs e)
    {
        for (int i = 0; i < chkLstSelectRank.Items.Count; i++)
        {
            chkLstSelectRank.Items[i].Selected = false;
        }
        if (lstParentRanks.SelectedIndex > 0)
        {
            btnAssign.Enabled        = true;
            chkLstSelectRank.Enabled = true;
            chkVerifiersRank.Enabled = true;
        }
        else
        {
            btnAssign.Enabled        = false;
            chkLstSelectRank.Enabled = false;
            chkVerifiersRank.Enabled = false;
            return;
        }
        DataTable dt;

        if (rdbEval.Checked || rdbHandover.Checked)
        {
            if (rdbEval.Checked)
            {
                dt = BLL_Crew_Evaluation.Get_EvaluationRanks(UDFLib.ConvertToInteger(lstParentRanks.SelectedValue), "EVAL").Tables[0];
            }
            else
            {
                dt = BLL_Crew_Evaluation.Get_EvaluationRanks(UDFLib.ConvertToInteger(lstParentRanks.SelectedValue), "HAND").Tables[0];
            }
            for (int i = 1; i < chkLstSelectRank.Items.Count; i++)
            {
                DataRow[] drs = dt.Select("ChildRank = " + chkLstSelectRank.Items[i].Value);
                if (drs.Length > 0)
                {
                    chkLstSelectRank.Items[i].Selected = true;
                }
                else
                {
                    chkLstSelectRank.Items[i].Selected = false;
                }
            }
        }
        else
        {
            dt = BLL_Crew_Evaluation.Get_EvaluationRanks(UDFLib.ConvertToInteger(lstParentRanks.SelectedValue), "RESTS").Tables[0];
            for (int i = 1; i < chkLstSelectRank.Items.Count; i++)
            {
                DataRow[] drs = dt.Select("ChildRank = " + chkLstSelectRank.Items[i].Value);
                if (drs.Length > 0)
                {
                    chkLstSelectRank.Items[i].Selected = true;
                }
                else
                {
                    chkLstSelectRank.Items[i].Selected = false;
                }
            }

            DataTable dt1 = BLL_Crew_Evaluation.Get_EvaluationRanks(UDFLib.ConvertToInteger(lstParentRanks.SelectedValue), "RESTV").Tables[0];
            for (int i = 1; i < chkLstSelectRank.Items.Count; i++)
            {
                DataRow[] drs = dt1.Select("ChildRank = " + chkLstSelectRank.Items[i].Value);
                if (drs.Length > 0)
                {
                    chkVerifiersRank.Items[i].Selected = true;
                }
                else
                {
                    chkVerifiersRank.Items[i].Selected = false;
                }
            }
        }
        string js = "LoadAfterCheckBox();";

        ScriptManager.RegisterStartupScript(this, this.GetType(), "alert2", js, true);
    }