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));
 }