protected void Page_Load(object sender, EventArgs e) { if (Session["currentuser"] == null) { Response.Redirect("Login.aspx"); } if (!IsPostBack) { chkindate.Text = DateTime.Now.ToString("yyyy-MM-dd"); chkoutdate.Text = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"); ddlreservationtype.DataSource = _reservartiontypemanagement.GetAll(); ddlreservationtype.DataTextField = "ReservationType"; ddlreservationtype.DataValueField = "ReservationTypeID"; ddlreservationtype.DataBind(); ddlGuestNumber.DataSource = _roommanagement.GetAll(); ddlGuestNumber.DataTextField = "RoomNumber"; ddlGuestNumber.DataValueField = "RoomNumber"; ddlGuestNumber.DataBind(); } }
public List <Room> GetAll() { return(_rom.GetAll()); }
protected void ddltotalperson_SelectedIndexChanged(object sender, EventArgs e) { ContentPlaceHolder contentPlaceHolder = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1"); int totalPeople = Convert.ToInt32(ddltotalperson.SelectedValue); string[] ptext = new string[] { "First Name", "Last Name", "Civilization Number", "Gender" }; int countroom = 2; for (int i = 1; i < totalPeople; i++) { HtmlGenericControl div = new HtmlGenericControl("div"); div.ID = string.Format("div{0}", i); div.Style.Add(HtmlTextWriterStyle.Display, "inline-block"); for (int j = 0; j < 4; j++) { if (j != 3) { HtmlGenericControl innerdiv = new HtmlGenericControl("div"); innerdiv.ID = string.Format("innerdiv{0}", i * 4 + j); innerdiv.Attributes.Add("class", "name-agile"); innerdiv.Style.Add(HtmlTextWriterStyle.Width, "266.82px"); innerdiv.InnerHtml = string.Format("<p>{0}</p>", ptext[j]); TextBox txt = new TextBox(); txt.ID = string.Format("Guest{0}{1}", i, ptext[j].Replace(" ", string.Empty)); txt.ClientIDMode = ClientIDMode.Static; txt.Attributes.Add("name", txt.ClientID); txt.Attributes.Add("placeholder", string.Format("{1}.Guest {0}", ptext[j], (i + 1))); innerdiv.Controls.Add(txt); div.Controls.Add(innerdiv); guest.Controls.Add(div); } else { HtmlGenericControl innerdiv = new HtmlGenericControl("div"); innerdiv.ID = string.Format("innerdiv{0}", i * 4 + j); innerdiv.Attributes.Add("class", "room-agile"); innerdiv.InnerHtml = string.Format("<p>{0}</p>", ptext[j]); DropDownList ddl = new DropDownList(); ddl.ID = string.Format("Guest{0}{1}", i, ptext[j].Replace(" ", string.Empty)); ddl.ClientIDMode = ClientIDMode.Static; ddl.Attributes.Add("name", ddl.ClientID); var ddlmale = new ListItem(); ddlmale.Text = "Male"; ddlmale.Value = "Male"; var ddlfamale = new ListItem(); ddlfamale.Text = "Female"; ddlfamale.Value = "Female"; ddl.Items.Add(ddlfamale); ddl.Items.Add(ddlmale); innerdiv.Controls.Add(ddl); div.Controls.Add(innerdiv); guest.Controls.Add(div); } } if ((i == 2 && totalPeople > 3) || (i == 5 && totalPeople > 6) || (i == 8 && totalPeople == 10)) { HtmlGenericControl roomdiv = new HtmlGenericControl("div"); roomdiv.ID = string.Format("roomdiv{0}", i); roomdiv.Attributes.Add("class", "room-agile"); roomdiv.InnerHtml = string.Format("<p>{0}Room Numbers</p>", countroom); roomdiv.Style.Add(HtmlTextWriterStyle.MarginLeft, "-150px"); roomdiv.Style.Add(HtmlTextWriterStyle.MarginTop, "30px"); DropDownList ddl1 = new DropDownList(); ddl1.ID = string.Format("Guest{0}", i); ddl1.ClientIDMode = ClientIDMode.Static; ddl1.DataSource = _roommanagement.GetAll(); ddl1.DataTextField = "RoomNumber"; ddl1.DataValueField = "RoomNumber"; ddl1.DataBind(); ddl1.Attributes.Add("name", ddl1.ClientID); countroom += 1; roomdiv.Controls.Add(ddl1); div.Controls.Add(roomdiv); guest.Controls.Add(div); } } }