Ejemplo n.º 1
0
        protected void btnDirections_Click(object sender, EventArgs e)
        {
            int ID         = Int32.Parse(Request.QueryString["ID"]);
            int buildingID = BuildingBL.getBuildingByID(RoomBL.getRoomByID(TableBL.GetTableByID(ID).RoomID).BuildingID).BuildingID;
            // directions module
            string URL = DirectionModuleBL.start(buildingID);

            Response.Redirect(URL);
        }
Ejemplo n.º 2
0
 protected void notifyGroup(string email, int tableID, DateTime date, string sHour)
 {
     //The details that are send to the group members
     NotifyBL.startNotifyGroupMember(UserBL.passUserSearch(Session["login"].ToString()).FirstName.ToString(),
                                     email,
                                     TableBL.GetTableByID(tableID).TableID.ToString(),
                                     RoomBL.getRoomByID(TableBL.GetTableByID(tableID).RoomID).RoomName.ToString(),
                                     BuildingBL.getBuildingByID(RoomBL.getRoomByID(TableBL.GetTableByID(tableID).RoomID).BuildingID).BuildingName.ToString(),
                                     date.ToString("dd-MM-yyyy"),
                                     sHour + "00");
 }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int ID = Int32.Parse(Request.QueryString["ID"]);

            TableModel ThisTable = TableBL.GetTableByID(ID);

            lblgetID.Text              = ThisTable.TableID.ToString();
            lblgetCategory.Text        = ThisTable.Category;
            lblgetSeatingCapacity.Text = ThisTable.PersonCapacity.ToString();

            DateTime today = DateTime.Now;   //HH = 24hours, hh = 12hours, M = month, m = minute, d = day, y = year.

            lblHeading.Text = "Select Hour: ";

            //updates the dropdown list for book Today section
            List <string> hoursList = new List <String>();
            int           x         = Convert.ToInt32(today.ToString("HH"));;
            RoomModel     thisRoom  = RoomBL.getRoomByID(TableBL.GetTableByID(ID).RoomID);

            if (x >= thisRoom.ClosingTime.TotalHours) //check if room is closed
            {
                btnBook.Enabled = false;
            }
            while (x < thisRoom.ClosingTime.TotalHours) //will loop each hour until the end of the room's closing time
            {
                if (!TableBL.CheckTableHourAvailability(Int32.Parse(Request.QueryString["ID"]), x, today))
                {
                    hoursList.Add(x.ToString() + ": " + "is free");
                }
                else
                {
                    hoursList.Add(x.ToString() + ": Occupied");
                }

                x++;
            }
            if (!IsPostBack)
            {
                hourDropdown.DataSource = hoursList;
                hourDropdown.DataBind();
            }

            if (hourDropdown.SelectedValue.ToString().Contains("Occupied"))
            {
                btnBook.Visible = false;
                lblStatus.Text  = "THE TABLE IS CURRENTLY OCCUPIED";
            }

            showCalInputBoxes((TableBL.GetTableByID(ID).PersonCapacity) - 1); // -1 because the user takes up 1 spot
            showInputBoxes((TableBL.GetTableByID(ID).PersonCapacity) - 1);
        }
