《拓文asp.net网站内容管理系统》官方演示站。
 设为首页  
 收藏本站
 作者:黄振安
 QQ:53854651
首 页 开源拓文.NET编程网站编程网页设计图形图像数据库软件工程留言本
    站内搜索:  
您现在的位置: 拓文网络 → .NET编程 → ASP.NET → ASP.NET实现用户在线检测的类源码[正文]

热 门 文 章

相 关 文 章
  • ASP.NET性能优化
  • 在.NET框架应用程序中发送电子邮件
  • .net打包自动安装数据库
  • asp.net开发wap必备:更好的匹配手机设备
  • 用ashx动态生成文件
  • windows 2003下asp.Net站点无法使用用户名+密码的方
  • ASP.NET中17种正则表达式
  • 提高ASP.Net应用程序性能的十大方法
  • 一个通过web.Mail发送邮件的类
  • 在DataGrid里面根据日期的不同显示new图标
  • ASP.NET实现用户在线检测的类源码
     
    [作者:不详    转贴自:不详    点击数:    更新时间:2006-3-17 20:33:12]


        //功能说明:将当前用户加入在线列表
        //如果该用户的数据当前仍然在在线列表中,则暂时先不让该用户登陆,提示用户存在
        public  bool    AddUserToOnLine(User  user)
        {
    #if  DEBUG
          (new  SohoProject.SohoDebug()).WriteToDoc("开始进入<将当前用户加入在线列表>....");
          (new  SohoProject.SohoDebug()).WriteToDoc("\r\n");
    #endif


          //开始搜索是否已经存在该用户,如果存在则是改变数据,否则添加新的用户
          string  strExpr;
          strExpr  =  "sessionid='"  +  user.sessionid  +  "'";  
          DataRow[]  curUser;
          //  Use  the  Select  method  to  find  all  rows  matching  the  filter.
    #if  DEBUG
          (new  SohoProject.SohoDebug()).WriteToDoc("搜索字符串:"  +  strExpr);
          (new  SohoProject.SohoDebug()).WriteToDoc("\r\n");
    #endif


          curUser  =  _alluser.Select(strExpr);

    #if  DEBUG
          (new  SohoProject.SohoDebug()).WriteToDoc(strExpr);
          (new  SohoProject.SohoDebug()).WriteToDoc(curUser.Length.ToString());
    #endif


          if  (curUser.Length  >0  )
          {
            for(int  i  =  0;  i  <  curUser.Length;  i  ++)
            {
              curUser[i]["curtime"]=DateTime.Now;
              curUser[i]["iswhere"]=user.iswhere;
            }
          }
          else
          {
            //直接加入新的数据
            DataRow  myRow;
            try
            {
              myRow  =  _alluser.NewRow();
              //  Then  add  the  new  row  to  the  collection.
              myRow["name"]  =  user.name;
              myRow["ip"]  =  user.ip;
              myRow["iswhere"]  =  user.iswhere;
              myRow["lasttime"]  =  user.lasttime;
              myRow["curtime"]  =  DateTime.Now;
              myRow["sessionid"]  =  user.sessionid;
              _alluser.Rows.Add(myRow);
            }
            catch(Exception  e)
            {
              throw(new  Exception(e  +  "--------------------"  +    e.ToString()))  ;
            }  
          }
          _alluser.AcceptChanges();
          return  true;
        }    
        

    首页 | 1 | 2 | 3 | 4 | 5 | 尾页  共 5 页
     
    winner 打印本页 关闭窗口

         文 章 评 论
    评论人 查看该文章的评论 发表时间
       笔 名* : 0 50分 60分 70分 80分 90分 100分
    评论内容 *: (最多1000字。当前字数:0)


    80 分丰富fffffff2006-4-6 23:50:33

    - 关于本站 - 网站帮助 - 下载声明 - 友情连接 - 网站地图 -
    Copyright © 2005-2006 myTopWin.Com. All Rights Reserved . [桂ICP备06004496号]