コード例 #1
0
        private void _F_AddClassInfo()
        {
            var cInstatnce = ServiceLocator.Current.GetInstance <ClassModifyViewModel>();

            cInstatnce.OriginalClass = new ClassInfo();
            cInstatnce.SelectModel   = false;
            cInstatnce.GradeEditable = true;
            cInstatnce.Title         = "添加班级信息";
            ClassInfoWindow ciw = new ClassInfoWindow();

            ciw.ShowDialog();
            if (ciw.DialogResult == true)
            {
                var c = cInstatnce.OriginalClass;
                _ClassInfoDal.Insert(c);
                _ClassInfoDal.Save();
                ClassList.Add(new ClassInfoViewModel(c));
                //ClassList.OrderBy(a => a.Grade).ThenBy(b=>b.Name);
            }
        }
コード例 #2
0
        private void _F_SendToClass(object students)
        {
            var list = ((System.Collections.IList)students)?.Cast <StudentInfoViewModel>();

            if (list == null || list.Count() == 0)
            {
                return;
            }

            var cInstatnce = ServiceLocator.Current.GetInstance <ClassModifyViewModel>();

            cInstatnce.OriginalClass = _EFDataContext.classes.Local.FirstOrDefault();
            if (cInstatnce.OriginalClass == null)
            {
                //候选班级列表为空
                return;
            }
            cInstatnce.SelectModel = true;
            cInstatnce.Title       = "批量移动学生到指定班级";
            ClassInfoWindow ciw = new ClassInfoWindow();

            ciw.ShowDialog();
            if (ciw.DialogResult == true)
            {
                var c = cInstatnce.OriginalClass;
                foreach (var item in list)
                {
                    _RelationShipDal.Update(new Student_Class_Relation()
                    {
                        StudentId = item.ID, ClassId = c.ID
                    }, true);
                }
                _RelationShipDal.Save();

                foreach (var item in list)
                {
                    item.UpdateClassInfo();
                }
            }
        }
コード例 #3
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();
        }