Ejemplo n.º 1
0
        private void MakeReservation()
        {
            switch (MessageBox.Show("Making reservation?", "Room available", MessageBoxButtons.YesNo))
            {
            case DialogResult.Yes:
            {
                try
                {
                    Entities.Rent_Rooms rent = new Entities.Rent_Rooms(dateComming_picker.Value, dateLeaving_picker.Value, Int32.Parse(tb_RoomID.Text), tb_UniqueClientID.Text);
                    if (rentedCar != null)
                    {
                        DAL.Dal_Rent_Rooms.InsertRenter(rent, rentedCar);
                    }
                    else
                    {
                        DAL.Dal_Rent_Rooms.InsertRenter(rent, null);
                    }

                    AddConfirmationRichTextbox(rent);

                    //DONE: Send a confirmation email
                    SendEmail();
                    //Solved: Add all data to a CSV file

                    SaveToCSV(rent, Form1.ReserveRoom);

                    //MessageBox.Show("Room succesfully Rented in period " + dateComming_picker.Value.ToString() + "-" + dateLeaving_picker.Value.ToString());
                    //this.Close();

                    GenerateBarCodeinPictureBox(UniqueID, PB_Barcode);
                }
                catch (OracleException OE)
                {
                    DAL.Log.LogMessage(OE);
                    MessageBox.Show("Error occured!");
                }
                break;
            }

            case DialogResult.No:
            {
                break;
            }
            }
        }
Ejemplo n.º 2
0
 private void AddConfirmationRichTextbox(Entities.Rent_Rooms rented_Room)
 {
     if (Switch_CarRent.Value == true)
     {
         Car = string.Format("Car rented: {0}.", comboBox_selectCarType.Text);
     }
     else
     {
         Car = "No car selected";
     }
     richTextBox_ConfReservationOrShowError.ForeColor = Color.FromArgb(52, 106, 237);
     richTextBox_ConfReservationOrShowError.Text      = String.Format("\t\t\t\t\tConfirm Reservation!\n" +
                                                                      "User: UNDEFINED TODO :P\n\n" +
                                                                      "Room ID: " + rented_Room.ROOM_ID + "\n" +
                                                                      "Date Coming: " + rented_Room.START_DATE + "\n" +
                                                                      "DateLeaving: " + rented_Room.END_DATE + "\n\n" +
                                                                      Car + "\n\n" +
                                                                      "Reservation Identifier:" + rented_Room.ReservationID + "\n\n" +
                                                                      "\t\t\t\t\tTotal Cost: " + AddVAT(Form1.ReserveRoom.Price + GetCarPrice(), VAT) + " " + currency);
     //TODO: ADD Details of car to facture and e-mail and add to database tha fact that a car is rented.
 }
Ejemplo n.º 3
0
 private void SaveToCSV(Entities.Rent_Rooms rent_Rooms, Entities.Rooms rooms)
 {
     DAL.Log.WriteCSV(rent_Rooms, rooms);
 }