您目前尚未登陆,请选择【登陆】或【注册
首页->聊天计数->NChat简易聊天室源码(.Net 3.5,LINQ,AJAX)>>NChart.DBHelper/UserHelper.cs>>代码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:NChat简易聊天室源码(.Net 3.5,LINQ,AJAX)


当前文件路径:NChat/NChart.DBHelper/UserHelper.cs 文件类型
普通视图
		            
1using System; 2using System.Collections.Generic; 3using System.Linq; 4using System.Text; 5using System.Data.Linq; 6using System.Web; 7using NChat.Common; 8//该源码下载自www.51aspx.com(51aspx.com) 9namespace NChart.DBHelper 10{ 11 public abstract class UserHelper 12 { 13 public static User Login(User user) 14 { 15 NChatDataContext context = NChatData.Instance; 16 var users = from u in context.Users 17 where u.Name == user.Name && u.Password == user.Password 18 select u; 19 if (users.Count() > 0) 20 return users.Single(); 21 else 22 { 23 if (!IsExits(user)) 24 { 25 Register(user); 26 return Login(user); 27 } 28 else 29 { 30 user.ID = -1; 31 return user; 32 } 33 } 34 } 35//5_1_a_s_p_x.c_o_m 36 37 public static bool IsExits(User user) 38 { 39 NChatDataContext context = NChatData.Instance; 40 var users = from u in context.Users 41 where u.Name == user.Name 42 select u; 43 if (users.Count() > 0) 44 return true; 45 else 46 return false; 47 } 48 49 public static void Register(User user) 50 { 51 NChatDataContext context = NChatData.Instance; 52 context.Users.InsertOnSubmit(user); 53 context.SubmitChanges(); 54 } 55 56 public static IQueryable<User> Users() 57 { 58 NChatDataContext context = NChatData.Instance; 59 var users = from user in context.Users 60 select user; 61 return users; 62 } 63 } 64} 65
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:NChat简易聊天室源码(.Net 3.5,LINQ,AJAX)

- 面向对象实例之数据操作项目源码

- 最简购物车(Access)源码

- GridView实用示例源码附加导..

- Asp.net简单XML新闻发布系统

- Asp.net2.0车票管理系统

- 成幻(CHSNS#)SNS1.22版源码

- 简单新闻管理系统(Access数据..

- 明日Asp.net在线论坛源码

51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号