Exemplo n.º 1
0
 private void btnConfirm_Click(object sender, EventArgs e)
 {
     //Updates guests (but not fron the guestdetails class - can't get that to work yet
     MessageBox.Show(txtName.Text + " updated,");
     UpdateGuest();
     GuestDetails.Allguests();
 }
Exemplo n.º 2
0
        public void AddGuest()
        {//actually adding a booking and connecting it to a room
            try
            {
                if (txtName.Text != String.Empty || txtAddress.Text != String.Empty || txtPhone.Text != String.Empty ||
                    txtNumGuests.Text != String.Empty)
                {
                    using (var context = new ManahauMotelEntities())
                    {
                        Guest guest = new Guest();
                        guest.Name        = txtName.Text;
                        guest.Address     = txtAddress.Text;
                        guest.Phone       = txtPhone.Text;
                        guest.No_ofGuests = Convert.ToInt32(txtNumGuests.Text);
                        guest.Notes       = txtNotes.Text;

                        // var booking = new Booking();
                        Booking booking = new Booking();
                        booking.BookingFrom = dtpBookFrom.Value.Date;
                        booking.BookingTo   = dtpBookedTo.Value.Date;
                        booking.GuestIDFK   = guest.GuestID;

                        Billing billing = new Billing();
                        billing.RoomCharge = Convert.ToDecimal(txtCostForRoom.Text);

                        context.Guests.Add(guest);
                        context.Bookings.Add(booking);
                        context.Billings.Add(billing);


                        Room room = new Room();
                        room.RoomID = Convert.ToInt32(txtRoomId.Text);
                        Join join = new Join();
                        join.RoomIDFK    = room.RoomID;
                        join.BookingIDFK = booking.BookingID;
                        join.BillingIDFK = billing.BillingID;
                        // join.BillingIDFK = billing.BillingID;
                        context.Joins.Add(join);
                        context.SaveChanges();
                    }
                    GuestDetails.Allguests();
                    // DataLoading.BillForGuest(GuestID);
                    //DataLoading.OpenAccount();
                }
                else
                {
                    MessageBox.Show("Please enter all guest details thentry again.");
                }
            }

            catch (Exception q)
            {
                MessageBox.Show(q.Message);
            }
        }
Exemplo n.º 3
0
 public void LoadDataGrids()
 {
     DataLoading.dgvRooms        = dgvRooms;
     DataLoading.dgvReservations = dgvReservations;
     GuestDetails.dgvGuests      = dgvGuests;
     dgvGuests.Visible           = true;
     DataLoading.AllRooms();
     DataLoading.TodaysReservations();
     // DataLoading.Reservations();
     // DataLoading.ChoooseRoom();
     GuestDetails.Allguests();
     dtpBookFrom.MinDate = dtpBookFrom.Value.Date;
     // DataLoading.allRoomsFree();
     // SetVarialbes();
     //txtNumGuests = GuestDetails.txtNumGuests;
 }
Exemplo n.º 4
0
        public static void AddGuest()
        {
            {
                if (txtName.Text != String.Empty || txtAddress.Text != String.Empty || txtPhone.Text != String.Empty ||
                    txtNumGuests.Text != String.Empty)
                {
                    using (var context = new ManahauMotelEntities())
                    {
                        // var guest = new Guest();
                        Guest guest = new Guest();
                        guest.Name        = txtName.Text;
                        guest.Address     = txtAddress.Text;
                        guest.Phone       = txtPhone.Text;
                        guest.No_ofGuests = Convert.ToInt32(txtNumGuests.Text);
                        guest.Notes       = txtNotes.Text;

                        // var booking = new Booking();
                        Booking booking = new Booking();
                        booking.BookingFrom = dtpBookFrom.Value.Date;
                        booking.BookingTo   = dtpBookedTo.Value.Date;
                        booking.GuestIDFK   = guest.GuestID;



                        context.Guests.Add(guest);
                        context.Bookings.Add(booking);

                        Room room = new Room();
                        room.RoomID = Convert.ToInt32(txtRoomId.Text);
                        Join join = new Join();
                        join.RoomIDFK    = room.RoomID;
                        join.BookingIDFK = booking.BookingID;
                        context.Joins.Add(join);
                        context.SaveChanges();
                    }
                    GuestDetails.Allguests();
                }
            }
        }
Exemplo n.º 5
0
        private void dgvGuests_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            // int GuestID = 0;

            DialogResult dialogueResult = MessageBox.Show("Would you like to modify this guest's details?", "",
                                                          MessageBoxButtons.YesNo);

            if (dialogueResult == DialogResult.Yes)
            {
                if (txtNotes.Text != string.Empty)
                {
                    GuestDetails.UpdateGuest();
                }
            }

            try
            {
                GuestID         = (int)dgvGuests.Rows[e.RowIndex].Cells[0].Value;
                txtGuestID.Text = dgvGuests.Rows[e.RowIndex].Cells[0].Value.ToString();
                txtName.Text    = dgvGuests.Rows[e.RowIndex].Cells[1].Value.ToString();
                txtAddress.Text = dgvGuests.Rows[e.RowIndex].Cells[2].Value.ToString();
                txtPhone.Text   = dgvGuests.Rows[e.RowIndex].Cells[3].Value.ToString();
                txtNotes.Text   = dgvGuests.Rows[e.RowIndex].Cells[4].Value.ToString();

                //if (e.RowIndex >= 0)
                //{

                //    txtGuestID.Text =  GuestID.ToString();


                //}
            }
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 6
0
 private void btnAllGuests_Click(object sender, EventArgs e)
 {
     GuestDetails.Allguests();
 }