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"); }
/// <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(); }
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 { } } }