Пример #1
0
        public List <Booking> FindAllBookings()
        {
            List <Booking> bookingList = new List <Booking>();

            bookingList = BookingDAL.FindAllBookings();
            return(bookingList);
        }
Пример #2
0
        public void SaveBooking(Booking booking)
        {
            // Uppfyller inte objektet affärsreglerna...
            ICollection <ValidationResult> validationResults;

            if (!booking.Validate(out validationResults)) // Använder "extension method" för valideringen!
            {                                             // Klassen finns under App_Infrastructure.
                // ...kastas ett undantag med ett allmänt felmeddelande samt en referens
                // till samlingen med resultat av valideringen.
                var ex = new ValidationException("Objektet klarade inte valideringen.");
                ex.Data.Add("ValidationResults", validationResults);
                throw ex;
            }

            // Booking-objektet sparas antingen genom att en ny post
            // skapas eller genom att en befintlig post uppdateras.
            if (booking.BookingID == 0) // Ny post om CustomerId är 0!
            {
                BookingDAL.InsertBooking(booking);
            }
            else
            {
                BookingDAL.UpdateBooking(booking);
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try {
                int a = dataGridView1.CurrentCell.ColumnIndex;
                int b = dataGridView3.CurrentCell.ColumnIndex;
                int c = dataGridView2.CurrentCell.ColumnIndex;
                if (a == 0)
                {
                    //add.showBalloonTip( dataGridView1.CurrentCell.Value.ToString(), "Student ID Selected");

                    x = int.Parse(dataGridView1.CurrentCell.Value.ToString());
                    if (b == 0)
                    {
                        //add.showBalloonTip(dataGridView3.CurrentCell.Value.ToString(), "Tutor ID Selected");

                        y = int.Parse(dataGridView3.CurrentCell.Value.ToString());

                        if (c == 0)
                        {
                            //add.showBalloonTip(dataGridView2.CurrentCell.Value.ToString(), "Room ID Selected");
                            z = int.Parse(dataGridView2.CurrentCell.Value.ToString());
                            BookingDAL.addNewBooking(x, y, z, cboAllocated.Text, cboDay.Text, cboTime.Text, comboBox2.Text, int.Parse(textBox1.Text), int.Parse(comboBox1.Text));
                            add.showBalloonTip("Success", "Successfully Add Booking");
                            cboAllocated.SelectedIndex = -1;
                            cboDay.SelectedIndex       = -1;
                            cboTime.SelectedIndex      = -1;
                            comboBox1.SelectedIndex    = -1;
                            comboBox2.SelectedIndex    = -1;
                            textBox1.Text = "";
                            dataGridView1.ClearSelection();
                            dataGridView2.ClearSelection();
                            dataGridView3.ClearSelection();
                        }
                        else
                        {
                            add.showBalloonTip("Room Number ", "Please Select a Room Number");
                        }
                    }
                    else
                    {
                        add.showBalloonTip("Tutor ID ", "Please Select a Tutor ID");
                    }
                }
                else
                {
                    add.showBalloonTip("Student ID ", "Please Select a Student ID");
                }
            }
            catch (Exception ex)
            {
                add.showBalloonTip("Error", "Something Went Wrong");
                System.IO.StreamWriter writer = new System.IO.StreamWriter("../../ErrorLog.txt", true);
                writer.WriteLine("- " + DateTime.Now + " " + ex.Message, true);
                writer.Flush();
                writer.Close();
            }
        }
        public IHttpActionResult GetEmployee(int id)
        {
            IBooking myDbBooking = new BookingDAL();

            btcr = new ASP.NET_Backend.Controller.BookingController(myDbBooking);
            var hairdresser = btcr.FindHairdresser(3);

            return(Ok(hairdresser));
        }
Пример #5
0
        /// <summary>
        /// Calls check in function with booking Model BookingDAL.CheckCheckin(bookingModel);
        /// Returns string dependant on login success
        /// </summary>
        public static string ProcessTableCheckin(BookingModel bookingModel)
        {
            bool bCheck = BookingDAL.CheckCheckin(bookingModel); //check if booking exists - return false if exists

            if (bCheck == false)
            {
                return(bookingModel.emailAddress + " has successfully checked in!");
            }

            return("Failed to check in. Booking does not exist. If you are more than 15 minutes late your booking has been deleted.");
        }
Пример #6
0
        private void addBookingstoDb()
        {
            List <Booking> bookinglist = parsefile.getCSVBookingdata();
            BookingDAL     bookingDAL  = new BookingDAL();


            foreach (Booking bok in bookinglist)
            {
                bookingDAL.addBookingDb(bok);
            }
        }
Пример #7
0
        /// <summary>
        /// Books a table with booking Model via  TableDAL.CheckTableStatus(bookingModel)
        /// If booking is successful returns bool true
        /// else returns bool false
        /// </summary>
        public static bool ProcessCalanderBookTable(BookingModel bookingModel)
        {
            bool bCheck = TableDAL.CheckTableStatus(bookingModel); //check if booking exists - return false if exists


            if (bCheck == true)
            {
                if (BookingDAL.CreateCalanderBookTable(bookingModel))
                {
                    return(true);
                }
            }

            return(false);
        }
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         BookingDAL.TerminateBooking(x);
         add.showBalloonTip("Success", "Successfully Terminated Booking");
     }
     catch (Exception ex) {
         add.showBalloonTip("Error", "Something Went Wrong");
         System.IO.StreamWriter writer = new System.IO.StreamWriter("../../ErrorLog.txt", true);
         writer.WriteLine("- " + DateTime.Now + " " + ex.Message, true);
         writer.Flush();
         writer.Close();
     }
 }
