protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { JumpHeights = ""; foreach (String s in ShowClasses.HEIGHTNAMES) { if (JumpHeights.Length > 0) JumpHeights += ","; JumpHeights += String.Format("'{0}'", s); } JumpHeights = "[" + JumpHeights + "]"; String cmd = Request["cmd"]; if (Session["showid"] != null) { _showid = Convert.ToInt32(Session["showid"]); } else { _showid = Convert.ToInt32(Request["showid"]); Session["showid"] = _showid.ToString(); } _orgID = Convert.ToInt32(Session["OrgID"]); ShowID.Value = _showid.ToString(); if (cmd == "edit") { Shows show = new Shows(_showid); _showStatus = show.Status; ShowDetails showDetails = new ShowDetails(); showDetails.GetFrom(_showid); ShowDetailsID.Value = showDetails.ShowDetailsID.ToString(); edtClosingDate.Value = "(not set)"; DateTime tmp = new DateTime(); if (show.ClosingDate.CompareTo(tmp) != 0) { edtClosingDate.Value = show.ClosingDate.ToString("dd MMM yyyy"); } edtShowDate.Value = show.ShowDate.ToString("dd MMM yyyy"); dspShowDate.Value = edtShowDate.Value; edtVenue.Value = (!DBNull.Value.Equals(show.Venue) ? show.Venue : ""); edtVenuePostcode.Value = (!DBNull.Value.Equals(show.VenuePostcode) ? show.VenuePostcode : ""); edtShowName.Value = show.ShowName; initialShowDate.Value = String.Format("{0:dd MMM yyyy}", show.ShowDate); System.Web.UI.HtmlControls.HtmlTableRow row = new HtmlTableRow(); System.Web.UI.HtmlControls.HtmlTableCell cell = new HtmlTableCell(); row.Attributes.Add("class", "tableHeader"); cell.InnerHtml = "Show Day"; cell.Attributes.Add("class", "showDate"); row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "Classes"; cell.Attributes.Add("class", "classSummary"); row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "<input id='btnNewDay' type='button' value='New Day' /><input id='btnRenumber' type='button' value='Renumber' />"; row.Cells.Add(cell); summaryDetails.Rows.Add(row); DataTable table = showDetails.GetAllShows().Tables[0]; if (table != null) { foreach (DataRow dataRow in table.Rows) { row = new HtmlTableRow(); row.Attributes.Add("class", "tableDetails"); row.Attributes.Add("showdate", String.Format("{0:yyyy-MM-dd}", dataRow["ShowDate"])); row.Attributes.Add("id", String.Format("day_{0}", dataRow["ShowDetailID"])); row.Attributes.Add("classdaylimit", String.Format("{0}", dataRow["ClassLimit"])); cell = new HtmlTableCell(); cell.InnerHtml = String.Format("{0:dddd, dd MMM}", dataRow["ShowDate"]); cell.Attributes.Add("class", "showDate"); row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = String.Format("({0} Classes)", dataRow["Classes"]); cell.Attributes.Add("class", "classNumber"); row.Cells.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("class", "classControls"); cell.InnerHtml = "<span class='del'>Del</span><span class='copy'>Copy</span>"; row.Cells.Add(cell); summaryDetails.Rows.Add(row); } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { FormsIdentity identity = (FormsIdentity)HttpContext.Current.User.Identity; // get the forms authetication ticket of the user FormsAuthenticationTicket ticket = identity.Ticket; // get the roles stored as UserData into the ticket String[] userData = ticket.UserData.Split(':'); String[] roles = userData[0].Split(','); int id = Convert.ToInt32(userData[1]); Fpp.WebModules.Business.User currentUser = new User(id); UserID.Value = currentUser.ID.ToString(); UserName.Value = currentUser.Name; String cmd = Request["cmd"]; int showid = Convert.ToInt32(Request["showid"]); ShowID.Value = showid.ToString(); if (cmd == "edit") { Shows show = new Shows(showid); ShowDetails showDetails = new ShowDetails(); showDetails.GetFrom(showid); ShowDetailsID.Value = showDetails.ShowDetailsID.ToString(); edtClosingDate.Value = show.ClosingDate.ToString("dd MMM yyyy"); edtShowDate.Value = show.ShowDate.ToString("dd MMM yyyy"); edtVenue.Value = show.Venue; edtVenuePostcode.Value = show.VenuePostcode; edtShowName.Value = show.ShowName; initialShowDate.Value = String.Format("{0:dd MMM yyyy}", showDetails.ShowDate); System.Web.UI.HtmlControls.HtmlTableRow row = new HtmlTableRow(); System.Web.UI.HtmlControls.HtmlTableCell cell = new HtmlTableCell(); row.Attributes.Add("class", "tableHeader"); cell.InnerHtml = "Show Day"; cell.Attributes.Add("class", "showDate"); row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "Classes"; cell.Attributes.Add("class", "classSummary"); row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "<input id='btnNewDay' type='button' value='New Day' />"; row.Cells.Add(cell); classSummary.Rows.Add(row); DataTable table = showDetails.GetAllShows().Tables[0]; if (table != null) { foreach (DataRow dataRow in table.Rows) { row = new HtmlTableRow(); row.Attributes.Add("class", "tableDetails"); row.Attributes.Add("showdate", String.Format("{0:yyyy-MM-dd}", dataRow["ShowDate"])); row.Attributes.Add("id", String.Format("{0}", dataRow["ShowDetailID"])); cell = new HtmlTableCell(); cell.InnerHtml = String.Format("{0:dddd, dd MMM}", dataRow["ShowDate"]); cell.Attributes.Add("class", "showDate"); row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = String.Format("({0} Classes)", dataRow["Classes"]); cell.Attributes.Add("class", "classNumber"); row.Cells.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("class", "classControls"); cell.InnerHtml = "<span class='del'>DEL</span>"; row.Cells.Add(cell); classSummary.Rows.Add(row); } } } } }