Exemple #1
0
        private void _F_RemoveClassInfo(ClassInfoViewModel classInfo)
        {
            var list = (from item in _EFDataContext.relations where item.ClassId == classInfo.ID select item).ToList();

            //删除与班级对应的学生-班级关系记录
            foreach (var relation in list)
            {
                _RelationShipDal.Remove(relation);
            }
            _ClassInfoDal.Remove(classInfo.ClassInfo);
            _RelationShipDal.Save();
            ClassList.Remove(classInfo);
            //RefreshData();
        }
Exemple #2
0
        private void _F_ModifyClassInfo(ClassInfoViewModel classInfo)
        {
            var cInstatnce = ServiceLocator.Current.GetInstance <ClassModifyViewModel>();

            cInstatnce.OriginalClass = classInfo.ClassInfo;
            cInstatnce.SelectModel   = false;
            cInstatnce.GradeEditable = false;
            cInstatnce.Title         = "修改班级信息";
            ClassInfoWindow ciw = new ClassInfoWindow();

            ciw.ShowDialog();
            if (ciw.DialogResult == true)
            {
                _ClassInfoDal.Update(cInstatnce.OriginalClass);
                _ClassInfoDal.Save();
                classInfo.Update(cInstatnce.OriginalClass);
                //ClassList.OrderBy(a => a.Grade).ThenBy(b => b.Name);
            }
            var tStudent = StudentList.Where(s => s.ClassInfo.ID == cInstatnce.OriginalClass.ID).FirstOrDefault();

            tStudent?.UpdateClassInfo();
        }