コード例 #1
0
ファイル: Table.aspx.cs プロジェクト: eTableTap/EtableTap
        protected void btnCheckinSection_Click(object sender, EventArgs e)
        {
            if (Session["user"] == null)
            {
                string url = Request.Url.AbsoluteUri;
                Session["LoginFallback"] = url;
                Response.Redirect("Login.aspx");
            }

            BookNowSection.Visible  = false;
            CalanderSection.Visible = false;
            CheckinSection.Visible  = true;

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

            sHour = new string(sHour.TakeWhile(Char.IsDigit).ToArray());
            BookingModel newCheckin = new BookingModel();

            newCheckin.tableID      = ID;
            newCheckin.bookingDate  = DateTime.Now;
            newCheckin.emailAddress = Session["Login"].ToString();
            newCheckin.bookingHour  = Int32.Parse(sHour);

            lblCheckinResult.Text = BookingBL.ProcessTableCheckin(newCheckin);
            //Checking returns a string telling if it was successful or not
        }
コード例 #2
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();
        }
コード例 #3
0
ファイル: Table.aspx.cs プロジェクト: eTableTap/EtableTap
        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);
            }
        }
コード例 #4
0
 public IndexController()
 {
     bookingBL = new BookingBL();
 }