Ejemplo n.º 1
0
        public bool Register(string email, string password, string firstname, string lastname)
        {
            bool issuccess = false;

            using (DBGemmyService2 db = new DBGemmyService2())
            {
                var entity = db.T_USER_UserInfo.Where(m => m.Email == email).ToList();
                if (entity.Count == 0)
                {
                    password = MD5T.MD5Encrypt(password);
                    db.T_USER_UserInfo.Add(new T_USER_UserInfo()
                    {
                        FirstName = firstname,
                        Password  = password,
                        LastName  = lastname,
                        Email     = email
                    });
                    int n = db.SaveChanges();
                    if (n > 0)
                    {
                        issuccess = true;
                    }
                }
            }
            return(issuccess);
        }
Ejemplo n.º 2
0
        public T_USER_UserInfo Login(string email, string password)
        {
            string pwd = MD5T.MD5Encrypt(password);

            using (DBGemmyService2 db = new DBGemmyService2())
            {
                var entity = db.T_USER_UserInfo.Where(m => m.Email == email).FirstOrDefault();
                if (entity != null)
                {
                    //判断是否允许登录

                    if (entity.Password == pwd)
                    {
                        entity.CanLogin = true;
                    }
                    else
                    {
                        entity.NoPassword = true;
                    }
                    return(entity);
                }
                else
                {
                }
            }
            return(null);
        }
Ejemplo n.º 3
0
        public List <T_USER_UserInfo> getUserinfoLoginReset(string email, string password)
        {
            string pwd = MD5T.MD5Encrypt(password);

            using (DBGemmyService2 db = new DBGemmyService2())
            {
                var entity = db.T_USER_UserInfo.Where(m => m.Email == email && m.Password == pwd);
                return(entity.ToList());
            }
        }
Ejemplo n.º 4
0
 public void Reset(string email, string password)
 {
     using (DBGemmyService2 db = new DBGemmyService2())
     {
         var entity = db.T_USER_UserInfo.Where(m => m.Email == email).ToList();
         if (entity.Count != 0)
         {
             foreach (var item in entity)
             {
                 item.Password = MD5T.MD5Encrypt(password);
             }
             db.Configuration.ValidateOnSaveEnabled = false;
             db.SaveChanges();
             db.Configuration.ValidateOnSaveEnabled = true;
         }
     }
 }