コード例 #1
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            Boolean                     Logging        = EnableLogging.Get(executionContext);
            EntityReference             Letter         = LetterId.Get(executionContext);
            EntityReference             Attachment     = AttachmentId.Get(executionContext);
            IWorkflowContext            context        = executionContext.GetExtension <IWorkflowContext>();
            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>();
            IOrganizationService        service        = serviceFactory.CreateOrganizationService(context.UserId);

            try
            {
                if (Logging)
                {
                    Log("Workflow Execution Start", service);
                }
                if (Logging)
                {
                    Log("Retrieving Attahment", service);
                }
                Entity TempAttachment = service.Retrieve("annotation", Attachment.Id, new ColumnSet(true));
                if (TempAttachment != null)
                {
                    if (Logging)
                    {
                        Log("Creating New Attachment", service);
                    }
                    Entity NewAttachment = new Entity("annotation");
                    if (TempAttachment.Contains("subject"))
                    {
                        NewAttachment.Attributes.Add("subject", TempAttachment["subject"]);
                    }
                    if (TempAttachment.Contains("filename"))
                    {
                        NewAttachment.Attributes.Add("filename", TempAttachment["filename"]);
                    }
                    if (TempAttachment.Contains("notetext"))
                    {
                        NewAttachment.Attributes.Add("notetext", TempAttachment["notetext"]);
                    }
                    if (TempAttachment.Contains("mimetype"))
                    {
                        NewAttachment.Attributes.Add("mimetype", TempAttachment["mimetype"]);
                    }
                    if (TempAttachment.Contains("documentbody"))
                    {
                        NewAttachment.Attributes.Add("documentbody", TempAttachment["documentbody"]);
                    }
                    NewAttachment.Attributes.Add("objectid", new EntityReference(Letter.LogicalName, Letter.Id));
                    service.Create(NewAttachment);
                    if (Logging)
                    {
                        Log("New Attachment Added To Letter", service);
                    }
                }
                else
                {
                    if (Logging)
                    {
                        Log("Temp Attachment doesnot exist", service);
                    }
                }
                if (Logging)
                {
                    Log("Workflow Executed Successfully", service);
                }
            }
            catch (Exception ex)
            {
                Log(ex.Message, service);
                throw ex;
            }
        }
コード例 #2
0
 public AlphabetLetter(LetterId id, RangeSet <T> ranges)
 {
     this.Id     = id;
     this.Ranges = ranges;
 }