Example #1
0
 public string SearchName(string addUserNumber)//查询账号是否存在
 {
     using (Model1 db = new Model1())
     {
         Userinfo aDda2 = db.Userinfoes.FirstOrDefault(p => p.UserNumber == addUserNumber);
         return(aDda2.UserName);
     }
 }
Example #2
0
 public bool SearchPassword(string addUserNumber, string addUserPassword)//查询密码是否匹配
 {
     using (Model1 db = new Model1())
     {
         Userinfo aDda2 = db.Userinfoes.FirstOrDefault(p => p.UserNumber == addUserNumber);
         if (aDda2.UserPassword == addUserPassword)
         {
             return(true);
         }
     }
     return(false);
 }
Example #3
0
 public bool SearchNumber(string addUserNumber)//查询账号是否存在
 {
     using (Model1 db = new Model1())
     {
         Userinfo aDda2 = db.Userinfoes.FirstOrDefault(p => p.UserNumber == addUserNumber);
         if (aDda2 == null)
         {
             return(false); //不存在
         }
     }
     return(true);
 }
Example #4
0
        public void Deletemessage(int addId, string addUserNumber, string addUserName, string addUserPassword)
        {
            using (Model1 db = new Model1())
            {
                db.Userinfoes.Add(new Userinfo()
                {
                    Id = addId, UserNumber = addUserNumber, UserName = addUserName, UserResignDate = DateTime.Now
                });                                 //无则增(有则改)

                var person = db.Userinfoes.Find(3); //查找主键PersonID=1, PersonName="Michael"的实体

                // Userinfo aDShiTi = db.Userinfoes.Find(1);//查

                Userinfo aDda2 = db.Userinfoes.FirstOrDefault(p => p.UserName == addUserName);

                if (aDda2 == null)
                {
                    return;
                }
                db.Userinfoes.Remove(aDda2);//删

                db.SaveChanges();
            }
        }