示例#1
0
        public WorkOrderService(IArsOrganizationContext context, ITechnicianService technicianService, IOptionSetHelper optionSetHelper, ILogger logger)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (technicianService == null)
            {
                throw new ArgumentNullException("technicianService");
            }

            if (optionSetHelper == null)
            {
                throw new ArgumentNullException("optionSetHelper");
            }

            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            _context           = context;
            _technicianService = technicianService;
            _optionSetHelper   = optionSetHelper;
            _logger            = logger;
        }
        protected override void Execute(CodeActivityContext executionContext)
        {
            var tracingService  = executionContext.GetExtension <ITracingService>();
            var workflowContext = executionContext.GetExtension <IWorkflowContext>();

            if (workflowContext == null)
            {
                throw new InvalidOperationException("Wokflow Context is null");
            }

            IArsOrganizationContext serviceContext = null;

            try
            {
                var serviceFactory           = executionContext.GetExtension <IOrganizationServiceFactory>();
                IOrganizationService service = serviceFactory.CreateOrganizationService(workflowContext.UserId);

                serviceContext = executionContext.GetExtension <IServiceContextFactory>().CreateContext(service);
                HandleRequest(executionContext, serviceContext, workflowContext);
            }
            catch (Exception ex)
            {
                ThrowException(ex, tracingService, workflowContext);
            }
            finally
            {
                var disposable = serviceContext as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }
示例#3
0
        public LocationService(IArsOrganizationContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            _context = context;
        }
        protected EntityServiceBase(IArsOrganizationContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            _context = context;
        }
        public CrmTechnicianAuthenticationService(IArsOrganizationContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            _context = context;
        }
示例#6
0
        public TimeService(IArsOrganizationContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            _context      = context;
            _timeZoneCode = new Lazy <int>(GetCurrentUserTimeZoneCode);
        }
示例#7
0
        public AppointmentService(IArsOrganizationContext context, ITimeService timeService)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (timeService == null)
            {
                throw new ArgumentNullException("timeService");
            }

            _context     = context;
            _timeService = timeService;
        }
        public TechnicianService(IArsOrganizationContext context, ObjectCache cache)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (cache == null)
            {
                throw new ArgumentNullException("cache");
            }

            _context = context;
            _cache   = cache;
        }
示例#9
0
        public PurchaseOrderService(IArsOrganizationContext context, ITechnicianService technicianService)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (technicianService == null)
            {
                throw new ArgumentNullException("technicianService");
            }

            _context           = context;
            _technicianService = technicianService;
        }
示例#10
0
 public static void Main(string[] args)
 {
     _context = CreateOrganizationContext();
     CreateWorkOrdersForToday();
 }
示例#11
0
 protected abstract void HandleRequest(CodeActivityContext executionContext, IArsOrganizationContext serviceContext, IWorkflowContext workflowContext);