/// <summary>
        /// This method returns all students currently members of the group currently displayed
        /// </summary>
        /// <returns>A list of all students currently members of the group currently displayed</returns>
        private IEnumerable<IMAvailableStudent> LoadSelectedStudentsForIM()
        {


            var selectedStudents = new IMAssignment().GetSelectedStudentsForIM(SessionObject.LoggedInUser.Page, GroupId, ClassId, DocumentNodeID);

            //var selectedStudents =
            //    _groupProxy.GetStudentsInGroup(GroupId, DistrictParms.LoadDistrictParms().ClientID);

            return selectedStudents;
        }
 protected void btnSaveClient_Click(object sender, EventArgs e)
 {
     List<IMAvailableStudent> availablelist = (List<IMAvailableStudent>)ViewState["availableStudents"];
     List<IMAvailableStudent> selectedlist = (List<IMAvailableStudent>)ViewState["selectedStudents"];
     IMAssignment obj = new IMAssignment();
     obj.SaveStudentForIM(SessionObject.LoggedInUser.Page, _imNodeList[0].NodeId, GetStudentAssignmentandDueDate(selectedlist));
     ViewState["isSaved"] = true;            
     ViewState["selectedStudents"] = null;
     ViewState["availableStudents"] = null;
     RefreshDataBindingForGroupingGrids();
     isCompleted.Value = "";
     ScriptManager.RegisterStartupScript(this, typeof(string), "assignmentSaved", "confirmCallbackCloseClient(); ", true);              
     isCompleted.Value = "";
 }
        /// <summary>
        /// This method loads all students the the current user has visibility too AND that are not already 
        /// enrolled in the current group.
        /// </summary>
        /// <returns>A list of students who are eligable to be added to this group</returns>
        public IEnumerable<IMAvailableStudent> LoadStudentsAvailableForIM()
        {
            var availableStudents = new List<IMAvailableStudent>();
            var studentSearchCriteria = new IMStudentSearchCriteria();
            var IM = new IMAssignment();
            var criteriaController = GetCriteriaControllerFromMasterPage();

            if (criteriaController != null)
            {
                studentSearchCriteria = GetStudentCriteriaFromController(criteriaController);
            }


            switch (SessionObject.CurrentPortal)
            {
                case EntityTypes.District:
                    availableStudents = IM.GetAvaiableStudentsForIM(GroupId,
                     SessionObject.LoggedInUser.Page, studentSearchCriteria,
                      DistrictParms.LoadDistrictParms().ClientID, ClassId, DocumentNodeID);
                    break;
                case EntityTypes.School:
                    if (studentSearchCriteria.School == 0)
                    {
                        studentSearchCriteria.School = SessionObject.LoggedInUser.School;
                    }

                    availableStudents = IM.GetAvaiableStudentsForIM(GroupId,
                     SessionObject.LoggedInUser.Page, studentSearchCriteria,
                      DistrictParms.LoadDistrictParms().ClientID, ClassId, DocumentNodeID);
                    break;
                case EntityTypes.Teacher:

                    availableStudents = IM.GetAvaiableStudentsForIM(GroupId,
                      SessionObject.LoggedInUser.Page, studentSearchCriteria,
                      DistrictParms.LoadDistrictParms().ClientID, ClassId, DocumentNodeID);
                    break;
            }



            return availableStudents;
        }