protected void btnGonder_Click(object sender, EventArgs e) { int i; pnlPanel.Height = Unit.Percentage(75); pnlPanel.Width = Unit.Pixel(200); lblAd.BorderStyle = BorderStyle.Dotted; lblAd.BackColor = Color.LawnGreen; lblAd.BorderColor = Color.FromArgb(255, 255, 0, 0); txtAD.ForeColor = ColorTranslator.FromHtml("#00ff00"); ListItem Li=new ListItem("nolsun","denemeeee"); chklCheckDeneme.Items.Add( Li); ///***************************************************** /// tbl.Controls.Clear(); tbl.BorderStyle = BorderStyle.Double; tbl.BorderWidth = Unit.Pixel(1); int rows = 3, cols = 4; TableCell tc; for (int sat = 0; sat < rows; sat++) { TableRow tr = new TableRow(); tbl.Controls.Add(tr); for (int sut = 0; sut < cols; sut++) { tc = new TableCell(); tc.BorderStyle = BorderStyle.Double; tc.BorderWidth = Unit.Pixel(1); tc.Text = sat.ToString() + " " + sut.ToString(); tr.Controls.Add(tc); } } }
public void Format(Body body, Table table) { var wordTable = new WordTable(); wordTable.Append(GenerateTableProperties()); var headerRow = new TableRow(); foreach (string cell in table.HeaderRow) { var wordCell = new TableCell(); wordCell.Append(new Paragraph(new Run(new Text(cell)))); headerRow.Append(wordCell); } wordTable.Append(headerRow); foreach (Parser.TableRow row in table.DataRows) { var wordRow = new TableRow(); foreach (string cell in row) { var wordCell = new TableCell(); wordCell.Append(new Paragraph(new Run(new Text(cell)))); wordRow.Append(wordCell); } wordTable.Append(wordRow); } body.Append(wordTable); }
public static FileTransfer AddNewFileTransfer(this FlowDocument doc, Tox tox, int friendnumber, int filenumber, string filename, ulong filesize, bool is_sender) { FileTransferControl fileTransferControl = new FileTransferControl(tox.GetName(friendnumber), friendnumber, filenumber, filename, filesize); FileTransfer transfer = new FileTransfer() { FriendNumber = friendnumber, FileNumber = filenumber, FileName = filename, FileSize = filesize, IsSender = is_sender, Control = fileTransferControl }; Section usernameParagraph = new Section(); TableRow newTableRow = new TableRow(); BlockUIContainer fileTransferContainer = new BlockUIContainer(); fileTransferControl.HorizontalAlignment = HorizontalAlignment.Stretch; fileTransferControl.HorizontalContentAlignment = HorizontalAlignment.Stretch; fileTransferContainer.Child = fileTransferControl; usernameParagraph.Blocks.Add(fileTransferContainer); usernameParagraph.Padding = new Thickness(0); TableCell fileTableCell = new TableCell(); fileTableCell.ColumnSpan = 2; fileTableCell.Blocks.Add(usernameParagraph); newTableRow.Cells.Add(fileTableCell); fileTableCell.Padding = new Thickness(0, 10, 0, 10); TableRowGroup MessageRows = (TableRowGroup)doc.FindName("MessageRows"); MessageRows.Rows.Add(newTableRow); return transfer; }
protected void Page_Load (object sender, EventArgs e) { TableRow row = new TableRow (); TableCell title = new TableCell (); TableCell user = new TableCell (); title.Text = "<a href='index.aspx'>MonkeyWrench</a>"; if (!Utils.IsInRole (MonkeyWrench.DataClasses.Logic.Roles.Administrator)) { user.Text = "<a href='Login.aspx'>Login</a>"; } else { user.Text = string.Format ("<a href='User.aspx?id={0}'>{0}</a> <a href='Login.aspx?action=logout'>Log out</a>", Context.User.Identity.Name); } user.CssClass = "headerlogin"; row.Cells.Add (title); row.Cells.Add (user); tableHeader.Rows.Add (row); if (!IsPostBack) CreateTree (); if (Utils.IsInRole (MonkeyWrench.DataClasses.Logic.Roles.Administrator)) { tableFooter.Rows.Add (Utils.CreateTableRow ("<a href='EditHosts.aspx'>Edit Hosts</a>")); tableFooter.Rows.Add (Utils.CreateTableRow ("<a href='EditLanes.aspx'>Edit Lanes</a>")); tableFooter.Rows.Add (Utils.CreateTableRow ("<a href='Admin.aspx'>Administration</a>")); } tableFooter.Rows.Add (Utils.CreateTableRow ("<a href='doc/index.html'>Documentation</a>")); }
protected void cmdCreate_Click(object sender, EventArgs e) { ////首先移除所有的行和列,如果EnableViewState设置为False则每次都会重新创建而不需要调用这行代码。 tbl.Controls.Clear(); //获取文本框中的行列值 int rows = Int32.Parse(txtRows.Text); int cols = Int32.Parse(txtCols.Text); for (int row = 0; row < rows; row++) { ////创建一个TableRow对象 TableRow rowNew = new TableRow(); //将TableRow对象添加到Table对象中 tbl.Controls.Add(rowNew); for (int col = 0; col < cols; col++) { //创建一个新的TableCell对象 TableCell cellNew = new TableCell(); TextBox tb = new TextBox(); tb.Text = "当前列为 (" + row.ToString() + ","+col.ToString() + ")"; cellNew.Controls.Add(tb); if (chkBorder.Checked) { //如果允许列边框复选框被选择,则设置TableCell的边框 cellNew.BorderStyle = BorderStyle.Inset; ////注意这里的单位表示方式,是使用Unit结构 cellNew.BorderWidth = Unit.Pixel(1); } ////将TableCell添加到TableRow中 rowNew.Controls.Add(cellNew); } } }
/** * Create a new Table of the given number of rows and columns * * @param numrows the number of rows * @param numcols the number of columns */ public Table(int numrows, int numcols) { base(); if(numrows < 1) throw new ArgumentException("The number of rows must be greater than 1"); if(numcols < 1) throw new ArgumentException("The number of columns must be greater than 1"); int x=0, y=0, tblWidth=0, tblHeight=0; cells = new TableCell[numrows][numcols]; for (int i = 0; i < cells.Length; i++) { x = 0; for (int j = 0; j < cells[i].Length; j++) { cells[i][j] = new TableCell(this); Rectangle anchor = new Rectangle(x, y, TableCell.DEFAULT_WIDTH, TableCell.DEFAULT_HEIGHT); cells[i][j].SetAnchor(anchor); x += TableCell.DEFAULT_WIDTH; } y += TableCell.DEFAULT_HEIGHT; } tblWidth = x; tblHeight = y; SetAnchor(new Rectangle(0, 0, tblWidth, tblHeight)); EscherContainerRecord spCont = (EscherContainerRecord) GetSpContainer().GetChild(0); EscherOptRecord opt = new EscherOptRecord(); opt.SetRecordId((short)0xF122); opt.AddEscherProperty(new EscherSimpleProperty((short)0x39F, 1)); EscherArrayProperty p = new EscherArrayProperty((short)0x43A0, false, null); p.SetSizeOfElements(0x0004); p.SetNumberOfElementsInArray(numrows); p.SetNumberOfElementsInMemory(numrows); opt.AddEscherProperty(p); List<EscherRecord> lst = spCont.GetChildRecords(); lst.Add(lst.Count-1, opt); spCont.SetChildRecords(lst); }
protected void btn_SearchUsernames_OnClick(object sender, EventArgs e) { int uID; bool result = Int32.TryParse(Request.QueryString["userID"].ToString(), out uID); DataTable DT = theCake.searchUsersByUserName(txt_usernameSearch.Text.Trim()); if (DT.Rows.Count == 0) // No results found { TableRow TR0 = new TableRow(); TableCell TC0 = new TableCell(); Label no_res = new Label(); no_res.Text = "No matches were found."; TC0.Controls.Add(no_res); TR0.Cells.Add(TC0); tbl_searchResults.Rows.Add(TR0); } if (DT.Rows.Count >= 1) // Results found { foreach (DataRow DR in DT.Rows) { TableRow TR1 = new TableRow(); TableCell TC1 = new TableCell(); Label username_res = new Label(); username_res.Text = "<a href=\"UserProfile.aspx?userID=" + DR["ID"].ToString() + "\">" + DR["ownerAlias"].ToString() + "</a>"; TC1.Controls.Add(username_res); TR1.Cells.Add(TC1); tbl_searchResults.Rows.Add(TR1); } } }
protected void convertButton_Click(object sender, EventArgs e) { if (IsValid) { //Hämtar input från textbox's int startTemp = int.Parse(startTempTextBox.Text); int endTemp = int.Parse(endTempTextBox.Text); int levelTemp = int.Parse(levelTempTextBox.Text); //Hämtar inputs från textboxarna och lägger dom yttligare i en variabel var startTempRun = (int.Parse(startTempTextBox.Text)); var endTempRun = (int.Parse(endTempTextBox.Text)); var levelTempRun = (int.Parse(levelTempTextBox.Text)); //Do-while som repeterar förfarande tills startTempRun är = endTempRun do { TableRow tRow = new TableRow(); TableCell cell1 = new TableCell(); cell1.Text = startTempRun.ToString(); TableCell cell2 = new TableCell(); cell2.Text = RadioButton1.Checked ? TempatureConverter.FahrenheitToCelcius(start).ToString() : TempatureConverter.CelciusToFahrenheit(start).ToString(); tRow.Cells.Add(cell1); tRow.Cells.Add(cell2); TablePresent.Rows.Add(tRow); startTempRun += endTempRun; } while (startTempRun <= endTempRun); } }
internal void Process(TableCell cell, DocxTableProperties docxProperties, DocxNode node) { TableCellProperties cellProperties = new TableCellProperties(); ProcessColSpan(node, cellProperties); ProcessWidth(node, cellProperties); if (HasRowSpan) { cellProperties.Append(new VerticalMerge() { Val = MergedCellValues.Restart }); } //Processing border should be after colspan ProcessBorders(node, docxProperties, cellProperties); string backgroundColor = node.ExtractStyleValue(DocxColor.backGroundColor); if (!string.IsNullOrEmpty(backgroundColor)) { DocxColor.ApplyBackGroundColor(backgroundColor, cellProperties); } ProcessVerticalAlignment(node, cellProperties); if (cellProperties.HasChildren) { cell.Append(cellProperties); } }
private void LoadDanhMuc() { try { NhomSanPham nsp = new NhomSanPham(); DataSet ds = nsp.SelectNhomSanPhamByNhomChaID(0); ds.Tables[0].DefaultView.Sort = "SapXep ASC"; if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { TableRow tr = new TableRow(); TableCell td = new TableCell(); td.Text = "<a href=\"maincategory.aspx?mcid=" + dr["NhomSanPhamID"] + "\">" + dr["TenNhomSanPham"] + "</a>"; tr.Cells.Add(td); tblDanhMuc.Rows.Add(tr); } } } catch (Exception ex) { Response.Write(ex.ToString()); } }
public void DrawPages() { PagesRow.Controls.Clear(); int start = 0; if (Pages <= 1) return; while (start < Pages) { TableCell cell = new TableCell(); LinkButton link = new LinkButton(); link.ID = "Link" + start.ToString(); link.Text = (start + 1).ToString(); link.Click += new EventHandler(link_Click); if (start == CurrentPage) { link.BorderStyle = BorderStyle.Solid; link.BorderColor = Color.Red; link.BorderWidth = Unit.Pixel(1); } cell.Controls.Add(link); PagesRow.Controls.Add(cell); start++; } }
private void LoadGianHang() { CuaHang ch = new CuaHang(); DataSet ds = ch.SelectCuaHangAtViTriCuaHang(1); int n = ds.Tables[0].Rows.Count; for (int j = 0; j < 4; j++) { TableRow tr = new TableRow(); for (int i = 0; i < 4; i++) { TableCell td = new TableCell(); string content = ""; if (j*4 + i < n) { content += "<table width=\"100%\" border=\"0\" cellspacing=\"4\" cellpadding=\"0\">"; content += "<tr><td><a href=\"estore.aspx?sid=" + ds.Tables[0].Rows[j*4 + i]["CuaHangID"] + "\"><img src=\"" + ds.Tables[0].Rows[j*4 + i]["Anh"] + "\" width=\"110\" height=\"73\" style=\"border:#ece2a4 1px solid\" /></a></td>"; content += "<td><a href=\"estore.aspx?sid=" + ds.Tables[0].Rows[j*4 + i]["CuaHangID"] + "\"><b>" + ds.Tables[0].Rows[j*4 + i]["TenCuaHang"] + "</b></a></td></tr></table>"; } td.Text = content; td.HorizontalAlign = HorizontalAlign.Left; if (j == 0) td.Width = Unit.Percentage(25); tr.Cells.Add(td); } tblGianHang.Rows.Add(tr); } }
public static FileTransferControl AddNewFileTransfer(this FlowDocument doc, Tox tox, FileTransfer transfer) { var fileTableCell = new TableCell(); var fileTransferControl = new FileTransferControl(transfer, fileTableCell); var usernameParagraph = new Section(); var newTableRow = new TableRow(); newTableRow.Tag = transfer; var fileTransferContainer = new BlockUIContainer(); fileTransferControl.HorizontalAlignment = HorizontalAlignment.Stretch; fileTransferControl.HorizontalContentAlignment = HorizontalAlignment.Stretch; fileTransferContainer.Child = fileTransferControl; usernameParagraph.Blocks.Add(fileTransferContainer); usernameParagraph.Padding = new Thickness(0); fileTableCell.ColumnSpan = 3; fileTableCell.Blocks.Add(usernameParagraph); newTableRow.Cells.Add(fileTableCell); fileTableCell.Padding = new Thickness(0, 10, 0, 10); var MessageRows = (TableRowGroup)doc.FindName("MessageRows"); MessageRows.Rows.Add(newTableRow); return fileTransferControl; }
protected void Page_Load(object sender, EventArgs e) { if (Session["admin"] == null) Server.Transfer("admin.aspx"); else admin.Text = "ADMIN " + Session["admin"].ToString(); DataView dv = (DataView)(SqlDataSourceADDCUST.Select(DataSourceSelectArguments.Empty)); for (int i = 0; i < dv.Table.Rows.Count; i++) { TableRow r = new TableRow(); custtable.Rows.Add(r); TableCell c1= new TableCell(); c1.Text = dv.Table.Rows[i]["custName"].ToString(); r.Cells.Add(c1); TableCell c2 = new TableCell(); Button b = new Button(); b.CssClass = "btn btn-danger"; b.Text = "DELETE"; b.ID = dv.Table.Rows[i]["custID"].ToString(); b.Click += B_Click; c2.Controls.Add(b); r.Cells.Add(c2); } }
void ListLoginUsers() { User[] users = TheAdminServer.SecurityManager.GetAllLoginUsers(); if (users != null) { for (int i = 0; i < users.Length; i++) { User user = users[i]; TableRow row = new TableRow(); TableCell cell = new TableCell(); cell.Text = user.UserName; row.Cells.Add(cell); cell = new TableCell(); cell.Text = user.ClientAddress; row.Cells.Add(cell); cell = new TableCell(); cell.Text = user.LoginTime.ToString(); row.Cells.Add(cell); TableLoginUser.Rows.Add(row); } } }
public SpanInfo(TableCell cell, int cellHeight, int rowsSpanned) { this.cell = cell; this.cellHeight = cellHeight; this.totalRowHeight = 0; this.rowsRemaining = rowsSpanned; }
public void BindPager(int totalRecords, int pageSize, int currentPage) { int pageCount = (totalRecords % pageSize > 0) ? ((totalRecords / pageSize) + 1) : totalRecords / pageSize; Table pagerTable; TableRow pagerRow; TableCell pagerCell; if (pageCount > 1) { pagerTable = new Table(); pagerRow = new TableRow(); for (int index = 1; index <= pageCount; index++) { pagerCell = new TableCell(); if (index == currentPage) pagerCell.Text = "<a class=selected href=index.aspx?currentPage=" + index + ">" + index + "</a>"; else pagerCell.Text = "<a href=index.aspx?currentPage=" + index + ">" + index + "</a>"; pagerRow.Cells.Add(pagerCell); } pagerTable.Rows.Add(pagerRow); pagerHolder.Controls.Add(pagerTable); } }
private TableCell adicionar(TableRow linha, TableCell celula, object conteudoCelula) { if (conteudoCelula == null || "".Equals(conteudoCelula)) { conteudoCelula = "-"; } Control control = conteudoCelula as Control; if (control == null) { celula.Text = Convert.ToString(conteudoCelula); } else { celula.Controls.Add(control); } celula.Attributes["cellpadding"] = "2"; string tamanho = obterTamanhoCelula(linha.Cells.Count); if (tamanho != null) { celula.Width = new Unit(tamanho); } string alinhamento = obterAlinhamentoCelula(linha.Cells.Count); if (alinhamento != null) { celula.Attributes["align"] = alinhamento; } linha.Cells.Add(celula); return celula; }
protected void boradmaker_Click(object sender, EventArgs e) { TableCell boardcells; TableRow boardrows; Table chessboard = new Table(); chessboard.Attributes.Add("align", "center"); string rowqueen = "25160374"; rowqueen = resultlist.SelectedItem.ToString(); char[] queenarray = rowqueen.ToCharArray(); for (int i = 0; i < 8; i++) { boardrows = new TableRow(); for (int j = 0; j < 8; j++) { boardcells = new TableCell(); if ((i + j) % 2 == 1) { boardcells.CssClass = "black_td"; } else { boardcells.CssClass = "white_td"; } if (j.ToString() == queenarray[i].ToString()) { boardcells.CssClass += " queen"; } boardrows.Cells.Add(boardcells); } chessboard.Rows.Add(boardrows); } PlaceHolder1.Controls.Add(chessboard); }
public Table CreateModuleTable(string ModuleName, string ParentImage) { Table tbl = new Table(); //tbl.Attributes.Add("class", "Menu"); tbl.Attributes.Add("cellspacing", "0"); tbl.Attributes.Add("cellpadding", "0"); tbl.Attributes.Add("style", "width: 100%; height: 28px; padding:2 5 3 2; cursor:hand; color:#000000;background-image:url(../images/leftmenu/button.jpg)"); //tbl.Attributes.Add("style", "width: 100%; height: 28px; padding:2 5 3 2; border-right: buttonshadow 1px solid; border-top: #f5f5f5 1px solid; border-left: #f5f5f5 1px solid; border-bottom: buttonshadow 1px solid; background-color:Transparent; cursor:hand; color:#000000;"); TableRow tr = new TableRow(); TableCell tdImg = new TableCell(); TableCell td = new TableCell(); //Image img = new Image(); //img.Attributes.Add("style", "vertical-align: middle; border:0;hspace:3;");//width:20px;height:20px; //if (ParentImage == "") //{ // img.ImageUrl = "../images/leftmenu/exit.gif"; //} //else //{ // img.ImageUrl = "../images/leftmenu/" + ParentImage; //} //tdImg.Attributes.Add("style", "width:5%; text-align:right;");//FILTER:progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr=#ffffff, EndColorStr=buttonface); //tdImg.Controls.Add(img); td.Text = " " + ModuleName; // td.Attributes.Add("style", "text-align:left; FILTER:progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr=buttonface, EndColorStr=white);"); //#91D6FA tr.Controls.Add(tdImg); tr.Controls.Add(td); tbl.Controls.Add(tr); return tbl; }
private void CreateTableAlertCondition() { IList alertConditions = TheAdminServer.GameServerMonitor.AlertConditions; for (int i = 0; i < alertConditions.Count; i++) { AlertCondition condition = alertConditions[i] as AlertCondition; TableRow row = new TableRow(); TableCell cell = new TableCell(); LinkButton linkButtonRemove = new LinkButton(); linkButtonRemove.Attributes.Add(WebConfig.ParamIndex, i.ToString()); linkButtonRemove.SkinID = "PlainText"; //linkButtonRemove.NavigateUrl = "AlertConfig.aspx?" + WebConfig.ParamOperation + "=" + OperationRemoveAlertCondition + "&" + WebConfig.ParamIndex + "=" + i; linkButtonRemove.Click += LinkButtonRemove_Click; linkButtonRemove.Text = StringDef.Remove; linkButtonRemove.ID = "LinkButtonRemove"+i.ToString(); cell.Controls.Add(linkButtonRemove); row.Cells.Add(cell); cell = new TableCell(); cell.Text = (i + 1).ToString(); row.Cells.Add(cell); cell = new TableCell(); cell.Text = condition.ToString(); row.Cells.Add(cell); TableAlertCondition.Rows.Add(row); } }
private void SetTableHeader() { var tableRow = new TableRow(); if (ServerModel.User.Current.Islector()) { var inputCell = new TableCell { Text = "Input" }; var expectedOutputCell = new TableCell { Text = "Expected Output" }; tableRow.Cells.AddRange(new[] { inputCell, expectedOutputCell }); } var userOutputCell = new TableCell { Text = "User Output" }; var timeUsedCell = new TableCell { Text = "Time Used" }; var memoryUsedCell = new TableCell { Text = "Memory Used" }; var statusCell = new TableCell { Text = "Status" }; tableRow.Cells.AddRange(new[] { userOutputCell, timeUsedCell, memoryUsedCell, statusCell }); _compiledAnswerTable.Rows.Add(tableRow); }
protected void Page_Load(object sender, EventArgs e) { string polku = HttpContext.Current.Server.MapPath("~/App_Data/Palautteet.xml"); palautteet pal = new palautteet(); pal = (palautteet)XMLDeserialize(polku); TableRow r = new TableRow(); TableCell c = new TableCell(); TableCell c0 = new TableCell(); TableCell c1 = new TableCell(); TableCell c2 = new TableCell(); TableCell c3 = new TableCell(); TableCell c4 = new TableCell(); TableCell c5 = new TableCell(); c.Text = "Pvm"; c0.Text = "Nimi"; c1.Text = "Opittu"; c2.Text = "Haluan oppia"; c3.Text = "Hyvää"; c4.Text = "Parannettavaa"; c5.Text = "Muuta"; r.Cells.Add(c); r.Cells.Add(c0); r.Cells.Add(c1); r.Cells.Add(c2); r.Cells.Add(c3); r.Cells.Add(c4); r.Cells.Add(c5); tblPalautteet.Rows.Add(r); for (int i = 0; i < pal.palaute.Count; i++) { TableRow row = new TableRow(); TableCell cell = new TableCell(); TableCell cell0 = new TableCell(); TableCell cell1 = new TableCell(); TableCell cell2 = new TableCell(); TableCell cell3 = new TableCell(); TableCell cell4 = new TableCell(); TableCell cell5 = new TableCell(); cell.Text = pal.palaute[i].pvm; cell0.Text = pal.palaute[i].tekija; cell1.Text = pal.palaute[i].opittu; cell2.Text = pal.palaute[i].haluanoppia; cell3.Text = pal.palaute[i].hyvaa; cell4.Text = pal.palaute[i].parannettavaa; cell5.Text = pal.palaute[i].muuta; row.Cells.Add(cell); row.Cells.Add(cell0); row.Cells.Add(cell1); row.Cells.Add(cell2); row.Cells.Add(cell3); row.Cells.Add(cell4); row.Cells.Add(cell5); tblPalautteet.Rows.Add(row); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request.Params["SerialNum"] != null) HyperLinkDetail.NavigateUrl = "../GameServer/ServerOperationHistory.aspx?SerialNum=" + Request.Params["SerialNum"].ToString(); TableHeaderRow header = new TableHeaderRow(); TableHeaderCell[] head = new TableHeaderCell[2]; for (int i = 0; i <= 1; i++) head[i] = new TableHeaderCell(); head[0].Width = new Unit(10f, UnitType.Percentage); head[0].Text = StringDef.Name; head[1].Width = new Unit(30f, UnitType.Percentage); head[1].Text = StringDef.Message; header.Cells.AddRange(head); ResultList.Rows.Add(header); if (Session["ActionResultList"] == null) { TableRow row = new TableRow(); TableCell[] cell = new TableCell[2]; for (int i = 0; i <= 1; i++) cell[i] = new TableCell(); ; cell[0].Text = ""; cell[1].Text = "Çë²é¿´ÈÕÖ¾"; row.Cells.AddRange(cell); ResultList.Rows.Add(row); } else { ShowRunResult(Session["ActionResultList"] as IList); } } }
public VisitPrint(Visit visit) { InitializeComponent(); TableCell r1 = new TableCell(new Paragraph(new Run(visit.Patient.AccountantCode))); header.Rows[0].Cells.Add(r1); TableCell r2 = new TableCell(new Paragraph(new Run(visit.Patient.ToString()))); header.Rows[0].Cells.Add(r2); TableCell r3 = new TableCell(new Paragraph(new Run(visit.Doctor.ToString()))); header.Rows[0].Cells.Add(r3); TableCell r4 = new TableCell(new Paragraph(new Run(new PersianDate(visit.FromTime).ToString()))); header.Rows[0].Cells.Add(r4); foreach (VisitService s in visit.VisitServices) { TableRow r = new TableRow(); TableCell c1 = new TableCell(new Paragraph(new Run(s.Service.Title))); r.Cells.Add(c1); TableCell c2 = new TableCell(new Paragraph(new Run(new PatientHistory(s).Insurance))); r.Cells.Add(c2); TableCell c3 = new TableCell(new Paragraph(new Run(s.ToothDescription))); r.Cells.Add(c3); TableCell c4 = new TableCell(new Paragraph(new Run(s.FinalCost.ToString("n0")))); r.Cells.Add(c4); tblServices.Rows.Add(r); } comment.Inlines.Add(new Run(visit.Comment)); Fee.Inlines.Add(new Run(" "+visit.FinalSumCost.ToString("n0")+" ریال")); }
private TableCell CreateCellFor(string data) { TableCell tableCell=new TableCell(); tableCell.Blocks.Add(new Paragraph(new Run(data))); tableCell.TextAlignment = TextAlignment.Center; return tableCell; }
protected void btn_tabloolustur_Click(object sender, EventArgs e) { int satir = int.Parse(txt_satir.Text); int sutun = int.Parse(txt_sutun.Text); TableCell td; tbl.BorderWidth = Unit.Point(1); tbl.BorderStyle = BorderStyle.Dashed; for (int i = 1; i <= satir; i++) { TableRow rw = new TableRow(); for (int j = 1; j < sutun; j++) { td = new TableCell(); td.Text = i.ToString() + " " + j.ToString(); td.BorderWidth = Unit.Pixel(3); if (i % 2 == 0) td.BackColor = Color.Aqua; else td.BackColor = Color.Red; tbl.Controls.Add(rw); } } }
protected void Page_Load(object sender, EventArgs e) { string qry = "SELECT * FROM job-phases "; SqlCommand cmd = new SqlCommand(qry, con); con.Open(); SqlDataReader OperationList = cmd.ExecuteReader(); //create a table with phase name in each row while (OperationList.Read()) { TableRow PhaseRow = new TableRow(); TableCell PhaseCellName = new TableCell(); PhaseCellName.ID = OperationList[0].ToString(); PhaseCellName.Text = OperationList[1].ToString(); PhaseRow.Cells.Add(PhaseCellName); TableCell PhaseDuration = new TableCell(); PhaseDuration.ID = "Duration" + PhaseCellName.ID; PhaseDuration.Text = OperationList[3].ToString(); PhaseRow.Cells.Add(PhaseDuration); TableStatus.Rows.Add(PhaseRow); } con.Close(); }
public void Format(Body body, Scenario background) { var headerParagraph = new Paragraph(new ParagraphProperties(new ParagraphStyleId { Val = "Heading2" })); var backgroundKeyword = GetLocalizedBackgroundKeyword(); headerParagraph.Append(new Run(new RunProperties(new Bold()), new Text(backgroundKeyword))); var table = new Table(); table.Append(GenerateTableProperties()); var row = new TableRow(); var cell = new TableCell(); cell.Append(headerParagraph); foreach (var descriptionSentence in WordDescriptionFormatter.SplitDescription(background.Description)) { cell.Append(CreateNormalParagraph(descriptionSentence)); } foreach (var step in background.Steps) { cell.Append(WordStepFormatter.GenerateStepParagraph(step)); if (step.TableArgument != null) { cell.Append(this.wordTableFormatter.CreateWordTableFromPicklesTable(step.TableArgument)); } } cell.Append(CreateNormalParagraph("")); // Is there a better way to generate a new empty line? row.Append(cell); table.Append(row); body.Append(table); }
public void Format(Body body, Table table) { var wordTable = new DocumentFormat.OpenXml.Wordprocessing.Table(); wordTable.Append(GenerateTableProperties()); var headerRow = new TableRow(); foreach (string cell in table.HeaderRow) { var wordCell = new TableCell(); wordCell.Append(new Paragraph(new Run(new Text(cell)))); headerRow.Append(wordCell); } wordTable.Append(headerRow); foreach (ObjectModel.TableRow row in table.DataRows) { var wordRow = new TableRow(); foreach (string cell in row) { var wordCell = new TableCell(); wordCell.Append(new Paragraph(new Run(new Text(cell)))); wordRow.Append(wordCell); } wordTable.Append(wordRow); } body.Append(wordTable); }
/// <summary> /// 插入表格1行数据 /// </summary> /// <param name="depart">部门</param> /// <param name="zeren">责任人</param> /// <param name="huikuan">金额</param> private void InsertRow(string depart, string zeren, double huikuan) { string time1 = ""; if (HttpContext.Current.Items["time0"].ToString() != "") { time1 = (DateTime.Parse(HttpContext.Current.Items["time0"].ToString())).ToString("yyyy-MM-dd"); } string time2 = ""; if (HttpContext.Current.Items["time1"].ToString() != "") { time2 = (DateTime.Parse(HttpContext.Current.Items["time1"].ToString())).ToString("yyyy-MM-dd"); } TableRow tr = new TableRow(); tr.HorizontalAlign = HorizontalAlign.Center; if (depart != "" && zeren == "") { tr.BackColor = Color.FromArgb(0xcc, 0xff, 0xcc); } else { tr.BackColor = Color.White; } tr.Height = Unit.Parse("18pt"); //第1列 TableCell tc1 = new TableCell(); if (depart == "" && zeren == "") { tc1.Text = "<b><font color='#ff0000'>总计</font></b>"; } else if (zeren == "") { tc1.Text = String.Format("{0}小计", depart); } else { tc1.Text = depart; } tr.Cells.Add(tc1); //第2列 TableCell tc2 = new TableCell(); tc2.Text = zeren; if (tc2.Text == "") { tc2.Text = "----"; } tr.Cells.Add(tc2); //第3列 TableCell tc3 = new TableCell(); tc3.HorizontalAlign = HorizontalAlign.Right; if (huikuan != 0) { HyperLink link1 = new HyperLink(); link1.Text = "¥" + PubComm.GetNumberFormat(huikuan) + " "; link1.NavigateUrl = string.Format("TJ_HK_List.aspx?dt1={0}&dt2={1}&depart={2}&zeren={3}", time1, time2, Server.UrlEncode(depart), Server.UrlEncode(zeren)); link1.Target = "_blank"; link1.ForeColor = Color.Blue; link1.ToolTip = "点击浏览详细"; link1.Font.Underline = true; tc3.Controls.Add(link1); } else { tc3.Text = "0¥" + " ";; } tr.Cells.Add(tc3); this.Table1.Rows.Add(tr); }
/// ----------------------------------------------------------------------------- /// <summary> /// BuildTable creates the Control as a Table. /// </summary> /// <param name="editInfo">The EditorInfo object for this control.</param> /// ----------------------------------------------------------------------------- private void BuildTable(EditorInfo editInfo) { var tbl = new Table(); var labelCell = new TableCell(); var editorCell = new TableCell(); // Build Label Cell labelCell.VerticalAlign = VerticalAlign.Top; labelCell.Controls.Add(this.BuildLabel(editInfo)); if (editInfo.LabelMode == LabelMode.Left || editInfo.LabelMode == LabelMode.Right) { labelCell.Width = this.LabelWidth; } // Build Editor Cell editorCell.VerticalAlign = VerticalAlign.Top; EditControl propEditor = this.BuildEditor(editInfo); Image requiredIcon = this.BuildRequiredIcon(editInfo); editorCell.Controls.Add(propEditor); if (requiredIcon != null) { editorCell.Controls.Add(requiredIcon); } if (editInfo.LabelMode == LabelMode.Left || editInfo.LabelMode == LabelMode.Right) { editorCell.Width = this.EditControlWidth; } VisibilityControl visibility = this.BuildVisibility(editInfo); if (visibility != null) { editorCell.Controls.Add(new LiteralControl(" ")); editorCell.Controls.Add(visibility); } // Add cells to table var editorRow = new TableRow(); var labelRow = new TableRow(); if (editInfo.LabelMode == LabelMode.Bottom || editInfo.LabelMode == LabelMode.Top || editInfo.LabelMode == LabelMode.None) { editorCell.ColumnSpan = 2; editorRow.Cells.Add(editorCell); if (editInfo.LabelMode == LabelMode.Bottom || editInfo.LabelMode == LabelMode.Top) { labelCell.ColumnSpan = 2; labelRow.Cells.Add(labelCell); } if (editInfo.LabelMode == LabelMode.Top) { tbl.Rows.Add(labelRow); } tbl.Rows.Add(editorRow); if (editInfo.LabelMode == LabelMode.Bottom) { tbl.Rows.Add(labelRow); } } else if (editInfo.LabelMode == LabelMode.Left) { editorRow.Cells.Add(labelCell); editorRow.Cells.Add(editorCell); tbl.Rows.Add(editorRow); } else if (editInfo.LabelMode == LabelMode.Right) { editorRow.Cells.Add(editorCell); editorRow.Cells.Add(labelCell); tbl.Rows.Add(editorRow); } // Build the Validators this.BuildValidators(editInfo, propEditor.ID); var validatorsRow = new TableRow(); var validatorsCell = new TableCell(); validatorsCell.ColumnSpan = 2; // Add the Validators to the editor cell foreach (BaseValidator validator in this.Validators) { validatorsCell.Controls.Add(validator); } validatorsRow.Cells.Add(validatorsCell); tbl.Rows.Add(validatorsRow); // Add the Table to the Controls Collection this.Controls.Add(tbl); }
/// <summary> /// Adds new row into result table. /// </summary> private TableRow GetRow(string cultureName, string cultureCode) { bool isDefaultCulture = cultureCode.Equals(CultureHelper.DefaultUICultureCode, StringComparison.InvariantCultureIgnoreCase); bool isCurrentCulture = cultureCode.Equals(selectedCultureCode, StringComparison.InvariantCultureIgnoreCase); if (isDefaultCulture) { cultureName = String.Format("{0} ({1})", cultureName, GetString("general.default").ToLowerInvariant()); } else if (isCurrentCulture) { cultureName = String.Format("{0} ({1})", cultureName, GetString("general.current").ToLowerInvariant()); } Image flag = new Image(); flag.ImageUrl = GetFlagIconUrl(cultureCode, "16x16"); flag.CssClass = "cms-icon-80"; flag.Style.Add("vertical-align", "middle"); flag.ToolTip = String.Format("{0} ({1})", cultureName, cultureCode); flag.AlternateText = flag.ToolTip; var label = new Label(); label.Text = " " + cultureName; TableCell cultureCell = new TableCell(); cultureCell.Width = new Unit("250px"); cultureCell.Controls.Add(flag); cultureCell.Controls.Add(label); var textArea = (FormEngineUserControl)LoadControl("~/CMSFormControls/Inputs/LargeTextArea.ascx"); textArea.ID = cultureCode; textArea.Enabled = EnableTranslations; if (!String.IsNullOrEmpty(mResourceStringInfo.StringKey)) { textArea.Text = ResourceStringInfoProvider.GetStringFromDB(mResourceStringInfo.StringKey, cultureCode); if (string.IsNullOrEmpty(textArea.Text)) { // If translation not found in database try to load it from resource file textArea.Text = ResHelper.GetFileString(mResourceStringInfo.StringKey, cultureCode, string.Empty, false); } } if (!isDefaultCulture && EnableTranslations) { textArea.SetValue("AllowTranslationServices", true); textArea.SetValue("TranslationSourceLanguage", CultureHelper.DefaultUICultureCode); textArea.SetValue("TranslationTargetLanguage", cultureCode); } TableCell resStringCell = new TableCell(); resStringCell.Controls.Add(textArea); TableRow row = new TableRow(); row.Cells.Add(cultureCell); row.Cells.Add(resStringCell); mTranslations.Add(cultureCode.ToLowerInvariant(), textArea); return(row); }
public static Table HtmlTable(IDataReader rd, string title = null, int?maxrows = null) { var pctnames = new List <string> { "pct", "percent" }; var t = new Table(); t.Attributes.Add("class", "table table-striped"); if (title.HasValue()) { var c = new TableHeaderCell { ColumnSpan = rd.FieldCount, Text = title, }; c.Style.Add(HtmlTextWriterStyle.TextAlign, "center"); var r = new TableHeaderRow { TableSection = TableRowSection.TableHeader }; r.Cells.Add(c); t.Rows.Add(r); } var h = new TableHeaderRow { TableSection = TableRowSection.TableHeader }; for (var i = 0; i < rd.FieldCount; i++) { var typ = rd.GetDataTypeName(i); var nam = rd.GetName(i).ToLower(); var align = HorizontalAlign.NotSet; switch (typ.ToLower()) { case "decimal": align = HorizontalAlign.Right; break; case "int": if (nam != "year" && !nam.EndsWith("id") && !nam.EndsWith("id2")) { align = HorizontalAlign.Right; } break; } if (!nam.Equal("linkfornext")) { h.Cells.Add(new TableHeaderCell { Text = rd.GetName(i), HorizontalAlign = align }); } } t.Rows.Add(h); var rn = 0; string linkfornext = null; while (rd.Read()) { rn++; if (maxrows.HasValue && rn > maxrows) { break; } var r = new TableRow(); for (var i = 0; i < rd.FieldCount; i++) { var typ = rd.GetDataTypeName(i); var nam = rd.GetName(i).ToLower(); if (nam == "linkfornext") { linkfornext = rd.GetString(i); continue; } string s; var align = HorizontalAlign.NotSet; switch (typ.ToLower()) { case "decimal": var dec = rd[i].ToNullableDecimal(); s = StartsEndsWith(pctnames, nam) ? dec.ToString2("N1", "%") : dec.ToString2("c"); align = HorizontalAlign.Right; break; case "real": case "float": var dbl = rd[i].ToNullableDouble(); s = StartsEndsWith(pctnames, nam) ? dbl.ToString2("N1", "%") : dbl.ToString2("N1"); align = HorizontalAlign.Right; break; case "date": case "datetime": var dt = rd[i].ToNullableDate(); if (dt.HasValue && dt.Value.Date != dt.Value) { s = dt.FormatDateTime(); } else { s = dt.FormatDate(); } break; case "int": var ii = rd[i].ToNullableInt(); if (nam.Equal("peopleid") || nam.Equal("spouseid")) { s = $"<a href='/Person2/{ii}' target='Person'>{ii}</a>"; } else if (nam.Equal("organizationid") || nam.EndsWith("orgid")) { s = $"<a href='/Org/{ii}' target='Organization'>{ii}</a>"; } else if (nam.EndsWith("id") || nam.EndsWith("id2") || nam.Equal("Year")) { s = ii.ToString(); } else { s = ii.ToString2("N0"); align = HorizontalAlign.Right; } break; default: s = rd[i].ToString(); if (s == "Total") { s = $"<strong>{s}</strong>"; } break; } if (linkfornext.HasValue()) { s = $"<a href='{linkfornext}' target='link'>{s}</a>"; linkfornext = null; } r.Cells.Add(new TableCell() { Text = s, HorizontalAlign = align, }); } t.Rows.Add(r); } var rowcount = $"Count = {rn} rows"; if (maxrows.HasValue && rn > maxrows) { rowcount = $"Displaying {maxrows} of {rn} rows"; } var tc = new TableCell() { ColumnSpan = rd.FieldCount, Text = rowcount, }; var tr = new TableFooterRow(); tr.Cells.Add(tc); t.Rows.Add(tr); return(t); }
public void displayBooks(List <Book> returnBooks) { bookTable.Rows.Clear(); TableHeaderRow hRow = new TableHeaderRow(); bookTable.Rows.Add(hRow); TableHeaderCell numH = new TableHeaderCell(); numH.Text = "Num"; TableHeaderCell idH = new TableHeaderCell(); idH.Text = "ID"; TableHeaderCell nameH = new TableHeaderCell(); nameH.Text = "Name"; TableHeaderCell authorH = new TableHeaderCell(); authorH.Text = "Author"; TableHeaderCell yearH = new TableHeaderCell(); yearH.Text = "Year"; TableHeaderCell priceH = new TableHeaderCell(); priceH.Text = "Price"; TableHeaderCell stockH = new TableHeaderCell(); stockH.Text = "Stock"; hRow.Cells.Add(numH); hRow.Cells.Add(idH); hRow.Cells.Add(nameH); hRow.Cells.Add(authorH); hRow.Cells.Add(yearH); hRow.Cells.Add(priceH); hRow.Cells.Add(stockH); for (int i = 1; i <= returnBooks.Count; i++) { Book book = returnBooks[i - 1]; TableRow tRow = new TableRow(); bookTable.Rows.Add(tRow); TableCell num = new TableCell(); num.Text = i.ToString(); TableCell id = new TableCell(); id.Text = book.ID; TableCell name = new TableCell(); name.Text = book.Name; TableCell author = new TableCell(); author.Text = book.Author; TableCell year = new TableCell(); year.Text = book.Year.ToString(); TableCell price = new TableCell(); price.Text = book.Price.ToString(); TableCell stock = new TableCell(); stock.Text = book.Stock.ToString(); tRow.Cells.Add(num); tRow.Cells.Add(id); tRow.Cells.Add(name); tRow.Cells.Add(author); tRow.Cells.Add(year); tRow.Cells.Add(price); tRow.Cells.Add(stock); } }
//display the search results from the search term in the query string on statup protected void Page_Load(object sender, EventArgs e) { //get the search term form the querystring searchTerm = Request.QueryString["ST"]; //check if the search term is empty if (searchTerm == null || searchTerm == "") { JumbotronSearchBox.ForeColor = System.Drawing.Color.Red; JumbotronSearchBox.Text = "Enter A Search Term"; } else { //creat a counter to keep track of the current row and result count int productCount = 0; int serviceCount = 0; int stylistRowCount = 0; bookingCount = 0; try { //run the search function of the BLL to get the results and diplay them Tuple <List <SP_ProductSearchByTerm>, List <SP_SearchStylistsBySearchTerm> > results = handler.UniversalSearch(searchTerm); #region Products //check if there are product result or not if (results.Item1.Count != 0) { TableRow newRow = new TableRow(); TableHeaderCell newHeaderCell = new TableHeaderCell(); //create a loop to display each result foreach (SP_ProductSearchByTerm result in results.Item1) { //check if it is a service or product //service (Applecation / Service) if (result.ProductType == 'S' || result.ProductType == 'A') { //Service serviceCount++; //check if it the first service and create a table header if it is if (serviceCount == 1) { createServiceTableHeader(); } // create a new row in the results table and set the height newRow = new TableRow(); newRow.Height = 50; serviceSearchResults.Rows.Add(newRow); //fill the row with the data from the product results object TableCell newCell = new TableCell(); newCell.Text = "<a class='btn btn-default' href='/cheveux/services.aspx?ProductID=" + result.ProductID.ToString().Replace(" ", string.Empty) + "'>" + result.Name.ToString() + "</a>"; serviceSearchResults.Rows[serviceCount].Cells.Add(newCell); newCell = new TableCell(); newCell.Text = "<a class='btn btn-default' href='/cheveux/services.aspx?ProductID=" + result.ProductID.ToString().Replace(" ", string.Empty) + "'>" + result.ProductDescription.ToString() + "</a>"; serviceSearchResults.Rows[serviceCount].Cells.Add(newCell); newCell = new TableCell(); newCell.Text = "R " + result.Price; serviceSearchResults.Rows[serviceCount].Cells.Add(newCell); } //products (Treatments) else if (result.ProductType == 'T') { //Products productCount++; //check if it the first product and create a table header if it is if (productCount == 1) { createProductTableHeader(); } // create a new row in the results table and set the height newRow = new TableRow(); newRow.Height = 50; ProductSearchResults.Rows.Add(newRow); //fill the row with the data from the product results object TableCell newCell = new TableCell(); newCell.Text = "<a class='btn btn-default' href='/cheveux/Products.aspx??ProductID=" + result.ProductID.ToString().Replace(" ", string.Empty) + "'>" + result.Name.ToString() + "</a>"; ProductSearchResults.Rows[productCount].Cells.Add(newCell); newCell = new TableCell(); newCell.Text = "<a class='btn btn-default' href='/cheveux/Products.aspx??ProductID=" + result.ProductID.ToString().Replace(" ", string.Empty) + "'>" + result.ProductDescription.ToString() + "</a>"; ProductSearchResults.Rows[productCount].Cells.Add(newCell); newCell = new TableCell(); newCell.Text = "R " + result.Price; ProductSearchResults.Rows[productCount].Cells.Add(newCell); } //error else { //Error function.logAnError("Unknown Product Type found in search results"); } } } #endregion #region Stylist //check if the are Stylist Results or not if (results.Item2.Count != 0) { //create a new row in the results table and set the height TableRow newRow = new TableRow(); newRow.Height = 50; StylistSearchResults.Rows.Add(newRow); //create a header row and set cell withs TableHeaderCell newHeaderCell = new TableHeaderCell(); newHeaderCell.Width = 150; StylistSearchResults.Rows[0].Cells.Add(newHeaderCell); newHeaderCell = new TableHeaderCell(); newHeaderCell.Text = "Stylist Name"; newHeaderCell.Width = 750; StylistSearchResults.Rows[0].Cells.Add(newHeaderCell); newHeaderCell = new TableHeaderCell(); newHeaderCell.Text = "Stylist Specialization"; newHeaderCell.Width = 750; StylistSearchResults.Rows[0].Cells.Add(newHeaderCell);; //create a loop to display each result foreach (SP_SearchStylistsBySearchTerm result in results.Item2) { stylistRowCount++; // create a new row in the results table and set the height newRow = new TableRow(); newRow.Height = 50; StylistSearchResults.Rows.Add(newRow); //fill the row with the data from the results object TableCell newCell = new TableCell(); newCell.Text = "<img src=" + result.StylistImage + " alt='" + result.StylistFName + " " + result.StylistLName + " Profile Image' width='75' height='75'/>"; StylistSearchResults.Rows[stylistRowCount].Cells.Add(newCell); newCell = new TableCell(); newCell.Text = "<a class='btn btn-default' href='Profile.aspx?Action=View&empID=" + result.StylistID.ToString().Replace(" ", string.Empty) + "'>" + result.StylistFName + " " + result.StylistLName + "</a>"; StylistSearchResults.Rows[stylistRowCount].Cells.Add(newCell); newCell = new TableCell(); newCell.Text = "<a class='btn btn-default' href='/cheveux/services.aspx?ProductID=" + handler.viewStylistSpecialisationAndBio(result.StylistID.ToString()).serviceID.ToString().Replace(" ", string.Empty) + "'>" + handler.viewStylistSpecialisationAndBio(result.StylistID.ToString()).serviceName.ToString() + "</a>"; StylistSearchResults.Rows[stylistRowCount].Cells.Add(newCell); } } #endregion #region Bookings searchBookings(sender, e); #endregion #region count headings //set the headings based on the search results //products heading if (bookingCount != 0) { //set the product search results heading bookingResultLable.Text = "<h2> " + bookingCount + " Booking Search Results For '" + searchTerm + "' </h2>"; btnShowBoings.Visible = true; } //products heading if (productCount != 0) { //set the product search results heading ProductResultsLable.Text = "<h2> " + productCount + " Product Search Results For '" + searchTerm + "' </h2>"; btnHideProducts.Visible = true; } //service heading if (serviceCount != 0) { //set the product search results heading serviceResultsLable.Text = "<h2> " + serviceCount + " Service Search Results For '" + searchTerm + "' </h2>"; btnHideServices.Visible = true; } //Stylist Heading if (stylistRowCount != 0) { //set the stylist search results heading StylistResultsLable.Text = "<h2> " + stylistRowCount + " Stylist Search Results For '" + searchTerm + "' </h2>"; btnHideStylists.Visible = true; } //no results if (stylistRowCount == 0 && serviceCount == 0 && productCount == 0 && bookingCount == 0) { bookingResultLable.Text = "<h2> 0 Search Results For '" + searchTerm + "' </h2>"; } } #endregion catch (Exception Err) { function.logAnError(Err.ToString()); serviceResultsLable.Text = "An Error Occurred Getting Search Results From The Server, Try Again Later"; } } }
public void searchBookings(object sender, EventArgs e) { List <SP_GetCustomerBooking> bookingsList = new List <SP_GetCustomerBooking>(); List <SP_GetBookingServices> bookingServiceList = null; bool searchBooking = false; bookingCount = 0; bookingSearchResults.Rows.Clear(); //get the search term form the querystring searchTerm = Request.QueryString["ST"]; if (cookie != null) { if (cookie["UT"].ToString()[0] == 'C' || cookie["UT"].ToString()[0] == 'R' || cookie["UT"].ToString()[0] == 'S' || cookie["UT"].ToString()[0] == 'M') { searchBooking = true; if (!Page.IsPostBack) { CalendarDateStrart.SelectedDate = Convert.ToDateTime("1/1/1753"); CalendarDateEnd.SelectedDate = Convert.ToDateTime("12/31/9999"); } } if (searchBooking == true) { if (CalendarDateStrart.SelectedDate < CalendarDateEnd.SelectedDate) { lCalBookingError.Visible = false; //add booking to list foreach (SP_GetCustomerBooking book in handler.searchBookings(CalendarDateStrart.SelectedDate, CalendarDateEnd.SelectedDate)) { bookingsList.Add(book); } //sort the list by date bookingsList.Sort((x, y) => y.bookingDate.CompareTo(x.bookingDate)); if (bookingsList.Count != 0) { foreach (SP_GetCustomerBooking booking in bookingsList) { bool addBooking = false; //if customer show only their bookings if (cookie["UT"].ToString()[0] == 'C' && booking.CustomerID.ToString().Replace(" ", string.Empty) == cookie["ID"].ToString().Replace(" ", string.Empty)) { if (function.compareToSearchTerm(booking.bookingDate.ToString(), searchTerm) == true || function.compareToSearchTerm(booking.bookingStartTime.ToString(), searchTerm) == true || function.compareToSearchTerm(booking.stylistFirstName.ToString(), searchTerm) == true || function.compareToSearchTerm(function.GetFullArrivedStatus(booking.arrived), searchTerm) == true || function.compareToSearchTerm(booking.BookingComment.ToString(), searchTerm) == true) { addBooking = true; } bookingServiceList = handler.getBookingServices(booking.bookingID); foreach (SP_GetBookingServices bookingService in bookingServiceList) { if (function.compareToSearchTerm(bookingService.ServiceName.ToString(), searchTerm) == true || function.compareToSearchTerm(bookingService.serviceDescripion.ToString(), searchTerm) == true) { addBooking = true; } } } //if stylist show only their bookings else if (cookie["UT"].ToString()[0] == 'S' && booking.stylistEmployeeID.ToString().Replace(" ", string.Empty) == cookie["ID"].ToString().Replace(" ", string.Empty)) { if (function.compareToSearchTerm(booking.bookingDate.ToString(), searchTerm) == true || function.compareToSearchTerm(booking.bookingStartTime.ToString(), searchTerm) == true || function.compareToSearchTerm(booking.CustFullName.ToString(), searchTerm) == true || function.compareToSearchTerm(booking.BookingComment.ToString(), searchTerm) == true || function.compareToSearchTerm(function.GetFullArrivedStatus(booking.arrived), searchTerm) == true) { addBooking = true; } bookingServiceList = handler.getBookingServices(booking.bookingID); foreach (SP_GetBookingServices bookingService in bookingServiceList) { if (function.compareToSearchTerm(bookingService.ServiceName.ToString(), searchTerm) == true || function.compareToSearchTerm(bookingService.serviceDescripion.ToString(), searchTerm) == true) { addBooking = true; } } } //if receptionist or manager show only their bookings else if (cookie["UT"].ToString()[0] == 'R' || cookie["UT"].ToString()[0] == 'M') { if (function.compareToSearchTerm(booking.bookingDate.ToString(), searchTerm) == true || function.compareToSearchTerm(booking.bookingStartTime.ToString(), searchTerm) == true || function.compareToSearchTerm(booking.stylistFirstName.ToString(), searchTerm) == true || function.compareToSearchTerm(booking.CustFullName.ToString(), searchTerm) == true || function.compareToSearchTerm(booking.BookingComment.ToString(), searchTerm) == true || function.compareToSearchTerm(function.GetFullArrivedStatus(booking.arrived), searchTerm) == true) { addBooking = true; } bookingServiceList = handler.getBookingServices(booking.bookingID); foreach (SP_GetBookingServices bookingService in bookingServiceList) { if (function.compareToSearchTerm(bookingService.ServiceName.ToString(), searchTerm) == true || function.compareToSearchTerm(bookingService.serviceDescripion.ToString(), searchTerm) == true) { addBooking = true; } } } if (addBooking == true) { if (bookingCount == 0) { createBookingTableHeader(); FillterBookingResults.Visible = true; } bookingCount++; // create a new row in the results table and set the height TableRow newRow = new TableRow(); newRow.Height = 50; bookingSearchResults.Rows.Add(newRow); //fill the row with the data from the results object //Date TableCell newCell = new TableCell(); newCell.Text = booking.bookingDate.ToString("dd-MM-yyyy"); bookingSearchResults.Rows[bookingCount].Cells.Add(newCell); //Services newCell = new TableCell(); if (bookingServiceList.Count == 1) { newCell.Text = "<a href='/cheveux/services.aspx?ProductID=" + bookingServiceList[0].ServiceID.Replace(" ", string.Empty) + "'>" + bookingServiceList[0].ServiceName.ToString() + "</a>"; } else if (bookingServiceList.Count == 2) { newCell.Text = "<a href='../ViewBooking.aspx?BookingID=" + booking.bookingID.ToString().Replace(" ", string.Empty) + "'>" + bookingServiceList[0].ServiceName.ToString() + ", " + bookingServiceList[1].ServiceName.ToString() + "</a>"; } else if (bookingServiceList.Count > 2) { newCell.Text = "<a href='../ViewBooking.aspx?BookingID=" + booking.bookingID.ToString().Replace(" ", string.Empty) + "&BookingType=Past'> Multiple </a>"; } bookingSearchResults.Rows[bookingCount].Cells.Add(newCell); //if customer show stylist if (cookie["UT"].ToString()[0] == 'C') { //Stylist newCell = new TableCell(); newCell.Text = "<a href='Profile.aspx?Action=View" + "&empID=" + booking.stylistEmployeeID.ToString().Replace(" ", string.Empty) + "'>" + booking.stylistFirstName.ToString() + "</a>"; bookingSearchResults.Rows[bookingCount].Cells.Add(newCell); } //if stylist show customer else if (cookie["UT"].ToString()[0] == 'S') { //Customer newCell = new TableCell(); newCell.Text = "<a href='Profile.aspx?Action=View" + "&UserID=" + booking.CustomerID.ToString().Replace(" ", string.Empty) + "'>" + booking.CustFullName.ToString() + "</a>"; bookingSearchResults.Rows[bookingCount].Cells.Add(newCell); } //if receptionist or manager customer and stylist else if (cookie["UT"].ToString()[0] == 'R' || cookie["UT"].ToString()[0] == 'M') { //Customer newCell = new TableCell(); newCell.Text = "<a href='Profile.aspx?Action=View" + "&UserID=" + booking.CustomerID.ToString().Replace(" ", string.Empty) + "'>" + booking.CustFullName.ToString() + "</a>"; bookingSearchResults.Rows[bookingCount].Cells.Add(newCell); //Stylist newCell = new TableCell(); newCell.Text = "<a href='Profile.aspx?Action=View" + "&empID=" + booking.stylistEmployeeID.ToString().Replace(" ", string.Empty) + "'>" + booking.stylistFirstName.ToString() + "</a>"; bookingSearchResults.Rows[bookingCount].Cells.Add(newCell); } //BTN newCell = new TableCell(); newCell.Text = "<button type = 'button' class='btn btn-default'>" + "<a href = '../ViewBooking.aspx?BookingID=" + booking.bookingID.ToString().Replace(" ", string.Empty) + "&BookingType=Past'" + ">View Booking</a></button>"; bookingSearchResults.Rows[bookingCount].Cells.Add(newCell); } } } } else { lCalBookingError.Text = "Start date must be before end date"; lCalBookingError.ForeColor = System.Drawing.Color.Red; lCalBookingError.Visible = true; } updateBookingHeadings(); } } }
private void LoadPropertiesTable() { if (ddlObjectName.SelectedValue != "") { //Add header TableRow trHeader = new TableRow(); TableCell tc1 = new TableCell(); tc1.Text = "Property"; trHeader.Cells.Add(tc1); TableCell tc2 = new TableCell(); tc2.Text = "Audit this property"; trHeader.Cells.Add(tc2); tblProperties.Rows.Add(trHeader); //Create an instance of the type. PropertyInfo[] properties = Type.GetType(ddlObjectName.SelectedValue).GetProperties(BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public); //Populate the table with all the fields. foreach (PropertyInfo prop in properties) { //Only show properties the have a public set property. MethodInfo[] methodInfo = prop.GetAccessors(); //Get the set method IEnumerable <MethodInfo> set = from m in methodInfo where m.Name.StartsWith("set") select m; if (set.Count() > 0) { if (set.Single <MethodInfo>().IsPublic) { ENTWFStatePropertyEO entWFStateProperty = new ENTWFStatePropertyEO(); TableRow tr = new TableRow(); //Name of property TableCell tcName = new TableCell(); tcName.Text = prop.Name; tr.Cells.Add(tcName); //Checkbox TableCell tcAudit = new TableCell(); CheckBox chkAudit = new CheckBox(); chkAudit.Enabled = !ReadOnly; chkAudit.ID = "chk" + prop.Name; tcAudit.Controls.Add(chkAudit); tr.Cells.Add(tcAudit); tblProperties.Rows.Add(tr); } } } } else { tblProperties.Rows.Clear(); } }
private void DrawBlafTableHeader() { //第一行 TableRow headerRow = this.BmBlafTableHistory.AddHeadRow(); headerRow.Height = 25; this.BmBlafTableHistory.AddHeadCell(headerRow, " ", 70).HorizontalAlign = HorizontalAlign.Center; //股票代码 this.BmBlafTableHistory.AddHeadCell(headerRow, " ", 70).HorizontalAlign = HorizontalAlign.Center; //股票名称 this.BmBlafTableHistory.AddHeadCell(headerRow, " ", 70).HorizontalAlign = HorizontalAlign.Center; //证券市场 this.BmBlafTableHistory.AddHeadCell(headerRow, " ", 120).HorizontalAlign = HorizontalAlign.Center; //证监会行业 this.BmBlafTableHistory.AddHeadCell(headerRow, " ", 120).HorizontalAlign = HorizontalAlign.Center; //行业领域 this.BmBlafTableHistory.AddHeadCell(headerRow, " ", 100).HorizontalAlign = HorizontalAlign.Center; //省份 StockQueryCondition qc = new StockQueryCondition(); qc.DeserializeFromString(this.ViewState["_StockQueryCondition"].ToString()); _dateList = this.SplitDate(qc.DatePickerFrom, qc.DatePickerTo); for (int i = _dateList.Count - 1; i >= 0; i--) { TableCell cell = this.BmBlafTableHistory.AddHeadCell(headerRow, _dateList[i].ToString(), 70 * 12); cell.ColumnSpan = 12; cell.HorizontalAlign = HorizontalAlign.Center; } if (_dateList.Count > 1) { this.BmBlafTableHistory.AddHeadCell(headerRow, " ", 70).HorizontalAlign = HorizontalAlign.Center; for (int i = _dateList.Count - 1; i > 0; i--) { this.BmBlafTableHistory.AddHeadCell(headerRow, " ", 70).HorizontalAlign = HorizontalAlign.Center; } } this.BmBlafTableHistory.AddHeadCell(headerRow, " ", 70).HorizontalAlign = HorizontalAlign.Center; //总股本数 this.BmBlafTableHistory.AddHeadCell(headerRow, " ", 100).HorizontalAlign = HorizontalAlign.Center; //大股东 this.BmBlafTableHistory.AddHeadCell(headerRow, " ", 70).HorizontalAlign = HorizontalAlign.Center; //收入 this.BmBlafTableHistory.AddHeadCell(headerRow, " ", 70).HorizontalAlign = HorizontalAlign.Center; //利润 this.BmBlafTableHistory.AddHeadCell(headerRow, " ", 70).HorizontalAlign = HorizontalAlign.Center; //净利润率 //第二行 TableRow secondRow = this.BmBlafTableHistory.AddHeadRow(); this.BmBlafTableHistory.AddHeadCell(secondRow, "股票代码", 70).HorizontalAlign = HorizontalAlign.Center; //股票代码 this.BmBlafTableHistory.AddHeadCell(secondRow, "股票名称", 70).HorizontalAlign = HorizontalAlign.Center; //股票名称 this.BmBlafTableHistory.AddHeadCell(secondRow, "证券市场", 70).HorizontalAlign = HorizontalAlign.Center; //证券市场 this.BmBlafTableHistory.AddHeadCell(secondRow, "证监会行业", 120).HorizontalAlign = HorizontalAlign.Center; //证监会行业 this.BmBlafTableHistory.AddHeadCell(secondRow, "行业领域", 120).HorizontalAlign = HorizontalAlign.Center; //行业领域 this.BmBlafTableHistory.AddHeadCell(secondRow, "省份", 100).HorizontalAlign = HorizontalAlign.Center; //省份 for (int i = _dateList.Count - 1; i >= 0; i--) { this.BmBlafTableHistory.AddHeadCell(secondRow, "今日开盘价", 70).HorizontalAlign = HorizontalAlign.Center; this.BmBlafTableHistory.AddHeadCell(secondRow, "昨日收盘价", 70).HorizontalAlign = HorizontalAlign.Center; this.BmBlafTableHistory.AddHeadCell(secondRow, "今日收盘价", 70).HorizontalAlign = HorizontalAlign.Center; this.BmBlafTableHistory.AddHeadCell(secondRow, "5日均价", 70).HorizontalAlign = HorizontalAlign.Center; this.BmBlafTableHistory.AddHeadCell(secondRow, "10日均价", 70).HorizontalAlign = HorizontalAlign.Center; this.BmBlafTableHistory.AddHeadCell(secondRow, "20日均价", 70).HorizontalAlign = HorizontalAlign.Center; this.BmBlafTableHistory.AddHeadCell(secondRow, "最高价", 70).HorizontalAlign = HorizontalAlign.Center; this.BmBlafTableHistory.AddHeadCell(secondRow, "最低价", 70).HorizontalAlign = HorizontalAlign.Center; this.BmBlafTableHistory.AddHeadCell(secondRow, "成交量(股)", 70).HorizontalAlign = HorizontalAlign.Center; this.BmBlafTableHistory.AddHeadCell(secondRow, "成交额(元)", 70).HorizontalAlign = HorizontalAlign.Center; this.BmBlafTableHistory.AddHeadCell(secondRow, "增长率", 70).HorizontalAlign = HorizontalAlign.Center; this.BmBlafTableHistory.AddHeadCell(secondRow, "K线图", 70).HorizontalAlign = HorizontalAlign.Center; } if (_dateList.Count > 1) { this.BmBlafTableHistory.AddHeadCell(secondRow, "累计增长率", 70).HorizontalAlign = HorizontalAlign.Center; for (int i = _dateList.Count - 1; i > 0; i--) { this.BmBlafTableHistory.AddHeadCell(secondRow, _dateList[i] + "与" + _dateList[i - 1] + "的成交量比率", 70).HorizontalAlign = HorizontalAlign.Center; } } this.BmBlafTableHistory.AddHeadCell(secondRow, "总股本数", 70).HorizontalAlign = HorizontalAlign.Center; //总股本数 this.BmBlafTableHistory.AddHeadCell(secondRow, "大股东", 100).HorizontalAlign = HorizontalAlign.Center; //大股东 this.BmBlafTableHistory.AddHeadCell(secondRow, "收入", 70).HorizontalAlign = HorizontalAlign.Center; //收入 this.BmBlafTableHistory.AddHeadCell(secondRow, "利润", 70).HorizontalAlign = HorizontalAlign.Center; //利润 this.BmBlafTableHistory.AddHeadCell(secondRow, "净利润率", 70).HorizontalAlign = HorizontalAlign.Center; //净利润率 this.BmBlafTableHistory.Width = "100%"; this.BmBlafTableHistory.Height = "400"; }
private void PopulateGrid() { string searchfrom = txtSearchFrom.Value; string searchto = txtSearchTo.Value; bool err = false; divError.Visible = false; spnNoRows.Visible = false; spnRows.Visible = false; lblSearchFrom.Attributes.Remove("class"); lblSearchFrom.Attributes.Add("class", "input"); lblSearchTo.Attributes.Remove("class"); lblSearchTo.Attributes.Add("class", "input"); DateTime dttemp; if (!String.IsNullOrWhiteSpace(searchfrom) && !String.IsNullOrWhiteSpace(searchto)) { if (DateTime.TryParse(searchfrom, out dttemp)) { dttemp = Convert.ToDateTime(searchfrom); if (dttemp > DateTime.Today) { lblSearchFrom.Attributes.Remove("class"); lblSearchFrom.Attributes.Add("class", "input state-error"); var errorMessageDiv = new HtmlGenericControl("div"); errorMessageDiv.Attributes.Add("class", "note note-error"); errorMessageDiv.InnerText = "Search From cannot be after current date"; lblSearchFrom.Controls.Add(errorMessageDiv); err = true; } if (dttemp < DateTime.Today.AddYears(-120)) { lblSearchFrom.Attributes.Remove("class"); lblSearchFrom.Attributes.Add("class", "input state-error"); var errorMessageDiv = new HtmlGenericControl("div"); errorMessageDiv.Attributes.Add("class", "note note-error"); errorMessageDiv.InnerText = "Search From cannot be so far in the past"; lblSearchFrom.Controls.Add(errorMessageDiv); err = true; } } else { lblSearchFrom.Attributes.Remove("class"); lblSearchFrom.Attributes.Add("class", "input state-error"); var errorMessageDiv = new HtmlGenericControl("div"); errorMessageDiv.Attributes.Add("class", "note note-error"); errorMessageDiv.InnerText = "Search From has an invalid date format"; lblSearchFrom.Controls.Add(errorMessageDiv); err = true; } if (DateTime.TryParse(searchto, out dttemp)) { dttemp = Convert.ToDateTime(searchto); if (dttemp > DateTime.Today) { lblSearchTo.Attributes.Remove("class"); lblSearchTo.Attributes.Add("class", "input state-error"); var errorMessageDiv = new HtmlGenericControl("div"); errorMessageDiv.Attributes.Add("class", "note note-error"); errorMessageDiv.InnerText = "Search To cannot be after current date"; lblSearchTo.Controls.Add(errorMessageDiv); err = true; } if (dttemp < DateTime.Today.AddYears(-120)) { lblSearchTo.Attributes.Remove("class"); lblSearchTo.Attributes.Add("class", "input state-error"); var errorMessageDiv = new HtmlGenericControl("div"); errorMessageDiv.Attributes.Add("class", "note note-error"); errorMessageDiv.InnerText = "Search To cannot be so far in the past"; lblSearchTo.Controls.Add(errorMessageDiv); err = true; } } else { lblSearchTo.Attributes.Remove("class"); lblSearchTo.Attributes.Add("class", "input state-error"); var errorMessageDiv = new HtmlGenericControl("div"); errorMessageDiv.Attributes.Add("class", "note note-error"); errorMessageDiv.InnerText = "Search To has an invalid date format"; lblSearchTo.Controls.Add(errorMessageDiv); err = true; } if (DateTime.TryParse(searchfrom, out dttemp) && DateTime.TryParse(searchto, out dttemp)) { if (Convert.ToDateTime(searchfrom) > Convert.ToDateTime(searchto)) { lblSearchFrom.Attributes.Remove("class"); lblSearchFrom.Attributes.Add("class", "input state-error"); var errorMessageDiv = new HtmlGenericControl("div"); errorMessageDiv.Attributes.Add("class", "note note-error"); errorMessageDiv.InnerText = "Search From must be before Search To"; lblSearchFrom.Controls.Add(errorMessageDiv); lblSearchTo.Attributes.Remove("class"); lblSearchTo.Attributes.Add("class", "input state-error"); errorMessageDiv = new HtmlGenericControl("div"); errorMessageDiv.Attributes.Add("class", "note note-error"); errorMessageDiv.InnerText = "Search To must be after Search From"; lblSearchTo.Controls.Add(errorMessageDiv); err = true; } } } if (err) { divError.Visible = true; return; } ; var results = _reportService.GetCausalityNotSetItems(Convert.ToDateTime(searchfrom), Convert.ToDateTime(searchto), _configValue, ddlFacility.SelectedValue == "" ? 0 : Convert.ToInt32(ddlFacility.SelectedValue), ddlCriteria.SelectedValue == "1" ? CausalityCriteria.CausalitySet : CausalityCriteria.CausalityNotSet); if (results.Count == 0) { spnNoRows.InnerText = "No matching records found..."; spnNoRows.Visible = true; spnRows.Visible = false; } else { spnRows.InnerText = results.Count.ToString() + " row(s) matching criteria found..."; spnRows.Visible = true; spnNoRows.Visible = false; } TableRow row; TableCell cell; if (results.Count > 0) { foreach (CausalityNotSetList item in results) { row = new TableRow(); cell = new TableCell(); cell.Text = item.FirstName; row.Cells.Add(cell); cell = new TableCell(); cell.Text = item.Surname; row.Cells.Add(cell); var patient = UnitOfWork.Repository <Patient>().Queryable().SingleOrDefault(p => p.Id == item.Patient_Id); var facility = patient.GetCurrentFacility(); cell = new TableCell(); cell.Text = facility != null ? facility.Facility.FacilityName : " ** NOT ASSIGNED ** "; row.Cells.Add(cell); cell = new TableCell(); cell.Text = item.AdverseEvent; row.Cells.Add(cell); cell = new TableCell(); cell.Text = item.OnsetDate.ToString("yyyy-MM-dd"); row.Cells.Add(cell); cell = new TableCell(); cell.Text = item.Medicationidentifier; row.Cells.Add(cell); cell = new TableCell(); cell.Text = item.NaranjoCausality; row.Cells.Add(cell); cell = new TableCell(); cell.Text = item.WhoCausality; row.Cells.Add(cell); dt_basic.Rows.Add(row); } } switch (_configValue) { case CausalityConfigType.WHOScale: dt_basic.HideColumn(6); break; case CausalityConfigType.NaranjoScale: dt_basic.HideColumn(7); break; } }
private void getSheet() { sId = new List <string>(); string sem = null; string query = "Select * from Student where ClassID='" + classId + "' "; con.Open(); SqlCommand cmd = new SqlCommand(query, con); SqlDataReader dr = cmd.ExecuteReader(); int i = 1; while (dr.Read()) { sem = dr["SemesterNo"].ToString(); if (i == 1) { departLabel.Text = dr["Department"].ToString(); } TableRow row = new TableRow(); TableCell cell1 = new TableCell(); cell1.CssClass = "backcell"; cell1.Text = i.ToString(); row.Cells.Add(cell1); TableCell cell2 = new TableCell(); cell2.CssClass = "backcell"; cell2.Text = dr["RollNumber"].ToString();; row.Cells.Add(cell2); TableCell cell3 = new TableCell(); cell3.CssClass = "backcell"; cell3.Text = dr["SName"].ToString(); row.Cells.Add(cell3); TableCell cell4 = new TableCell(); cell4.CssClass = "backcell"; cell4.Text = dr["FatherName"].ToString();; row.Cells.Add(cell4); if (i % 2 == 0) { row.BackColor = System.Drawing.Color.FromArgb(240, 240, 240); } attTable.Rows.Add(row); sId.Add(dr["SId"].ToString()); i++; } con.Close(); // getCourses courseId = new List <string>(); query = "Select Distinct(CourseId) from TimeTable where ClassId='" + classId + "' and SemesterNo='" + sem + "' "; con.Open(); cmd = new SqlCommand(query, con); dr = cmd.ExecuteReader(); while (dr.Read()) { courseId.Add(dr[0].ToString()); } con.Close(); for (i = 0; i < courseId.Count; i++) { query = "Select CourseAbb,CourseNo from Course where CourseId='" + courseId[i] + "' "; con.Open(); cmd = new SqlCommand(query, con); dr = cmd.ExecuteReader(); while (dr.Read()) { TableCell cell = new TableCell(); cell.Text = dr["CourseAbb"].ToString() + "(" + dr["CourseNo"].ToString() + ")\n%age"; attTable.Rows[0].Cells.Add(cell); } con.Close(); } query = "Select ClassName from ClassTable where ClassId='" + classId + "' "; con.Open(); cmd = new SqlCommand(query, con); dr = cmd.ExecuteReader(); dr.Read(); classLabel.Text = dr[0].ToString(); con.Close(); }
protected void Page_Load(object sender, EventArgs e) { try { String baseURL = "http://webstrar81.fulton.asu.edu/Page2/api/Review/GetReviews/"; using (var httpClient = new HttpClient()) { var response = httpClient.GetStringAsync(new Uri($"{baseURL}")).Result; if (response != null) { list = JsonConvert.DeserializeObject <List <String> >(response); } } if (list.Count > 0 && string.Equals(list[0].ToString(), "ERROR")) { reviewTable.Visible = false; errorLabel.Visible = true; errorLabel.Text = "ERROR: " + list[1].ToString(); } if (list.Count > 0 && !string.Equals(list[0].ToString(), "ERROR")) { reviewTable.Visible = true; errorLabel.Visible = false; TableRow row; TableCell cell1, cell2, cell3, cell4, cell5, cell6, cell7, cell8, cell9; foreach (var review in list) { row = new TableRow(); cell1 = new TableCell(); cell2 = new TableCell(); cell3 = new TableCell(); cell4 = new TableCell(); cell5 = new TableCell(); cell6 = new TableCell(); cell7 = new TableCell(); cell8 = new TableCell(); cell9 = new TableCell(); string[] colvalues = review.Split('#'); cell1.Text = colvalues[1]; DropDownList1.Items.Add(colvalues[1]); hospitals.Add(colvalues[0], colvalues[1]); cell2.Text = colvalues[2]; cell3.Text = colvalues[4]; cell4.Text = colvalues[5]; cell5.Text = colvalues[6]; cell6.Text = colvalues[7]; cell7.Text = colvalues[8]; cell8.Text = colvalues[9]; cell9.Text = colvalues[3]; row.Cells.Add(cell1); row.Cells.Add(cell2); row.Cells.Add(cell3); row.Cells.Add(cell4); row.Cells.Add(cell5); row.Cells.Add(cell6); row.Cells.Add(cell7); row.Cells.Add(cell8); row.Cells.Add(cell9); reviewTable.Rows.Add(row); } } else { reviewTable.Visible = false; } } catch (Exception ex) { errorLabel.Visible = true; reviewTable.Visible = false; errorLabel.Text = "ERROR: " + ex.Message.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["noOFCartItems"] == null) { Session["noOFCartItems"] = "0"; } int noOfCartItems = Int32.Parse(Session["noOFCartItems"].ToString()); if (noOfCartItems == 0) { emptyCart.Visible = true; } else { String[] cartItems = getCartItems(noOfCartItems); /*TEST * for (int z= 0; z<cartItems.Length; z++) * { * Response.Write(cartItems[z]); * }*/ for (int rowCtr = 1; rowCtr <= noOfCartItems; rowCtr++) { TableRow tRow = new TableRow(); tblCartTable.Rows.Add(tRow); for (int i = 1; i <= 2; i++) { if (i == 1) { TableCell tCell = new TableCell(); tRow.Cells.Add(tCell); String itemName = databaseHelper.getDetails("name", cartItems[rowCtr - 1]); tCell.Controls.Add(new LiteralControl(itemName + ":")); tCell.Attributes.Add("class", "cartTableLeft"); } else { TableCell tCell = new TableCell(); tRow.Cells.Add(tCell); double price = Double.Parse(databaseHelper.getDetails("price", cartItems[rowCtr - 1])); tCell.Controls.Add(new LiteralControl("£" + price.ToString())); tCell.Attributes.Add("class", "cartTableRight"); } } } TableRow Row = new TableRow(); tblCartTable.Rows.Add(Row); TableCell Cell = new TableCell(); Row.Cells.Add(Cell); TableCell Cell2 = new TableCell(); Row.Cells.Add(Cell2); Button clearTrolly = new Button(); clearTrolly.ID = "clearTrolly"; clearTrolly.Text = "Empty Cart"; clearTrolly.Click += new System.EventHandler(clearTrolly_Click); Button checkout = new Button(); checkout.ID = "checkout"; checkout.Text = "Check out"; checkout.Click += new System.EventHandler(checkout_Click); Cell.Controls.Add(clearTrolly); Cell.Attributes.Add("class", "cartTableLeft"); Cell2.Controls.Add(checkout); Cell2.Attributes.Add("class", "cartTableRight"); } }
protected void addproducts_c() { Table T = new Table(); T.Attributes["Class"] = "table-shopping-cart"; TableHeaderRow tr_1 = new TableHeaderRow(); tr_1.Attributes["Class"] = "table-head"; TableHeaderCell th1 = new TableHeaderCell(); th1.Attributes["Class"] = "column-1"; TableHeaderCell th2 = new TableHeaderCell(); th1.Attributes["Class"] = "column-2"; TableHeaderCell th3 = new TableHeaderCell(); th1.Attributes["Class"] = "column-3"; TableHeaderCell th5 = new TableHeaderCell(); th1.Attributes["Class"] = "column-5"; tr_1.Cells.Add(th1); tr_1.Cells.Add(th2); tr_1.Cells.Add(th3); tr_1.Cells.Add(th5); //list_stones_cart = s.getStone_Byname( string name); foreach (var item in list_stones_cart) { #region create HtmlGenericControl TableRow New_stone_div1_c = new TableRow(); TableCell New_stone_div2_c = new TableCell(); HtmlGenericControl New_stone_divimage_c = new HtmlGenericControl("div"); HtmlImage img_for_stone_c = new HtmlImage(); TableCell New_stone_div4_c = new TableCell(); TableCell New_stone_div5_c = new TableCell(); TableCell New_stone_div6_c = new TableCell(); #endregion #region class for HtmlGenericControl New_stone_div1_c.Attributes["Class"] = "table-row"; New_stone_div2_c.Attributes["Class"] = "column-1"; New_stone_divimage_c.Attributes["Class"] = "cart-img-product b-rad-4 o-f-hidden"; New_stone_div4_c.Attributes["Class"] = "column-2"; New_stone_div5_c.Attributes["Class"] = "column-3"; New_stone_div6_c.Attributes["Class"] = "column-5"; #endregion img_for_stone_c.Src = item.ImagePath; New_stone_div4_c.Text = item.Name.ToString(); New_stone_div5_c.Text = item.Sale_Price_CT.ToString(); New_stone_div6_c.Text = item.T_Sale_Price.ToString(); New_stone_divimage_c.Controls.Add(img_for_stone_c); New_stone_div2_c.Controls.Add(New_stone_divimage_c); New_stone_div1_c.Cells.Add(New_stone_div2_c); New_stone_div1_c.Cells.Add(New_stone_div4_c); New_stone_div1_c.Cells.Add(New_stone_div5_c); New_stone_div1_c.Cells.Add(New_stone_div6_c); T.Rows.Add(New_stone_div1_c); } divfortable.Controls.Add(T); }
private void addValue_Click(object sender, EventArgs e) { var it = 0; TableCell tcValue = ((sender as Button).Parent.Parent as TableCell); long IdField = 0; long TypeField = 0; string group = ""; foreach (Control c in tcValue.Controls) { if (c is Panel) { it++; } if (c is HiddenField) { if (c.ID.Contains("HiddenFieldIdField")) { IdField = Convert.ToInt64(((HiddenField)c).Value); } if (c.ID.Contains("HiddenFieldTypeField")) { TypeField = Convert.ToInt64(((HiddenField)c).Value); } if (c.ID.Contains("HiddenFieldGroupField")) { group = ((HiddenField)c).Value; } } } var Field = JsonConvert.DeserializeObject <CustomFieldDto>((sender as Button).CommandArgument); var lc = new Panel() { ID = "Panel" + group + Field.Id + it, CssClass = "input-group" }; var ddl = new DropDownList() { ID = "DropDownListValue" + group + Field.Id + it, Width = 100, CssClass = "input-group-prepend" }; var enums = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, string> >(Field.Enums.ToString()); foreach (var option in enums) { ddl.Items.Add(new ListItem() { Value = option.Key.ToString(), Text = option.Value }); } ; ddl.SelectedIndex = 0; lc.Controls.Add(ddl); var numValue = new TextBox() { ID = "TextBoxFieldValue" + group + Field.Id + it, Text = "", CssClass = "form-control" }; lc.Controls.Add(numValue); var addValue = new Button() { ID = "ButtonFieldValue" + group + Field.Id + it, Text = "+", CssClass = "input-group-append input-group-text" }; addValue.Click += addValue_Click; lc.Controls.Add(addValue); if (Session.Contents["MultiFields" + group + Field.Id.ToString()] == null) { Session.Contents["MultiFields" + group + Field.Id.ToString()] = new Dictionary <String, Panel>(); } (Session.Contents["MultiFields" + group + Field.Id.ToString()] as Dictionary <String, Panel>).Add(lc.ID, lc); tcValue.Controls.Add(lc); }
private Table CreateTableContact(int count, long ContactId, string FIO, string CompanyName, List <CrmCustomField> fields) { var table = new Table() { ID = "TableContact" + count, CssClass = "table-borderless" }; var th = new TableHeaderRow(); th.Cells.Add(new TableHeaderCell() { Text = "Поле" }); th.Cells.Add(new TableHeaderCell() { Text = "Значение" }); table.Rows.Add(th); var tr = new TableRow(); tr.Cells.Add(new TableCell() { Text = "ФИО:" }); var tc = new TableCell(); tc.Controls.Add(new TextBox() { ID = "TextBoxContact" + count, Text = FIO, Width = 400, CssClass = "form-control" }); if (ContactId > 0) { tc.Controls.Add(new HiddenField() { ID = "HiddenFieldContact" + count, Value = ContactId.ToString() }); } tr.Cells.Add(tc); table.Rows.Add(tr); var trCompany = new TableRow(); trCompany.Cells.Add(new TableCell() { Text = "Компания:" }); var tcCompany = new TableCell(); tcCompany.Controls.Add(new TextBox() { ID = "TextBoxCampaignName" + count, Text = CompanyName, Width = 400, CssClass = "form-control" }); trCompany.Cells.Add(tcCompany); table.Rows.Add(trCompany); var contact_fields = _service.GetAccountInfo().CustomFields.Contacts; foreach (var ContactField in contact_fields.Where(r => ContactFields.Count == 0 || ContactFields.Contains(r.Id)).ToList()) { table.Rows.Add(CreateRowForCustomField(TypeField.Lead, "Contact" + count, fields, ContactField)); } PanelContacts.Controls.Add(table); return(table); }
protected override void CreateChildControls() { if (!String.IsNullOrEmpty(this.OAuthCode) || !String.IsNullOrEmpty(this.OAuthClientID) || !String.IsNullOrEmpty(this.OAuthRedirectUrl) || !String.IsNullOrEmpty(this.OAuthClientSecret) || !String.IsNullOrEmpty(this.UserID) ) { //first get the authentication token oAuthToken = CommonHelper.GetOAuthToken("publish_stream", OAuthClientID, OAuthRedirectUrl, OAuthClientSecret, OAuthCode); this.Page.Header.Controls.Add(CommonHelper.InlineStyle()); base.CreateChildControls(); try { Table mainTable; TableRow tr; TableCell tc; Button buttonWriteOnWall; mainTable = new Table(); mainTable.Width = Unit.Percentage(100); mainTable.CellSpacing = 0; mainTable.CellPadding = 0; this.Controls.Add(mainTable); //Create the header if (this.ShowHeader) { tr = new TableRow(); mainTable.Rows.Add(tr); tc = new TableCell(); tr.Cells.Add(tc); tc.Controls.Add(CommonHelper.CreateHeader(this.UserID, this.oAuthToken, this.ShowHeaderImage)); tc.CssClass = "fbHeaderTitleBranded"; } tr = new TableRow(); mainTable.Rows.Add(tr); tc = new TableCell(); tc.Width = Unit.Percentage(30); tr.Cells.Add(tc); textWall = new TextBox(); textWall.TextMode = TextBoxMode.MultiLine; textWall.MaxLength = 140; textWall.CssClass = "fbTextBox"; tc.Controls.Add(textWall); tr = new TableRow(); mainTable.Rows.Add(tr); tc = new TableCell(); tc.HorizontalAlign = HorizontalAlign.Right; tc.Width = Unit.Percentage(30); tr.Cells.Add(tc); buttonWriteOnWall = new Button(); buttonWriteOnWall.ForeColor = Color.White; buttonWriteOnWall.BackColor = Color.FromArgb(84, 116, 186); buttonWriteOnWall.Text = "Share"; buttonWriteOnWall.Click += new EventHandler(buttonWriteOnWall_Click); tc.Controls.Add(buttonWriteOnWall); } catch (Exception Ex) { LblMessage = new Label(); LblMessage.Text = Ex.Message; this.Controls.Add(LblMessage); } } else { LblMessage = new Label(); LblMessage.Text = "Please set the values of facebook settings in webpart properties section in edit mode."; this.Controls.Add(LblMessage); } }
private TableRow CreateRowForCustomField(TypeField typeField, string group, List <CrmCustomField> valueFields, CustomFieldDto Field) { var tr = new TableRow() { ID = "TableRow" + group + Field.Id }; var tcName = new TableCell() { ID = "TableCellName" + group + Field.Id }; var labelName = new Label() { ID = "LabelFieldName" + group + Field.Id, Text = Field.Name // + "_" + Field.TypeId }; tcName.Controls.Add(labelName); tr.Cells.Add(tcName); var tcValue = new TableCell() { ID = "TableCellValue" + group + Field.Id }; var hfIdField = new HiddenField() { ID = "HiddenFieldIdField" + group + Field.Id, Value = Field.Id.ToString() }; tcValue.Controls.Add(hfIdField); var hfGroup = new HiddenField() { ID = "HiddenFieldGroupField" + group + Field.Id, Value = group }; tcValue.Controls.Add(hfGroup); var hfTypeField = new HiddenField() { ID = "HiddenFieldTypeField" + group + Field.Id, Value = Field.TypeId.ToString() }; tcValue.Controls.Add(hfTypeField); switch (Field.TypeId) { case 5: { var selectValue = new CheckBoxList() { ID = "CheckBoxListFieldValue" + group + Field.Id }; var enums = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, string> >(Field.Enums.ToString()); foreach (var option in enums) { selectValue.Items.Add(new ListItem() { Value = option.Key.ToString(), Text = option.Value }); } ; var selectedValue = valueFields.FirstOrDefault(r => r.Id == Field.Id); if (selectedValue != null) { foreach (var _val in selectedValue.Values) { var option = selectValue.Items.FindByValue(_val.Enum); if (option != null) { option.Selected = true; } } } ; tcValue.Controls.Add(selectValue); } break; case 4: { var selectValue = new DropDownList() { ID = "DropDownListFieldValue" + group + Field.Id, CssClass = "form-control" }; var enums = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, string> >(Field.Enums.ToString()); selectValue.Items.Add(new ListItem() { Value = "", Text = "-----" }); foreach (var option in enums) { selectValue.Items.Add(new ListItem() { Value = option.Key.ToString(), Text = option.Value }); } ; var selectedValue = valueFields.FirstOrDefault(r => r.Id == Field.Id); if (selectedValue != null && selectValue.Items.FindByValue(selectedValue.Values.FirstOrDefault().Enum) != null) { selectValue.SelectedValue = selectedValue.Values.FirstOrDefault().Enum; } ; tcValue.Controls.Add(selectValue); } break; case 2: { var selectedValue = valueFields.FirstOrDefault(r => r.Id == Field.Id); var val = selectedValue != null && selectedValue.Values != null && selectedValue.Values.FirstOrDefault() != null?selectedValue.Values.FirstOrDefault().Value : ""; var numValue = new TextBox() { ID = "TextBoxFieldValue" + group + Field.Id, Text = val, TextMode = TextBoxMode.Number, CssClass = "form-control" }; tcValue.Controls.Add(numValue); } break; case 1: { var selectedValue = valueFields.FirstOrDefault(r => r.Id == Field.Id); var val = selectedValue != null && selectedValue.Values != null && selectedValue.Values.FirstOrDefault() != null?selectedValue.Values.FirstOrDefault().Value : ""; var numValue = new TextBox() { ID = "TextBoxFieldValue" + group + Field.Id, Text = val, TextMode = TextBoxMode.SingleLine, CssClass = "form-control" }; tcValue.Controls.Add(numValue); } break; case 3: { var selectedValue = valueFields.FirstOrDefault(r => r.Id == Field.Id); var val = selectedValue != null && selectedValue.Values != null && selectedValue.Values.FirstOrDefault() != null?selectedValue.Values.FirstOrDefault().Value : ""; var numValue = new CheckBox() { ID = "CheckBoxFieldValue" + group + Field.Id, Checked = val == "True" }; tcValue.Controls.Add(numValue); } break; case 8: { if (Session.Contents["MultiFields" + group + Field.Id.ToString()] == null) { Session.Contents["MultiFields" + group + Field.Id.ToString()] = new Dictionary <String, Panel>(); } var sessionFields = (Session.Contents["MultiFields" + group + Field.Id.ToString()] as Dictionary <String, Panel>); var it = 0; var selectedValue = valueFields.FirstOrDefault(r => r.Id == Field.Id); var vals = selectedValue != null && selectedValue.Values != null ? selectedValue.Values : new List <CrmCustomFieldValue>(); foreach (var val in vals) { var lc = new Panel() { ID = "Panel" + group + Field.Id + it, CssClass = "input-group" }; var ddl = new DropDownList() { ID = "DropDownListValue" + group + Field.Id + it, Width = 100, CssClass = "input-group-prepend" }; var enums = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, string> >(Field.Enums.ToString()); foreach (var option in enums) { ddl.Items.Add(new ListItem() { Value = option.Key.ToString(), Text = option.Value }); } ; ddl.SelectedValue = val.Enum; lc.Controls.Add(ddl); var numValue = new TextBox() { ID = "TextBoxFieldValue" + group + Field.Id + it, Text = val.Value, CssClass = "form-control" }; lc.Controls.Add(numValue); var addValue = new Button() { ID = "ButtonFieldValue" + group + Field.Id + it, Text = "+", CssClass = "input-group-append input-group-text" }; addValue.Click += addValue_Click; addValue.CommandArgument = JsonConvert.SerializeObject(Field); lc.Controls.Add(addValue); if (sessionFields.ContainsKey(lc.ID) != null) { sessionFields.Remove(lc.ID); } tcValue.Controls.Add(lc); it++; } foreach (var panel in sessionFields) { tcValue.Controls.Add(panel.Value); it++; } if (it == 0) { var lc = new Panel() { ID = "Panel" + group + Field.Id + it, CssClass = "input-group" }; var ddl = new DropDownList() { ID = "DropDownListValue" + group + Field.Id + it, Width = 100, CssClass = "input-group-prepend" }; var enums = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, string> >(Field.Enums.ToString()); foreach (var option in enums) { ddl.Items.Add(new ListItem() { Value = option.Key.ToString(), Text = option.Value }); } ; ddl.SelectedIndex = 0; lc.Controls.Add(ddl); var numValue = new TextBox() { ID = "TextBoxFieldValue" + group + Field.Id + it, Text = "", CssClass = "form-control" }; lc.Controls.Add(numValue); var addValue = new Button() { ID = "ButtonFieldValue" + group + Field.Id + it, Text = "+", CssClass = "input-group-append input-group-text" }; addValue.Click += addValue_Click; lc.Controls.Add(addValue); tcValue.Controls.Add(lc); } Session.Contents["MultiFields" + group + Field.Id.ToString()] = sessionFields; } break; case 9: { var selectedValue = valueFields.FirstOrDefault(r => r.Id == Field.Id); var val = selectedValue != null && selectedValue.Values != null && selectedValue.Values.FirstOrDefault() != null?selectedValue.Values.FirstOrDefault().Value : ""; var numValue = new TextBox() { ID = "TextBoxFieldValue" + group + Field.Id, Text = val, TextMode = TextBoxMode.MultiLine, CssClass = "form-control" }; tcValue.Controls.Add(numValue); } break; } tr.Cells.Add(tcValue); return(tr); }
private void Fill() { string addq = ""; if (metode.SelectedIndex == 1) { addq = "SELECT * FROM MS_SERTIFIKAT A INNER JOIN MS_KONTRAK B ON A.NoKontrak = B.NoKontrak " + "WHERE B.Status = 'A'"; } else if (metode.SelectedIndex == 2) { addq = "SELECT * FROM MS_SERTIFIKAT A INNER JOIN MS_KONTRAK B ON A.NoKontrak = B.NoKontrak " + "WHERE B.Status = 'B'"; } string strSql = "SELECT " + " A.NoKontrak" + ",B.TglKontrak" + ",B.Status" + ",B.NoUnit" + ",C.Nama AS Cs" + ",D.Nama + ' ' + D.Principal AS Ag" + ",(SELECT COUNT(NoUrut) FROM MS_TAGIHAN WHERE A.NoKontrak = A.NoKontrak) AS CountTagihan" + ",B.FlagKomisi" + ",B.ST" + ",B.NoPPJB" + ",B.NoAJB" + ",A.NoSertifikat" + " FROM MS_SERTIFIKAT A INNER JOIN MS_KONTRAK B ON A.NoKontrak = B.NoKontrak" + " INNER JOIN MS_CUSTOMER C ON B.NoCustomer = C.NoCustomer " + " INNER JOIN MS_AGENT D ON B.NoAgent = D.NoAgent" + " WHERE A.NoKontrak + B.NoUnit + C.Nama + D.Nama + D.Principal " + " LIKE '%" + Cf.Str(keyword.Text) + "%'" + addq + " ORDER BY A.NoKontrak"; DataTable rs = Db.Rs(strSql); Rpt.NoData(rpt, rs, "Tidak ditemukan data kontrak dengan keyword diatas."); for (int i = 0; i < rs.Rows.Count; i++) { if (!Response.IsClientConnected) { break; } TableRow r = new TableRow(); TableCell c; string StatusKontrak = rs.Rows[i]["Status"].ToString(); string sStrike = ""; if (StatusKontrak == "B") { r.ForeColor = Color.Silver; sStrike = "style='text-decoration:line-through'"; } string st = ""; if ((string)rs.Rows[i]["ST"] == "D") { //sudah keluar st = "black"; } else { st = "silver"; } string ppjb = ""; if ((string)rs.Rows[i]["NoPPJB"] != "") { //sudah keluar ppjb = "black"; } else { ppjb = "silver"; } string ajb = ""; if ((string)rs.Rows[i]["NoAJB"] != "") { //sudah keluar ajb = "black"; } else { ajb = "silver"; } c = new TableCell(); if (Request.QueryString["status"] == "dari" || Request.QueryString["status"] == "sampai") { c.Text = "<a href=\"javascript:callSource('" + rs.Rows[i]["NoKontrak"] + "', '" + Request.QueryString["status"] + "')\">" + rs.Rows[i]["NoKontrak"].ToString() + "</a><br>" + "<font style='font:8pt;color:" + ppjb + "'>PPJB</font> " + "<font style='font:8pt;color:" + ajb + "'>AJB</font> " + "<font style='font:8pt;color:" + st + "'>BAST</font>" ; } else { c.Text = "<a href=\"javascript:call('" + rs.Rows[i]["NoKontrak"] + "')\" " + sStrike + ">" + rs.Rows[i]["NoKontrak"].ToString() + "</a><br>" + "<font style='font:8pt;color:" + ppjb + "'>PPJB</font> " + "<font style='font:8pt;color:" + ajb + "'>AJB</font> " + "<font style='font:8pt;color:" + st + "'>BAST</font>" ; } c.Wrap = false; r.Cells.Add(c); c = new TableCell(); c.Text = rs.Rows[i]["NoUnit"].ToString(); c.Wrap = false; r.Cells.Add(c); c = new TableCell(); c.Text = Cf.Day(rs.Rows[i]["TglKontrak"]); c.Wrap = false; r.Cells.Add(c); c = new TableCell(); c.Text = rs.Rows[i]["Cs"].ToString() + "<br>" + rs.Rows[i]["Ag"].ToString(); c.Wrap = false; r.Cells.Add(c); c = new TableCell(); c.Text = ""; r.Cells.Add(c); Rpt.Border(r); rpt.Rows.Add(r); } }
private void GenerateModules() { if (Global.PermissionCore.Sections.Items != null) { foreach (PermissionCore.Classes.Section sec in Global.PermissionCore.Sections.Items) { WebUtilities.Controls.Table tblSection = new WebUtilities.Controls.Table(); tblSection.ID = "tbl" + sec.Name; tblSection.CssClass = "Userroletable"; tblSection.CellPadding = 0; tblSection.CellSpacing = 0; tblSection.Width = new Unit(100, UnitType.Percentage); TableHeaderRow hrow = new TableHeaderRow(); TableCell hCell1 = new TableCell(); hCell1.ID = "hCell" + sec.Name; hCell1.Width = new Unit(100, UnitType.Pixel); hCell1.CssClass = "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor8 TableCellPercentage"; hCell1.Text = Global.LanguageManager.GetText(sec.Name).ToLower(); hrow.Cells.Add(hCell1); int cnt = 0; foreach (PermissionCore.Classes.Permission permission in sec.Permissions) { if (!Global.User.HasPermission(permission.Id) && Global.User.HasPermission(1001) == false) { continue; } if (!(permission.Id == 1001) && !(permission.Id == 1000)) { TableCell tc = new TableCell(); tc.ID = "tc" + permission.Name.ToLower(); tc.Text = PrepareRoleName(Global.LanguageManager.GetText(permission.Name).ToLower()); tc.Width = new Unit(150, UnitType.Pixel); tc.CssClass = cnt % 2 == 0 ? "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor5" : "TableCellHeadline TableCellHeadlineCategory BorderColor9 BackgroundColor9"; hrow.Cells.Add(tc); cnt++; } } tblSection.Rows.Add(hrow); TableRow tr = new WebUtilities.Controls.TableRow(); TableCell td1 = new TableCell { ID = "td_" + sec.Name, Width = new Unit(150, UnitType.Pixel) }; td1.CssClass = "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor7"; tr.Cells.Add(td1); int count = 0; foreach (PermissionCore.Classes.Permission detailPermission in sec.Permissions) { if (!Global.User.HasPermission(detailPermission.Id) && Global.User.HasPermission(1001) == false) { continue; } if (!(detailPermission.Id == 1001) && !(detailPermission.Id == 1000)) { TableCell cell = new TableCell(); cell.ID = "td" + detailPermission.Name; cell.Width = new Unit(150, UnitType.Pixel); cell.CssClass = count % 2 == 0 ? "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor9" : "TableCellHeadline TableCellHeadlineCategory BorderColor9 BackgroundColor5"; WebUtilities.Controls.CheckBox checkBox = new WebUtilities.Controls.CheckBox(); checkBox.ID = "chk_" + detailPermission.Id; cell.Controls.Add(checkBox); tr.Cells.Add(cell); count++; } } tblSection.Rows.Add(tr); pnlModuleDetails.Controls.Add(tblSection); } } }
protected void ShowGrid() { tableProfiles.Rows.Clear(); // Draw header here TableHeaderRow rowHeader = new TableHeaderRow(); foreach (ABTableColumn column in _tableColumns) { if (!column.Visible) { continue; } TableHeaderCell cell = new TableHeaderCell(); cell.Controls.Add(column.LinkButton); rowHeader.Cells.Add(cell); } tableProfiles.Rows.Add(rowHeader); int nRow = 0; foreach (RecordUserProfile profile in _users.GetProfiles(_strOrder, _strFilter)) { ++nRow; TableRow row = new TableRow(); string sProfileURL = ""; string sPhotoURL = ""; string sEmail = ""; if (profile.ProfileURL.Trim().Length > 0) { sProfileURL = "javascript:ShowABProfileDialog('" + profile.LastName.Replace("\'", "\\\'").Replace("\"", "\\\"") + ", " + profile.FirstName.Replace("\'", "\\\'").Replace("\"", "\\\"") + "', '" + System.Web.HttpUtility.UrlEncode(profile.ProfileURL) + "')"; } if (_bShowPhotoIconOnly) { if (profile.PhotoURL.Trim().Length > 0) { sPhotoURL = string.Format("<a onmouseover=\"ShowABPhotoDialog('{0}', '{1}'); return true;\" " + "onmouseout=\"HideABPhotoDialog('{3}'); return true;\" " + "href=\"javascript:ShowABPhotoDialog('{0}', '{1}')\"> " + "<img id=\"{0}\" width=\"23\" height=\"16\" src=\"{2}\"></a>", this.ClientID + "_photo_img_ctl_" + nRow.ToString(), profile.PhotoURL, _site.Url + _sPhotoImageFile, _site.Url + _sNoProfileImageFile); } else { sPhotoURL = string.Format("<a onmouseover=\"ShowABPhotoDialog('{0}', '{1}'); return true;\" " + "onmouseout=\"HideABPhotoDialog('{1}'); return true;\" " + "href=\"javascript:ShowABPhotoDialog('{0}', '{1}')\"> " + "<img id=\"{0}\" width=\"23\" height=\"16\" src=\"{2}\"></a>", this.ClientID + "_photo_img_ctl_" + nRow.ToString(), _site.Url + _sNoProfileImageFile, _site.Url + _sPhotoImageFile); } } else { if (profile.PhotoURL.Trim().Length > 0) { sPhotoURL = string.Format("<div class=\"photo_img\"><img width=\"80\" height=\"80\" src=\"{0}\"></div>", profile.PhotoURL); } else { sPhotoURL = string.Format("<div class=\"photo_img\"><img width=\"80\" height=\"80\" src=\"{0}\"></div>", _site.Url + _sNoProfileImageFile); } } if (profile.EmailWork.Trim().Length > 0) { sEmail = string.Format("mailto:{0}", profile.EmailWork); } if (_tableColumns[(int)columnNames.columnPhoto].Visible) { TableCell cellPhoto = new TableCell(); LiteralControl lcPhoto = new LiteralControl(); lcPhoto.Text = sPhotoURL; cellPhoto.Controls.Add(lcPhoto); row.Cells.Add(cellPhoto); } if (_tableColumns[(int)columnNames.columnLastName].Visible) { TableCell cellLastName = new TableCell(); HyperLink linkLastName = new HyperLink(); linkLastName.Text = profile.LastName; linkLastName.NavigateUrl = sProfileURL; cellLastName.Controls.Add(linkLastName); row.Cells.Add(cellLastName); } if (_tableColumns[(int)columnNames.columnFirstName].Visible) { TableCell cellFirstName = new TableCell(); HyperLink linkFirstName = new HyperLink(); linkFirstName.Text = profile.FirstName; linkFirstName.NavigateUrl = sProfileURL; cellFirstName.Controls.Add(linkFirstName); row.Cells.Add(cellFirstName); } if (_tableColumns[(int)columnNames.columnMiddleName].Visible) { TableCell cellMiddleName = new TableCell(); HyperLink linkMiddleName = new HyperLink(); linkMiddleName.Text = profile.MiddleName; linkMiddleName.NavigateUrl = sProfileURL; cellMiddleName.Controls.Add(linkMiddleName); row.Cells.Add(cellMiddleName); } if (_tableColumns[(int)columnNames.columnOrganization].Visible) { TableCell cellOrganization = new TableCell(); cellOrganization.Controls.Add(new LiteralControl(profile.Organization)); row.Cells.Add(cellOrganization); } if (_tableColumns[(int)columnNames.columnSeparateDivision].Visible) { TableCell cellSeparateDivision = new TableCell(); cellSeparateDivision.Controls.Add(new LiteralControl(profile.SeparateDivision)); row.Cells.Add(cellSeparateDivision); } if (_tableColumns[(int)columnNames.columnSubDivision].Visible) { TableCell cellSubDivision = new TableCell(); cellSubDivision.Controls.Add(new LiteralControl(profile.SubDivision)); row.Cells.Add(cellSubDivision); } if (_tableColumns[(int)columnNames.columnPosition].Visible) { TableCell cellPosition = new TableCell(); cellPosition.Controls.Add(new LiteralControl(profile.Position)); row.Cells.Add(cellPosition); } if (_tableColumns[(int)columnNames.columnPhoneWork].Visible) { TableCell cellPhoneWork = new TableCell(); cellPhoneWork.Controls.Add(new LiteralControl(profile.PhoneWork)); row.Cells.Add(cellPhoneWork); } if (_tableColumns[(int)columnNames.columnPhoneHome].Visible) { TableCell cellHomeWork = new TableCell(); cellHomeWork.Controls.Add(new LiteralControl(profile.PhoneHome)); row.Cells.Add(cellHomeWork); } if (_tableColumns[(int)columnNames.columnEmailWork].Visible) { TableCell cellEmail = new TableCell(); HyperLink linkEmail = new HyperLink(); linkEmail.Text = profile.EmailWork; linkEmail.NavigateUrl = sEmail; cellEmail.Controls.Add(linkEmail); row.Cells.Add(cellEmail); } if (_tableColumns[(int)columnNames.columnBirthday].Visible) { string sBirthday = ""; if (profile.Birthday != null) { sBirthday = profile.BirthdayDT.ToShortDateString(); } TableCell cellMerit = new TableCell(); cellMerit.Controls.Add(new LiteralControl(sBirthday)); row.Cells.Add(cellMerit); } if (_tableColumns[(int)columnNames.columnBirthdayShort].Visible) { string sBirthday = ""; if (profile.Birthday != null) { sBirthday = profile.BirthdayDT.ToString("dd MMMM"); } TableCell cellMerit = new TableCell(); cellMerit.Controls.Add(new LiteralControl(sBirthday)); row.Cells.Add(cellMerit); } if (_tableColumns[(int)columnNames.columnMerit].Visible) { TableCell cellMerit = new TableCell(); cellMerit.Controls.Add(new LiteralControl(profile.BestWorkerMerit)); row.Cells.Add(cellMerit); } tableProfiles.Rows.Add(row); } }
// // Word // private void ExportWord_AppendTableCell(TableRow tr, CellRecord cr) { TableCell tc = tr.AppendChild(new TableCell()); Paragraph para = tc.AppendChild(new Paragraph()); // see: https://stackoverflow.com/questions/17675526/ // how-can-i-modify-the-foreground-and-background-color-of-an-openxml-tablecell/17677892 if (cr.HorizAlign != null) { ParagraphProperties pp = new ParagraphProperties(); if (cr.HorizAlign == "left") { pp.Justification = new Justification() { Val = JustificationValues.Left } } ; if (cr.HorizAlign == "center") { pp.Justification = new Justification() { Val = JustificationValues.Center } } ; if (cr.HorizAlign == "right") { pp.Justification = new Justification() { Val = JustificationValues.Right } } ; para.Append(pp); } if (cr.VertAlign != null || cr.Bg != null) { var tcp = tc.AppendChild(new TableCellProperties()); if (cr.VertAlign == "top") { tcp.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Top }); } if (cr.VertAlign == "center") { tcp.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center }); } if (cr.VertAlign == "bottom") { tcp.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Bottom }); } if (cr.Bg != null) { // ReSharper disable EmptyGeneralCatchClause // ReSharper disable PossibleNullReferenceException try { var bgc = (System.Windows.Media.Color)ColorConverter.ConvertFromString(cr.Bg); var bgs = (new ColorConverter()).ConvertToString(bgc).Substring(3); tcp.Append(new DocumentFormat.OpenXml.Wordprocessing.Shading() { Color = "auto", Fill = bgs, Val = ShadingPatternValues.Clear }); } catch { } // ReSharper enable EmptyGeneralCatchClause // ReSharper enable PossibleNullReferenceException } } // var run = new Run(new Text(cr.Text)); // make a run with multiple breaks var run = new Run(); var lines = cr.Text.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); foreach (var l in lines) { if (run.ChildElements != null && run.ChildElements.Count > 0) { run.AppendChild(new Break()); } run.AppendChild(new Text(l)); } if (cr.Fg != null || cr.Font != null) { // ReSharper disable EmptyGeneralCatchClause try { var rp = new RunProperties(); if (cr.Fg != null) { var fgc = (System.Windows.Media.Color)ColorConverter.ConvertFromString(cr.Fg); var fgs = (new ColorConverter()).ConvertToString(fgc).Substring(3); rp.Append(new DocumentFormat.OpenXml.Wordprocessing.Color() { Val = fgs }); } if (cr.Font != null && cr.Font.Contains("bold")) { rp.Bold = new Bold(); } if (cr.Font != null && cr.Font.Contains("italic")) { rp.Italic = new Italic(); } if (cr.Font != null && cr.Font.Contains("underline")) { rp.Underline = new Underline(); } run.RunProperties = rp; } catch { } // ReSharper enable EmptyGeneralCatchClause } para.Append(run); }
private string LoadInformation(DataTable table) { DataGrid grid = new DataGrid(); BoundColumn col; col = new BoundColumn(); col.DataField = "Name"; col.HeaderText = "Name"; col.ItemStyle.CssClass = "name"; col.ItemStyle.Width = new Unit(400); grid.Columns.Add(col); col = new BoundColumn(); col.DataField = "Value"; col.HeaderText = "Value"; col.ItemStyle.CssClass = "value"; col.ItemStyle.Width = new Unit(624); grid.Columns.Add(col); grid.AutoGenerateColumns = false; grid.HeaderStyle.CssClass = "header"; grid.DataSource = new DataView(table); grid.DataBind(); foreach (DataGridItem item in grid.Items) { if (item.Cells.Count == 2) { TableCell cell = item.Cells[1]; // change true/false style switch (cell.Text.ToLower()) { case "true": cell.CssClass = "value_true"; break; case "false": cell.CssClass = "value_false"; break; } //// wrap <pre> for text contain newline. //if (cell.Text.IndexOf(Environment.NewLine) >= 0) //{ // cell.Wrap = true; // cell.Text = string.Format("{0}", cell.Text); //} } } HtmlGenericControl title = new HtmlGenericControl("h1"); title.InnerText = _context.Server.HtmlEncode(table.TableName); title.Attributes.Add("class", "title"); HtmlGenericControl div = new HtmlGenericControl("div"); div.Attributes.Add("class", "section"); div.Controls.Add(new HtmlGenericControl("p")); div.Controls.Add(title); div.Controls.Add(grid); div.Controls.Add(new HtmlGenericControl("p")); StringBuilder generatedHtml = new StringBuilder(); HtmlTextWriter htw = new HtmlTextWriter(new StringWriter(generatedHtml)); div.RenderControl(htw); string output = generatedHtml.ToString(); return(output); //divCenter.Controls.Add(div); }
public void LoadData(string customerName, string jobName, string batch, List <FrameRail> rails) { TableRowGroup titleGroup = new TableRowGroup(); titleGroup.Rows.Add(new TableRow()); titleGroup.Rows[0].FontSize = 20; titleGroup.Rows[0].Cells.Add(new TableCell(new Paragraph(new Run("FRAME RAILS")))); TableRowGroup infoGroup = new TableRowGroup(); infoGroup.Rows.Add(new TableRow()); infoGroup.Rows[0].FontSize = 14; TableCell customerCell = new TableCell(); Paragraph customerTitle = new Paragraph(new Run("Customer:")); customerTitle.FontWeight = FontWeights.Bold; Paragraph customerInfo = new Paragraph(new Run(customerName)); Paragraph jobTitle = new Paragraph(new Run("Job Number:")); jobTitle.FontWeight = FontWeights.Bold; Paragraph jobInfo = new Paragraph(new Run(jobName)); Paragraph batchName = new Paragraph(new Run("Batch:")); batchName.FontWeight = FontWeights.Bold; Paragraph batchInfo = new Paragraph(new Run(batch)); infoGroup.Rows[0].Cells.Add(customerCell); infoGroup.Rows[0].Cells.Add(new TableCell(customerTitle)); infoGroup.Rows[0].Cells.Add(new TableCell(customerInfo)); infoGroup.Rows[0].Cells.Add(new TableCell(jobTitle)); infoGroup.Rows[0].Cells.Add(new TableCell(jobInfo)); infoGroup.Rows[0].Cells.Add(new TableCell(batchName)); infoGroup.Rows[0].Cells.Add(new TableCell(batchInfo)); TableRowGroup columnHeaders = new TableRowGroup(); columnHeaders.Rows.Add(new TableRow()); columnHeaders.Rows[0].Cells.Add(new TableCell(new Paragraph(new Run("ID")))); columnHeaders.Rows[0].Cells.Add(new TableCell(new Paragraph(new Run("Width")))); columnHeaders.Rows[0].Cells.Add(new TableCell(new Paragraph(new Run("Thickness")))); columnHeaders.Rows[0].Cells.Add(new TableCell(new Paragraph(new Run("Length")))); columnHeaders.Rows[0].Cells.Add(new TableCell(new Paragraph(new Run("Material")))); columnHeaders.Rows[0].Cells.Add(new TableCell(new Paragraph(new Run("Cope")))); columnHeaders.Rows[0].Cells.Add(new TableCell(new Paragraph(new Run("Type")))); tblRails.RowGroups.Add(titleGroup); tblRails.RowGroups.Add(infoGroup); tblRails.RowGroups.Add(columnHeaders); foreach (var rail in rails) { TableRowGroup columns = new TableRowGroup(); columns.Rows.Add(new TableRow()); columns.Rows[0].Cells.Add(new TableCell(new Paragraph(new Run(rail.Id.ToString())))); columns.Rows[0].Cells.Add(new TableCell(new Paragraph(new Run(rail.RailWidth.ToString())))); columns.Rows[0].Cells.Add(new TableCell(new Paragraph(new Run(rail.RailThickness.ToString())))); columns.Rows[0].Cells.Add(new TableCell(new Paragraph(new Run(rail.RailLength.ToString())))); columns.Rows[0].Cells.Add(new TableCell(new Paragraph(new Run(rail.Material)))); columns.Rows[0].Cells.Add(new TableCell(new Paragraph(new Run(rail.CopeName)))); columns.Rows[0].Cells.Add(new TableCell(new Paragraph(new Run(rail.Type.ToString())))); } }
protected void ButtonSearch_Click(object sender, EventArgs e) { try { if (AccidentFromDate.Text =="" || AccidentToDate.Text == "") { tmpLabel.Text = "<strong>Please enter both From and To dates</strong>"; } else { tmpLabel.Text = ""; myConnection.Close(); myConnection.Open(); decimal TotalClaims = 0; SqlDataReader myReaderCount = null; SqlDataReader myReader = null; CultureInfo provider = new CultureInfo("en-AU"); DateTime AccidentFrom = DateTime.Parse(AccidentFromDate.Text, provider); DateTime AccidentTo = DateTime.Parse(AccidentToDate.Text, provider); String AccidentFromText = AccidentFrom.Month.ToString() + "/" + AccidentFrom.Day.ToString() + "/" + AccidentFrom.Year.ToString(); String AccidentToText = AccidentTo.Month.ToString() + "/" + AccidentTo.Day.ToString() + "/" + AccidentTo.Year.ToString(); SqlCommand myCommand = new SqlCommand("SELECT ND.ClaimantFirstName + ' ' + ND.ClaimantLastName as Claimant,ND.ClaimNumber as NDReferenceNo, ND.AccidentDate as DateofAccident, Ins1.InsurerName as NSWManagingInsurerName, UPPER(VehInv.RegistrationNumber) as RegistrationNo,AUS.State as RegistrationState,Ins2.InsurerName as InterstateCTPInsurerName FROM NDF.dbo.NominalDefendants ND,NDF.dbo.VehiclesInvolved VehInv,NDF.dbo.Insurers Ins1,NDF.dbo.Insurers Ins2,NDF.dbo.AustralianStates AUS WHERE ND.AllocatedInsurerId = Ins1.InsurerId AND ND.ID = VehInv.Ndid AND AUS.ID = VehInv.RegistrationState AND VehInv.InsurerId = Ins2.InsurerId AND VehInv.RegistrationState not in (1, 2) AND VehInv.AtFault = 'True' AND ND.AccidentDate >= '" + AccidentFromText + "' AND ND.AccidentDate <= '" + AccidentToText + "' ORDER BY dateofAccident,Claimant", myConnection); SqlCommand myCommandCount = new SqlCommand("SELECT COUNT(*) as NumberofClaims FROM NDF.dbo.NominalDefendants ND,NDF.dbo.VehiclesInvolved VehInv,NDF.dbo.Insurers Ins1,NDF.dbo.Insurers Ins2,NDF.dbo.AustralianStates AUS WHERE ND.AllocatedInsurerId = Ins1.InsurerId AND ND.ID = VehInv.Ndid AND AUS.ID = VehInv.RegistrationState AND VehInv.InsurerId = Ins2.InsurerId AND VehInv.RegistrationState not in (1, 2) AND VehInv.AtFault = 'True' AND ND.AccidentDate >= '" + AccidentFromText + "' AND ND.AccidentDate <= '" + AccidentToText + "' ", myConnection); myReader = myCommand.ExecuteReader(); myReaderCount = myCommandCount.ExecuteReader(); bool rowCount = myReader.HasRows; if (rowCount) { TestPlaceholder.Controls.Clear(); Label TitleLabel = new Label(); TitleLabel.Text = "<strong> Interstate Claims</strong><br /><br />"; TitleLabel.Text += "Claims Accident between " + AccidentFrom.Day.ToString() + "/" + AccidentFrom.Month.ToString() + "/" + AccidentFrom.Year.ToString() + " and " + AccidentTo.Day.ToString() + "/" + AccidentTo.Month.ToString() + "/" + AccidentTo.Year.ToString() + "<br /><br />"; TestPlaceholder.Controls.Add(TitleLabel); myReaderCount.Read(); TotalClaims = Convert.ToDecimal(myReaderCount["NumberClaims"]); Table table = new Table(); table.CellPadding = 8; table.CellSpacing = 3; TableRow rowTitle = new TableRow(); rowTitle.ID = "RowTitle"; rowTitle.Height = 28; TableCell cell1Title = new TableCell(); // Claimant FirstName TableCell cell2Title = new TableCell(); // Claimant LastName TableCell cell3Title = new TableCell(); // ND Reference Number TableCell cell4Title = new TableCell(); // Date of Accident TableCell cell5Title = new TableCell(); // NSW ManagingInsurerName TableCell cell6Title = new TableCell(); // Registration No TableCell cell7Title = new TableCell(); // Interstate CTP InsurerName Literal cell1TitleText = new Literal(); Literal cell2TitleText = new Literal(); Literal cell3TitleText = new Literal(); Literal cell4TitleText = new Literal(); Literal cell5TitleText = new Literal(); Literal cell6TitleText = new Literal(); Literal cell7TitleText = new Literal(); cell1TitleText.Text = "<strong>Claimant First Name</strong>"; cell1Title.Controls.Add(cell1TitleText); cell1Title.Width = 200; cell1Title.Wrap = false; cell1Title.CssClass = "tableTitle"; rowTitle.Cells.Add(cell1Title); cell2TitleText.Text = "<strong>Claimant Last Name</strong>"; cell2Title.Controls.Add(cell2TitleText); cell2Title.Width = 150; cell2Title.CssClass = "tableTitle"; rowTitle.Cells.Add(cell2Title); cell3TitleText.Text = "<strong>ND Reference Number</strong>"; cell3Title.Controls.Add(cell3TitleText); cell3Title.Width = 150; cell3Title.CssClass = "tableTitle"; rowTitle.Cells.Add(cell3Title); cell4TitleText.Text = "<strong>Date of Accident</strong>"; cell4Title.Controls.Add(cell4TitleText); cell4Title.Width = 150; cell4Title.CssClass = "tableTitle"; rowTitle.Cells.Add(cell4Title); cell5TitleText.Text = "<strong>NSW ManagingInsurerName</strong>"; cell5Title.Controls.Add(cell5TitleText); cell5Title.Width = 150; cell5Title.CssClass = "tableTitle"; rowTitle.Cells.Add(cell5Title); cell6TitleText.Text = "<strong>Registration No</strong>"; cell6Title.Controls.Add(cell6TitleText); cell6Title.Width = 150; cell6Title.CssClass = "tableTitle"; rowTitle.Cells.Add(cell6Title); cell7TitleText.Text = "<strong>Interstate CTP InsurerName</strong>"; cell7Title.Controls.Add(cell6TitleText); cell7Title.Width = 150; cell7Title.CssClass = "tableTitle"; rowTitle.Cells.Add(cell7Title); table.Rows.Add(rowTitle); while (myReader.Read()) { // This is the display row. TableRow rowDisp = new TableRow(); rowDisp.ID = "rowDisp"; rowDisp.Height = 28; TableCell cell1Disp = new TableCell(); TableCell cell2Disp = new TableCell(); TableCell cell3Disp = new TableCell(); TableCell cell4Disp = new TableCell(); TableCell cell5Disp = new TableCell(); TableCell cell6Disp = new TableCell(); TableCell cell7Disp = new TableCell(); Literal cell1DispText = new Literal(); cell1DispText.Text = myReader["ClaimantFirstName"].ToString(); cell1Disp.Style.Value = "text-transform:uppercase"; cell1Disp.Controls.Add(cell1DispText); cell1Disp.CssClass = "tableField"; rowDisp.Cells.Add(cell1Disp); Literal cell2DispText = new Literal(); cell2DispText.Text = myReader["ClaimantLastName"].ToString(); cell2Disp.Controls.Add(cell2DispText); cell2Disp.CssClass = "tableField"; rowDisp.Cells.Add(cell2Disp); Literal cell3DispText = new Literal(); cell3DispText.Text = myReader["NDReferenceNo"].ToString(); cell3Disp.Controls.Add(cell3DispText); cell3Disp.CssClass = "tableField"; rowDisp.Cells.Add(cell3Disp); Literal cell4DispText = new Literal(); cell4DispText.Text = myReader["DateofAccident"].ToString(); cell4Disp.Controls.Add(cell4DispText); cell4Disp.CssClass = "tableField"; rowDisp.Cells.Add(cell4Disp); Literal cell5DispText = new Literal(); cell5DispText.Text = myReader["NSWManagingInsurerName"].ToString(); cell5Disp.Controls.Add(cell5DispText); cell5Disp.CssClass = "tableField"; rowDisp.Cells.Add(cell5Disp); Literal cell6DispText = new Literal(); cell6DispText.Text = myReader["RegistrationNo"].ToString(); cell6Disp.Controls.Add(cell6DispText); cell6Disp.CssClass = "tableField"; rowDisp.Cells.Add(cell6Disp); Literal cell7DispText = new Literal(); cell7DispText.Text = myReader["RegistrationNo"].ToString(); cell7Disp.Controls.Add(cell7DispText); cell7Disp.CssClass = "tableField"; rowDisp.Cells.Add(cell7Disp); table.Rows.Add(rowDisp); } TableRow rowTotal = new TableRow(); rowTotal.ID = "RowTotal"; rowTotal.Height = 28; TableCell cell1Total = new TableCell(); TableCell cell2Total = new TableCell(); TableCell cell3Total = new TableCell(); TableCell cell4Total = new TableCell(); TableCell cell5Total = new TableCell(); TableCell cell6Total = new TableCell(); TableCell cell7Total = new TableCell(); Literal cell1TotalText = new Literal(); Literal cell2TotalText = new Literal(); Literal cell3TotalText = new Literal(); Literal cell4TotalText = new Literal(); Literal cell5TotalText = new Literal(); Literal cell6TotalText = new Literal(); Literal cell7TotalText = new Literal(); cell1TotalText.Text = "<strong>Totals for Period</strong>"; cell1Total.Controls.Add(cell1TotalText); cell1Total.Width = 200; cell1Total.Wrap = false; cell1Total.CssClass = "tableTitle"; rowTotal.Cells.Add(cell1Total); cell2TotalText.Text = TotalClaims.ToString(); cell2Total.Controls.Add(cell2TotalText); cell2Total.Width = 150; cell2Total.CssClass = "tableTitle"; rowTotal.Cells.Add(cell2Total); cell3TotalText.Text = " "; cell3Total.Controls.Add(cell3TotalText); cell3Total.Width = 150; cell3Total.CssClass = "tableTitle"; rowTotal.Cells.Add(cell3Total); cell4TotalText.Text = " "; cell4Total.Controls.Add(cell4TotalText); cell4Total.Width = 150; cell4Total.CssClass = "tableTitle"; rowTotal.Cells.Add(cell4Total); cell5TotalText.Text = " "; cell5Total.Controls.Add(cell5TotalText); cell5Total.Width = 150; cell5Total.CssClass = "tableTitle"; rowTotal.Cells.Add(cell5Total); cell6TotalText.Text = " "; cell6Total.Controls.Add(cell6TotalText); cell6Total.Width = 150; cell6Total.CssClass = "tableTitle"; rowTotal.Cells.Add(cell6Total); cell7TotalText.Text = " "; cell7Total.Controls.Add(cell7TotalText); cell7Total.Width = 150; cell7Total.CssClass = "tableTitle"; rowTotal.Cells.Add(cell7Total); table.Rows.Add(rowTotal); TestPlaceholder.Controls.Add(table); } myReaderCount.Close(); myReader.Close(); myConnection.Close(); } } catch (Exception ex) { Resources.errorHandling(ex); } }
List <Contact> _contacts = new List <Contact>(); //We need have a list of type Contact so we can reference it for editing and deleting. protected void Page_Load(object sender, EventArgs e) { if (Session["username"] == null || Session["password"] == null) { /*oAuth 2.0 Legacy * code = Request.QueryString["code"]; //extract oAUTH code from the URL that google has provided us * accessToken = getToken(); * Session["accessToken"] = accessToken; //Save access token for all future interactions with google for this session. * emailInfo.Text = "New Access Token: " + accessToken; */ //Redirect the user to the login page if these variables are not set Response.Redirect("http://localhost:1172/Default.aspx"); } else { /*oAuth 2.0 Legacy * accessToken = (String)Session["accessToken"]; * emailInfo.Text = "Same Session Token: " + accessToken; */ } //Extract the contacts from the address book. RequestSettings settings = new RequestSettings("ProQuorum Messaging Module", (String)Session["username"], (String)Session["password"]); //Setting autopaging to true means all of the contacts will be extracted instead of a portion. settings.AutoPaging = true; ContactsRequest cr = new ContactsRequest(settings); Feed <Contact> f = cr.GetContacts(); //Input all names into a list, which will be used as the data source for the ListBox. foreach (Contact entry in f.Entries) { _contacts.Add(entry); if (entry.Name != null) { Name name = entry.Name; if (!string.IsNullOrEmpty(name.FullName)) { _contactNames.Add(name.FullName); } else { _contactNames.Add("No full name found."); } } else { _contactNames.Add("No name found."); } /* * foreach (EMail email in entry.Emails) * { * _emails.Add(email.Address); * }*/ } //Sort both the lists of contacts in alphabetical order _contactNames.Sort(); _contacts = _contacts.OrderBy(o => o.Name.FullName).ToList(); //Set the title label on top of the address book to the number of contacts. title.Text = "Contact List (" + _contacts.Count.ToString() + " entries)"; if (!Page.IsPostBack) //this needs to be checked so that the listbox can read what index the user is selecting. { ContactsListBox.DataSource = _contactNames; ContactsListBox.DataBind(); } //Populate the inbox with the emails try { tcpc = new System.Net.Sockets.TcpClient("imap.gmail.com", 993); ssl = new System.Net.Security.SslStream(tcpc.GetStream()); ssl.AuthenticateAsClient("imap.gmail.com"); receiveResponse(""); //IMAP login command string googleResponse = receiveResponse("$ LOGIN " + (String)Session["username"] + " " + (String)Session["password"] + " \r\n"); System.Diagnostics.Debug.WriteLine(googleResponse + " |LOGIN END|"); //This command lists the folders (inbox,sentmail,users labels ) //receiveResponse("$ LIST " + "\"\"" + " \"*\"" + "\r\n"); //Select the inbox folder googleResponse = receiveResponse("$ SELECT INBOX\r\n"); System.Diagnostics.Debug.WriteLine(googleResponse + " |SELECT INBOX END|"); //Get the status of the inbox. Response includes the number of messages. googleResponse = receiveResponse("$ STATUS INBOX (MESSAGES)\r\n"); System.Diagnostics.Debug.WriteLine(googleResponse + " |STATUS INBOX END|"); //Use String.Split to extract the number of emails and parses. string[] stringSeparators = new string[] { "(MESSAGES", ")" }; string[] words = googleResponse.ToString().Split(stringSeparators, StringSplitOptions.None); try{ numEmails = int.Parse(words[1]); } catch { MessageBox.Show("Error parsing number of emails."); } //Extract all emails and organize them into the table. if (numEmails > 0) { for (int i = numEmails; i >= 1; i--) { TableRow r = new TableRow(); //Highlight when cursor is over the message. r.Attributes["onmouseover"] = "highlight(this, true);"; //Remove the highlight when the curser exits the message r.Attributes["onmouseout"] = "highlight(this, false);"; r.Attributes["style"] = "cursor:pointer;"; r.Attributes["onclick"] = "link(this, false);"; r.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF"); //The first cell in the row will be a checkbox TableCell c0 = new TableCell(); c0.HorizontalAlign = HorizontalAlign.Center; System.Web.UI.WebControls.CheckBox checkBox = new System.Web.UI.WebControls.CheckBox(); //Add the js function to the checkbox that will highlight the row when checked and unhighlight when unchecked. checkBox.Attributes.Add("onclick", "javascript:colorRow(this);"); c0.Controls.Add(checkBox); r.Cells.Add(c0); //Specifc email number to fetch. googleResponse = receiveResponse("$ FETCH " + i + " body[HEADER.FIELDS (DATE FROM SUBJECT)]\r\n"); while (!googleResponse.Contains("$ OK Success")) { googleResponse += receiveResponse(""); } System.Diagnostics.Debug.WriteLine(googleResponse + " |HEADER " + i + " END|"); string[] orderedHeaders = organizeHeaders(googleResponse); //The second cell will be who the message is from (email) TableCell c1 = new TableCell(); //c1.Controls.Add(new LiteralControl(headers[3])); c1.Controls.Add(new LiteralControl(orderedHeaders[0])); r.Cells.Add(c1); //The third cell will be the subject. TableCell c2 = new TableCell(); c2.Controls.Add(new LiteralControl(orderedHeaders[1])); r.Cells.Add(c2); //The fourth cell will be the Date. TableCell c3 = new TableCell(); //Parse the date into a more readable format string[] ss = new string[] { " " }; string[] dateSplit = orderedHeaders[2].Split(ss, StringSplitOptions.None); DateTime time = Convert.ToDateTime(dateSplit[5]); c3.Controls.Add(new LiteralControl(dateSplit[1] + " " + dateSplit[2] + " " + dateSplit[3] + " " + dateSplit[4] + " " + time.ToShortTimeString())); r.Cells.Add(c3); googleResponse = receiveResponse("$ FETCH " + i + " body[text]\r\n"); System.Threading.Thread.Sleep(1000); googleResponse += receiveResponse(""); System.Diagnostics.Debug.WriteLine(googleResponse + " |MESSAGE " + i + " END|"); //Remove the beginning metadata int beginningDataIndex = googleResponse.IndexOf("}"); if (beginningDataIndex != -1) { googleResponse = googleResponse.Remove(0, beginningDataIndex + 1); } googleResponse = googleResponse.Trim(); //Remove the ") $ OK Success" at the end of the header int index = googleResponse.LastIndexOf(")"); if (index > -1) { googleResponse = googleResponse.Remove(index); } //Add a hidden cell so the javascript can access the message and put it in a modal when clicked on. TableCell c4 = new TableCell(); //c4.Controls.Add(new LiteralControl(emailBody[1])); c4.Controls.Add(new LiteralControl(googleResponse.ToString())); r.Cells.Add(c4); c4.Attributes.Add("hidden", "true"); InboxTable.Rows.Add(r); } } else { TableRow r = new TableRow(); TableCell c1 = new TableCell(); c1.Controls.Add(new LiteralControl("No Messages")); r.Cells.Add(c1); InboxTable.Rows.Add(r); } receiveResponse("$ LOGOUT\r\n"); } catch (Exception ex) { MessageBox.Show("error fetching emails: " + ex.Message); } finally { if (ssl != null) { ssl.Close(); ssl.Dispose(); } if (tcpc != null) { tcpc.Close(); } } }
/// <summary> /// Genera la tabella per la scelta dei numeri da giocare /// </summary> public void GeneraTabellaNumeri() { for (int i = 0; i <= 8; i++) { TableCell tc1 = new TableCell(); TableCell tc2 = new TableCell(); TableCell tc3 = new TableCell(); TableCell tc4 = new TableCell(); TableCell tc5 = new TableCell(); TableCell tc6 = new TableCell(); TableCell tc7 = new TableCell(); TableCell tc8 = new TableCell(); TableCell tc9 = new TableCell(); TableCell tc10 = new TableCell(); Button bt1 = new Button(); Button bt2 = new Button(); Button bt3 = new Button(); Button bt4 = new Button(); Button bt5 = new Button(); Button bt6 = new Button(); Button bt7 = new Button(); Button bt8 = new Button(); Button bt9 = new Button(); Button bt10 = new Button(); bt1.CssClass = "btn btn-outline-dark";/* d-flex justify-content-center*/ bt2.CssClass = "btn btn-outline-dark"; bt3.CssClass = "btn btn-outline-dark"; bt4.CssClass = "btn btn-outline-dark"; bt5.CssClass = "btn btn-outline-dark"; bt6.CssClass = "btn btn-outline-dark"; bt7.CssClass = "btn btn-outline-dark"; bt8.CssClass = "btn btn-outline-dark"; bt9.CssClass = "btn btn-outline-dark"; bt10.CssClass = "btn btn-outline-dark"; int numeroVariabile = i * 10; bt1.Text = Convert.ToString(1 + numeroVariabile); bt2.Text = Convert.ToString(2 + numeroVariabile); bt3.Text = Convert.ToString(3 + numeroVariabile); bt4.Text = Convert.ToString(4 + numeroVariabile); bt5.Text = Convert.ToString(5 + numeroVariabile); bt6.Text = Convert.ToString(6 + numeroVariabile); bt7.Text = Convert.ToString(7 + numeroVariabile); bt8.Text = Convert.ToString(8 + numeroVariabile); bt9.Text = Convert.ToString(9 + numeroVariabile); bt10.Text = Convert.ToString(10 + numeroVariabile); bt1.ID = bt1.Text; bt2.ID = bt2.Text; bt3.ID = bt3.Text; bt4.ID = bt4.Text; bt5.ID = bt5.Text; bt6.ID = bt6.Text; bt7.ID = bt7.Text; bt8.ID = bt8.Text; bt9.ID = bt9.Text; bt10.ID = bt10.Text; bt1.Click += new EventHandler(GiocaNumero); bt2.Click += new EventHandler(GiocaNumero); bt3.Click += new EventHandler(GiocaNumero); bt4.Click += new EventHandler(GiocaNumero); bt5.Click += new EventHandler(GiocaNumero); bt6.Click += new EventHandler(GiocaNumero); bt7.Click += new EventHandler(GiocaNumero); bt8.Click += new EventHandler(GiocaNumero); bt9.Click += new EventHandler(GiocaNumero); bt10.Click += new EventHandler(GiocaNumero); tc1.Controls.Add(bt1); tc2.Controls.Add(bt2); tc3.Controls.Add(bt3); tc4.Controls.Add(bt4); tc5.Controls.Add(bt5); tc6.Controls.Add(bt6); tc7.Controls.Add(bt7); tc8.Controls.Add(bt8); tc9.Controls.Add(bt9); tc10.Controls.Add(bt10); TableRow tr = new TableRow(); tr.Cells.Add(tc1); tr.Cells.Add(tc2); tr.Cells.Add(tc3); tr.Cells.Add(tc4); tr.Cells.Add(tc5); tr.Cells.Add(tc6); tr.Cells.Add(tc7); tr.Cells.Add(tc8); tr.Cells.Add(tc9); tr.Cells.Add(tc10); TBLnumeri.Rows.Add(tr); } }
protected void ImageButton9_Click(object sender, ImageClickEventArgs e) { int cnt = 0; Panel1.Visible = true; // 자신 PC의 SQLEXPRESS를 DB서버로 지정하고 사용 데이터베이스는 VS2015??? 로 지정 string connectionString = "server=(local)\\SQLExpress;Integrated Security=true;database=sqlexpress2"; SqlConnection conn = new SqlConnection(connectionString); // SQL COMMAND OBJECT를 만들고 SQL COMMAND 넣기 SqlCommand Cmd = new SqlCommand(); Cmd.Connection = conn; Cmd.CommandText = "select * from user_db";//얘뺴곤 항상 다 똑같음 // SQL COMMAND 수행하기 conn.Open(); // ExecuteNonQuery()문은 CREATE, ALTER, DROP, INSERT, UPDATE, DELETE 문을 수행할때 사용 // 리턴 값은 영향을 받은 ROW의 갯수 SqlDataReader reader = Cmd.ExecuteReader(); while (reader.Read()) { if (cnt == 0) { TableRow r = new TableRow(); // 필드( name ) 값 추출하여 테이블 cell에 넣기 TableCell c1 = new TableCell(); c1.Controls.Add(new LiteralControl("name")); r.Cells.Add(c1); // 필드( id ) 값 추출하여 테이블 cell에 넣기 TableCell c2 = new TableCell(); c2.Controls.Add(new LiteralControl("id")); r.Cells.Add(c2); // 필드( email ) 값 추출하여 테이블 cell에 넣기 TableCell c3 = new TableCell(); c3.Controls.Add(new LiteralControl("email")); r.Cells.Add(c3); // 필드( sex ) 값 추출하여 테이블 cell에 넣기 TableCell c4 = new TableCell(); c4.Controls.Add(new LiteralControl("sex")); r.Cells.Add(c4); // 필드( level ) 값 추출하여 테이블 cell에 넣기 TableCell c5 = new TableCell(); c5.Controls.Add(new LiteralControl("situ")); r.Cells.Add(c5); // 필드( mileage ) 값 추출하여 테이블 cell에 넣기 TableCell c6 = new TableCell(); c6.Controls.Add(new LiteralControl("cm")); r.Cells.Add(c6); TableCell c7 = new TableCell(); c7.Controls.Add(new LiteralControl("kg")); r.Cells.Add(c7); TableCell c8 = new TableCell(); c8.Controls.Add(new LiteralControl("goalkg")); r.Cells.Add(c8); Table1.Rows.Add(r); } if (cnt >= 0) { TableRow r = new TableRow(); // 필드( name ) 값 추출하여 테이블 cell에 넣기 TableCell c1 = new TableCell(); c1.Controls.Add(new LiteralControl(reader["name"].ToString())); r.Cells.Add(c1); // 필드( id ) 값 추출하여 테이블 cell에 넣기 TableCell c2 = new TableCell(); c2.Controls.Add(new LiteralControl(reader["id"].ToString())); r.Cells.Add(c2); // 필드( email ) 값 추출하여 테이블 cell에 넣기 TableCell c3 = new TableCell(); c3.Controls.Add(new LiteralControl(reader["email"].ToString())); r.Cells.Add(c3); // 필드( sex ) 값 추출하여 테이블 cell에 넣기 TableCell c4 = new TableCell(); c4.Controls.Add(new LiteralControl(reader["sex"].ToString())); r.Cells.Add(c4); // 필드( level ) 값 추출하여 테이블 cell에 넣기 TableCell c5 = new TableCell(); c5.Controls.Add(new LiteralControl(reader["situ"].ToString())); r.Cells.Add(c5); // 필드( mileage ) 값 추출하여 테이블 cell에 넣기 TableCell c6 = new TableCell(); c6.Controls.Add(new LiteralControl(reader["cm"].ToString())); r.Cells.Add(c6); TableCell c7 = new TableCell(); c7.Controls.Add(new LiteralControl(reader["kg"].ToString())); r.Cells.Add(c7); TableCell c8 = new TableCell(); c8.Controls.Add(new LiteralControl(reader["goalkg"].ToString())); r.Cells.Add(c8); Table1.Rows.Add(r); } cnt++; } conn.Close(); }
protected void grdDetails_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { GridView HeaderGrid = (GridView)sender; GridViewRow HeaderGridRow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert); HeaderGridRow.BackColor = System.Drawing.ColorTranslator.FromHtml("#DBDACE"); HeaderGridRow.ForeColor = System.Drawing.Color.Black; TableCell HeaderCell = new TableCell(); HeaderCell = new TableCell(); HeaderCell.Text = "Edit"; HeaderCell.Font.Name = " Verdana"; HeaderCell.BorderColor = System.Drawing.ColorTranslator.FromHtml("#000000"); //HeaderCell.Font.Bold = true; HeaderCell.ColumnSpan = 1; HeaderGridRow.Cells.Add(HeaderCell); HeaderCell = new TableCell(); HeaderCell.Text = "SL"; HeaderCell.Font.Name = " Verdana"; HeaderCell.BorderColor = System.Drawing.ColorTranslator.FromHtml("#000000"); HeaderCell.Font.Bold = true; //HeaderCell.ColumnSpan = 2; HeaderGridRow.Cells.Add(HeaderCell); HeaderCell.Visible = false; HeaderCell = new TableCell(); HeaderCell.Text = "Comp. Id"; HeaderCell.Font.Name = " Verdana"; HeaderCell.BorderColor = System.Drawing.ColorTranslator.FromHtml("#000000"); HeaderCell.Font.Bold = true; //HeaderCell.ColumnSpan = 2; HeaderGridRow.Cells.Add(HeaderCell); //HeaderCell.Visible = false; HeaderCell = new TableCell(); HeaderCell.Text = "Comp. Name"; HeaderCell.Font.Name = " Verdana"; //HeaderCell.Font.Size = 15; HeaderCell.BorderColor = System.Drawing.ColorTranslator.FromHtml("#000000"); HeaderCell.Font.Bold = true; //HeaderCell.ColumnSpan = 2; HeaderGridRow.Cells.Add(HeaderCell); HeaderCell = new TableCell(); HeaderCell.Text = "GL Head"; HeaderCell.Font.Name = " Verdana"; //HeaderCell.Font.Size = 15; HeaderCell.BorderColor = System.Drawing.ColorTranslator.FromHtml("#000000"); HeaderCell.Font.Bold = true; //HeaderCell.ColumnSpan = 2; HeaderGridRow.Cells.Add(HeaderCell); HeaderCell = new TableCell(); HeaderCell.Text = "GL DEsc."; HeaderCell.Font.Name = " Verdana"; //HeaderCell.Font.Size = 15; HeaderCell.BorderColor = System.Drawing.ColorTranslator.FromHtml("#000000"); HeaderCell.Font.Bold = true; //HeaderCell.ColumnSpan = 2; HeaderGridRow.Cells.Add(HeaderCell); grdDetails.Controls[0].Controls.AddAt (0, HeaderGridRow); } }
//Fonction qui construit le tableau contenant les jeux de la base de données. public void ConstruireTable(Table table, OleDbDataReader reader) { TableRow headerRow = new TableRow(); TableHeaderCell cell = null; //extraction des champs pour créer l'entete for (int champ = 1; champ < reader.FieldCount; champ++) { cell = new TableHeaderCell(); //On récupère le nom des champs ici cell.Text = reader.GetName(champ); //et ils deviennent le texte de nos entêtes headerRow.Cells.Add(cell); } //ajout d'une colonne qui ne vient pas de la base de données ! cell = new TableHeaderCell(); cell.Text = "detail"; headerRow.Cells.Add(cell); //On ajoute la ligne des entêtes dans la table table.Rows.Add(headerRow); //extraction des enregistrements, on boucle le reader while (reader.Read()) { TableRow row = new TableRow(); TableCell tableCell = null; //Attention, on ne se rendra pas jusqu'au bout car la dernière entete ne provient pas de la BD !!! int numColumns = headerRow.Cells.Count - 1; //on se sert des noms de nos entetes comme clé pour récupérer nos enregistrements, encore une fois en ignorant la dernière qui a été créée manuellement ! for (int i = 0; i < numColumns; i++) { tableCell = new TableCell(); //on se sert du nom de l'entête ici comme clé tableCell.Text = reader[headerRow.Cells[i].Text].ToString(); row.Cells.Add(tableCell); } if (cell.Text == "ps4.jpg") { Image myImage = new Image(); myImage.ImageUrl = "ps4.png"; } //On popule la dernière colonne en créant un hyperlien qui enverra le id en GET HyperLink link = new HyperLink(); //La valeur du id se trouve dans la première cellule de la rangée courante, d'où le [0] pour aller le chercher link.NavigateUrl = "DetailJeu.aspx?codeJeu=" + reader[0].ToString(); link.Text = "Voir les détails"; //L'hyperlien étant un contrôle, on l'ajoute dans la cellule tableCell = new TableCell(); tableCell.Controls.Add(link); row.Cells.Add(tableCell); //Et on ajoute notre ligne dans la table, on recommencera ce traitement pour tous les enregistrements table.Rows.Add(row); } }