Ejemplo n.º 4
0
        protected void MyCalendar_SelectionChanged(object sender, EventArgs e)
        {
            //Updates the calander section whenever a new selection is made
            lblCalCheck.Text        = "You selected date: ";
            CalHourDropDown.Visible = true;
            lblHourHelper.Visible   = true;
            foreach (DateTime dt in Cal.SelectedDates)
            {
                lblCalCheck.Text += dt.ToLongDateString() + "<br />";
            }
            int           ID        = Int32.Parse(Request.QueryString["ID"]);
            RoomModel     thisRoom  = RoomBL.getRoomByID(TableBL.GetTableByID(ID).RoomID);
            List <string> hoursList = new List <String>();

            double x = thisRoom.OpeningTime.TotalHours; //building opening time

            while (x < thisRoom.ClosingTime.TotalHours) //will loop until the end of the day's booking aka 2300. Can change to room closing time
            {
                if (!TableBL.CheckTableHourAvailability(Int32.Parse(Request.QueryString["ID"]), Convert.ToInt32(x), Cal.SelectedDate))
                {
                    hoursList.Add(x.ToString() + ": " + "is free");
                }
                else
                {
                    hoursList.Add(x.ToString() + ": Occupied");
                }

                x++;
            }

            CalHourDropDown.DataSource = hoursList;
            CalHourDropDown.DataBind();

            if (CalHourDropDown.SelectedValue.ToString().Contains("Occupied"))
            {
                btnBookCalander.Visible = false;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Generates relevant booking information, as acquired from the user's booking information supplied
        /// </summary>
        /// <param name="bookingID"></param>
        protected void MainWorker(int bookingID)
        {
            //Get booking by the ID provided
            BookingModel booking = BookingBL.SearchBookingByID(bookingID);

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

            //Get all values by their identifiers (table, users & room)
            table    = TableBL.GetTableByID(booking.tableID);
            user     = UserBL.passUserSearch(booking.emailAddress);
            room     = RoomBL.getRoomByID(table.RoomID);
            building = BuildingBL.getBuildingByID(room.BuildingID);

            string name         = user.FirstName;
            string day          = booking.bookingDate.ToString("yyyy-MM-d");
            string hour         = booking.bookingHour.ToString() + ":00";
            string bTable       = table.TableID.ToString();
            string roomName     = room.RoomName;
            string buildingName = building.BuildingName;

            //Generate a string from acquired data
            string buildingAddress = building.street + " " + building.suburb + Environment.NewLine + "<br />"
                                     + " " + building.provence + " " + building.country;

            //Update relevant data from user input booking information
            lblName.Text       = name;
            lblDay.Text        = day;
            lblHour.Text       = hour;
            lblTable.Text      = bTable;
            lblRoom.Text       = roomName;
            lblBuilding.Text   = buildingName;
            lblAddress.Text    = buildingAddress;
            lblbuildingid.Text = building.BuildingID.ToString();
        }
Ejemplo n.º 6
0
        protected void btnBookCalander_Click(Object sender, EventArgs e)
        {
            if (Session["user"] == null)
            {
                string url = Request.Url.AbsoluteUri;
                Session["LoginFallback"] = url;
                Response.Redirect("Login.aspx");
            }

            int    ID    = Int32.Parse(Request.QueryString["ID"]);
            string sHour = CalHourDropDown.SelectedValue.ToString();

            sHour = new string(sHour.TakeWhile(Char.IsDigit).ToArray());
            DateTime     date       = Cal.SelectedDate;
            BookingModel newBooking = new BookingModel();

            newBooking.tableID      = ID;
            newBooking.bookingDate  = Cal.SelectedDate.Date;
            newBooking.emailAddress = Session["Login"].ToString();
            newBooking.bookingHour  = Int32.Parse(sHour);
            newBooking.memberEmail1 = InputCalEmail1.Value;
            newBooking.memberEmail2 = InputCalEmail2.Value;
            newBooking.memberEmail3 = InputCalEmail3.Value;
            newBooking.memberEmail4 = InputCalEmail4.Value;
            newBooking.memberEmail5 = InputCalEmail5.Value;

            //if bool returns true, booking is successfully made - so we need to send emails to groupmembers below
            if (BookingBL.ProcessCalanderBookTable(newBooking))
            {
                lblHeading.Text = "Table was booked";

                lblStatus.Text = "Table: " + TableBL.GetTableByID(ID).TableID + "<br />Room Name: " + RoomBL.getRoomByID(TableBL.GetTableByID(ID).RoomID).RoomName.ToString() + "<br />in building: " + BuildingBL.getBuildingByID(RoomBL.getRoomByID(TableBL.GetTableByID(ID).RoomID).BuildingID).BuildingName + "<br />at: " + sHour + "00 -" + (Convert.ToInt32(sHour) + 1).ToString() + "00" + "<br /> was successfully booked";

                if (InputCalEmail1.Value != null)
                {
                    notifyGroup(InputCalEmail1.Value, ID, date, sHour);
                }
                if (InputCalEmail2.Value != null)
                {
                    notifyGroup(InputCalEmail2.Value, ID, date, sHour);
                }
                if (InputCalEmail3.Value != null)
                {
                    notifyGroup(InputCalEmail3.Value, ID, date, sHour);
                }
                if (InputCalEmail4.Value != null)
                {
                    notifyGroup(InputCalEmail4.Value, ID, date, sHour);
                }
                if (InputCalEmail5.Value != null)
                {
                    notifyGroup(InputCalEmail5.Value, ID, date, sHour);
                }
                //(string email, int tableID,DateTime date, string sHour)
                btnDirections.Visible = true;

                int receipt = BookingBL.GetBookingIDByBookingModel(newBooking);

                string url = ConfigurationManager.AppSettings["UnsecurePath"] + "BookingReceipt.aspx?id=" + receipt;
                Response.Redirect(url);
            }
        }
Ejemplo n.º 7
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
                {
                }
            }
        }