void Case3 (DataControlFieldCell cell) { Content content = new Content (); CheckBox checkBox = new CheckBox(); checkBox.ToolTip = "Dummy"; content.Controls.Add(checkBox); checkBox.DataBinding += OnDataBindField; cell.Controls.Add (content); }
protected void Page_Load(object sender, EventArgs e) { //int count = 5; //int top = 0; //while (count > 0) //{ // Literal tagBR = new Literal(); // Literal divInicio = new Literal(); // Literal divFim = new Literal(); // Panel pnlBotoes = new Panel(); // Button btn = new Button(); // divInicio.Text = "<div class=" + count + ">"; // divFim.Text = "</div>"; // tagBR.Text = "<br/>"; // btn.Text = "Texto do botão"; // btn.ID = "ID do botão" + count; //Este deve variar também // btn.Width = 100; //Largura // btn.Height = 20; //Altura // btn.Style["Position"] = "Absolute"; //CSS // btn.Style["Top"] = top.ToString() + "px"; //Posição na tela, se não será criado um ao lado do outro // pnlBotoes.Controls.Add(btn); // pnlBotoes.Controls.Add(divInicio); // pnlBotoes.Controls.Add(tagBR); // pnlBotoes.Controls.Add(divFim); // Page.Master.FindControl("MainContent").Controls.Add(pnlBotoes); // // form1.Controls.Add(btn); //Adicionando o botão // btn.Click += new System.EventHandler(this.Button1_Click); //Evento relacionado ao clicar do botão // count = count - 1; // top = top + 20; //} Panel pnlBotoes = new Panel(); Literal fildsetInicio = new Literal(); Literal tagBR = new Literal(); Literal fieldFim = new Literal(); tagBR.Text = "<br/>"; fildsetInicio.Text = "<fielset class='loginDisplayLegend'> <legend class='accordionContent'>Avisar Morador Encomenda </legend>"; pnlBotoes.Controls.Add(fildsetInicio); for (int i = 1; i <= 40; i++) { //btn = new Button(); //btn.ID = "btn" + i.ToString(); //btn.Text = "txt" + i.ToString(); //Panel1.Controls.Add(btn); Content cont = new Content(); Literal divInicio = new Literal(); Literal divFim = new Literal(); // titulo.ID = "BLOCO" + i.ToString(); // titulo.Text = "Issue " + i.ToString(); tagBR.Text = "<br/>"; Label titulo = new Label(); Button btn = new Button(); divInicio.Text = "<div class=" + i + ">"; divFim.Text = "</div>"; tagBR.Text = "<br/>"; btn.ID = "ButtonIssue" + i.ToString(); // btn.Click += new EventHandler(); btn.Text = "AP " + i.ToString(); btn.Width = 100; //Largura btn.Height = 20; //Altura btn.Font.Bold = true; btn.CssClass = "botao"; btn.Click += new EventHandler(btn_Click); pnlBotoes.Controls.Add(divInicio); //pnlBotoes.Controls.Add(titulo); pnlBotoes.Controls.Add(btn); pnlBotoes.Controls.Add(tagBR); pnlBotoes.Controls.Add(divFim); pnlBotoes.Controls.Add(divFim); } fieldFim.Text = "</fildset>"; pnlBotoes.Controls.Add(fieldFim); Page.Master.FindControl("MainContent").Controls.Add(pnlBotoes); }
private static string exportHTML(string title, Content content, string id, string adress, string worker, string datecreate, string datesecond, Template template, string path, string basepath) { path += ".html"; using (StreamWriter file = new StreamWriter(path)) { //html header (containing CSS!) file.WriteLine("<html>"); file.WriteLine("<head>"); file.WriteLine("<title>" + title + "</title>"); file.WriteLine("<style>"); foreach (string line in getCSS(basepath + Path.DirectorySeparatorChar + "vorlagen" + Path.DirectorySeparatorChar + template.CSS_HTML)) { file.WriteLine(line); } file.WriteLine("</style>"); file.WriteLine("</head>"); //header file.WriteLine("<body>"); file.WriteLine("<div id=\"container\">"); if (!template.IsEmpty) { file.WriteLine("<div id=\"header\">"); if (template.Header != null) { file.WriteLine(htmlTags(template.Header, basepath + Path.DirectorySeparatorChar + "vorlagen" + Path.DirectorySeparatorChar + template.NiceID).Replace(Template.FULLSTARTER, "").Replace(Template.DATE_NOW, DateTime.Now.ToString("dd.MM.yyyy"))); } else { file.WriteLine("<div class=\"left\">" + htmlTags(template.Header_Left, basepath + Path.DirectorySeparatorChar + "vorlagen" + Path.DirectorySeparatorChar + template.NiceID).Replace(Template.DATE_NOW, DateTime.Now.ToString("dd.MM.yyyy")) + "</div>"); file.WriteLine("<div class=\"center\">" + htmlTags(template.Header_Center, basepath + Path.DirectorySeparatorChar + "vorlagen" + Path.DirectorySeparatorChar + template.NiceID).Replace(Template.DATE_NOW, DateTime.Now.ToString("dd.MM.yyyy")) + "</div>"); file.WriteLine("<div class=\"right\">" + htmlTags(template.Header_Right, basepath + Path.DirectorySeparatorChar + "vorlagen" + Path.DirectorySeparatorChar + template.NiceID).Replace(Template.DATE_NOW, DateTime.Now.ToString("dd.MM.yyyy")) + "</div>"); } file.WriteLine("</div>"); file.WriteLine("<div id=\"textBefore\">"); file.WriteLine("<div id=\"textBefore_left\">" + Template.ReplacePlaceholder(template.TextBefore_Left.Replace(Template.LINEBREAK, "<br/>"), id, adress, worker, datecreate, datesecond) + "</div>"); file.WriteLine("<div id=\"textBefore_right\">" + Template.ReplacePlaceholder(template.TextBefore_Right.Replace(Template.LINEBREAK, "<br/>"), id, adress, worker, datecreate, datesecond) + "</div>"); file.WriteLine("</div>"); file.WriteLine("<div id=\"beforeContent\">" + template.BeforeContent + "</div>"); } file.WriteLine("<h1>" + title + "</h1>"); //content switch (content.Type) { case DataType.Table: ContentTable c = (ContentTable)content as ContentTable; file.WriteLine("<table>"); file.WriteLine("<thead>"); file.WriteLine("<tr>"); foreach (DataColumn col in c.Table.Columns) { file.Write("<th scope=\"col\">" + col.Caption + "</th>"); } file.WriteLine("</tr>"); file.WriteLine("</thead>"); file.WriteLine("<tbody>"); foreach (DataRow row in c.Table.Rows) { file.WriteLine("<tr>"); foreach (string item in row.ItemArray) { file.WriteLine("<td>" + item.Replace(Template.EMPTY, Template.HTML_SPACE) + "</td>"); } file.WriteLine("</tr>"); } file.WriteLine("</tbody>"); file.WriteLine("</table>"); break; case DataType.Paragraphs: ContentParagraphs p = (ContentParagraphs)content as ContentParagraphs; file.WriteLine("<dl>"); foreach (KeyValuePair<string, string> item in p.Paragraphs) { file.WriteLine("<dt>" + item.Key + "</dt>"); file.WriteLine("<dd>" + item.Value + "</dd>"); } file.WriteLine("</dl>"); break; case DataType.Text: ContentText t = (ContentText)content as ContentText; file.WriteLine("<p>" + t.Text + "</p>"); break; default: break; } //footer if (!template.IsEmpty) { file.WriteLine("<div id=\"afterContent\">" + template.AfterContent + "</div>"); file.WriteLine("<div id=\"footer\">"); if (template.Footer != null) { file.WriteLine(htmlTags(template.Footer, basepath + Path.DirectorySeparatorChar + "vorlagen" + Path.DirectorySeparatorChar + template.NiceID).Replace(Template.FULLSTARTER, "").Replace(Template.DATE_NOW, DateTime.Now.ToString("dd.MM.yyyy"))); } else { file.WriteLine("<div class=\"left\">" + htmlTags(template.Footer_Left, basepath + Path.DirectorySeparatorChar + "vorlagen" + Path.DirectorySeparatorChar + template.NiceID).Replace(Template.DATE_NOW, DateTime.Now.ToString("dd.MM.yyyy")) + "</div>"); file.WriteLine("<div class=\"center\">" + htmlTags(template.Footer_Center, basepath + Path.DirectorySeparatorChar + "vorlagen" + Path.DirectorySeparatorChar + template.NiceID).Replace(Template.DATE_NOW, DateTime.Now.ToString("dd.MM.yyyy")) + "</div>"); file.WriteLine("<div class=\"right\">" + htmlTags(template.Footer_Right, basepath + Path.DirectorySeparatorChar + "vorlagen" + Path.DirectorySeparatorChar + template.NiceID).Replace(Template.DATE_NOW, DateTime.Now.ToString("dd.MM.yyyy")) + "</div>"); } file.WriteLine("</div>"); } file.WriteLine("</div>"); file.WriteLine("</body>"); file.WriteLine("</html>"); } return path; }
private static string exportExcel(string title, Content content, string id, string adress, string worker, string datecreate, string datesecond, Template template, string path) { throw new NotImplementedException(); }
private static string exportTXT(string title, Content content, string id, string adress, string worker, string datecreate, string datesecond, Template template, string path) { path += ".txt"; using (StreamWriter file = new StreamWriter(path)) { if (!template.IsEmpty) { if (template.Header != null) { file.WriteLine(template.Header.Replace(Template.IMAGE_TAG, "<").Replace(Template.IMAGE_END, ">").Replace(Template.LINEBREAK, "\n").Replace(Template.FULLSTARTER, "").Replace(Template.DATE_NOW, DateTime.Now.ToString("dd.MM.yyyy"))); } else { file.WriteLine(template.Header_Left.Replace(Template.DATE_NOW, DateTime.Now.ToString("dd.MM.yyyy")) + Template.TAB + Template.TAB + template.Header_Center.Replace(Template.DATE_NOW, DateTime.Now.ToString("dd.MM.yyyy")) + Template.TAB + Template.TAB + template.Header_Right.Replace(Template.DATE_NOW, DateTime.Now.ToString("dd.MM.yyyy"))); } file.WriteLine(""); int llines = 0; if (template.TextBefore_Left.Contains(Template.LINEBREAK)) llines = template.TextBefore_Left.Split(Template.LINEBREAK.ToArray(), StringSplitOptions.RemoveEmptyEntries).Length; else llines = 1; int rlines = 0; if (template.TextBefore_Right.Contains(Template.LINEBREAK)) rlines = template.TextBefore_Right.Split(Template.LINEBREAK.ToArray(), StringSplitOptions.RemoveEmptyEntries).Length; else rlines = 1; if (llines > 1 && rlines > 1) { string[] ltext = Template.ReplacePlaceholder(template.TextBefore_Left, id, adress, worker, datecreate, datesecond).Split(Template.LINEBREAK.ToArray(), StringSplitOptions.RemoveEmptyEntries); string[] rtext = Template.ReplacePlaceholder(template.TextBefore_Right, id, adress, worker, datecreate, datesecond).Split(Template.LINEBREAK.ToArray(), StringSplitOptions.RemoveEmptyEntries); if (llines != rlines) { if (llines > rlines) { int j = 0; for (int i = 0; i < rlines; i++) { file.WriteLine(ltext[i] + Template.TAB + Template.TAB + Template.TAB + Template.TAB + rtext[i]); j++; } for (int i = j; i < rlines; i++) { file.WriteLine(Template.TAB + Template.TAB + Template.TAB + Template.TAB + Template.TAB + rtext[i]); } } else { int j = 0; for (int i = 0; i < llines; i++) { file.WriteLine(ltext[i] + Template.TAB + Template.TAB + Template.TAB + Template.TAB + rtext[i]); j++; } for (int i = j; i < rlines; i++) { file.WriteLine(Template.TAB + Template.TAB + Template.TAB + Template.TAB + Template.TAB + rtext[i]); } } } else { for (int i = 0; i < llines; i++) { file.WriteLine(ltext[i] + Template.TAB + Template.TAB + Template.TAB + Template.TAB + rtext[i]); } } } else { file.WriteLine(template.TextBefore_Left + Template.TAB + Template.TAB + Template.TAB + Template.TAB + template.TextBefore_Right); } file.WriteLine(""); } file.WriteLine(title); file.WriteLine(""); if (!template.IsEmpty) { file.WriteLine(template.BeforeContent); file.WriteLine(""); } switch (content.Type) { case DataType.Table: ContentTable c = (ContentTable)content as ContentTable; foreach (DataColumn col in c.Table.Columns) { file.Write(col.Caption + Template.TAB); } file.WriteLine(""); file.WriteLine(new String('-', c.TableWidth)); foreach (DataRow row in c.Table.Rows) { string r = String.Join(Template.TAB, row.ItemArray); r.Replace(Template.EMPTY, Template.TAB); file.WriteLine(r); } file.WriteLine(new String('-', c.TableWidth)); break; case DataType.Paragraphs: ContentParagraphs p = (ContentParagraphs)content as ContentParagraphs; foreach (KeyValuePair<string, string> item in p.Paragraphs) { file.WriteLine(item.Key); file.WriteLine(item.Value); file.WriteLine(""); } break; case DataType.Text: ContentText t = (ContentText)content as ContentText; file.WriteLine(t.Text); break; default: break; } if (!template.IsEmpty) { file.WriteLine(""); file.WriteLine(template.AfterContent); file.WriteLine(""); if (template.Footer != null) { file.WriteLine(template.Footer.Replace(Template.IMAGE_TAG, "<").Replace(Template.IMAGE_END, ">").Replace(Template.LINEBREAK, "\n").Replace(Template.FULLSTARTER, "").Replace(Template.DATE_NOW, DateTime.Now.ToString("dd.MM.yyyy"))); } else { file.WriteLine(template.Footer_Left.Replace(Template.DATE_NOW, DateTime.Now.ToString("dd.MM.yyyy")) + Template.TAB + Template.TAB + template.Footer_Center.Replace(Template.DATE_NOW, DateTime.Now.ToString("dd.MM.yyyy")) + Template.TAB + Template.TAB + template.Footer_Right.Replace(Template.DATE_NOW, DateTime.Now.ToString("dd.MM.yyyy"))); } } } return path; }
private static string exportPDF(string title, Content content, string id, string adress, string worker, string datecreate, string datesecond, Template template, string path, string basepath, string pathtohtmltopdf) { string temp = basepath + ".html"; path += ".pdf"; //TODO: eigene PDF-Style! temp = exportHTML(title, content, id, adress, worker, datecreate, datesecond, template, path, basepath); path = PdfGenerator.HtmlToPdf(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path), temp, null, pathtohtmltopdf); File.Delete(temp); return path; }
/// <summary></summary> public void ProcessRequest() { ManagedFusion.Modules.Configuration.ConfigurationPage page = null; // checks to see if the center module has anything added to it if (this.Config.Pages != null) { page = this.Config.FindPage(InternalLocation); // an alternative handler is being loaded so no futher processing has to be done if (page.Handler != null) return; } // executes the correct even depending on if we are creating a page or syndication if (SectionInformation.Syndicated && Context.Request.Url.Query.ToLower().IndexOf("feed") > -1) { LoadSyndicationEventArgs pcea = new LoadSyndicationEventArgs(this._syndication); this.OnLoadSyndication(pcea); } else { Content beforeModule = new Content(); Content afterModule = new Content(); // setup content holders LoadModuleEventArgs phea = new LoadModuleEventArgs( this._holders, beforeModule, afterModule ); this.OnLoad(phea); #region Controls Before the Module // add the controls that are before the module if (beforeModule.Controls.Count > 0) this._centerHolder.Controls.Add(beforeModule); // center pane foreach (ContainerInfo c in this.SectionInformation.Containers.GetContainersForPosition((int)CenterPosition.BeforeModule)) this._centerHolder.Controls.Add(new ContainerHolder(c)); #endregion // checks to see if the center module has anything added to it if (page != null && page.Control != null) { // load current control according to the page address foreach (Control c in GetControls(page)) this._centerHolder.Controls.Add(c); } #region Controls After the Module // add the controls that are after the module if (afterModule.Controls.Count > 0) this._centerHolder.Controls.Add(afterModule); // center pane foreach (ContainerInfo c in this.SectionInformation.Containers.GetContainersForPosition((int)CenterPosition.AfterModule)) this._centerHolder.Controls.Add(new ContainerHolder(c)); #endregion // configure the containers this.ConfigureContainers(); } }