コード例 #1
0
ファイル: AgentBrokerTest.cs プロジェクト: CHAOS-ApS/Octopus
        public void Should_Rollback_Plugin()
        {
            IBroker      broker = new Broker();
            IAgentEngine agent  = new AgentEngine( );
            IAllocationDefinition definition = new AllocationDefinition(2);
            IExecutionSlot slot = new ExecutionSlot(definition);

            broker.Add(agent);
            definition.Add( DTO.NewPluginInfoTestPlugin );
            agent.PluginManager.Install(definition);
            agent.ExecutionManager.Add( slot );

            definition.Add(DTO.NewPluginInfoTestPlugin);

            IPlugin completedPlugin = null;
            TestPlugin testPlugin = new TestPlugin(100);

            broker.RollbackCompleted += delegate(object sender, ObjectEventArgs<IPlugin> eventArgs)
                                        {
                                            completedPlugin = eventArgs.EventObject;
                                        };

            broker.Rollback(testPlugin);

            Assert.AreEqual(slot, agent.ExecutionManager[definition]);
            Assert.AreEqual(1, agent.ExecutionManager[definition].UsedSlots, "Slots Used");

            Timing.WaitWhile(() => completedPlugin == null, 1000);

            Assert.AreEqual(testPlugin, completedPlugin);
            Assert.AreEqual(0, agent.ExecutionManager[definition].UsedSlots);
            Assert.AreEqual(PluginStatus.Rolledback, testPlugin.Status);
        }
コード例 #2
0
        public static RepresentedConfiguration ExtractFromBroker(Broker b)
        {
            ConfigurationBroker c = new ConfigurationBroker();
            c.Connections = (from cc in b.MessageChannels.Connections
                             select new cConnection()
                             {
                                 Name = cc.Key,
                                 queueTypeName = cc.Value.QueueTypeName,
                                 QueueParameters = cc.Value.specParams.GetHolder()
                             }).ToArray();
            c.Channels = (from cc in b.MessageChannels.MChannelsList
                          select new cChannel()
                          {
                              connectionName = cc.ConnectionName,
                              Name = cc.UniqueName
                          }).ToArray();

            c.Tasks = (from tt in b.Tasks
                       select new cTask()
                       {
                           intervalType = tt.intervalType,
                           Description = tt.NameAndDescription,
                           ChannelName = tt.ChannelName,
                           intervalValue = tt.intervalValue,
                           ModuleName = tt.Module.UniqueName,
                           parameters = tt.Parameters == null ? null : tt.Parameters,
                           Auto = tt.Temp
                       }).ToArray();

            return c;
        }
コード例 #3
0
ファイル: AgentBrokerTest.cs プロジェクト: CHAOS-ApS/Octopus
        public void Should_Initialize_Broker()
        {
            IBroker broker = new Broker();

            Assert.IsNotNull( broker.Agents, "Agents" );
            Assert.IsNotNull( broker.GetPluginsOnAgents(), "Plugins" );
        }
コード例 #4
0
        static void Main(string[] args)
        {
            var messageSerializer = new MessageSerializer();
              var messageBodySerializer = new MessageBodySerializer();
              var messageFactory = new MessageFactory();
              var pathFactory = new PathFactory();
              var broker = new Broker(1337,
                              messageSerializer,
                              messageBodySerializer,
                              messageFactory,
                              pathFactory);
              var messageObserver = new MessageObserver<Foo>(broker.ID,
                                                     messageBodySerializer)
                            {
                              InterceptRemoteMessagesOnly = false,
                              InterceptOnNext = foo =>
                                                {
                                                  // TODO what to do next ...
                                                }
                            };
              broker.Subscribe(messageObserver);
              broker.Start();

              broker.Publish(new Foo
                     {
                       Bar = "hello" // Not L10N
                     });

              Console.ReadLine();
        }
コード例 #5
0
        public int Parse(byte[] data, int dataOffset)
        {
            int bufferOffset = dataOffset;
            Brokers = new List<Broker>();

            bufferOffset = BufferReader.Read(data, bufferOffset, out correlationId);
            int brokerCount;
            bufferOffset = BufferReader.Read(data, bufferOffset, out brokerCount);
            for (var i = 0; i < brokerCount; i++)
            {
                Broker broker = new Broker();
                bufferOffset = broker.Parse(data, bufferOffset);
                Brokers.Add(broker);
            }

            int topicCount;
            bufferOffset = BufferReader.Read(data, bufferOffset, out topicCount);
            for (var i = 0; i < topicCount; i++)
            {
                TopicMetaData topicMetaData = new TopicMetaData();
                bufferOffset = topicMetaData.Parse(data, bufferOffset);
                topicMetaDatas.Add(topicMetaData.TopicName,topicMetaData);
            }

            return bufferOffset;
        }
コード例 #6
0
ファイル: Order.cs プロジェクト: krasniew/InvestoBank
 public Order(Client client, Broker broker, OperationType operationType, double cost, int numberOfDigicoins)
 {
     Client = client;
     Broker = broker;
     OperationType = operationType;
     Cost = cost;
     NumberOfDigicoins = numberOfDigicoins;
 }
コード例 #7
0
        public static void Apply(this ConfigurationAssemblys con, Broker broker)
        {
            logger.Debug("Trying to apply assembly's configuration\r\n with datetime stamp: {0} {1}", con.CreationDate.ToLongDateString(), con.CreationDate.ToLongTimeString());

            foreach (var assemblyProject in con.Assemblys)
            {
                broker.AddAssembly(assemblyProject.Name, assemblyProject.BuildServerType, assemblyProject.BSParameters);
            }
        }
