Exemplo n.º 1
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            LocalWorkflowContext    localWorkflowContext   = new LocalWorkflowContext(executionContext);
            IConfigurationRetrieval configurationRetrieval = new ConfigurationRetrieval();

            requestLogging = new RequestLogging(configurationRetrieval, localWorkflowContext);
            ITracingService             tracer         = executionContext.GetExtension <ITracingService>();
            IWorkflowContext            context        = executionContext.GetExtension <IWorkflowContext>();
            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>();
            IOrganizationService        service        = serviceFactory.CreateOrganizationService(context.UserId);

            try
            {
                tracer.Trace("Gettting Service Request Id from execution context " + DateTime.Now.ToString());
                var serviceRequestId = ServiceRequestId.Get <EntityReference>(executionContext);
                tracer.Trace("Retrieve Active Work Order ID using Service Request Id " + DateTime.Now.ToString());
                var workOrder = GetWorkOrderByServiceActivity(service, serviceRequestId);
                tracer.Trace("Retrieved Active Work Order ID  " + DateTime.Now.ToString());
                if (workOrder != null)
                {
                    WorkOrderId.Set(executionContext, workOrder.ToEntityReference());
                    IsExists.Set(executionContext, true);
                }
                else
                {
                    WorkOrderId.Set(executionContext, null);
                    IsExists.Set(executionContext, false);
                }
                ////requestLogging.LogWorkflowTrace(MappingConstants.GetWORelatedToSRSequenceId, MappingConstants.GetWORelatedToSRSuccessEventId, MappingConstants.GetWORelatedToSREventName, MappingConstants.GetWORelatedToSRSuccessEventMessage);
            }
            catch (FaultException <OrganizationServiceFault> e)
            {
                ////requestLogging.LogWorkflowException(e, MappingConstants.GetWORelatedToSRSequenceId, MappingConstants.GetWORelatedToSRFailedEventId, MappingConstants.GetWORelatedToSREventName, MappingConstants.GetWORelatedToSRFailedEventMessage);
                tracer.Trace("GetWorkOrderRelatedServiceRequest Code Activity : {0}", e.ToString());
                throw new InvalidPluginExecutionException("An error occurred in GetWorkOrderRelatedServiceRequest Code Activity." + e.Message);
            }
            catch (Exception ex)
            {
                ////requestLogging.LogWorkflowException(ex, MappingConstants.GetWORelatedToSRSequenceId, MappingConstants.GetWORelatedToSRFailedEventId, MappingConstants.GetWORelatedToSREventName, MappingConstants.GetWORelatedToSRFailedEventMessage);
                tracer.Trace("GetWorkOrderRelatedServiceRequest Code Activity : {0}", ex.ToString());
                throw;
            }
        }
Exemplo n.º 2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + (ActualCost == null ? 0 : ActualCost.GetHashCode());
         hash = hash * 23 + (ActualEndDate == null ? 0 : ActualEndDate.GetHashCode());
         hash = hash * 23 + (ActualResourceHrs == null ? 0 : ActualResourceHrs.GetHashCode());
         hash = hash * 23 + (ActualStartDate == null ? 0 : ActualStartDate.GetHashCode());
         hash = hash * 23 + (LocationId == default(short) ? 0 : LocationId.GetHashCode());
         hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode());
         hash = hash * 23 + (OperationSequence == default(short) ? 0 : OperationSequence.GetHashCode());
         hash = hash * 23 + (PlannedCost == default(decimal) ? 0 : PlannedCost.GetHashCode());
         hash = hash * 23 + (ProductId == default(int) ? 0 : ProductId.GetHashCode());
         hash = hash * 23 + (ScheduledEndDate == default(DateTime) ? 0 : ScheduledEndDate.GetHashCode());
         hash = hash * 23 + (ScheduledStartDate == default(DateTime) ? 0 : ScheduledStartDate.GetHashCode());
         hash = hash * 23 + (WorkOrderId == default(int) ? 0 : WorkOrderId.GetHashCode());
         return(hash);
     }
 }