Esempio n. 1
0
    protected void GridView_AssignedCriteria_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int SelectedRowIndex = 0;
        int IQID             = 0;
        int QID    = 0;
        int RankID = 0;

        if (e.CommandName == "MoveUp")
        {
            GridViewRow r = (GridViewRow)((ImageButton)e.CommandSource).Parent.Parent;
            SelectedRowIndex = r.RowIndex;
            IQID             = UDFLib.ConvertToInteger(Request.QueryString["IQID"].ToString());
            QID    = UDFLib.ConvertToInteger(GridView_AssignedCriteria.DataKeys[SelectedRowIndex].Values[0].ToString());
            RankID = UDFLib.ConvertToInteger(GridView_AssignedCriteria.DataKeys[SelectedRowIndex].Values[1].ToString());

            BLL_Crew_Interview.Swap_InterviewQuestion_Sort_Order(IQID, RankID, QID, 1, GetSessionUserID());
            if (SelectedRowIndex >= 1)
            {
                SelectedRowIndex -= 1;
            }
            Bind_AssignedCriteria();
            GridView_AssignedCriteria.SelectedIndex = SelectedRowIndex;
        }
        else if (e.CommandName == "MoveDown")
        {
            GridViewRow r = (GridViewRow)((ImageButton)e.CommandSource).Parent.Parent;
            SelectedRowIndex = r.RowIndex;
            IQID             = UDFLib.ConvertToInteger(Request.QueryString["IQID"].ToString());
            QID    = UDFLib.ConvertToInteger(GridView_AssignedCriteria.DataKeys[SelectedRowIndex].Values[0].ToString());
            RankID = UDFLib.ConvertToInteger(GridView_AssignedCriteria.DataKeys[SelectedRowIndex].Values[1].ToString());

            BLL_Crew_Interview.Swap_InterviewQuestion_Sort_Order(IQID, RankID, QID, -1, GetSessionUserID());
            if (SelectedRowIndex < GridView_AssignedCriteria.Rows.Count - 1)
            {
                SelectedRowIndex += 1;
            }
            Bind_AssignedCriteria();
            GridView_AssignedCriteria.SelectedIndex = SelectedRowIndex;
        }
        else if (e.CommandName == "RemoveCriteria")
        {
            GridViewRow r = (GridViewRow)((ImageButton)e.CommandSource).Parent.Parent;
            SelectedRowIndex = r.RowIndex;
            IQID             = UDFLib.ConvertToInteger(Request.QueryString["IQID"].ToString());
            QID    = UDFLib.ConvertToInteger(GridView_AssignedCriteria.DataKeys[SelectedRowIndex].Values[0].ToString());
            RankID = UDFLib.ConvertToInteger(GridView_AssignedCriteria.DataKeys[SelectedRowIndex].Values[1].ToString());

            BLL_Crew_Interview.Remove_QuestionFromInterview(QID, IQID, RankID, GetSessionUserID());
            Bind_UnAssignedCriteria();
            Bind_AssignedCriteria();
            GridView_AssignedCriteria.SelectedIndex = SelectedRowIndex;
        }
    }