コード例 #8
0
ファイル: DictionaryTests.cs プロジェクト: OpenTaal/enchant
		public void Setup()
		{
			oldRegistryValue = (string) Registry.GetValue(@"HKEY_CURRENT_USER\Software\Enchant\Config", "Data_Dir", null);
			tempdir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());

			Registry.SetValue(@"HKEY_CURRENT_USER\Software\Enchant\Config", "Data_Dir", tempdir, RegistryValueKind.String);
			broker = new Broker();
			dictionary = broker.RequestDictionary("en_US");
		}
コード例 #9
0
ファイル: ModHolder.cs プロジェクト: alejandraa/TaskMQ
        public ModHolder(Broker b)
        {
            Modules = new Dictionary<string, ModMod>();
            ModInterfaces = new Dictionary<string, Type>();
            ModLocalInterfaces = new Dictionary<string, Type>();
            loadedInterfaces = new Dictionary<string, string>();

            AddInterfacesFromCurrentDomain(b);
        }
コード例 #10
0
        public static void Apply(this ConfigurationBroker con, Broker broker)
        {
            logger.Debug("Trying to apply main configuration\r\n with datetime stamp: {0} {1}", con.CreationDate.ToLongDateString(), con.CreationDate.ToLongTimeString());

            for (int i = 0; i < con.Connections.Length; i++)
            {
                cConnection connection = con.Connections[i];
                if (connection.queueTypeName == null)
                {
                    logger.Error("Connection has not auto specific property, ignored: {0}", i);
                }
                else if (connection.QueueParameters == null)
                {
                    logger.Error("Connection parameters for queue: {0} is absent, this queue will be ignored", connection.Name);
                }
                else
                {
                    var qinterface = broker.QueueInterfaces.GetQueue(connection.queueTypeName);
                    QueueSpecificParameters parameters = qinterface.GetParametersModel();
                    parameters.SetHolder(connection.QueueParameters);
                    broker.RegisterConnection(connection.Name, qinterface, parameters);
                }
            }

            foreach (var channel in con.Channels)
            {
                try
                {
                    broker.RegisterChannel(channel.connectionName, channel.Name);
                }
                catch (Exception e)
                {
                    logger.Exception(e, "Channels configuration applying, ignored");
                }
            }
            for (int i = 0; i < con.Tasks.Length; i++)
            {
                var task = con.Tasks[i];
                if (task == null)
                {
                    logger.Error("Task has not auto specific property, ignored: {0}", i);
                }
                else if (!task.Auto)
                {
                    try
                    {
                        broker.RegisterTask(task.ChannelName, task.ModuleName, task.intervalType, task.intervalValue, task.parameters, task.Description);
                    }
                    catch (Exception e)
                    {
                        logger.Exception(e, "Tasks configuration applying, ignored");
                    }
                }
            }
        }
コード例 #11
0
 internal FetcherRunnable(string name, IZooKeeperClient zkClient, ConsumerConfiguration config, Broker broker, List<PartitionTopicInfo> partitionTopicInfos, Action<PartitionTopicInfo> markPartitonWithError)
 {
     _name = name;
     _zkClient = zkClient;
     _config = config;
     _broker = broker;
     _partitionTopicInfos = partitionTopicInfos;
     _fetchBufferLength = config.MaxFetchBufferLength;
     _markPartitonWithError = markPartitonWithError;
     _simpleConsumer = new Consumer(_config, broker.Host, broker.Port);
 }
コード例 #12
0
ファイル: ClusterManager.cs プロジェクト: Aaron-Liu/equeue
        public void RegisterBroker(ITcpConnection connection, BrokerRegistrationRequest request)
        {
            lock (_lockObj)
            {
                var brokerInfo = request.BrokerInfo;
                var cluster = _clusterDict.GetOrAdd(brokerInfo.ClusterName, x => new Cluster { ClusterName = x });
                var brokerGroup = cluster.BrokerGroups.GetOrAdd(brokerInfo.GroupName, x => new BrokerGroup { GroupName = x });
                Broker broker;
                if (!brokerGroup.Brokers.TryGetValue(brokerInfo.BrokerName, out broker))
                {
                    var connectionId = connection.RemotingEndPoint.ToAddress();
                    broker = new Broker
                    {
                        BrokerInfo = request.BrokerInfo,
                        TotalSendThroughput = request.TotalSendThroughput,
                        TotalConsumeThroughput = request.TotalConsumeThroughput,
                        TotalUnConsumedMessageCount = request.TotalUnConsumedMessageCount,
                        TopicQueueInfoList = request.TopicQueueInfoList,
                        TopicConsumeInfoList = request.TopicConsumeInfoList,
                        ProducerList = request.ProducerList,
                        ConsumerList = request.ConsumerList,
                        Connection = connection,
                        ConnectionId = connectionId,
                        LastActiveTime = DateTime.Now,
                        FirstRegisteredTime = DateTime.Now,
                        Group = brokerGroup
                    };
                    if (brokerGroup.Brokers.TryAdd(brokerInfo.BrokerName, broker))
                    {
                        _logger.InfoFormat("Registered new broker, brokerInfo: {0}", _jsonSerializer.Serialize(brokerInfo));
                    }
                }
                else
                {
                    broker.LastActiveTime = DateTime.Now;
                    broker.TotalSendThroughput = request.TotalSendThroughput;
                    broker.TotalConsumeThroughput = request.TotalConsumeThroughput;
                    broker.TotalUnConsumedMessageCount = request.TotalUnConsumedMessageCount;

                    if (!broker.BrokerInfo.IsEqualsWith(request.BrokerInfo))
                    {
                        var logInfo = string.Format("Broker basicInfo changed, old: {0}, new: {1}", broker.BrokerInfo, request.BrokerInfo);
                        broker.BrokerInfo = request.BrokerInfo;
                        _logger.Info(logInfo);
                    }

                    broker.TopicQueueInfoList = request.TopicQueueInfoList;
                    broker.TopicConsumeInfoList = request.TopicConsumeInfoList;
                    broker.ProducerList = request.ProducerList;
                    broker.ConsumerList = request.ConsumerList;
                }
            }
        }
