예제 #1
0
        public int AddLogin(VLogin item, string ipAddress)
        {
            var login = new Login();

            item.SessionId  = Guid.NewGuid().ToString() + login.LoginTime.ToString("yyyyMMddHHmmss");
            login.SessionId = item.SessionId;
            login.UserId    = item.User.Id;
            login.UserName  = item.User.Name;
            login.IPAddress = ipAddress;
            login.LoginTime = DateTime.UtcNow;

            var sql         = "update Login set IsDrop = 0  where UserId=@userId ";
            var dbParameter = new DbParameter[] {
                new SqlParameter()
                {
                    DbType = DbType.Int32, Value = item.User.Id, ParameterName = "@userId"
                },
            };

            _login.Exec(sql, dbParameter.ToArray());
            return(_login.Add(login));
        }
예제 #2
0
 public UserServices()
 {
     _user  = new User();
     _login = new Login();
     _departmentServices = new DepartmentServices();
 }