Пример #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        List <Inovice> incl = new List <Inovice>();
        BookingDAL     bd   = new BookingDAL();

        Inovice inc = (Inovice)Session["Invoice"];



        Custname = inc.CustName;
        Custph   = inc.CustContact;
        Vname    = inc.VenName;
        Vemail   = inc.VenEmail;
        Vph      = inc.VenContact;
        Basic    = inc.Basic;
        Service  = inc.ServiceType;
    }
        public void SaveBooking(Booking booking)
        {
            ICollection <ValidationResult> validationResults;

            if (!booking.Validate(out validationResults))
            {
                var ex = new ValidationException("Objektet klarade inte valideringen");
                ex.Data.Add("ValidationResults", validationResults);
                throw ex;
            }

            if (booking.BookingID == 0)//Ny post om Id är 0
            {
                BookingDAL.InsertBooking(booking);
            }
            else
            {
                throw new ApplicationException("Fel uppstod i samband med att ny bokning skulle skapas.");
            }
        }
Пример #11
0
 private void btnDeleteBooking_Click(object sender, EventArgs e)
 {
     //This code checks if a student id is selected before reading it to a local variable
     //It then passes that data to a method in a seperate class. if any errors are found they
     //will be caught by Try-Catch. if No ID selected User prompted to select a Student ID
     if (dgvViewBookings.CurrentCell.ColumnIndex == 1)
     {
         int x = int.Parse(dgvViewBookings.CurrentCell.Value.ToString());
         try
         {
             BookingDAL.TerminateBooking(x);
             dgvViewBookings.Update();
         }
         catch
         {
             add.showBalloonTip("Error", "Something Went Wrong");
         }
     }
     else
     {
         add.showBalloonTip("Student ID", "Please Select a Student ID");
     }
 }
Пример #12
0
        /// <summary>
        /// Calls by user ID and User Email
        /// IncidenceDAL.incAllUserDelete(userID);
        /// BookingDAL.BookingAllUserDelete(user.Email);
        /// UserDAL.deleteUser(userID);
        /// to delete a user and all referances to the user in the database
        /// </summary>
        public static void userDelete(int userID)
        {
            UserModel user = new UserModel();

            /// access user delete function
            ///

            user = getUserByID(userID);

            IncidenceDAL.incAllUserDelete(userID);
            BookingDAL.BookingAllUserDelete(user.Email);
            UserDAL.deleteUser(userID);

            /*bool success;
             * try
             * {
             *
             *  return success = true;
             * }
             * catch
             * {
             *  return success = false;
             * }*/
        }
Пример #13
0
 public static DataSet GetExportVoyagesWithPOL(int Vessel, int POLID)
 {
     return(BookingDAL.GetExportVoyagesWithPOL(Vessel, POLID));
 }
Пример #14
0
 public static DataSet GetExportMLVoyages(int Vessel)
 {
     return(BookingDAL.GetExportMLVoyages(Vessel));
 }
Пример #15
0
        /// <summary>
        /// Gets the bookingID by bookingModel (TableID)   via BookingDAL.GetBookingIDByBookingModel(bookingModel)
        /// Returns bookingID
        /// </summary>
        public static int GetBookingIDByBookingModel(BookingModel bookingModel)
        {
            int bookingID = BookingDAL.GetBookingIDByBookingModel(bookingModel);

            return(bookingID);
        }
Пример #16
0
        /// <summary>
        /// Searches booking table by booking ID via BookingDAL.CheckBooking(bookingID);
        /// returns BookingModel booking
        /// </summary>
        public static BookingModel SearchBookingByID(int bookingID)
        {
            BookingModel booking = BookingDAL.CheckBooking(bookingID);

            return(booking);
        }
Пример #17
0
 //Souvik
 public static IBooking GetBookingByBookingId(int BookingId)
 {
     return(BookingDAL.GetBookingByBookingId(BookingId));
 }
Пример #18
0
 // Ta bort Booking
 public void DeleteBooking(int bookingId)
 {
     BookingDAL.DeleteBooking(bookingId);
 }