コード例 #13
0
ファイル: AgentBrokerTest.cs プロジェクト: CHAOS-ApS/Octopus
        public void Should_Add_LocalAgent()
        {
            IBroker broker = new Broker();
            IAgent  agent  = new AgentEngine( );
            int     count  = 0;

            broker.Add( agent );

            foreach( IAgent enumerable in broker.Agents )
                count++;

            Assert.AreEqual(1, count);
        }
コード例 #14
0
        public static RepresentedConfiguration ExtractAssemblysFromBroker(Broker b)
        {
            ConfigurationAssemblys c = new ConfigurationAssemblys();

            c.Assemblys = (from mm in b.AssemblyHolder.assemblySources.hostedProjects
                           select new cAssembly()
                           {
                               Name = mm.PackageName,
                               BSParameters = mm.BuildServer.GetParametersModel().GetHolder(),
                               BuildServerType = mm.BuildServer.Name
                           }).ToArray();

            return c;
        }
コード例 #15
0
        public static RepresentedConfiguration ExtractModulesFromBroker(Broker b)
        {
            ConfigurationModules c = new ConfigurationModules();

            c.Modules = (from mm in b.Modules.Modules
                         select new cModule()
                         {
                             TypeFullName = mm.Value.MI.GetType().FullName,
                             Name = mm.Key,
                             Description = mm.Value.Description,
                             Role = mm.Value.Role,
                             ParametersModel = mm.Value.ParametersModel.schema.ToList().ToDictionary((keyItem) => keyItem.Value1, (valueItem) => new Configuration.SchemeValueSpec(valueItem.Value2))
                             //mm.Value.ParametersModel.schema
                         }).ToArray();

            return c;
        }
コード例 #16
0
        private void Experiment(OrderQueueType type, EventWaitHandle waitHandler)
        {
            Stopwatch sw = Stopwatch.StartNew();
            QueueProvider.SetQueueType(type);

            TradeConsole tc = new TradeConsole();
            tc.Execute();

            Broker broker = new Broker();
            broker.Complete = () =>
            {
                sw.Stop();
                Console.WriteLine(string.Format("{1, 35}\t\t\t\t{0}", sw.ElapsedMilliseconds, type.ToString()));

                waitHandler.Set();
            };
            broker.Sell();
        }
コード例 #17
0
        public static Broker CreateEntityWithTwoDetailsAndTwoMappings()
        {
            SourceSystem endur = repository.Queryable<SourceSystem>().Where(system => system.Name == "Endur").First();
            SourceSystem trayport =
                repository.Queryable<SourceSystem>().Where(system => system.Name == "Trayport").First();

            var entity = new Broker();
            entity.Party = ObjectMother.Create<Party>();
            baseDate = DateTime.Today.Subtract(new TimeSpan(72, 0, 0));
            SystemTime.UtcNow = () => new DateTime(DateTime.Today.Subtract(new TimeSpan(73, 0, 0)).Ticks);

            AddDetailsToEntity(entity, DateTime.MinValue, baseDate);
            AddDetailsToEntity(entity, baseDate, DateTime.MaxValue);

            SystemTime.UtcNow = () => DateTime.Now;

            var trayportMapping = new PartyRoleMapping
                {
                    MappingValue = Guid.NewGuid().ToString(),
                    System = trayport,
                    Validity = new DateRange(DateTime.MinValue, DateTime.MaxValue)
                };

            var endurMapping = new PartyRoleMapping
                {
                    MappingValue = Guid.NewGuid().ToString(),
                    System = endur,
                    IsDefault = true,
                    Validity = new DateRange(DateTime.MinValue, DateTime.MaxValue)
                };

            entity.ProcessMapping(trayportMapping);
            entity.ProcessMapping(endurMapping);

            repository.Add(entity);
            repository.Flush();
            return entity;
        }
コード例 #18
0
        public void ValidContractIsSaved()
        {
            // Arrange
            var validatorFactory = new Mock<IValidatorEngine>();
            var mappingEngine = new Mock<IMappingEngine>();
            var repository = new Mock<IRepository>();
            var searchCache = new Mock<ISearchCache>();

            var service = new BrokerService(validatorFactory.Object, mappingEngine.Object, repository.Object, searchCache.Object);

            var broker = new Broker();
            var contract = new EnergyTrading.MDM.Contracts.Sample.Broker();

            validatorFactory.Setup(x => x.IsValid(It.IsAny<EnergyTrading.MDM.Contracts.Sample.Broker>(), It.IsAny<IList<IRule>>())).Returns(true);
            mappingEngine.Setup(x => x.Map<EnergyTrading.MDM.Contracts.Sample.Broker, Broker>(contract)).Returns(broker);

            // Act
            var expected = service.Create(contract);

            // Assert
            Assert.AreSame(expected, broker, "Broker differs");
            repository.Verify(x => x.Add(broker));
            repository.Verify(x => x.Flush());
        }
