Exemple #1
0
        //修改密码
        public bool ForgetPassword(string id, string pw)
        {
            //用户信息
            User us;
            //数据库实例
            MyDbEntities myDbEntities = new MyDbEntities();
            //选中这一条数据
            var q = from t in myDbEntities.User
                    where t.Acount == id
                    select t;

            if (q != null)
            {
                us = q.FirstOrDefault();
                if (us == null)
                {
                    return(false);
                }
                us.Password = pw;
                try
                {
                    myDbEntities.SaveChanges();
                }
                catch (Exception)
                {
                    return(false);
                }
                return(true);
            }
            return(false);
        }
Exemple #2
0
        //远程注册
        public bool Registered(string id, string pw, string sn, string name)
        {
            User         us           = new User();
            MyDbEntities myDbEntities = new MyDbEntities();

            us.Acount   = id;
            us.Password = pw;
            us.Sign     = sn;
            us.Name     = name;
            try
            {
                myDbEntities.User.Add(us);
                myDbEntities.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
            //return false;
        }