/// <summary> /// 增加/修改班级信息 /// </summary> /// <param name="operation"></param> /// <param name="model"></param> public void OperateClassInfo(OperationType operation, RegularClassModel model) { string classID; int classSerial; int newIndex = 0; switch (operation) { case OperationType.Add: _dal.Add(model, out classID, out classSerial); model.ClassID = classID; model.ClassSerial = classSerial; RegularClassCollection.Add(model); break; case OperationType.Update: _dal.Update(model, out classSerial); model.ClassSerial = classSerial; RegularClassCollection[RegularClassCollection.IndexOf(RegularClassCollection.Where(c => c.ClassID == model.ClassID).First())] = model; OverdueChangedEvent?.Invoke(); break; } RegularClassCollection.Sort(); newIndex = RegularClassCollection.IndexOf(model); RegularClassChangedEvent?.Invoke(operation, model, newIndex); }
public PresenceBussiness(TraineeManagementBussiness trainees, RegularClassManagement regular, RegularTraineeBussiness regularTrainees, OverdueManagementBussiness overdue, NameCallingBussiness calling) { _regular = regular; _trainees = trainees; _overdue = overdue; _calling = calling; _regularTrainees = regularTrainees; _regular.RegularClassChangedEvent += (op, model, index) => RegularClassChangedEvent?.Invoke(); _regularTrainees.LoadTraineesEvent += traineeCollection => { _currentTrainees = traineeCollection; TraineeChangedEvent?.Invoke(_currentTrainees); }; }