/// <summary> /// 新增和修改操作 /// </summary> /// <param name="online"></param> /// <param name="isSave"></param> public void Save(T_Online online,bool isSave) { if (isSave) { _onlineRepository.Add(online); } else { _onlineRepository.Update(online); } }
protected void RegisterOnlineUser(T_User user) { T_Online online = tOnlineService.GetTOnlineByUserCode(user.UserCode); bool flag = false; // 如果不存在,就创建一条新的记录 if (online == null) { online = new T_Online(); flag = true; } DateTime now = DateTime.Now; //online.T_User = user; online.IPAdddress = Request.UserHostAddress; online.LoginTime = now; online.UpdateTime = now; online.UserCode = user.UserCode; tOnlineService.Save(online, flag); // 记录本次更新时间 Session[SK_ONLINE_UPDATE_TIME] = now; }