Пример #1
0
 protected void AddStudent_Click(object sender, EventArgs e)
 {
     if (!StudentSelector.SelectedValue.Equals(String.Empty) && !GroupIds.Contains(Convert.ToInt32(StudentSelector.SelectedValue)))
     {
         StudentListField.Value += (StudentListField.Value.Length > 0 ? "," : "") + StudentSelector.SelectedValue;
     }
     LoadTable();
     StudentSelector.ClearSelection();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         using (WebhostEntities db = new WebhostEntities())
         {
             StudentSelector.DataSource     = StudentListItem.GetDataSource(db.Students.Where(s => s.isActive).OrderBy(s => s.LastName).ThenBy(s => s.FirstName).Select(s => s.ID).ToList());
             StudentSelector.DataTextField  = "Text";
             StudentSelector.DataValueField = "ID";
             StudentSelector.DataBind();
         }
     }
 }
Пример #3
0
        public List <Student> GetStudents(StudentSelector selector)
        {
            var listStudent = new List <Student>();

            foreach (var student in listStudent)
            {
                if (selector(student))
                {
                    listStudent.Add(student);
                }
            }

            return(listStudent);
        }
Пример #4
0
        protected void DormSelector_SelectedIndexChanged(object sender, EventArgs e)
        {
            using (WebhostEntities db = new WebhostEntities())
            {
                Dorm dorm = db.Dorms.Where(d => d.id == DormId).Single();
                DormHeadSelector.ClearSelection();
                DormHeadSelector.SelectedValue = Convert.ToString(dorm.DormHeadId);

                DormParentSelector.Clear();
                DormParentSelector.AddFaculty(dorm.DormParents.Select(f => f.ID).ToList());

                StudentSelector.Clear();
                StudentSelector.AddStudent(dorm.Students.Select(s => s.ID).ToList());
            }
        }
Пример #5
0
        protected void Page_Init(object sender, EventArgs e)
        {
            using (WebhostEntities db = new WebhostEntities())
            {
                StudentSelector.DataSource     = StudentListItem.GetDataSource(db.Students.Where(s => s.isActive).Select(s => s.ID).ToList());
                StudentSelector.DataTextField  = "Text";
                StudentSelector.DataValueField = "ID";
                StudentSelector.DataBind();

                RemoveList.DataSource     = StudentListItem.GetDataSource(GroupIds);
                RemoveList.DataTextField  = "Text";
                RemoveList.DataValueField = "ID";
                RemoveList.DataBind();
            }
        }