コード例 #19
0
ファイル: ObrisiIstoriju.cs プロジェクト: PedjaM/GymSoftware
 public override object Izvrsi(object odo)
 {
     return(Broker.DajSesiju().delete(odo as OpstiDomenskiObjekat));
 }
コード例 #20
0
ファイル: BrokerTests.cs プロジェクト: Thor1Khan/enchant
 public void Dictionaries()
 {
     using (Broker broker = new Broker())
     {
         IEnumerable<DictionaryInfo> dictionaries = broker.Dictionaries;
         Assert.IsNotNull(dictionaries);
         int count = 0;
         foreach (DictionaryInfo info in dictionaries)
         {
             Console.WriteLine("Language:{0}\tName:{1}\tDescription:{2}\tFile:{3}",
                                                 info.Language,
                                                 info.Provider.Name,
                                                 info.Provider.Description,
                                                 info.Provider.File);
             Assert.IsNotEmpty(info.Language);
             Assert.IsNotEmpty(info.Provider.Name);
             Assert.IsNotEmpty(info.Provider.Description);
             Assert.IsNotEmpty(info.Provider.File);
             ++count;
         }
         Assert.AreEqual(1, count);
     }
 }
コード例 #21
0
        private static void AddDetailsToEntity(Broker entity, DateTime startDate, DateTime endDate)
        {
            var newEntity = ObjectMother.Create<Broker>();

            entity.PartyRoleType = newEntity.PartyRoleType;
            entity.AddDetails(new BrokerDetails() {
                Name = newEntity.Details[0].Name,
                Phone = ((BrokerDetails)newEntity.Details[0]).Phone,
                Fax = ((BrokerDetails)newEntity.Details[0]).Fax,
                Rate = ((BrokerDetails)newEntity.Details[0]).Rate});
        }
コード例 #22
0
 public PurchaseInvoice FindInvoiceByBroker(List <PurchaseInvoice> saleInvoice, Broker broker)
 {
     return(saleInvoice.Find(b => b.Broker.Id == broker.Id));
 }
コード例 #23
0
ファイル: BrokerTests.cs プロジェクト: Thor1Khan/enchant
 private static Dictionary GetDictionaryAllowingBrokerToGoOutOfScope(out WeakReference brokerReference)
 {
     Broker broker = new Broker();
     brokerReference = new WeakReference(broker);
     return broker.RequestDictionary("en_US");
 }
コード例 #24
0
 public void Create(Broker broker, byte[] configuration)
 {
     this.broker        = broker;
     this.configuration = System.Text.Encoding.UTF8.GetString(configuration);
 }
コード例 #25
0
 public override object IzvrsiKonkretnuSO(OpstiDomenskiObjekat odo)
 {
     return(Broker.dajSesiju().vratiSveZaUslovOstalo(odo).OfType <Destinacija>().ToList <Destinacija>());
 }
コード例 #26
0
ファイル: mdbroker.cs プロジェクト: chubbson/zguide
 /// <summary>
 /// 
 /// </summary>
 /// <param name="idString"></param>
 /// <param name="broker"></param>
 /// <param name="identity">will be dublicated inside the constructor</param>
 public Worker(string idString, Broker broker, ZFrame identity)
 {
     Broker = broker;
     IdString = idString;
     Identity = identity.Duplicate();
 }
コード例 #27
0
        public void Start()
        {
            WorkerTask = Task.Factory.StartNew(async delegate {
                while (!CancelTokenSource.IsCancellationRequested && !Broker.IsCompleted)
                {
                    try
                    {
                        var toSend = new List <Task>();
                        foreach (var n in Broker.TakeMany())
                        {
                            var t = Connection.Send(n);
                            // Keep the continuation
                            var cont = t.ContinueWith(ct => {
                                var cn = n;
                                var ex = t.Exception;

                                if (ex == null)
                                {
                                    Broker.RaiseNotificationSucceeded(cn);
                                }
                                else
                                {
                                    Broker.RaiseNotificationFailed(cn, ex);
                                }
                            });

                            // Let's wait for the continuation not the task itself
                            toSend.Add(cont);
                        }

                        if (toSend.Count <= 0)
                        {
                            continue;
                        }

                        try
                        {
                            Log.Info("Waiting on all tasks {0}", toSend.Count());
                            await TaskEx.WhenAll(toSend).ConfigureAwait(false);
                            Log.Info("All Tasks Finished");
                        }
                        catch (Exception ex)
                        {
                            Log.Error("Waiting on all tasks Failed: {0}", ex);
                        }
                        Log.Info("Passed WhenAll");
                    }
                    catch (Exception ex)
                    {
                        Log.Error("Broker.Take: {0}", ex);
                    }
                }

                if (CancelTokenSource.IsCancellationRequested)
                {
                    Log.Info("Cancellation was requested");
                }
                if (Broker.IsCompleted)
                {
                    Log.Info("Broker IsCompleted");
                }

                Log.Debug("Broker Task Ended");
            }, CancelTokenSource.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default).Unwrap();

            WorkerTask.ContinueWith(t => {
                var ex = t.Exception;
                if (ex != null)
                {
                    Log.Error("ServiceWorker.WorkerTask Error: {0}", ex);
                }
            }, TaskContinuationOptions.OnlyOnFaulted);
        }
