public GenericSvcResult ActivateService(int serviceId, bool sendEmail, bool logSvcUsage)
        {
            GenericSvcResult result = null;
            // load svc type
            ProductType svc_type = ServiceController.GetServiceItemType(serviceId);

            //
            if (svc_type == null)
            {
                result         = new GenericSvcResult();
                result.Succeed = true;
                return(result);
            }
            // instantiate svc controller
            IServiceProvisioning controller = (IServiceProvisioning)Activator.CreateInstance(
                Type.GetType(svc_type.ProvisioningController));
            // create context
            ProvisioningContext context = controller.GetProvisioningContext(serviceId, sendEmail);

            // activate svc
            result = controller.ActivateService(context);
            // check result
            if (result.Succeed)
            {
                // log svc usage
                if (logSvcUsage)
                {
                    controller.LogServiceUsage(context);
                }
            }
            //
            return(result);
        }
Пример #2
0
        public static void AddServiceUsageRecord(int serviceId)
        {
            // read service type
            ProductType svcType = GetServiceItemType(serviceId);
            // create svc controller
            IServiceProvisioning controller = (IServiceProvisioning)Activator.CreateInstance(
                Type.GetType(svcType.ProvisioningController));

            //
            controller.LogServiceUsage(controller.GetProvisioningContext(serviceId, false));
        }
Пример #3
0
        public GenericSvcResult CancelService(int serviceId, bool sendEmail)
        {
            GenericSvcResult result = null;
            // load svc type
            ProductType svc_type = ServiceController.GetServiceItemType(serviceId);
            // instantiate svc controller
            IServiceProvisioning controller = (IServiceProvisioning)Activator.CreateInstance(
                Type.GetType(svc_type.ProvisioningController));
            // create context
            ProvisioningContext context = controller.GetProvisioningContext(serviceId, sendEmail);

            // cancel svc
            result = controller.CancelService(context);
            //
            return(result);
        }