public static void ProductOptionsAsControls(Catalog.OptionList options, System.Web.UI.WebControls.PlaceHolder ph) { foreach (Catalog.Option opt in options) { if (!opt.NameIsHidden) { System.Web.UI.LiteralControl lit = new System.Web.UI.LiteralControl("<label for=\"" + opt.Bvin.Replace("-", "") + "\">" + opt.Name + "</label>"); lit.EnableViewState = false; ph.Controls.Add(lit); } System.Web.UI.LiteralControl lit2 = new System.Web.UI.LiteralControl("<span class=\"choice\">"); lit2.EnableViewState = false; ph.Controls.Add(lit2); opt.RenderAsControl(ph); System.Web.UI.LiteralControl lit3 = new System.Web.UI.LiteralControl("</span>"); lit3.EnableViewState = false; ph.Controls.Add(lit3); } }
private void ProgramRunTime() { long ProgramEndRunTime = System.Environment.TickCount; programRunTime = ProgramEndRunTime - this.ProgramBeginRunTime; System.Web.UI.LiteralControl literal = new System.Web.UI.LiteralControl("<!-- 程序运行时间 " + programRunTime.ToString() + " 毫秒 -->"); this.Page.Controls.Add(literal); }
public void InstantiateIn(System.Web.UI.Control container) { anchor = new System.Web.UI.LiteralControl(); anchor.ID = "MemberCaseLinkAnchor"; anchor.DataBinding += new EventHandler(MemberCaseLinkTemplate_DataBinding); container.Controls.Add(anchor); }
public void MemberCaseLinkTemplate_DataBinding(Object sender, EventArgs e) { System.Web.UI.LiteralControl controlInstance = (System.Web.UI.LiteralControl)sender; if (!(controlInstance.NamingContainer is Telerik.Web.UI.GridDataItem)) { return; } Telerik.Web.UI.GridDataItem container = (Telerik.Web.UI.GridDataItem)controlInstance.NamingContainer; Client.Core.CoreObject coreObject = (Client.Core.CoreObject)container.DataItem; controlInstance.Text = CommonFunctions.CaseAnchor(coreObject.Id, coreObject.Id.ToString()); return; }
protected void Page_Load(object sender, EventArgs e) { try { this.GetResponceData(); } catch (Exception ex) { System.Web.UI.LiteralControl deadlineMessage = new System.Web.UI.LiteralControl(); deadlineMessage.Text = "<link rel='stylesheet' href='/_catalogs/masterpage/bmsc/styles/advertising_thanks_a.css'>" + "<div class='advertisingMessage'>" + ex.Message + "</div>"; this.Controls.Clear(); this.Controls.Add(deadlineMessage); } }
public void MemberLinkTemplate_DataBinding(Object sender, EventArgs e) { System.Web.UI.LiteralControl controlInstance = (System.Web.UI.LiteralControl)sender; if (!(controlInstance.NamingContainer is Telerik.Web.UI.GridDataItem)) { return; } Telerik.Web.UI.GridDataItem container = (Telerik.Web.UI.GridDataItem)controlInstance.NamingContainer; Client.Core.Member.Member member = (Client.Core.Member.Member)container.DataItem; controlInstance.Text = CommonFunctions.MemberProfileAnchor(member.Id, member.Name); return; }
protected override void OnInit(EventArgs e) { base.OnInit(e); InitializeControl(); try { this.GetFormData(); } catch (Exception ex) { System.Web.UI.LiteralControl deadlineMessage = new System.Web.UI.LiteralControl(); deadlineMessage.Text = "<link rel='stylesheet' href='/_catalogs/masterpage/bmsc/styles/advertising_a.css'>" + "<div class='advertisingMessage'>" + ex.Message + "</div>"; this.Controls.Clear(); this.Controls.Add(deadlineMessage); } }
public void p5_web_page_add_meta_tag(ApplicationContext context, ActiveEventArgs e) { // Making sure we clean up and remove all arguments passed in after execution using (new ArgsRemover(e.Args)) { // Verifying this is not an Ajax request, and if it is, we throw an exception. if (IsAjaxRequest) { throw new LambdaException("You can't add a meta tag during an Ajax request", e.Args, context); } var lit = new System.Web.UI.LiteralControl(); var attrs = ""; foreach (var idxAtr in e.Args.Children.Where(ix => ix.Name != "")) { attrs += string.Format("{0}=\"{1}\" ", idxAtr.Name, idxAtr.GetExValue <string> (context)); } lit.Text = string.Format("<{0} {1}/>", e.Args.GetExValue <string> (context), attrs); Header.Controls.Add(lit); } }
/// <summary> /// Respond to a <c>DataGrid.ItemCreated</c> event where <c>DataGridItemEventArgs.Item.ItemType == ListItemType.Pager</c>. /// </summary> /// <param name="e">Event DataGridItemEventArgs.</param> public static void CustomizePager(System.Web.UI.WebControls.DataGridItemEventArgs e) { System.Web.UI.WebControls.TableCell pager = (System.Web.UI.WebControls.TableCell)e.Item.Controls[0]; for (int i = 0; i < pager.Controls.Count; i++) { if (pager.Controls[i].ToString() == "System.Web.UI.WebControls.Label") { System.Web.UI.WebControls.Label lbl = (System.Web.UI.WebControls.Label)pager.Controls[i]; lbl.Text = "Page " + lbl.Text; } else if (pager.Controls[i].ToString() == "System.Web.UI.LiteralControl") { System.Web.UI.LiteralControl lit = (System.Web.UI.LiteralControl)pager.Controls[i]; lit.Text = " | "; } else { System.Web.UI.WebControls.LinkButton lnk = (System.Web.UI.WebControls.LinkButton)pager.Controls[i]; lnk.Text = "Page " + lnk.Text; } } }
/// <summary> /// Renders the specified context. /// </summary> /// <param name="context">The context.</param> /// <param name="result">The result.</param> public override void Render(Context context, TextWriter result) { RockPage page = HttpContext.Current.Handler as RockPage; var parms = ParseMarkup(_markup, context); using (TextWriter twStylesheet = new StringWriter()) { base.Render(context, twStylesheet); var stylesheet = twStylesheet.ToString(); if (parms.ContainsKey("compile")) { if (parms["compile"] == "less") { DotlessConfiguration dotLessConfiguration = new DotlessConfiguration(); dotLessConfiguration.MinifyOutput = true; if (parms.ContainsKey("import")) { // import statements should go at the end to allow for default variable assignment in the beginning // to help reduce the number of Less errors we automatically add the bootstrap and core rock variables files var importStatements = string.Empty; var importSource = "~/Styles/Bootstrap/variables.less,~/Styles/_rock-variables.less," + parms["import"]; var importFiles = importSource.Split(','); foreach (var importFile in importFiles) { var filePath = string.Empty; if (!importFile.StartsWith("~")) { filePath = $"~~/Styles/{importFile}"; } else { filePath = importFile; } filePath = page.ResolveRockUrl(filePath); var fullPath = page.MapPath("~/") + filePath; if (File.Exists(fullPath)) { importStatements = $"{importStatements}{Environment.NewLine}@import \"{fullPath}\";"; } } stylesheet = $"{stylesheet}{Environment.NewLine}{importStatements}"; } // ok we have our less stylesheet let's see if it's been cached (less can take ~100ms to compile so let's try not to do that if necessary) if (parms.ContainsKey("cacheduration")) { var cacheKey = stylesheet.GetHashCode().ToString(); var cachedStylesheet = RockCache.Get(cacheKey) as string; if (cachedStylesheet.IsNotNullOrWhiteSpace()) { stylesheet = cachedStylesheet; } else { stylesheet = LessWeb.Parse(stylesheet, dotLessConfiguration); // check if we should cache this if (parms.ContainsKey("cacheduration") && stylesheet.IsNotNullOrWhiteSpace()) { int cacheDuration = 0; Int32.TryParse(parms["cacheduration"], out cacheDuration); if (cacheDuration > 0) { RockCache.AddOrUpdate(cacheKey, null, stylesheet, RockDateTime.Now.AddSeconds(cacheDuration)); } } } } else { stylesheet = LessWeb.Parse(stylesheet, dotLessConfiguration); } } if (stylesheet == string.Empty) { if (parms.ContainsKey("id")) { result.Write($"An error occurred compiling the Less for this stylesheet (id: {parms["id"]})."); } else { result.Write("An error occurred compiling the Less for this stylesheet."); } return; } } if (parms.ContainsKey("id")) { var identifier = parms["id"]; if (identifier.IsNotNullOrWhiteSpace()) { var controlId = "css-" + identifier; var cssControl = page.Header.FindControl(controlId); if (cssControl == null) { cssControl = new System.Web.UI.LiteralControl($"{Environment.NewLine}<style>{stylesheet}</style>{Environment.NewLine}"); cssControl.ID = controlId; page.Header.Controls.Add(cssControl); } } } else { page.Header.Controls.Add(new System.Web.UI.LiteralControl($"{Environment.NewLine}<style>{stylesheet}</style>{Environment.NewLine}")); } } }
protected void btnSend_Click(object sender, EventArgs e) { try { if (Page.IsValid) { string newItemId = ""; using (SPSite sps = new SPSite(SPContext.Current.Web.Url)) using (SPWeb spw = sps.OpenWeb()) { SPListItemCollection itemsAdvertisingRecords = spw.Lists[ADVERTISING_RECORDS].Items; SPListItem newItem = itemsAdvertisingRecords.Add(); List <string> sendMailResponce = new List <string>(2); System.Web.UI.WebControls.DropDownList officeElement = new System.Web.UI.WebControls.DropDownList(); string nameBox; string phoneBox; if (SpAdvertisingTemplate == Templates.Plantilla_A) { officeElement = ddlOfficeA; nameBox = txbNameA.Text; phoneBox = txbPhoneA.Text; } else { officeElement = ddlOfficeB; nameBox = txbNameB.Text; phoneBox = txbPhoneB.Text; } sendMailResponce = this.SendMail( spw, officeElement.SelectedIndex - 1, nameBox, phoneBox); newItem["Title"] = nameBox; newItem["T_x00ed_tulo_x0020_Campa_x00f1_a"] = spw.Lists[ADVERTISING_PARAMETERS].GetItemById(SpAdvertisingId).Title; newItem["Tel_x00e9_fono_x0020_Registro"] = phoneBox; newItem["Agencia_x0020_Registro"] = officeElement.SelectedItem.Value + " | " + officeElement.SelectedItem.Text; newItem["Correo_x0020_Enviado"] = Convert.ToBoolean(sendMailResponce[0]); newItem["Comentarios_x0020_Registro"] = sendMailResponce[1]; newItem.Update(); newItemId = newItem.ID.ToString(); } Page.Response.Redirect(SpAdvertisingRedirect + "?ad=" + SpAdvertisingId + "&cl=" + newItemId, true); } } catch (Exception ex) { //pnlFormA.Visible = false; //pnlFormB.Visible = false; System.Web.UI.LiteralControl deadlineMessage = new System.Web.UI.LiteralControl(); deadlineMessage.Text = "<link rel='stylesheet' href='/_catalogs/masterpage/bmsc/styles/advertising_a.css'>" + "<div class='advertisingMessage'>" + ex.Message + "</div>"; this.Controls.Clear(); this.Controls.Add(deadlineMessage); } }
public void LoadHtmlTable() { System.Web.UI.HtmlControls.HtmlTable tblPivot = new System.Web.UI.HtmlControls.HtmlTable(); tblPivot.CellPadding = 0; tblPivot.CellSpacing = 0; tblPivot.Width = "100%"; tblPivot.Height = "100%"; tblPivot.Attributes.Add("class", "tbl1_T"); pnlPivot.Controls.Add(tblPivot); if (_report == null || _report.Cellset.IsValid == false) { return; } int Ax0MemCount = _report.Cellset.Axis0TupleMemCount; int Ax1MemCount = _report.Cellset.Axis1TupleMemCount; int Ax0PosCount = _report.Cellset.Axis0PosCount; int Ax1PosCount = _report.Cellset.Axis1PosCount; int ax0OrderPos = _report.GetOrderPosition(_report.Axes[0]); int ax1OrderPos = _report.GetOrderPosition(_report.Axes[1]); Hierarchy ax1Hier = null; Hierarchy ax0Hier = null; //table System.Web.UI.HtmlControls.HtmlTableRow tr = null; System.Web.UI.HtmlControls.HtmlTableCell td = null; if (Ax0PosCount == 0 && Ax1PosCount == 0) { tr = new HtmlTableRow(); tblPivot.Rows.Add(tr); td = new HtmlTableCell(); tr.Cells.Add(td); td.Attributes.Add("class", "tbl1_err"); td.Attributes.Add("nowrap", "true"); td.InnerText = "Query successfully executed, cellset contains no data"; return; } for (int i = 0; i < Ax0MemCount; i++) { tr = new System.Web.UI.HtmlControls.HtmlTableRow(); tblPivot.Rows.Add(tr); for (int j = 0; j < Ax1MemCount; j++) { td = new System.Web.UI.HtmlControls.HtmlTableCell(); td.Attributes.Add("class", "tbl1_HC"); td.NoWrap = true; tr.Cells.Add(td); //hier controls in last row if (i == Ax0MemCount - 1) { this.CreateHierControls(_report.Axes[1].Hierarchies[j], td); } } ax0Hier = _report.Axes[0].Hierarchies[i]; for (int j = 0; j < Ax0PosCount; j++) { CellsetMember mem = _report.Cellset.GetCellsetMember(0, i, j); bool inOrderTuple = false; //if same as prev, continue if (j != 0 && _report.Cellset.GetCellsetMember(0, i, j - 1).UniqueName == mem.UniqueName) { continue; } td = new System.Web.UI.HtmlControls.HtmlTableCell(); td.NoWrap = true; // handle order position highlight if (j == ax0OrderPos) // in order tuple { inOrderTuple = true; } // handle colspan int spanCount = 1; for (int n = j + 1; n < Ax0PosCount; n++) { CellsetMember nextMem = _report.Cellset.GetCellsetMember(0, i, n); if (nextMem.UniqueName == mem.UniqueName) { spanCount++; // handle order position highlight if (n == ax0OrderPos) { inOrderTuple = true; } } else { break; } } // handle order position highlight if (inOrderTuple) // in order tuple { td.Attributes.Add("class", "tbl1_H3"); } else { td.Attributes.Add("class", "tbl1_H2"); } // if we span if (spanCount > 1) { td.ColSpan = spanCount; } if (mem.ChildCount == 0) { // leaf-level System.Web.UI.HtmlControls.HtmlImage img = new System.Web.UI.HtmlControls.HtmlImage(); img.Src = "../images/leaf.gif"; td.Controls.Add(img); } System.Web.UI.HtmlControls.HtmlInputCheckBox chb = new System.Web.UI.HtmlControls.HtmlInputCheckBox(); chb.ID = "m:" + _contr.IdentifierFromCellsetPosition(0, j, i); chb.EnableViewState = false; td.EnableViewState = false; td.Controls.Add(chb); System.Web.UI.LiteralControl literal = new System.Web.UI.LiteralControl(mem.Name); td.Controls.Add(literal); tr.Cells.Add(td); } // hier controls in last col td = new System.Web.UI.HtmlControls.HtmlTableCell(); td.Attributes.Add("class", "tbl1_HC"); td.NoWrap = true; CreateHierControls(ax0Hier, td); tr.Cells.Add(td); } for (int i = 0; i < Ax1PosCount; i++) { tr = new System.Web.UI.HtmlControls.HtmlTableRow(); tblPivot.Rows.Add(tr); for (int j = 0; j < Ax1MemCount; j++) { ax1Hier = _report.Axes[1].Hierarchies[j]; CellsetMember mem = _report.Cellset.GetCellsetMember(1, j, i); bool inOrderTuple = false; //if same as prev, continue if (i != 0 && _report.Cellset.GetCellsetMember(1, j, i - 1).UniqueName == mem.UniqueName) { continue; } td = new System.Web.UI.HtmlControls.HtmlTableCell(); td.NoWrap = true; // handle order position highlight if (i == ax1OrderPos) // in order tuple { inOrderTuple = true; } // handle rowspan int spanCount = 1; for (int n = i + 1; n < Ax1PosCount; n++) { CellsetMember nextMem = _report.Cellset.GetCellsetMember(1, j, n); if (nextMem.UniqueName == mem.UniqueName) { spanCount++; // handle order position highlight if (n == ax1OrderPos) { inOrderTuple = true; } } else { break; } } // handle order position highlight if (inOrderTuple) // in order tuple { td.Attributes.Add("class", "tbl1_H1"); } else { td.Attributes.Add("class", "tbl1_H"); } // if we span if (spanCount > 1) { td.RowSpan = spanCount; } if (mem.ChildCount == 0) { // leaf-level System.Web.UI.HtmlControls.HtmlImage img = new System.Web.UI.HtmlControls.HtmlImage(); img.Src = "../images/leaf.gif"; td.Controls.Add(img); } System.Web.UI.HtmlControls.HtmlInputCheckBox chb = new System.Web.UI.HtmlControls.HtmlInputCheckBox(); chb.ID = "m:" + _contr.IdentifierFromCellsetPosition(1, i, j); chb.EnableViewState = false; td.EnableViewState = false; td.Controls.Add(chb); System.Web.UI.LiteralControl literal = new System.Web.UI.LiteralControl(mem.Name); td.Controls.Add(literal); tr.Cells.Add(td); } for (int j = 0; j < Ax0PosCount; j++) { td = new System.Web.UI.HtmlControls.HtmlTableCell(); td.Attributes.Add("class", "tbl1_C"); td.NoWrap = true; Cell olapCell = _report.Cellset.GetCell(j, i); td.InnerText = olapCell.FormattedValue; tr.Cells.Add(td); } } }
/// <summary> /// Obtiene toda la informacion para ser mostrada en la pagina. /// </summary> private void GetResponceData() { if (SpAdvertisingTemplate == Templates.Plantilla_A) { ltrStyle.Text = "<link rel='stylesheet' href='/_catalogs/masterpage/bmsc/styles/advertising_thanks_a.css'>"; } else { ltrStyle.Text = "<link rel='stylesheet' href='/_catalogs/masterpage/bmsc/styles/advertising_thanks_b.css'>"; } string advertisingTitle = ""; string advertisingDescription = ""; string advertisingImage = ""; string advertisingAttach = ""; bool advertisingDownload = false; string advertisingId = ""; string advertisingRecordId = ""; string advertisingRecordClient = ""; string advertisingRecordOffice = ""; using (SPSite sps = new SPSite(SPContext.Current.Web.Url)) using (SPWeb spw = sps.OpenWeb()) { /*Consulta para obtener datos de la campaña*/ advertisingId = Page.Request.QueryString["ad"]; SPQuery queryAdv = new SPQuery(); queryAdv.Query = string.Format( "<Where><And>" + "<Eq><FieldRef Name='ID' /><Value Type='Counter'>{0}</Value></Eq>" + "<Eq><FieldRef Name='_ModerationStatus' /><Value Type='ModStat'>0</Value></Eq>" + "</And></Where>", advertisingId); SPListItemCollection advertising = spw.Lists[ADVERTISING_PARAMETERS].GetItems(queryAdv); if (advertising.Count == 1) { SPListItem theAdvertising = advertising[0]; advertisingTitle = theAdvertising["T_x00ed_tulo_x0020_Agradecimient"].ToString(); advertisingDescription = theAdvertising["Descripci_x00f3_n_x0020_Agradeci"].ToString().Replace("\n", "<br/>"); advertisingDownload = Convert.ToBoolean(theAdvertising["Descargar_x0020_Campa_x00f1_a"].ToString()); advertisingImage = theAdvertising["Imagen_x0020_Agradecimiento"].ToString(); if (advertisingImage.Contains(",")) { advertisingImage = advertisingImage.Remove(advertisingImage.IndexOf(',')); } if (theAdvertising.Attachments.Count > 0) { advertisingAttach = string.Format( "/Lists/Publicidad%20Parmetros/Attachments/{0}/{1}", theAdvertising.ID, theAdvertising.Attachments[0]); } } else { System.Web.UI.LiteralControl deadlineMessage = new System.Web.UI.LiteralControl(); deadlineMessage.Text = "<link rel='stylesheet' href='/_catalogs/masterpage/bmsc/styles/advertising_thanks_a.css'>" + "<div class='advertisingMessage'>" + "La campaña con el ID <b>" + advertisingId + "</b> no existe o no esta aprobada.</div>"; this.Controls.Clear(); this.Controls.Add(deadlineMessage); } /*Consulta para obtener datos del cliente*/ advertisingRecordId = Page.Request.QueryString["cl"]; SPListItem theClient = spw.Lists[ADVERTISING_RECORDS].GetItemById(Convert.ToInt32(advertisingRecordId)); advertisingRecordClient = theClient["Title"].ToString().Trim().ToUpper(); advertisingRecordOffice = theClient["Agencia_x0020_Registro"].ToString().Substring( theClient["Agencia_x0020_Registro"].ToString().LastIndexOf('|') + 1).ToUpper().Trim(); } lblAdvertisingName.Text = advertisingTitle.Replace("[C]", advertisingRecordClient).Replace("[A]", advertisingRecordOffice); lblAdvertisingDescription.Text = advertisingDescription.Replace("[C]", advertisingRecordClient).Replace("[A]", advertisingRecordOffice); ltrAdvertisingDownload.Text = this.FormatDownloadControl(advertisingDownload, advertisingAttach); if (SpAdvertisingTemplate != Templates.Plantilla_A) { ltrBackgroundB.Text = string.Format( "<style type='text/css'>" + "html {{" + "height:100%; min-height:100%;" + "background: url('{0}') no-repeat center center fixed;" + "-webkit-background-size: cover;" + "-moz-background-size: cover;" + "-o-background-size: cover;" + "background-size: cover;" + "}}" + "</style>", advertisingImage); } }
public void RenderAsControl(Option baseOption, System.Web.UI.WebControls.PlaceHolder ph) { System.Web.UI.LiteralControl result = new System.Web.UI.LiteralControl(baseOption.Settings.GetSettingOrEmpty("html")); ph.Controls.Add(result); }
public void RenderAsControl(Option baseOption, System.Web.UI.WebControls.PlaceHolder ph) { System.Web.UI.LiteralControl result = new System.Web.UI.LiteralControl(baseOption.Settings.GetSettingOrEmpty("html")); ph.Controls.Add(result); }
public static void ProductOptionsAsControls(Catalog.OptionList options, System.Web.UI.WebControls.PlaceHolder ph) { foreach (Catalog.Option opt in options) { if (!opt.NameIsHidden) { System.Web.UI.LiteralControl lit = new System.Web.UI.LiteralControl("<label for=\"" + opt.Bvin.Replace("-", "") + "\">" + opt.Name + "</label>"); lit.EnableViewState = false; ph.Controls.Add(lit); } System.Web.UI.LiteralControl lit2 = new System.Web.UI.LiteralControl("<span class=\"choice\">"); lit2.EnableViewState = false; ph.Controls.Add(lit2); opt.RenderAsControl(ph); System.Web.UI.LiteralControl lit3 = new System.Web.UI.LiteralControl("</span>"); lit3.EnableViewState = false; ph.Controls.Add(lit3); } }
/// <summary> /// Obtiene los datos de Ciudad y Agencia para el formulario. /// </summary> private void GetFormData() { if (SpAdvertisingTemplate == Templates.Plantilla_A) { ltrStyle.Text = "<link rel='stylesheet' href='/_catalogs/masterpage/bmsc/styles/advertising_a.css'>"; pnlFormA.Visible = true; } else { ltrStyle.Text = "<link rel='stylesheet' href='/_catalogs/masterpage/bmsc/styles/advertising_b.css'>"; pnlFormB.Visible = true; } advertisingOffices = new List <Office>(); advertisingCities = new List <string>(); string advertisingTitle = ""; string advertisingDescription = ""; string advertisingImage = ""; string advertisingNote = ""; string advertisingDeadline = ""; string advertisingButton = ""; bool advertisingCountdown = false; using (SPSite sps = new SPSite(SPContext.Current.Web.Url)) using (SPWeb spw = sps.OpenWeb()) { /*Consulta para obtener Ciudades y demas datos del formulario*/ SPQuery queryAdv = new SPQuery(); queryAdv.Query = string.Format( "<Where><And>" + "<Eq><FieldRef Name='ID' /><Value Type='Counter'>{0}</Value></Eq>" + "<Eq><FieldRef Name='_ModerationStatus' /><Value Type='ModStat'>0</Value></Eq>" + "</And></Where>", SpAdvertisingId); SPListItemCollection advertising = spw.Lists[ADVERTISING_PARAMETERS].GetItems(queryAdv); if (advertising.Count == 1) { SPListItem theAdvertising = advertising[0]; string[] stringSeparators = new string[] { ";#" }; string cities = theAdvertising["Ciudades_x0020_Campa_x00f1_a"].ToString().ToUpper(); advertisingCities = new List <string>(cities.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries)); foreach (string city in advertisingCities) { /*Consulta para obtener Agencias, en base a las Ciudades elegidas*/ SPQuery queryOffice = new SPQuery(); queryOffice.Query = string.Format( "<OrderBy><FieldRef Name='Departamento0' /><FieldRef Name='Title' /></OrderBy>" + "<Where><And>" + "<Eq><FieldRef Name='Departamento0' /><Value Type='Text'>{0}</Value></Eq>" + "<Eq><FieldRef Name='_ModerationStatus' /><Value Type='ModStat'>0</Value></Eq>" + "</And></Where>", city); SPListItemCollection offices = spw.Lists[ADVERTISING_OFFICES].GetItems(queryOffice); foreach (SPListItem office in offices) { //string officeMail = office.Title.Replace(" ", "") + "@gnet.com"; string officeMail = ""; if (office["Correo_x0020_oficina"] != null) { officeMail = office["Correo_x0020_oficina"].ToString().Trim(); } advertisingOffices.Add(new Office(office.ID, office.Title.Trim(), office["Departamento0"].ToString().Trim(), office["Direcci_x00f3_n"].ToString().Trim(), officeMail)); } } /*Recuperar los demas datos para el formulario*/ advertisingTitle = theAdvertising.Title; advertisingDescription = theAdvertising["Descripci_x00f3_n_x0020_Campa_x0"].ToString().Replace("\n", "<br/>"); advertisingImage = theAdvertising["Imagen_x0020_Campa_x00f1_a"].ToString(); if (advertisingImage.Contains(",")) { advertisingImage = advertisingImage.Remove(advertisingImage.IndexOf(',')); } if (theAdvertising["Nota_x0020_Campa_x00f1_a"] != null) { advertisingNote = theAdvertising["Nota_x0020_Campa_x00f1_a"].ToString(); } if (theAdvertising["Vigencia_x0020_Campa_x00f1_a"] != null) { advertisingDeadline = theAdvertising["Vigencia_x0020_Campa_x00f1_a"].ToString(); } advertisingButton = theAdvertising["Bot_x00f3_n_x0020_Campa_x00f1_a"].ToString(); advertisingCountdown = Convert.ToBoolean(theAdvertising["Cuenta_x0020_Regresiva"].ToString()); } else { //pnlFormA.Visible = false; //pnlFormB.Visible = false; System.Web.UI.LiteralControl deadlineMessage = new System.Web.UI.LiteralControl(); deadlineMessage.Text = "<link rel='stylesheet' href='/_catalogs/masterpage/bmsc/styles/advertising_a.css'>" + "<div class='advertisingMessage'>" + "La campaña con el ID <b>" + SpAdvertisingId + "</b> no existe o no esta aprobada.</div>"; this.Controls.Clear(); this.Controls.Add(deadlineMessage); } } lblAdvertisingNameA.Text = advertisingTitle; lblAdvertisingNameB.Text = advertisingTitle; lblAdvertisingDescriptionA.Text = advertisingDescription; lblAdvertisingDescriptionB.Text = advertisingDescription; ltrBackgroundB.Text = string.Format( "<style type='text/css'>" + "html {{" + "height:100%; min-height:100%;" + "background: url('{0}') no-repeat center center fixed;" + "-webkit-background-size: cover;" + "-moz-background-size: cover;" + "-o-background-size: cover;" + "background-size: cover;" + "}}" + "</style>", advertisingImage); lblAdvertisingNoteA.Text = advertisingNote; lblAdvertisingNoteB.Text = advertisingNote; btnSendA.Text = advertisingButton; btnSendB.Text = advertisingButton; ddlCityA.DataSource = advertisingCities; ddlCityB.DataSource = advertisingCities; ddlCityA.DataBind(); ddlCityB.DataBind(); ddlCityA.Items.Insert(0, new System.Web.UI.WebControls.ListItem("", string.Empty)); ddlCityB.Items.Insert(0, new System.Web.UI.WebControls.ListItem("", string.Empty)); ddlOfficeA.DataValueField = "Id"; ddlOfficeB.DataValueField = "Id"; ddlOfficeA.DataTextField = "Display"; ddlOfficeB.DataTextField = "Display"; ddlOfficeA.DataSource = advertisingOffices; ddlOfficeB.DataSource = advertisingOffices; ddlOfficeA.DataBind(); ddlOfficeB.DataBind(); ddlOfficeA.Items.Insert(0, new System.Web.UI.WebControls.ListItem("", string.Empty)); ddlOfficeB.Items.Insert(0, new System.Web.UI.WebControls.ListItem("", string.Empty)); ltrCountdownA.Text = this.FormatCountdownControl(advertisingCountdown, advertisingDeadline); ltrCountdownB.Text = this.FormatCountdownControl(advertisingCountdown, advertisingDeadline); }
/// <summary> /// Renders the specified context. /// </summary> /// <param name="context">The context.</param> /// <param name="result">The result.</param> public override void Render(Context context, TextWriter result) { RockPage page = HttpContext.Current.Handler as RockPage; var parms = ParseMarkup(_markup, context); using (TextWriter twJavascript = new StringWriter()) { base.Render(context, twJavascript); if (parms["url"].IsNullOrWhiteSpace()) { string javascript = ""; if (!parms["disableanonymousfunction"].AsBoolean()) { javascript = $@"(function(){{ {twJavascript.ToString()} }})({parms["references"]});"; } else { javascript = twJavascript.ToString(); } if (parms.ContainsKey("id")) { var identifier = parms["id"]; if (identifier.IsNotNullOrWhiteSpace()) { var controlId = "js-" + identifier; var scriptControl = page.Header.FindControl(controlId); if (scriptControl == null) { scriptControl = new System.Web.UI.LiteralControl($"{Environment.NewLine}<script>{javascript}</script>{Environment.NewLine}"); scriptControl.ID = controlId; page.Header.Controls.Add(scriptControl); } } } else { page.Header.Controls.Add(new System.Web.UI.LiteralControl($"{Environment.NewLine}<script>{javascript}</script>{Environment.NewLine}")); } } else { var url = ResolveRockUrl(parms["url"]); if (parms.ContainsKey("id")) { var identifier = parms["id"]; if (identifier.IsNotNullOrWhiteSpace()) { var controlId = "js-" + identifier; var scriptControl = page.Header.FindControl(controlId); if (scriptControl == null) { scriptControl = new System.Web.UI.LiteralControl($"{Environment.NewLine}<script src='{url}' type='text/javascript'></script>{Environment.NewLine}"); scriptControl.ID = controlId; page.Header.Controls.Add(scriptControl); } } } else { page.Header.Controls.Add(new System.Web.UI.LiteralControl($"{Environment.NewLine}<script src='{url}' type='text/javascript'></script>{Environment.NewLine}")); } } } }
public void LoadHtmlTable() { System.Web.UI.HtmlControls.HtmlTable tblPivot=new System.Web.UI.HtmlControls.HtmlTable(); tblPivot.CellPadding=0; tblPivot.CellSpacing=0; tblPivot.Width="100%"; tblPivot.Height="100%"; tblPivot.Attributes.Add("class" , "tbl1_T"); pnlPivot.Controls.Add(tblPivot); if(_report==null || _report.Cellset.IsValid==false) return; int Ax0MemCount=_report.Cellset.Axis0TupleMemCount; int Ax1MemCount=_report.Cellset.Axis1TupleMemCount; int Ax0PosCount=_report.Cellset.Axis0PosCount; int Ax1PosCount=_report.Cellset.Axis1PosCount; int ax0OrderPos=_report.GetOrderPosition(_report.Axes[0]); int ax1OrderPos=_report.GetOrderPosition(_report.Axes[1]); Hierarchy ax1Hier=null; Hierarchy ax0Hier=null; //table System.Web.UI.HtmlControls.HtmlTableRow tr=null; System.Web.UI.HtmlControls.HtmlTableCell td=null; if(Ax0PosCount==0 && Ax1PosCount==0) { tr=new HtmlTableRow(); tblPivot.Rows.Add(tr); td=new HtmlTableCell(); tr.Cells.Add(td); td.Attributes.Add("class" , "tbl1_err"); td.Attributes.Add("nowrap" , "true"); td.InnerText="Query successfully executed, cellset contains no data"; return; } for (int i=0 ; i<Ax0MemCount ; i++ ) { tr=new System.Web.UI.HtmlControls.HtmlTableRow(); tblPivot.Rows.Add(tr); for (int j=0 ; j<Ax1MemCount ; j++ ) { td=new System.Web.UI.HtmlControls.HtmlTableCell(); td.Attributes.Add("class" , "tbl1_HC"); td.NoWrap=true; tr.Cells.Add(td); //hier controls in last row if(i==Ax0MemCount-1) { this.CreateHierControls(_report.Axes[1].Hierarchies[j] , td); } } ax0Hier=_report.Axes[0].Hierarchies[i]; for (int j=0 ; j<Ax0PosCount ; j++ ) { CellsetMember mem=_report.Cellset.GetCellsetMember(0, i, j); bool inOrderTuple=false; //if same as prev, continue if(j!=0 && _report.Cellset.GetCellsetMember(0, i, j-1).UniqueName==mem.UniqueName) continue; td=new System.Web.UI.HtmlControls.HtmlTableCell(); td.NoWrap=true; // handle order position highlight if(j==ax0OrderPos) // in order tuple inOrderTuple=true; // handle colspan int spanCount=1; for(int n=j+1;n<Ax0PosCount;n++) { CellsetMember nextMem=_report.Cellset.GetCellsetMember(0, i, n); if(nextMem.UniqueName==mem.UniqueName) { spanCount++; // handle order position highlight if(n==ax0OrderPos) inOrderTuple=true; } else break; } // handle order position highlight if(inOrderTuple) // in order tuple td.Attributes.Add("class" , "tbl1_H3"); else td.Attributes.Add("class" , "tbl1_H2"); // if we span if(spanCount>1) td.ColSpan=spanCount; if(mem.ChildCount==0) { // leaf-level System.Web.UI.HtmlControls.HtmlImage img=new System.Web.UI.HtmlControls.HtmlImage(); img.Src="../images/leaf.gif"; td.Controls.Add(img); } System.Web.UI.HtmlControls.HtmlInputCheckBox chb=new System.Web.UI.HtmlControls.HtmlInputCheckBox(); chb.ID="m:" + _contr.IdentifierFromCellsetPosition(0 , j , i); chb.EnableViewState=false; td.EnableViewState=false; td.Controls.Add(chb); System.Web.UI.LiteralControl literal=new System.Web.UI.LiteralControl(mem.Name); td.Controls.Add(literal); tr.Cells.Add(td); } // hier controls in last col td=new System.Web.UI.HtmlControls.HtmlTableCell(); td.Attributes.Add("class" , "tbl1_HC"); td.NoWrap=true; CreateHierControls(ax0Hier , td); tr.Cells.Add(td); } for (int i=0 ; i<Ax1PosCount ; i++ ) { tr=new System.Web.UI.HtmlControls.HtmlTableRow(); tblPivot.Rows.Add(tr); for (int j=0 ; j<Ax1MemCount ; j++ ) { ax1Hier=_report.Axes[1].Hierarchies[j]; CellsetMember mem=_report.Cellset.GetCellsetMember(1, j, i); bool inOrderTuple=false; //if same as prev, continue if(i!=0 && _report.Cellset.GetCellsetMember(1, j, i-1).UniqueName==mem.UniqueName) continue; td=new System.Web.UI.HtmlControls.HtmlTableCell(); td.NoWrap=true; // handle order position highlight if(i==ax1OrderPos) // in order tuple inOrderTuple=true; // handle rowspan int spanCount=1; for(int n=i+1;n<Ax1PosCount;n++) { CellsetMember nextMem=_report.Cellset.GetCellsetMember(1, j, n); if(nextMem.UniqueName==mem.UniqueName) { spanCount++; // handle order position highlight if(n==ax1OrderPos) inOrderTuple=true; } else break; } // handle order position highlight if(inOrderTuple) // in order tuple td.Attributes.Add("class" , "tbl1_H1"); else td.Attributes.Add("class" , "tbl1_H"); // if we span if(spanCount>1) td.RowSpan=spanCount; if(mem.ChildCount==0) { // leaf-level System.Web.UI.HtmlControls.HtmlImage img=new System.Web.UI.HtmlControls.HtmlImage(); img.Src="../images/leaf.gif"; td.Controls.Add(img); } System.Web.UI.HtmlControls.HtmlInputCheckBox chb=new System.Web.UI.HtmlControls.HtmlInputCheckBox(); chb.ID="m:" + _contr.IdentifierFromCellsetPosition(1 , i , j); chb.EnableViewState=false; td.EnableViewState=false; td.Controls.Add(chb); System.Web.UI.LiteralControl literal=new System.Web.UI.LiteralControl(mem.Name); td.Controls.Add(literal); tr.Cells.Add(td); } for (int j=0 ; j<Ax0PosCount ; j++ ) { td=new System.Web.UI.HtmlControls.HtmlTableCell(); td.Attributes.Add("class" , "tbl1_C"); td.NoWrap=true; Cell olapCell=_report.Cellset.GetCell(j , i); td.InnerText=olapCell.FormattedValue; tr.Cells.Add(td); } } }