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); } } }
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); } }
/// <summary> /// Select a field and add it as a filter field uing the provided criteria. /// </summary> /// <param name="fieldCaption">The field to add.</param> /// <param name="criteria">Mapping of the unique field ids to their desired values for the criteria dialog.</param> public static void AddFilterField(string fieldCaption, TableRow criteria) { OpenTab("Select filter and output fields"); WaitClick(getXField(fieldCaption)); WaitClick(getXIncludeRecordButton); ApplyCriteria(criteria); }
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>")); }
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); }
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 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); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); ScrollView scrollView = new ScrollView(this); TableLayout tableLayout = new TableLayout(this); TableRow tablerow = new TableRow(this); // make columns span the whole width tableLayout.SetColumnStretchable(0, true); tableLayout.SetColumnStretchable(1, true); TextView DepartCollumn = new TextView(this); DepartCollumn.Text = "Depart"; tablerow.AddView(DepartCollumn); TimetableList.TimeColumns.Add(DepartCollumn); TextView ArriveCollumn = new TextView(this); ArriveCollumn.Text = "Arrive"; tablerow.AddView(ArriveCollumn); TimetableList.TimeColumns.Add(ArriveCollumn); tableLayout.AddView(tablerow); // tableLayout.SetScrollContainer(true); scrollView.AddView(tableLayout); SetContentView(scrollView); }
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); } } }
private void MergeToTable(PropertyInfo[] properties) { var mergeTableRows = new TableRow[data.TransitStateDetails.Count]; // Find both the first row in the multiple producers table and the table itself. var firstMergeFieldInTable = FindFirstMergeFieldInAnnexTable(); var table = FindAnnexTable(firstMergeFieldInTable); // Get the table row containing the merge fields. mergeTableRows[0] = firstMergeFieldInTable.Run.Ancestors<TableRow>().First(); // Create a row containing merge fields for each of the producers. for (var i = 1; i < data.TransitStateDetails.Count; i++) { mergeTableRows[i] = (TableRow)mergeTableRows[0].CloneNode(true); table.AppendChild(mergeTableRows[i]); } // Merge the producers into the table rows. for (var i = 0; i < mergeTableRows.Length; i++) { foreach (var field in MergeFieldLocator.GetMergeRuns(mergeTableRows[i])) { MergeFieldDataMapper.BindCorrespondingField( MergeFieldLocator.ConvertAnnexMergeFieldToRegularMergeField(field), data.TransitStateDetails[i], properties); } } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //set view SetContentView(Resource.Layout.SelectView); TextView Lab_RowTitle = FindViewById<TextView>(Resource.Id.Lab_RowTitle); Lab_RowTitle.Text = "城市"; //get Data // 得到跳转到该Activity的Intent对象 Bundle bundle = Intent.GetBundleExtra("bundle"); List<string> citylist = bundle.GetStringArrayList("citylist").ToList(); //Create your application here TableLayout MainTable = FindViewById<TableLayout>(Resource.Id.table_city); Button b; TableRow tr; for (int i = 0; i < citylist.Count; i++) { tr = new TableRow(this); b = new Button(this); //string cityname = citylist[i].Substring(1, citylist[i].Length - 2); string cityname = citylist[i]; b.Text = cityname; b.Click+= delegate { CreatNewSelect(cityname); }; tr.AddView(b); MainTable.AddView(tr); } }
public static TableRow AddRow(int countColumns) { var TR = new TableRow(); for (int i = 0; i < countColumns; i++) TR.Append(OXMLTableCellWrap.AddCell(new OXMLParagraphWrap())); return TR; }
public PrintScriiption(Visit visit) { InitializeComponent(); SystemSettings setting = DataLayer.GetSystemSettings(); clinicName.Text = setting.CilinicName; if (setting.ClinicImage != null) { MemoryStream ms = new MemoryStream(); setting.ClinicImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png); ms.Position = 0; BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.StreamSource = ms; bi.EndInit(); clinicLogo.Source = bi; } patientName.Text = visit.Patient.ToString(); visitDate.Text = visit.PersianDate; address.Text = setting.CilinicAddress; phoneNumber.Text = setting.CilinicPhone; int i = 1; foreach(VisitDrug visDrug in visit.VisitDrugs) { TableRow row = new TableRow(); row.Cells.Add(new TableCell(new Paragraph(new Run(i+++"")))); row.Cells.Add(new TableCell(new Paragraph(new Run(visDrug.Drug.Title)))); row.Cells.Add(new TableCell(new Paragraph(new Run(visDrug.CustomManual)))); drugTable.Rows.Add(row); } DoctorCode.Text = visit.Doctor.DoctorCode; DoctorName.Text = visit.Doctor.ToString(); }
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()); } }
internal DocxDocumentTableSchemeBuilder(WordprocessingDocument document, TableProperties contextTableProperties) : base(document) { table = new Table(); if (contextTableProperties == null) { var borderType = new EnumValue<BorderValues>(BorderValues.Thick); var tblProp = new TableProperties( new TableBorders( new TopBorder {Val = borderType, Size = 1}, new BottomBorder {Val = borderType, Size = 1}, new LeftBorder {Val = borderType, Size = 1}, new RightBorder {Val = borderType, Size = 1}, new InsideHorizontalBorder {Val = borderType, Size = 1}, new InsideVerticalBorder {Val = borderType, Size = 1} ) ); table.AppendChild(tblProp); } else table.AppendChild(contextTableProperties); headerRow = new TableRow(); table.AppendChild(headerRow); Aggregation.Add(table); }
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); } }
internal static void Read(PEReader buff, TableRow[] fMarshal) { Contract.Requires(buff != null); Contract.Requires(fMarshal != null); for (int i = 0; i < fMarshal.Length; i++) fMarshal[i] = new FieldMarshal(buff); }
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); } }
private void MergeCarriersTable() { var mergeTableRows = new TableRow[data.CarrierDetails.Count]; var properties = PropertyHelper.GetPropertiesForViewModel(typeof(MovementCarrierDetails)); // Find both the first row in the multiple carriers table and the table itself. var firstMergeFieldInTable = FindFirstMergeFieldInAnnexTable(); var table = FindMultipleCarriersTable(firstMergeFieldInTable); // Get the table row containing the merge fields. mergeTableRows[0] = firstMergeFieldInTable.Run.Ancestors<TableRow>().First(); // Create a row containing merge fields for each of the Carriers. for (var i = 1; i < data.CarrierDetails.Count; i++) { mergeTableRows[i] = (TableRow)mergeTableRows[0].CloneNode(true); table.AppendChild(mergeTableRows[i]); } // Merge the carriers into the table rows. for (var i = 0; i < mergeTableRows.Length; i++) { foreach (var field in MergeFieldLocator.GetMergeRuns(mergeTableRows[i])) { MergeFieldDataMapper.BindCorrespondingField( MergeFieldLocator.ConvertAnnexMergeFieldToRegularMergeField(field), data.CarrierDetails[i], properties); } } }
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; }
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; }
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 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; }
protected void Page_Load (object sender, EventArgs e) { if (!IsPostBack) { string action = Request ["action"]; int lane_id; if (!string.IsNullOrEmpty (action)) { switch (action) { case "clone": if (!int.TryParse (Request ["lane_id"], out lane_id)) break; if (string.IsNullOrEmpty (Request ["lane"])) break; try { int tmp; tmp = Utils.LocalWebService.CloneLane (Master.WebServiceLogin, lane_id, Request ["lane"], false); Response.Redirect ("EditLane.aspx?lane_id=" + tmp.ToString (), false); return; } catch (Exception ex) { lblMessage.Text = Utils.FormatException (ex); } break; case "remove": if (!int.TryParse (Request ["lane_id"], out lane_id)) break; Response.Redirect ("Delete.aspx?action=delete-lane&lane_id=" + lane_id.ToString (), false); return; case "add": try { Utils.LocalWebService.AddLane (Master.WebServiceLogin, Request ["lane"]); Response.Redirect ("EditLanes.aspx", false); return; } catch (Exception ex) { lblMessage.Text = Utils.FormatException (ex); } break; default: // do nothing break; } } } else if (!string.IsNullOrEmpty (Request ["txtLane"])) { Utils.LocalWebService.AddLane (Master.WebServiceLogin, Request ["txtlane"]); Response.Redirect ("EditLanes.aspx", false); return; } GetLanesResponse response = Utils.LocalWebService.GetLanes (Master.WebServiceLogin); TableRow row; foreach (DBLane lane in response.Lanes) { row = new TableRow (); row.CssClass = lane.enabled ? "lane-enabled" : "lane-disabled"; row.Cells.Add (Utils.CreateTableCell (string.Format ("<a href='EditLane.aspx?lane_id={0}'>{1}</a>", lane.id, lane.lane))); row.Cells.Add (Utils.CreateTableCell ( string.Format ("<a href='EditLanes.aspx?lane_id={0}&action=remove'>Delete</a> ", lane.id) + string.Format ("<a href='javascript:cloneLane ({0}, \"{1}\");'>Clone</a>", lane.id, lane.lane))); tblLanes.Rows.Add (row); } }
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")+" ریال")); }
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); }
/// <summary> /// Delete a marketing acknowledgement template. /// </summary> /// <param name="template">Mapping of the column captions to a single row's values.</param> public static void DeleteTemplate(TableRow template) { SelectTab("Templates"); SelectSectionDatalistRow(template, "Acknowledgement templates"); WaitClick(getXSelectedDatalistRowButton("Delete")); Dialog.Yes(); }
public CursorSection() { var layout = new TableLayout(); layout.Spacing = new Size(20, 20); TableRow row; layout.Rows.Add(row = new TableRow()); foreach (var type in Enum.GetValues(typeof(CursorType)).OfType<CursorType?>()) { var label = new Label { Size = new Size(100, 50), Text = type.ToString(), VerticalAlignment = VerticalAlignment.Center, TextAlignment = TextAlignment.Center, BackgroundColor = Colors.Silver }; if (type == null) label.Cursor = null; else label.Cursor = new Cursor(type.Value); row.Cells.Add(label); if (row.Cells.Count > 3) layout.Rows.Add(row = new TableRow()); } Content = TableLayout.AutoSized(layout, centered: true); }
/// <summary> /// Add a receipt process. /// </summary> /// <param name="receipt">Mapping of the field captions to their desired values.</param> public static void AddReceipt(TableRow receipt) { SelectTab("Receipts"); ClickSectionAddButton("Receipt processes"); foreach (string caption in receipt.Keys) { if (receipt[caption] == null) continue; string value = receipt[caption]; switch (caption) { case "Name": SetTextField(Dialog.getXInput("ReceiptingProcessAddForm3", "_NAME_value"), value); break; case "Output format": Dialog.SetDropDown(Dialog.getXInput("ReceiptingProcessAddForm3", "_BUSINESSPROCESSVIEWID_value"), value); break; case "Mark revenue 'Receipted' when process completes": SetCheckbox(Dialog.getXInput("ReceiptingProcessAddForm3", "_MARKRECEIPTED_value"), value); break; default: throw new NotImplementedException(String.Format("Field '{0}' is not implemented for a receipt process dialog.", caption)); } } Dialog.Save(); }
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); } }
protected void Page_Load(object sender, EventArgs e) { //code = Session["CourseElectiveCode"].ToString(); //facId = Session["FacultyCode"].ToString(); code = Request.QueryString["CourseElectiveCode"]; facId = Request.QueryString["FacultyCode"]; facCreated = Request.QueryString["FacultyCreated"]; lbl1.Text = "รหัสวิชา (" + code + ")"; lbl2.Text = new Faculty().getFaculty(facCreated).Faculty_Thai; if (!Page.IsPostBack) { List <FacultyData> faculty = new Faculty().getFaculty(); ddlCURR_FACULTY.Items.Clear(); ddlCURR_FACULTY.Items.Insert(ddlCURR_FACULTY.Items.Count, new ListItem("--- เลือกคณะ ---", "00")); foreach (FacultyData row in faculty) { ddlCURR_FACULTY.Items.Insert(ddlCURR_FACULTY.Items.Count, new ListItem(row.Faculty_Thai, row.Faculty_Code)); } //ddlCURR_FACULTY.Items.FindByValue(facId).Selected = true; // Head Table string[] ar = { "เลือก", "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต", "วิชาของคณะ" }; tblCourse.Attributes.Add("class", "table table-bordered table-striped table-hover"); tblCourse.Attributes.Add("id", "dt_basic"); TableHeaderRow tRowHead = new TableHeaderRow(); tRowHead.TableSection = TableRowSection.TableHeader; for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++) { // Create a new cell and add it to the row. TableHeaderCell cellHead = new TableHeaderCell(); cellHead.Text = ar[cellCtr - 1]; tRowHead.Cells.Add(cellHead); } tblCourse.Rows.Add(tRowHead); } //List<Course> course = new List<Course>(); course = new List <TQF.Course>(); //string sql = "Select * From COURSE Where FACULTYCODE='" + facId + "'"; //course = new Course().getCourseManual(sql); if (Page.IsPostBack) { course = new TQF.Course().getCourse(); } else { string sql = "Select * From COURSE Where FACULTYCODE='" + facId + "'"; course = new TQF.Course().getCourseManual(sql); } foreach (TQF.Course data in course) { TableRow tRowBody = new TableRow(); tRowBody.TableSection = TableRowSection.TableBody; //Cell [0] TableCell cellCheck = new TableCell(); CheckBox chk = new CheckBox(); chk.ID = data.CourseCode; //chk.AutoPostBack = true; cellCheck.Controls.Add(chk); cellCheck.CssClass = "text-center"; cellCheck.Width = 50; tRowBody.Cells.Add(cellCheck); //Cell [1] TableCell cellCourseCode = new TableCell(); string urlShow = "showCOURSE.aspx?token=" + data.CourseCode; HyperLink hypShow = new HyperLink(); hypShow.Attributes.Add("data-target", "#showCOURSE"); hypShow.Attributes.Add("data-toggle", "modal"); hypShow.Text = data.CourseCode; hypShow.NavigateUrl = urlShow; hypShow.ToolTip = "Course details"; cellCourseCode.Controls.Add(hypShow); cellCourseCode.CssClass = "text-center"; cellCourseCode.Width = 80; tRowBody.Cells.Add(cellCourseCode); //Cell [2] TableCell cellCourseEnName = new TableCell(); cellCourseEnName.Text = data.CourseThName + "<br>" + data.CourseEnName; tRowBody.Cells.Add(cellCourseEnName); //Cell [3] TableCell cellCredit = new TableCell(); cellCredit.Text = data.Credit + "(" + data.TheoryHour + "-" + data.PracticeHour + "-" + data.SelfStudyHour + ")"; tRowBody.Cells.Add(cellCredit); //Cell [4] TableCell cellFacultyCode = new TableCell(); cellFacultyCode.Text = new Faculty().getFaculty(data.FacultyCode).Faculty_Thai; cellFacultyCode.Width = 200; tRowBody.Cells.Add(cellFacultyCode); //Cell [5] //Cell นี้เอาไว้เก็บค่าไอดีลง ฐานข้อมูล TableCell cellCourseCodeId = new TableCell(); cellCourseCodeId.Text = data.CourseCode; cellCourseCodeId.Visible = false; tRowBody.Cells.Add(cellCourseCodeId); tblCourse.Rows.Add(tRowBody); } }
private TableRow buildPermissionRow(TblPermissions permission) { TableRow operationRow = new TableRow(); Label dateSinceLabel = new Label(); dateSinceLabel.Text = since + ": "; GMDatePicker dateSinceDatePicker = recreateDatePicker(since + permission.ID.ToString()); Label dateTillLabel = new Label(); dateTillLabel.Text = till + ": "; GMDatePicker dateTillDatePicker = recreateDatePicker(till + permission.ID.ToString()); TableCell operationNameCell = new TableCell(); if (permission.StageOperationRef.HasValue) { FxStageOperations stageOperation = ServerModel.DB.Load <FxStageOperations>(permission.StageOperationRef.Value); operationNameCell.Text = stageOperation.Name; } if (permission.CurriculumOperationRef.HasValue) { FxCurriculumOperations curriculumOperation = ServerModel.DB.Load <FxCurriculumOperations>(permission.CurriculumOperationRef.Value); operationNameCell.Text = curriculumOperation.Name; } operationRow.Cells.Add(operationNameCell); Table layoutTable = new Table(); TableRow layoutRow = new TableRow(); TableCell sinceLabelCell = new TableCell(); sinceLabelCell.Controls.Add(dateSinceLabel); TableCell sincePickerCell = new TableCell(); sincePickerCell.HorizontalAlign = HorizontalAlign.Right; sincePickerCell.Controls.Add(dateSinceDatePicker); TableCell tillLabelCell = new TableCell(); tillLabelCell.Controls.Add(dateTillLabel); TableCell tillPickerCell = new TableCell(); tillPickerCell.HorizontalAlign = HorizontalAlign.Right; tillPickerCell.Controls.Add(dateTillDatePicker); operationRow.Cells.Add(sinceLabelCell); operationRow.Cells.Add(sincePickerCell); operationRow.Cells.Add(tillLabelCell); operationRow.Cells.Add(tillPickerCell); if (permission.DateSince.HasValue) { dateSinceDatePicker.InitialText = permission.DateSince.Value.ToShortDateString(); dateSinceDatePicker.InitialTimePickerText = permission.DateSince.Value.ToShortTimeString(); } if (permission.DateTill.HasValue) { dateTillDatePicker.InitialText = permission.DateTill.Value.ToShortDateString(); dateTillDatePicker.InitialTimePickerText = permission.DateTill.Value.ToShortTimeString(); } TableCell operationCell = new TableCell(); Button ApppyButton = new Button(); ApppyButton.ID = applyChar + permission.ID.ToString(); ApppyButton.Click += new EventHandler(ApppyButton_Click); ApppyButton.Text = apply; Button RemoveButton = new Button(); RemoveButton.ID = removeChar + permission.ID.ToString(); RemoveButton.Click += new EventHandler(RemoveButton_Click); RemoveButton.Text = remove; operationCell.Controls.Add(ApppyButton); operationCell.Controls.Add(RemoveButton); operationRow.Cells.Add(operationCell); return(operationRow); }
/// <summary> /// Gets the list of files from directory and displays them in the page /// </summary> private void GetMmsFiles() { int columnCount = 0; TableRow tableRow = null; TableRow secondRow = null; int totalFiles = 0; Table pictureTable = new Table(); Table tableControl = new Table(); DirectoryInfo directory = new DirectoryInfo(Request.MapPath(this.directoryPath)); List <FileInfo> imageList = null; try { imageList = directory.GetFiles().OrderBy(f => f.CreationTime).ToList(); } catch { } if (imageList == null) { lbl_TotalCount.Text = "0"; return; } totalFiles = imageList.Count; string fileShownMessage = imageList.Count.ToString(); lbl_TotalCount.Text = fileShownMessage; int fileCountIndex = 0; foreach (FileInfo file in imageList) { if (fileCountIndex == this.numOfFilesToDisplay) { break; } if (columnCount == 0) { tableRow = new TableRow(); secondRow = new TableRow(); TableCell tableCellImage = new TableCell(); System.Web.UI.WebControls.Image image1 = new System.Web.UI.WebControls.Image(); image1.ImageUrl = string.Format("{0}{1}", this.directoryPath, file.Name); image1.Width = 150; image1.Height = 150; tableCellImage.Controls.Add(image1); tableRow.Controls.Add(tableCellImage); TableCell tableCellSubject = new TableCell(); tableCellSubject.Text = file.Name; tableCellSubject.Width = 150; secondRow.Controls.Add(tableCellSubject); columnCount += 1; } else { TableCell tableCellImage = new TableCell(); System.Web.UI.WebControls.Image image1 = new System.Web.UI.WebControls.Image(); image1.ImageUrl = string.Format("{0}{1}", this.directoryPath, file.Name); image1.Width = 150; image1.Height = 150; tableCellImage.Controls.Add(image1); tableRow.Controls.Add(tableCellImage); TableCell tableCellSubject = new TableCell(); tableCellSubject.Text = file.Name; tableCellSubject.Width = 150; secondRow.Controls.Add(tableCellSubject); columnCount += 1; if (columnCount == 5) { columnCount = 0; } fileCountIndex++; } pictureTable.Controls.Add(tableRow); pictureTable.Controls.Add(secondRow); } messagePanel.Controls.Add(pictureTable); }
protected void create_page_numbers(int no_of_page_reqs) { Panel panel = new Panel(); //LAYOUT SHOWING PAGE NUMBERS AT BOTTOM Table table_top_pagenumbers = new Table(); table_top_pagenumbers.Style.Add(HtmlTextWriterStyle.Width, "20%"); //table.Style.Add(HtmlTextWriterStyle.MarginRight, "10%"); TableRow row_top_pagenumbers = new TableRow(); row_top_pagenumbers.Style.Add(HtmlTextWriterStyle.Width, "10%"); for (int i = 0; i <= no_of_page_reqs + 1; i++) { TableCell cell = new TableCell(); HyperLink page_number = new HyperLink(); if (int.Parse(Request.QueryString["pg"].ToString()) == i) { page_number.BackColor = System.Drawing.Color.Black; page_number.ForeColor = System.Drawing.Color.LemonChiffon; } else { page_number.BackColor = System.Drawing.Color.Transparent; } //NEXT POINTER if (i == no_of_page_reqs + 1) { string page_sel = Request.QueryString["pg"].ToString(); string next_ptr = (int.Parse(page_sel) + 1).ToString(); if (int.Parse(next_ptr) != no_of_page_reqs + 1) { page_number.Text = "Next"; page_number.ID = i.ToString() + "Top"; page_number.NavigateUrl = "../Forum/forumtopics.aspx?grp_id=" + grp_id + "&pg=" + next_ptr; } } //PREV POINTER else if (i == 0) { string page_sel = Request.QueryString["pg"].ToString(); string prev_ptr = (int.Parse(page_sel) - 1).ToString(); if (int.Parse(prev_ptr) != 0) { page_number.Text = "Previous"; page_number.ID = i.ToString() + "Top"; page_number.NavigateUrl = "../Forum/forumtopics.aspx?grp_id=" + grp_id + "&pg=" + prev_ptr; } } else { page_number.Text = i.ToString(); page_number.ID = i.ToString() + "Top"; page_number.NavigateUrl = "../Forum/forumtopics.aspx?grp_id=" + grp_id + "&pg=" + i.ToString(); } page_number.BorderColor = System.Drawing.Color.Transparent; page_number.BorderStyle = BorderStyle.Ridge; page_number.BorderWidth = 1; page_number.Style.Add(HtmlTextWriterStyle.FontSize, "22px"); page_number.Style.Add(HtmlTextWriterStyle.PaddingLeft, "4px"); page_number.Style.Add(HtmlTextWriterStyle.PaddingRight, "4px"); cell.Controls.Add(page_number); cell.Style.Add(HtmlTextWriterStyle.Width, "10px"); row_top_pagenumbers.Cells.Add(cell); } table_top_pagenumbers.Rows.Add(row_top_pagenumbers); //LAYOUT SHOWING PAGE NUMBERS AT BOTTOM Table table_Bottom_pagenumbers = new Table(); table_Bottom_pagenumbers.Style.Add(HtmlTextWriterStyle.Width, "20%"); //table.Style.Add(HtmlTextWriterStyle.MarginRight, "10%"); TableRow row_Bottom_pagenumbers = new TableRow(); row_Bottom_pagenumbers.Style.Add(HtmlTextWriterStyle.Width, "10%"); for (int i = 0; i <= no_of_page_reqs + 1; i++) { TableCell cell = new TableCell(); HyperLink page_number = new HyperLink(); if (int.Parse(Request.QueryString["pg"].ToString()) == i) { page_number.BackColor = System.Drawing.Color.Black; page_number.ForeColor = System.Drawing.Color.LemonChiffon; } else { page_number.BackColor = System.Drawing.Color.Transparent; } //NEXT POINTER if (i == no_of_page_reqs + 1) { string page_sel = Request.QueryString["pg"].ToString(); string next_ptr = (int.Parse(page_sel) + 1).ToString(); if (int.Parse(next_ptr) != no_of_page_reqs + 1) { page_number.Text = "Next"; page_number.ID = i.ToString() + "Bottom"; page_number.NavigateUrl = "../Forum/forumtopics.aspx?grp_id=" + grp_id + "&pg=" + next_ptr; } } //PREV POINTER else if (i == 0) { string page_sel = Request.QueryString["pg"].ToString(); string prev_ptr = (int.Parse(page_sel) - 1).ToString(); if (int.Parse(prev_ptr) != 0) { page_number.Text = "Previous"; page_number.ID = i.ToString() + "Bottom"; page_number.NavigateUrl = "../Forum/forumtopics.aspx?grp_id=" + grp_id + "&pg=" + prev_ptr; } } else { page_number.Text = i.ToString(); page_number.ID = i.ToString() + "Bottom"; page_number.NavigateUrl = "../Forum/forumtopics.aspx?grp_id=" + grp_id + "&pg=" + i.ToString(); } page_number.BorderColor = System.Drawing.Color.Transparent; page_number.BorderStyle = BorderStyle.Ridge; page_number.BorderWidth = 1; page_number.Style.Add(HtmlTextWriterStyle.FontSize, "22px"); page_number.Style.Add(HtmlTextWriterStyle.PaddingLeft, "4px"); page_number.Style.Add(HtmlTextWriterStyle.PaddingRight, "4px"); cell.Controls.Add(page_number); cell.Style.Add(HtmlTextWriterStyle.Width, "10px"); row_Bottom_pagenumbers.Cells.Add(cell); } table_Bottom_pagenumbers.Rows.Add(row_Bottom_pagenumbers); //ADDING BOTH TOP & BOTTOM LAYOUTS TO SPECIFIED div's dv2.Controls.Add(table_top_pagenumbers); dv2.Style.Add(HtmlTextWriterStyle.Width, "100%"); dv3.Controls.Add(table_Bottom_pagenumbers); dv3.Style.Add(HtmlTextWriterStyle.Width, "100%"); table_top_pagenumbers.Style.Add(HtmlTextWriterStyle.Width, "10%"); table_Bottom_pagenumbers.Style.Add(HtmlTextWriterStyle.Width, "10%"); }
protected void generate_topic_table(string group_id) { int start, stop; start = (10 * ((int.Parse(p_no)) - 1)) + 1; stop = 10 * (int.Parse(p_no)); string conn = System.Configuration.ConfigurationManager.ConnectionStrings["connstring"].ConnectionString; SqlConnection connection = new SqlConnection(conn); string sqlqry = "SELECT topic_id,starter_user_id,no_of_likes,date_created,views,topic_name,topic_description FROM (SELECT group_id,topic_id,starter_user_id,no_of_likes,date_created,views,topic_name,topic_description,ROW_NUMBER() OVER (ORDER BY topic_id ASC) AS Row FROM forum_topics) tmp WHERE tmp.group_id=@p1 AND Row >=" + start.ToString() + " AND Row <= " + stop.ToString(); pages = no_of_page("SELECT group_id,topic_id,starter_user_id,no_of_likes,date_created,views,topic_name,topic_description FROM forum_topics"); SqlCommand command = new SqlCommand(sqlqry, connection); SqlParameter param1 = new SqlParameter(); param1.SqlDbType = System.Data.SqlDbType.Int; param1.ParameterName = "@p1"; param1.Value = group_id; command.Parameters.Add(param1); SqlDataReader Reader = null; command.Connection.Open(); Reader = command.ExecuteReader(); Table topic_table = new Table(); topic_table.CssClass = "table_forum"; TableHeaderRow h_row = new TableHeaderRow(); h_row.CssClass = "header_row"; TableHeaderCell h_cell_topic_name = new TableHeaderCell(); TableHeaderCell h_cell_topic_stats = new TableHeaderCell(); Label lbl_population = new Label(); lbl_population.Text = "Topic Stats"; h_cell_topic_stats.Controls.Add(lbl_population); TableHeaderCell h_cell_topic_last_activity = new TableHeaderCell(); Label lbl_last_act = new Label(); lbl_last_act.Text = "Latest Activity"; h_cell_topic_last_activity.Controls.Add(lbl_last_act); h_row.Cells.Add(h_cell_topic_name); h_row.Cells.Add(h_cell_topic_stats); h_row.Cells.Add(h_cell_topic_last_activity); topic_table.Rows.Add(h_row); int i = 0; while (Reader.Read()) { ++i; TableRow row_topic = new TableRow(); row_topic.CssClass = "normal_table_forum_row"; if (i % 2 == 0) { row_topic.Style.Add(HtmlTextWriterStyle.BackgroundColor, "#f5f5f5"); } else { row_topic.Style.Add(HtmlTextWriterStyle.BackgroundColor, "#f9f9f9"); } TableCell cell_title_topic = new TableCell(); cell_title_topic.Style.Add(HtmlTextWriterStyle.Width, "70%"); cell_title_topic.Style.Add(HtmlTextWriterStyle.TextAlign, "Left"); cell_title_topic.Style.Add(HtmlTextWriterStyle.Padding, "10px 10px 10px 10px"); TableCell cell_No_of_comments_topic = new TableCell(); cell_No_of_comments_topic.Style.Add(HtmlTextWriterStyle.TextAlign, "center"); cell_No_of_comments_topic.Style.Add(HtmlTextWriterStyle.Padding, "10px 4px 10px 4px"); TableCell cell_Last_comment_starter_group = new TableCell(); cell_Last_comment_starter_group.Style.Add(HtmlTextWriterStyle.TextAlign, "center"); cell_Last_comment_starter_group.Style.Add(HtmlTextWriterStyle.Padding, "10px 4px 10px 4px"); HyperLink topic_title = new HyperLink(); topic_title.CssClass = "heading_forum"; topic_title.Text = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(Reader[5].ToString().ToLower()); topic_title.NavigateUrl = "../Forum/forumtopicres.aspx?tpc_id=" + Reader[0].ToString() + "&pg=1"; Literal nl1 = new Literal(); nl1.Text = "<br />"; Label topic_starter = new Label(); topic_starter.CssClass = "descr_forum"; topic_starter.Text = "Started by " + get_starting_user(Reader[1].ToString()); cell_title_topic.Controls.Add(topic_title); cell_title_topic.Controls.Add(nl1); cell_title_topic.Controls.Add(topic_starter); Label total_comments = new Label(); total_comments.CssClass = "descr_forum"; total_comments.Text = calculate_comments(Reader[0].ToString()) + " Comments"; Literal nl5 = new Literal(); nl5.Text = "<br />"; Label total_views = new Label(); total_views.CssClass = "number"; total_views.Text = (Reader[4].ToString()) + " Views"; cell_No_of_comments_topic.Controls.Add(total_comments); cell_No_of_comments_topic.Controls.Add(nl5); cell_No_of_comments_topic.Controls.Add(total_views); Label last_act_user = new Label(); last_act_user.CssClass = "descr_forum"; Literal nl4 = new Literal(); nl4.Text = "<br />"; Literal nl3 = new Literal(); nl3.Text = "<br />"; Label last_act_datetime = new Label(); last_act_datetime.CssClass = "descr_forum"; if (get_last_user(Reader[0].ToString()) != "/") { last_act_user.Text = "by " + get_last_user(Reader[0].ToString()); last_act_datetime.Text = get_last_user_time(Reader[0].ToString()); } else { last_act_user.Text = "by " + get_starting_user(Reader[1].ToString()); last_act_datetime.Text = (((DateTime)(Reader[3])).ToShortDateString()); } cell_Last_comment_starter_group.Controls.Add(last_act_user); cell_Last_comment_starter_group.Controls.Add(nl3); cell_Last_comment_starter_group.Controls.Add(last_act_datetime); row_topic.Cells.Add(cell_title_topic); row_topic.Cells.Add(cell_No_of_comments_topic); row_topic.Cells.Add(cell_Last_comment_starter_group); topic_table.Rows.Add(row_topic); } table_topics.Controls.Add(topic_table); command.Connection.Close(); }
partial void TimesheetReports_Inserting(TimesheetReport entity) { string wordDocument; //Retrieve the Engineer DataWorkspace workspace = new DataWorkspace(); var timesheetEngineer = workspace.ApplicationData.Engineers_SingleOrDefault( entity.EngineerId); if (timesheetEngineer != null) { DateTime startOfMonth; startOfMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); //Retrieve timesheet records for engineer for current month var timesheetRecords = workspace.ApplicationData.Timesheets.Where( tsRec => tsRec.Engineer.Id == entity.EngineerId && tsRec.EntryDate > startOfMonth); wordDocument = HttpContext.Current.Server.MapPath( @"~\bin\HelpDeskCS.Server\Reports\TimesheetTemplate.docx"); Byte[] byteArray = File.ReadAllBytes(wordDocument); using (MemoryStream mem = new MemoryStream()) { mem.Write(byteArray, 0, (int)byteArray.Length); using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(mem, true)) { MainDocumentPart mainDocPart = wordDoc.MainDocumentPart; //Insert the bookmark values InsertBookmarkValue(ref mainDocPart, "EngineerSurname", timesheetEngineer.Surname); InsertBookmarkValue(ref mainDocPart, "EngineerFirstname", timesheetEngineer.Firstname); IEnumerable <TableProperties> docTableProperties = mainDocPart.Document.Descendants <TableProperties>().Where( prop => (prop.TableCaption != null) && prop.TableCaption.Val.Value == "TimesheetEntries"); //Find a reference to the table Table tableTimesheet = (Table)docTableProperties.First().Parent; IEnumerable <TableRow> rowsTimeseet = tableTimesheet.Descendants <TableRow>(); //Loop through the timesheet records foreach (Timesheet tsRec in timesheetRecords) { TableRow rowCopy = (TableRow)tableTimesheet.Descendants < TableRow>().Skip(1).First().CloneNode(true); IEnumerable <TableCell> rowCells = rowCopy.Descendants <TableCell>(); rowCells.ElementAt(0).Append( GetParagraph(tsRec.EntryDate.ToShortDateString())); rowCells.ElementAt(1).Append( GetParagraph(tsRec.Issue.Subject)); rowCells.ElementAt(2).Append( GetParagraph(tsRec.DurationMins.ToString())); tableTimesheet.InsertAfter(rowCopy.CloneNode(true), tableTimesheet.Descendants <TableRow>().Skip(1).First()); } mainDocPart.Document.Save(); } //Save the Word document to the table entity.ReportData = mem.ToArray(); } } }
void Draw(Cairo.Context ctx, List <TableRow> rowList, int dividerX, int x, ref int y) { if (!heightMeasured) { return; } Pango.Layout layout = new Pango.Layout(PangoContext); TableRow lastCategory = null; foreach (var r in rowList) { int w, h; layout.SetText(r.Label); layout.GetPixelSize(out w, out h); int indent = 0; if (r.IsCategory) { var rh = h + CategoryTopBottomPadding * 2; ctx.Rectangle(0, y, Allocation.Width, rh); using (var gr = new LinearGradient(0, y, 0, rh)) { gr.AddColorStop(0, new Cairo.Color(248d / 255d, 248d / 255d, 248d / 255d)); gr.AddColorStop(1, new Cairo.Color(240d / 255d, 240d / 255d, 240d / 255d)); ctx.SetSource(gr); ctx.Fill(); } if (lastCategory == null || lastCategory.Expanded || lastCategory.AnimatingExpand) { ctx.MoveTo(0, y + 0.5); ctx.LineTo(Allocation.Width, y + 0.5); } ctx.MoveTo(0, y + rh - 0.5); ctx.LineTo(Allocation.Width, y + rh - 0.5); ctx.SetSourceColor(DividerColor); ctx.Stroke(); ctx.MoveTo(x, y + CategoryTopBottomPadding); ctx.SetSourceColor(CategoryLabelColor); Pango.CairoHelper.ShowLayout(ctx, layout); var img = r.Expanded ? discloseUp : discloseDown; CairoHelper.SetSourcePixbuf(ctx, img, Allocation.Width - img.Width - CategoryTopBottomPadding, y + (rh - img.Height) / 2); ctx.Paint(); y += rh; lastCategory = r; } else { var cell = GetCell(r); r.Enabled = !r.Property.IsReadOnly || cell.EditsReadOnlyObject; var state = r.Enabled ? State : Gtk.StateType.Insensitive; ctx.Save(); ctx.Rectangle(0, y, dividerX, h + PropertyTopBottomPadding * 2); ctx.Clip(); ctx.MoveTo(x, y + PropertyTopBottomPadding); ctx.SetSourceColor(Style.Text(state).ToCairoColor()); Pango.CairoHelper.ShowLayout(ctx, layout); ctx.Restore(); if (r != currentEditorRow) { cell.Render(GdkWindow, ctx, r.EditorBounds, state); } y += r.EditorBounds.Height; indent = PropertyIndent; } if (r.ChildRows != null && r.ChildRows.Count > 0 && (r.Expanded || r.AnimatingExpand)) { int py = y; ctx.Save(); if (r.AnimatingExpand) { ctx.Rectangle(0, y, Allocation.Width, r.AnimationHeight); } else { ctx.Rectangle(0, 0, Allocation.Width, Allocation.Height); } ctx.Clip(); Draw(ctx, r.ChildRows, dividerX, x + indent, ref y); ctx.Restore(); if (r.AnimatingExpand) { y = py + r.AnimationHeight; // Repaing the background because the cairo clip doesn't work for gdk primitives int dx = (int)((double)Allocation.Width * dividerPosition); ctx.Rectangle(0, y, dx, Allocation.Height - y); ctx.SetSourceColor(LabelBackgroundColor); ctx.Fill(); ctx.Rectangle(dx + 1, y, Allocation.Width - dx - 1, Allocation.Height - y); ctx.SetSourceRGB(1, 1, 1); ctx.Fill(); } } } }
protected override IList ExecuteCrawl(bool crawlAll) { IList list = new List <BidInfo>(); int pageInt = 1; string html = string.Empty; string viewState = string.Empty; string eventValidation = string.Empty; string cookiestr = string.Empty; try { html = this.ToolWebSite.GetHtmlByUrl(this.SiteUrl); } catch { return(list); } Parser parser = new Parser(new Lexer(html)); NodeList pageNode = parser.ExtractAllNodesThatMatch(new AndFilter(new HasParentFilter(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("id", "AspNetPager1")), true), new TagNameFilter("a"))); if (pageNode != null && pageNode.Count > 0) { try { string temp = pageNode[pageNode.Count - 1].GetATagHref().GetRegexBegEnd(",'", "'"); pageInt = int.Parse(temp); } catch { } } for (int i = 1; i <= pageInt; i++) { if (i > 1) { viewState = this.ToolWebSite.GetAspNetViewState(html); eventValidation = this.ToolWebSite.GetAspNetEventValidation(html); NameValueCollection nvc = this.ToolWebSite.GetNameValueCollection(new string[] { "ScriptManager1", "__EVENTTARGET", "__EVENTARGUMENT", "__LASTFOCUS", "__VIEWSTATE", "__VIEWSTATEGENERATOR", "__EVENTVALIDATION" }, new string[] { "UpdatePanel1|AspNetPager1", "AspNetPager1", i.ToString(), "", viewState, "89EEEF6E", eventValidation }); try { html = this.ToolWebSite.GetHtmlByUrl(this.SiteUrl, nvc); } catch { continue; } } parser = new Parser(new Lexer(html)); NodeList listNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("id", "GridView1"))); if (listNode != null && listNode.Count > 0) { TableTag table = listNode[0] as TableTag; for (int j = 1; j < table.RowCount; j++) { string prjName = string.Empty, buildUnit = string.Empty, bidUnit = string.Empty, bidMoney = string.Empty, code = string.Empty, bidDate = string.Empty, beginDate = string.Empty, endDate = string.Empty, bidType = string.Empty, specType = string.Empty, InfoUrl = string.Empty, msgType = string.Empty, bidCtx = string.Empty, prjAddress = string.Empty, remark = string.Empty, prjMgr = string.Empty, otherType = string.Empty, HtmlTxt = string.Empty; TableRow tr = table.Rows[j]; ATag aTag = tr.Columns[0].GetATag(); prjName = aTag.GetAttribute("title"); code = tr.Columns[1].ToNodePlainString(); bidUnit = tr.Columns[2].GetSpan().GetAttribute("title"); prjMgr = tr.Columns[3].ToNodePlainString(); bidMoney = tr.Columns[4].ToNodePlainString().GetMoney(); beginDate = tr.Columns[5].ToPlainTextString().GetDateRegex(); InfoUrl = "http://www.sdzb.gov.cn/" + aTag.Link; string htmldtl = string.Empty; try { htmldtl = this.ToolWebSite.GetHtmlByUrl(InfoUrl).GetJsString(); } catch { continue; } parser = new Parser(new Lexer(htmldtl)); NodeList dtlNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("id", "htmlTable"))); if (dtlNode != null && dtlNode.Count > 0) { HtmlTxt = dtlNode.AsHtml(); bidCtx = HtmlTxt.ToCtxString(); prjAddress = bidCtx.GetAddressRegex().GetCodeDel().GetReplace(" "); buildUnit = bidCtx.GetBuildRegex().GetReplace(" "); if (buildUnit.Contains("公司")) { buildUnit = buildUnit.Remove(buildUnit.IndexOf("公司")) + "公司"; } if (buildUnit.Contains("联系")) { buildUnit = buildUnit.Remove(buildUnit.IndexOf("联系")); } if (buildUnit.Contains("地址")) { buildUnit = buildUnit.Remove(buildUnit.IndexOf("地址")); } if (buildUnit.Contains("_")) { buildUnit = string.Empty; } if (prjMgr == "/") { prjMgr = string.Empty; } msgType = "山东省建设工程招标投标管理办公室"; specType = bidType = "建设工程"; BidInfo info = ToolDb.GenBidInfo("山东省", "山东省及地市", "", string.Empty, code, prjName, buildUnit, beginDate, bidUnit, beginDate, endDate, bidCtx, string.Empty, msgType, bidType, specType, otherType, bidMoney, InfoUrl, prjMgr, HtmlTxt); list.Add(info); parser = new Parser(new Lexer(HtmlTxt)); NodeList aNode = parser.ExtractAllNodesThatMatch(new TagNameFilter("a")); if (aNode != null && aNode.Count > 0) { for (int k = 0; k < aNode.Count; k++) { ATag a = aNode[k] as ATag; if (a.IsAtagAttach()) { string link = string.Empty; if (a.Link.ToLower().Contains("http")) { link = a.Link; } else { link = "http://www.sdzb.gov.cn/" + a.Link.GetReplace("../,./"); } if (Encoding.Default.GetByteCount(link) > 500) { continue; } BaseAttach attach = ToolDb.GenBaseAttach(a.LinkText, info.Id, link); base.AttachList.Add(attach); } } } if (!crawlAll && list.Count >= this.MaxCount) { return(list); } } } } } return(list); }
protected Table CreateShelfChart(string AreaCode, string shelfCode) { BLL.BLLBase bll = new BLL.BLLBase(); string strWhere = ""; if (AreaCode == "") { strWhere = string.Format("ShelfCode='{0}'", shelfCode); } else { strWhere = string.Format("ShelfCode='{0}' and AreaCode='{1}'", shelfCode, AreaCode); } DataTable ShelfCell = bll.FillDataTable("CMD.SelectWareHouseCellQueryByShelf", new DataParameter[] { new DataParameter("{0}", strWhere) }); int Rows = int.Parse(ShelfCell.Rows[0]["Rows"].ToString()); int Columns = int.Parse(ShelfCell.Rows[0]["Columns"].ToString()); string Width = (90 / Columns) + "%"; Table tb = new Table(); string tbstyle = "width:100%"; tb.Attributes.Add("style", tbstyle); for (int i = Rows; i >= 1; i--) { TableRow row = new TableRow(); for (int j = 1; j <= Columns; j++) { if (AreaCode == "") { strWhere = string.Format("CellRow={0} and CellColumn={1}", i, j); } else { strWhere = string.Format("CellRow={0} and CellColumn={1} and AreaCode='{2}'", i, j, AreaCode); } DataRow[] drs = ShelfCell.Select(strWhere, ""); if (drs.Length > 0) { TableCell cell = new TableCell(); cell.ID = drs[0]["CellCode"].ToString(); string style = "height:25px;width:" + Width + ";border:2px solid #008B8B;"; string backColor = ReturnColorFlag(drs[0]["PalletCode"].ToString(), drs[0]["IsActive"].ToString(), drs[0]["IsLock"].ToString(), drs[0]["ErrorFlag"].ToString(), ToYMD(drs[0]["InDate"])); if (drs[0]["PalletCode"].ToString() != "") { style += "background-color:" + backColor + ";"; } cell.Attributes.Add("style", style); cell.Attributes.Add("onclick", "ShowCellInfo('" + cell.ID + "');"); row.Cells.Add(cell); } else { TableCell cell = new TableCell(); string style = "height:25px;width:" + Width + ";border:0px solid #008B8B"; cell.Attributes.Add("style", style); row.Cells.Add(cell); } if (j == Columns) { TableCell cellTag = new TableCell(); cellTag.Attributes.Add("style", "height:25px;border:0px solid #008B8B"); cellTag.Attributes.Add("align", "right"); cellTag.Text = "<font color=\"#008B8B\"> 第" + int.Parse(shelfCode.Substring(4, 2)).ToString() + "排第" + i.ToString() + "层</font>"; row.Cells.Add(cellTag); } } tb.Rows.Add(row); if (i == 1) { TableRow rowNum = new TableRow(); for (int j = 1; j <= Columns; j++) { string K = j.ToString(); TableCell cellNum = new TableCell(); cellNum.Attributes.Add("style", "height:40px;width:" + Width.ToString() + "px;border:0px solid #008B8B"); cellNum.Attributes.Add("align", "center"); cellNum.Attributes.Add("Valign", "top"); cellNum.Text = "<font color=\"#008B8B\">" + K + "</font>"; rowNum.Cells.Add(cellNum); } tb.Rows.Add(rowNum); } } return(tb); }
protected void Page_Load(object sender, EventArgs e) { HtmlGenericControl body = (HtmlGenericControl)Master.FindControl("master"); body.Attributes.Add("class", "admin"); tablename = HttpContext.Current.Request.QueryString["t"]; userrole = LoginHelper.UserRole(Page.User.Identity.Name); if (userrole != "admin") { AllPanel.Visible = false; Label1.Text = "Vous n'avez pas la permission d'utiliser cette page. Veuillez contacter [email protected] si vous pensez que c'est une erreur."; } else { eh = new ElevesHelper(); columns = new ArrayList(); if (tablename == "" | tablename == null) { Label1.Text = "Aucune table n'a été sélectionnée."; } else { litTableName.Text = tablename; tbs = PageHelper.CreateTextBoxes(PageHelper.ColumnNames(eh.GetContactsDataSet("SELECT * from " + tablename).Tables[0])); Table tbl = new Table(); InputPanel.Controls.Add(tbl); int counter = 0; foreach (TextBox tb in tbs) { columns.Add(tb.ID.Substring(PREFIX_LENGTH)); TableRow tr = new TableRow(); TableCell td1 = new TableCell(); TableCell td2 = new TableCell(); tbl.Controls.Add(tr); tr.Controls.Add(td1); tr.Controls.Add(td2); Label lb = new Label(); lb.Text = LoginHelper.GetColumnComment(tablename, tb.ID.Substring(PREFIX_LENGTH)); td1.Controls.Add(lb); td2.Controls.Add(tb); counter++; } if (!IsPostBack) { if (Page.User.Identity.Name == "*****@*****.**") { Label1.Text = "Super admin"; GridView1.AutoGenerateEditButton = true; GridView1.AutoGenerateDeleteButton = true; } else { GridView1.AutoGenerateEditButton = false; GridView1.AutoGenerateDeleteButton = false; } BindDataGrid(); } } } }
public void printDG(DataGrid dataGrid, string title) { PrintDialog printDialog = new PrintDialog(); if (printDialog.ShowDialog() == true) { FlowDocument fd = new FlowDocument(); Paragraph p = new Paragraph(new Run(title)); p.FontStyle = dataGrid.FontStyle; p.FontFamily = dataGrid.FontFamily; p.FontSize = 18; fd.Blocks.Add(p); Table table = new Table(); TableRowGroup tableRowGroup = new TableRowGroup(); TableRow r = new TableRow(); fd.PageWidth = printDialog.PrintableAreaWidth; fd.PageHeight = printDialog.PrintableAreaHeight; fd.BringIntoView(); fd.TextAlignment = TextAlignment.Center; fd.ColumnWidth = 500; table.CellSpacing = 0; var headerList = dataGrid.Columns.Select(e => e.Header.ToString()).ToList(); for (int j = 0; j < headerList.Count; j++) { r.Cells.Add(new TableCell(new Paragraph(new Run(headerList[j])))); r.Cells[j].ColumnSpan = 4; r.Cells[j].Padding = new Thickness(4); r.Cells[j].BorderBrush = Brushes.Black; r.Cells[j].FontWeight = FontWeights.Bold; r.Cells[j].Background = Brushes.DarkGray; r.Cells[j].Foreground = Brushes.White; r.Cells[j].BorderThickness = new Thickness(1, 1, 1, 1); } tableRowGroup.Rows.Add(r); table.RowGroups.Add(tableRowGroup); for (int i = 0; i < dataGrid.Items.Count; i++) { DataRowView row = (DataRowView)dataGrid.Items.GetItemAt(i); table.BorderBrush = Brushes.Gray; table.BorderThickness = new Thickness(1, 1, 0, 0); table.FontStyle = dataGrid.FontStyle; table.FontFamily = dataGrid.FontFamily; table.FontSize = 13; tableRowGroup = new TableRowGroup(); r = new TableRow(); for (int j = 0; j < row.Row.ItemArray.Count(); j++) { r.Cells.Add(new TableCell(new Paragraph(new Run(row.Row.ItemArray[j].ToString())))); r.Cells[j].ColumnSpan = 4; r.Cells[j].Padding = new Thickness(4); r.Cells[j].BorderBrush = Brushes.DarkGray; r.Cells[j].BorderThickness = new Thickness(0, 0, 1, 1); } tableRowGroup.Rows.Add(r); table.RowGroups.Add(tableRowGroup); } fd.Blocks.Add(table); printDialog.PrintDocument(((IDocumentPaginatorSource)fd).DocumentPaginator, ""); } }
protected void Page_Load(object sender, EventArgs e) { Dictionary <int, string> dict = new Dictionary <int, string>(); dict.Add(1, "Makaroni"); dict.Add(2, "Chocolate"); dict.Add(3, "Alfajores"); dict.Add(4, "Vanilla"); dict.Add(7, "WhiteChocolate"); dict.Add(8, "Berries"); dict.Add(9, "Cream"); dict.Add(10, "Chocolate"); dict.Add(11, "BerriesVanilla"); dict.Add(12, "BlueberryPai"); int userId = Int32.Parse(userIdString); int sum = 0; string message = string.Empty; List <string> result = new List <string>(); string query = "SELECT * FROM orders_table WHERE user_id = @userId"; SqlCommand cmd = new SqlCommand(query, con); cmd.Parameters.AddWithValue("@userId", userId); SqlDataAdapter sda = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); sda.Fill(dt); con.Open(); int i = cmd.ExecuteNonQuery(); con.Close(); numOfItems.Text = dt.Rows.Count.ToString(); if (dt.Rows.Count == 0) { TableRow row = new TableRow(); TableCell cell1 = new TableCell(); cell1.Text = "Not have orders yet."; row.Cells.Add(cell1); myTable.Rows.Add(row); } foreach (DataRow rrow in dt.Rows) { TableRow row1 = new TableRow(); TableCell cell1 = new TableCell(); TableCell cell2 = new TableCell(); TableCell cell3 = new TableCell(); int index = Convert.ToInt32(rrow.ItemArray[2]); cell1.Text = dict[index]; cell2.Text = "12$"; cell3.Text = rrow.ItemArray[3].ToString(); row1.Cells.Add(cell1); row1.Cells.Add(cell2); row1.Cells.Add(cell3); myTable.Rows.Add(row1); sum = sum + 12; } Total.Text = sum.ToString() + "$"; }
private void data() { send_msg(tc, ns, "B" + Session["Data"].ToString()); string recv_mess = recv_msg(ns); if (recv_mess != "") { int counter = 1; string[] nr_task = recv_mess.Split(new Char[] { '~' }); Label[] labels = new Label[33]; for (int i = 0; i < nr_task.Length - 1; i++) { string[] words = nr_task[i].Split(new Char[] { '|' }); TableRow rw = new TableRow(); for (int cellNum = 0; cellNum < words.Length; cellNum++) { TableCell cel = new TableCell(); if (counter % 5 == 1) { cel.Text = words[0]; } else if (counter % 5 == 2) { cel.Text = words[1]; } else if (counter % 5 == 3) { cel.Text = words[2]; } else if (counter % 5 == 4) { if (words[3] == "0") { cel.Text = "To do"; cel.BackColor = Color.Red; cel.ForeColor = Color.White; cel.Font.Bold = true; //cel.HorizontalAlign = HorizontalAlign.Center; } else if (words[3] == "1") { cel.Text = "In Progress"; cel.BackColor = Color.Green; cel.ForeColor = Color.White; cel.Font.Bold = true; //cel.HorizontalAlign = HorizontalAlign.Center; } else { cel.Text = "Holded"; cel.BackColor = Color.Orange; cel.ForeColor = Color.White; cel.Font.Bold = true; //cel.HorizontalAlign = HorizontalAlign.Center; } } else { int sec = Int32.Parse(words[4]); //secunde if (sec < 1800 && sec > 600) { cel.BackColor = Color.Orange; cel.ForeColor = Color.White; } else if (sec <= 600 && sec >= 0) { cel.BackColor = Color.Red; cel.ForeColor = Color.White; } else if (sec < 0) { cel.BackColor = Color.DarkRed; cel.ForeColor = Color.White; } else { cel.BackColor = Color.Green; cel.ForeColor = Color.White; } bool k = true; if (sec < 0) { k = false; sec = sec - 2 * sec; } int minute = sec / 60; int ore = minute / 60; minute = minute % 60; sec = sec % 60; String str_sec = null; if (sec < 10) { str_sec = "0" + sec; } else { str_sec = sec.ToString(); } String str_min = null; if (minute < 10) { str_min = "0" + minute; } else { str_min = minute.ToString(); } labels[i * 3 + cellNum - 4] = new Label(); if (k) { labels[i * 3 + cellNum - 4].Text = ore.ToString() + ":" + str_min + ":" + str_sec; } else { labels[i * 3 + cellNum - 4].Text = "-" + ore.ToString() + ":" + str_min + ":" + str_sec; } cel.Controls.Add(labels[i * 3 + cellNum - 4]); } rw.Cells.Add(cel); counter++; } Table1.Rows.Add(rw); Table1.GridLines = GridLines.Both; Table1.CellPadding = 4; Table1.CellSpacing = 0; Table1.Font.Size = 12; } string[] contact = nr_task[nr_task.Length - 1].Split(new Char[] { ';' }); Label3.Text = contact[0]; Label5.Text = contact[1]; Label2.Font.Bold = true; Label3.Font.Bold = true; Label4.Font.Bold = true; Label5.Font.Bold = true; } }
public void CreateTableOfQuests(Table tbl, TestABC tABC, bool isShuffle) { QuestionDAL qDAL = new QuestionDAL(); AnswerDAL aDAL = new AnswerDAL(); Label lblQestion = new Label(); Label lblAnswer = new Label(); Label lblNumerator = new Label(); RadioButton rbtnAnswer = new RadioButton(); TableCell tCell = new TableCell(); TableRow tRow = new TableRow(); int i = 0; int j = 0; int q = 0; tbl.CssClass = "AbcTest"; foreach (QuestionABC qt in tABC.QuestionList) { lblNumerator.Text = string.Format("{0}.", q + 1); tCell.Controls.Add(lblNumerator); tCell.HorizontalAlign = HorizontalAlign.Center; tCell.VerticalAlign = VerticalAlign.Middle; tCell.ID = string.Format("tCell{0}{1}", i, j); j++; tRow.Cells.Add(tCell); lblNumerator = new Label(); tCell = new TableCell(); lblQestion.Text = qt.QuestionCurrent; tCell.Controls.Add(lblQestion); tCell.HorizontalAlign = HorizontalAlign.Center; tCell.VerticalAlign = VerticalAlign.Middle; tCell.ID = string.Format("tCell{0}{1}", i, j); tRow.Cells.Add(tCell); j = 0; tRow.ID = string.Format("tRow{0}", i); i++; tbl.Rows.Add(tRow); tCell = new TableCell(); tRow = new TableRow(); lblQestion = new Label(); if (isShuffle) { Shuffle(qt.ListAnswers); } foreach (AnswerABC answer in qt.ListAnswers) { rbtnAnswer.ID = string.Format("rbtn{0}", i); rbtnAnswer.GroupName = string.Format("rbtnGrP{0}", q); tCell.Controls.Add(rbtnAnswer); tCell.HorizontalAlign = HorizontalAlign.Center; tCell.VerticalAlign = VerticalAlign.Middle; tCell.ID = string.Format("tCell{0}{1}", i, j); j++; tRow.Cells.Add(tCell); tCell = new TableCell(); lblAnswer.ID = string.Format("lblAnswer{0}", i); lblAnswer.Text = answer.AnswerCurrent; tCell.Controls.Add(lblAnswer); tCell.HorizontalAlign = HorizontalAlign.Center; tCell.ID = string.Format("tCell{0}{1}", i, j); tCell.HorizontalAlign = HorizontalAlign.Left; j++; tRow.Cells.Add(tCell); tCell = new TableCell(); j = 0; tRow.ID = string.Format("tRow{0}", i); i++; tbl.Rows.Add(tRow); tRow = new TableRow(); rbtnAnswer = new RadioButton(); lblAnswer = new Label(); } q++; } }
private void CreateTablehMethod(Table table) { #region radwordsprocessing-model-tablerow_1 TableRow row = table.Rows.AddTableRow(); #endregion }
protected override IList ExecuteCrawl(bool crawlAll) { IList list = new List <BidInfo>(); Dictionary <string, string> citys = this.GetCitys(); foreach (string area in citys.Keys) { int count = 0; int pageInt = 1; string html = string.Empty; string viewState = string.Empty; string eventValidation = string.Empty; string cookiestr = string.Empty; try { html = this.ToolWebSite.GetHtmlByUrl(citys[area], Encoding.UTF8, ref cookiestr); } catch { return(list); } Parser parser = new Parser(new Lexer(html)); NodeList pageNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("td"), new HasAttributeFilter("nowrap", "true"))); if (pageNode != null && pageNode.Count > 0) { try { string temp = pageNode.AsString().GetRegexBegEnd("总页数", "当前页").Replace(":", ""); pageInt = int.Parse(temp); } catch { } } for (int i = 1; i <= pageInt; i++) { if (i > 1) { viewState = this.ToolWebSite.GetAspNetViewState(html); eventValidation = this.ToolWebSite.GetAspNetEventValidation(html); string viewSTATEGENERATOR = ToolHtml.GetHtmlInputValue(html, "__VIEWSTATEGENERATOR"); NameValueCollection nvc = this.ToolWebSite.GetNameValueCollection(new string[] { "__VIEWSTATE", "__VIEWSTATEGENERATOR", "__EVENTTARGET", "__EVENTARGUMENT", "__EVENTVALIDATION", "MoreInfoList1$txtTitle" }, new string[] { viewState, viewSTATEGENERATOR, "MoreInfoList1$Pager", i.ToString(), eventValidation, "" }); try { html = this.ToolWebSite.GetHtmlByUrl(citys[area], nvc, Encoding.UTF8, ref cookiestr); } catch { continue; } } parser = new Parser(new Lexer(html)); NodeList listNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("id", "MoreInfoList1_DataGrid1"))); if (listNode != null && listNode.Count > 0) { TableTag table = listNode[0] as TableTag; for (int j = 1; j < table.RowCount; j++) { string prjName = string.Empty, buildUnit = string.Empty, bidUnit = string.Empty, bidMoney = string.Empty, code = string.Empty, bidDate = string.Empty, beginDate = string.Empty, endDate = string.Empty, bidType = string.Empty, specType = string.Empty, InfoUrl = string.Empty, msgType = string.Empty, bidCtx = string.Empty, prjAddress = string.Empty, remark = string.Empty, prjMgr = string.Empty, otherType = string.Empty, HtmlTxt = string.Empty; TableRow tr = table.Rows[j]; ATag aTag = tr.Columns[1].GetATag(); prjName = aTag.GetAttribute("title").GetReplace("【正在报名】,【报名结束】"); beginDate = tr.Columns[2].ToPlainTextString().GetDateRegex(); InfoUrl = "http://www.gxzbtb.cn" + aTag.Link; string htmldtl = string.Empty; try { htmldtl = this.ToolWebSite.GetHtmlByUrl(InfoUrl, Encoding.UTF8).GetJsString(); } catch { continue; } parser = new Parser(new Lexer(htmldtl)); NodeList dtlNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("td"), new HasAttributeFilter("id", "TDContent"))); if (dtlNode != null && dtlNode.Count > 0) { HtmlTxt = dtlNode.AsHtml(); bidCtx = HtmlTxt.GetReplace(new string[] { "<br/>", "<br />", "<br>" }, "\r\n").ToCtxString(); prjAddress = bidCtx.GetAddressRegex(); buildUnit = bidCtx.GetBuildRegex(); bidUnit = bidCtx.GetBidRegex(); bidMoney = bidCtx.GetMoneyRegex(); prjMgr = bidCtx.GetMgrRegex(); code = bidCtx.GetCodeRegex().GetCodeDel(); if (string.IsNullOrEmpty(bidUnit)) { parser = new Parser(new Lexer(HtmlTxt)); NodeList bidNode = parser.ExtractAllNodesThatMatch(new TagNameFilter("table")); if (bidNode != null && bidNode.Count > 0) { string ctx = string.Empty; TableTag bidTable = bidNode[0] as TableTag; for (int r = 0; r < bidTable.RowCount; r++) { for (int c = 0; c < bidTable.Rows[r].ColumnCount; c++) { if ((c + 1) % 2 == 0) { ctx += bidTable.Rows[r].Columns[c].ToNodePlainString() + "\r\n"; } else { ctx += bidTable.Rows[r].Columns[c].ToNodePlainString() + ":"; } } } bidUnit = ctx.GetBidRegex(); if (string.IsNullOrEmpty(bidMoney) || bidMoney == "0") { bidMoney = ctx.GetMoneyString().GetMoney("万元"); } if (string.IsNullOrEmpty(prjAddress)) { prjAddress = ctx.GetAddressRegex(); } if (string.IsNullOrEmpty(buildUnit)) { buildUnit = ctx.GetBuildRegex(); } if (string.IsNullOrEmpty(code)) { code = ctx.GetCodeRegex().GetCodeDel(); } if (bidUnit.Contains("推荐") || bidUnit.Contains("中标") || bidUnit.Contains("地址")) { bidUnit = string.Empty; } if (string.IsNullOrEmpty(bidUnit)) { if (bidTable.RowCount > 1) { ctx = string.Empty; for (int d = 0; d < bidTable.Rows[0].ColumnCount; d++) { ctx += bidTable.Rows[0].Columns[d].ToNodePlainString() + ":"; try { ctx += bidTable.Rows[1].Columns[d].ToNodePlainString() + "\r\n"; } catch { } } bidUnit = ctx.GetBidRegex(); if (string.IsNullOrEmpty(bidMoney) || bidMoney == "0") { bidMoney = ctx.GetMoneyString().GetMoney(); } if (string.IsNullOrEmpty(prjAddress)) { prjAddress = ctx.GetAddressRegex(); } if (string.IsNullOrEmpty(buildUnit)) { buildUnit = ctx.GetBuildRegex(); } if (string.IsNullOrEmpty(code)) { code = ctx.GetCodeRegex().GetCodeDel(); } } } } } try { if (decimal.Parse(bidMoney) > 10000) { bidMoney = (decimal.Parse(bidMoney) / 10000).ToString(); } } catch { } bidUnit = bidUnit.Replace("名称", "").Replace("单位", "").Replace("№", "").Replace("1", "").Replace("2", "").Replace("联合体", "").Replace("(", ""); if (bidUnit.Contains("公司")) { bidUnit = bidUnit.Remove(bidUnit.IndexOf("公司")) + "公司"; } if (bidUnit.Contains("研究院")) { bidUnit = bidUnit.Remove(bidUnit.IndexOf("研究院")) + "研究院"; } if (bidUnit.Contains("研究所")) { bidUnit = bidUnit.Remove(bidUnit.IndexOf("研究所")) + "研究所"; } bidType = "水利工程"; specType = "建设工程"; msgType = "广西壮族自治区公共资源交易中心"; BidInfo info = ToolDb.GenBidInfo("广西壮族自治区", "广西壮族自治区及地市", area, string.Empty, code, prjName, buildUnit, beginDate, bidUnit, beginDate, endDate, bidCtx, string.Empty, msgType, bidType, specType, otherType, bidMoney, InfoUrl, prjMgr, HtmlTxt); list.Add(info); count++; parser = new Parser(new Lexer(HtmlTxt)); NodeList aNode = parser.ExtractAllNodesThatMatch(new TagNameFilter("a")); if (aNode != null && aNode.Count > 0) { for (int k = 0; k < aNode.Count; k++) { ATag a = aNode[k] as ATag; if (a.IsAtagAttach()) { string link = string.Empty; if (a.Link.ToLower().Contains("http")) { link = a.Link; } else { link = "http://www.gxzbtb.cn/" + a.Link.GetReplace("../,./"); } if (Encoding.Default.GetByteCount(link) > 500) { continue; } BaseAttach attach = ToolDb.GenBaseAttach(a.LinkText, info.Id, link); base.AttachList.Add(attach); } } } if (!crawlAll && count >= this.MaxCount) { goto Funcs; } } } } } Funcs :; } return(list); }
protected void LoadSuggestionLines() { int lineCount = 0; List <Item> items = new List <Item>(); List <string> selectedItem = new List <string>(); ItemNo = Convert.ToString(Request.QueryString["ItemNo"]); RowNo = Convert.ToString(Request.QueryString["RowNo"]); SuggestionOption = ddlSuggestionOptions.SelectedIndex; items = cs.GetSuggestedSimilarItems(ItemNo, SuggestionOption); if (Session[ItemNo] != null) { selectedItem = (List <string>)Session[ItemNo]; TableRow originalRow = new TableRow(); TableCell originalNo = new TableCell(); TableCell originalDesc = new TableCell(); TableCell originalCost = new TableCell(); originalNo.Text = selectedItem[0]; originalDesc.Text = selectedItem[1]; originalCost.Text = "$ " + selectedItem[2]; originalCost.HorizontalAlign = HorizontalAlign.Right; originalRow.Cells.Add(originalNo); originalRow.Cells.Add(originalDesc); originalRow.Cells.Add(originalCost); tblOriginalItem.Rows.Add(originalRow); } foreach (Item item in items) { lineCount++; TableRow singleRow = new TableRow(); TableCell no = new TableCell(); TableCell desc = new TableCell(); TableCell unitPrice = new TableCell(); TableCell select = new TableCell(); Button btnSelect = new Button { ID = "btnSelect_" + lineCount.ToString(), Text = "Select", OnClientClick = "return SetSuggestedItem('" + item.ItemNo + "', '" + RowNo + "')" }; no.ID = "itemNo_" + lineCount.ToString(); desc.ID = "desc_" + lineCount.ToString(); unitPrice.ID = "unitPrice_" + lineCount.ToString(); select.ID = "select_" + lineCount.ToString(); no.Text = item.ItemNo; desc.Text = item.Description; unitPrice.Text = "$ " + item.UnitPrice.ToString(); unitPrice.HorizontalAlign = HorizontalAlign.Right; select.Controls.Add(btnSelect); singleRow.Cells.Add(no); singleRow.Cells.Add(desc); singleRow.Cells.Add(unitPrice); singleRow.Cells.Add(select); if (lineCount % 2 == 0) { singleRow.BackColor = Color.White; } else { singleRow.BackColor = ColorTranslator.FromHtml("#EFF3FB"); } tblSuggestedSimilarItems.Rows.Add(singleRow); } }
protected void Page_Load(object sender, EventArgs e) { try { int id = Convert.ToInt32(Request.QueryString["Id"]); int locationid = Convert.ToInt32(Request.QueryString["location"]); if (Request.QueryString["Id"] != null && Request.QueryString["location"] != null) { Entities.Register.SalesReturnRegister sq = new Entities.Register.SalesReturnRegister(); sq = Entities.Register.SalesReturnRegister.GetDetails(id, locationid); dynamic setting = Entities.Application.Settings.GetFeaturedSettings(); lblCurrency.Text = Convert.ToString(setting.CurrencySymbol); Entities.Master.Company c = new Entities.Master.Company(); c = Entities.Master.Company.GetDetailsByLocation(locationid); imgLogo.ImageUrl = "data:image/jpeg;base64, " + c.LogoBase64; //lblCustName.Text = sq.CustomerName; lblCompRegId.Text = sq.CompanyRegId; lblLocRegId.Text = sq.LocationRegId; lblCity.Text = c.City; lblCompState.Text = c.State; lblCompCountry.Text = c.Country; lblCustState.Text = sq.CustomerState; lblCustCountry.Text = sq.CustomerCountry; lblCustTaxNo.Text = sq.CustomerTaxNo; lblCustAddr1.Text = sq.CustomerAddress; lblCustAddr2.Text = sq.CustomerAddress2; lblComp.Text = sq.Company; lblCompAddr1.Text = c.Address1; lblCompAddr2.Text = c.Address2; lblCompPh.Text = c.MobileNo1; lblCompRegId.Text = c.RegId1; lblCustPhone.Text = sq.ContactNo; lblLocName.Text = sq.Location; lblLocAddr1.Text = sq.LocationAddress1; lblLocAddr2.Text = sq.LocationAddress2; lblLocPhone.Text = sq.LocationPhone; lblDate.Text = sq.EntryDateString; //lblInvoiceNo.Text = sq.CreditNoteNumber; lblTotal.Text = Convert.ToString(sq.Gross); lblTax.Text = Convert.ToString(sq.TaxAmount); lblNet.Text = Convert.ToString(sq.NetAmount); lblroundOff.Text = Convert.ToString(sq.RoundOff); tAndC.Text = Entities.Application.Settings.GetSetting(115); for (int i = 0; i < sq.Products.Count; i++) { TableRow r = new TableRow(); TableCell t1 = new TableCell(); t1.Text = (i + 1).ToString(); r.Cells.Add(t1); TableCell t2 = new TableCell(); t2.Text = sq.Products[i].ItemCode; r.Cells.Add(t2); TableCell t3 = new TableCell(); t3.Text = sq.Products[i].Name; r.Cells.Add(t3); TableCell t4 = new TableCell(); t4.Text = sq.Products[i].MRP.ToString(); r.Cells.Add(t4); TableCell t5 = new TableCell(); t5.Text = sq.Products[i].SellingPrice.ToString(); r.Cells.Add(t5); TableCell t6 = new TableCell(); t6.Text = sq.Products[i].Quantity.ToString(); r.Cells.Add(t6); TableCell t7 = new TableCell(); t7.Text = sq.Products[i].Gross.ToString(); r.Cells.Add(t7); TableCell t8 = new TableCell(); t8.Text = sq.Products[i].TaxPercentage.ToString(); r.Cells.Add(t8); if (c.StateId == sq.CustStateId) { TableCell t9 = new TableCell(); t9.Text = (Convert.ToDecimal(sq.Products[i].TaxAmount) / 2).ToString(); r.Cells.Add(t9); TableCell t10 = new TableCell(); t10.Text = (Convert.ToDecimal(sq.Products[i].TaxAmount) / 2).ToString(); r.Cells.Add(t10); TableCell t11 = new TableCell(); t11.Text = "0.00"; r.Cells.Add(t11); } else { TableCell t9 = new TableCell(); t9.Text = "0.00"; r.Cells.Add(t9); TableCell t10 = new TableCell(); t10.Text = "0.00"; r.Cells.Add(t10); TableCell t11 = new TableCell(); t11.Text = sq.Products[i].TaxAmount.ToString(); r.Cells.Add(t11); } TableCell t12 = new TableCell(); t12.Text = sq.Products[i].NetAmount.ToString(); r.Cells.Add(t12); listTable.Rows.Add(r); } } } catch (Exception ex) { Entities.Application.Helper.LogException(ex, "quote | Page_Load(object sender, EventArgs e)"); Response.Write("<script> alert('" + ex.Message + "') </script>"); } }
protected void Page_Load(object sender, EventArgs e) { /*using (TPP bd = new TPP()) * { * * }*/ /*TPP bd = new TPP(); * bd.Materials.Add(new Material() * { * Assortment = "erhrh", * DesignOfStandard = "htdfdh", * Name = "rth", * Stamp = "hfhrfr" * }); * bd.SaveChanges();*/ TPP bd = new TPP(); SPSite site = SPControl.GetContextSite(Context); SPWeb web = site.OpenWeb(); /*SPListCollection collList = web.Lists; * * foreach (var oList in collList) * { * Console.WriteLine("Title: {0} Created: {1}", oList., oList.Created.ToString()); * }*/ //SPUser developer = web.Users.GetByID(route.NameOfDeveloper); //cell4.Text = developer.LoginName; SPGroupCollection collGroups = web.Groups; foreach (SPGroup oGroup in collGroups) { foreach (SPUser user in oGroup.Users) { routeNameOfDeveloper.Items.Add( new ListItem(user.LoginName, user.ID.ToString())); routeCardAgreed.Items.Add( new ListItem(user.LoginName, user.ID.ToString())); routeCardApproved.Items.Add( new ListItem(user.LoginName, user.ID.ToString())); routeCardChecked.Items.Add( new ListItem(user.LoginName, user.ID.ToString())); routeCardDeveloper.Items.Add( new ListItem(user.LoginName, user.ID.ToString())); routeCardNormController.Items.Add( new ListItem(user.LoginName, user.ID.ToString())); } } //add materials foreach (var mat in bd.Materials) { //fill dropdowns technologicalProcessMaterial.Items.Add( new ListItem(mat.MaterialId.ToString(), mat.MaterialId.ToString())); TableRow row = new TableRow(); TableCell cell1 = new TableCell(); cell1.Text = mat.MaterialId.ToString(); row.Cells.Add(cell1); TableCell cell2 = new TableCell(); cell2.Text = mat.Assortment; row.Cells.Add(cell2); TableCell cell3 = new TableCell(); cell3.Text = mat.Name; row.Cells.Add(cell3); TableCell cell4 = new TableCell(); cell4.Text = mat.Stamp; row.Cells.Add(cell4); TableCell cell5 = new TableCell(); cell5.Text = mat.DesignOfStandard; row.Cells.Add(cell5); Button button = new Button(); button.Text = "Delete"; button.Click += (s, e1) => { TPP lbd = new TPP(); lbd.Materials.Attach(mat); lbd.Entry(mat).State = System.Data.Entity.EntityState.Deleted; lbd.SaveChanges(); Response.Redirect(Request.RawUrl); }; TableCell cell6 = new TableCell(); cell6.Controls.Add(button); row.Cells.Add(cell6); materials.Rows.Add(row); } //fill Equipment table foreach (var eqip in bd.Equipments) { //add to dropdown operationEquipment.Items.Add( new ListItem(eqip.EquipmentId.ToString(), eqip.EquipmentId.ToString())); TableRow row = new TableRow(); TableCell cell1 = new TableCell(); cell1.Text = eqip.EquipmentId.ToString(); row.Cells.Add(cell1); TableCell cell2 = new TableCell(); cell2.Text = eqip.DetailNumber.ToString(); row.Cells.Add(cell2); TableCell cell3 = new TableCell(); cell3.Text = eqip.Name; row.Cells.Add(cell3); TableCell cell4 = new TableCell(); cell4.Text = eqip.Quantity.ToString(); row.Cells.Add(cell4); TableCell cell5 = new TableCell(); cell5.Text = eqip.Department; row.Cells.Add(cell5); Button button = new Button(); button.Text = "Delete"; button.Click += (s, e1) => { TPP lbd = new TPP(); lbd.Equipments.Attach(eqip); lbd.Entry(eqip).State = System.Data.Entity.EntityState.Deleted; lbd.SaveChanges(); Response.Redirect(Request.RawUrl); }; TableCell cell6 = new TableCell(); cell6.Controls.Add(button); row.Cells.Add(cell6); equipments.Rows.Add(row); } //add rigging foreach (var rig in bd.Riggings) { //add to dropdowns operationRigging.Items.Add( new ListItem(rig.RiggingId.ToString(), rig.RiggingId.ToString())); TableRow row = new TableRow(); TableCell cell1 = new TableCell(); cell1.Text = rig.RiggingId.ToString(); row.Cells.Add(cell1); TableCell cell2 = new TableCell(); cell2.Text = rig.Name; row.Cells.Add(cell2); TableCell cell3 = new TableCell(); cell3.Text = rig.TypeOfTool; row.Cells.Add(cell3); TableCell cell4 = new TableCell(); cell4.Text = rig.Quantity.ToString(); row.Cells.Add(cell4); Button button = new Button(); button.Text = "Delete"; button.Click += (s, e1) => { TPP lbd = new TPP(); lbd.Riggings.Attach(rig); lbd.Entry(rig).State = System.Data.Entity.EntityState.Deleted; lbd.SaveChanges(); Response.Redirect(Request.RawUrl); }; TableCell cell5 = new TableCell(); cell5.Controls.Add(button); row.Cells.Add(cell5); riggings.Rows.Add(row); } //fill operations table foreach (var oper in bd.Operations) { //add to dropdowns technologicalProcessOperation.Items.Add( new ListItem(oper.OperationId.ToString(), oper.OperationId.ToString())); TableRow row = new TableRow(); TableCell cell1 = new TableCell(); cell1.Text = oper.OperationId.ToString(); row.Cells.Add(cell1); TableCell cell2 = new TableCell(); cell2.Text = oper.Name; row.Cells.Add(cell2); TableCell cell3 = new TableCell(); cell3.Text = oper.Number.ToString(); row.Cells.Add(cell3); TableCell cell4 = new TableCell(); cell4.Text = oper.TransitionId.ToString(); row.Cells.Add(cell4); TableCell cell5 = new TableCell(); cell5.Text = oper.TransitionName; row.Cells.Add(cell5); TableCell cell6 = new TableCell(); cell6.Text = oper.EquipmentId.ToString(); row.Cells.Add(cell6); TableCell cell7 = new TableCell(); cell7.Text = oper.RiggingId.ToString(); row.Cells.Add(cell7); TableCell cell8 = new TableCell(); cell8.Text = oper.DepartmentNumber.ToString(); row.Cells.Add(cell8); TableCell cell9 = new TableCell(); cell9.Text = oper.SiteNumber.ToString(); row.Cells.Add(cell9); TableCell cell10 = new TableCell(); cell10.Text = oper.WorkplaceNumber.ToString(); row.Cells.Add(cell10); Button button = new Button(); button.Text = "Delete"; button.Click += (s, e1) => { TPP lbd = new TPP(); lbd.Operations.Attach(oper); lbd.Entry(oper).State = System.Data.Entity.EntityState.Deleted; lbd.SaveChanges(); Response.Redirect(Request.RawUrl); }; TableCell cell11 = new TableCell(); cell11.Controls.Add(button); row.Cells.Add(cell11); operations.Rows.Add(row); } //add transitions foreach (var trans in bd.Transitions) { //add to dropdowns operationTransition.Items.Add( new ListItem(trans.TransitionId.ToString(), trans.TransitionId.ToString())); TableRow row = new TableRow(); TableCell cell1 = new TableCell(); cell1.Text = trans.TransitionId.ToString(); row.Cells.Add(cell1); TableCell cell2 = new TableCell(); cell2.Text = trans.TransitionNumber.ToString(); row.Cells.Add(cell2); TableCell cell3 = new TableCell(); cell3.Text = trans.Keyword; row.Cells.Add(cell3); TableCell cell4 = new TableCell(); cell4.Text = trans.TransitionType; row.Cells.Add(cell4); Button button = new Button(); button.Text = "Delete"; button.Click += (s, e1) => { TPP lbd = new TPP(); lbd.Transitions.Attach(trans); lbd.Entry(trans).State = System.Data.Entity.EntityState.Deleted; lbd.SaveChanges(); Response.Redirect(Request.RawUrl); }; TableCell cell5 = new TableCell(); cell5.Controls.Add(button); row.Cells.Add(cell5); transitions.Rows.Add(row); } //fill TechnologicalProcesses foreach (var tp in bd.TechnologicalProcesseses) { //add to routes this.routeTechProc.Items.Add( new ListItem(tp.TechProcId.ToString(), tp.TechProcId.ToString())); TableRow row = new TableRow(); TableCell cell1 = new TableCell(); cell1.Text = tp.TechProcId.ToString(); row.Cells.Add(cell1); TableCell cell2 = new TableCell(); cell2.Text = tp.Name; row.Cells.Add(cell2); TableCell cell3 = new TableCell(); cell3.Text = tp.OperationId.ToString(); row.Cells.Add(cell3); TableCell cell4 = new TableCell(); cell4.Text = tp.MaterialId.ToString(); row.Cells.Add(cell4); TableCell cell5 = new TableCell(); cell5.Text = tp.TypeByExecution; row.Cells.Add(cell5); TableCell cell6 = new TableCell(); cell6.Text = tp.ActNumber.ToString(); row.Cells.Add(cell6); Button button = new Button(); button.Text = "Delete"; button.Click += (s, e1) => { TPP lbd = new TPP(); lbd.TechnologicalProcesseses.Attach(tp); lbd.Entry(tp).State = System.Data.Entity.EntityState.Deleted; lbd.SaveChanges(); Response.Redirect(Request.RawUrl); }; TableCell cell7 = new TableCell(); cell5.Controls.Add(button); row.Cells.Add(cell7); technologicalProcesses.Rows.Add(row); } //fill route foreach (var route in bd.Routes) { //add to route card this.routeCardRoute.Items.Add( new ListItem(route.RouteId.ToString(), route.RouteId.ToString())); TableRow row = new TableRow(); TableCell cell1 = new TableCell(); cell1.Text = route.RouteId.ToString(); row.Cells.Add(cell1); TableCell cell2 = new TableCell(); cell2.Text = route.TechProcId.ToString(); row.Cells.Add(cell2); TableCell cell3 = new TableCell(); cell3.Text = route.NameTechProc; row.Cells.Add(cell3); TableCell cell4 = new TableCell(); SPUserCollection users = web.SiteUsers; SPUser user = users.GetByID(route.NameOfDeveloper); //SPUser developer = web.Users.GetByID(route.NameOfDeveloper); //cell4.Text = developer.LoginName; //cell4.Text = route.NameOfDeveloper.ToString(); cell4.Text = user.LoginName; row.Cells.Add(cell4); TableCell cell5 = new TableCell(); cell5.Text = route.DetailsDesignation; row.Cells.Add(cell5); TableCell cell6 = new TableCell(); cell6.Text = route.DetailsName; row.Cells.Add(cell6); Button button = new Button(); button.Text = "Delete"; button.Click += (s, e1) => { TPP lbd = new TPP(); lbd.Routes.Attach(route); lbd.Entry(route).State = System.Data.Entity.EntityState.Deleted; lbd.SaveChanges(); Response.Redirect(Request.RawUrl); }; TableCell cell7 = new TableCell(); cell7.Controls.Add(button); row.Cells.Add(cell7); routes.Rows.Add(row); } //fill routeCard foreach (var rc in bd.RouteCars) { TableRow row = new TableRow(); TableCell cell1 = new TableCell(); cell1.Text = rc.RouteCarId.ToString(); row.Cells.Add(cell1); TableCell cell2 = new TableCell(); cell2.Text = rc.RouteId.ToString(); row.Cells.Add(cell2); TableCell cell3 = new TableCell(); cell3.Text = rc.CompanyName; row.Cells.Add(cell3); TableCell cell4 = new TableCell(); SPUserCollection users = web.SiteUsers; SPUser user = users.GetByID(rc.Developer); //cell4.Text = rc.Developer.ToString(); cell4.Text = user.LoginName; row.Cells.Add(cell4); TableCell cell5 = new TableCell(); //cell5.Text = rc.Checked.ToString(); user = users.GetByID(rc.Checked); cell5.Text = user.LoginName; row.Cells.Add(cell5); TableCell cell6 = new TableCell(); //cell6.Text = rc.Agreed.ToString(); user = users.GetByID(rc.Agreed); cell6.Text = user.LoginName; row.Cells.Add(cell6); TableCell cell7 = new TableCell(); //cell7.Text = rc.Approved.ToString(); user = users.GetByID(rc.Approved); cell7.Text = user.LoginName; row.Cells.Add(cell7); TableCell cell8 = new TableCell(); //cell8.Text = rc.NormСontroller.ToString(); user = users.GetByID(rc.NormСontroller); cell8.Text = user.LoginName; row.Cells.Add(cell8); Button button = new Button(); button.Text = "Delete"; button.Click += (s, e1) => { TPP lbd = new TPP(); lbd.RouteCars.Attach(rc); lbd.Entry(rc).State = System.Data.Entity.EntityState.Deleted; lbd.SaveChanges(); Response.Redirect(Request.RawUrl); }; TableCell cell9 = new TableCell(); cell9.Controls.Add(button); row.Cells.Add(cell9); routeCards.Rows.Add(row); } }
protected void btnSAVE_Click(object sender, EventArgs e) { foreach (TableRow row in tblCourse.Rows) { var cell = row.Cells[0]; foreach (Control control in cell.Controls) { var checkBox = control as CheckBox; if (checkBox != null) { if (checkBox.Checked == true) { CourseElectiveMember courseElectiveMember = new CourseElectiveMember(); courseElectiveMember.CourseElectiveMemberCode = new TQF.TQFUtility().getMaxID("COURSEELECTIVEMEMBERCODE", "COURSEELECTIVEMEMBER"); courseElectiveMember.CourseCode = row.Cells[5].Text; courseElectiveMember.CourseElectiveCode = code; courseElectiveMember.FacultyCode = facCreated; courseElectiveMember.FacultyOwner = ddlCURR_FACULTY.Items.FindByText(row.Cells[4].Text).Value; string courseElectiveMemberSave = new CourseElectiveMember().insertCourseElectiveMember(courseElectiveMember); if (courseElectiveMemberSave == "Success") { TableRow tRowBody = new TableRow(); tRowBody.TableSection = TableRowSection.TableBody; TableCell cellCourseCode = new TableCell(); string urlShow = "showCOURSE.aspx?token=" + courseElectiveMember.CourseCode; HyperLink hypShow = new HyperLink(); hypShow.Attributes.Add("data-target", "#showModal"); hypShow.Attributes.Add("data-toggle", "modal"); hypShow.Text = courseElectiveMember.CourseCode; hypShow.NavigateUrl = urlShow; hypShow.ToolTip = "Course details"; cellCourseCode.Controls.Add(hypShow); cellCourseCode.CssClass = "text-center"; cellCourseCode.Width = 80; tRowBody.Cells.Add(cellCourseCode); TQF.Course course = new TQF.Course().getCourse(code); TableCell cellCourseEnName = new TableCell(); cellCourseEnName.Text = course.CourseThName + "<br>" + course.CourseEnName; tRowBody.Cells.Add(cellCourseEnName); TableCell cellCredit = new TableCell(); cellCredit.Text = course.Credit + "(" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")"; tRowBody.Cells.Add(cellCredit); TableCell cellFacultyCode = new TableCell(); cellFacultyCode.Text = row.Cells[4].Text; cellFacultyCode.Width = 200; tRowBody.Cells.Add(cellFacultyCode); TableCell cellDel = new TableCell(); string urlDel = "deleteCOURSE.aspx?token=" + courseElectiveMember.CourseCode; HyperLink hypDel = new HyperLink(); hypDel.Attributes.Add("data-target", "#deleteModal"); hypDel.Attributes.Add("data-toggle", "modal"); hypDel.Text = "<h4><i class='fa fa-trash-o'></i></h4>"; hypDel.NavigateUrl = urlDel; hypDel.ToolTip = "Delete"; cellDel.Controls.Add(hypDel); cellDel.CssClass = "text-center"; cellDel.Width = 50; tRowBody.Cells.Add(cellDel); dummyRow.Add(tRowBody); //tblCourse.Rows.Add(tRowBody); } else { continue; } } else { continue; } } } } //Session["tblElectiveCourse"] = (List<TableRow>)dummyRow; //Response.Redirect("listCOURSEXXX.aspx"); Response.Redirect("editElective_COURSE.aspx?token=" + code + "&facultyId=" + facId + "&FacultyCreated=" + facCreated); }
private static Table genTable(List <CalcCore.CalcValueBase> calcVals, MainDocumentPart mainPart) { Table tableOfInputs = new Table(); var tableGrid = new TableGrid(); tableGrid.AppendChild(new GridColumn()); tableGrid.AppendChild(new GridColumn()); tableGrid.AppendChild(new GridColumn()); tableOfInputs.AppendChild(tableGrid); var tableProps = new TableProperties(); tableProps.AppendChild(new TableLayout() { Type = TableLayoutValues.Fixed }); tableProps.AppendChild(new TableWidth() { Width = "9000", Type = TableWidthUnitValues.Dxa }); tableProps.AppendChild(new TableBorders() { InsideHorizontalBorder = new InsideHorizontalBorder() { Color = "c0c0c0", Size = 4, Val = BorderValues.Single } }); tableProps.AppendChild(new TableBorders() { BottomBorder = new BottomBorder() { Color = "c0c0c0", Size = 4, Val = BorderValues.Single } }); tableProps.AppendChild(new TableBorders() { TopBorder = new TopBorder() { Color = "c0c0c0", Size = 4, Val = BorderValues.Single } }); //tableProps.AppendChild(new TableBorders() { LeftBorder = new LeftBorder() { Color = "c0c0c0", Size = 4, Val = BorderValues.Single } }); //tableProps.AppendChild(new TableBorders() { InsideVerticalBorder = new InsideVerticalBorder() { Color = "c0c0c0", Size = 4, Val = BorderValues.Single } }); //tableProps.AppendChild(new TableBorders() { RightBorder = new RightBorder() { Color = "c0c0c0", Size = 4, Val = BorderValues.Single } }); tableOfInputs.AppendChild(tableProps); foreach (var item in calcVals) { TableRow row = new TableRow(); var para1 = new Paragraph(); TableCell cell1 = new TableCell(); // insert symbol as image var parser = new TexFormulaParser(); if (item.Symbol != "") { TexFormula formulaToParse = new TexFormula(); try { parser = new TexFormulaParser(); formulaToParse = parser.Parse(item.Symbol); } catch (Exception) { parser = new TexFormulaParser(); formulaToParse = parser.Parse("Error in LaTeX string..."); } var formulaImage = formulaToParse.RenderToPng(100, 0, 0, "Franklin Gothic Book"); ImagePart imagePart = mainPart.AddImagePart(ImagePartType.Png); using (var stream = new MemoryStream(formulaImage)) { imagePart.FeedData(stream); var img = new BitmapImage(); img.BeginInit(); img.StreamSource = stream; img.CacheOption = BitmapCacheOption.OnLoad; img.EndInit(); img.Freeze(); var paraImage = AddImageToBody(mainPart.GetIdOfPart(imagePart), img.Width * 2.54 / 600, img.Height * 2.54 / 600); para1.AppendChild(new Run(paraImage)); } } else { para1.AppendChild(new Run(new Text(" "))); } //var myMath = new M.OfficeMath(new M.Run(new M.Text(item.Symbol) { Space = SpaceProcessingModeValues.Preserve })); //para1.AppendChild(myMath); //para1.AppendChild(new Run(new Text(" ") { Space = SpaceProcessingModeValues.Preserve })); cell1.Append(para1); cell1.Append(new TableCellProperties(new TableCellWidth() { Type = TableWidthUnitValues.Dxa, Width = "1200" })); var para2 = new Paragraph(new Run(new Text(item.Name))); TableCell cell2 = new TableCell(); cell2.AppendChild(para2); cell2.Append(new TableCellProperties(new TableCellWidth() { Type = TableWidthUnitValues.Dxa, Width = "6100" })); var para3 = new Paragraph(); if (item.Type == CalcValueType.DOUBLE) { // insert symbol as image parser = new TexFormulaParser(); string toRender = item.ValueAsString + item.Unit; if (toRender != "") { TexFormula formulaToParse = new TexFormula(); try { parser = new TexFormulaParser(); formulaToParse = parser.Parse(toRender); } catch (Exception) { parser = new TexFormulaParser(); formulaToParse = parser.Parse("Error in LaTeX string..."); } var formulaImage = formulaToParse.RenderToPng(100, 0, 0, "Franklin Gothic Book"); ImagePart imagePart = mainPart.AddImagePart(ImagePartType.Png); using (var stream = new MemoryStream(formulaImage)) { imagePart.FeedData(stream); var img = new BitmapImage(); img.BeginInit(); img.StreamSource = stream; img.CacheOption = BitmapCacheOption.OnLoad; img.EndInit(); img.Freeze(); var paraImage = AddImageToBody(mainPart.GetIdOfPart(imagePart), img.Width * 2.54 / 600, img.Height * 2.54 / 600); para3.AppendChild(new Run(paraImage)); } } else { para3.AppendChild(new Run(new Text(" "))); } //myMath = new DocumentFormat.OpenXml.Math.OfficeMath(new M.Run(new M.Text(item.ValueAsString + item.Unit) { Space = SpaceProcessingModeValues.Preserve })); //para3.AppendChild(myMath); //para3.AppendChild(new Run(new Text(" ") { Space = SpaceProcessingModeValues.Preserve })); } else if (item.Type == CalcValueType.SELECTIONLIST) { para3.AppendChild(new Run(new Text(item.ValueAsString))); } else { cell2.AppendChild(new Paragraph(new Run(new Text(item.ValueAsString)))); } TableCell cell3 = new TableCell(); cell3.Append(para3); cell3.Append(new TableCellProperties(new TableCellWidth() { Type = TableWidthUnitValues.Dxa, Width = "1700" })); row.Append(cell1, cell2, cell3); tableOfInputs.AppendChild(row); } return(tableOfInputs); }
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); }
protected void Page_Load(object sender, EventArgs e) { // Settings table TableHeaderRow headerRow = new TableHeaderRow(); headerRow.Cells.Add(new TableHeaderCell { Text = "Name" }); headerRow.Cells.Add(new TableHeaderCell { Text = "Value" }); Settings.Rows.AddAt(0, headerRow); TableRow row = new TableRow(); row.Cells.Add(new TableCell() { Text = "Start Time" }); row.Cells.Add(new TableCell() { Text = Statistics.StartTime.ToString() }); Settings.Rows.Add(row); row = new TableRow(); row.Cells.Add(new TableCell() { Text = "Requests Received" }); row.Cells.Add(new TableCell() { Text = Statistics.NumRequestsReceived.ToString() }); Settings.Rows.Add(row); row = new TableRow(); row.Cells.Add(new TableCell() { Text = "Requests Inserted" }); row.Cells.Add(new TableCell() { Text = Statistics.NumRequestsInserted.ToString() }); Settings.Rows.Add(row); row = new TableRow(); row.Cells.Add(new TableCell() { Text = "Authenticated Tokens in Cache" }); row.Cells.Add(new TableCell() { Text = String.Format("{0} / {1}", AuthTokenCache.Instance.Count, AuthTokenCache.Instance.MaxSize) }); Settings.Rows.Add(row); row = new TableRow(); row.Cells.Add(new TableCell() { Text = "Last Cache Purge" }); row.Cells.Add(new TableCell() { Text = AuthTokenCache.Instance.LastPurge == null ? "N/A" : AuthTokenCache.Instance.LastPurge.ToString() }); Settings.Rows.Add(row); row = new TableRow(); row.Cells.Add(new TableCell() { Text = "Authentication Token Cache - Sliding Expiration (mins)" }); row.Cells.Add(new TableCell() { Text = AuthTokenCache.Instance.SlidingExpirationMinutes.ToString() }); Settings.Rows.Add(row); row = new TableRow(); row.Cells.Add(new TableCell() { Text = "Unauthenticated Requests (not incl in Requests Received)" }); row.Cells.Add(new TableCell() { Text = Statistics.Instance.UnauthenticatedRequests.ToString() }); Settings.Rows.Add(row); }
protected void Page_Load(object sender, EventArgs e) { if (Session["products"] != null) { Table tbl = new Table(); tbl.ID = "OrderSummaryTbl"; tbl.CssClass = "tblOrder"; tbl.Width = 700; TableHeaderRow tblHeader = new TableHeaderRow(); TableHeaderCell tblHeaderCell = new TableHeaderCell(); tblHeaderCell.Text = "Shopping Cart Summary: "; tblHeaderCell.ColumnSpan = 5; tblHeader.Cells.Add(tblHeaderCell); tbl.Rows.Add(tblHeader); TableRow row = new TableRow(); TableRow rowTotal = new TableRow(); TableCell header1 = new TableCell(); TableCell header2 = new TableCell(); TableCell header3 = new TableCell(); TableCell header4 = new TableCell(); TableCell header6 = new TableCell(); TableCell totalPrice = new TableCell(); double sumTotal = 0; header1.Text = "<span class=\"tableHeader\">Name</span>"; header2.Text = "<span class=\"tableHeader\">ID</span>"; header3.Text = "<span class=\"tableHeader\">Size</span>"; header4.Text = "<span class=\"tableHeader\">Price</span>"; header6.Text = " "; row.Cells.Add(header1); row.Cells.Add(header2); row.Cells.Add(header3); row.Cells.Add(header4); row.Cells.Add(header6); tbl.Rows.Add(row); int i = 0; items = (ArrayList)Session["products"]; foreach (ArrayList item in items) { LinkButton link = new LinkButton(); link.Attributes.Add("runat", "server"); link.Text = "Delete"; link.ID = i.ToString(); CommandEventArgs comm = new CommandEventArgs("num", item[1]); CommandEventArgs comm2 = new CommandEventArgs("num", item[2]); link.Click += delegate { LinkButton1_Click(sender, comm, comm2); }; //link.CommandArgument = i.ToString(); i++; TableCell cell1 = new TableCell(); TableCell cell2 = new TableCell(); TableCell cell3 = new TableCell(); TableCell cell4 = new TableCell(); TableCell cell6 = new TableCell(); TableRow row2 = new TableRow(); string id = (string)item[1]; string size = (string)item[2]; double sum = Convert.ToDouble(item[3]) * Convert.ToDouble(item[4]); string price = String.Format("{0:0.00}", Convert.ToDouble(item[4])); string total = String.Format("{0:0.00}", sum); cell1.Text = "<a href=\"ProductInfo_Antibody.aspx?Product_Number=" + item[1].ToString() + " \" >" + item[0].ToString() + "</a>"; cell2.Text = item[1].ToString(); cell3.Text = item[2].ToString(); cell4.Text = "$" + price.ToString(); cell6.Controls.Add(link); row2.Cells.Add(cell1); row2.Cells.Add(cell2); row2.Cells.Add(cell3); row2.Cells.Add(cell4); row2.Cells.Add(cell6); sumTotal = sumTotal + Convert.ToDouble(item[4]); tbl.Rows.Add(row2); } TableCell c1 = new TableCell(); TableCell c2 = new TableCell(); TableCell c3 = new TableCell(); TableCell c4 = new TableCell(); totalPrice.Text = "<span>Total:</span> $" + sumTotal.ToString() + ".00"; totalPrice.ColumnSpan = 2; rowTotal.Cells.Add(c1); rowTotal.Cells.Add(c2); rowTotal.Cells.Add(c3); rowTotal.Cells.Add(totalPrice); HyperLink checkout = new HyperLink(); checkout.Text = "Checkout"; checkout.NavigateUrl = "/OrderForm.aspx"; checkout.CssClass = "checkoutButton"; tbl.CellSpacing = 5; tbl.Rows.Add(rowTotal); OrderSummary.Controls.Add(tbl); OrderSummary.Controls.Add(checkout); } else { CartMessage.Text = "Your Shopping Cart is Empty"; } }
public void HelloWorld(Int32 SurahNr) { var basmala = @"بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ"; string docName = @"C:\Data\surah-" + SurahNr + ".docx"; // Create a Wordprocessing document. using (WordprocessingDocument mydoc = WordprocessingDocument.Create(docName, WordprocessingDocumentType.Document)) { // Add a new main document part. MainDocumentPart mainPart = mydoc.AddMainDocumentPart(); //Create DOM tree for simple document. mainPart.Document = new Document(); Body body = new Body(); Paragraph p = new Paragraph(); ParagraphProperties pp = p.ChildElements.First <ParagraphProperties>(); if (pp == null) { pp = new ParagraphProperties(); p.Append(pp); //p.InsertBefore(pp, p.First()); } BiDi bidi = new BiDi(); pp.Append(bidi); Run r = new Run(); Text t; // = new Text(ayah.AyahText); Table table = new Table(); //Quran ayah; using (var context = new DBEntities()) { TableProperties props = new TableProperties( new TableBorders( new TopBorder { Val = new EnumValue <BorderValues>(BorderValues.Single), Size = 12 }, new BottomBorder { Val = new EnumValue <BorderValues>(BorderValues.Single), Size = 11 }, new LeftBorder { Val = new EnumValue <BorderValues>(BorderValues.Single), Size = 11 }, new RightBorder { Val = new EnumValue <BorderValues>(BorderValues.Single), Size = 11 }, new InsideHorizontalBorder { Val = new EnumValue <BorderValues>(BorderValues.Single), Size = 11 }, new InsideVerticalBorder { Val = new EnumValue <BorderValues>(BorderValues.Single), Size = 11 })); table.AppendChild <TableProperties>(props); //var ayah = context.Qurans.Where(q => q.SuraID == 112 && q.VerseID == 2).FirstOrDefault<Quran>(); var ayah = from a in context.Qurans where a.SuraID.Equals(SurahNr) select a; foreach (var a in ayah) { var tr = new TableRow(); var ayahT = a.AyahText; if (a.VerseID == 1) { ayahT = ayahT.Remove(0, basmala.Length); } var tc = new TableCell(); tc.Append(new Paragraph(new Run(new Text(ayahT)))); //var p2 = new Paragraph(); //pp = p2.ChildElements.First<ParagraphProperties>(); //if (pp == null) //{ // pp = new ParagraphProperties(); // p.Append(pp); // //p.InsertBefore(pp, p.First()); //} //bidi = new BiDi(); //pp.Append(bidi); //r = new Run(); //t = new Text(a.AyahText); //tc.Append(p2); //tc.Append(new Paragraph(new Run(new Text(a.VerseID.ToString())))); tr.Append(tc); tc = new TableCell(); //tc.Append(new Paragraph(new Run(new Text(a.AyahText)))); tc.Append(new Paragraph(new Run(new Text(a.VerseID.ToString())))); //p2 = new Paragraph(); //pp = p2.ChildElements.First<ParagraphProperties>(); //if (pp == null) //{ // pp = new ParagraphProperties(); // p.Append(pp); // //p.InsertBefore(pp, p.First()); //} //bidi = new BiDi(); //pp.Append(bidi); //r = new Run(); //t = new Text(a.VerseID.ToString()); //tc.Append(p2); tr.Append(tc); table.Append(tr); //t = new Text(a.VerseID + ": " + a.AyahText); //r.Append(t); //r.AppendChild(new Break()); } } //Append elements appropriately. //r.Append(t); p.Append(r); body.Append(table); body.Append(p); mainPart.Document.Append(body); // Save changes to the main document part. mainPart.Document.Save(); // Save changes to the main document part. mydoc.MainDocumentPart.Document.Save(); } }
private static Table genFormulaeTable(List <Formula> formulae, MainDocumentPart mainPart) { Table tableOfInputs = new Table(); var tableGrid = new TableGrid(); tableGrid.AppendChild(new GridColumn()); tableGrid.AppendChild(new GridColumn()); tableGrid.AppendChild(new GridColumn()); tableOfInputs.AppendChild(tableGrid); var tableProps = new TableProperties(); tableProps.AppendChild(new TableLayout() { Type = TableLayoutValues.Fixed }); tableProps.AppendChild(new TableWidth() { Width = "9000", Type = TableWidthUnitValues.Dxa }); tableProps.AppendChild(new TableBorders() { InsideHorizontalBorder = new InsideHorizontalBorder() { Color = "c0c0c0", Size = 4, Val = BorderValues.Single } }); tableProps.AppendChild(new TableBorders() { BottomBorder = new BottomBorder() { Color = "c0c0c0", Size = 4, Val = BorderValues.Single } }); tableProps.AppendChild(new TableBorders() { TopBorder = new TopBorder() { Color = "c0c0c0", Size = 4, Val = BorderValues.Single } }); //tableProps.AppendChild(new TableBorders() { LeftBorder = new LeftBorder() { Color = "c0c0c0", Size = 4, Val = BorderValues.Single } }); //tableProps.AppendChild(new TableBorders() { InsideVerticalBorder = new InsideVerticalBorder() { Color = "c0c0c0", Size = 4, Val = BorderValues.Single } }); //tableProps.AppendChild(new TableBorders() { RightBorder = new RightBorder() { Color = "c0c0c0", Size = 4, Val = BorderValues.Single } }); tableOfInputs.AppendChild(tableProps); foreach (var item in formulae) { TableRow row = new TableRow(); var para = new Paragraph(); para.AppendChild((new Run(new Text(item.Ref)))); TableCell cell1 = new TableCell(); cell1.Append(para); cell1.Append(new TableCellProperties(new TableCellWidth() { Type = TableWidthUnitValues.Dxa, Width = "1200" })); TableCell cell2 = new TableCell(); cell2.Append(new TableCellProperties(new TableCellWidth() { Type = TableWidthUnitValues.Dxa, Width = "6100" })); cell2.AppendChild(new Paragraph(new Run(new Text(item.Narrative)))); //foreach (var formula in item.Expression) //{ // var mathPara = new Paragraph(); // var myMath = new M.OfficeMath(new M.Run(new M.Text(formula + Environment.NewLine) { Space = SpaceProcessingModeValues.Preserve })); // mathPara.AppendChild(myMath); // mathPara.AppendChild(new Run(new Text(" ") { Space = SpaceProcessingModeValues.Preserve })); // cell2.AppendChild(mathPara); //} foreach (var formula in item.Expression) { if (formula != "") { TexFormula formulaToParse = new TexFormula(); try { var parser = new TexFormulaParser(); formulaToParse = parser.Parse(formula); } catch (Exception) { var parser = new TexFormulaParser(); formulaToParse = parser.Parse("Error in LaTeX string..."); } var test = formulaToParse.GetRenderer(TexStyle.Script, 100, "Franklin Gothic Book"); if (test.RenderSize.Width > 0 && test.RenderSize.Height > 0) { var formulaImage = formulaToParse.RenderToPng(100, 0, 0, "Franklin Gothic Book"); ImagePart imagePart = mainPart.AddImagePart(ImagePartType.Png); using (var stream = new MemoryStream(formulaImage)) { imagePart.FeedData(stream); var img = new BitmapImage(); img.BeginInit(); img.StreamSource = stream; img.CacheOption = BitmapCacheOption.OnLoad; img.EndInit(); img.Freeze(); var paraImage = AddImageToBody(mainPart.GetIdOfPart(imagePart), img.Width * 2.54 / 600, img.Height * 2.54 / 600); cell2.AppendChild(new Paragraph(new Run(paraImage))); } } } //var myMath = new M.OfficeMath(new M.Run(new M.Text(formula + Environment.NewLine) { Space = SpaceProcessingModeValues.Preserve })); //mathPara.AppendChild(myMath); //mathPara.AppendChild(new Run(new Text(" ") { Space = SpaceProcessingModeValues.Preserve })); //cell2.AppendChild(mathPara); } if (item.Image != null) { ImagePart imagePart = mainPart.AddImagePart(ImagePartType.Png); var tempFile = Path.GetTempFileName(); PngBitmapEncoder png = new PngBitmapEncoder(); //CHANGEBITMAP //png.Frames.Add(BitmapFrame.Create(item.Image)); var width = Math.Min(10d, item.Image.Width * 2.54 / 96); var height = ((double)item.Image.Height / (double)item.Image.Width) * width; using (SkiaSharp.SKWStream stm = new SkiaSharp.SKFileWStream(tempFile)) { item.Image.Encode(stm, SkiaSharp.SKEncodedImageFormat.Png, 0); } using (FileStream stream = new FileStream(tempFile, FileMode.Open)) { imagePart.FeedData(stream); } var paraImage = AddImageToBody(mainPart.GetIdOfPart(imagePart), width, height); cell2.AppendChild(new Paragraph(new Run(paraImage))); } TableCell cell3 = new TableCell(); cell3.Append(new Paragraph(new Run(new Text(item.Conclusion)))); cell3.Append(new TableCellProperties(new TableCellWidth() { Type = TableWidthUnitValues.Dxa, Width = "1700" })); row.Append(cell1, cell2, cell3); tableOfInputs.AppendChild(row); } return(tableOfInputs); }
public void loadSerivceTypes() { try { List <ProductType> types = handler.getProductTypes(); types = types.OrderBy(o => o.name).ToList(); //check if there are outstanding orders if (types.Count > 0) { //if there are bookings desplay them //create a new row in the uppcoming bookings table and set the height TableRow newRow = new TableRow(); newRow.Height = 50; tblServiceTypes.Rows.Add(newRow); //create a header row and set cell withs TableHeaderCell newHeaderCell = new TableHeaderCell(); newHeaderCell.Text = "Name"; newHeaderCell.Width = 1000; tblServiceTypes.Rows[0].Cells.Add(newHeaderCell); //create a loop to display each result //creat a counter to keep track of the current row int rowCount = 1; foreach (ProductType type in types) { if (type.ProductOrService == 'S' && type.name.Replace(" ", string.Empty) != "Service" && type.name.Replace(" ", string.Empty) != "EmployeeLeave") { newRow = new TableRow(); newRow.Height = 50; tblServiceTypes.Rows.Add(newRow); //fill the row with the data from the results object TableCell newCell = new TableCell(); newCell.Text = "<a href='/Manager/Service.aspx?Action=EditType" + "&typeID=" + type.typeID.Replace(" ", string.Empty) + "'>" + type.name + "</a>"; tblServiceTypes.Rows[rowCount].Cells.Add(newCell); rowCount++; } } if (rowCount == 1) { // if there aren't let the user know lblServicetypes.Text = "<p> No Suppliers </p>"; tblServiceTypes.Visible = false; } else { // set the booking copunt lblServicetypes.Text = "<p> " + (rowCount - 1) + " Supliers </p>"; } } else { // if there aren't let the user know lblServicetypes.Text = "<p> No Suppliers </p>"; } } catch (Exception err) { function.logAnError("Error loading Service Types on internal service page | Error: " + err.ToString()); lblServicetypes.Visible = true; tblServiceTypes.Visible = false; lblServicetypes.Text = "<h2> An Error Occured Communicating With The Data Base, Try Again Later. </h2>"; } }
private void createLinksTable(int curPage) { pageCount = Convert.ToInt32(ViewState["pageCount"].ToString()); string sqlWhere = Server.UrlEncode(ViewState["sWhere"].ToString()); string sOrderBy = Server.UrlEncode(ViewState["sOrderBy"].ToString()); if (sqlWhere.Length > 1000) { Session["linkSqlWhere"] = ViewState["sWhere"].ToString(); sqlWhere = ""; } Table t1 = new Table(); Table t2 = new Table(); TableRow tr1 = new TableRow(); TableRow tr2 = new TableRow(); HyperLink lkPrev1 = new HyperLink(); HyperLink lkNext1 = new HyperLink(); HyperLink lkPrev2 = new HyperLink(); HyperLink lkNext2 = new HyperLink(); lkPrev1.CssClass = "regularGray"; lkNext1.CssClass = "regularGray"; lkPrev2.CssClass = "regularGray"; lkNext2.CssClass = "regularGray"; lkPrev1.EnableViewState = true; lkNext1.EnableViewState = true; lkPrev2.EnableViewState = true; lkNext2.EnableViewState = true; lkPrev1.Text = "<< Prev"; lkNext1.Text = "Next >>"; lkPrev2.Text = "<< Prev"; lkNext2.Text = "Next >>"; if (curPage < pageCount) { lkNext1.Visible = true; lkNext2.Visible = true; } else { lkNext1.Visible = false; lkNext2.Visible = false; } if (curPage > 1) { lkPrev1.Visible = true; lkPrev2.Visible = true; } else { lkPrev1.Visible = false; lkPrev2.Visible = false; } lkPrev1.NavigateUrl = "chameleon-memberResults.aspx?line=" + ViewState["sLine"] + "&heading=" + ViewState["sSearchHeading"] + "&pageNo=prev&curPage=" + curPage.ToString() + "&where=" + sqlWhere + "&sOrderBy=" + sOrderBy;; lkNext1.NavigateUrl = "chameleon-memberResults.aspx?line=" + ViewState["sLine"] + "&heading=" + ViewState["sSearchHeading"] + "&pageNo=next&curPage=" + curPage.ToString() + "&where=" + sqlWhere + "&sOrderBy=" + sOrderBy;; lkPrev2.NavigateUrl = "chameleon-memberResults.aspx?line=" + ViewState["sLine"] + "&heading=" + ViewState["sSearchHeading"] + "&pageNo=prev&curPage=" + curPage.ToString() + "&where=" + sqlWhere + "&sOrderBy=" + sOrderBy;; lkNext2.NavigateUrl = "chameleon-memberResults.aspx?line=" + ViewState["sLine"] + "&heading=" + ViewState["sSearchHeading"] + "&pageNo=next&curPage=" + curPage.ToString() + "&where=" + sqlWhere + "&sOrderBy=" + sOrderBy;; TableCell tcPrev = new TableCell(); TableCell tcNext = new TableCell(); TableCell tcPrev2 = new TableCell(); TableCell tcNext2 = new TableCell(); tcPrev.Controls.Add(lkPrev1); tcNext.Controls.Add(lkNext1); tcPrev2.Controls.Add(lkPrev2); tcNext2.Controls.Add(lkNext2); tr1.Cells.Add(tcPrev); tr2.Cells.Add(tcPrev2); int j = 0; for (int i = 1; i <= pageCount; i++, j++) { TableCell tc1 = new TableCell(); TableCell tc2 = new TableCell(); HyperLink lk1 = new HyperLink(); HyperLink lk2 = new HyperLink(); if (j == 20) { t1.Rows.Add(tr1); t2.Rows.Add(tr2); j = 0; tr1 = new TableRow(); tr2 = new TableRow(); } if (i == curPage) { lk1.CssClass = "linkRed"; lk2.CssClass = "linkRed"; } else { lk1.CssClass = "regularGray"; lk2.CssClass = "regularGray"; } lk1.Text = i.ToString(); lk2.Text = i.ToString(); lk1.NavigateUrl = "chameleon-memberResults.aspx?line=" + ViewState["sLine"] + "&heading=" + ViewState["sSearchHeading"] + "&pageNo=" + i.ToString() + "&where=" + sqlWhere + "&sOrderBy=" + sOrderBy;; lk2.NavigateUrl = "chameleon-memberResults.aspx?line=" + ViewState["sLine"] + "&heading=" + ViewState["sSearchHeading"] + "&pageNo=" + i.ToString() + "&where=" + sqlWhere + "&sOrderBy=" + sOrderBy;; if (pageCount == 1) { lk1.Visible = false; lk2.Visible = false; } else { lk1.Visible = true; lk2.Visible = true; } tc1.Controls.Add(lk1); tc2.Controls.Add(lk2); tr1.Cells.Add(tc1); tr2.Cells.Add(tc2); }// end for tr1.Cells.Add(tcNext); tr2.Cells.Add(tcNext2); t1.Rows.Add(tr1); t2.Rows.Add(tr2); phTopNav.Controls.Add(t1); phBottomNav.Controls.Add(t2); }
public void loadProductList() { try { //load a list of all products products = handler.getAllProducts(); //track row count & number of products cound int count = 0; if (products.Count > 0) { //disply the table headers //create a new row in the table and set the height TableRow newRow = new TableRow(); newRow.Height = 50; tblProductTable.Rows.Add(newRow); //create a header row and set cell withs //Product image row TableHeaderCell newHeaderCell = new TableHeaderCell(); newHeaderCell.Width = 100; tblProductTable.Rows[count].Cells.Add(newHeaderCell); //create a header row and set cell withs newHeaderCell = new TableHeaderCell(); newHeaderCell.Text = "Name: "; newHeaderCell.Width = 300; tblProductTable.Rows[count].Cells.Add(newHeaderCell); //create a header row and set cell withs newHeaderCell = new TableHeaderCell(); newHeaderCell.Text = "Description: "; newHeaderCell.Width = 500; tblProductTable.Rows[count].Cells.Add(newHeaderCell); newHeaderCell = new TableHeaderCell(); newHeaderCell.Width = 100; tblProductTable.Rows[count].Cells.Add(newHeaderCell); //increment rowcounter count++; foreach (PRODUCT prod in products) { //if the product maches the selected type //if product matches the tearm if ((function.compareToSearchTerm(prod.Name, txtProductSearchTerm.Text) == true || function.compareToSearchTerm(prod.ProductDescription, txtProductSearchTerm.Text) == true) && prod.ProductType[0] == 'S') { //diplay the product details //add a new row to the table newRow = new TableRow(); newRow.Height = 50; tblProductTable.Rows.Add(newRow); //image TableCell newCell = new TableCell(); //image display to be added here tblProductTable.Rows[count].Cells.Add(newCell); //Edit service link to be added by Sivu //view service link to be added by Lachea //Name newCell = new TableCell(); newCell.Text = "<a class='btn btn-default' href ='../cheveux/services.aspx?ProductID=" + prod.ProductID.ToString().Replace(" ", string.Empty) + "'>" + prod.Name + "</a>"; tblProductTable.Rows[count].Cells.Add(newCell); //Description newCell = new TableCell(); newCell.Text = "<a class='btn btn-default' href ='../cheveux/services.aspx?ProductID=" + prod.ProductID.ToString().Replace(" ", string.Empty) + "'>" + prod.ProductDescription + "</a> "; tblProductTable.Rows[count].Cells.Add(newCell); if (prod.Active[0] == 'Y') { newCell = new TableCell(); tblProductTable.Rows[count].Cells.Add(newCell); } else { newCell = new TableCell(); newCell.Text = "Inactive Service"; tblProductTable.Rows[count].Cells.Add(newCell); } //increment counter count++; } } } //result count productJumbotronLable.Text = count - 1 + " Services"; if (count - 1 == 0) { productJumbotronLable.ForeColor = System.Drawing.Color.Red; } else { productJumbotronLable.ForeColor = System.Drawing.Color.Black; } } catch (Exception Err) { function.logAnError(Err.ToString() + " An error occurred retrieving list of Services with tearm " + txtProductSearchTerm.Text + " in loadEmployeeList() method on Manager/Employee page"); productJumbotronLable.Font.Size = 22; productJumbotronLable.Font.Bold = true; productJumbotronLable.Text = "An error occurred retrieving employee details"; } }
protected override IList ExecuteCrawl(bool crawlAll) { IList list = new List <BidInfo>(); int pageInt = 1; string html = string.Empty; string viewState = string.Empty; string eventValidation = string.Empty; string cookiestr = string.Empty; try { html = this.ToolWebSite.GetHtmlByUrl(this.SiteUrl, Encoding.Default, ref cookiestr); } catch { return(list); } Parser parser = new Parser(new Lexer(html)); NodeList pageNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("span"), new HasAttributeFilter("id", "lblPageCount"))); if (pageNode != null && pageNode.Count > 0) { try { string temp = pageNode[0].ToNodePlainString(); pageInt = int.Parse(temp); } catch { } } for (int i = 1; i <= pageInt; i++) { if (i > 1) { viewState = this.ToolWebSite.GetAspNetViewState(html); eventValidation = this.ToolWebSite.GetAspNetEventValidation(html); NameValueCollection nvc = this.ToolWebSite.GetNameValueCollection(new string[] { "__EVENTTARGET", "__EVENTARGUMENT", "__LASTFOCUS", "__VIEWSTATE", "__VIEWSTATEGENERATOR", "__EVENTVALIDATION", "gcbh_Text_Box", "gcmc_TextBox", "num_TextBox", "ImageButton3.x", "ImageButton3.y" }, new string[] { "", "", "", viewState, "B0108473", eventValidation, "", "", "", "5", "12" }); try { html = this.ToolWebSite.GetHtmlByUrl(this.SiteUrl, nvc, Encoding.Default, ref cookiestr); } catch { continue; } } parser = new Parser(new Lexer(html)); NodeList listNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("id", "DataGrid1"))); if (listNode != null && listNode.Count > 0) { TableTag table = listNode[0] as TableTag; for (int j = 0; j < table.RowCount; j++) { TableRow tr = table.Rows[j]; ATag aTag = tr.Columns[2].GetATag(); if (aTag == null) { continue; } string prjName = string.Empty, buildUnit = string.Empty, bidUnit = string.Empty, bidMoney = string.Empty, code = string.Empty, bidDate = string.Empty, beginDate = string.Empty, endDate = string.Empty, bidType = string.Empty, specType = string.Empty, InfoUrl = string.Empty, msgType = string.Empty, bidCtx = string.Empty, prjAddress = string.Empty, remark = string.Empty, prjMgr = string.Empty, otherType = string.Empty, HtmlTxt = string.Empty; code = tr.Columns[1].ToNodePlainString(); prjName = aTag.LinkText.GetReplace(" "); beginDate = tr.Columns[3].ToPlainTextString().GetDateRegex(); InfoUrl = "http://www.bcactc.com/home/gcxx/" + aTag.Link; string htmldtl = string.Empty; try { htmldtl = this.ToolWebSite.GetHtmlByUrl(InfoUrl, Encoding.Default).GetJsString(); } catch { continue; } parser = new Parser(new Lexer(htmldtl)); NodeList dtlNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("class", "hei_text"))); if (dtlNode != null && dtlNode.Count > 0) { TableTag dtlTable = dtlNode[0] as TableTag; HtmlTxt = dtlTable.ToHtml(); for (int r = 0; r < dtlTable.RowCount; r++) { for (int c = 0; c < dtlTable.Rows[r].ColumnCount; c++) { string temp = dtlTable.Rows[r].Columns[c].ToHtml().GetReplace("<br>,<br/>", "\r\n").ToCtxString(); if (!temp.Contains("\r\n")) { temp = dtlTable.Rows[r].Columns[c].ToNodePlainString(); } if (!IsTable(dtlTable.Rows[r].ToHtml())) { if ((c + 1) % 2 == 0) { bidCtx += temp + "\r\n"; } else { bidCtx += temp.GetReplace(":,:") + ":"; } } else { bidCtx += GetTableBid(dtlTable.Rows[r].ToHtml()); } } } bidCtx = bidCtx.GetReplace(":\r\n", ":"); if (code.Contains("..")) { code = bidCtx.GetCodeRegex(); } buildUnit = bidCtx.GetBuildRegex(); if (string.IsNullOrEmpty(buildUnit)) { buildUnit = bidCtx.GetRegex("建设单位名称"); } bidUnit = bidCtx.GetBidRegex(); if (string.IsNullOrEmpty(bidUnit)) { bidUnit = bidCtx.GetRegex("中标侯选人"); } bidMoney = bidCtx.GetMoneyRegex(); prjMgr = bidCtx.GetMgrRegex(); msgType = "北京市建设工程发包承包交易中心"; specType = "建设工程"; bidType = "施工"; BidInfo info = ToolDb.GenBidInfo("北京市", "北京市区", "", string.Empty, code, prjName, buildUnit, beginDate, bidUnit, beginDate, endDate, bidCtx, string.Empty, msgType, bidType, specType, otherType, bidMoney, InfoUrl, prjMgr, HtmlTxt); list.Add(info); parser = new Parser(new Lexer(HtmlTxt)); NodeList aNode = parser.ExtractAllNodesThatMatch(new TagNameFilter("a")); if (aNode != null && aNode.Count > 0) { for (int k = 0; k < aNode.Count; k++) { ATag a = aNode[k] as ATag; if (a.IsAtagAttach()) { string link = string.Empty; if (a.Link.ToLower().Contains("http")) { link = a.Link; } else { link = "http://www.bcactc.com/" + a.Link; } BaseAttach attach = ToolDb.GenBaseAttach(a.LinkText, info.Id, link); base.AttachList.Add(attach); } } } if (!crawlAll && list.Count >= this.MaxCount) { return(list); } } } } } return(list); }