Esempio n. 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();
            }
        }
Esempio n. 2
0
 private void updateValuesOnClick(object sender, RoutedEventArgs e)
 {
     using (e1 = new M120Entities())
     {
         k1 = e1.Kundes.FirstOrDefault(c => c.Name == tbLoad.Text);
         try
         {
             if (k1.Anrede == "Frau" && l2.IsChecked == false)
             {
                 k1.Anrede            = "Herr";
                 hiddenLabel2.Content = updatedMessage();
             }
             else if (k1.Anrede == "Herr" && l1.IsChecked == false)
             {
                 k1.Anrede            = "Frau";
                 hiddenLabel2.Content = updatedMessage();
             }
             else if (tbName.Text != k1.Name)
             {
                 k1.Name = tbName.Text;
                 hiddenLabel2.Content = updatedMessage();
             }
             else if (tbVorname.Text != k1.Vorname)
             {
                 k1.Vorname           = tbVorname.Text;
                 hiddenLabel2.Content = updatedMessage();
             }
             else if (tbPlz.Text != k1.PLZ.ToString())
             {
                 k1.PLZ = Convert.ToInt16(tbPlz.Text);
                 hiddenLabel2.Content = updatedMessage();
             }
             else if (tbOrt.Text != k1.Ort)
             {
                 k1.Ort = tbOrt.Text;
                 hiddenLabel2.Content = updatedMessage();
             }
             else if (tbEmail.Text != k1.Email)
             {
                 k1.Email             = tbEmail.Text;
                 hiddenLabel2.Content = updatedMessage();
             }
             else if (DateTime.Parse(tbBirthdate.SelectedDate.ToString()) != k1.Geburtsdatum)
             {
                 k1.Geburtsdatum      = DateTime.Parse(tbBirthdate.SelectedDate.ToString());
                 hiddenLabel2.Content = updatedMessage();
             }
             else
             {
                 hiddenLabel2.Foreground = new SolidColorBrush(Colors.Yellow);
                 hiddenLabel2.Content    = "Nothing Updated";
             }
             e1.SaveChanges();
         }
         catch (NullReferenceException x)
         {
             MessageBox.Show(x.Message);
         }
     }
 }
Esempio n. 3
0
        private void updateValuesOnClick(object sender, RoutedEventArgs e)
        {
            using (e1 = new M120Entities())
            {
                k1 = e1.Hotels.FirstOrDefault(c => c.Name == tbLoad.Text);
                k2 = e1.Lands.FirstOrDefault(c => c.LandID == k1.Land);
                try
                {
                    if (tbOOrt.Text != k1.Ort)
                    {
                        k1.Ort = tbOOrt.Text;
                        hiddenLabel2.Content = updatedMessage();
                    }
                    else if (tbLand.Text != k2.Name)
                    {
                        k1.Land = k2.LandID;
                        hiddenLabel2.Content = updatedMessage();
                    }
                    else if (tbSterne.Text != k1.Sterne.ToString())
                    {
                        k1.Sterne            = Convert.ToByte(tbSterne.Text);
                        hiddenLabel2.Content = updatedMessage();
                    }
                    else if (tbManager.Text != k1.Manager)
                    {
                        k1.Manager           = tbManager.Text;
                        hiddenLabel2.Content = updatedMessage();
                    }
                    else if (tbAnzahlZimmer.Text != k1.AnzahlZimmer.ToString())
                    {
                        k1.AnzahlZimmer      = Convert.ToInt16(tbAnzahlZimmer);
                        hiddenLabel2.Content = updatedMessage();
                    }
                    else if (tbEmail.Text != k1.Email)
                    {
                        k1.Email             = tbEmail.Text;
                        hiddenLabel2.Content = updatedMessage();
                    }
                    else if (tbEmail.Text != k1.Email)
                    {
                        k1.TagesPreis        = Convert.ToInt16(tbTäglicheKosten.Text);
                        hiddenLabel2.Content = updatedMessage();
                    }

                    else
                    {
                        hiddenLabel2.Foreground = new SolidColorBrush(Colors.Yellow);
                        hiddenLabel2.Content    = "Nothing Updated";
                    }
                    e1.SaveChanges();
                }
                catch (NullReferenceException x)
                {
                    MessageBox.Show(x.Message);
                }
            }
        }
Esempio n. 4
0
 private void deleteValuesOnClick(object sender, RoutedEventArgs e)
 {
     using (e1 = new M120Entities())
     {
         k1 = e1.Hotels.FirstOrDefault(c => c.Name == tbLoad.Text);
         e1.Hotels.Remove(k1);
         e1.SaveChanges();
         hiddenLabel2.Foreground = new SolidColorBrush(Colors.ForestGreen);
         hiddenLabel2.Content    = "Successfully deleted";
     }
 }
Esempio n. 5
0
        public void saveImageToDb(byte[] img, string description, string hotelName)
        {
            using (e1 = new M120Entities()){
                Hotel     h2 = e1.Hotels.FirstOrDefault(c => c.Name == hotelName);
                HotelBild b1 = new HotelBild
                {
                    Beschreibung = description,
                    Bild         = img,
                    HotelID      = h2.HotelID
                };

                e1.HotelBilds.Add(b1);
                e1.SaveChanges();
            }
        }
Esempio n. 6
0
 public void saveHotelToDB(string hoName, string hoOrt, long hoLand, byte hoSterne, string hoManager, short hoAnzahlZimmer, int hoTagesPreis, string hoTelefon, string hoEmail, string hoWeb)
 {
     using (e1 = new M120Entities())
     {
         Hotel h1 = new Hotel
         {
             Name         = hoName,
             Ort          = hoOrt,
             Land         = hoLand,
             Sterne       = hoSterne,
             Manager      = hoManager,
             AnzahlZimmer = hoAnzahlZimmer,
             TagesPreis   = hoTagesPreis,
             Telefon      = hoTelefon,
             Email        = hoEmail,
             Web          = hoWeb
         };
         e1.Hotels.Add(h1);
         e1.SaveChanges();
     }
 }