Example #1
0
        /// <summary>
        /// Inserts a normal event (possible outcomes are victory, draw and loss).
        /// </summary>
        /// <param name="sportname">Name of the sport</param>
        /// <param name="BookieEmail">E-mail of the bookie.</param>
        private static void InsertNormalEvent(string sportname, string BookieEmail)
        {
            string descr, o1, o2, d;
            double odd1, odd2, draw;

            Console.Write("Description: ");
            descr = Console.ReadLine();
            Console.Write("Odds:\n1: ");
            o1 = Console.ReadLine();
            double.TryParse(o1, out odd1);
            Console.Write("2: ");
            o2 = Console.ReadLine();
            double.TryParse(o2, out odd2);
            Console.Write("Draw: ");
            d = Console.ReadLine();
            double.TryParse(d, out draw);

            NormalEvent ne = new NormalEvent(eventCounter, descr, BookieEmail, odd1, odd2, draw);

            BetESS.AddEvent(sportname, eventCounter, ne, BookieEmail);
            BetESS.SubscribeBookieToEvent(ne, BookieEmail);
            BetESS.AddSubscribedEventTo(ne.getEventID(), BookieEmail);
            Console.WriteLine("Event was added successfully!");
            eventCounter++;
        }
 internal MariLoggerWriter(int _)
 {
     Semaphore  = new SemaphoreSlim(1, 1);
     LogsQueue  = new ConcurrentQueue <MariEventLogMessage>();
     WriteLog   = new NormalEvent <MariEventLogMessage>();
     IsDisposed = false;
     OnLog     += LogReceived;
 }
Example #3
0
        public async Task <BaseResponse> NormalEvent()
        {
            NormalEvent nomalEvent = new NormalEvent {
                Content = " hello "
            };

            _rabbitMqClient.SendMessage(nomalEvent);
            return(BaseResponse.Ok());
        }
        public MariLoggerSender(int _)
        {
            Semaphore   = new SemaphoreSlim(1, 1);
            LogsQueue   = new ConcurrentQueue <MariEventLogMessage>();
            SendLog     = new NormalEvent <MariEventLogMessage>();
            OnLogSender = new NormalEvent <MariEventLogMessage>();

            IsDisposed = false;

            OnLogReceived += LogReceived;
        }
 public async Task <BaseResponse> SendDirectNormalEvent( )
 {
     using (var connection = _connectionFactory.CreateConnection())
         using (var channel = connection.CreateModel())
         {
             channel.ExchangeDeclare(exchange: "bihu_api_exc",
                                     type: "direct", true);
             NormalEvent normalEvent = new NormalEvent();
             var         body        = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(normalEvent));
             channel.BasicPublish(exchange: "bihu_api_exc",
                                  routingKey: "NormalEvent",
                                  basicProperties: null,
                                  body: body);
             LogHelper.Info($"已发送:{"NormalEvent"},direct Message!");
         }
     return(BaseResponse.Ok());
 }