Ejemplo n.º 1
0
 /// <summary>
 ///  成功登录后修改数据库中的信息:如LastOS,lastIP
 /// </summary>
 /// <param name="user"></param>
 public bool UpdateUser(User user)
 {
     using(Kerberos_SsoEntities kerbSso = new Kerberos_SsoEntities())
     {
         User oldUser = kerbSso.User.FirstOrDefault(k => k.UserCode == user.UserCode);
         kerbSso.Attach(oldUser);
         kerbSso.ApplyPropertyChanges("User", user);
         return (kerbSso.SaveChanges() == 1);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 用于用户登录是否成功的判断
 /// </summary>
 /// <param name="userName"></param>
 /// <param name="userPwd"></param>
 /// <returns></returns>
 public bool Login(string userName,string userPwd)
 {
     using (Kerberos_SsoEntities kerbSso = new Kerberos_SsoEntities())
     {
         var obj = from u in kerbSso.User
                   where u.LoginName == userName && u.Password == userPwd
                   select u;
         return obj == null ? false : true;
     }
 }
Ejemplo n.º 3
0
 public User GetUser(string userName,string userPwd)
 {
     using (Kerberos_SsoEntities kerbSso = new Kerberos_SsoEntities())
     {
         var obj = from u in kerbSso.User
                   where u.LoginName == userName && u.Password == userPwd
                   select u;
         return obj == null ? null : obj.FirstOrDefault();
     }
 }
Ejemplo n.º 4
0
 public User GetUser(string uid)
 {
     try
     {
         using (Kerberos_SsoEntities kerbSso = new Kerberos_SsoEntities())
         {
             var user = from u in kerbSso.User
                        where u.UserCode == uid
                        select u;
             return user == null ? null : user.FirstOrDefault();
         }
     }
     catch (System.Exception ex)
     {
         Console.WriteLine("Exception is :" + ex.Message);
     }
     return null;
 }