コード例 #28
0
        public new static MemberCCSD Retrieve(int id)
        {
            Key key = new Key(typeof(MemberCCSD), true, "Id", id);

            return(Broker.RetrieveInstance(typeof(MemberCCSD), key) as MemberCCSD);
        }
コード例 #29
0
ファイル: BrokerAccountService.cs プロジェクト: ichoukou/BM
        /// <summary>
        /// 创建用户
        /// </summary>
        /// <param name="phone"></param>
        /// <param name="password"></param>
        /// <param name="cityCode"></param>
        /// <param name="name"></param>
        /// <param name="firmNo"></param>
        /// <param name="referral"></param>
        /// <returns></returns>
        public MessageRecorder <Broker> Create(
            string phone,
            string password,
            string cityCode = null,
            string name     = null,
            string firmNo   = null,
            string referral = null)
        {
            var mr = new MessageRecorder <Broker>();

            using (var conn = ConnectionManager.Open())
            {
                var trans = conn.BeginTransaction();

                var accountQuery = new Criteria <Account>()
                                   .Or(m => m.Phone, Op.Eq, phone)
                                   .Or(m => m.Phone2, Op.Eq, phone)
                                   .Or(m => m.Phone3, Op.Eq, phone);
                var account = conn.Get(accountQuery);

                if (account == null)
                {
                    account = new Account
                    {
                        No        = Guid.NewGuid().ToString("N").ToUpper(),
                        Name      = name ?? "未来经纪大师",
                        Phone     = phone,
                        CreatedBy = "SYSTEM",
                        CreatedAt = DateTime.Now,
                        Password  = password,
                        Status    = AccountStatus.Type.Normal,
                        Referral  = referral
                    };
                    var effectedCount = conn.Insert(account, trans);
                    if (effectedCount == -1)
                    {
                        trans.Rollback();
                        return(mr.Error("创建账户失败"));
                    }
                }

                var q1 = new Criteria <AccountRoleRef>()
                         .Where(m => m.AccountNo, Op.Eq, account.No)
                         .And(m => m.BranchNo, Op.Eq, "420100")
                         .And(m => m.RoleNo, Op.Eq, "Broker")
                         .Limit(1);
                if (conn.Exists(q1))
                {
                    trans.Rollback();
                    return(mr.Error("账户已经存在,不能重复创建"));
                }

                var query = new Criteria <Broker>()
                            .Where(m => m.No, Op.Eq, account.No)
                            .Desc(m => m.No);
                if (conn.Exists(query))
                {
                    trans.Rollback();
                    return(mr.Error("账户已经存在,不能重复创建"));
                }

                var model2 = new AccountRoleRef
                {
                    AccountNo = account.No,
                    RoleNo    = "Broker",
                    BranchNo  = cityCode ?? "420100",
                    CreatedAt = DateTime.Now,
                    CreatedBy = "SYSTEM"
                };
                var effectedCount1 = conn.Insert(model2, trans);
                if (effectedCount1 == -1)
                {
                    trans.Rollback();
                    return(mr.Error("账户创建失败,请重试"));
                }

                var model = new Broker
                {
                    No        = account.No,
                    Name      = account.Name,
                    Mobile    = phone,
                    CityNo    = cityCode ?? "420100",
                    FirmNo    = firmNo,
                    CreatedBy = "SYSTEM",
                    CreatedAt = DateTime.Now
                };
                var effectedCount2 = conn.Insert(model, trans);
                if (effectedCount2 == -1)
                {
                    trans.Rollback();
                    return(mr.Error("账户创建失败,请重试"));
                }

                trans.Commit();
                mr.SetValue(model);
            }

            return(mr);
        }
