示例#1
0
        public void InsertData(Class1 li)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            perso rs = new perso();

            var chars           = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
            var stringCharsuser = new char[6];
            var stringCharspass = new char[8];
            var random          = new Random();

            for (int i = 0; i < stringCharsuser.Length; i++)
            {
                stringCharsuser[i] = chars[random.Next(chars.Length)];
            }
            for (int i = 0; i < stringCharspass.Length; i++)
            {
                stringCharspass[i] = chars[random.Next(chars.Length)];
            }


            li.login = new String(stringCharsuser);
            li.pw    = new String(stringCharspass);


            rs.Id     = li.Id;
            rs.nom    = li.nom;
            rs.prenom = li.prenom;
            rs.age    = li.age;
            rs.login  = li.login;
            rs.pw     = li.pw;


            db.perso.InsertOnSubmit(rs);
            db.SubmitChanges();
        }
示例#2
0
        public string searchLP(Class1 li)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            perso  rs      = new perso();
            string passout = "";
            // var pass = from m in db.registers where m.emailid == li.Emailid select m.userpassword;
            var pass = from m in db.perso where m.login == li.login select m.pw;

            // var pass = from m in db.registers where m.emailid == li.Emailid select m.userpassword;
            foreach (string query in pass)
            {
                passout = query;
            }
            return(passout);
        }
 partial void Deleteperso(perso instance);
 partial void Updateperso(perso instance);
 partial void Insertperso(perso instance);