示例#1
0
        protected void RegisterOnlineUser(Maticsoft.Model.tUsers user)
        {
            Maticsoft.BLL.S_Onlines   bll    = new Maticsoft.BLL.S_Onlines();
            Maticsoft.Model.S_Onlines online = bll.GetModelByUseId(user.userId);

            DateTime now = DateTime.Now;

            // 如果不存在,就创建一条新的记录
            if (online == null)
            {
                online            = new Maticsoft.Model.S_Onlines();
                online.UserId     = user.userId;
                online.IpAdddress = Request.UserHostAddress;
                online.LoginTime  = now;
                online.UpdateTime = now;

                bll.Add(online);
            }
            else
            {
                online.UserId     = user.userId;
                online.IpAdddress = Request.UserHostAddress;
                online.LoginTime  = now;
                online.UpdateTime = now;
                bll.Update(online);
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadData();
                Maticsoft.Model.tUsers user = GetIdentityUser();
                btnUserName.Text = user.usersName;

                Maticsoft.BLL.tSet bll = new Maticsoft.BLL.tSet();
                model = bll.GetModel(1);
                Maticsoft.BLL.S_Onlines   bllOn  = new Maticsoft.BLL.S_Onlines();
                Maticsoft.Model.S_Onlines online = bllOn.GetModelByUseId(user.userId);

                CreateNotify("您上次登陆时间是:" + online.UpdateTime, "Self", "登录提示", 0, false);
            }
        }