Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string   test       = txtPass.Text;
            Security mySecurity = new Security();

            if (mySecurity.IsLoggedIn())
            {
                loginLink.Style.Add("display", "none");
                registerLink.Style.Add("display", "none");
                settingsLink.Visible      = true;
                hlLogout.Visible          = true;
                myBookedRoomsLink.Visible = true;
                pnlUserSettings.Visible   = true;
                //settingsLink.Attributes.Add("onclick", "pnlVisibleTrue()");
                int UserID = mySecurity.UserID;
                LoadUserInfo(UserID);

                lblWelcome.Text = "Welcome " + mySecurity.FullName + "!";
            }
            if (mySecurity.IsAdmin())
            {
                hlAdmin.Visible = true;
            }
        }
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            Security mySecurity = new Security();

            if (!mySecurity.IsLoggedIn())
            {
                Response.Redirect("Booking.aspx?MustLogIn=true");
            }
            else
            {
                if (Page.IsValid)
                {
                    DAL      myDal     = new DAL(conn);
                    DateTime StartTime = DateTime.Parse(txtDate.Text + " " + txtStartTime.Text);
                    DateTime EndTime   = DateTime.Parse(txtDate.Text + " " + txtEndTime.Text);
                    myDal.AddParam("@FloorNumber", ddlFloor.SelectedValue);
                    myDal.AddParam("@NumberOfChairs", ddlCapacity.SelectedValue);
                    myDal.AddParam("@StartTime", StartTime);
                    myDal.AddParam("@EndTime", EndTime);
                    gvAvailableRooms.DataSource = myDal.ExecuteProcedure("spSearch");
                    gvAvailableRooms.DataBind();
                }
            }
        }