public void AddErtek(Tipu t) { Ertek e = new Ertek(); e.Id = this.database.Erteks.Last().Id + 1; e.Mikortol = System.DateTime.Now; e.Tipus = t.Id; this.database.Erteks.Add(e); this.database.SaveChanges(); }
public Kartya(Szin szin, Ertek ertek) { this.Szin = szin; this.Ertek = ertek; }
private void executeadd() { if (this._daysselected) { Berlet b = new Berlet(); b.Idotartam = Int32.Parse(this.hanyalkalom); b.Napok = new byte[7]; int szamlalo = 0; foreach (bool nap in this._napok) { if (nap) { b.Napok[szamlalo] = 1; } else { b.Napok[szamlalo] = 0; } szamlalo = szamlalo + 1; } b.Belepesek_szama = 0; b.Aktiv = true; if (this.kezdet != null) { b.Kezdeti_ora = Int32.Parse(this.kezdet); } if (this.veg != null) { b.Veg_ora = Int32.Parse(this.veg); } Vasarolt v = new Vasarolt(); v.Berlet = b; v.User = this.selecteduser; Ertek e = MainwindowViewModel.DatabaseController.getErtekByTipus(this.selectedtipus); this.ar = e.Ar.ToString(); v.Ertek1 = e; MainwindowViewModel.DatabaseController.addBerlet(b); MainwindowViewModel.DatabaseController.addVasarlas(v); MessageBox.Show("Sikeres Vasarlas"); } else { Berlet b = new Berlet(); b.Idotartam = Int32.Parse(this.hanyalkalom); b.Napok = new byte[7]; int szamlalo = 0; b.Belepesek_szama = 0; b.Aktiv = true; if (this.kezdet != null) { b.Kezdeti_ora = Int32.Parse(this.kezdet); } if (this.veg != null) { b.Veg_ora = Int32.Parse(this.veg); } Vasarolt v = new Vasarolt(); v.Berlet = b; v.User = this.selecteduser; Ertek e = MainwindowViewModel.DatabaseController.getErtekByTipus(this.selectedtipus); this.ar = e.Ar.ToString(); v.Ertek1 = e; MainwindowViewModel.DatabaseController.addBerlet(b); MainwindowViewModel.DatabaseController.addVasarlas(v); MessageBox.Show("Sikeres Vasarlas"); } }