예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Gets all buildings by an ID
            int ID = Int32.Parse(Request.QueryString["ID"]);

            lblHeading.Text = "Building: " + BuildingBL.getBuildingByID(ID).BuildingName;
            rooms           = RoomBL.fillRoomsList(ID);

            if (!IsPostBack)
            {
                //Fill list with all relevant rooms
                inputRoomSelecter.DataSource     = rooms;
                inputRoomSelecter.DataValueField = "RoomID";
                inputRoomSelecter.DataTextField  = "RoomName";
                inputRoomSelecter.DataBind();
            }

            if (inputRoomSelecter.Items.Count < 1)
            {
                //If no rooms found, output error code and hide selection options
                sideLbl.Text = "No rooms found";
                inputRoomSelecter.Visible = false;
                goToRoomingButton.Visible = false;
            }
        }
예제 #2
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);
        }
예제 #3
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");
 }
 public IHttpActionResult Post([FromBody] Building b)
 {
     try
     {
         BuildingBL.AddBuilding(b);
         return(Ok());
     }
     catch
     {
         throw;
     }
 }
예제 #5
0
 public HttpResponseMessage AddBuilding(Building b)
 {
     try
     {
         int buildingId = BuildingBL.AddBuilding(b);
         return(Request.CreateResponse(HttpStatusCode.OK, buildingId));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, ex));
     }
 }
예제 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            buildings = BuildingBL.fillBuildingsList();

            if (!IsPostBack) //need this to stop it reverting to the top value every button click
            {
                buildingDropdown.DataSource     = buildings;
                buildingDropdown.DataValueField = "BuildingID";
                buildingDropdown.DataTextField  = "BuildingName";
                buildingDropdown.DataBind();
            }
        }
예제 #7
0
        protected void addBuildingButton_Click(Object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                BuildingModel newBuilding = new BuildingModel();

                newBuilding.BuildingName  = inBuildingName.Value;
                newBuilding.BuildingLabel = inBuildingLabel.Value;
                newBuilding.RoomQty       = Convert.ToInt32(inRoomQty.Value);


                BuildingBL.ProcessAddNewBuilding(newBuilding);


                Response.Redirect("AdminHome.aspx");
            }
        }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e) //created by beau
        {
            buildings = BuildingBL.fillBuildingsList();
            // Image1.ImageUrl = "~/Images/Room1.png";


            if (!IsPostBack) //need this to stop it reverting to the top value every button click
            {
                buildingDropdown.DataSource     = buildings;
                buildingDropdown.DataValueField = "BuildingID";
                buildingDropdown.DataTextField  = "BuildingName";
                buildingDropdown.DataBind();
                DropDownList1.DataSource     = buildings;
                DropDownList1.DataValueField = "BuildingID";
                DropDownList1.DataTextField  = "BuildingName";
                DropDownList1.DataBind();
            }
        }
예제 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Load data if user has initiated so, by button click.
            if ((string)Session["loggedUser"] != "admin") //stops non admins accessing page
            {
                Response.Redirect("home.aspx");
            }

            buildings = BuildingBL.fillBuildingsList();

            //Update building information if user has initiated so, by button click.
            if (!IsPostBack)
            {
                buildingDropdown.DataSource     = buildings;
                buildingDropdown.DataValueField = "BuildingID";
                buildingDropdown.DataTextField  = "BuildingName";
                buildingDropdown.DataBind();
            }
        }
예제 #10
0
        //Takes the event information from the button click in the user interaction layer and processes insertion into the database
        protected void addBuildingButton_Click(Object sender, EventArgs e)
        {
            //Uses ASP.NET function IsValid() to test user input and the current error state before proceeding
            if (Page.IsValid)
            {
                BuildingModel newBuilding = new BuildingModel(); //Creates a new BuildingModel instance

                //Sets relevant values from user input
                newBuilding.BuildingName  = inBuildingName.Value;
                newBuilding.BuildingLabel = inBuildingLabel.Value;
                newBuilding.RoomQty       = Convert.ToInt32(inRoomQty.Value);

                //Adds a new building to the database
                BuildingBL.ProcessAddNewBuilding(newBuilding);

                //Redirects the user to the administrator home panel after processing is completed
                Response.Redirect("AdminHome.aspx");
            }
        }
예제 #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            buildings = BuildingBL.fillBuildingsList();

            if (!IsPostBack)
            {
                //Sets relevant building fields
                inputBuildingSelecter.DataSource     = buildings;
                inputBuildingSelecter.DataValueField = "BuildingID";
                inputBuildingSelecter.DataTextField  = "BuildingName";
                inputBuildingSelecter.DataBind();
            }

            if (inputBuildingSelecter.Items.Count < 1)
            {
                //If rooms are not found, output an error code & do not display building selector / goto building button
                sideLbl.Text = "No rooms found";
                inputBuildingSelecter.Visible = false;
                goToBuildingButton.Visible    = false;
            }
        }
예제 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Checks if a user is an administrator, and only grants an administrator access to this page
            if ((string)Session["loggedUser"] != "admin")
            {
                Response.Redirect("home.aspx");
            }

            //Pulls all saved buildings from the database
            buildings = BuildingBL.fillBuildingsList();

            //Uses the ASP control IsPostBack to determine if a post-back or user actioned button click has been performed
            if (!IsPostBack)
            {
                buildingDropdown.DataSource     = buildings; //Fills the dropdown with all the buildings pulled from the database
                buildingDropdown.DataValueField = "BuildingID";
                buildingDropdown.DataTextField  = "BuildingName";
                buildingDropdown.DataBind();                         //Binds the ID / Name in the dropdown for user selection

                ddlbuildingDropDown_SelectedIndexChanged(sender, e); //Forces actions to reflect on user visual layer
            }
        }
예제 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Checks if a user is an administrator, and only grants an administrator access to this page
            if ((string)Session["loggedUser"] != "admin")
            {
                Response.Redirect("Login.aspx"); //If a user is not an administrator, it redirects to the login page for further processing
            }

            //Pulls all saved buildings from the database
            buildings = BuildingBL.fillBuildingsList();

            //Uses the ASP control IsPostBack to determine if a user actioned button click has occurred
            if (!IsPostBack)
            {
                buildingDropdown.DataSource     = buildings; //Fills the dropdown with values pulled from database
                buildingDropdown.DataValueField = "BuildingID";
                buildingDropdown.DataTextField  = "BuildingName";
                buildingDropdown.DataBind();                         //Binds the buildingID & buildingName to the data to be shown in the dropdown

                ddlbuildingDropDown_SelectedIndexChanged(sender, e); //Reflects these actions on the user display layer
            }
        }
예제 #14
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();
        }
예제 #15
0
 public Building Get(int id)
 {
     return(BuildingBL.GetById(id));
 }
예제 #16
0
 public List <Building> Get()
 {
     return(BuildingBL.GetAll());
 }
예제 #17
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);
            }
        }
예제 #18
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
                {
                }
            }
        }