Exemple #1
0
        public Employee GetEmployeeReimbursingByEmployeeID(int id)
        {
            Employee employee = _DalReimburse.GetEmployeeReimburseByEmployeeID(id);

            //for (int i = 0; i < employee.Reimburses.Count; i++)
            //{
            //    if (employee.Reimburses[i].ReimburseStatus == ReimburseStatusEnum.Interrupt || employee.Reimburses[i].ReimburseStatus == ReimburseStatusEnum.Reimbursed || employee.Reimburses[i].ReimburseStatus == ReimburseStatusEnum.Cancel)
            //    {
            //        employee.Reimburses.RemoveAt(i);
            //        i--;
            //    }
            //}
            return(employee);
        }
 protected override void Validation()
 {
     //验证报销单已存在,报销单已进入报销流程不可修改或删除
     _EmployeeReimburse = _DalReimburse.GetEmployeeReimburseByEmployeeID(_EmployeeID);
     HRMISModel.Reimburse reimburseOld = _EmployeeReimburse.FindReimburseByReimburseID(_ReimburseID);
     if (reimburseOld == null)
     {
         BllUtility.ThrowException(BllExceptionConst._Reimburse_Not_Exist);
     }
     else if (reimburseOld.ReimburseStatus != ReimburseStatusEnum.Added && reimburseOld.ReimburseStatus != ReimburseStatusEnum.Return)
     {
         BllUtility.ThrowException(BllExceptionConst._Reimburse_Not_Update_Or_Delete);
     }
 }
Exemple #3
0
        protected override void ExcuteSelf()
        {
            try
            {
                _EmployeeReimburse = _DalReimburse.GetEmployeeReimburseByEmployeeID(_EmployeeID);
                if (_EmployeeReimburse.Reimburses == null)
                {
                    BllUtility.ThrowException(BllExceptionConst._Reimburse_Not_Exist);
                }

                for (int i = 0; i < _ReimburseID.Count; i++)
                {
                    HRMISModel.Reimburse reimburseToUpdate = _EmployeeReimburse.FindReimburseByReimburseID(_ReimburseID[i].ReimburseID);
                    if (!ValidationEach(reimburseToUpdate))
                    {
                        continue;
                    }
                    _EmployeeReimburse.RemoveReimburseByReimburseID(_ReimburseID[i].ReimburseID);
                    if (reimburseToUpdate.ReimburseFlows == null)
                    {
                        reimburseToUpdate.ReimburseFlows = new List <ReimburseFlow>();
                    }
                    reimburseToUpdate.ReimburseFlows.Add(
                        new ReimburseFlow(_Operator, DateTime.Now, ReimburseStatusEnum.Reimbursed));
                    reimburseToUpdate.ReimburseStatus = ReimburseStatusEnum.Reimbursed;
                    _EmployeeReimburse.Reimburses.Add(reimburseToUpdate);
                }
                if (FailCount < _ReimburseID.Count)
                {
                    using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
                    {
                        _DalReimburse.UpdateEmployeeReimburse(_EmployeeReimburse);
                        ts.Complete();
                    }
                }
            }
            catch
            {
                BllUtility.ThrowException(BllExceptionConst._DbError);
            }
        }
 protected override void Validation()
 {
     _EmployeeReimburse = _DalReimburse.GetEmployeeReimburseByEmployeeID(_EmployeeID);
     reimburse          = _EmployeeReimburse.FindReimburseByReimburseID(_ReimburseID);
     if (reimburse == null)
     {
         BllUtility.ThrowException(BllExceptionConst._Reimburse_Not_Exist);
     }
     if (reimburse.ReimburseStatus == ReimburseStatusEnum.Return)
     {
         BllUtility.ThrowException(BllExceptionConst._Reimburse_Has_Interruptted);
     }
     if (reimburse.ReimburseStatus == ReimburseStatusEnum.Reimbursed)
     {
         BllUtility.ThrowException(BllExceptionConst._Reimburse_Has_Reimbursed);
     }
     if (reimburse.ReimburseStatus == ReimburseStatusEnum.Added)
     {
         BllUtility.ThrowException(BllExceptionConst._Reimburse_Has_Added);
     }
 }