protected override void ExcuteSelf()
 {
     try
     {
         using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
         {
             _OverWorkDal.DeleteOverWorkByPKID(_ApplicationID);
             _OverWorkDal.DeleteOverWorkItemByOverWorkID(_ApplicationID);
             ts.Complete();
         }
     }
     catch
     {
         HrmisUtility.ThrowException(HrmisUtility._DbError);
     }
 }
Exemple #2
0
        protected override void ExcuteSelf()
        {
            int currentID = _OverWork.PKID;

            try
            {
                using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    if (_OldOverWork.IfAutoCancel)
                    {
                        AutoCancelOverWork();
                    }
                    _OverWorkDal.UpdateOverWork(_OverWork);
                    _OverWorkDal.DeleteOverWorkItemByOverWorkID(currentID);
                    if (_OverWork.Item != null)
                    {
                        foreach (OverWorkItem item in _OverWork.Item)
                        {
                            item.AdjustHour =
                                new UpdateAdjustRestByOverWork(item, _OverWork.Account.Id).GetItemAdjustHour();
                            int itemid = _OverWorkDal.InsertOverWorkItem(currentID, item);
                            if (item.Status == RequestStatus.Submit)
                            {
                                OverWorkFlow flow =
                                    new OverWorkFlow(0, _OverWork.Account, _OverWork.SubmitDate, _OverWork.Reason,
                                                     item.Status, 1);
                                _OverWorkDal.InsertOverWorkFlow(itemid, flow);
                            }
                        }
                    }
                    ts.Complete();
                }
            }
            catch
            {
                HrmisUtility.ThrowException(HrmisUtility._DbError);
            }
            new OverWorkMailAndPhoneDelegate().SubmitOperation(_OverWork.PKID, _CCList);
        }