public Window1(dat154_18_2Entities db, Room room) { InitializeComponent(); this.room = room; romnr.Content = this.room.roomID; }
private void Button_Click(object sender, RoutedEventArgs e) { using (var db = new dat154_18_2Entities()) { string name = textbox1.Text; Customer kunde = new Customer { navn = name, passord = "1234" }; db.Customer.Add(kunde); db.SaveChanges(); db.Customer.Load(); DateTime from = (DateTime)FirstCal.SelectedDate; DateTime to = (DateTime)SecondCal.SelectedDate; Booking book = new Booking { checkinDate = from, checkoutDate = to, customerID = kunde.customerID, roomtype = (int)room.roomType }; db.Booking.Add(book); db.SaveChanges(); db.Booking.Load(); MessageBoxResult m = MessageBox.Show("Bestilling fullført. \n KundeNr " + kunde.customerID + "\n Passord " + kunde.passord + "\n BookingID " + book.bookingID + " \n ", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); if (m == MessageBoxResult.OK) { this.Close(); } } }
public IssueWindow(dat154_18_2Entities db, Room rom) { InitializeComponent(); this.db = db; this.rom = rom; Romnr.Content = rom.roomID; ComboSak.SelectedIndex = 0; }
public ReservationWindow(dat154_18_2Entities db) { InitializeComponent(); this.db = db; delegatClass.delegat += updateView; db.Booking.Load(); resList.DataContext = db.Booking.Local; }
public EditResWindow(dat154_18_2Entities db, Booking bk) { InitializeComponent(); this.db = db; this.bk = bk; resLabel.Content = this.bk.bookingID; kundeLabel.Content = this.bk.customerID; roomtype.SelectedIndex = this.bk.roomtype - 1; innkalender.SelectedDate = this.bk.checkinDate; utkalender.SelectedDate = this.bk.checkoutDate; }
private void Button_Click_2(object sender, RoutedEventArgs e) { if (romList.SelectedItem != null) { using (var db = new dat154_18_2Entities()) { Room selected = (Room)romList.SelectedItem; Window w = new Window1(db, selected); w.Activate(); w.ShowDialog(); } } }
public MainWindow() { InitializeComponent(); db = new dat154_18_2Entities(); delegatClass.delegat += updateView; //var room1 = new Room { roomType = 1, vasket = false, opptatt = false }; //db.Room.Add(room1); db.SaveChanges(); db.Room.Load(); romList.DataContext = romtypeCombo.DataContext = db.Room.Local; romtypeCombo.SelectedIndex = 0; }