Exemple #1
0
        public bool Add(string UserName, string SystemID)
        {
            AUTH_LOGIN_LOG LoginLog = new AUTH_LOGIN_LOG();

            LoginLog.LOG_ID           = LoginLogRepository.GetNewID("AUTH_LOGIN_LOG", "LOG_ID");
            LoginLog.LOGIN_PC         = System.Net.Dns.Resolve(System.Net.Dns.GetHostName()).AddressList[0].ToString();
            LoginLog.LOGIN_TIME       = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
            LoginLog.SYSTEM_SYSTEM_ID = SystemID;
            LoginLog.USER_USER_ID     = UserRepository.GetSingle(i => i.USER_NAME == UserName).USER_ID;

            LoginLogRepository.Add(LoginLog);
            LoginLogRepository.SaveChanges();
            return(true);
        }
Exemple #2
0
        public void SubmitForm(LoginLogInputDto loginLogInputDto, string keyValue)
        {
            LoginLog loginLog = new LoginLog();

            if (!string.IsNullOrEmpty(keyValue))
            {
            }
            else
            {
                AutoMapper.Mapper.Map <LoginLogInputDto, LoginLog>(loginLogInputDto, loginLog);
                loginLog.Id           = IdWorkerHelper.GenId64();
                loginLog.DeletedMark  = false;
                loginLog.CreationTime = DateTime.Now;
                loginLogRepository.Add(loginLog);
            }
        }
Exemple #3
0
        public bool CreateLoginLog(string login_time, string user_name, Guid system_ID, string ipaddress)
        {
            var userid = UserRepository.GetQueryable().Where(s => s.UserName == user_name).Select(s => new { userId = s.UserID });

            if (userid.ToArray().Length > 0)
            {
                var LoginLog = new LoginLog()
                {
                    LogID           = Guid.NewGuid(),
                    LoginPC         = ipaddress,
                    LoginTime       = login_time,
                    LogoutTime      = "",
                    User_UserID     = userid.ToArray()[0].userId,
                    System_SystemID = system_ID
                };
                LoginLogRepository.Add(LoginLog);
                LoginLogRepository.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }