protected void GridView_Selected_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int RankID        = UDFLib.ConvertToInteger(GridView_Selected.DataKeys[e.RowIndex].Value.ToString());
        int Evaluation_ID = UDFLib.ConvertToInteger(ddlEvaluations.SelectedValue);

        if (RankID > 0)
        {
            foreach (ListItem liMon in lstSelectedMonth.Items)
            {
                BLL_Crew_Evaluation.UPDATE_EvaluationMonths(Evaluation_ID, RankID, UDFLib.ConvertToInteger(liMon.Value), 0, GetSessionUserID());
            }
            foreach (ListItem liRule in lstSelectedRules.Items)
            {
                BLL_Crew_Evaluation.UPDATE_EvaluationRules(Evaluation_ID, RankID, UDFLib.ConvertToInteger(liRule.Value), 0, GetSessionUserID());
            }

            string js = "alert('Evaluation Planned Updated');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert2", js, true);


            Bind_Evaluation_Ranks(Evaluation_ID);

            if (GridView_Selected.Rows.Count > 0)
            {
                GridView_Selected.SelectedIndex = 1;
                RankID = UDFLib.ConvertToInteger(GridView_Selected.SelectedValue);
                Load_MonthsAndRules_ForRank(RankID);
            }
        }
    }
    private int Update_Evaluation_Planning()
    {
        int Evaluation_ID = UDFLib.ConvertToInteger(ddlEvaluations.SelectedValue);
        int RankID        = (GridView_NotSelected.SelectedIndex >= 0) ? UDFLib.ConvertToInteger(GridView_NotSelected.SelectedValue) : UDFLib.ConvertToInteger(GridView_Selected.SelectedValue);

        int SelectedMonthCount = 0;
        int SelectedRulesCount = 0;
        int ReturnValue        = 0;

        if (RankID > 0)
        {
            foreach (ListItem liMon in lstSelectedMonth.Items)
            {
                if (liMon.Selected == true)
                {
                    BLL_Crew_Evaluation.UPDATE_EvaluationMonths(Evaluation_ID, RankID, UDFLib.ConvertToInteger(liMon.Value), 1, GetSessionUserID());
                    SelectedMonthCount++;
                }
                else
                {
                    BLL_Crew_Evaluation.UPDATE_EvaluationMonths(Evaluation_ID, RankID, UDFLib.ConvertToInteger(liMon.Value), 0, GetSessionUserID());
                }
            }
            foreach (ListItem liRule in lstSelectedRules.Items)
            {
                if (liRule.Selected == true)
                {
                    BLL_Crew_Evaluation.UPDATE_EvaluationRules(Evaluation_ID, RankID, UDFLib.ConvertToInteger(liRule.Value), 1, GetSessionUserID());
                    SelectedRulesCount++;
                }
                else
                {
                    BLL_Crew_Evaluation.UPDATE_EvaluationRules(Evaluation_ID, RankID, UDFLib.ConvertToInteger(liRule.Value), 0, GetSessionUserID());
                }
            }

            if (SelectedMonthCount > 0 || SelectedRulesCount > 0)
            {
                ReturnValue = 1;
            }
            else
            {
                string js2 = "alert('Please select applicable month or rule.');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert2", js2, true);
            }
        }
        else
        {
            string js3 = "alert('Please select rank.');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert3", js3, true);
        }

        return(ReturnValue);
    }