예제 #1
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);
        }
예제 #2
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;
            }
        }
예제 #3
0
        protected void createImageTable(int tableNumber, string category)
        {
            string url = ConfigurationManager.AppSettings["UnsecurePath"] + "Table.aspx?id=" + tableNumber;
            /////////////////
            Image imageTable = new Image();

            imageTable.ID = "imgBox" + tableNumber.ToString();
            //determine height
            if (category.ToLower() == "lounge")
            {
                imageTable.Attributes.Add("height", "32");
            }
            else if (category.ToLower() == "small")
            {
                imageTable.Attributes.Add("height", "32");
            }
            else
            {
                imageTable.Attributes.Add("height", "42");
            }
            //Determine width
            if (category.ToLower() == "large")
            {
                imageTable.Attributes.Add("width", "72");
            }
            else if (category.ToLower() == "lounge")
            {
                imageTable.Attributes.Add("width", "72");
            }
            else if (category.ToLower() == "small")
            {
                imageTable.Attributes.Add("width", "32");
            }
            else
            {
                imageTable.Attributes.Add("width", "42");
            }
            imageTable.Attributes.Add("class", "img-circle");

            imageTable.Attributes.Add("style", "border-radius:14px;margin-bottom:20px; ");

            HyperLink imageHL = new HyperLink();

            imageHL.ID = "hLink" + tableNumber.ToString();
            imageHL.Attributes.Add("style", "margin-left:20px; ");

            //imageHL.Text = "hLink" + tableNumber.ToString();

            imageHL.Controls.Add(imageTable);//adds image to the hyperlink

            /*if (TableBL.checkTableStatus(tableNumber))
             * {
             *  imageTable.BackColor = System.Drawing.Color.Green;
             *  imageHL.NavigateUrl = url; //will only genertate url if table is available
             * }*/
            if (!TableBL.CheckTableHourAvailability(tableNumber, Int32.Parse(DateTime.Now.ToString("HH")), DateTime.Now)) //returning false means it is free
            {                                                                                                             //returning true means table exists, therefor is booked
                imageTable.BackColor = System.Drawing.Color.Green;
                imageHL.NavigateUrl  = url;                                                                               //will only genertate url if table is available
            }
            else
            {
                imageTable.BackColor = System.Drawing.Color.Red;
            }

            divTableImages.Controls.Add(imageHL);
        }