示例#1
0
        private KCMSMQueueReader CreateQueue(SyncType syncType)
        {
            var              pnName    = KCMSMQQueueHelper.GetSyncName(syncType);
            string           pnAddress = Environment.MachineName + @"\private$\" + KCMSMQQueueHelper.GetSyncQueueName(syncType);
            KCMSMQueueReader queue     = new KCMSMQueueReader(pnAddress);

            bool queueExists = queue.IsQueueExists;

            if (queueExists)
            {
                queue.DeleteQueue();
            }

            queue.CreateQueue();

            string activity = KCMSMQConstants.createQueue(pnName);
            string comments = KCMSMQConstants.createQueueSuccess(pnName);

            InsertInitializationActivity(activity, comments);

            return(queue);
        }
示例#2
0
        private void CreatePN(SyncType syncType)
        {
            var pnName = KCMSMQQueueHelper.GetSyncName(syncType);

            PushNotificationsHook notification = PushNotifications.SelectSingle(pnName);

            if (notification != null)
            {
                PushNotifications.Delete(notification);
                PushNotifications.Cache.PersistDeleted(notification);

                foreach (var item in PushNotifocationSource.Select(notification.HookId))
                {
                    var obj = item.GetItem <PushNotificationsSource>();

                    PushNotifocationSource.Delete(obj);
                    PushNotifocationSource.Cache.PersistDeleted(obj);
                }

                foreach (var item in PushNotifocationErrors.Select(notification.HookId))
                {
                    var obj = item.GetItem <PushNotificationsErrors>();

                    PushNotifocationErrors.Delete(obj);
                    PushNotifocationErrors.Cache.PersistDeleted(obj);
                }

                foreach (var item in PushNotifocationFailed.Select(notification.HookId))
                {
                    var obj = item.GetItem <PushNotificationsFailedToSend>();

                    PushNotifocationFailed.Delete(obj);
                    PushNotifocationFailed.Cache.PersistDeleted(obj);
                }

                Persist();
            }

            notification = new PushNotificationsHook
            {
                Name    = pnName,
                Type    = "KCMQ",
                Active  = true,
                Address = Environment.MachineName + @"\private$\" + KCMSMQQueueHelper.GetSyncQueueName(syncType),
                HookId  = Guid.NewGuid()
            };
            PushNotifications.Insert(notification);

            GIDesign design = Design.SelectSingle(pnName);
            PushNotificationsSource source = new PushNotificationsSource
            {
                HookId     = notification.HookId,
                DesignID   = design.DesignID,
                SourceType = "GI"
            };

            PushNotifocationSource.Insert(source);

            InsertInitializationActivity(KCMSMQConstants.createPN(pnName), KCMSMQConstants.createPNSuccess(pnName));
            Persist();
        }