コード例 #30
0
ファイル: TVChannels.cs プロジェクト: usermonk/MediaPortal-1
        private void mpButtonClear_Click(object sender, EventArgs e)
        {
            string holder = String.Format("Are you sure you want to clear all channels?");

            if (MessageBox.Show(holder, "", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            NotifyForm dlg = new NotifyForm("Clearing all tv channels...", "This can take some time\n\nPlease be patient...");

            dlg.Show(this);
            dlg.WaitForDisplay();
            IList <Channel> channels = Channel.ListAll();

            foreach (Channel channel in channels)
            {
                if (channel.IsTv)
                {
                    Broker.Execute("delete from TvMovieMapping WHERE idChannel=" + channel.IdChannel);
                    channel.Delete();
                }
            }
            dlg.Close();

            /*Gentle.Framework.Broker.Execute("delete from history");
             * Gentle.Framework.Broker.Execute("delete from tuningdetail");
             * Gentle.Framework.Broker.Execute("delete from GroupMap");
             * Gentle.Framework.Broker.Execute("delete from Channelmap");
             * Gentle.Framework.Broker.Execute("delete from Recording");
             * Gentle.Framework.Broker.Execute("delete from CanceledSchedule");
             * Gentle.Framework.Broker.Execute("delete from Schedule");
             * Gentle.Framework.Broker.Execute("delete from Program");
             * Gentle.Framework.Broker.Execute("delete from Channel");
             * mpListView1.BeginUpdate();*/
            /*
             * IList details = TuningDetail.ListAll();
             * foreach (TuningDetail detail in details) detail.Remove();
             *
             * IList groupmaps = GroupMap.ListAll();
             * foreach (GroupMap groupmap in groupmaps) groupmap.Remove();
             *
             * IList channelMaps = ChannelMap.ListAll();
             * foreach (ChannelMap channelMap in channelMaps) channelMap.Remove();
             *
             * IList recordings = Recording.ListAll();
             * foreach (Recording recording in recordings) recording.Remove();
             *
             * IList canceledSchedules = CanceledSchedule.ListAll();
             * foreach (CanceledSchedule canceledSchedule in canceledSchedules) canceledSchedule.Remove();
             *
             * IList schedules = Schedule.ListAll();
             * foreach (Schedule schedule in schedules) schedule.Remove();
             *
             * IList programs = Program.ListAll();
             * foreach (Program program in programs) program.Remove();
             *
             * IList channels = Channel.ListAll();
             * foreach (Channel channel in channels) channel.Remove();
             */

            //mpListView1.EndUpdate();
            OnSectionActivated();
        }
コード例 #31
0
 protected override object Execute(IGenericObject odo, Broker broker)
 {
     return(broker.GetObjectByCondition(odo));
 }
コード例 #32
0
ファイル: DataAccess.cs プロジェクト: kexpertdev/baseVer01
        public Policy SavePolicy(Guid guid, Client client, Vehicle vehicle, Broker broker)
        {
            PolicyQuote quote = QuoteRepo.GetByID(guid);

            if (quote == null)
            {
                throw new Exception("The supplied guid not exists");
            }
            if (quote.Period.Count > 0)
            {
                throw new Exception("The quote already is transferred to policy");
            }

            //check if exists policy with quote
            //check if the quid belong to the brokee or not
            //check againts quote starting date, and modify if we need!!!

            string policyNumber = GetNextPolicyNumber(quote.Product_ID);

            client.ClientCode = policyNumber;

            Policy policy = new Policy()
            {
                PolicyNumber    = policyNumber,
                PolicyStartDate = quote.PolicyStartDate,
                PolicyEndDate   = quote.PolicyEndDate,
                IsFixedTerm     = quote.PolicyType_ID == PolicyTypes.FixedTerm ? true : false,
                Product_ID      = Convert.ToInt32(quote.Product_ID),
                Status_ID       = Convert.ToInt32(PolicyStatuses.Policy),
                Broker_ID       = quote.Broker_ID,
                CreatedBy_ID    = 1, //sysadmin, to do
                Client          = client,
                Vehicle         = vehicle,
                PolicyPeriods   = new List <PolicyPeriod>()
                {
                    new PolicyPeriod()
                    {
                        PeriodStartDate         = quote.PolicyStartDate,
                        PeriodEndDate           = quote.PolicyEndDate,
                        Premium                 = quote.Premium,
                        IsLastPeriod            = true,
                        PeriodNumber            = 1,
                        PaymentType_ID          = Convert.ToInt32(quote.PolicyPaymentMethod_ID),
                        PreviousPolicyPeriod_ID = null,
                        Quote       = quote,
                        Installment = new List <PolicyInstallment>()
                        {
                            new PolicyInstallment()
                            {
                                Nr      = 1,
                                Type    = 1,
                                DueDate = quote.PolicyStartDate,
                                Value   = quote.Premium
                            }
                        },
                        InsurancePolicies = new List <InsurancePolicy>()
                        {
                            new InsurancePolicy()
                            {
                                Company      = Convert.ToInt32(quote.InsuranceCompany),
                                PolicyNumber = quote.InsurancePolicyNumber,
                                StartDate    = quote.InsuranceStartDate,
                                EndDate      = quote.InsuranceEndDate
                            }
                        }
                    }
                }
            };

            Policy savedPolicy = PolicyRepo.Insert(policy);

            SaveChanges();

            return(savedPolicy);
        }
コード例 #33
0
        static void Main(string[] args)
        {
            //Clan clan = new Clan
            //{
            //    ClanID = 1,
            //    Ime = "Ognjen",
            //    Prezime = "Pejcic",
            //    DatumRodjenja = DateTime.Parse("9/23/1998"),
            //    Grupa = new GrupaZaTrening
            //    {
            //        GrupaID = 1
            //    }
            //};

            Termin termin = new Termin
            {
                TerminID     = 2,
                DanTermina   = "petak subota",
                VremeTermina = "07:00 PM",
                Grupa        = new GrupaZaTrening
                {
                    GrupaID = 1
                },
                Trener = new Trener
                {
                    TrenerID = 1
                }
            };

            //GrupaZaTrening grupa = new GrupaZaTrening
            //{
            //    GrupaID = 6,
            //    BrojClanova = 50,
            //    VrstaGrupe = new VrstaGrupe
            //    {
            //        VrstaGrupeID = 1
            //    }
            //};

            Broker broker = new Broker();

            broker.OtvoriKonekciju();

            List <DomenskiObjekat> grupe = broker.VratiSveJoin(new GrupaZaTrening());

            foreach (GrupaZaTrening grupa in grupe)
            {
                Console.WriteLine(grupa.BrojClanova + grupa.VrstaGrupe.NazivVrste);
            }


            //if(broker.Sacuvaj(grupa) == 1)
            //{
            //    Console.WriteLine("Grupa je sacuvana");
            //}

            //List<DomenskiObjekat> objekat = broker.Pronadji(grupa);
            //foreach (GrupaZaTrening g in objekat)
            //{
            //    Console.WriteLine(g.VrstaGrupe.NazivVrste); //ne radi
            //}

            //try
            //{
            //    broker.Azuriraj(grupa);
            //    Console.WriteLine("Grupa je izmenjena");
            //}
            //catch(Exception e)
            //{

            //}

            //List<DomenskiObjekat> objekat = broker.VratiSve(grupa);
            //foreach (GrupaZaTrening g in objekat)
            //{
            //    Console.WriteLine(g.BrojClanova);
            //}

            //if(broker.Sacuvaj(termin) == 1)
            //{
            //    Console.WriteLine("Termin je sacuva");
            //}

            //List<DomenskiObjekat> objekat = broker.Pronadji(termin);
            //foreach(Termin t in objekat)
            //{
            //    Console.WriteLine(t.DanTermina + " " + t.VremeTermina);
            //}

            //try
            //{
            //    broker.Azuriraj(termin);
            //    Console.WriteLine("Termin je izmenjen");
            //}
            //catch(Exception e)
            //{

            //}

            //if(broker.Sacuvaj(clan) == 1)
            //{
            //    Console.WriteLine("Clan je sacuvan");
            //}

            //List<DomenskiObjekat> objekat = broker.Pronadji(clan);
            //foreach (Clan c in objekat)
            //{
            //    Console.WriteLine(c.Ime + " " + c.Prezime);
            //}

            //try
            //{
            //    broker.Azuriraj(clan);
            //    Console.WriteLine("Uspesna izmena");
            //}catch(Exception e)
            //{

            //}

            //List<DomenskiObjekat> objekat = broker.VratiSve(clan);
            //foreach (Clan c in objekat)
            //{
            //    Console.WriteLine(c.Ime + " " + c.Prezime);
            //}



            broker.ZatvoriKonekciju();
        }
コード例 #34
0
ファイル: Connection.cs プロジェクト: nonomal/NCache
 internal Connection(Broker container, OnCommandRecieved commandRecieved, OnServerLost serverLost, Logs logs, StatisticsCounter perfStatsCollector, ResponseIntegrator rspIntegraotr, string bindIP, string cacheName)
 {
     _connectionStatusLatch = new Latch(ConnectionStatus.Disconnected);
     Initialize(container, commandRecieved, serverLost, logs, perfStatsCollector, rspIntegraotr, bindIP, cacheName);
 }
コード例 #35
0
ファイル: ModHolder.cs プロジェクト: alejandraa/TaskMQ
 private void reloadLocalMods(Broker b)
 {
     foreach (Type item in ModLocalInterfaces.Values)
     {
         HostModule(item.FullName, new ModMod(), b);
     }
 }
コード例 #36
0
        public SearchMarket Get(string id)
        {
            Broker <BrokerSecurity> b = new Broker <BrokerSecurity>(context);

            return(b.GetPrice(id.ToUpper()));
        }
コード例 #37
0
 public override object Izvrsi(OpstiDomenskiObjekat odo)
 {
     return(Broker.DajSesiju().Obrisi(odo));
 }
コード例 #38
0
        public override object Izvrsi(object odo)
        {
            List <Govornik> lista = Broker.dajSesiju().vratiSve(odo as OpstiDomenskiObjekat).OfType <Govornik>().ToList <Govornik>();

            return(lista);
        }
コード例 #39
0
ファイル: AmqpEntities.cs プロジェクト: pichierrif/Carrot
 public AmqpEntities()
 {
     _broker = new Broker(new EnvironmentConfiguration(), new Mock <IConnectionBuilder>().Object);
 }
コード例 #40
0
        public void GetBrokerInfoTest()
        {
            Broker broker = _brokerMgrRepository.GetBrokerInfo();

            Assert.NotNull(broker);
        }
コード例 #41
0
        public List <SearchMarket> Get()
        {
            Broker <BrokerSecurity> b = new Broker <BrokerSecurity>(context);

            return(b.GetAllMarket());
        }
コード例 #42
0
        public async Task PartitionsAssignedEvent_ResetOffset_MessagesConsumedAgain()
        {
            var serviceProvider = Host.ConfigureServices(
                services => services
                .AddLogging()
                .AddSilverback()
                .UseModel()
                .WithConnectionToMessageBroker(options => options.AddMockedKafka())
                .AddEndpoints(
                    endpoints => endpoints
                    .AddOutbound <IIntegrationEvent>(new KafkaProducerEndpoint(DefaultTopicName))
                    .AddInbound(
                        new KafkaConsumerEndpoint(DefaultTopicName)
            {
                Configuration = new KafkaConsumerConfig
                {
                    GroupId = "consumer1",
                    AutoCommitIntervalMs = 100
                }
            }))
                .AddSingletonSubscriber <OutboundInboundSubscriber>()
                .AddDelegateSubscriber(
                    (KafkaPartitionsAssignedEvent message) =>
                    message.Partitions = message.Partitions.Select(
                        topicPartitionOffset => new TopicPartitionOffset(
                            topicPartitionOffset.TopicPartition,
                            Offset.Beginning)).ToList()))
                                  .Run();

            var publisher = serviceProvider.GetRequiredService <IEventPublisher>();

            await publisher.PublishAsync(
                new TestEventOne
            {
                Content = "Message 1"
            });

            await publisher.PublishAsync(
                new TestEventOne
            {
                Content = "Message 2"
            });

            await publisher.PublishAsync(
                new TestEventOne
            {
                Content = "Message 3"
            });

            await KafkaTestingHelper.WaitUntilAllMessagesAreConsumedAsync();

            Subscriber.InboundEnvelopes.Should().HaveCount(3);

            await Broker.DisconnectAsync();

            await Broker.ConnectAsync();

            await publisher.PublishAsync(
                new TestEventOne
            {
                Content = "Message 4"
            });

            await KafkaTestingHelper.WaitUntilAllMessagesAreConsumedAsync();

            Subscriber.InboundEnvelopes.Should().HaveCount(7);
        }
コード例 #43
0
 public override object Izvrsi(OpstiDomenskiObjekat odo)
 {
     return(Broker.dajSesiju().vratiSifru(odo));
 }
コード例 #44
0
 public void Init()
 {
     Broker.Execute("delete from PropertyHolder");
 }
コード例 #45
0
ファイル: BrokerTests.cs プロジェクト: Thor1Khan/enchant
 public void SetOrdering()
 {
     using (Broker broker = new Broker())
     {
         broker.SetOrdering("en_US", "aspell, myspell, ispell");
     }
 }
コード例 #46
0
 public List <Product> FindProductsByBroker(List <PurchaseInvoice> purchaseInvoice, Broker broker)
 {
     if (purchaseInvoice.Find(p => p.Broker.Id == broker.Id) != null)
     {
         return(purchaseInvoice.Find(p => p.Broker.Id == broker.Id).Products);
     }
     else
     {
         purchaseInvoice.Add(new PurchaseInvoice {
             Broker = broker, Products = new List <Product>()
         });
     }
     return(purchaseInvoice.Find(p => p.Broker.Id == broker.Id).Products);
 }
コード例 #47
0
ファイル: BrokerTests.cs プロジェクト: Thor1Khan/enchant
 //this will allow the dictionary object to go out of scope
 private static WeakReference GetDictionaryReference(Broker broker)
 {
     Dictionary dictionary = broker.RequestDictionary("en_US");
     return new WeakReference(dictionary);
 }
コード例 #48
0
 /// <summary>
 /// Retrieves an entity given it's id, using Gentle.Framework.Key class.
 /// This allows retrieval based on multi-column keys.
 /// </summary>
 public static GroupMap Retrieve(Key key)
 {
     return(Broker.RetrieveInstance <GroupMap>(key));
 }
コード例 #49
0
 public static void CreateSearch(Search search, Broker entity1, Broker entity2)
 {
     CreateSearchData(search, entity1, entity2);
 }
コード例 #50
0
 /// <summary>
 /// Static method to retrieve all instances that are stored in the database in one call
 /// </summary>
 public static IList <GroupMap> ListAll()
 {
     return(Broker.RetrieveList <GroupMap>());
 }
コード例 #51
0
 private static void CreateSearchData(Search search, Broker entity1, Broker entity2)
 {
     search.AddSearchCriteria(SearchCombinator.Or)
         .AddCriteria("Name", SearchCondition.Equals, entity1.LatestDetails.Name)
         .AddCriteria("Name", SearchCondition.Equals, entity2.LatestDetails.Name);
 }
コード例 #52
0
ファイル: Favorite.cs プロジェクト: usermonk/MediaPortal-1
 /// <summary>
 /// Retrieves an entity given it's id, using Gentle.Framework.Key class.
 /// This allows retrieval based on multi-column keys.
 /// </summary>
 public static Favorite Retrieve(Key key)
 {
     return(Broker.RetrieveInstance <Favorite>(key));
 }
コード例 #53
0
ファイル: mdbroker.cs プロジェクト: chubbson/zguide
 //ToDo check workers var
 internal Service(Broker broker, string name)
 {
     Broker = broker;
     Name = name;
     Requests = new List<ZMessage>();
     Waiting = new List<Worker>();
 }
コード例 #54
0
ファイル: Favorite.cs プロジェクト: usermonk/MediaPortal-1
 /// <summary>
 /// Static method to retrieve all instances that are stored in the database in one call
 /// </summary>
 public static IList <Favorite> ListAll()
 {
     return(Broker.RetrieveList <Favorite>());
 }
コード例 #55
0
ファイル: ModHolder.cs プロジェクト: alejandraa/TaskMQ
        private void AddInterfacesFromCurrentDomain(Broker b)
        {
            //TaskBroker.Assemblys.Assemblys.ForceReferencedLoad();// locals...

            var type = typeof(IMod);
            var types = AppDomain.CurrentDomain.GetAssemblies().ToList()
                .SelectMany(s => s.GetTypes())
                .Where(p => type.IsAssignableFrom(p) && !p.IsInterface);
            foreach (Type item in types)
            {
                ModLocalInterfaces.Add(item.FullName, item);
                loadedInterfaces.Add(item.FullName, item.Assembly.FullName);
            }
            reloadLocalMods(b);
        }
コード例 #56
0
 protected override object Izvrsi(IDomenskiObjekat odo)
 {
     return(Broker.Instance().VratiSveZaUslov(odo).OfType <Proizvod>().ToList <Proizvod>());
 }
コード例 #57
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="idString"></param>
 /// <param name="broker"></param>
 /// <param name="identity">will be dublicated inside the constructor</param>
 public Worker(string idString, Broker broker, ZFrame identity)
 {
     Broker   = broker;
     IdString = idString;
     Identity = identity.Duplicate();
 }
コード例 #58
0
 protected override bool Izvrsi(IDomenskiObjekat objekat, string kriterijum = "", string sifraJakog = "")
 {
     Rezultat = Broker.DajInstancu().VratiIDSlabog(objekat, objekat.VratiKriterijumJakog(sifraJakog));
     return(true);
 }
コード例 #59
0
ファイル: BrokerTests.cs プロジェクト: ronnieoverby/LogServer
 public void CanCreateBroker()
 {
     var broker = new Broker();
 }
コード例 #60
0
 public StoragePacijent()
 {
     broker = new Broker();
 }