Ejemplo n.º 1
0
        public ApprovalEngine.ApprovalProcessResults Process()
        {
            MailboxSession session = (MailboxSession)this.messageItem.Session;
            string         text;
            string         approvalRequestMessageId;

            if (!this.TryGetInitiationAndApprovalRequestMessageId(out text, out approvalRequestMessageId))
            {
                NdrOofHandler.diag.TraceDebug((long)this.GetHashCode(), "Ignoring NDR/OOF. Cannot get initiation/approval request message id's");
                return(ApprovalEngine.ApprovalProcessResults.NdrOofInvalid);
            }
            long          num;
            StoreObjectId storeObjectId = NdrOofHandler.FindInitiationMessage(session, text, approvalRequestMessageId, out num);

            NdrOofHandler.diag.TraceDebug <long>((long)this.GetHashCode(), "Time searching for initiation = {0} ms", num);
            if (storeObjectId == null)
            {
                NdrOofHandler.diag.TraceDebug <string>((long)this.GetHashCode(), "Initiation message not found, ignoring NDR/OOF, messageId={0}", text);
                return(new ApprovalEngine.ApprovalProcessResults(ApprovalEngine.ProcessResult.InitiationNotFoundForNdrOrOof, num));
            }
            if (!this.WriteToInitiationMessage(session, storeObjectId, text))
            {
                NdrOofHandler.diag.TraceDebug <string>((long)this.GetHashCode(), "Initiation message cannot be updated with NDR/OOF, messageId={0}", text);
                return(new ApprovalEngine.ApprovalProcessResults(ApprovalEngine.ProcessResult.NdrOrOofUpdateSkipped, num));
            }
            return(new ApprovalEngine.ApprovalProcessResults(ApprovalEngine.ProcessResult.NdrOrOofUpdated, num));
        }