예제 #1
0
 /// <summary>
 /// Process actual document - do not call directly.
 /// Calls the individual actions which call the document action
 /// </summary>
 /// <param name="action">document action</param>
 /// <returns>true if performed</returns>
 public bool ProcessIt(String action)
 {
     _message = null;
     _action  = action;
     //
     if (ACTION_UNLOCK.Equals(_action))
     {
         return(UnlockIt());
     }
     if (ACTION_INVALIDATE.Equals(_action))
     {
         return(InvalidateIt());
     }
     if (ACTION_PREPARE.Equals(_action))
     {
         return(STATUS_INPROGRESS.Equals(PrepareIt()));
     }
     if (ACTION_APPROVE.Equals(_action))
     {
         return(ApproveIt());
     }
     if (ACTION_REJECT.Equals(_action))
     {
         return(RejectIt());
     }
     if (ACTION_COMPLETE.Equals(_action) || ACTION_WAITCOMPLETE.Equals(_action))
     {
         String status = null;
         if (IsDrafted() || IsInvalid())         //	prepare if not prepared yet
         {
             status = PrepareIt();
             if (!STATUS_INPROGRESS.Equals(status))
             {
                 return(false);
             }
         }
         status = CompleteIt();
         if (_document != null &&
             !Ini.IsClient())            //	Post Immediate if on Server
         {
             MClient client = MClient.Get(_document.GetCtx(), _document.GetAD_Client_ID());
             if (STATUS_COMPLETED.Equals(status) && client.IsPostImmediate())
             {
                 _document.Save();
                 PostIt();
             }
         }
         return(STATUS_COMPLETED.Equals(status) ||
                STATUS_INPROGRESS.Equals(status) ||
                STATUS_WAITINGPAYMENT.Equals(status) ||
                STATUS_WAITINGCONFIRMATION.Equals(status));
     }
     if (ACTION_REACTIVATE.Equals(_action))
     {
         return(ReActivateIt());
     }
     if (ACTION_REVERSE_ACCRUAL.Equals(_action))
     {
         return(ReverseAccrualIt());
     }
     if (ACTION_REVERSE_CORRECT.Equals(_action))
     {
         return(ReverseCorrectIt());
     }
     if (ACTION_CLOSE.Equals(_action))
     {
         return(CloseIt());
     }
     if (ACTION_VOID.Equals(_action))
     {
         return(VoidIt());
     }
     if (ACTION_POST.Equals(_action))
     {
         return(PostIt());
     }
     //
     return(false);
 }
예제 #2
0
 /// <summary>
 /// Document is completed
 /// </summary>
 /// <returns>return true if completed</returns>
 public bool IsCompleted()
 {
     return(STATUS_COMPLETED.Equals(_status));
 }