示例#1
0
        public void saveUserToDB(string anrede, string vorname, string name, string namezusatz, string strassennr, short plz, string ort, string telefon, string mobile, string email, string web, DateTime geburtsdatum, string passnr, long nationalität, string usn, string pw)
        {
            using (e1 = new M120Entities())
            {
                Kunde k1 = new Kunde
                {
                    Anrede        = anrede,
                    Vorname       = vorname,
                    Name          = name,
                    NameZusatz    = namezusatz,
                    StrasseNr     = strassennr,
                    PLZ           = plz,
                    Ort           = ort,
                    Telefon       = telefon,
                    Mobile        = mobile,
                    Email         = email,
                    Web           = web,
                    Geburtsdatum  = geburtsdatum,
                    PassNr        = passnr,
                    Nationalitaet = nationalität
                };
                GUIUSER g1 = new GUIUSER
                {
                    Gu_Benutzername = usn,
                    GU_Password     = pw,
                };

                m1 = new Menu2();
                m1.Show();
                e1.GUIUSERs.Add(g1);
                e1.Kundes.Add(k1);
                e1.SaveChanges();
            }
        }
示例#2
0
        public bool isUserInDB(string usn, string pw)
        {
            using (e1 = new M120Entities())
            {
                g1 = e1.GUIUSERs.FirstOrDefault(r => r.Gu_Benutzername == usn);
                g2 = e1.GUIUSERs.FirstOrDefault(p => p.GU_Password == pw);

                try
                {
                    if (g1.Gu_Benutzername == usn && g2.GU_Password == pw)
                    {
                        m1 = new Menu2();
                        m1.Show();

                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show("No User found in Database");
                }
                return(false);
            }
        }
示例#3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Menu2 m1 = new Menu2();

            m1.Show();
            this.Close();
        }