Пример #1
0
        private void BookRoomButton_Click(object sender, EventArgs e)
        {
            if (RoomBox.SelectedValue == null)
            {
                return;
            }
            RoomBox.ValueMember = "RoomID";
            var Customer = new SearchCustomer();

            var B   = new Booking();
            var Add = new AdjustData();

            B.RoomID = int.Parse(RoomBox.SelectedValue.ToString());
            var Objekt = Customer.FindACustomer(_ID);

            B.CustomerID = int.Parse(Objekt.CustomerID.ToString());
            B.DateStart  = DateTime1.Value;
            B.DateEnd    = DateTime2.Value;
            B.Guests     = int.Parse(GuestsBox.SelectedValue.ToString());

            Add.BookARoom(B);
            Add.CreateInvoice(B);

            this.Close();
        }
Пример #2
0
        private void Delete(object sender, System.Windows.Forms.FormClosedEventArgs e)
        {
            if (Deleted.BoolValue)
            {
                var Get = new GetData();
                var Add = new AdjustData();

                Booking B = Get.GetBooking(_ID);
                Add.DeleteBooking(B);
                this.Close();
            }
        }
Пример #3
0
        private void Button1_Click(object sender, EventArgs e)
        {
            var      Update = new AdjustData();
            var      Search = new SearchCustomer();
            Customer C      = Search.FindACustomer(_ID);

            C.FirstName = FirstNameBox.Text;
            C.LastName  = LastNameBox.Text;
            C.PersonID  = int.Parse(PersionIDBox.Text);

            if (Search.CheckPersonID(C))
            {
                MessageBox.Show("ID Already Exists");
            }
            else
            {
                Update.ChangeCustomer(C);
                this.Close();
            }
        }
Пример #4
0
        private void Button1_Click(object sender, EventArgs e)
        {
            var Customer = new Customer();
            var Search   = new SearchCustomer();

            Customer.FirstName = FirstNameBox.Text;
            Customer.LastName  = LastNameBox.Text;
            Customer.PersonID  = int.Parse(PersionIDBox.Text);

            if (Search.CheckPersonID(Customer))
            {
                MessageBox.Show("ID Already Exists");
            }
            else
            {
                var Data = new AdjustData();
                Data.AddCustomer(Customer);

                this.Close();
            }
        }
Пример #5
0
        private void SaveChangesButton_Click(object sender, EventArgs e)
        {
            var Get = new GetData();
            var Add = new AdjustData();

            Booking B = Get.GetBooking(_ID);
            Room    R = Get.GetRoom(int.Parse(B.RoomID.ToString()));

            if (Get.CheckRoomAvailable(Customer_ID, R, dateTimePicker1.Value, dateTimePicker2.Value))
            {
                B.DateStart = dateTimePicker1.Value;
                B.DateEnd   = dateTimePicker2.Value;
                B.Guests    = int.Parse(GuestsBox.SelectedValue.ToString());

                Add.UpdateBooking(B);
                this.Close();
            }
            else
            {
                NoRoomLabel.Text = "Room not available.";
            }
        }
Пример #6
0
        private void DeleteCustomerButton_Click(object sender, EventArgs e)
        {
            if (CustomerBox.SelectedValue == null)
            {
                return;
            }
            var      Delete = new AdjustData();
            var      Get    = new GetData();
            var      Search = new SearchCustomer();
            Customer C      = Search.FindACustomer(int.Parse(CustomerBox.SelectedValue.ToString()));
            var      List   = Get.GetBookings(C);

            if (List.Count > 0)
            {
                MessageBox.Show("Cannot Delete: Active Booking");
            }
            else
            {
                CustomerBox.ClearSelected();
                CustomerBox.DataSource = null;
                Delete.DeleteCustomer(C);
            }
        }