/// <summary> Handle the messages from RabbitMQ
        ///<para>Messages are separated according to their queue. Then json is converted into the respective queue object</para>
        /// </summary>
        ///
        private void OnReceivedMessageBrowser(object consumer, BasicDeliverEventArgs eventArgs)
        {
            string             message    = DecodeEventArgBody(eventArgs.Body);
            BrowserInformation browserObj = BrowserInformation.FromJson(message);

            string key = GenerateRandomGuidString();

            db.BrowserInformations.ContainsAsync(browserObj).ContinueWith((result) =>
            {
                if (!result.Result)
                {
                    AddObjectIntoSqlDatabase(browserObj);
                    //Add BrowserInformation into Couchbase bucket
                    _bucket.Upsert(key, new
                    {
                        Ip          = browserObj.Ip,
                        PageName    = browserObj.PageName,
                        BrowserName = browserObj.BrowserName,
                        Type        = browserObj.GetType().Name
                    });
                }
                else
                {
                    Console.WriteLine("Already exists in database");
                }
            });
        }
Beispiel #2
0
        public void Defaults()
        {
            BrowserInformation bi = HtmlPage.BrowserInformation;

            // according to documentation ProductName and ProductVersion are extracted from userAgent
            Assert.IsTrue(bi.UserAgent.Contains(bi.ProductName), "ProductName");
            Assert.IsTrue(bi.UserAgent.Contains(bi.ProductVersion), "ProductVersion");
        }
Beispiel #3
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            BrowserInformation b = HtmlPage.BrowserInformation;

            lblInfo.Text  = "Name: " + b.Name;
            lblInfo.Text += "\nBrowser Version: " + b.BrowserVersion;
            lblInfo.Text += "\nPlatform: " + b.Platform;
            lblInfo.Text += "\nCookies Enabled: " + b.CookiesEnabled;
            lblInfo.Text += "\nUser Agent: " + b.UserAgent;
        }
Beispiel #4
0
 public void SaveInformations(BrowserInformation browserInformation)
 {
     try
     {
         _unitOfWork.BrowserInformationRepository.SaveInformations(browserInformation);
         _unitOfWork.Commit();
     }
     catch (Exception ex)
     {
         new ExceptionsLog().SaveExceptionLogs(ex);
     }
 }
        public IActionResult SaveInformations(string pageName)
        {
            BrowserInformation information = new BrowserInformation()
            {
                IPAdress    = Request.HttpContext.Connection.RemoteIpAddress.ToString(),
                BrowserName = _detection.Browser.Type.ToString(),
                PageName    = pageName
            };

            _facade.SaveInformations(information);

            return(Ok());
        }
 public void SaveInformations(BrowserInformation browserInformation)
 {
     _context.BrowserInformation.Add(browserInformation);
 }