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; } }
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); }
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; } }
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)); } }
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(); } }
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"); } }
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(); } }
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(); } }
//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"); } }
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; } }
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 } }
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 } }
/// <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(); }
public Building Get(int id) { return(BuildingBL.GetById(id)); }
public List <Building> Get() { return(BuildingBL.GetAll()); }
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); } }
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 { } } }