Example #1
0
        public UserLoginHistory GetSingle(Int32 Id)
        {
            UserLoginHistory obj = new UserLoginHistory();

            try
            {
                string     query = "select * from user_login_history where ID = " + Id + "";
                SqlCommand cmd   = new SqlCommand(query, mySQLDBConnect.connection);
                mySQLDBConnect.OpenConnection();
                DataTable      dt = new DataTable();
                SqlDataAdapter dA = new SqlDataAdapter(cmd);
                dA.Fill(dt);
                obj = (from x in dt.AsEnumerable()
                       select new UserLoginHistory
                {
                    Id = x.Field <Int32>("id"),
                    UserId = x.Field <Int32>("user_id"),
                    LoginDate = x.Field <DateTime>("login_date"),
                    LoginIp = x.Field <String>("login_ip"),
                }).ToList().FirstOrDefault();
                mySQLDBConnect.CloseConnection();
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }
            return(obj);
        }
Example #2
0
        public string UpdateUserSession(UserLoginHistory userLoginHistory)
        {
            string query = "UPDATE userloginhistory SET LoggedOutTime = NOW(), IsActive = ?IsActive WHERE UserId = ?UserId AND SessionId = ?SessionId AND IsActive = 1 ";

            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.Parameters.Add(new MySqlParameter("?UserId", userLoginHistory.UserId));
                cmd.Parameters.Add(new MySqlParameter("?SessionId", userLoginHistory.SessionId));
                cmd.Parameters.Add(new MySqlParameter("?IsActive", false));

                using (MySqlConnection con = new MySqlConnection(DBConnection.ConnectionString))
                {
                    cmd.Connection = con;
                    con.Open();
                    cmd.CommandText = query;
                    cmd.ExecuteNonQuery();
                }
                return("Success");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        public string InsertLoginHistory(UserLoginHistory userLoginHistory)
        {
            string query = "INSERT  INTO userloginhistory (UserId, SessionId, LoggedInTime, IsActive) "
                           + "Values (?UserId, ?SessionId, NOW(), ?IsActive)";

            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.Parameters.Add(new MySqlParameter("?UserId", userLoginHistory.UserId));
                cmd.Parameters.Add(new MySqlParameter("?SessionId", userLoginHistory.SessionId));
                cmd.Parameters.Add(new MySqlParameter("?IsActive", true));

                using (MySqlConnection con = new MySqlConnection(DBConnection.ConnectionString))
                {
                    cmd.Connection = con;
                    con.Open();
                    cmd.CommandText = query;
                    cmd.ExecuteNonQuery();
                }
                return("Success");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #4
0
        public ActionResult Login(User objuser)
        {
            string redirect = "Login";

            User user = db.Users.Where(x => x.UserName == objuser.UserName && x.UserPassword == objuser.UserPassword).FirstOrDefault();

            if (user != null)
            {
                //new GernalFunction().SetCookie(user);
                new GernalFunction().setSession(user);
                TempData["Msg"] = "Login Successfully.";
                redirect        = "/";
                UserLoginHistory loginHistory = new UserLoginHistory();
                HttpRequest      req          = System.Web.HttpContext.Current.Request;
                string           browserName  = req.Browser.Browser;
                loginHistory.BrowserType     = browserName;
                loginHistory.CurrentUser     = user.UserName;
                loginHistory.HostName        = Dns.GetHostName();
                loginHistory.IsFailedAttempt = false;
                loginHistory.LoginDate       = DateTime.UtcNow;

                IPHostEntry ipEntry = Dns.GetHostEntry(loginHistory.HostName);

                IPAddress[] addr = ipEntry.AddressList;

                loginHistory.LoginIP      = addr[addr.Length - 1].ToString();
                loginHistory.PasswordUsed = objuser.UserPassword;
                loginHistory.PlateForm    = req.Browser.Platform;
                loginHistory.UserId       = user.ID;
                db.UserLoginHistories.Add(loginHistory);
                db.SaveChanges();
            }
            else
            {
                TempData["Msg"] = "User or Password incorrect.";
                redirect        = "/Login";
                UserLoginHistory loginHistory = new UserLoginHistory();
                HttpRequest      req          = System.Web.HttpContext.Current.Request;
                string           browserName  = req.Browser.Browser;
                loginHistory.BrowserType     = browserName;
                loginHistory.CurrentUser     = objuser.UserName;
                loginHistory.HostName        = Dns.GetHostName();
                loginHistory.IsFailedAttempt = true;
                loginHistory.LoginDate       = DateTime.UtcNow;

                IPHostEntry ipEntry = Dns.GetHostEntry(loginHistory.HostName);

                IPAddress[] addr = ipEntry.AddressList;

                loginHistory.LoginIP      = addr[addr.Length - 1].ToString();
                loginHistory.PasswordUsed = objuser.UserPassword;
                loginHistory.PlateForm    = req.Browser.Platform;
                loginHistory.UserId       = 1;
                db.UserLoginHistories.Add(loginHistory);
                db.SaveChanges();
            }
            return(Redirect(redirect));
        }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserLoginHistoryDTO"/> class.
 /// </summary>
 /// <param name="clh">
 /// The contact login history.
 /// </param>
 /// <param name="company">
 /// The company.
 /// </param>
 public UserLoginHistoryDTO(UserLoginHistory clh, Company company)
 {
     this.userLoginHistoryId = clh.Id;
     this.dateCreated        = clh.DateCreated.With(x => x.ConvertToUnixTimestamp());
     this.fromIP             = clh.FromIP;
     this.application        = clh.Application;
     this.userId             = clh.User.With(x => x.Id);
     this.userName           = clh.User.With(x => x.FullName);
     this.companyName        = company.With(x => x.CompanyName);
     this.companyId          = company.With(x => x.Id);
 }
Example #6
0
        public static void AddUserLastLoginLog(UserLoginHistory req)
        {
            var result = UserLastLoginLog.FirstOrDefault(u => u.PlayerId == req.PlayerId);

            if (result != null)
            {
                UserLastLoginLog.Remove(result);
            }

            UserLastLoginLog.Add(req);
        }
 public UserLoginHistory UpdateData(UserLoginHistory obj)
 {
     try
     {
         obj = IUserLoginHistoryRepo.UpdateData(obj);
     }
     catch (Exception ex)
     {
         Console.Write(ex.ToString());
     }
     return(obj);
 }
Example #8
0
 public void UpdateUserLoginHistory(UserLoginHistory objUserLoginHistory)
 {
     try
     {
         context.Entry(objUserLoginHistory).State = EntityState.Modified;
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #9
0
 public void InsertUserLoginHistory(UserLoginHistory objUserLoginHistory)
 {
     try
     {
         objUserLoginHistory.LoginDateTime = DateTime.Now;
         context.UserLoginHistories.Add(objUserLoginHistory);
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public static void LogUserAccess(string UserName, Boolean IsSucess, string Comments = "")
        {
            Model.UserLoginHistory _userAccess = new UserLoginHistory
            {
                UserName   = UserName,
                IsSuccess  = IsSucess,
                Comments   = Comments,
                CreateDate = DateTime.Now
            };

            context.UserLoginHistories.Add(_userAccess);
            context.SaveChanges();
        }
Example #11
0
 public void DeleteUserLoginHistory(int userLoginHistoryId)
 {
     try
     {
         UserLoginHistory objUserLoginHistory = context.UserLoginHistories.Find(userLoginHistoryId);
         context.UserLoginHistories.Remove(objUserLoginHistory);
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public UserLoginHistory DeleteData(Int32 Id)
        {
            UserLoginHistory obj = new UserLoginHistory();

            try
            {
                obj = IUserLoginHistoryRepo.DeleteData(Id);
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }
            return(obj);
        }
        private static IEnumerable <UserLoginHistory> MAPHistoryEntitites(SqlDataReader Reader)
        {
            List <UserLoginHistory> UsersHistory = new List <UserLoginHistory>();

            while (Reader.Read())
            {
                UserLoginHistory SingleRecord = new UserLoginHistory();
                SingleRecord.UserID   = (int)(Reader["UserId"]);
                SingleRecord.DateTime = (DateTime)(Reader["LoginTime"]);
                UsersHistory.Add(SingleRecord);
            }

            return(UsersHistory);
        }
Example #14
0
        void IFitAppManager.SaveLoginHistory(UserLoginHistory logHistory)
        {
            var existing = Context.UserHistory.SingleOrDefault(s => s.UserId == logHistory.UserId);

            if (existing != null)
            {
                existing.LastLoggenOn = logHistory.LastLoggenOn;
            }
            else
            {
                Context.UserHistory.Add(logHistory);
            }
            Context.SaveChanges();
        }
        public IActionResult Authenticate([FromBody] AuthenticateModel model)
        {
            try
            {
                var user = _userService.Authenticate(model.UsernameOrEmail, model.Password);

                if (user == null)
                {
                    return(BadRequest(new { message = "Username or password is incorrect" }));
                }

                var tokenHandler    = new JwtSecurityTokenHandler();
                var key             = Encoding.ASCII.GetBytes(_appSettings.Secret);
                var tokenDescriptor = new SecurityTokenDescriptor
                {
                    Subject = new ClaimsIdentity(new Claim[]
                    {
                        new Claim(ClaimTypes.Name, user.Id.ToString())
                    }),
                    Expires            = DateTime.UtcNow.AddDays(1),
                    SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature)
                };
                var token       = tokenHandler.CreateToken(tokenDescriptor);
                var tokenString = tokenHandler.WriteToken(token);

                //    // create login history
                UserLoginHistory loginHistory = new UserLoginHistory();
                loginHistory.User          = user;
                loginHistory.LoginDate     = DateTime.UtcNow;
                loginHistory.RequestOrigin = $@"IP Address: {_accessor.ActionContext.HttpContext.Connection.RemoteIpAddress.ToString()} Host: {_accessor.ActionContext.HttpContext.Request.Host.ToString()}";

                //throw new AppException("Exceptoin aa gayi");
                // return basic user info and authentication token
                return(Ok(new
                {
                    Id = user.Id,
                    Username = user.Username,
                    FirstName = user.FirstName,
                    LastName = user.LastName,
                    Email = user.Email,
                    Token = tokenString
                }));
            }
            catch (AppException ex)
            {
                _logger.LogError(ex, ex.Message, ex.StackTrace);
                return(BadRequest(new { message = ex.Message }));
            }
        }
Example #16
0
        public ActionResult UpdateUserSession()
        {
            //TODO - Need to pass the Session
            UserLoginHistory userLoginHistory = new UserLoginHistory();

            userLoginHistory.UserId    = Convert.ToInt64(HttpContext.Session["UserId"]);
            userLoginHistory.SessionId = HttpContext.Session.SessionID;
            string sResults = _login.UpdateUserSession(userLoginHistory);

            HttpContext.Session.Clear();
            HttpContext.Session.Remove("UserId");
            HttpContext.Session.Remove("FirstName");
            HttpContext.Session.Remove("LastName");
            return(RedirectToAction("Index", "Home"));
        }
Example #17
0
        //public IEnumerable<int> GetAllDependantUserIdsIncludingCurrent(User user)
        //{
        //    List<int> result =
        //        this.Repository.StoreProcedureForMany<int>(
        //            "GetChildUserIds",
        //            new StoreProcedureParam<int>("UserId", user.Id)).ToList();
        //    result.Add(user.Id);
        //    return result;
        //}

        /// <summary>
        /// The get all for company.
        /// </summary>
        /// <param name="companyId">
        /// The company id.
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable{User}"/>.
        /// </returns>
        public IEnumerable <UserWithLoginHistoryDTO> GetAllForCompany(int companyId)
        {
            var              queryOver = new QueryOverUser().GetQueryOver().Where(x => x.Company.Id == companyId).Fetch(x => x.UserRole).Eager;
            var              users     = this.Repository.FindAll(queryOver).ToList();
            var              usersIds  = users.Select(x => x.Id).ToList();
            User             u         = null;
            UserLoginHistory h         = null;
            UserLastLoginFromStoredProcedureDTO dto = null;
            var queryOver2 = new QueryOverUser().GetQueryOver(() => u).WhereRestrictionOn(() => u.Id).IsIn(usersIds)
                             .JoinQueryOver(() => u.LoginHistory, () => h).OrderBy(() => h.DateCreated).Desc
                             .SelectList(l => l.Select(() => u.Id).WithAlias(() => dto.userId).Select(() => h.DateCreated).WithAlias(() => dto.loginDate))
                             .TransformUsing(Transformers.AliasToBean <UserLastLoginFromStoredProcedureDTO>()).Take(1);
            var logindatesForUsers = this.Repository.FindAll <UserLastLoginFromStoredProcedureDTO>(queryOver2).ToList();

            return(users.Select(x => new UserWithLoginHistoryDTO(x, logindatesForUsers.FirstOrDefault(hl => hl.userId == x.Id).Return(hl => hl.loginDate, (DateTime?)null))));
        }
Example #18
0
        public ActionResult LogOut()
        {
            var authenticationManager = HttpContext.GetOwinContext().Authentication;

            authenticationManager.SignOut();

            var logHistory = new UserLoginHistory()
            {
                UserId       = User.Identity.GetUserId(),
                LastLoggenOn = DateTime.Now
            };

            _repository.SaveLoginHistory(logHistory);

            return(RedirectToAction("Index", "Home"));
        }
Example #19
0
 public UserLoginHistory UpdateData(UserLoginHistory obj)
 {
     try
     {
         string     query = obj.ObjectToQuery <UserLoginHistory>("update");
         SqlCommand cmd   = new SqlCommand(query, mySQLDBConnect.connection);
         mySQLDBConnect.OpenConnection();
         cmd.ExecuteNonQuery();
         mySQLDBConnect.CloseConnection();
     }
     catch (Exception ex)
     {
         Console.Write(ex.ToString());
     }
     return(obj);
 }
Example #20
0
 public UserLoginHistory PostData(UserLoginHistory obj)
 {
     try
     {
         string     query = obj.ObjectToQuery <UserLoginHistory>("insert") + "SELECT SCOPE_IDENTITY()";
         SqlCommand cmd   = new SqlCommand(query, mySQLDBConnect.connection);
         mySQLDBConnect.OpenConnection();
         // cmd.ExecuteNonQuery();
         obj.Id = Convert.ToInt32(cmd.ExecuteScalar());
         mySQLDBConnect.CloseConnection();
     }
     catch (Exception ex)
     {
         Console.Write(ex.ToString());
     }
     return(obj);
 }
Example #21
0
        public ActionResult ValidateLogin(Users users)
        {
            //TODO - Need to pass the Session
            users.SessionId = Guid.NewGuid().ToString();
            //users.Password = Encryptioncs.RsaEncrypt(users.Password);
            Users objUsers = _login.ValidateLogin(users);

            if (!string.IsNullOrEmpty(objUsers.Email))
            {
                if (users.Password.Equals(objUsers.Password))
                {
                    TempData["UserLoginFailed"] = "Invalid Password. Please try again.";
                    return(View("AuthorLogin"));
                }
                else
                {
                    HttpContext.Session["UserId"]    = objUsers.UserId.ToString();
                    HttpContext.Session["FirstName"] = objUsers.FirstName.ToString();
                    HttpContext.Session["LastName"]  = objUsers.LastName.ToString();
                    HttpContext.Session["Email"]     = objUsers.Email.ToString();

                    //var claims = new List<Claim>
                    //{
                    //    new Claim(ClaimTypes.Email, objUsers.Email)
                    //};

                    //ClaimsIdentity userIdentity = new ClaimsIdentity(claims, "login");
                    //ClaimsPrincipal principal = new ClaimsPrincipal(userIdentity);

                    //await HttpContext.SignInAsync(principal);
                    UserLoginHistory userLoginHistory = new UserLoginHistory();
                    userLoginHistory.UserId    = objUsers.UserId;
                    userLoginHistory.SessionId = HttpContext.Session.SessionID;
                    _login.InsertLoginHistory(userLoginHistory);

                    TempData["UserLoginFailed"] = "Logged in Successfully.";
                    return(RedirectToAction("Index", "Author"));
                }
            }
            else
            {
                TempData["UserLoginFailed"] = "Invalid Username or Password. Please try again.";
                return(View("AuthorLogin"));
            }
        }
        public async Task <UserLoginHistory> RecordUserLogin(int userId, TokenType type, string provider, string audience)
        {
            var userLoginHistory = new UserLoginHistory
            {
                UserId    = userId,
                TokenType = type,
                Provider  = provider,
                Audience  = audience,
                LoginDate = DateTime.UtcNow
            };

            using (var uow = new UnitOfWork(Context))
            {
                var repo = new UserLoginHistoryRepository(uow);

                return(await repo.Create(userLoginHistory));
            }
        }
Example #23
0
 public List <Int64> TeamLogin(string username, string password, short counterNumber, string teamName)
 {
     try
     {
         using (Cafeteria_Vernier_dbEntities cvDatabase = new Cafeteria_Vernier_dbEntities())
         {
             var teamInfo = cvDatabase.TeamAccounts.FirstOrDefault(x => x.Team.Name.Equals(teamName) &&
                                                                   x.Status == false);
             var memberInfo  = cvDatabase.TeamMembers.FirstOrDefault(x => x.UserID.Equals(username));
             var userInfo    = cvDatabase.CustomerAccounts.FirstOrDefault(x => x.UserID.Equals(username) && x.Password.Equals(password));
             var isTeamAdmin = cvDatabase.Teams.FirstOrDefault(x => x.Name.Equals(teamName) && x.AdminName.Equals(username));
             if (teamInfo != null && (memberInfo != null || isTeamAdmin != null) && userInfo != null)
             {
                 UserLoginHistory newUserLoginHistory = new UserLoginHistory
                 {
                     AutoInc       = default(long),
                     CounterNumber = counterNumber,
                     StratTime     = DateTime.Now,
                     TeamName      = teamName,
                     UserID        = username
                 };
                 cvDatabase.AddToUserLoginHistories(newUserLoginHistory);
                 teamInfo.Status = true;
                 var userinfo = cvDatabase.CustomerAccounts.FirstOrDefault(x => x.UserID.Equals(username));
                 userinfo.Status        = false;
                 userinfo.Counternumber = counterNumber;
                 cvDatabase.SaveChanges();
                 List <Int64> teamLoginInfo = new List <Int64>();
                 teamLoginInfo.Add(teamInfo.Minutes);
                 teamLoginInfo.Add(newUserLoginHistory.AutoInc);
                 return(teamLoginInfo);
             }
             else
             {
                 throw new FaultException(ServiceVariables.ERROR_MESSAGES[0, 1]);
             }
         }
     }
     catch (Exception error)
     {
         throw new FaultException(error.Message);
     }
 }
Example #24
0
 public List <Int64> UserLogin(string username, string password, short counterNumber)
 {
     try
     {
         using (Cafeteria_Vernier_dbEntities cvDatabase = new Cafeteria_Vernier_dbEntities())
         {
             var loginfo = cvDatabase.CustomerAccounts.FirstOrDefault(x => x.UserID.Equals(username) &&
                                                                      x.Password.Equals(password) &&
                                                                      x.Minutes > 1 &&
                                                                      x.Status == false);
             if (loginfo != null)
             {
                 UserLoginHistory newLoginHistory = new UserLoginHistory
                 {
                     AutoInc       = default(long),
                     CounterNumber = counterNumber,
                     StratTime     = DateTime.Now,
                     UserID        = username,
                 };
                 cvDatabase.AddToUserLoginHistories(newLoginHistory);
                 loginfo.Status        = true;
                 loginfo.Counternumber = counterNumber;
                 cvDatabase.SaveChanges();
                 List <Int64> customerinfo = new List <Int64>();
                 customerinfo.Add(loginfo.Minutes);
                 customerinfo.Add(newLoginHistory.AutoInc);
                 return(customerinfo);
             }
             else
             {
                 throw new FaultException(ServiceVariables.ERROR_MESSAGES[0, 0]);
             }
         }
     }
     catch (Exception error)
     {
         throw new FaultException(error.Message);
     }
 }
Example #25
0
        public ActionResult ValidateEditorLogin(Users users)
        {
            //TODO - Need to pass the Session
            users.SessionId = Guid.NewGuid().ToString();
            //users.Password = IJERTSEncryptioncs.RsaEncrypt(users.Password);
            users.UserType = "E";
            Users objUsers = _login.ValidateLogin(users);

            if (!string.IsNullOrEmpty(objUsers.Email))
            {
                if (!users.Password.Equals(objUsers.Password))
                {
                    TempData["UserLoginFailed"] = "Invalid Password. Please try again.";
                    return(View("EditorLogin"));
                }
                else
                {
                    HttpContext.Session["UserId"]    = objUsers.UserId.ToString();
                    HttpContext.Session["FirstName"] = objUsers.FirstName.ToString();
                    HttpContext.Session["LastName"]  = objUsers.LastName.ToString();
                    HttpContext.Session["UserType"]  = objUsers.UserType.ToString();
                    HttpContext.Session["Email"]     = objUsers.Email.ToString();


                    UserLoginHistory userLoginHistory = new UserLoginHistory();
                    userLoginHistory.UserId    = objUsers.UserId;
                    userLoginHistory.SessionId = HttpContext.Session.SessionID;
                    _login.InsertLoginHistory(userLoginHistory);

                    TempData["UserLoginFailed"] = "Logged in Successfully.";
                    return(RedirectToAction("Index", "Editor"));
                }
            }
            else
            {
                TempData["UserLoginFailed"] = "Invalid Username or Password. Please try again.";
                return(View("EditorLogin"));
            }
        }
Example #26
0
        public Int32 DeleteBulkData(List <Int32> Ids)
        {
            Int32 result = 0;

            try
            {
                string query = "";
                Ids.ForEach(Id =>
                {
                    UserLoginHistory obj = GetSingle(Id);
                    query += obj.ObjectToQuery <UserLoginHistory>("update");
                });
                SqlCommand cmd = new SqlCommand(query, mySQLDBConnect.connection);
                mySQLDBConnect.OpenConnection();
                result = cmd.ExecuteNonQuery();
                mySQLDBConnect.CloseConnection();
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }
            return(result);
        }
Example #27
0
        public UserLoginHistoryDetailModel(UserLoginHistory userLoginHistory)
            : this()
        {
            Id = userLoginHistory.Id;

            UserId   = userLoginHistory.UserId;
            Username = userLoginHistory.UserId.HasValue ? (string.IsNullOrEmpty(userLoginHistory.User.Username) ? userLoginHistory.User.Email : userLoginHistory.User.Username) : string.Empty;

            IpAddress               = userLoginHistory.IpAddress;
            Platform                = userLoginHistory.Platform;
            OsVersion               = userLoginHistory.OsVersion;
            BrowserType             = userLoginHistory.BrowserType;
            BrowserName             = userLoginHistory.BrowserName;
            BrowserVersion          = userLoginHistory.BrowserVersion;
            MajorVersion            = userLoginHistory.MajorVersion;
            MinorVersion            = userLoginHistory.MinorVersion;
            IsBeta                  = userLoginHistory.IsBeta;
            IsCrawler               = userLoginHistory.IsCrawler;
            IsAOL                   = userLoginHistory.IsAOL;
            IsWin16                 = userLoginHistory.IsWin16;
            IsWin32                 = userLoginHistory.IsWin32;
            SupportsFrames          = userLoginHistory.SupportsFrames;
            SupportsTables          = userLoginHistory.SupportsTables;
            SupportsCookies         = userLoginHistory.SupportsCookies;
            SupportsVBScript        = userLoginHistory.SupportsVBScript;
            SupportsJavaScript      = userLoginHistory.SupportsJavaScript;
            SupportsJavaApplets     = userLoginHistory.SupportsJavaApplets;
            SupportsActiveXControls = userLoginHistory.SupportsActiveXControls;
            JavaScriptVersion       = userLoginHistory.JavaScriptVersion;
            RawAgentString          = userLoginHistory.RawAgentString;

            Created      = userLoginHistory.Created;
            CreatedBy    = userLoginHistory.CreatedBy;
            LastUpdate   = userLoginHistory.LastUpdate;
            LastUpdateBy = userLoginHistory.LastUpdateBy;
        }
Example #28
0
        public Guid?Login(LoginRequest request)
        {
            var email = _userProfileRepository.GetSingleNoneDeleted(x => x.Email == request.Email);
            var pwd   = CryptoMd5.Encode(request.Password);

            if (email != null && pwd == email.Password)
            {
                var newUserLoginHistory = new UserLoginHistory
                {
                    UserId       = Constants.GetUserId(),
                    AccessToken  = Guid.NewGuid(),
                    IsAppToken   = true,
                    IsLoggedOut  = false,
                    CreatedBy    = Constants.GetUserId(),
                    ModifiedBy   = Constants.GetUserId(),
                    CreatedDate  = Constants.GetDateNow(),
                    ModifiedDate = Constants.GetDateNow()
                };
                _userLoginHistoryRepository.Add(newUserLoginHistory);
                _userLoginHistoryRepository.Commit();
                return(newUserLoginHistory.AccessToken);
            }
            return(null);
        }
 internal ResponseModel Delete(UserLoginHistory userLoginHistory)
 {
     return(_userLoginHistoryRepository.Delete(userLoginHistory));
 }
Example #30
0
 public void AddToUserLoginHistories(UserLoginHistory userLoginHistory)
 {
     base.AddObject("UserLoginHistories", userLoginHistory);
 }
 public ResponseModel Insert(UserLoginHistory userLoginHistory)
 {
     return(_userLoginHistoryRepository.Insert(userLoginHistory));
 }
Example #32
0
 public static UserLoginHistory CreateUserLoginHistory(int userLoginHistoryID, string loginStatus, global::System.DateTime loginDate)
 {
     UserLoginHistory userLoginHistory = new UserLoginHistory();
     userLoginHistory.UserLoginHistoryID = userLoginHistoryID;
     userLoginHistory.LoginStatus = loginStatus;
     userLoginHistory.LoginDate = loginDate;
     return userLoginHistory;
 }