示例#1
0
        private void OnTraineeChanged(OperationType operation, TraineeModel trainee)
        {
            switch (operation)
            {
            case OperationType.Add:
                if (trainee.IsNew)    //新建学员
                {
                    string traineeID;
                    _dal.Add(trainee, out traineeID);
                    trainee.TraineeID = traineeID;
                }
                _dal.AddTraineeForBlock(trainee.CurrentBlockID, trainee.TraineeID);
                OverdueChangedEvent?.Invoke();
                break;

            case OperationType.Update:
                _dal.UpdateForBlock(trainee, _currentClassID);
                if (trainee.CurrentBlockID != _currentClassID)
                {
                    operation = OperationType.Delete;
                }
                break;
            }
            TraineeChangedEvent?.Invoke(operation, trainee);
        }
 /// <summary>
 /// 学员信息已更改,更新界面,更新数据库
 /// </summary>
 /// <param name="operation"></param>
 /// <param name="trainee"></param>
 public void OnTraineeChanged(OperationType operation, TraineeModel trainee)
 {
     if (operation == OperationType.Update)
     {
         _dal.Update(trainee);
         if (trainee.RegularClassID != _currentClassID)
         {
             operation = OperationType.Delete;
         }
         OverdueChangedEvent?.Invoke();
     }
     else if (operation == OperationType.Add)
     {
         if (trainee.IsNew)
         {
             string traineeID;
             _dal.Add(trainee, out traineeID);
             trainee.TraineeID = traineeID;
         }
         else
         {
             _dal.AddTraineeForRegular(trainee.RegularClassID, trainee.TraineeID);
         }
         _trainees.Add(trainee);
         OverdueChangedEvent?.Invoke();
     }
     TraineeChangedEvent?.Invoke(operation, trainee);
 }
示例#3
0
        /// <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 void Add(NameCallingModel calling)
 {
     _dal.Add(calling);
     if (calling.ClassType == 0)
     {
         OverdueChangedEvent?.Invoke();
     }
 }
        public void Refresh()
        {
            Overdues.Clear();
            Overdues = _dal.GetList() ?? new List <OverdueModel>();
            Overdues.ForEach(o =>
            {
                o.ClassName = o.ClassType == 0 ?
                              _regular.RegularClassCollection.Where(c => c.ClassID == o.ClassID).First().ClassName :
                              _block.BlockClassCollection.Where(c => c.ClassID == o.ClassID).First().ClassName;
            });

            OverdueChangedEvent?.Invoke();
        }
        //public void GetTraineeNames()

        /// <summary>
        /// 界面请求对学员进行编辑
        /// </summary>
        /// <param name="operation"></param>
        /// <param name="trainee"></param>
        public void OperateTrainee(OperationType operation, TraineeModel trainee)
        {
            if (operation == OperationType.Delete || operation == OperationType.Reverse)
            {
                DeleteOrReverseTrainee(operation, trainee);
                OverdueChangedEvent?.Invoke();
                return;
            }
            if (operation == OperationType.Add)
            {
                if (string.IsNullOrEmpty(_currentClassID))
                {
                    return;
                }
                trainee = new TraineeModel();
                trainee.RegularClassID = _currentClassID;
            }

            TraineeOperation.Enable(operation, trainee);
        }
示例#7
0
 public void AddPayment(ClassPaymentModel model)
 {
     _dal.AddCountPayment(model);
     OverdueChangedEvent?.Invoke();
     GeneralCapitalChanged?.Invoke(null, EventArgs.Empty);
 }
 public void Update(NameCallingModel model)
 {
     _dal.Update(model);
     OverdueChangedEvent?.Invoke();
 }
 public void Del(string callingID)
 {
     _dal.Del(callingID);
     OverdueChangedEvent?.Invoke();
 }