/// <summary>
        /// Initializes a new instance of the <see cref="Trustee"/> class.
        /// </summary>
        /// <param name="client"><see cref="T:TcmCoreService.Client" /></param>
        /// <param name="trusteeData"><see cref="T:Tridion.ContentManager.CoreService.Client.TrusteeData" /></param>
        protected Trustee(Client client, TrusteeData trusteeData)
            : base(client, trusteeData)
        {
            if (trusteeData == null)
                throw new ArgumentNullException("trustreeData");

            mTrusteeData = trusteeData;
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Trustee"/> class.
        /// </summary>
        /// <param name="client"><see cref="T:TcmCoreService.Client" /></param>
        /// <param name="trusteeData"><see cref="T:Tridion.ContentManager.CoreService.Client.TrusteeData" /></param>
        protected Trustee(Client client, TrusteeData trusteeData) : base(client, trusteeData)
        {
            if (trusteeData == null)
            {
                throw new ArgumentNullException("trustreeData");
            }

            mTrusteeData = trusteeData;
        }
        protected override void Execute()
        {
            PublishInstructionData publishInstruction = new PublishInstructionData();

            publishInstruction.ResolveInstruction = new ResolveInstructionData();
            publishInstruction.RenderInstruction  = new RenderInstructionData();

            //Needed for publishing workflow revision/version
            publishInstruction.ResolveInstruction.IncludeWorkflow = true;
            TrusteeData          lastPerformer    = GetFirstManualActivityPerformer();
            ActivityInstanceData activityInstance = ActivityInstance;

            Logger.Write(string.Format("lastPerformer: {0}", lastPerformer.Title), "Workflow", LoggingCategory.General, TraceEventType.Information);

            if (Utility.IsMailSendOptionTrue(activityInstance.Title))
            {
                Logger.Write(string.Format("Mail Send Option: {0}", "True"), "Workflow", LoggingCategory.General, TraceEventType.Information);

                try
                {
                    SmtpClient  client = Utility.SMTPClientConfiguration();
                    MailMessage mail   = Utility.WorkflowMailMessageConfiguration(ActivityInstance.Title.ToString(), null, lastPerformer.Title);
                    client.Send(mail);
                    Logger.Write(string.Format("Mail : {0}", mail.Body.ToString()), "Workflow", LoggingCategory.General, TraceEventType.Information);
                    Logger.Write(string.Format("ActivityInstance.Title : {0}", "Mail Sent"), "Workflow", LoggingCategory.General, TraceEventType.Information);
                }
                catch (Exception ex)
                {
                    Logger.Write(string.Format("ActivityInstance.Title : {0}", ex.Message.ToString()), "Workflow", LoggingCategory.General, TraceEventType.Information);
                }
            }

            if (Utility.IsPublishedToPreviewTrue())
            {
                // Retrieving the Publication Target and Publish Transaction
                if (ProcessInstance.Variables.ContainsKey("PublishTransaction"))
                {
                    string publishTransactionId = ProcessInstance.Variables["PublishTransaction"];
                    // Undo Publish Transaction
                    CoreServiceClient.UndoPublishTransaction(publishTransactionId, QueueMessagePriority.Normal, null);
                }
            }


            // Finish the Activity
            ActivityFinishData finishData = new ActivityFinishData()
            {
                Message      = "The Item " + activityInstance.WorkItems.FirstOrDefault().ToString() + " has been rejected and reassigned to " + lastPerformer.Title,
                NextAssignee = new LinkToTrusteeData()
                {
                    IdRef = lastPerformer.Id
                }
            };

            CoreServiceClient.FinishActivity(activityInstance.Id, finishData, null);
        }
Exemple #4
0
        /// <summary>
        /// Reload the <see cref="Trustee" /> with the specified <see cref="T:Tridion.ContentManager.CoreService.Client.TrusteeData" />
        /// </summary>
        /// <param name="categoryData"><see cref="T:Tridion.ContentManager.CoreService.Client.TrusteeData" /></param>
        protected void Reload(TrusteeData trustreeData)
        {
            if (trustreeData == null)
            {
                throw new ArgumentNullException("trustreeData");
            }

            mTrusteeData = trustreeData;
            base.Reload(trustreeData);
        }
        /// <summary>
        /// Reload the <see cref="Trustee" /> with the specified <see cref="T:Tridion.ContentManager.CoreService.Client.TrusteeData" />
        /// </summary>
        /// <param name="categoryData"><see cref="T:Tridion.ContentManager.CoreService.Client.TrusteeData" /></param>
        protected void Reload(TrusteeData trustreeData)
        {
            if (trustreeData == null)
                throw new ArgumentNullException("trustreeData");

            mTrusteeData = trustreeData;
            base.Reload(trustreeData);
        }