Exemplo n.º 1
0
        //On Page Load, Checks if date and room nr is set and available
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = $"Landlyst - Værelse: {Request["Room"]}";

            if (
                Request["SDate"] == new DateTime().ToString("dd-MM-yyyy") ||
                Request["LDate"] == new DateTime().ToString("dd-MM-yyyy") ||
                string.IsNullOrEmpty(Request["SDate"]) ||
                string.IsNullOrEmpty(Request["LDate"]))
            {
                Response.Redirect(@"..\Booking");
            }

            try
            {
                if (!reception.CheckAvailableRoom(
                        int.Parse(Request["Room"]),
                        Convert.ToDateTime(Request["SDate"]),
                        Convert.ToDateTime(Request["LDate"])
                        ))
                {
                    Response.Redirect(@"..\Booking\?e=1");
                }
            }
            catch (Exception)
            {
                Response.Redirect(@"..\Booking");
                throw;
            }
        }