private void zatwierdzButton_Click(object sender, EventArgs e) { if (!DesignMode) { Egzemplarz eg = new Egzemplarz(); Oferent of = new Oferent(); OfertaOferenta oo = new OfertaOferenta(); eg = (Egzemplarz)egzemplarzBindingSource.Current; of = (Oferent)oferentBindingSource.Current; oo = (OfertaOferenta)ofertaOferentaBindingSource.Current; oo.Oferent_IdOferenta = of.IdOferenta; ofertaOferentaBindingSource.ResetBindings(false); Funkcje.Instance._context.SaveChanges(); } }
private void StworzKontoOferentaButton_Click(object sender, EventArgs e) { using (var db = new KsiegarniaEntities()) { try { var oferenci = from b in db.Oferents where b.Login.Equals(OferentLoginTextBox.Text) select b; if (oferenci.Count() > 0) { MessageBox.Show("login jest juz zajety"); return; } if (OferentHasloTextBox.Text == "") { MessageBox.Show("Musisz podac jakies haslo"); return; } if (OferentLoginTextBox.Text == "") { MessageBox.Show("Musisz podac jakis login"); return; } var oferent = new Oferent { NazwaFirmy = OferentNazwaTextBox.Text, Adres = OferentAdresTextBox.Text, Login = OferentLoginTextBox.Text, Haslo = OferentHasloTextBox.Text, }; db.Oferents.Add(oferent); db.SaveChanges(); MessageBox.Show("Poprawnie zarejestrowano, możesz teraz się zalogować"); return; } catch (Exception ex) { MessageBox.Show("" + ex); return; } } }
private void StworzKontoOferentaButton_Click(object sender, EventArgs e) { using (var db = new KsiegarniaEntities()) { try { var oferenci = from b in db.Oferents where b.Login.Equals(OferentLoginTextBox.Text) select b; if (oferenci.Count() > 0) { MessageBox.Show("login jest juz zajety"); return; } if (OferentHasloTextBox.Text == "") { MessageBox.Show("Musisz podac jakies haslo"); return; } if (OferentLoginTextBox.Text == "") { MessageBox.Show("Musisz podac jakis login"); return; } var oferent = new Oferent { NazwaFirmy = OferentNazwaTextBox.Text, Adres = OferentAdresTextBox.Text, Login = OferentLoginTextBox.Text, Haslo = OferentHasloTextBox.Text, }; db.Oferents.Add(oferent); db.SaveChanges(); MessageBox.Show("Poprawnie zarejestrowano, możesz teraz się zalogować"); return; } catch (Exception ex) { MessageBox.Show(""+ex); return ; } } }