Пример #19
0
        public static void startEmailWorker()
        {
            // main Email worker, searches for any bookings in the next hour
            // via the booking table, searches user, room and building tables for associated data
            // loops through each booking sending email notifications via NotifyBL



            List <BookingModel> groups = new List <BookingModel>();


            groups = BookingDAL.loadBookingListattime();


            // loops through each booking returned by BookingDAL.loadBookingListattime();
            foreach (BookingModel booking in groups)
            {
                List <string> dataset1 = new List <string>();

                string URL = "https://www.etabletap.com/UL/BookingReceipt.aspx?id=" + booking.bookingID;

                UserModel     user     = new UserModel();
                TableModel    table    = new TableModel();
                RoomModel     room     = new RoomModel();
                BuildingModel building = new BuildingModel();


                table = TableBL.GetTableByID(booking.tableID);

                user = UserBL.passUserSearch(booking.emailAddress);

                room = RoomBL.getRoomByID(table.RoomID);

                building = BuildingBL.getBuildingByID(room.BuildingID);


                // main user
                NotifyBL.startNotifyBooking(user.FirstName + " " + user.LastName, user.phoneNum, user.Email, table.TableID.ToString(),
                                            room.RoomName, building.BuildingName, booking.bookingDate.ToString(), booking.bookingHour.ToString() + ":00", URL);

                //booking member 1
                try
                {
                    NotifyBL.startNotifyBooking(user.FirstName + " " + user.LastName, user.phoneNum, booking.memberEmail1, table.TableID.ToString(),
                                                room.RoomName, building.BuildingName, booking.bookingDate.ToString(), booking.bookingHour.ToString() + ":00", URL);
                }
                catch
                {
                }

                // booking member 2
                try
                {
                    NotifyBL.startNotifyBooking(user.FirstName + " " + user.LastName, user.phoneNum, booking.memberEmail2, table.TableID.ToString(),
                                                room.RoomName, building.BuildingName, booking.bookingDate.ToString(), booking.bookingHour.ToString() + ":00", URL);
                }
                catch
                {
                }

                // groupmember 3
                try
                {
                    NotifyBL.startNotifyBooking(user.FirstName + " " + user.LastName, user.phoneNum, booking.memberEmail3, table.TableID.ToString(),
                                                room.RoomName, building.BuildingName, booking.bookingDate.ToString(), booking.bookingHour.ToString() + ":00", URL);
                }
                catch
                {
                }

                // booking member 4
                try
                {
                    NotifyBL.startNotifyBooking(user.FirstName + " " + user.LastName, user.phoneNum, booking.memberEmail4, table.TableID.ToString(),
                                                room.RoomName, building.BuildingName, booking.bookingDate.ToString(), booking.bookingHour.ToString() + ":00", URL);
                }
                catch
                {
                }

                // groupmember 5
                try
                {
                    NotifyBL.startNotifyBooking(user.FirstName + " " + user.LastName, user.phoneNum, booking.memberEmail5, table.TableID.ToString(),
                                                room.RoomName, building.BuildingName, booking.bookingDate.ToString(), booking.bookingHour.ToString() + ":00", URL);
                }
                catch
                {
                }
            }
        }
Пример #20
0
 public static void UpdateBooking(IBooking Booking)
 {
     BookingDAL.UpdateBooking(Booking);
 }
Пример #21
0
 public static string GetRefundPayableId(string RefundPayable)
 {
     return(BookingDAL.GetRefundPayableId(RefundPayable));
 }
Пример #22
0
 public static string GetBrokeragePayableId(string BrokeragePayable)
 {
     return(BookingDAL.GetBrokeragePayableId(BrokeragePayable));
 }
Пример #23
0
 public static DataTable GetSlotOperators()
 {
     return(BookingDAL.GetSlotOperators());
 }
Пример #24
0
 public static DataSet GetExportVoyages(int Vessel, int LocationID)
 {
     return(BookingDAL.GetExportVoyages(Vessel, LocationID));
 }
Пример #25
0
 public static DataSet GetExportServices(int Line, Int32 Fpod)
 {
     return(BookingDAL.GetExportServices(Line, Fpod));
 }
Пример #26
0
 public void CreateBooking(Booking b)
 {
     BookingDAL.CreateBooking(b);
 }
Пример #27
0
 // Hämta ut alla bokningar fr tabellen Booking
 public IEnumerable <Booking> GetBookings()
 {
     return(BookingDAL.GetBookings());
 }
Пример #28
0
 public void DeleteBooking(Booking b)
 {
     BookingDAL.DeleteBooking(b);
 }
Пример #29
0
 public BookingBL()
 {
     dal = new BookingDAL();
 }
Пример #30
0
 public static DataTable GetPortWithServices(int ServiceID, Int32 Lineid)
 {
     return(BookingDAL.GetPortWithServices(ServiceID, Lineid));
 }