コード例 #1
0
        public ClientLogInfo GetClientInfoLog()
        {
            var log = new ClientLogInfo();

            log.Ip = Request.HttpContext.Connection.RemoteIpAddress.ToString();

            if (Request.Headers.ContainsKey(HeaderNames.UserAgent))
            {
                log.UserAgent       = Request.Headers[HeaderNames.UserAgent].ToString();
                log.Platform        = "";
                log.PlatformVersion = "";
                log.Browser         = "";
                log.BrowserVersion  = "";
            }

            if (Request.Headers.ContainsKey(ConstantHelper.HEADER_X_COUNTRY))
            {
                log.Country = Request.Headers[ConstantHelper.HEADER_X_COUNTRY].ToString();
            }

            if (Request.Headers.ContainsKey(ConstantHelper.HEADER_X_CITY))
            {
                log.City = Request.Headers[ConstantHelper.HEADER_X_CITY].ToString();
            }

            return(log);
        }
コード例 #2
0
        public static ClientLogInfo GetClientLogInfo()
        {
            var clientLogInfo = new ClientLogInfo();

            clientLogInfo.Country = StringOne;
            clientLogInfo.City    = StringOne;
            clientLogInfo.Ip      = IpOne;

            return(clientLogInfo);
        }
コード例 #3
0
 private void MapClientLogInfo(ClientLogInfo clientLogInfo, UserLoginLog entity)
 {
     entity.UserAgent       = clientLogInfo.UserAgent;
     entity.Platform        = clientLogInfo.Platform;
     entity.PlatformVersion = clientLogInfo.PlatformVersion;
     entity.Browser         = clientLogInfo.Browser;
     entity.BrowserVersion  = clientLogInfo.BrowserVersion;
     entity.Ip      = clientLogInfo.Ip;
     entity.Country = clientLogInfo.Country;
     entity.City    = clientLogInfo.City;
 }
コード例 #4
0
        public static void LogDisconnectedClient(Client client, bool expected)
        {
            ClientLogInfo logInfo = new ClientLogInfo(client, expected);
            string        file    = CUR_PACKET_LOG_DIRECTORY + client.Id.ToString() + ".clog";

            try
            {
                using (FileStream fs = File.OpenWrite(file))
                {
                    fs.Seek(0, SeekOrigin.Begin);
                    using (GZipStream gzs = new GZipStream(fs, CompressionLevel.Optimal))
                        logFormatter.Serialize(gzs, logInfo);
                }
            }
            catch (IOException) { }
        }
コード例 #5
0
        public SignUpRequest(string organizationName, string firstName, string lastName,
                             string email, string password, ClientLogInfo clientLogInfo,
                             Guid languageUid = default)
        {
            if (organizationName.IsEmpty())
            {
                ThrowArgumentException(nameof(organizationName), organizationName);
            }

            if (firstName.IsEmpty())
            {
                ThrowArgumentException(nameof(firstName), firstName);
            }

            if (lastName.IsEmpty())
            {
                ThrowArgumentException(nameof(lastName), lastName);
            }

            if (email.IsNotEmail())
            {
                ThrowArgumentException(nameof(email), email);
            }

            if (password.IsNotValidPassword())
            {
                ThrowArgumentException(nameof(password), password);
            }

            if (clientLogInfo == null)
            {
                ThrowArgumentException(nameof(clientLogInfo), null);
            }

            if (languageUid.IsNotEmptyGuid())
            {
                LanguageUid = languageUid;
            }

            OrganizationName = organizationName;
            FirstName        = firstName;
            LastName         = lastName;
            Email            = email;
            Password         = password;
            ClientLogInfo    = clientLogInfo;
        }
コード例 #6
0
        public LogOnRequest(string email, string password, ClientLogInfo clientLogInfo)
        {
            if (email.IsNotEmail())
            {
                ThrowArgumentException(nameof(email), email);
            }

            if (password.IsNotValidPassword())
            {
                ThrowArgumentException(nameof(password), "");
            }

            if (clientLogInfo == null)
            {
                ThrowArgumentException(nameof(clientLogInfo), null);
            }

            Email         = email;
            Password      = password;
            ClientLogInfo = clientLogInfo;
        }