protected void Page_Load(object sender, EventArgs e) { //首先创建一个HtmlTable对象 HtmlTable table1 = new HtmlTable(); //设置HtmlTable的格式属性 table1.Border = 1; table1.CellPadding = 1; table1.CellSpacing = 1; table1.BorderColor = "red"; //下面的代码向HtmlTable添加内容 HtmlTableRow row; HtmlTableCell cell; for (int i = 1; i <= 5; i++) { // 创建一个新的行,并设置其背景色属性 row = new HtmlTableRow(); row.BgColor = (i % 2 == 0 ? "lightyellow" : "lightcyan"); for (int j = 1; j <= 4; j++) { //创建一个新的列,为其设置文本 cell = new HtmlTableCell(); cell.InnerHtml = "行: " + i.ToString() + "<br />列: " + j.ToString(); //添加列对象到当前的行 row.Cells.Add(cell); } //添加行对象到当前的Htmltable table1.Rows.Add(row); } //添加HtmlTable到当前页的控件集合中 this.Controls.Add(table1); }
protected override void OnInit(EventArgs e) { string filename = Server.MapPath("settings.xml"); XPathDocument document = new XPathDocument(filename); XPathNavigator navigator = document.CreateNavigator(); XPathExpression expression = navigator.Compile("/appSettings/*"); XPathNodeIterator iterator = navigator.Select(expression); HtmlTable table = new HtmlTable(); HtmlTableRow row = new HtmlTableRow(); HtmlTableCell cell = new HtmlTableCell(); string tooltip = ""; try { while (iterator.MoveNext()) { tooltip = ""; row = new HtmlTableRow(); cell = new HtmlTableCell(); XPathNavigator navigator2 = iterator.Current.Clone(); Label label = new Label(); label.ID = navigator2.Name + "Label"; label.Text = navigator2.GetAttribute("name", navigator2.NamespaceURI); tooltip = navigator2.GetAttribute("description", navigator2.NamespaceURI); Control c = null; if (label.ID != "") { c = new TextBox(); c.ID = navigator2.GetAttribute("name", navigator2.NamespaceURI) + "Textbox"; (c as TextBox).Text = navigator2.Value; (c as TextBox).ToolTip = tooltip; (c as TextBox).Width = 700; (c as TextBox).TextMode = TextBoxMode.MultiLine; label.ToolTip = tooltip; } cell.Controls.Add(label); row.Cells.Add(cell); cell = new HtmlTableCell(); cell.Controls.Add(c); row.Cells.Add(cell); controls.Add(new ControlListItem(navigator2.Name, c.ID)); table.Rows.Add(row); } } catch (Exception ex) { FormMessage.ForeColor = Color.Red; FormMessage.Text = ex.Message; } ControlsPanel.Controls.Add(table); base.OnInit(e); }
/// <summary> /// select the table to show from the db and build the table in the page /// </summary> protected void ShowCampaignTable() { Campaign cam = new Campaign(); List<Campaign> campaigns = cam.GetCampaignList(email); foreach (Campaign c in campaigns) { HtmlTableRow tr = new HtmlTableRow(); HtmlTableCell tc = new HtmlTableCell(); HtmlTableCell tc1 = new HtmlTableCell(); HtmlTableCell tc2 = new HtmlTableCell(); HtmlTableCell tc3 = new HtmlTableCell(); HtmlTableCell tc4 = new HtmlTableCell(); HtmlTableCell tc5 = new HtmlTableCell(); tc.InnerHtml = c.Name; tc1.InnerHtml = c.DateCreated.ToString(); tc2.InnerHtml = c.Id.ToString(); tc3.InnerHtml = c.Voucher; tc4.InnerHtml = c.ShareCount.ToString(); if (c.IsActive == true) tc5.InnerHtml = "פעיל"; else tc5.InnerHtml = "לא פעיל"; tr.Cells.Add(tc); tr.Cells.Add(tc1); tr.Cells.Add(tc2); tr.Cells.Add(tc3); tr.Cells.Add(tc4); tr.Cells.Add(tc5); campaignsData.Controls.Add(tr); } }
private static HtmlTableCell AddControl(JobControl_Get_Result control) { HtmlTableCell cell = new HtmlTableCell(); Control c = new Control(); switch (control.ControlTypeName) { case "TextBox": c = new TextBox(); c.ID = control.JobControlID + control.ControlTypeName + control.ControlName; break; case "CheckBox": c = new CheckBox(); c.ID = control.JobControlID + control.ControlTypeName + control.ControlName; break; case "ImageUpload": c = new FileUpload(); c.ID = control.JobControlID + control.ControlTypeName + control.ControlName; break; } cell.Controls.Add(c); return cell; }
public void ContHTML() { for (int i = 0; i < ContListName.Count; i ++ ) { name[i] = ContListName[i] + "<span onclick=ContDelId('" + ContListIdType[i] + "')>" + "</span>"; img[i] = "<input type=image onserverclick=Del_ServerClick src=\\ICBCDynamicSite\\site\\Fund\\Bmp\\FundCompare\\button_delete_off.gif />"; ShowAlert(name[i]); ShowAlert(img[i]); } HtmlTable table = new HtmlTable(); table.Border = 0; table.CellPadding = 0; for (int rowcount = 0; rowcount < name.Length; rowcount ++ ) { HtmlTableRow row = new HtmlTableRow(); HtmlTableCell cell1 = new HtmlTableCell(); HtmlTableCell cell2 = new HtmlTableCell(); cell1.ColSpan = 2; cell1.Align = "Left"; cell2.Align = "Right"; cell1.Controls.Add(new LiteralControl(name[rowcount])); cell2.Controls.Add(new LiteralControl(name[rowcount])); row.Cells.Add(cell1); row.Cells.Add(cell2); table.Rows.Add(row); } Place.Controls.Clear(); Place.Controls.Add(table); }
private HtmlTableCell AddSiteCellInnerHTML(string name, string banner, string url) { HtmlTableCell cell = new HtmlTableCell(); Panel pnl = new Panel(); pnl.CssClass = "sitesbanerhome"; if(IsSitePage) { pnl.CssClass = "sitespagebaner"; } HyperLink hl = new HyperLink(); hl.NavigateUrl = url; hl.Attributes["rel"] = "nofollow"; hl.Target = "_blank"; if (banner != "") { Image i = new Image(); i.ImageUrl = Path.Combine(Utils.GaleryImagePath, banner); hl.Controls.Add(i); } else { hl.Text = name; } pnl.Controls.Add(hl); cell.Controls.Add(pnl); return cell; }
private void AddItem(string prtName, string val) { var tr = new HtmlTableRow(); var td=new HtmlTableCell(); int rc=tbprt.Rows.Count; if (rc > 0)//如果存在行 { if (tbprt.Rows[rc - 1].Cells.Count == 4)//如果最后行已满 { tbprt.Rows.Add(tr);//直接添加一个新行 } else { tr = tbprt.Rows[rc - 1];//将tr设为最后的行 } } else {//如果还没有行 tbprt.Rows.Add(tr); } td.InnerText = prtName; td.Attributes["class"] = "fieldHead"; tr.Cells.Add(td); td = new HtmlTableCell(); td.InnerText = val; tr.Cells.Add(td); }
public string RenderAccounts(TransitAccount[] accounts) { HtmlTable table = new HtmlTable(); table.Border = 0; table.BorderColor = "White"; HtmlTableRow row = new HtmlTableRow(); table.Rows.Add(row); foreach (TransitAccount ta in accounts) { HtmlTableCell cell = new HtmlTableCell(); cell.Controls.Add(new LiteralControl(string.Format( "<div><a href='AccountView.aspx?id={0}'>" + "<img border=0 style='width: 50%;' src='AccountPictureThumbnail.aspx?id={1}'></a></div>" + "<div class=sncore_link><a href='AccountView.aspx?id={0}'>{2}</a>", ta.Id, ta.PictureId, Render(ta.Name)))); row.Cells.Add(cell); if (row.Cells.Count % 4 == 0) { row = new HtmlTableRow(); table.Rows.Add(row); } } StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); table.RenderControl(new HtmlTextWriter(sw)); return sb.ToString(); }
/// <summary> /// Render object in html cell /// </summary> /// <param name="value">Object to render</param> /// <returns>Html table cell</returns> public override HtmlTableCell Render(object value) { var editWithList = (EditWithList)this.Property.GetValue(value); var result = new HtmlTableCell(); result.InnerHtml += "<select class=\"chosen\">"; var selectedOption = string.Empty; if (!string.IsNullOrEmpty(editWithList.SelectedValue)) { editWithList.List.TryGetValue(editWithList.SelectedValue, out selectedOption); } foreach (var option in editWithList.List) { if (option.Value == selectedOption) { result.InnerHtml += string.Format("<option selected=\"selected\" value=\"{0}\">{1}</option>", option.Key, option.Value); } else { result.InnerHtml += string.Format("<option value=\"{0}\">{1}</option>", option.Key, option.Value); } } result.InnerHtml += "</select>"; return result; }
/// <summary> /// Transfer object in html cell /// </summary> /// <param name="value">Object to render</param> /// <returns>Html cell</returns> public override HtmlTableCell Render(object value) { var isOn = (bool)Property.GetValue(value); var result = new HtmlTableCell(); result.InnerHtml = isOn ? "Да" : "Нет"; return result; }
private void LayoutColumns() { HtmlTableRow tr = new HtmlTableRow(); tr.Attributes["class"] = "ReportLayout"; tblReport.Rows.Add(tr); HtmlTableCell td = new HtmlTableCell(); tr.Cells.Add(td); td.Width = "20px"; td.Height = "0px"; td = new HtmlTableCell(); tr.Cells.Add(td); td.Width = "120px"; td.Height = "0px"; td = new HtmlTableCell(); tr.Cells.Add(td); td.Width = "120px"; td.Height = "0px"; td = new HtmlTableCell(); tr.Cells.Add(td); td.Width = "50px"; td.Height = "0px"; td = new HtmlTableCell(); tr.Cells.Add(td); td.Width = "500px"; td.Height = "0px"; }
public List<HtmlTableCell> BuildCheckbox(string fieldtext, string id, string SkinID, int length, bool isReadOnly, string controlValue) { List<HtmlTableCell> c = new List<HtmlTableCell>(); try { HtmlTableCell cell = new HtmlTableCell(); cell.Attributes.Add("class", "tblFormViewtdLabel"); cell.Style.Add("Width", "20%"); ASPxLabel lb = new ASPxLabel(); lb.Text = fieldtext; cell.Controls.Add(lb); HtmlTableCell celledit = new HtmlTableCell(); celledit.Attributes.Add("class", "tblFormViewtdValue"); celledit.Style.Add("Width", "30%"); ASPxCheckBox cb = new ASPxCheckBox() { SkinID = SkinID, Text = "", ID = id, Checked = true, Width = Unit.Percentage(100), ReadOnly = isReadOnly }; cb.Theme = "DevEx"; cb.AutoPostBack = false; if (controlValue == "1") cb.Checked = true; celledit.Controls.Add(cb); c.Add(cell); c.Add(celledit); cot += 2; } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), Guid.NewGuid().ToString(), "<script> alert('buildCheckbox fieldname" + id + "'); </script>", false); } return c; }
protected void AddRowIconClassName(string icon, HtmlTable table, HtmlTableRow row) { HtmlTableCell cell1 = new HtmlTableCell(); cell1.InnerHtml = icon; row.Cells.Add(cell1); table.Rows.Add(row); }
private static void CreateTableRow(HtmlTable table, Post post) { HtmlTableRow row = new HtmlTableRow(); HtmlTableCell date = new HtmlTableCell(); date.InnerHtml = post.DateCreated.ToString("yyyy-MM-dd"); date.Attributes.Add("class", "date"); row.Cells.Add(date); HtmlTableCell title = new HtmlTableCell(); title.InnerHtml = string.Format("<a href=\"{0}\">{1}</a>", post.RelativeLink, post.Title); title.Attributes.Add("class", "title"); row.Cells.Add(title); if (BlogSettings.Instance.IsCommentsEnabled) { HtmlTableCell comments = new HtmlTableCell(); comments.InnerHtml = post.ApprovedComments.Count.ToString(); comments.Attributes.Add("class", "comments"); row.Cells.Add(comments); } if (BlogSettings.Instance.EnableRating) { HtmlTableCell rating = new HtmlTableCell(); rating.InnerHtml = post.Raters == 0 ? "None" : Math.Round(post.Rating, 1).ToString(); rating.Attributes.Add("class", "rating"); row.Cells.Add(rating); } table.Rows.Add(row); }
private HtmlTableCell AddTableCell(string innerHtml) { HtmlTableCell cell = new HtmlTableCell(); cell.InnerHtml = innerHtml; cell.Align = "center"; return cell; }
private static HtmlTableCell AddLabel(string labelText) { HtmlTableCell cell = new HtmlTableCell(); Label l = new Label(); l.Text = labelText; cell.Controls.Add(l); return cell; }
/// <summary> /// Transfer object in html cell /// </summary> /// <param name="value">Object to render</param> /// <returns>Html cell</returns> public override HtmlTableCell Render(object value) { var isOn = (bool)Property.GetValue(value); var checkattribute = isOn ? "checked=\"checked\"" : string.Empty; var result = new HtmlTableCell(); result.InnerHtml = string.Format("<input type=\"checkbox\" {0} />", checkattribute); return result; }
private HtmlTableCell CreateCell(string data) { HtmlTableCell cell = new HtmlTableCell(); Label label = new Label(); label.ID = data + "Label"; label.Text = data; cell.Controls.Add(label); return cell; }
private HtmlTableCell AddCityCellInnerHTML(string name, string countryName, string name_en) { HtmlTableCell cell = new HtmlTableCell(); HyperLink hl = new HyperLink(); hl.NavigateUrl = SiteURL + "/" + Utils.GenerateFriendlyURL("city", new string[] { countryName, name_en}, false); ; hl.Text = name; cell.Controls.Add(hl); return cell; }
protected override void Render (HtmlTextWriter writer) { HtmlTableRow row = new HtmlTableRow (); HtmlTableCell cell = new HtmlTableCell (); cell.InnerHtml = "Test cell is visible"; row.Cells.Add (cell); Table1.Rows.Add (row); Table1.Visible = true; Table1.RenderControl (writer); }
/// <summary> /// Transfer object in html cell /// </summary> /// <param name="value">Object to render</param> /// <returns>Html cell</returns> public override HtmlTableCell Render(object value) { var result = new HtmlTableCell() { InnerHtml = "<input class=\"datetimepicker\" type=\"text\"/>" }; var propValue = Property.GetValue(value); if (propValue != null) { var date = (DateTime?)propValue; result.InnerHtml = string.Format("<input class=\"datetimepicker\" type=\"text\" value=\"{0}\"/>", date.Value.ToString(this.Format)); } return result; }
private HtmlTableRow CreateAssetRow(JobAsset item, HttpServerUtility server) { HtmlTableRow row = new HtmlTableRow(); string filename = Path.GetFileName(item.Filepath); row.Cells.Add(CreateCell("Job Asset: " + filename)); HtmlTableCell cell = new HtmlTableCell(); cell = new HtmlTableCell(); string url = WebUtils.ResolveVirtualPath(item.Filepath).Replace("~", ".."); cell.InnerHtml = String.Format("<a href=\"{0}\" target=\"blank\">{1}</a>", url, "Open File"); row.Cells.Add(cell); return row; }
protected void Page_Load(object sender, EventArgs e) { if ( !IsPostBack ) { IDataReader reader = (IDataReader)dsRegister.Select(new DataSourceSelectArguments()); try { while (reader.Read()) { HtmlTableRow row = new HtmlTableRow(); HtmlTableCell cell = new HtmlTableCell(); cell.InnerText = reader["DepName"].ToString(); row.Cells.Add(cell); TableViewRegister.Rows.Add(row); cell = new HtmlTableCell(); cell.InnerText = reader["ToolName"].ToString(); row.Cells.Add(cell); TableViewRegister.Rows.Add(row); cell = new HtmlTableCell(); cell.InnerText = reader["PersName"].ToString(); row.Cells.Add(cell); TableViewRegister.Rows.Add(row); cell = new HtmlTableCell(); cell.InnerText = reader["ManufName"].ToString(); row.Cells.Add(cell); TableViewRegister.Rows.Add(row); cell = new HtmlTableCell(); cell.InnerText = reader["CouName"].ToString(); row.Cells.Add(cell); TableViewRegister.Rows.Add(row); cell = new HtmlTableCell(); cell.InnerText = reader["MarkName"].ToString(); row.Cells.Add(cell); TableViewRegister.Rows.Add(row); cell = new HtmlTableCell(); cell.InnerText = reader["Count_l"].ToString(); row.Cells.Add(cell); TableViewRegister.Rows.Add(row); } } finally { reader.Close(); } } }
protected void OutputSuggestedResults() { try { ISuggestedResults suggestedResults = ObjectFactory.GetSuggestedResults(); List<SuggestedResultSet> suggestedResultsSets = suggestedResults.GetList(); foreach (SuggestedResultSet suggestedResultSet in suggestedResultsSets) { // Create the table row for this suggested result set. HtmlTableRow row = new HtmlTableRow(); HtmlTableCell phraseCell = new HtmlTableCell(); HtmlTableCell resultsCell = new HtmlTableCell(); row.Cells.Add(phraseCell); row.Cells.Add(resultsCell); // Add hyperlink for viewing the result set details. HyperLink viewSetLink = new HyperLink(); viewSetLink.NavigateUrl = string.Format(ViewSuggestedResultSetUrlFormat, Server.HtmlEncode(suggestedResultSet.Id.ToString())); viewSetLink.Text = Server.HtmlEncode(suggestedResultSet.Name); phraseCell.Controls.Add(viewSetLink); foreach (SuggestedResult suggestedResult in suggestedResultSet.SuggestedResults) { if (resultsCell.Controls.Count > 0) { Literal seperator = new Literal(); seperator.Text = ", "; resultsCell.Controls.Add(seperator); } HyperLink suggestedResultLink = new HyperLink(); suggestedResultLink.NavigateUrl = suggestedResult.Url; suggestedResultLink.Text = Server.HtmlEncode(suggestedResult.Title); suggestedResultLink.Attributes.Add("onclick", OpenInNewWindowScript); resultsCell.Controls.Add(suggestedResultLink); } tblSuggestedResultSets.Rows.Add(row); } } catch { Utilities.ShowError(messageHelper.GetMessage("msg search suggested results connection error")); } }
/// <summary> /// Render object in html cell /// </summary> /// <param name="value">Object to render</param> /// <returns>Html table cell</returns> public override HtmlTableCell Render(object value) { var result = new HtmlTableCell() { InnerHtml = "N/A" }; var propValue = Property.GetValue(value); if (propValue != null) { var date = (DateTime)propValue; if (date != DateTime.MinValue) { result.InnerHtml = date.ToShortDateString(); } } return result; }
private void InsertC() { //实例化ArrayList ArrayList AL = new ArrayList(); this.Tab_UpDownFile.Rows.Clear(); //清除id为F表格里的所有行 //表示 HtmlTable 控件中的 <tr> HTML 元素 HtmlTableRow HTR = new HtmlTableRow(); //表示 HtmlTableRow 对象中的 <td> 和 <th> HTML 元素 HtmlTableCell HTC = new HtmlTableCell(); //在单元格中添加一个FileUpload控件 HTC.Controls.Add(new FileUpload()); //在行中添加单元格 HTR.Controls.Add(HTC); //在表中添加行 Tab_UpDownFile.Rows.Add(HTR); SFUPC(); }
public static HtmlTable BuildDefaultCopies() { HtmlTable oTable = new HtmlTable() { Width = "30%", Align = "right" }; oTable.Style.Add("font-family", "Arial (Hebrew)"); oTable.Style.Add("font-size", "11pt"); oTable.Style.Add("font-style", "normal"); HtmlTableRow oRow = new HtmlTableRow(); HtmlTableCell oCell = new HtmlTableCell(); oCell.Attributes.Add("class", "clsUnderLineText"); oCell.InnerHtml = "העתקים:"; oRow.Cells.Add(oCell); oTable.Rows.Add(oRow); return oTable; }
protected void AddRadToggleButtonWithIcon(string ID, string IconName, string Skin, int? Height, int? Top, HtmlTable table, HtmlTableRow row) { HtmlTableCell cell = new HtmlTableCell(); RadToggleButton RadToggleButton1 = new RadToggleButton() { ID = "RadToggleButton1" + ID, Text = IconName, Skin = Skin, }; if (Height != null) RadToggleButton1.Height = Unit.Pixel((int)Height); RadToggleButton1.Icon.CssClass = IconName; if (Top != null) RadToggleButton1.Icon.Top = Unit.Pixel((int)Top); cell.Controls.Add(RadToggleButton1); row.Cells.Add(cell); table.Rows.Add(row); }
protected void Page_Load(object sender, EventArgs e) { HtmlTable myTable = new HtmlTable(); myTable.Border = 1; myTable.CellPadding = 3; myTable.CellSpacing = 3; for (int i = 0; i < 3; i++) { HtmlTableRow myRow = new HtmlTableRow(); for (int j = 0; j < 4; j++) { HtmlTableCell myCell = new HtmlTableCell(); myCell.InnerHtml = i + ", " + j; myRow.Cells.Add(myCell); } myTable.Rows.Add(myRow); } Page.Controls.Add(myTable); }
HtmlTableRow BuildNewRow(string Cell1Text, string Cell2Text) { //必須用到 using System.Web.UI.HtmlControls;。 HtmlTableRow row = new HtmlTableRow(); //-- 新的一列 HtmlTableCell cell1 = new HtmlTableCell(); //-- 新的儲存格 HtmlTableCell cell2 = new HtmlTableCell(); cell1.Controls.Add(new LiteralControl(Cell1Text)); cell1.Width = "20px"; cell1.Style.Add("border-bottom", "1px dotted black"); row.Cells.Add(cell1); cell2.Controls.Add(new LiteralControl(Cell2Text)); cell2.Width = "100px"; cell2.Style.Add("border-bottom", "1px dotted black"); row.Cells.Add(cell2); return row; //--回傳一個 HtmlTableRow }
protected void cargaSolicitudes() { string Sp = "SP_SEL_SOLICITUDES @FLAG = 3"; using (DataTable dr = Conexion.GetDataTable(Sp)) { foreach (DataRow row in dr.Rows) { HtmlTableRow rowNew = new HtmlTableRow(); solicitudesIngresadas.Controls.Add(rowNew); HtmlTableCell cell_id_solicitud = new HtmlTableCell("td"); HtmlTableCell cell_solicitud = new HtmlTableCell("td"); HtmlTableCell cell_area = new HtmlTableCell("td"); HtmlTableCell cell_fec_ingreso = new HtmlTableCell("td"); HtmlTableCell cell_fec_salida = new HtmlTableCell("td"); HtmlTableCell cell_tipo_solicitud = new HtmlTableCell("td"); HtmlTableCell cell_solicitante = new HtmlTableCell("td"); HtmlTableCell cell_analista_responsable = new HtmlTableCell("td"); HtmlTableCell cell_estado = new HtmlTableCell("td"); Label lblIdSolicitud = new Label(); Label lblSolicitud = new Label(); Label lblArea = new Label(); Label lblFechaIngreso = new Label(); Label lblFechaSalida = new Label(); Label lblTipoSolicitud = new Label(); Label lblSolicitante = new Label(); Label lblAnalistaResponsable = new Label(); Label lblEstado = new Label(); Button botonAsignar = new Button(); lblIdSolicitud.Text = row["id_solicitud"].ToString(); lblSolicitud.Text = row["nombre_solicitud"].ToString(); lblArea.Text = row["nombre_area"].ToString(); lblFechaIngreso.Text = Convert.ToDateTime(row["fec_ingreso"]).ToString("dd/MM/yyyy"); lblFechaSalida.Text = Convert.ToDateTime(row["fec_salida"]).ToString("dd/MM/yyyy"); lblTipoSolicitud.Text = row["tipo_solicitud"].ToString(); lblSolicitante.Text = row["solicitante"].ToString(); lblAnalistaResponsable.Text = row["analista"].ToString(); string Estado = row["estado_solicitud"].ToString(); switch (Estado) { case "1": lblEstado.Text = "<button type='button' class='btn btn-warning btn-xs'><span class='glyphicon glyphicon-floppy-disk' aria-hidden='true'></span> Ingresada</button>"; break; case "2": lblEstado.Text = "<button type='button' class='btn btn-info2 btn-xs'><span class='glyphicon glyphicon-floppy-disk' aria-hidden='true'></span> Asignada</button>"; break; case "3": lblEstado.Text = "<button type='button' class='btn btn-info btn-xs'><span class='glyphicon glyphicon-pause' aria-hidden='true'></span> En Proceso</button>"; break; case "4": lblEstado.Text = "<button type='button' class='btn btn-success btn-xs'><span class='glyphicon glyphicon-ok' aria-hidden='true'></span> Finalizada</button>"; break; case "5": lblEstado.Text = "<button type='button' class='btn btn-warning btn-xs'><span class='glyphicon glyphicon-ok' aria-hidden='true'></span> Devuelta</button>"; break; } cell_id_solicitud.Controls.Add(lblIdSolicitud); cell_solicitud.Controls.Add(lblSolicitud); cell_area.Controls.Add(lblArea); cell_fec_ingreso.Controls.Add(lblFechaIngreso); cell_fec_salida.Controls.Add(lblFechaSalida); cell_tipo_solicitud.Controls.Add(lblTipoSolicitud); cell_solicitante.Controls.Add(lblSolicitante); cell_analista_responsable.Controls.Add(lblAnalistaResponsable); cell_estado.Controls.Add(lblEstado); cell_solicitud.Attributes.Add("class", "text-left"); cell_area.Attributes.Add("class", "text-left"); cell_tipo_solicitud.Attributes.Add("class", "text-left"); cell_solicitante.Attributes.Add("class", "text-left"); cell_analista_responsable.Attributes.Add("class", "text-left"); cell_estado.Attributes.Add("class", "text-left"); rowNew.Controls.Add(cell_id_solicitud); rowNew.Controls.Add(cell_solicitud); rowNew.Controls.Add(cell_area); rowNew.Controls.Add(cell_fec_ingreso); rowNew.Controls.Add(cell_fec_salida); rowNew.Controls.Add(cell_tipo_solicitud); rowNew.Controls.Add(cell_solicitante); rowNew.Controls.Add(cell_analista_responsable); rowNew.Controls.Add(cell_estado); } } }
protected void showCart() { HtmlTable transTable = new HtmlTable(); transTable.Border = 1; transTable.CellPadding = 3; transTable.CellSpacing = 3; transTable.BorderColor = "White"; HtmlTableRow row; HtmlTableCell cell; int rowCount = 0; //create the header row and add to the table row = new HtmlTableRow(); cell = new HtmlTableCell(); cell.InnerHtml = "<b>Remove</b>"; cell.Height = "25px"; cell.Width = "100px"; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "<b>Item Name</b>"; cell.Height = "20px"; cell.Width = "100px"; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "<b>Item Number</b>"; cell.Height = "20px"; cell.Width = "100px"; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "<b>Price</b>"; cell.Height = "20px"; cell.Width = "80px"; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "<b>Quantity</b>"; cell.Height = "20px"; cell.Width = "80px"; row.Cells.Add(cell); transTable.Rows.Add(row); int count = 1; // count = CustomerDB.GetOneInt("select count(*) from vw_customerTransaction where email = '" + userName + "'"); if (count == 0) {//no transaction, create an empty row row = new HtmlTableRow(); cell = new HtmlTableCell(); cell.InnerHtml = "No transactions found."; cell.ColSpan = 4; cell.Height = "20px"; row.Cells.Add(cell); transTable.Rows.Add(row); PnlCartTable.Controls.Add(transTable); } else { //get the list List <CartItem> itemList = (List <CartItem>)Session["CartItems"]; //loop through the list and get each item for (int i = 0; i < itemList.Count; i++) { rowCount++; //create a new row row = new HtmlTableRow(); row.BgColor = (rowCount % 2 == 0 ? "white" : "#cccccc"); CartItem oneItem = itemList[i]; //now get the member variables from each item and add to the table display cell = new HtmlTableCell(); cell.InnerHtml = "<input type=\"checkbox\" id=\"chk" + rowCount + "\" />";; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "<a href=\"product.aspx?t=i&item=" + oneItem.ItemNumber + "\">" + oneItem.Name + "</a>"; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = oneItem.ItemNumber; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "$" + System.Convert.ToString(oneItem.Price); row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = "<input type=\"text\" value=\"1\" id=\"qn" + rowCount + "\" >"; row.Cells.Add(cell); transTable.Rows.Add(row); } PnlCartTable.Controls.Add(transTable); } }
protected void rptCourses_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e) { Menu menu = this.CurrentMenu; Meal currentMeal = null; MealDayOfWeek currentWeekDay = null; int currentWeekDayId = 0; string currentMealSignature = ""; int currentCourseOrMenuTypeId = ((CourseOrMealType)e.Item.DataItem).CourseOrMealTypeId; RepeaterItem parentItem = e.Item.Parent.Parent as RepeaterItem; if (parentItem != null) { currentWeekDay = parentItem.DataItem as MealDayOfWeek; } if (currentWeekDay != null) { currentWeekDayId = currentWeekDay.DayId; } TextBox txtComments = null; if (menu.MenuTypeId == (int)MenuTypeEnum.OneMeal && currentCourseOrMenuTypeId == 6) { txtComments = e.Item.FindControl("TextBoxComments") as TextBox; txtComments.Visible = true; txtComments.Attributes["DayId"] = currentWeekDayId.ToString(); if (_comments != null && _comments.Count != 0) { txtComments.Text = _comments[currentWeekDayId - 1]; } } if (menu.MenuTypeId == (int)MenuTypeEnum.Weekly && currentCourseOrMenuTypeId == 5) { txtComments = e.Item.FindControl("TextBoxComments") as TextBox; txtComments.Visible = true; txtComments.Attributes["DayId"] = currentWeekDayId.ToString(); if (_comments != null && _comments.Count != 0) { txtComments.Text = _comments[currentWeekDayId - 1]; } } if (menu.MenuTypeId == (int)MenuTypeEnum.OneMeal) { foreach (Meal m in this.CurrentMenu.Meals.ToArray()) { if (m.CourseTypeId == currentCourseOrMenuTypeId) { currentMeal = m; } if (currentCourseOrMenuTypeId == 6 && !string.IsNullOrEmpty(m.Comments)) { if (string.IsNullOrEmpty(txtComments.Text)) { txtComments.Text = m.Comments; _comments[currentWeekDayId - 1] = m.Comments; } } } currentMealSignature = "d0m4c" + currentCourseOrMenuTypeId; } if (menu.MenuTypeId == (int)MenuTypeEnum.Weekly) { foreach (Meal m in this.CurrentMenu.Meals.ToArray()) { if (m.MealTypeId == currentCourseOrMenuTypeId && m.DayIndex == currentWeekDayId) { currentMeal = m; } if (currentCourseOrMenuTypeId == 5 && m.DayIndex == currentWeekDayId && !string.IsNullOrEmpty(m.Comments)) { if (string.IsNullOrEmpty(txtComments.Text)) { txtComments.Text = m.Comments; _comments[currentWeekDayId - 1] = m.Comments; } } } currentMealSignature = "d" + currentWeekDayId + "m" + currentCourseOrMenuTypeId + "c0"; } // for identification of relevant meal after recipe was dropped on the table cell. HtmlTableCell tdMealRecipes = e.Item.FindControl("tdMealRecipes") as HtmlTableCell; if (tdMealRecipes != null) { tdMealRecipes.Attributes["meal_signature"] = currentMealSignature; } if (currentMeal == null) { tdMealRecipes.Controls.Add(new LiteralControl(" ")); //for IE return; } if (currentMeal.MealRecipes.Count == 0) { tdMealRecipes.Controls.Add(new LiteralControl(" ")); //for IE } if (this.CurrentMenu.MenuTypeId == (int)MenuTypeEnum.OneMeal && txtComments != null) { txtComments.Text = currentMeal.Comments; } if (this.CurrentMenu.MenuTypeId == (int)MenuTypeEnum.Weekly) { HtmlTableCell tdDinersNum = e.Item.FindControl("tdDinersNum") as HtmlTableCell; if (tdDinersNum != null) { tdDinersNum.Style["width"] = "33px"; tdDinersNum.Style["padding-right"] = "2px"; tdDinersNum.Style["padding-top"] = "5px"; tdDinersNum.Style["padding-bottom"] = "5px"; } TextBox txtDinersNum = e.Item.FindControl("txtDinersNum") as TextBox; if (txtDinersNum != null) { txtDinersNum.Attributes["mealSignature"] = this.GetMealSignature(currentMeal); txtDinersNum.Text = currentMeal.Diners.ToString(); txtDinersNum.Visible = true; } } Repeater rpt = e.Item.FindControl("rptRecipes") as Repeater; if (rpt != null) { rpt.DataSource = currentMeal.MealRecipes.ToArray(); rpt.DataBind(); } }
protected void _btnExportar_Click(object sender, EventArgs e) { try { MSTech.Web.Util.GeraHTML.GeraHTML gera = new MSTech.Web.Util.GeraHTML.GeraHTML { _FileName = NomeModulo + " " + DateTime.Now.ToString("dd_MM_yyyy"), _FileExtension = ".xls", _Encoding = Encoding.GetEncoding("ISO-8859-1") }; HtmlGenericControl div = new HtmlGenericControl("div"); HtmlTable table = new HtmlTable(); HtmlTableCell tdNumSerie; HtmlTableCell tdDataEnvio; HtmlTableCell tdVersaoAPP; HtmlTableCell tdVersaoSO; /*** Cabeçalho ***/ HtmlTableRow tr = new HtmlTableRow(); HtmlTableCell tdUnidadeAdministrativa = new HtmlTableCell { InnerHtml = "Diretoria regional de educação: <b>" + uccUaEscola.ValorComboUA + "</b>", ColSpan = 4 }; tdUnidadeAdministrativa.Style.Add("text-align", "center"); tdUnidadeAdministrativa.Style.Add("width", "600"); tr.Cells.Add(tdUnidadeAdministrativa); table.Rows.Add(tr); tr = new HtmlTableRow(); HtmlTableCell tdEscola = new HtmlTableCell { InnerHtml = "Escola: <b>" + uccUaEscola.ValorComboEscola + "</b>", ColSpan = 4 }; tdEscola.Style.Add("text-align", "center"); tdEscola.Style.Add("width", "600"); tr.Cells.Add(tdEscola); table.Rows.Add(tr); /*** Fim cabeçalho ***/ /*** Descrição |Nº Serie|Data de envio|Versão APP|Versão SO| ***/ if (grvConsultaLogTablets.Rows.Count > 0) { tr = new HtmlTableRow(); tdNumSerie = new HtmlTableCell { InnerText = "Nº Serie" }; tdNumSerie.Style.Add("text-align", "center"); tdNumSerie.Style.Add("background-color", "#000000"); tdNumSerie.Style.Add("color", "#FFFFFF"); tr.Cells.Add(tdNumSerie); tdDataEnvio = new HtmlTableCell { InnerText = "Data de envio" }; tdDataEnvio.Style.Add("text-align", "center"); tdDataEnvio.Style.Add("background-color", "#000000"); tdDataEnvio.Style.Add("color", "#FFFFFF"); tr.Cells.Add(tdDataEnvio); tdVersaoAPP = new HtmlTableCell { InnerText = "Versão APP" }; tdVersaoAPP.Style.Add("text-align", "center"); tdVersaoAPP.Style.Add("background-color", "#000000"); tdVersaoAPP.Style.Add("color", "#FFFFFF"); tr.Cells.Add(tdVersaoAPP); tdVersaoSO = new HtmlTableCell { InnerText = "Versão SO" }; tdVersaoSO.Style.Add("text-align", "center"); tdVersaoSO.Style.Add("background-color", "#000000"); tdVersaoSO.Style.Add("color", "#FFFFFF"); tr.Cells.Add(tdVersaoSO); tr.Style.Add("font-weight", "bold"); table.Rows.Add(tr); /*** Fim descrição ***/ /*** Registros da pesquisa ***/ DataTable dt = new DataTable(); dt = SYS_EquipamentoBO.SelectLogTabletEquipamento(uccUaEscola.Esc_ID, uccUaEscola.Uad_ID); bool linha = true; foreach (DataRow row in dt.Rows) { tr = new HtmlTableRow(); tdNumSerie = new HtmlTableCell { InnerText = row.ItemArray[2].ToString() }; tdNumSerie.Style.Add("text-align", "center"); if (tdVersaoAPP.InnerText == null) { tdVersaoAPP.Style.Add("text", "-"); } if (!linha) { tdNumSerie.Style.Add("background-color", "#D9D9D9");// linha colorida quando a linha for (!linha), pinta a linha de cinza } tdNumSerie.Style.Add("border-style", "solid"); tdNumSerie.Style.Add("border-width", "thin"); tr.Cells.Add(tdNumSerie); tdDataEnvio = new HtmlTableCell { InnerText = row.ItemArray[3].ToString() }; tdDataEnvio.Style.Add("text-align", "center"); if (!linha) { tdDataEnvio.Style.Add("background-color", "#D9D9D9"); } tdDataEnvio.Style.Add("border-style", "solid"); tdDataEnvio.Style.Add("border-width", "thin"); tr.Cells.Add(tdDataEnvio); tdVersaoAPP = new HtmlTableCell { InnerText = row.ItemArray[4].ToString() }; tdVersaoAPP.Style.Add("text-align", "center"); if (!linha) { tdVersaoAPP.Style.Add("background-color", "#D9D9D9"); } tdVersaoAPP.Style.Add("border-style", "solid"); tdVersaoAPP.Style.Add("border-width", "thin"); tr.Cells.Add(tdVersaoAPP); tdVersaoSO = new HtmlTableCell { InnerText = row.ItemArray[5].ToString() }; tdVersaoSO.Style.Add("text-align", "center"); if (!linha) { tdVersaoSO.Style.Add("background-color", "#D9D9D9"); } tdVersaoSO.Style.Add("border-style", "solid"); tdVersaoSO.Style.Add("border-width", "thin"); tr.Cells.Add(tdVersaoSO); table.Rows.Add(tr); linha = !linha; } /*** Fim registros da pesquisa ***/ table.Style.Add("border-style", "solid"); table.Style.Add("border-width", "3px"); div.Controls.Add(table); StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); div.RenderControl(hw); gera._Add(sw.ToString()); gera._GenerateForDownload(); // na linha acima ele gera uma exception, porém é assim mesmo e ela cai no ThreadAbortException abaixo para gerar o relatorio. } } catch (Exception ex) { if (!(ex is System.Threading.ThreadAbortException)) { lblMensagemErro.Text = UtilBO.GetErroMessage("Ocorreu um erro ao exportar para excel.", UtilBO.TipoMensagem.Erro); } } }
private void ShowPictures(int pageIndex) { var xml = this.LoadPictures(); if (string.IsNullOrEmpty(xml)) { return; } var xroot = XElement.Parse(xml); var photos = (from photo in xroot.Element("photos").Elements("photo") select new FlickrPhotoInfo { Id = (string)photo.Attribute("id"), Owner = (string)photo.Attribute("owner"), Title = (string)photo.Attribute("title"), Secret = (string)photo.Attribute("secret"), Server = (string)photo.Attribute("server"), Farm = (string)photo.Attribute("Farm"), /*IsPublic = (bool)photo.Attribute("ispublic"), * IsFriend = (bool)photo.Attribute("isfriend"), * IsFamily = (bool)photo.Attribute("isfamily")*/ }).Skip(pageIndex * Columns * Rows).Take(Columns * Rows); HtmlTable table = new HtmlTable(); table.Align = "center"; var row = 0; var col = 0; var count = 0; foreach (var photo in photos) { if (col == 0) { table.Rows.Add(new HtmlTableRow()); } var cell = new HtmlTableCell(); var div = new HtmlGenericControl("div"); div.Attributes.Add("class", "preview"); var img = new HtmlImage(); img.Src = photo.PhotoUrl(true); //img.Width = img.Height = 75; img.Border = 0; img.Attributes.Add("class", "preview"); //img.Attributes.Add("onmouseover", "Zoom.larger(this, 150, 150)"); //img.Attributes.Add("onmouseout", "Zoom.smaller(this, 150, 150)"); var link = new HtmlGenericControl("a"); link.Attributes["href"] = photo.PhotoPageUrl; link.Attributes["target"] = "_blank"; link.Attributes["title"] = photo.Title; link.Controls.Add(img); div.Controls.Add(link); cell.Controls.Add(div); table.Rows[row].Cells.Add(cell); col++; if (col == Columns) { col = 0; row++; } count++; } photoPanel.Controls.Clear(); photoPanel.Controls.Add(table); if (pageIndex == 0) { this.ShowPrevious.Visible = false; this.ShowNext.Visible = true; } else { this.ShowPrevious.Visible = true; } if (count < Columns * Rows) { this.ShowNext.Visible = false; } }
public static void SetGdvTitlePanelCellStyle(this HtmlTableCell cell, string postfix) { cell.Attributes.Add("class", string.Format("dxgvTitlePanel_{0}", postfix)); cell.Style["empty-cells"] = "show"; }
protected void BindStepStats(object sender, EventArgs e) { div_stats.Controls.Clear(); DataTable scheme_steps = GetThisSchemeSteps(); HtmlTable table = new HtmlTable(); table.EnableViewState = false; table.Border = 0; table.CellPadding = 0; table.Width = "980"; table.Attributes.Add("style", "margin-left:auto; margin-right:auto;"); for (int i = 0; i < scheme_steps.Rows.Count; i++) { if (Convert.ToBoolean(scheme_steps.Rows[i][17])) // if complete step { String cca_type = scheme_steps.Rows[i][9].ToString(); if (cca_type == "0") { cca_type = "2"; } else { cca_type = "-1"; } String start_date = Convert.ToDateTime(scheme_steps.Rows[i][13]).ToString("yyyy/MM/dd"); int sus = Convert.ToInt32(scheme_steps.Rows[i][4]); int pros = Convert.ToInt32(scheme_steps.Rows[i][5]); int apps = Convert.ToInt32(scheme_steps.Rows[i][6]); int rev = Convert.ToInt32(scheme_steps.Rows[i][7]); int duration_weeks = Convert.ToInt32(scheme_steps.Rows[i][15]); String cca_expr = "persRev+mTotalRev+tTotalRev+wTotalRev+thTotalRev+fTotalRev+xTotalRev"; // For Sales if (cca_type == "List Gen") // For List Gen { cca_expr = "persRev"; } String performanceExpr = " HAVING SUM(mS+tS+wS+thS+fS+xS) < " + (sus * duration_weeks) + " " + " OR SUM(mP+tP+wP+thP+fP+xP) < " + (pros * duration_weeks) + " " + " OR SUM(mA+tA+wA+thA+fA+xA) < " + (apps * duration_weeks) + " " + " OR SUM("+cca_expr+") < " + rev + " "; if (cb_showoverperformers.Checked){performanceExpr = " ";} String qry = "SELECT " + "fullname as 'CCA', " + "SUM(mS+tS+wS+thS+fS+xS) as Suspects, " + "SUM(mP+tP+wP+thP+fP+xP) as Prospects, " + "SUM(mA+tA+wA+thA+fA+xA) as Approvals, " + "SUM(mTotalRev+tTotalRev+wTotalRev+thTotalRev+fTotalRev+xTotalRev) as 'Total Revenue', " + "SUM(persRev) as 'Personal Revenue', " + "@office AS centre, db_userpreferences.userid AS 'uid' " + "FROM db_progressreport, db_userpreferences " + "WHERE db_progressreport.userid = db_userpreferences.userid " + "AND pr_id IN " + "( " + " SELECT pr_id " + " FROM db_progressreporthead " + " WHERE centre=@office " + " AND start_date=@start_date" + //AND start_date > DATEADD(WW, -" + (weeks + 1) + ", GETDATE()) " + ") " + " AND db_progressreport.ccalevel=@cca_type " + " GROUP BY db_progressreport.userid, fullname " + performanceExpr + " ORDER BY " + (String)ViewState["sortField"] + " " + (String)ViewState["sortDir"]; DataTable dt = SQL.SelectDataTable(qry, new String[] { "@office", "@start_date", "@cca_type" }, new Object[] { dd_office.SelectedItem.Text, start_date, cca_type }); HtmlTableRow tr1 = new HtmlTableRow(); HtmlTableCell tc = new HtmlTableCell(); tc.ColSpan = 2; Label gv_step = new Label(); gv_step.Font.Size = 8; gv_step.Font.Name = "Verdana"; gv_step.Text = "Stage " + (i + 1) + " underperformance statistics<br/>"; tc.Controls.Add(gv_step); tr1.Cells.Add(tc); HtmlTableRow tr2 = new HtmlTableRow(); HtmlTableCell lc = new HtmlTableCell(); HtmlTableCell rc = new HtmlTableCell(); lc.VAlign = rc.VAlign = "top"; lc.Width = "50%"; rc.Width = "50%"; lc.Align = "left"; tr2.Cells.Add(lc); tr2.Cells.Add(rc); GridView newGrid = CreateGrid(); newGrid.DataSource = dt; newGrid.DataBind(); // Get CCA stats for step int numSuccess = 0; for (int j = 0; j < newGrid.Rows.Count; j++) { if (Convert.ToInt32(newGrid.Rows[j].Cells[1].Text) >= (sus * duration_weeks)) { newGrid.Rows[j].Cells[1].ForeColor = Color.Green; numSuccess++; } else { newGrid.Rows[j].Cells[1].ForeColor = Color.DarkRed; } if (Convert.ToInt32(newGrid.Rows[j].Cells[2].Text) >= (pros * duration_weeks)) { newGrid.Rows[j].Cells[2].ForeColor = Color.Green; numSuccess++; } else { newGrid.Rows[j].Cells[2].ForeColor = Color.DarkRed; } if (Convert.ToInt32(newGrid.Rows[j].Cells[3].Text) >= (apps * duration_weeks)) { newGrid.Rows[j].Cells[3].ForeColor = Color.Green; numSuccess++; } else { newGrid.Rows[j].Cells[3].ForeColor = Color.DarkRed; } if (Convert.ToInt32(Util.CurrencyToText(newGrid.Rows[j].Cells[5].Text)) >= (rev * duration_weeks)) { newGrid.Rows[j].Cells[5].ForeColor = Color.Green; numSuccess++; } else { newGrid.Rows[j].Cells[5].ForeColor = Color.DarkRed; } if (numSuccess == 4) { newGrid.Rows[j].Font.Underline = true; newGrid.Rows[j].Font.Bold = true; } numSuccess = 0; } if (newGrid.Rows.Count > 0) { lc.Controls.Add(newGrid); Label lbl_sus = new Label(); Label lbl_pros = new Label(); Label lbl_app = new Label(); Label lbl_trev = new Label(); Label lbl_prev = new Label(); Label lbl_noccas = new Label(); lbl_noccas.Text = "No. CCAs: " + dt.Rows.Count; lbl_sus.Text = "<br/>Stage Avg. Suspects Threshold: " + (sus * duration_weeks).ToString(); lbl_pros.Text = "<br/>Stage Avg. Prospects Threshold: " + (pros * duration_weeks).ToString(); lbl_app.Text = "<br/>Stage Avg. Approvals Threshold: " + (apps * duration_weeks).ToString(); lbl_trev.Text = "<br/>Stage Avg. Total Revenue Threshold: " + (0 * duration_weeks).ToString(); lbl_prev.Text = "<br/>Stage Avg. Personal Revenue Threshold: " + Util.TextToCurrency((rev * duration_weeks).ToString(), dd_office.SelectedItem.Text); rc.Controls.Add(lbl_noccas); rc.Controls.Add(lbl_sus); rc.Controls.Add(lbl_pros); rc.Controls.Add(lbl_app); rc.Controls.Add(lbl_trev); rc.Controls.Add(lbl_prev); for (int j = 0; j < rc.Controls.Count; j++) { if (rc.Controls[j] is Label) { Label x = rc.Controls[j] as Label; x.Font.Size = 7; x.Font.Name = "Verdana"; } } } else { Label lbl_nodata = new Label(); lbl_nodata.ForeColor = Color.Red; lbl_nodata.Font.Bold=true; lbl_nodata.Font.Name = "Verdana"; lbl_nodata.Font.Size = 9; HyperLink hl = gv_schemesteps.Rows[i].Cells[5].Controls[0] as HyperLink; lbl_nodata.Text = "There was no Progress Report data found for the time period beginning " + hl.Text + "." +" Make sure the start date of this scheme and its steps correspond to the start dates of existing Progress Reports."; lc.Align = "center"; lc.Controls.Add(lbl_nodata); } table.Rows.Add(tr1); table.Rows.Add(tr2); } } div_stats.Controls.Add(table); }
protected void rptRoom_ItemDataBound(object sender, RepeaterItemEventArgs e) { Room item = e.Item.DataItem as Room; if (item != null) { #region Name using (HyperLink hyperLink_Name = e.Item.FindControl("hyperLink_Name") as HyperLink) { if (hyperLink_Name != null) { hyperLink_Name.Text = item.Name; hyperLink_Name.NavigateUrl = string.Format( "RoomEdit.aspx?NodeId={0}&SectionId={1}&RoomId={2}", Node.Id, Section.Id, item.Id); } } #endregion #region Edit using (HyperLink hyperLinkEdit = e.Item.FindControl("hyperLinkEdit") as HyperLink) { if (hyperLinkEdit != null) { hyperLinkEdit.NavigateUrl = string.Format("RoomEdit.aspx?NodeId={0}&SectionId={1}&RoomId={2}", Node.Id, Section.Id, item.Id); } } #endregion #region RoomType using (Label label_RoomType = e.Item.FindControl("label_RoomType") as Label) { if (label_RoomType != null) { label_RoomType.Text = item.RoomType.Name; } } #endregion #region Room Class using (Label label_RoomClass = e.Item.FindControl("label_RoomClass") as Label) { if (label_RoomClass != null) { label_RoomClass.Text = item.RoomClass.Name; } } #endregion Label labelCruise = e.Item.FindControl("labelCruise") as Label; if (labelCruise != null) { try { if (item.Cruise != null) { labelCruise.Text = item.Cruise.Name; } } catch { item.Cruise = null; } } if (_date != DateTime.MinValue) { HtmlTableCell tdAvailable = e.Item.FindControl("tdAvailable") as HtmlTableCell; if (tdAvailable != null) { if (item.IsAvailable) { tdAvailable.InnerText = string.Format("{0} người lớn - {1} trẻ em - {2} trẻ sơ sinh", item.Adult, item.Child, item.Baby); } else { tdAvailable.InnerText = string.Format("{0} người lớn - {1} trẻ em - {2} trẻ sơ sinh", item.Adult, item.Child, item.Baby); tdAvailable.Style[HtmlTextWriterStyle.BackgroundColor] = SailsModule.IMPORTANT; } } } } }
protected override void CreateChildControls() { int policyID = PolicyID; List <PolicyItem> listPolicyItems = PolicyItem.Table.Where(pi => pi.PolicyID == policyID).ToList(); int n = 1; foreach (PolicyItem pItem in listPolicyItems) { Button buttonForView = new Button(); buttonForView.ID = "btnView" + n.ToString(); buttonForView.Text = pItem.InsuranceSubType.ShortDescription; buttonForView.CausesValidation = true; buttonForView.CssClass = "PacketButton"; buttonForView.Click += new EventHandler(buttonForView_Click); //pnlEverything.Controls.Add(buttonForView); pnlViewButtons.Controls.Add(buttonForView); n++; } int j = 0; foreach (PolicyItem pist in listPolicyItems) { List <Broker.DataAccess.Control> listControls = Broker.DataAccess.Control.GetByInsuranceSubType(pist.InsuranceSubTypeID).OrderBy(c => c.OrderNumber).ToList(); HtmlTable defaultTable = new HtmlTable(); defaultTable.Width = "690px"; defaultTable.Style.Add("padding-left", "4px"); HtmlTableRow firstDefaultTableRow = new HtmlTableRow(); defaultTable.Rows.Add(firstDefaultTableRow); HtmlTableCell firstCellFirstRowInDefaultTable = new HtmlTableCell(); firstCellFirstRowInDefaultTable.Width = "172px"; firstDefaultTableRow.Cells.Add(firstCellFirstRowInDefaultTable); Label lblPolicyNumber = new Label(); lblPolicyNumber.ID = "lblPolicyNumber" + (j + 1).ToString(); lblPolicyNumber.Text = "Број на полиса"; firstCellFirstRowInDefaultTable.Controls.Add(lblPolicyNumber); HtmlTableCell secondCellFirstRowInDefaultTable = new HtmlTableCell(); firstDefaultTableRow.Cells.Add(secondCellFirstRowInDefaultTable); TextBox tbPolicyNumber = new TextBox(); tbPolicyNumber.ID = "tbPolicyNumber" + (j + 1).ToString(); tbPolicyNumber.ReadOnly = true; tbPolicyNumber.Font.Bold = true; tbPolicyNumber.Text = pist.PolicyNumber; RequiredFieldValidator rfvPolicyNumber = new RequiredFieldValidator(); rfvPolicyNumber.ID = "rfvPolicyNumber" + (j + 1).ToString(); rfvPolicyNumber.ErrorMessage = "*"; rfvPolicyNumber.Display = ValidatorDisplay.Dynamic; rfvPolicyNumber.ControlToValidate = tbPolicyNumber.ID; secondCellFirstRowInDefaultTable.Controls.Add(tbPolicyNumber); secondCellFirstRowInDefaultTable.Controls.Add(rfvPolicyNumber); HtmlTableRow secondDefaultTableRow = new HtmlTableRow(); defaultTable.Rows.Add(secondDefaultTableRow); HtmlTableCell firstCellSecondRowInDefaultTable = new HtmlTableCell(); firstCellSecondRowInDefaultTable.Width = "172px"; secondDefaultTableRow.Cells.Add(firstCellSecondRowInDefaultTable); Label lblInsuranceType = new Label(); lblInsuranceType.ID = "lblInsuranceType" + (j + 1).ToString(); lblInsuranceType.Text = "Класа на осигурување"; firstCellSecondRowInDefaultTable.Controls.Add(lblInsuranceType); HtmlTableCell secondCellSecondRowInDefaultTable = new HtmlTableCell(); secondDefaultTableRow.Cells.Add(secondCellSecondRowInDefaultTable); TextBox tbInsuranceType = new TextBox(); tbInsuranceType.ID = "tbInsuranceType" + (j + 1).ToString(); tbInsuranceType.Text = pist.InsuranceSubType.InsuranceType.ShortName; tbInsuranceType.Width = 400; tbInsuranceType.ReadOnly = true; secondCellSecondRowInDefaultTable.Controls.Add(tbInsuranceType); HtmlTableRow thirdDefaultTableRow = new HtmlTableRow(); defaultTable.Rows.Add(thirdDefaultTableRow); HtmlTableCell firstCellThirdRowInDefaultTable = new HtmlTableCell(); thirdDefaultTableRow.Cells.Add(firstCellThirdRowInDefaultTable); firstCellThirdRowInDefaultTable.Width = "172px"; Label lblInsuranceSubType = new Label(); lblInsuranceSubType.ID = "lblInsuranceSubType" + (j + 1).ToString(); lblInsuranceSubType.Text = "Подкласа на осигурување"; firstCellThirdRowInDefaultTable.Controls.Add(lblInsuranceSubType); HtmlTableCell secondCellThirdRowInDefaultTable = new HtmlTableCell(); thirdDefaultTableRow.Cells.Add(secondCellThirdRowInDefaultTable); TextBox tbInsuranceSubType = new TextBox(); tbInsuranceSubType.ID = "tbInsuranceSubType" + (j + 1).ToString(); tbInsuranceSubType.Text = pist.InsuranceSubType.ShortDescription; tbInsuranceSubType.Width = 400; tbInsuranceSubType.ReadOnly = true; secondCellThirdRowInDefaultTable.Controls.Add(tbInsuranceSubType); HtmlTableRow realPolicyDefaultTableRow = new HtmlTableRow(); HtmlTableCell fifthCellFourthRowInDefaultTable = new HtmlTableCell(); fifthCellFourthRowInDefaultTable.Width = "172px"; Label lblRealPolicyValue = new Label(); lblRealPolicyValue.ID = "lblRealPolicyValue" + (j + 1).ToString(); lblRealPolicyValue.Text = "Полисирана премија"; fifthCellFourthRowInDefaultTable.Controls.Add(lblRealPolicyValue); HtmlTableCell sixthCellFourthRowInDefaultTable = new HtmlTableCell(); TextBox tbRealPolicyValue = new TextBox(); tbRealPolicyValue.ID = "tbRealPolicyValue" + (j + 1).ToString(); //tbRealPolicyValue.CssClass = "tekstPole"; tbRealPolicyValue.CssClass = "currencyClass"; tbRealPolicyValue.ReadOnly = true; tbRealPolicyValue.Text = String.Format("{0:#,0.00}", pist.RealPremiumValue); sixthCellFourthRowInDefaultTable.Controls.Add(tbRealPolicyValue); realPolicyDefaultTableRow.Cells.Add(fifthCellFourthRowInDefaultTable); realPolicyDefaultTableRow.Cells.Add(sixthCellFourthRowInDefaultTable); defaultTable.Rows.Add(realPolicyDefaultTableRow); HtmlTableRow finDiscountPolicyDefaultTableRow = new HtmlTableRow(); HtmlTableCell fifthCellfinDiscountInDefaultTable = new HtmlTableCell(); fifthCellfinDiscountInDefaultTable.Width = "172px"; Label lblFinDiscount = new Label(); lblFinDiscount.ID = "lblFinDiscount" + (j + 1).ToString(); lblFinDiscount.Text = "Финансиски попуст (%)"; fifthCellfinDiscountInDefaultTable.Controls.Add(lblFinDiscount); HtmlTableCell sixthCellfinDiscountInDefaultTable = new HtmlTableCell(); TextBox tbFinDiscountValue = new TextBox(); tbFinDiscountValue.ID = "tbFinDiscountValue" + (j + 1).ToString(); tbFinDiscountValue.CssClass = "currencyClass"; tbFinDiscountValue.ReadOnly = true; decimal finDiscountValue = 0; if (pist.RealPremiumValue > 0) { finDiscountValue = RateController.Scale5((1 - pist.PremiumValue / pist.RealPremiumValue) * 100); } tbFinDiscountValue.Text = String.Format("{0:#,0.00}", finDiscountValue); sixthCellfinDiscountInDefaultTable.Controls.Add(tbFinDiscountValue); finDiscountPolicyDefaultTableRow.Cells.Add(fifthCellfinDiscountInDefaultTable); finDiscountPolicyDefaultTableRow.Cells.Add(sixthCellfinDiscountInDefaultTable); defaultTable.Rows.Add(finDiscountPolicyDefaultTableRow); TextBox tbPolicyValue = new TextBox(); tbPolicyValue.ID = "tbPolicyValue" + (j + 1).ToString(); tbPolicyValue.CssClass = "currencyClass"; tbPolicyValue.Text = String.Format("{0:#,0.00}", pist.PremiumValue); tbPolicyValue.ReadOnly = true; HtmlTableRow fourthDefaultTableRow = new HtmlTableRow(); fourthDefaultTableRow.BgColor = "#FAFAF8"; defaultTable.Rows.Add(fourthDefaultTableRow); HtmlTableCell firstCellFourthRowInDefaultTable = new HtmlTableCell(); firstCellFourthRowInDefaultTable.Width = "172px"; fourthDefaultTableRow.Cells.Add(firstCellFourthRowInDefaultTable); Label lblPolicyValue = new Label(); lblPolicyValue.ID = "lblPolicyValue" + (j + 1).ToString(); lblPolicyValue.Text = "Премија за наплата"; firstCellFourthRowInDefaultTable.Controls.Add(lblPolicyValue); HtmlTableCell secondCellFourthRowInDefaultTable = new HtmlTableCell(); fourthDefaultTableRow.Cells.Add(secondCellFourthRowInDefaultTable); secondCellFourthRowInDefaultTable.Controls.Add(tbPolicyValue); HtmlTableRow paidValuePolicyDefaultTableRow = new HtmlTableRow(); HtmlTableCell fifthCellpaidValueInDefaultTable = new HtmlTableCell(); Label lblPaidValue = new Label(); lblPaidValue.ID = "lblPaidValue" + (j + 1).ToString(); lblPaidValue.Text = "Уплатено"; fifthCellpaidValueInDefaultTable.Width = "172px"; fifthCellpaidValueInDefaultTable.Controls.Add(lblPaidValue); HtmlTableCell sixthCellpaidValueInDefaultTable = new HtmlTableCell(); TextBox tbPaidValue = new TextBox(); tbPaidValue.ID = "tbPaidValue" + (j + 1).ToString(); tbPaidValue.CssClass = "currencyClass"; tbPaidValue.ReadOnly = true; decimal paidValue = 0; List <Payment> lst = Payment.GetByPolicyItemID(pist.ID); foreach (Payment payment in lst) { paidValue += payment.Value; } tbPaidValue.Text = String.Format("{0:#,0.00}", paidValue); sixthCellpaidValueInDefaultTable.Controls.Add(tbPaidValue); paidValuePolicyDefaultTableRow.Cells.Add(fifthCellpaidValueInDefaultTable); paidValuePolicyDefaultTableRow.Cells.Add(sixthCellpaidValueInDefaultTable); defaultTable.Rows.Add(paidValuePolicyDefaultTableRow); HtmlTableRow toPaidValuePolicyDefaultTableRow = new HtmlTableRow(); HtmlTableCell fifthCelltoPaidValueInDefaultTable = new HtmlTableCell(); Label lblToPaidValue = new Label(); lblToPaidValue.ID = "lblToPaidValue" + (j + 1).ToString(); lblToPaidValue.Text = "Должна премија"; fifthCelltoPaidValueInDefaultTable.Width = "172px"; fifthCelltoPaidValueInDefaultTable.Controls.Add(lblToPaidValue); HtmlTableCell sixthCelltoPaidValueInDefaultTable = new HtmlTableCell(); TextBox tbToPaidValue = new TextBox(); tbToPaidValue.ID = "tbToPaidValue" + (j + 1).ToString(); tbToPaidValue.CssClass = "currencyClass"; tbToPaidValue.ReadOnly = true; tbToPaidValue.Text = String.Format("{0:#,0.00}", (pist.PremiumValue - paidValue)); sixthCelltoPaidValueInDefaultTable.Controls.Add(tbToPaidValue); toPaidValuePolicyDefaultTableRow.Cells.Add(fifthCelltoPaidValueInDefaultTable); toPaidValuePolicyDefaultTableRow.Cells.Add(sixthCelltoPaidValueInDefaultTable); defaultTable.Rows.Add(toPaidValuePolicyDefaultTableRow); HtmlTableRow seventhDefaultTableRow = new HtmlTableRow(); defaultTable.Rows.Add(seventhDefaultTableRow); HtmlTableCell firstCellSeventhRowInDefaultTable = new HtmlTableCell(); seventhDefaultTableRow.Cells.Add(firstCellSeventhRowInDefaultTable); Label lblStatus = new Label(); lblStatus.ID = "lblStatus" + (j + 1).ToString(); lblStatus.Text = "Статус"; firstCellSeventhRowInDefaultTable.Width = "172px"; firstCellSeventhRowInDefaultTable.Controls.Add(lblStatus); HtmlTableCell secondCellSeventhRowInDefaultTable = new HtmlTableCell(); seventhDefaultTableRow.Cells.Add(secondCellSeventhRowInDefaultTable); TextBox tbStatus = new TextBox(); tbStatus.ID = "tbStatus" + (j + 1).ToString(); tbStatus.ReadOnly = true; tbStatus.Text = pist.Statuse.Description; secondCellSeventhRowInDefaultTable.Controls.Add(tbStatus); mvPolicyItem.Views[j].Controls.Clear(); mvPolicyItem.Views[j].Controls.Add(defaultTable); HtmlTable table = new HtmlTable(); table.Width = "690px"; table.Style.Add("padding-left", "4px"); int counter = 0; foreach (Broker.DataAccess.Control c in listControls) { if (c.IsActive) { if (c.ColumnNumber == 1) { HtmlTableRow tableRow = new HtmlTableRow(); table.Rows.Add(tableRow); HtmlTableCell tableCell = new HtmlTableCell(); tableCell.Width = "172px"; tableRow.Cells.Add(tableCell); Label label = new Label(); label.ID = c.LabelID + j.ToString(); label.Text = c.LabelName; tableCell.Controls.Add(label); HtmlTableCell tableCellSecond = new HtmlTableCell(); tableRow.Cells.Add(tableCellSecond); if (c.FieldType.Name == FieldType.CHECKBOX) { CheckBox checkBox = new CheckBox(); checkBox.ID = c.TextBoxID + j.ToString(); PolicyExtendInformation pei = PolicyExtendInformation.GetByPolicyItemAndControl(pist.ID, c.ID); if (pei != null) { if (pei.Value != null) { try { checkBox.Checked = Boolean.Parse(pei.Value); checkBox.Enabled = false; tableCellSecond.Controls.Add(checkBox); } catch { continue; } } } } else { TextBox textbox = new TextBox(); textbox.ID = c.TextBoxID + j.ToString(); textbox.ReadOnly = true; PolicyExtendInformation pei = PolicyExtendInformation.GetByPolicyItemAndControl(pist.ID, c.ID); if (pei != null) { textbox.Text = pei.Value; if (pei.Value != string.Empty) { ValidationDataType vdt = Broker.DataAccess.VariableType.GetForVariableType(c.VariableTypeID); if (vdt == ValidationDataType.Double) { textbox.CssClass = "currencyClass"; textbox.Text = String.Format("{0:#,0.00}", pei.Value); } } } tableCellSecond.Controls.Add(textbox); } } else if (c.ColumnNumber == 2) { HtmlTableRow tableRow = table.Rows[counter / 2]; if ((counter % 4 == 0) || (counter % 4 == 1)) { tableRow.BgColor = "#FAFAF8"; } HtmlTableCell tableCellThird = new HtmlTableCell(); tableCellThird.Width = "172px"; tableRow.Cells.Add(tableCellThird); Label label = new Label(); label.ID = c.LabelID + j.ToString(); label.Text = c.LabelName; tableCellThird.Controls.Add(label); HtmlTableCell tableCellForth = new HtmlTableCell(); tableCellForth.Width = "172px"; tableRow.Cells.Add(tableCellForth); if (c.FieldType.Name == FieldType.CHECKBOX) { CheckBox checkBox = new CheckBox(); checkBox.ID = c.TextBoxID + j.ToString(); PolicyExtendInformation pei = PolicyExtendInformation.GetByPolicyItemAndControl(pist.ID, c.ID); if (pei != null) { if (pei.Value != null) { try { checkBox.Checked = Boolean.Parse(pei.Value); checkBox.Enabled = false; tableCellForth.Controls.Add(checkBox); } catch { continue; } } } } else { TextBox textbox = new TextBox(); textbox.ID = c.TextBoxID + j.ToString(); textbox.ReadOnly = true; PolicyExtendInformation pei = PolicyExtendInformation.GetByPolicyItemAndControl(pist.ID, c.ID); if (pei != null) { textbox.Text = pei.Value; if (pei.Value != string.Empty) { ValidationDataType vdt = Broker.DataAccess.VariableType.GetForVariableType(c.VariableTypeID); if (vdt == ValidationDataType.Double) { textbox.CssClass = "currencyClass"; textbox.Text = String.Format("{0:#,0.00}", pei.Value); } } } tableCellForth.Controls.Add(textbox); } } } counter++; } mvPolicyItem.Views[j].Controls.Add(table); j++; } base.CreateChildControls(); }
private void GetGroups() { int nStudyID; if (IsPostBack) { nStudyID = Convert.ToInt32(hidStudyID.Value.ToString()); } else { nStudyID = Convert.ToInt32(Request["StudyID"].ToString()); } hidStudyID.Value = nStudyID.ToString(); SqlCommand oCmd = new SqlCommand(); oCmd.Connection = Master.SqlConn; oCmd.CommandTimeout = 90; oCmd.CommandType = CommandType.StoredProcedure; oCmd.CommandText = "spGetGroupsByStudyID"; oCmd.Parameters.Add(new SqlParameter("@StudyID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Default, nStudyID)); SqlDataReader oReader = oCmd.ExecuteReader(); HtmlTableRow oTr; HtmlTableCell oTd; int nRowCount = 0; bool bDisplayedHeader = false; while (oReader.Read()) { if (!bDisplayedHeader) { #region Display Column Headers oTr = new HtmlTableRow(); oTr.Attributes["class"] = "trHeader"; oTd = new HtmlTableCell(); oTd.InnerHtml = "Order"; oTr.Cells.Add(oTd); oTd = new HtmlTableCell(); oTd.InnerHtml = "Group Name"; oTr.Cells.Add(oTd); oTd = new HtmlTableCell(); oTd.InnerHtml = "Group Desc."; oTr.Cells.Add(oTd); oTd = new HtmlTableCell(); oTd.InnerHtml = "Goal #"; oTr.Cells.Add(oTd); tblMaster.Rows.Insert(nRowCount + 1, oTr); bDisplayedHeader = true; #endregion } #region Display the Form Controls for Each Group oTr = new HtmlTableRow(); oTd = new HtmlTableCell(); oTd.InnerHtml += "<input type=\"text\" name=\"txtSortOrder\" value=\"" + oReader["SortOrder"].ToString() + "\" style=\"width: 50px;\" maxlength=\"5\" id=\"txtSortOrder" + oReader["GroupID"].ToString() + "\" />"; oTr.Cells.Add(oTd); oTd = new HtmlTableCell(); oTd.InnerHtml += "<input type=\"text\" name=\"txtGroupName\" value=\"" + oReader["GroupName"].ToString() + "\" style=\"width: 100px;\" id=\"txtGroupName" + oReader["GroupID"].ToString() + "\" />"; oTr.Cells.Add(oTd); oTd = new HtmlTableCell(); oTd.InnerHtml += "<input type=\"text\" name=\"txtGroupDesc\" value=\"" + oReader["GroupDesc"].ToString() + "\" style=\"width: 400px;\" id=\"txtGroupDesc" + oReader["GroupID"].ToString() + "\" />"; oTr.Cells.Add(oTd); oTd = new HtmlTableCell(); oTd.InnerHtml += "<input type=\"text\" name=\"txtGoalN\" value=\"" + oReader["GoalN"].ToString() + "\" style=\"width: 50px;\" maxlength=\"5\" id=\"txtGoalN" + oReader["GroupID"].ToString() + "\" />"; oTd.InnerHtml += "<input type=\"hidden\" name=\"hidGroupID\" value=\"" + oReader["GroupID"].ToString() + "\" id=\"hidGroupID" + oReader["GroupID"].ToString() + "\" />"; oTr.Cells.Add(oTd); tblMaster.Rows.Insert(nRowCount + 2, oTr); #endregion nRowCount++; } oReader.Close(); }
private void danyuangehebing() { for (int i = rptKQTJ.Items.Count - 1; i > 0; i--) { HtmlTableCell oCell_previous0 = rptKQTJ.Items[i - 1].FindControl("td_ST_WORKNO") as HtmlTableCell; HtmlTableCell oCell0 = rptKQTJ.Items[i].FindControl("td_ST_WORKNO") as HtmlTableCell; HtmlTableCell oCell_previous1 = rptKQTJ.Items[i - 1].FindControl("td_ST_NAME") as HtmlTableCell; HtmlTableCell oCell1 = rptKQTJ.Items[i].FindControl("td_ST_NAME") as HtmlTableCell; HtmlTableCell oCell_previous2 = rptKQTJ.Items[i - 1].FindControl("td_DEP_NAME") as HtmlTableCell; HtmlTableCell oCell2 = rptKQTJ.Items[i].FindControl("td_DEP_NAME") as HtmlTableCell; HtmlTableCell oCell_previous3 = rptKQTJ.Items[i - 1].FindControl("td_ST_DEPID1") as HtmlTableCell; HtmlTableCell oCell3 = rptKQTJ.Items[i].FindControl("td_ST_DEPID1") as HtmlTableCell; HtmlTableCell oCell_previous4 = rptKQTJ.Items[i - 1].FindControl("td_MXZY_YEARMONTH") as HtmlTableCell; HtmlTableCell oCell4 = rptKQTJ.Items[i].FindControl("td_MXZY_YEARMONTH") as HtmlTableCell; HtmlTableCell oCell_previous5 = rptKQTJ.Items[i - 1].FindControl("td_MXZY_GZRCQ") as HtmlTableCell; HtmlTableCell oCell5 = rptKQTJ.Items[i].FindControl("td_MXZY_GZRCQ") as HtmlTableCell; oCell0.RowSpan = (oCell0.RowSpan == -1) ? 1 : oCell0.RowSpan; oCell_previous0.RowSpan = (oCell_previous0.RowSpan == -1) ? 1 : oCell_previous0.RowSpan; oCell1.RowSpan = (oCell1.RowSpan == -1) ? 1 : oCell1.RowSpan; oCell_previous1.RowSpan = (oCell_previous1.RowSpan == -1) ? 1 : oCell_previous1.RowSpan; oCell2.RowSpan = (oCell2.RowSpan == -1) ? 1 : oCell2.RowSpan; oCell_previous2.RowSpan = (oCell_previous2.RowSpan == -1) ? 1 : oCell_previous2.RowSpan; oCell3.RowSpan = (oCell3.RowSpan == -1) ? 1 : oCell3.RowSpan; oCell_previous3.RowSpan = (oCell_previous3.RowSpan == -1) ? 1 : oCell_previous3.RowSpan; oCell4.RowSpan = (oCell4.RowSpan == -1) ? 1 : oCell4.RowSpan; oCell_previous4.RowSpan = (oCell_previous4.RowSpan == -1) ? 1 : oCell_previous4.RowSpan; oCell5.RowSpan = (oCell5.RowSpan == -1) ? 1 : oCell5.RowSpan; oCell_previous5.RowSpan = (oCell_previous5.RowSpan == -1) ? 1 : oCell_previous5.RowSpan; if (oCell0.InnerText == oCell_previous0.InnerText) { oCell0.Visible = false; oCell_previous0.RowSpan += oCell0.RowSpan; oCell1.Visible = false; oCell_previous1.RowSpan += oCell1.RowSpan; oCell2.Visible = false; oCell_previous2.RowSpan += oCell2.RowSpan; oCell3.Visible = false; oCell_previous3.RowSpan += oCell3.RowSpan; oCell4.Visible = false; oCell_previous4.RowSpan += oCell4.RowSpan; oCell5.Visible = false; oCell_previous5.RowSpan += oCell5.RowSpan; } } }
//可见性控制 protected void rptTravel_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView dr = (DataRowView)e.Item.DataItem; string lbTA_Code = ((Label)e.Item.FindControl("lbTA_Code")).Text.Trim(); HyperLink hlkViewOrAudit = e.Item.FindControl("HyperLink1") as HyperLink; Label wordtext = e.Item.FindControl("wordtext") as Label; HyperLink hlkEdit = e.Item.FindControl("HyperLink2") as HyperLink; HyperLink hlkSure = e.Item.FindControl("HyperLink3") as HyperLink; LinkButton lnkDelete = e.Item.FindControl("lnkDelete") as LinkButton; HtmlTableCell validcode = e.Item.FindControl("validcode") as HtmlTableCell; wordtext.Text = "查看"; hlkViewOrAudit.NavigateUrl = "OM_TravelApplyDetail.aspx?action=view&key=" + lbTA_Code + ""; hlkEdit.Visible = false; hlkSure.Visible = false; lnkDelete.Visible = false; if (rblState.SelectedValue == "0" || rblState.SelectedValue == "3")//0未提交、3已驳回 { if (stid == dr["TA_ZDRID"].ToString()) { hlkEdit.Visible = true; lnkDelete.Visible = true; } } else if (rblState.SelectedValue == "1")//审核中 { if (stid == dr["TA_SHRIDA"].ToString() && dr["TA_State"].ToString() == "1") { wordtext.Text = "审核"; hlkViewOrAudit.NavigateUrl = "OM_TravelApplyDetail.aspx?action=audit&key=" + lbTA_Code + ""; } if (dr["TA_SHLevel"].ToString() != "1") { if (stid == dr["TA_SHRIDB"].ToString() && dr["TA_State"].ToString() == "2") { wordtext.Text = "审核"; hlkViewOrAudit.NavigateUrl = "OM_TravelApplyDetail.aspx?action=audit&key=" + lbTA_Code + ""; } if (dr["TA_SHLevel"].ToString() == "3") { if (stid == dr["TA_SHRIDC"].ToString() && dr["TA_State"].ToString() == "3") { wordtext.Text = "审核"; hlkViewOrAudit.NavigateUrl = "OM_TravelApplyDetail.aspx?action=audit&key=" + lbTA_Code + ""; } } } } else if (rblState.SelectedValue == "2")//已通过 { if (stid == dr["TA_ZDRID"].ToString()) { hlkSure.Visible = true; } } else if (rblState.SelectedValue == "5")//我的审核任务 { if (dr["TA_State"].ToString() == "0") { hlkEdit.Visible = true; lnkDelete.Visible = true; } else if (dr["TA_State"].ToString() == "4") { hlkSure.Visible = true; } else if (dr["TA_State"].ToString() == "5") { hlkEdit.Visible = true; lnkDelete.Visible = true; } else { wordtext.Text = "审核"; hlkViewOrAudit.NavigateUrl = "OM_TravelApplyDetail.aspx?action=audit&key=" + lbTA_Code + ""; } } else if (rblState.SelectedValue == "")//全部 { if ((dr["TA_State"].ToString() == "0" || dr["TA_State"].ToString() == "5") && stid == dr["TA_ZDRID"].ToString()) { hlkEdit.Visible = true; lnkDelete.Visible = true; } else if (dr["TA_State"].ToString() == "1") { if (stid == dr["TA_SHRIDA"].ToString()) { wordtext.Text = "审核"; hlkViewOrAudit.NavigateUrl = "OM_TravelApplyDetail.aspx?action=audit&key=" + lbTA_Code + ""; } } else if (dr["TA_State"].ToString() == "2") { if (stid == dr["TA_SHRIDB"].ToString()) { wordtext.Text = "审核"; hlkViewOrAudit.NavigateUrl = "OM_TravelApplyDetail.aspx?action=audit&key=" + lbTA_Code + ""; } } else if (dr["TA_State"].ToString() == "3") { if (stid == dr["TA_SHRIDC"].ToString()) { wordtext.Text = "审核"; hlkViewOrAudit.NavigateUrl = "OM_TravelApplyDetail.aspx?action=audit&key=" + lbTA_Code + ""; } } else if (dr["TA_State"].ToString() == "4") { if (stid == dr["TA_ZDRID"].ToString()) { hlkSure.Visible = true; } } } if (listcode.Contains(lbTA_Code)) { hlkViewOrAudit.Visible = false; hlkEdit.Visible = false; hlkSure.Visible = false; lnkDelete.Visible = false; validcode.InnerText = ""; } else { listcode.Add(lbTA_Code); } } }
private bool InitializeMSARecommendationControls(int recommendationId) { try { using (SPSite oSPsite = new SPSite(SPContext.Current.Web.Url)) { using (SPWeb oSPWeb = oSPsite.OpenWeb()) { string listName = "MSARecommendation"; // Fetch the List SPList spListMSAR = oSPWeb.GetList(string.Format("{0}/Lists/{1}/AllItems.aspx", oSPWeb.Url, listName)); if (spListMSAR != null) { SPListItem spListItemMSAR = spListMSAR.GetItemById(recommendationId); if (spListItemMSAR != null) { bool isAllowed = true; bool isCompleted = false; SPUser responsiblePerson = null; //Check Permissions if (spListItemMSAR["Assignee"] != null) { string assignee = Convert.ToString(spListItemMSAR["Assignee"]); SPUser currentUser = oSPWeb.CurrentUser; if (currentUser != null && !Utility.CompareUsername(currentUser.LoginName, assignee)) { isAllowed = false; } if (isAllowed == false) { if (CheckPermission()) { DisableControls(); } else { string accessDeniedUrl = Utility.GetRedirectUrl("Access_Denied"); if (!String.IsNullOrEmpty(accessDeniedUrl)) { DisableControls(); Page.Response.Redirect(accessDeniedUrl, false); } return(false); } } } if (spListItemMSAR["Status"] != null) { string status = Convert.ToString(spListItemMSAR["Status"]); if (status.Equals("Completed", StringComparison.OrdinalIgnoreCase)) { isCompleted = true; this.approvedBy_div.Visible = true; DisableControls(); } } if (spListItemMSAR["TargetDate"] != null) { DateTime targetDate; bool bValid = DateTime.TryParse(Convert.ToString(spListItemMSAR["TargetDate"]), new CultureInfo("en-GB"), DateTimeStyles.AssumeLocal, out targetDate); if (!bValid) { targetDate = Convert.ToDateTime(spListItemMSAR["TargetDate"]); } this.targetDate_tf.Value = targetDate.ToShortDateString(); } if (!String.IsNullOrEmpty(Convert.ToString(spListItemMSAR["RecommendationNo"]))) { this.recommendationNo_tf.Value = Convert.ToString(spListItemMSAR["RecommendationNo"]); } if (!String.IsNullOrEmpty(Convert.ToString(spListItemMSAR["Status"]))) { this.status_ddl.Value = Convert.ToString(spListItemMSAR["Status"]); } if (!String.IsNullOrEmpty(Convert.ToString(spListItemMSAR["MSARecommendationDescription"]))) { this.description_ta.Value = Convert.ToString(spListItemMSAR["MSARecommendationDescription"]); } if (!String.IsNullOrEmpty(Convert.ToString(spListItemMSAR["ResponsibleDepartment"]))) { this.responsibleDepartment_tf.Value = Convert.ToString(spListItemMSAR["ResponsibleDepartment"]); } if (!String.IsNullOrEmpty(Convert.ToString(spListItemMSAR["ResponsibleSection"]))) { this.responsibleSection_tf.Value = Convert.ToString(spListItemMSAR["ResponsibleSection"]); } if (!String.IsNullOrEmpty(Convert.ToString(spListItemMSAR["InjuryClass"]))) { this.injuryClassification_tf.Value = Convert.ToString(spListItemMSAR["InjuryClass"]); } if (!String.IsNullOrEmpty(Convert.ToString(spListItemMSAR["TypeOfVoilation"]))) { this.typeOfVoilation_tf.Value = Convert.ToString(spListItemMSAR["TypeOfVoilation"]); } if (!String.IsNullOrEmpty(Convert.ToString(spListItemMSAR["ObservationCategory"]))) { this.observationCategoryA_tf.Value = Convert.ToString(spListItemMSAR["ObservationCategory"]); } if (!String.IsNullOrEmpty(Convert.ToString(spListItemMSAR["ObservationCategory"]))) { this.observationCategoryA_tf.Value = Convert.ToString(spListItemMSAR["ObservationCategory"]); } if (!String.IsNullOrEmpty(Convert.ToString(spListItemMSAR["LastStatement"]))) { this.lastStatement_ta.Value = Convert.ToString(spListItemMSAR["LastStatement"]); } if (!String.IsNullOrEmpty(Convert.ToString(spListItemMSAR["ClosureJustification"]))) { string guessMePattern = "*|~^|^~|*"; string justifications = Convert.ToString(spListItemMSAR["ClosureJustification"]); this.history_div.InnerHtml = Utility.GetFormattedData(justifications, guessMePattern, true); } else { this.history_div.InnerHtml = "<p class='dataItem'>There is no history available.</p>"; } if (!String.IsNullOrEmpty(Convert.ToString(spListItemMSAR["ApprovedBy"]))) { this.approvedBy_tf.Value = Convert.ToString(spListItemMSAR["ApprovedBy"]); } foreach (String attachmentname in spListItemMSAR.Attachments) { String attachmentAbsoluteURL = spListItemMSAR.Attachments.UrlPrefix // gets the containing directory URL + attachmentname; // To get the SPSile reference to the attachment just use this code SPFile attachmentFile = oSPWeb.GetFile(attachmentAbsoluteURL); StringBuilder sb = new StringBuilder(); HtmlTableRow tRow = new HtmlTableRow(); HtmlTableCell removeLink = new HtmlTableCell(); HtmlTableCell fileLink = new HtmlTableCell(); sb.Append(String.Format("<a href='{0}/{1}' target='_blank'>{2}</a>", oSPWeb.Url, attachmentFile.Url, attachmentname)); removeLink.InnerHtml = "<span class='btn-danger removeLink' style='padding:3px; margin-right:3px; border-radius:2px;'><i class='glyphicon glyphicon-remove'></i></span><span class='fileName' style='display:none;'>" + attachmentFile.Name + "</span>"; fileLink.InnerHtml = sb.ToString(); tRow.Cells.Add(removeLink); tRow.Cells.Add(fileLink); this.grdAttachments.Rows.Add(tRow); } //Responsible Person if (!String.IsNullOrEmpty(Convert.ToString(spListItemMSAR["ResponsiblePerson"]))) { string username = Convert.ToString(spListItemMSAR["ResponsiblePerson"]); responsiblePerson = Utility.GetUser(oSPWeb, username); if (responsiblePerson == null) { if (!String.IsNullOrEmpty(Convert.ToString(spListItemMSAR["Assignee"]))) { string tempUsername = Convert.ToString(spListItemMSAR["Assignee"]); responsiblePerson = Utility.GetUser(oSPWeb, tempUsername); } } if (responsiblePerson != null) { // Clear existing users from control this.responsiblePerson_PeopleEditor.Entities.Clear(); // PickerEntity object is used by People Picker Control PickerEntity UserEntity = new PickerEntity(); // CurrentUser is SPUser object UserEntity.DisplayText = responsiblePerson.Name; UserEntity.Key = responsiblePerson.LoginName; // Add PickerEntity to People Picker control this.responsiblePerson_PeopleEditor.Entities.Add(this.responsiblePerson_PeopleEditor.ValidateEntity(UserEntity)); } } //Status if (!String.IsNullOrEmpty(Convert.ToString(spListItemMSAR["Status"]))) { //Write some code here } //ResponsibleSection if (spListItemMSAR["ResponsibleSection"] != null) { int sectionId = Convert.ToInt32(spListItemMSAR["ResponsibleSection"]); listName = "Section"; // Fetch the List SPList spList = oSPWeb.GetList(string.Format("{0}/Lists/{1}/AllItems.aspx", oSPWeb.Url, listName)); if (spList != null && sectionId > 0) { SPListItem spListItem = spList.GetItemById(sectionId); if (spListItem != null) { this.responsibleSection_tf.Value = Convert.ToString(spListItem["Title"]); } } } //ResponsibleDepartment if (spListItemMSAR["ResponsibleDepartment"] != null) { int id = Convert.ToInt32(spListItemMSAR["ResponsibleDepartment"]); listName = "Department"; // Fetch the List SPList spList = oSPWeb.GetList(string.Format("{0}/Lists/{1}/AllItems.aspx", oSPWeb.Url, listName)); if (spList != null && id > 0) { SPListItem spListItem = spList.GetItemById(id); if (spListItem != null) { string departmentName = Convert.ToString(spListItem["Title"]); this.responsibleDepartment_tf.Value = departmentName; if (String.IsNullOrEmpty(this.approvedBy_tf.Value)) { var hodLI = FillApprovalAuthority(oSPWeb, departmentName); var currentUser = oSPWeb.CurrentUser; if (currentUser != null && hodLI != null && currentUser.Email.Equals(hodLI.Value, StringComparison.OrdinalIgnoreCase)) { this.approvalAuthority_ddl.SelectedValue = hodLI.Value; this.approvalAuthority_ddl.Enabled = false; this.approvalAuthority_ddl.Attributes.Add("class", "formcontrol disableControl"); } } else { var user = Utility.GetUser(oSPWeb, null, this.approvedBy_tf.Value); if (user != null) { this.approvalAuthority_ddl.Items.Add(new ListItem(user.Name, user.Email)); this.approvalAuthority_ddl.Enabled = false; this.approvalAuthority_ddl.Attributes.Add("class", "formcontrol disableControl"); this.approvedBy_tf.Value = user.Name; this.approvalAuthority_ddl.Items.Insert(0, new ListItem("Please Select", "0")); this.approvalAuthority_ddl.DataBind(); this.approvalAuthority_ddl.SelectedValue = user.Email; } } } } } //Initiated By if (spListItemMSAR["MSAID"] != null) { int id = Convert.ToInt32(spListItemMSAR["MSAID"]); //Department listName = "MSA"; // Fetch the List SPList spList = oSPWeb.GetList(string.Format("{0}/Lists/{1}/AllItems.aspx", oSPWeb.Url, listName)); if (spList != null) { SPListItem spListItem = spList.GetItemById(id); if (spListItem != null) { if (!String.IsNullOrEmpty(Convert.ToString(spListItem["AuditedBy"]))) { string auditedBy = Convert.ToString(spListItem["AuditedBy"]); var spUser = Utility.GetUser(oSPWeb, auditedBy); if (spUser != null) { this.initiatedBy_tf.Value = spUser.Name; } else { this.initiatedBy_tf.Value = Convert.ToString(spListItem["AuditedBy"]); } } } } } //Update Control on the basis of current operation SPUser spCurrentUser = oSPWeb.CurrentUser; string approvingAuthorityEmail = null; if (this.approvalAuthority_ddl != null && this.approvalAuthority_ddl.Items.Count > 0) { approvingAuthorityEmail = this.approvalAuthority_ddl.SelectedValue; } //Case: Responsible Person is also Approving Authority if (isAllowed == true && isCompleted == false && responsiblePerson != null && !String.IsNullOrEmpty(responsiblePerson.Email) && responsiblePerson.Email.Equals(approvingAuthorityEmail, StringComparison.OrdinalIgnoreCase)) { this.btnReject.Visible = false; this.btnApprove.Visible = true; this.btnSend.Visible = false; this.approvedBy_div.Visible = true; this.approvedBy_tf.Value = responsiblePerson.Name; } else if (isAllowed == true && isCompleted == false && spCurrentUser != null && !String.IsNullOrEmpty(approvingAuthorityEmail)) { if (spCurrentUser.Email.Equals(approvingAuthorityEmail, StringComparison.OrdinalIgnoreCase)) { this.btnApprove.Visible = true; this.btnReject.Visible = true; this.btnSend.Visible = false; //this.btnSave.Visible = true; this.approvedBy_div.Visible = true; } else { this.btnApprove.Visible = false; this.btnReject.Visible = false; this.btnSend.Visible = true; //this.btnSave.Visible = true; this.approvedBy_div.Visible = false; } } else { DisableControls(); } bool isSavedAsDraft = Convert.ToBoolean(spListItemMSAR["IsSavedAsDraft"]); if (isSavedAsDraft == true) { DisableControls(); } } } return(true); } } } catch (Exception ex) { SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("SL.FG.FFL(MSARecommendation->InitializeMSARecommendationControls)", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, ex.Message, ex.StackTrace); message_div.InnerHtml = "Something went wrong!!! Please Contact the administrator."; DisableControls(); } return(false); }
/// <summary> /// /// </summary> /// <param name="question"></param> /// <param name="options"></param> /// <param name="answerList"></param> /// <param name="tableOptions"></param> /// <param name="questionIndex"></param> private void PopulateQuestion(SurveyQuestions question, HtmlTable tableOptions, int questionIndex) { var rowQuestion = new HtmlTableRow(); var cellQuestion = new HtmlTableCell(); var cellQuestionTitle = new HtmlTableCell(); var strongQuestion = new HtmlGenericControl(); rowQuestion.Controls.Add(cellQuestionTitle); rowQuestion.Controls.Add(cellQuestion); tableOptions.Controls.Add(rowQuestion); cellQuestionTitle.Controls.Add(strongQuestion); if (question == null || question.ListSurveyOptions.Count == 0) { cellQuestion.Controls.Add(new Label { Text = "QuestionsNotAvailableText" }); } else { //cellQuestionTitle.Controls.Add(new HtmlGenericControl("BR")); cellQuestion.Controls.Add(new Label { Text = question.QuestionText }); cellQuestion.Attributes.Add("class", "question-title"); //cellQuestion.Controls.Add(new HtmlGenericControl("BR")); var strongOption = new HtmlGenericControl(); var cellOptionTitle = new HtmlTableCell(); cellOptionTitle.Controls.Add(strongOption); var isFirstOption = true; foreach (var option in question.ListSurveyOptions) { var rowOption = new HtmlTableRow(); var cellOption = new HtmlTableCell(); var cellOptionLabel = new HtmlTableCell(); if (isFirstOption) { rowOption.Controls.Add(cellOptionTitle); isFirstOption = false; } else { rowOption.Controls.Add(cellOptionLabel); } if (option.Type == QuestionType.Feedback) { cellOption.Controls.Add( new TextBox { ID = string.Format("txtOption{0}", option.Id), }); } else if (option.Type == QuestionType.MultipleChoice) { var ui = new CheckBox { Text = option.OptionText, ID = string.Format("chkOption{0}", option.Id), }; ui.Attributes["onChange"] = "OnSurveyOptionChange($(this));"; cellOption.Controls.Add(ui); cellOption.Attributes.Add("class", "check-option"); if (option.NeedComment) { AppendNeedCommentUI(cellOption, option, ui); } } else { var ui = new RadioButton { Text = option.OptionText, ID = string.Format("rdOption{0}", option.Id), GroupName = string.Format("optionsQuestion{0}", question.Id), Checked = false }; ui.Attributes["onChange"] = "OnSurveyOptionChange($(this));"; cellOption.Controls.Add(ui); if (option.NeedComment) { AppendNeedCommentUI(cellOption, option, ui); } } rowOption.Controls.Add(cellOption); tableOptions.Controls.Add(rowOption); } var rowSpace = new HtmlTableRow(); var cellSpace = new HtmlTableCell { ColSpan = 2 }; cellSpace.Controls.Add(new HtmlGenericControl("HR")); rowSpace.Controls.Add(cellSpace); tableOptions.Controls.Add(rowSpace); } }
private void ConfigurePatientRepeater(Object Sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Header) { HtmlTableCell ControlCellTitle = (HtmlTableCell)e.Item.FindControl("ControlCellTitle"); HtmlTableCell ControlCellTitle2 = (HtmlTableCell)e.Item.FindControl("ControlCellTitle2"); Literal ControlTitle = (Literal)e.Item.FindControl("ControlTitle"); Literal ControlTitle2 = (Literal)e.Item.FindControl("ControlTitle2"); HtmlTableCell DateOfBirthCellTitle = (HtmlTableCell)e.Item.FindControl("DateOfBirthCellTitle"); HtmlTableCell MRNCellTitle = (HtmlTableCell)e.Item.FindControl("MRNCellTitle"); HtmlTableCell HrefLinkCellTitle = (HtmlTableCell)e.Item.FindControl("HrefLinkCellTitle"); Literal HrefLinkTitle = (Literal)e.Item.FindControl("HrefLinkTitle"); ControlCellTitle.Style["display"] = ""; ControlCellTitle2.Style["display"] = ""; DateOfBirthCellTitle.Style["display"] = ""; MRNCellTitle.Style["display"] = ""; HrefLinkCellTitle.Style["display"] = ""; ControlCellTitle.Style["width"] = "10%"; ControlCellTitle2.Style["display"] = "25%"; DateOfBirthCellTitle.Style["width"] = "20%"; MRNCellTitle.Style["width"] = "20%"; HrefLinkCellTitle.Style["width"] = "25%"; //ControlTitle.Text = "Was Patient Called?"; ControlTitle2.Text = "Patient Status"; HrefLinkTitle.Text = "Name"; } if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { // create a reference to the current tr System.Web.UI.HtmlControls.HtmlContainerControl listRow; listRow = (System.Web.UI.HtmlControls.HtmlContainerControl)e.Item.FindControl("listRow"); HtmlTableCell ControlCellValue = (HtmlTableCell)e.Item.FindControl("ControlCellValue"); HtmlTableCell ControlCellValue2 = (HtmlTableCell)e.Item.FindControl("ControlCellValue2"); ImageButton PatientCalledBtn = (ImageButton)e.Item.FindControl("PatientCalledBtn"); ImageButton CurrentBtn = (ImageButton)e.Item.FindControl("CurrentBtn"); ImageButton DoNotContactPerMDBtn = (ImageButton)e.Item.FindControl("DoNotContactPerMDBtn"); HtmlTableCell DateOfBirthCellValue = (HtmlTableCell)e.Item.FindControl("DateOfBirthCellValue"); HtmlTableCell MRNCellValue = (HtmlTableCell)e.Item.FindControl("MRNCellValue"); HtmlTableCell HrefLinkCellValue = (HtmlTableCell)e.Item.FindControl("HrefLinkCellValue"); Literal HrefLinkValue = (Literal)e.Item.FindControl("HrefLinkValue"); ControlCellValue.Style["display"] = ""; ControlCellValue2.Style["display"] = ""; DateOfBirthCellValue.Style["display"] = ""; MRNCellValue.Style["display"] = ""; HrefLinkCellValue.Style["display"] = ""; string firstName = String.Empty; string lastName = String.Empty; if (((DataRowView)e.Item.DataItem)[Patient.PtFirstName].ToString().Length > 0) { firstName = ((DataRowView)e.Item.DataItem)[Patient.PtFirstName].ToString(); } if (((DataRowView)e.Item.DataItem)[Patient.PtLastName].ToString().Length > 0) { lastName = ((DataRowView)e.Item.DataItem)[Patient.PtLastName].ToString(); } SetLinkToPagePatientData(Sender, e, HrefLinkCellValue); HrefLinkValue.Text = !String.IsNullOrEmpty(firstName) ? lastName + ", " + firstName : lastName; } }
private void bindData(int id) { DataTable dth = null, dt = null, dtg = null; string category = "", newCategory = ""; using (var sd = new SecureData(false, UserManager.GetLoginToken(true))) { dth = sd.GetData("web_accession_maps_header", ":accessionid=" + id, 0, 0).Tables["web_accession_maps_header"]; dt = sd.GetData("web_accessiondetail_observation_phenotype", ":accessionid=" + id, 0, 0).Tables["web_accessiondetail_observation_phenotype"]; dtg = sd.GetData("web_accessiondetail_observation_genotype", ":accessionid=" + id, 0, 0).Tables["web_accessiondetail_observation_genotype"]; } lblPINumber.Text = dth.Rows[0].ItemArray[0].ToString(); HtmlTable tblCropTrait = this.tblCropTrait; foreach (DataRow dr in dt.Rows) { newCategory = dr["category_code"].ToString(); if (newCategory != category) { HtmlTableCell tc = new HtmlTableCell("TH"); tc.InnerHtml = newCategory + " Descriptors"; tc.Attributes.Add("colspan", "4"); HtmlTableRow tr = new HtmlTableRow(); tr.Cells.Add(tc); tblCropTrait.Rows.Add(tr); category = newCategory; } HtmlTableCell tc1 = new HtmlTableCell(); tc1.InnerHtml = "<a href='descriptordetail.aspx?id=" + dr["crop_trait_id"].ToString() + "' title='" + dr["trait_desc"].ToString() + "'>" + dr["trait_name"].ToString() + "</a>"; HtmlTableCell tc2 = new HtmlTableCell(); tc2.InnerHtml = dr["trait_value"].ToString(); //HtmlTableCell tc3 = new HtmlTableCell(); //tc3.InnerHtml = dr["qualifier_name"].ToString(); HtmlTableCell tc4 = new HtmlTableCell(); tc4.InnerHtml = "<a href='method.aspx?id=" + dr["method_id"].ToString() + "' title='" + dr["materials_and_methods"].ToString() + "'>" + dr["method_name"].ToString() + "</a>";; //Don't show default inventory ID HtmlTableCell tc5 = new HtmlTableCell(); if (dr["form_type_code"].ToString() == "**") { tc5.InnerHtml = ""; } else { tc5.InnerHtml = dr["inventory_id"].ToString(); } HtmlTableRow tr_data = new HtmlTableRow(); tr_data.Cells.Add(tc1); tr_data.Cells.Add(tc2); //tr_data.Cells.Add(tc3); tr_data.Cells.Add(tc4); tr_data.Cells.Add(tc5); tblCropTrait.Rows.Add(tr_data); } gv.DataSource = dt; gv.DataBind(); if (dtg.Rows.Count > 0) { divGeno.Visible = true; gvGeno.DataSource = dtg; gvGeno.DataBind(); } }
//This method will render the report. public void RenderReport(ref HtmlTable tblMaster) { string webRoot = ConfigurationManager.AppSettings["WEB_ROOT"]; HtmlTableRow oTr; HtmlTableCell oTd; int i; //If no Report property was set for this ReportWriter, display an error and exit. if (oReport == null) { oTr = new HtmlTableRow(); oTd = new HtmlTableCell("td"); oTd.Attributes.Add("class", "error"); oTd.InnerHtml = "There was an error: No report object was identified for the report writer."; oTr.Cells.Add(oTd); tblMaster.Rows.Add(oTr); return; } //If the report is a Crystal Report, we need to do things a little differently //than if we're getting the raw SQL. #region If the Report is a Crystal Report /* * if (oReport.Type == Report.ReportTypes.CrystalReport) * { #region Render Crystal Report * try * { * ReportDocument crReport = new ReportDocument(); * CrystalReportViewer crViewer = new CrystalReportViewer(); * * crReport.Load(HttpContext.Current.Server.MapPath(oReport.Source)); * crReport.SetDatabaseLogon("crystal_reports", "fatoni*99"); * * if (oReport.Parameters.Count > 0) * { * ParameterFields oParamFields = new ParameterFields(); * ParameterDiscreteValue oDiscreteValue; * ParameterField oParamField; * * foreach (Parameter oParam in oReport.Parameters) * { * oDiscreteValue = new ParameterDiscreteValue(); * oParamField = new ParameterField(); * * oDiscreteValue.Value = oParam.Value; * oParamField.ParameterFieldName = oParam.Name; * oParamField.CurrentValues.Add(oDiscreteValue); * * oParamFields.Add(oParamField); * } * * crViewer.ParameterFieldInfo = oParamFields; * } * * crViewer.ReportSource = crReport; * crViewer.SeparatePages = false; * crViewer.CssClass = "tblCrystalReport"; * crViewer.ClientTarget = "Downlevel"; * crViewer.DisplayGroupTree = false; * crViewer.DisplayToolbar = false; * * oTr = new HtmlTableRow(); * oTd = new HtmlTableCell(); * oTd.Attributes["style"] = "font-size: 16px; font-weight: bold; text-align: center; padding: 4px; background-color: #a1b5cf;"; * oTd.InnerHtml = oReport.Name; * oTd.InnerHtml += "<span class=\"verysmalltext\"><br/>" + DateTime.Now.ToString("MM/dd/yyyy hh:mm tt") + "</span>"; * if (oReport.Description.ToString() != "") {oTd.InnerHtml += "<span class=\"DoNotPrint\"><br/><a href=\"javascript:PopUpWindow('/Help/ReportsHelp.aspx#" + oReport.Name + oReport.ID.ToString() + "', 'wdwHelp', 'toolbars=no,statusbar=no,addressbar=no,scrollbars=yes,width=600,height=400');\" class=\"smalltext\">Help</a></span>";} * * oTr.Cells.Add(oTd); * tblMaster.Rows.Add(oTr); * * oTr = new HtmlTableRow(); * oTd = new HtmlTableCell(); * * oTd.Controls.Add(crViewer); * oTd.Style["padding"] = "0px"; * oTd.Style["margin"] = "0px"; * oTr.Cells.Add(oTd); * tblMaster.Rows.Add(oTr); * * tblMaster.Attributes["class"] = "tblCrystalReport"; * } * catch * { * * } #endregion * } * //If the report is a custom report, simply redirect them to the report passing * //the parameters in the report object. * else*/ #endregion if (oReport.Type == Report.ReportTypes.CustomReport) { #region Redirect to Custom Report string sParams = "?"; foreach (Parameter oParam in oReport.Parameters) { sParams = sParams + oParam.Name.Replace("@", "") + "=" + HttpContext.Current.Server.UrlEncode(oParam.Value) + "&"; } HttpContext.Current.Response.Redirect(ConfigurationManager.AppSettings["WEB_ROOT"] + oReport.Source + sParams, true); #endregion } else if (oReport.Type == Report.ReportTypes.SQLReport) { #region Redirect to Container for SQL Reporting Services Report oTr = new HtmlTableRow(); oTd = new HtmlTableCell(); oTr.Attributes.Add("class", "trTitle"); oTd.InnerHtml = oReport.Name; oTr.Cells.Add(oTd); tblMaster.Rows.Add(oTr); oTr = new HtmlTableRow(); oTd = new HtmlTableCell(); oTd.Attributes["style"] = "padding: 0px; margin: 0px; height: 650px;"; oTd.InnerHtml = "<iframe src=\"" + ConfigurationManager.AppSettings["SQL_REPORT_SERVER_URL"] + HttpContext.Current.Server.UrlEncode(oReport.Source) + "\" frameBorder=\"none\" width=\"100%\" height=\"100%\" scrolling=\"auto\"></iframe>"; oTr.Cells.Add(oTd); tblMaster.Rows.Add(oTr); #endregion } //Getting data straight from SQL Server. else { oDBLookup = new DBLookup(oConn); #region Render HTML Report from SQL database. //First, get the data from the database. DataSet oDataSet = GetSourceData(oReport); //Set the Sort Order if one is specified. string sSortOrder = ""; int nColSpan = 0; //if (HttpContext.Current.Request["hidSortField"] != null) // sSortOrder = HttpContext.Current.Request["hidSortField"].ToString(); if (HttpContext.Current.Request["ctl00$oBodyPlaceHolder$hidSortField"] != null) { sSortOrder = HttpContext.Current.Request["ctl00$oBodyPlaceHolder$hidSortField"].ToString(); } //Get the proper data from the data set. DataTable oTable = oDataSet.Tables["tblReport"]; DataRow[] oRows = oTable.Select("", sSortOrder); bool bDarkBG = false; #region Render the Table Header for the Report HtmlTableRow oTrHeader = new HtmlTableRow(); HtmlTableCell oTdHeader = new HtmlTableCell(); HtmlAnchor oAnchor; string sHref; LinkedReference oLinkedRef; oTdHeader.InnerHtml = oReport.Name; oTrHeader.Attributes.Add("class", "trTitle"); //If there is a study ID parameter for this report, get the study name for it //and add it to the report header. if (oReport.GetParameter("@StudyID") != null) { Parameter oParam = oReport.GetParameter("@StudyID"); oTdHeader.InnerHtml += " - " + oDBLookup.GetStudyName(Convert.ToInt32(oParam.Value), false); } else if (oReport.GetParameter("StudyID") != null) { Parameter oParam = oReport.GetParameter("StudyID"); oTdHeader.InnerHtml += " - " + oDBLookup.GetStudyName(Convert.ToInt32(oParam.Value), false); } oTdHeader.InnerHtml += "<span class=\"VeryVerySmallFont\"><br/>" + oRows.Length.ToString() + " Records - " + DateTime.Now.ToString("MM/dd/yyyy hh:mm tt") + "</span>"; if (oReport.Description != "") { oTdHeader.InnerHtml += "<span class=\"DoNotPrint\"><br/><a href=\"javascript:PopUpWindow('" + webRoot + "/Help/ReportsHelp.aspx#" + oReport.Name + oReport.ID + "', 'wdwHelp', 'toolbars=no,statusbar=no,addressbar=no,scrollbars=yes,width=600,height=400');\" class=\"smalltext\">Help</a></span>"; } oTrHeader.Cells.Add(oTdHeader); tblMaster.Rows.Add(oTrHeader); //Create an instance of a new table row. This will be the header for //the table, listing the field names on the report. oTr = new HtmlTableRow(); oTr.Attributes.Add("class", "trHeader"); #endregion //For each column in the result set, create a new table cell and put //the name of the column into the cell. Then, add the cell to the row. for (i = 0; i < oTable.Columns.Count; i++) { if (!oTable.Columns[i].ToString().StartsWith("_")) { oTd = new HtmlTableCell("td"); oTd.InnerHtml += oTable.Columns[i].ToString() + "\n"; oTd.InnerHtml += "<a href=\"javascript:DoSubmitSort2('" + oTable.Columns[i].ToString() + " ASC');\"><img src=\"" + webRoot + "/images/sort-az.gif\" alt=\"Sort Ascending\" /></a>\n"; oTd.InnerHtml += "<a href=\"javascript:DoSubmitSort2('" + oTable.Columns[i].ToString() + " DESC');\"><img src=\"" + webRoot + "/images/sort-za.gif\" alt=\"Sort Descending\" /></a>\n"; oTr.Cells.Add(oTd); nColSpan++; } } oTdHeader.ColSpan = nColSpan; //Add the row to the table. tblMaster.Rows.Add(oTr); //Now, do the same thing for each of the rows of data in the table. #region Loop Over Each Row in the Data Table for (i = 0; i < oRows.Length; i++) { //Create new row. oTr = new HtmlTableRow(); //Check the flag to see if we should apply the alternating style //to the row. Also, set the flag to the opposite of what it is //this time through the loop. if (bDarkBG) { oTr.Attributes.Add("class", "trDark"); } oTr.Attributes.Add("onclick", "HighlightRow(this)"); bDarkBG = !bDarkBG; //Generate each cell in the row. #region Loop Over Each Column in the Data Table for (int j = 0; j < oTable.Columns.Count; j++) { if (!oTable.Columns[j].ToString().StartsWith("_")) { oTd = new HtmlTableCell("td"); //Check for any linked references that we need to display. oLinkedRef = oReport.GetLinkedReference(oTable.Columns[j].ToString()); //If the current field is marked as a linked reference, display the link. if (oLinkedRef != null) { oAnchor = new HtmlAnchor(); if (oLinkedRef.URL != "mailto:") { //Set the HREF variable to the URL of the linked reference. sHref = ConfigurationManager.AppSettings["WEB_ROOT"] + oLinkedRef.URL; //If there are parameters for this linked reference and there is not //a question mark at the end of the URL, add one. if (oLinkedRef.URLParams.Count > 0 && sHref.IndexOf("?") <= 0) { sHref = sHref + "?"; } //If the link is to be opened in a new window, specify it. if (oLinkedRef.OpenInNewWindow) { oAnchor.Attributes["target"] = "_new"; } //Add a key/value pair to the URL for each parameter that is passed in. foreach (string sURLParam in oLinkedRef.URLParams) { sHref += CleanQueryString(sURLParam) + "=" + HttpContext.Current.Server.UrlEncode(oRows[i][sURLParam].ToString()) + "&"; } } else { sHref = oLinkedRef.URL; foreach (string sURLParam in oLinkedRef.URLParams) { sHref += oRows[i][sURLParam].ToString(); } } //Set the inner HTHML of the anchor tag and then set the href attribute. if (oTable.Columns[j].DataType == System.Type.GetType("System.DateTime") && oRows[i][j].ToString() != "") { oAnchor.InnerHtml = Convert.ToDateTime(oRows[i][j].ToString()).ToString("MM/dd/yyyy"); } else { oAnchor.InnerHtml = oRows[i][j].ToString(); } oAnchor.HRef = sHref; //Add the anchor tag to the table cell. oTd.Controls.Add(oAnchor); } else { //if (oTable.Rows[i][j].ToString() == "") if (oRows[i][j].ToString() == "") { oTd.InnerHtml = " "; } else { if (oTable.Columns[j].DataType == System.Type.GetType("System.DateTime") && oRows[i][j].ToString() != "") { oTd.InnerHtml = Convert.ToDateTime(oRows[i][j]).ToString("MM/dd/yyyy"); } else { oTd.InnerHtml = oRows[i][j].ToString(); } } } oTr.Cells.Add(oTd); } } #endregion //Add the row to the table. tblMaster.Rows.Add(oTr); } #endregion #endregion } }
public static void SetHeaderCellStyle(this HtmlTableCell cell, string postfix) { cell.Attributes.Add("class", string.Format("dxgvHeader_{0}", postfix)); cell.Style[System.Web.UI.HtmlTextWriterStyle.Cursor] = "default"; }
protected void ctlCalendar_DayRender(Object source, DayRenderEventArgs e) { // 01/16/2007 Paul. Catch any exceptions and log them. We are having a problem with duplicate ASSIGNED_USER_ID parameters. try { // Add custom text to cell in the Calendar control. if (!e.Day.IsOtherMonth) { DataView vwMain = new DataView(dtMain); DateTime dtDAY_START = e.Day.Date; DateTime dtDAY_END = dtDAY_START.AddDays(1); // 03/19/2007 Paul. Need to query activities based on server time. DateTime dtDAY_START_ServerTime = T10n.ToServerTime(dtDAY_START); DateTime dtDAY_END_ServerTime = T10n.ToServerTime(dtDAY_END); // 09/27/2005 Paul. System.Data.DataColumn.Expression documentation has description how to define dates and strings. // 01/21/2006 Paul. Brazilian culture is having a problem with date formats. Try using the european format. // 06/13/2006 Paul. Italian has a problem with the time separator. Use the value from the culture from CalendarControl.SqlDateTimeFormat. // 06/14/2006 Paul. The Italian problem was that it was using the culture separator, but DataView only supports the en-US format. CultureInfo ciEnglish = CultureInfo.CreateSpecificCulture("en-US"); string sDAY_START_ServerTime = dtDAY_START_ServerTime.ToString(CalendarControl.SqlDateTimeFormat, ciEnglish.DateTimeFormat); string sDAY_END_ServerTime = dtDAY_END_ServerTime.ToString(CalendarControl.SqlDateTimeFormat, ciEnglish.DateTimeFormat); vwMain.RowFilter = " DATE_START >= #" + sDAY_START_ServerTime + "# and DATE_START < #" + sDAY_END_ServerTime + "#" + ControlChars.CrLf + "or DATE_END > #" + sDAY_START_ServerTime + "# and DATE_END <= #" + sDAY_END_ServerTime + "#" + ControlChars.CrLf + "or DATE_START < #" + sDAY_START_ServerTime + "# and DATE_END > #" + sDAY_END_ServerTime + "#" + ControlChars.CrLf; //MonthRow ctlMonthRow = LoadControl("MonthRow.ascx") as MonthRow; //ctlMonthRow.DataSource = vwMain; //e.Cell.Controls.Add(ctlMonthRow); //ctlMonthRow.DataBind(); foreach (DataRowView row in vwMain) { HtmlGenericControl div = new HtmlGenericControl("div"); div.Attributes.Add("style", "margin-top: 1px;"); e.Cell.Controls.Add(div); HtmlTable tbl = new HtmlTable(); div.Controls.Add(tbl); tbl.CellPadding = 0; tbl.CellSpacing = 0; tbl.Border = 0; tbl.Width = "100%"; tbl.Attributes.Add("class", "monthCalBodyDayItem"); HtmlTableRow tr = new HtmlTableRow(); tbl.Rows.Add(tr); HtmlTableCell tdIcon = new HtmlTableCell(); tr.Cells.Add(tdIcon); tdIcon.Attributes.Add("class", "monthCalBodyDayIconTd"); Image img = new Image(); tdIcon.Controls.Add(img); img.ImageUrl = Session["themeURL"] + "images/" + Sql.ToString(row["ACTIVITY_TYPE"]) + ".gif"; img.AlternateText = L10n.Term(Sql.ToString(row["STATUS"])) + ": " + Sql.ToString(row["NAME"]); img.BorderWidth = 0; img.Width = 16; img.Height = 16; img.ImageAlign = ImageAlign.AbsMiddle; HtmlTableCell tdLink = new HtmlTableCell(); tr.Cells.Add(tdLink); tdLink.Attributes.Add("class", "monthCalBodyDayItemTd"); tdLink.Width = "100%"; HyperLink lnk = new HyperLink(); tdLink.Controls.Add(lnk); lnk.Text = L10n.Term(Sql.ToString(row["STATUS"])) + ": " + Sql.ToString(row["NAME"]); lnk.NavigateUrl = "../" + Sql.ToString(row["ACTIVITY_TYPE"]) + "/view.aspx?id=" + Sql.ToString(row["ID"]); lnk.CssClass = "monthCalBodyDayItemLink"; } } } catch (Exception ex) { SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex); lblError.Text += ex.Message; } }
protected override void CreateChildControls() { if (!this.ChildControlsCreated) { // base.CreateChildControls(); this.label_page_count = new Label(); this.label_page_count.ID = "label_page_count"; this.label_page_count.Text = "page count"; this.label_page_index = new Label(); this.label_page_index.ID = "label_page_index"; this.label_page_index.Text = "page index"; this.label_page_size = new Label(); this.label_page_size.ID = "label_page_size"; this.label_page_size.Text = "page size"; this.textbox_page_count = new TextBox(); this.textbox_page_count.ID = "textbox_page_count"; this.textbox_page_count.Text = "0"; this.textbox_page_count.Width = Unit.Pixel(30); this.textbox_page_count.ReadOnly = true; this.textbox_page_index = new TextBox(); this.textbox_page_index.ID = "textbox_page_index"; this.textbox_page_index.Text = "1"; this.textbox_page_index.Width = Unit.Pixel(30); this.textbox_page_index.MaxLength = 4; this.textbox_page_index.Attributes.Add("onkeydown", "javascript:return onlyNum();"); this.textbox_page_index.Attributes.Add("style", "ime-mode:Disabled"); this.textbox_page_size = new TextBox(); this.textbox_page_size.ID = "textbox_page_size"; this.textbox_page_size.Text = "10"; this.textbox_page_size.Width = Unit.Pixel(30); this.textbox_page_size.MaxLength = 2; this.textbox_page_size.Attributes.Add("onkeydown", "javascript:return onlyNum();"); this.textbox_page_size.Attributes.Add("style", "ime-mode:Disabled"); this.button_first = new ImageButton(); this.button_first.ID = "button_first"; this.button_first.ImageUrl = "Images/Icon_first.gif"; this.button_first.Click += new ImageClickEventHandler(this.button_first_Click); this.button_prev = new ImageButton(); this.button_prev.ID = "button_prev"; this.button_prev.ImageUrl = "Images/Icon_previous.gif"; this.button_prev.Click += new ImageClickEventHandler(this.button_prev_Click); this.button_next = new ImageButton(); this.button_next.ID = "button_next"; this.button_next.ImageUrl = "Images/Icon_next.gif"; this.button_next.Click += new ImageClickEventHandler(this.button_next_Click); this.button_last = new ImageButton(); this.button_last.ID = "button_last"; this.button_last.ImageUrl = "Images/Icon_last.gif"; this.button_last.Click += new ImageClickEventHandler(this.button_last_Click); HtmlTableRow row = new HtmlTableRow(); HtmlTableCell cell = new HtmlTableCell(); this.Controls.Add(row); row.Controls.Add(cell); cell.Controls.Add(this.label_page_size); cell.Controls.Add(this.CreateNewLiteral()); cell.Controls.Add(this.textbox_page_size); cell.Controls.Add(this.CreateNewLiteral()); cell.Controls.Add(this.label_page_index); cell.Controls.Add(this.CreateNewLiteral()); cell.Controls.Add(this.textbox_page_index); cell.Controls.Add(this.CreateNewLiteral()); cell.Controls.Add(this.label_page_count); cell.Controls.Add(this.CreateNewLiteral()); cell.Controls.Add(this.textbox_page_count); cell.Controls.Add(this.CreateNewLiteral()); cell.Controls.Add(this.button_first); cell.Controls.Add(this.CreateNewLiteral()); cell.Controls.Add(this.button_prev); cell.Controls.Add(this.CreateNewLiteral()); cell.Controls.Add(this.button_next); cell.Controls.Add(this.CreateNewLiteral()); cell.Controls.Add(this.button_last); cell.Controls.Add(this.CreateNewLiteral()); this.ChildControlsCreated = true; } }
public static void SetDataCellStyle(this HtmlTableCell cell) { cell.Attributes.Add("class", "dxgv"); cell.Style["empty-cells"] = "show"; }
// CONTROL ADDITION ------------------------------------------------------------------------------------------------------------- Control addcontrol(string[, ,] controlarray, HtmlTableCell cell, HtmlTableRow row, int col_traverse, int row_traverse) { // Generic return object Control returncontrol = new Control(); // Specific object generation methods switch (controlarray[col_traverse, row_traverse, 0]) { case "LABEL": // Label control { // Create new control Label newlabel = new Label(); // Set control properties newlabel.Font.Name = "Arial"; newlabel.Font.Size = 11; newlabel.ID = "control_" + col_traverse + "_" + row_traverse; // Add control cell.Controls.Add(newlabel); returncontrol = newlabel; break; } case "TEXTBOX": { // Create new control TextBox newtextbox = new TextBox(); Label newlabel = new Label(); // Set textbox control properties newtextbox.Font.Name = "Arial"; newtextbox.Font.Size = 11; newtextbox.ID = "control_" + col_traverse + "_" + row_traverse; newtextbox.Width = Unit.Pixel(Convert.ToInt16(cell.Width.Substring(0, cell.Width.Length - 2)) * cell.ColSpan - 2 * (layouttable.Border + layouttable.CellPadding)); // Set label control properties newlabel.Font.Name = "Arial"; newlabel.Font.Size = 11; // Add control cell.Controls.Add(newlabel); cell.Controls.Add(new LiteralControl("<br><br>")); cell.Controls.Add(newtextbox); // Return label for text fill //returncontrol = newtextbox; returncontrol = newlabel; break; } case "MULTISELECT": { // Create new control ListBox newlistbox = new ListBox(); Label newlabel = new Label(); // Set listbox control properties newlistbox.Font.Name = "Arial"; newlistbox.Font.Size = 11; newlistbox.ID = "control_" + col_traverse + "_" + row_traverse; newlistbox.Width = Unit.Pixel(Convert.ToInt16(cell.Width.Substring(0, cell.Width.Length - 2)) * cell.ColSpan - 2 * (layouttable.Border + layouttable.CellPadding)); newlistbox.SelectionMode = ListSelectionMode.Multiple; // Set label control properties newlabel.Font.Name = "Arial"; newlabel.Font.Size = 11; newlabel.ID = "control_" + col_traverse + "_" + row_traverse + "_label"; // Add control cell.Controls.Add(newlabel); cell.Controls.Add(new LiteralControl("<br><br>")); cell.Controls.Add(newlistbox); // Return label for text fill //returncontrol = newtextbox; returncontrol = newlistbox; break; } case "IMAGE": { // Create new control Image newimage = new Image(); // Set control properties newimage.ID = "control_" + col_traverse + "_" + row_traverse; newimage.Width = Unit.Pixel(Convert.ToInt16(cell.Width.Substring(0, cell.Width.Length - 2)) * cell.ColSpan - 2 * (layouttable.Border + layouttable.CellPadding)); newimage.Height = Unit.Pixel(Convert.ToInt16(row.Height.Substring(0, row.Height.Length - 2)) * cell.RowSpan - 2 * (layouttable.Border + layouttable.CellPadding)); // Add control cell.Controls.Add(newimage); returncontrol = newimage; break; } case "TABLE": { // Enclose table in panel Panel tablepanel = new Panel(); tablepanel.ScrollBars = ScrollBars.Both; tablepanel.Width = Unit.Pixel(Convert.ToInt16(cell.Width.Substring(0, cell.Width.Length - 2)) * cell.ColSpan - (layouttable.Border + layouttable.CellPadding)); tablepanel.Height = Unit.Pixel(Convert.ToInt16(row.Height.Substring(0, row.Height.Length - 2)) * cell.RowSpan - (layouttable.Border + layouttable.CellPadding)); // Create new control GridView newtable = new GridView(); // Set control properties newtable.ID = "control_" + col_traverse + "_" + row_traverse; newtable.Width = Unit.Pixel((int)(tablepanel.Width.Value - 17)); newtable.Height = Unit.Pixel((int)(tablepanel.Height.Value - 17)); newtable.Font.Name = "Arial"; newtable.Font.Size = 11; newtable.HeaderStyle.BackColor = System.Drawing.Color.Silver; newtable.RowStyle.BackColor = System.Drawing.Color.White; newtable.RowStyle.HorizontalAlign = HorizontalAlign.Center; // Add control tablepanel.Controls.Add(newtable); cell.Controls.Add(tablepanel); returncontrol = tablepanel; break; } case "SCATTERPLOT": { Chart Projection = new Chart(); Series newseries = new Series(); newseries.ChartType = SeriesChartType.Point; Projection.ChartAreas.Add(new ChartArea()); Projection.ChartAreas[0].AxisY.Title = "Second Principal Component"; Projection.ChartAreas[0].AxisX.Title = "First Principal Component"; Projection.Width = Unit.Pixel(Convert.ToInt16(cell.Width.Substring(0, cell.Width.Length - 2)) * cell.ColSpan - 2 * (layouttable.Border + layouttable.CellPadding)); Projection.Height = Unit.Pixel(Convert.ToInt16(row.Height.Substring(0, row.Height.Length - 2)) * cell.RowSpan - 2 * (layouttable.Border + layouttable.CellPadding)); DataMiningApp.Analysis.ParameterStream stream; Registry.Registry registry; stream = DataMiningApp.Analysis.ParameterStream.getStream(Session); registry = Registry.Registry.getRegistry(Session); Matrix PCmatrix = (Matrix)stream.get("PCmatrix"); String[] features = (String[])stream.get("selectedFeatures"); System.Data.DataSet ds = (System.Data.DataSet)registry.GetDataset((string)stream.get("dataSetName")); //retrieve dataset table (assume one for now) System.Data.DataTable dt = ds.Tables[0]; //raw data double[,] rawData = new double[dt.Rows.Count, features.Count()]; for (int i = 0; i < dt.Rows.Count; i++) { for (int j = 0; j < features.Count(); j++) { rawData[i, j] = (double)dt.Rows[i].ItemArray.ElementAt(dt.Columns[features[j]].Ordinal); } } //Create matrix to hold data for PCA Matrix X = new Matrix(rawData); //Remove mean Vector columnVector; for (int i = 0; i < X.ColumnCount; i++) { columnVector = X.GetColumnVector(i); X.SetColumnVector(columnVector.Subtract(columnVector.Average()), i); } //get first two PCs Matrix xy = new Matrix(PCmatrix.RowCount, 2); xy.SetColumnVector(PCmatrix.GetColumnVector(0), 0); xy.SetColumnVector(PCmatrix.GetColumnVector(1), 1); //project Matrix projected = X.Multiply(xy); DataPoint point; Projection.Series.Clear(); Projection.Legends.Clear(); //if a label column is selected String LabelColumnName = "Species"; if (!LabelColumnName.Equals("")) { //get labels int labelColumnIndex = dt.Columns[LabelColumnName].Ordinal; List <String> labels = new List <String>(); String item; for (int i = 0; i < dt.Rows.Count; i++) { item = (String)dt.Rows[i].ItemArray.ElementAt(labelColumnIndex); if (!labels.Contains(item)) { labels.Add(item); } } Legend mylegend = Projection.Legends.Add(LabelColumnName); mylegend.TableStyle = LegendTableStyle.Wide; Projection.Legends[0].Docking = Docking.Bottom; System.Drawing.Font font = Projection.Legends[LabelColumnName].Font = new System.Drawing.Font(Projection.Legends[LabelColumnName].Font.Name, 14); //Configure series foreach (String label in labels) { Projection.Series.Add(label); Projection.Series[label].LegendText = label; Projection.Series[label].IsXValueIndexed = false; Projection.Series[label].ChartType = SeriesChartType.Point; Projection.Series[label].MarkerSize = 8; } //Add points for (int i = 0; i < projected.RowCount; i++) { point = new DataPoint(projected[i, 0], projected[i, 1]); String label = dt.Rows[i].ItemArray[labelColumnIndex].ToString(); Projection.Series[label].Points.Add(point); } } else { //Single plot graph Projection.Series.Add("series1"); Projection.Series[0].IsXValueIndexed = false; Projection.Series[0].ChartType = SeriesChartType.Point; Projection.Series[0].MarkerSize = 8; for (int i = 0; i < projected.RowCount; i++) { point = new DataPoint(projected[i, 0], projected[i, 1]); Projection.Series[0].Points.Add(point); } } cell.Controls.Add(Projection); returncontrol = Projection; /* * // Create new control * Chart chartcontrol = new Chart(); * * // Set chart width and height * chartcontrol.Width = Unit.Pixel(Convert.ToInt16(cell.Width.Substring(0, cell.Width.Length - 2)) * cell.ColSpan - 2 * (layouttable.Border + layouttable.CellPadding)); * chartcontrol.Height = Unit.Pixel(Convert.ToInt16(row.Height.Substring(0, row.Height.Length - 2)) * cell.RowSpan - 2 * (layouttable.Border + layouttable.CellPadding)); * * // Needed so server knows where to store temporary image * chartcontrol.ImageStorageMode = ImageStorageMode.UseImageLocation; * * ChartArea mychartarea = new ChartArea(); * chartcontrol.ChartAreas.Add(mychartarea); * * Series myseries = new Series(); * myseries.Name = "Series"; * chartcontrol.Series.Add(myseries); * * chartcontrol.Series["Series"].ChartType = SeriesChartType.Point; * * // Add control * cell.Controls.Add(chartcontrol); * returncontrol = chartcontrol; */ break; } case "LINEPLOT": { DataMiningApp.Analysis.ParameterStream stream = DataMiningApp.Analysis.ParameterStream.getStream(Session); Vector Weights = (Vector)stream.get("Weights"); Chart VariancePlot = new Chart(); VariancePlot.Width = Unit.Pixel(Convert.ToInt16(cell.Width.Substring(0, cell.Width.Length - 2)) * cell.ColSpan - 2 * (layouttable.Border + layouttable.CellPadding)); VariancePlot.Height = Unit.Pixel(Convert.ToInt16(row.Height.Substring(0, row.Height.Length - 2)) * cell.RowSpan - 2 * (layouttable.Border + layouttable.CellPadding)); VariancePlot.Palette = ChartColorPalette.EarthTones; Series dataseries = new Series(); dataseries.ChartType = SeriesChartType.Line; dataseries.MarkerColor = System.Drawing.Color.Black; dataseries.MarkerBorderWidth = 3; dataseries.MarkerBorderColor = System.Drawing.Color.Black; VariancePlot.Series.Add(dataseries); VariancePlot.ChartAreas.Add(new ChartArea()); VariancePlot.ChartAreas[0].AxisY.Title = "Variance Explained"; VariancePlot.ChartAreas[0].AxisX.Title = "Principal Component"; for (int i = 0; i < Weights.Length; i++) { VariancePlot.Series[0].Points.InsertY(i, Weights[i]); } cell.Controls.Add(VariancePlot); returncontrol = VariancePlot; break; } case "UPLOAD": { // Create new controls Label uploadlabel = new Label(); FileUpload uploadcontrol = new FileUpload(); HiddenField savedfile = new HiddenField(); HiddenField savedpath = new HiddenField(); Button uploadbutton = new Button(); GridView uploadtable = new GridView(); // Create panel to enclose table to it can scroll without having to scroll entire window Panel tablepanel = new Panel(); tablepanel.ScrollBars = ScrollBars.Both; tablepanel.Width = Unit.Pixel(Convert.ToInt16(cell.Width.Substring(0, cell.Width.Length - 2)) * cell.ColSpan - (layouttable.Border + layouttable.CellPadding)); tablepanel.Height = Unit.Pixel(Convert.ToInt16(row.Height.Substring(0, row.Height.Length - 2)) * cell.RowSpan - (layouttable.Border + layouttable.CellPadding)); // Set IDs for all controls (necessary to get information after postback on upload) uploadlabel.ID = "control_" + col_traverse + "_" + row_traverse + "_label"; savedfile.ID = "control_" + col_traverse + "_" + row_traverse + "_savedfile"; savedpath.ID = "control_" + col_traverse + "_" + row_traverse + "_savedpath"; uploadcontrol.ID = "control_" + col_traverse + "_" + row_traverse; uploadtable.ID = "control_" + col_traverse + "_" + row_traverse + "_table"; uploadbutton.ID = "control_" + col_traverse + "_" + row_traverse + "_button"; // Set control properties uploadbutton.Text = "Load File"; uploadbutton.Font.Name = "Arial"; uploadbutton.Font.Size = 10; uploadbutton.Width = 100; uploadbutton.Click += new System.EventHandler(uploadbutton_Click); uploadlabel.Font.Name = "Arial"; uploadlabel.Font.Size = 11; uploadlabel.ForeColor = System.Drawing.Color.Black; uploadcontrol.Width = Unit.Pixel((int)(tablepanel.Width.Value - 17) - (int)uploadbutton.Width.Value); uploadtable.Width = Unit.Pixel((int)(tablepanel.Width.Value - 17)); uploadtable.Height = Unit.Pixel((int)(tablepanel.Height.Value - 17)); uploadtable.Font.Name = "Arial"; uploadtable.Font.Size = 11; uploadtable.HeaderStyle.BackColor = System.Drawing.Color.Silver; uploadtable.RowStyle.BackColor = System.Drawing.Color.White; uploadtable.RowStyle.HorizontalAlign = HorizontalAlign.Center; // Add controls to form and format tablepanel.Controls.Add(uploadlabel); tablepanel.Controls.Add(new LiteralControl("<br><br>")); tablepanel.Controls.Add(uploadcontrol); tablepanel.Controls.Add(uploadbutton); tablepanel.Controls.Add(new LiteralControl("<br><br>")); tablepanel.Controls.Add(uploadtable); // Add controls to scrollable panel cell.Controls.Add(tablepanel); // Return uploadcontrol, even though this control itself does not need to be filled (need control type) returncontrol = uploadcontrol; break; } } return(returncontrol); }
private void ProcessSkins(string strFolderPath, string type) { const int kColSpan = 5; HtmlTable tbl; HtmlTableRow row = null; HtmlTableCell cell; Panel pnlMsg; string[] arrFiles; string strURL; var intIndex = 0; if (Directory.Exists(strFolderPath)) { bool fallbackSkin; string strRootSkin; if (type == "Skin") { tbl = tblSkins; strRootSkin = SkinController.RootSkin.ToLower(); fallbackSkin = IsFallbackSkin(strFolderPath); pnlMsg = pnlMsgSkins; } else { tbl = tblContainers; strRootSkin = SkinController.RootContainer.ToLower(); fallbackSkin = IsFallbackContainer(strFolderPath); pnlMsg = pnlMsgContainers; } pnlMsg.Controls.Clear(); var strSkinType = strFolderPath.ToLower().IndexOf(Globals.HostMapPath.ToLower()) != -1 ? "G" : "L"; var canDeleteSkin = SkinController.CanDeleteSkin(strFolderPath, PortalSettings.HomeDirectoryMapPath); arrFiles = Directory.GetFiles(strFolderPath, "*.ascx"); int colSpan = arrFiles.Length == 0 ? 1: arrFiles.Length; tbl.Width = "auto"; if (fallbackSkin || !canDeleteSkin) { var pnl = new Panel { CssClass = "dnnFormMessage dnnFormWarning" }; var lbl = new Label { Text = Localization.GetString(type == "Skin" ? "CannotDeleteSkin.ErrorMessage" : "CannotDeleteContainer.ErrorMessage", LocalResourceFile) }; pnl.Controls.Add(lbl); pnlMsg.Controls.Add(pnl); cmdDelete.Visible = false; } if (arrFiles.Length == 0) { var pnl = new Panel { CssClass = "dnnFormMessage dnnFormWarning" }; var lbl = new Label { Text = Localization.GetString(type == "Skin" ? "NoSkin.ErrorMessage" : "NoContainer.ErrorMessage", LocalResourceFile) }; pnl.Controls.Add(lbl); pnlMsg.Controls.Add(pnl); } var strFolder = strFolderPath.Substring(strFolderPath.LastIndexOf("\\") + 1); foreach (var strFile in arrFiles) { var file = strFile.ToLower(); intIndex += 1; if (intIndex == kColSpan + 1) { intIndex = 1; } if (intIndex == 1) { //Create new row row = new HtmlTableRow(); tbl.Rows.Add(row); } cell = new HtmlTableCell { Align = "center", VAlign = "bottom" }; cell.Attributes["class"] = "NormalBold"; //thumbnail if (!this.AddThumbnail(file, ".jpg", cell) && !this.AddThumbnail(file, ".png", cell)) { var img = new System.Web.UI.WebControls.Image { ImageUrl = ResolveUrl("~/images/thumbnail_black.png"), BorderWidth = new Unit(1) }; cell.Controls.Add(img); } cell.Controls.Add(new LiteralControl("<br />")); strURL = file.Substring(strFile.IndexOf("\\" + strRootSkin + "\\")); strURL.Replace(".ascx", ""); //name var label = new Label { Text = getReducedFileName(Path.GetFileNameWithoutExtension(file)), ToolTip = Path.GetFileNameWithoutExtension(file), CssClass = "skinTitle" }; cell.Controls.Add(label); cell.Controls.Add(new LiteralControl("<br />")); //Actions var previewLink = new HyperLink(); if (type == "Skin") { previewLink.NavigateUrl = Globals.NavigateURL(PortalSettings.HomeTabId, Null.NullString, "SkinSrc=" + "[" + strSkinType + "]" + Globals.QueryStringEncode(strURL.Replace(".ascx", "").Replace("\\", "/"))); } else { previewLink.NavigateUrl = Globals.NavigateURL(PortalSettings.HomeTabId, Null.NullString, "ContainerSrc=" + "[" + strSkinType + "]" + Globals.QueryStringEncode(strURL.Replace(".ascx", "").Replace("\\", "/"))); } previewLink.CssClass = "dnnSecondaryAction"; previewLink.Target = "_blank"; previewLink.Text = Localization.GetString("cmdPreview", LocalResourceFile); cell.Controls.Add(previewLink); cell.Controls.Add(new LiteralControl(" ")); var applyButton = new LinkButton { Text = Localization.GetString("cmdApply", LocalResourceFile), CommandName = "Apply" + type, CommandArgument = "[" + strSkinType + "]" + strRootSkin + "/" + strFolder + "/" + Path.GetFileName(strFile), CssClass = "dnnSecondaryAction applyAction" }; applyButton.Command += OnCommand; cell.Controls.Add(applyButton); if ((UserInfo.IsSuperUser || strSkinType == "L") && (!fallbackSkin && canDeleteSkin)) { cell.Controls.Add(new LiteralControl(" ")); var deleteButton = new LinkButton { Text = Localization.GetString("cmdDelete"), CommandName = "Delete", CommandArgument = "[" + strSkinType + "]" + strRootSkin + "/" + strFolder + "/" + Path.GetFileName(strFile), CssClass = "dnnSecondaryAction" }; deleteButton.Command += OnCommand; cell.Controls.Add(deleteButton); } row.Cells.Add(cell); } if (File.Exists(strFolderPath + "/" + Globals.glbAboutPage)) { row = new HtmlTableRow(); cell = new HtmlTableCell { ColSpan = colSpan, Align = "center" }; var strFile = strFolderPath + "/" + Globals.glbAboutPage; strURL = strFile.Substring(strFile.IndexOf("\\portals\\")); var copyrightLink = new HyperLink { NavigateUrl = ResolveUrl("~" + strURL), CssClass = "dnnSecondaryAction", Target = "_blank", Text = string.Format(Localization.GetString("About", LocalResourceFile), strFolder) }; cell.Controls.Add(copyrightLink); row.Cells.Add(cell); tbl.Rows.Add(row); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["userid"] == null) { Response.Redirect("../web/Error.aspx"); } else { string userid = Session["userid"].ToString();//不给客户看到回款的对公账户 string strtext = ""; // string userid = "cus02"; string datefrom = Request.Params["datefrom"].ToString(); string dateto = Request.Params["dateto"].ToString(); string cus = Request.Params["cus"].ToString(); //如果传过来的值没有是null? if (datefrom == null) { datefrom = (DateTime.Now.AddMonths(-1)).ToString("yyyy-MM-dd"); } //系统当前时间提前半月 if (dateto == null) { dateto = (DateTime.Now).ToString("yyyy-MM-dd"); } //系统当前时间 if (cus == null || cus == "- 请选择 -") { strtext = "select cus_id,dTime,cBCode,amount from con_pay where wx_id = '" + userid + "'and dTime between '" + datefrom + "'and '" + dateto + "'"; } else { strtext = "select cus_id,dTime,cBCode,amount from con_pay where wx_id = '" + userid + "'and cus_id = '" + cus + "' and dTime between '" + datefrom + "'and '" + dateto + "'"; } // SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@cus_id", cus) }; // DataSet ds = SqlUtils.MSSQLHelper.Query(strtext, paras); DataSet ds = SqlUtils.MSSQLHelper.Query(strtext); //viewlist.DataSource = ds.Tables[0]; //viewlist.DataBind(); //拼接显示表格 int i = 0; int count = ds.Tables[0].Rows.Count; string[] arr = new string[count]; for (i = 0; i < count; i++) { arr[i] = "tb" + i; HtmlTableCell tc3 = new HtmlTableCell(); Label lb3 = new Label(); lb3.Text = "客户名称"; lb3.Width = 200; lb3.Font.Size = 15; Label tb3 = new Label(); //创建文本框对象 tb3.Width = 200; //设定宽度 tb3.ForeColor = System.Drawing.Color.LightSkyBlue; tb3.Text = ds.Tables[0].Rows[i][0].ToString(); //设定文本框中的值 tc3.Controls.Add(lb3); tc3.Controls.Add(tb3); //单元格内容赋值 form1.Controls.Add(tc3); //将行添加到表中 //应收 HtmlTableCell tc = new HtmlTableCell(); Label lb = new Label(); lb.Text = "回款日期"; Label tb = new Label(); //创建文本框对象 tb.Width = 200; //设定宽度 tb.ForeColor = System.Drawing.Color.LightSkyBlue; lb.Width = 200; lb.Font.Size = 15; tb.Text = ds.Tables[0].Rows[i][1].ToString(); //设定文本框中的值 tc.Controls.Add(lb); tc.Controls.Add(tb); //单元格内容赋值 form1.Controls.Add(tc); //将行添加到表中 // HtmlTableCell tc1 = new HtmlTableCell(); Label lb1 = new Label(); lb1.Text = "回款账户"; lb1.Width = 200; Label tb1 = new Label(); //创建文本框对象 tb1.Width = 200; //设定宽度 tb1.ForeColor = System.Drawing.Color.LightSkyBlue; lb1.Font.Size = 15; tb1.Text = ds.Tables[0].Rows[i][2].ToString(); //设定文本框中的值 tc1.Controls.Add(lb1); tc1.Controls.Add(tb1); //单元格内容赋值 form1.Controls.Add(tc1); //将行添加到表中 // HtmlTableCell tc2 = new HtmlTableCell(); Label lb2 = new Label(); lb2.Text = "回款金额"; lb2.Width = 200; lb2.Font.Size = 15; Label tb2 = new Label(); //创建文本框对象 tb2.Width = 200; //设定宽度 tb2.ForeColor = System.Drawing.Color.LightSkyBlue; tb2.Text = ds.Tables[0].Rows[i][3].ToString(); //设定文本框中的值 tc2.Controls.Add(lb2); tc2.Controls.Add(tb2); //单元格内容赋值 form1.Controls.Add(tc2); //将行添加到表中 //换行 HtmlTableCell tc0 = new HtmlTableCell(); Label lb0 = new Label(); lb0.Height = 2; lb0.Width = 500; lb0.Text = ""; lb0.BackColor = System.Drawing.Color.LightSlateGray; tc0.Controls.Add(lb0); //单元格内容赋值 form1.Controls.Add(tc0); //将行添加到表中 } } }
//Build list of files uploaded. private void buildTbl(MySqlConnection mySqlConnection) { if (tblUploads.Rows.Count > 1) { for (int i = tblUploads.Rows.Count - 1; i > 0; i--) { tblUploads.Rows.RemoveAt(i); } } MySqlCommand command = mySqlConnection.CreateCommand(); int staffID = Convert.ToInt32(Context.Request["StaffID"]); command.CommandText = @"SELECT Attachments.ID, FileName, AttchType, FileVersion, FileDate FROM Attachments LEFT JOIN TypeList ON Attachments.FileType = TypeList.ID WHERE AppID = " + Context.Request["AppID"]; MySqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) //Build each row. { HtmlTableRow row = new HtmlTableRow(); //Display filename as a hyperlink, so file can be opened. HtmlTableCell statusCell = HTMLFactory.buildCell("200", "left", ""); HyperLink hl = new HyperLink(); hl.Text = reader["FileName"].ToString(); hl.NavigateUrl = "http://curtinethics-001-site1.smarterasp.net/Uploads/" + Request["AppID"].ToString() + "_" + reader["FileName"].ToString(); hl.Target = "_blank"; statusCell.Controls.Add(hl); //Delete button. Button btnDel = new Button(); //Need to use an ASP button to add the client side confirmation. btnDel.ID = "Del" + reader["ID"].ToString(); btnDel.Text = "Delete"; btnDel.OnClientClick = "return(beforeDelete( ))"; //Asks user if they are sure they want to delete. btnDel.Click += btnDel_ServerClick; row.Cells.Add(statusCell); row.Cells.Add(HTMLFactory.buildCell("200", "left", reader["AttchType"].ToString())); row.Cells.Add(HTMLFactory.buildCell("97", "left", reader["FileVersion"].ToString())); row.Cells.Add(HTMLFactory.buildCell("97", "center", reader["FileDate"].ToString())); if (Context.Request["Mode"].Equals("W")) //If write then construct delete button. { row.Cells.Add(HTMLFactory.buildCell("97", "center", btnDel)); } else { row.Cells.Add(HTMLFactory.buildCell("97", "center", "Read only")); } tblUploads.Rows.Add(row); } } else { if (tblUploads.Rows.Count != 0) { HtmlTableRow blnkRow = new HtmlTableRow(); HtmlTableCell blnk = new HtmlTableCell(); blnk.InnerText = "None"; blnk.ColSpan = 5; blnkRow.Cells.Add(blnk); tblUploads.Rows.Add(blnkRow); } } reader.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { if (null != Request.QueryString["positionlabel"]) { getPositionName = (Request.QueryString["positionlabel"]).ToLower(); } Response response = AmazonDynamoDBIdentityTable.Instance.GetAllDataInDynamoDb(); List <IdentityDataModel> Identities = response.IdentityDataModel; int itemnmber = 0; if (null != Identities) { foreach (IdentityDataModel Identity in Identities) { IdentityDataModel identity = Identity; identity = AmazonDynamoDBIdentityTable.Instance.ConvertToTitleCase(identity); var tr = new HtmlTableRow(); tr.ID = identity.Email; HtmlTableCell checkbox = new HtmlTableCell(); HtmlGenericControl element = new HtmlGenericControl("input"); element.Attributes.Add("type", "checkbox"); element.Attributes.Add("name", "chkbox[]"); element.Attributes.Add("runat", "server"); element.Attributes.Add("id", identity.Email + "checkbox"); element.Attributes.Add("onchange", "checkAll(this,'" + identity.Email + "')"); checkbox.Controls.Add(element); checkbox.Attributes.Add("class", "tablecolumn"); tr.Cells.Add(checkbox); HtmlTableCell affiliate = new HtmlTableCell(); affiliate.InnerText = identity.Affiliate; affiliate.Attributes.Add("class", "tablecolumn"); tr.Cells.Add(affiliate); HtmlTableCell name = new HtmlTableCell(); name.InnerText = identity.FirstName + " " + identity.LastName; name.Attributes.Add("class", "tablecolumn"); tr.Cells.Add(name); HtmlTableCell email = new HtmlTableCell(); email.InnerText = identity.Email; email.Attributes.Add("class", "tablecolumn"); tr.Cells.Add(email); HtmlTableCell country = new HtmlTableCell(); country.ID = identity.CountryOfResidence + itemnmber; country.InnerText = identity.CountryOfResidence; country.Attributes.Add("class", "tablecolumn"); tr.Cells.Add(country); //HtmlAnchor _edit = new HtmlAnchor(); //_edit.HRef = "#"; //_edit.Attributes.CssStyle.Add("margin-left", "0px"); //HtmlImage editimage = new HtmlImage(); //editimage.Attributes.Add("src", "../Images/edit.png"); //editimage.Attributes.CssStyle.Add("width", "15px"); //_edit.Controls.Add(editimage); //_edit.Attributes.Add("onclick", "editCustomTaskValue('" + email.InnerText + "')"); //_edit.Attributes.Add("id", "edit" + email.InnerText); //HtmlAnchor _delete = new HtmlAnchor(); //_delete.HRef = "#"; //_delete.Attributes.CssStyle.Add("margin-left", "30%"); //HtmlImage deleteimage = new HtmlImage(); //deleteimage.Attributes.Add("src", "../Images/delete.png"); //deleteimage.Attributes.CssStyle.Add("width", "30px"); //_delete.Attributes.Add("onclick", "deleteCustomTaskValue('" + email.InnerText + "')"); //_delete.Attributes.Add("id", "delete" + email.InnerText); //_delete.Controls.Add(deleteimage); //HtmlTableCell actioncell = new HtmlTableCell(); //actioncell.Controls.Add(_edit); //actioncell.Controls.Add(_delete); //actioncell.Attributes.Add("class", "tablecolumn"); //tr.Cells.Add(actioncell); taskIdentities.Rows.Add(tr); foreach (WebsiteDataModel website in identity.WebsiteDataModel) { var item = selectwebsite.Items.FindByText(website.WebsiteName); if (null == item) { selectwebsite.Items.Add(website.WebsiteName); } } itemnmber++; } if (null != getPositionName) { response = AmazonDynamoDBPositionTable.Instance.GetDataInDynamoDb(getPositionName); if (null != (response.PositionData)) { positionData = response.PositionData.FirstOrDefault(); positionData = AmazonDynamoDBPositionTable.Instance.ConvertToTitleCase(positionData); //find identity from azure table and render content in fields. positionlabel.Value = positionData.PositionLabel; selectselection.Value = positionData.SelectSelection; starttime.Value = positionData.StartTime; endtime.Value = positionData.EndTime; startdate.Value = positionData.StartDate; enddate.Value = positionData.EndDate; int tasknumber = 3; for (int j = 0; j < positionData.SelectTasks.Count; j++) { if (null != positionData.SelectTasks[j] && j == 0) { step1.Value = positionData.SelectTasks[j]; } if (null != positionData.SelectTasks[j] && j == 1) { step2.Value = positionData.SelectTasks[j]; } if (null != positionData.SelectTasks[j] && j == 2) { step3.Value = positionData.SelectTasks[j]; } if (j > 2) { tasknumber++; HtmlTableRow tRow = new HtmlTableRow(); HtmlTableCell tb1 = new HtmlTableCell(); tb1.InnerText = tasknumber.ToString() + "."; tRow.Controls.Add(tb1); HtmlTableCell tb2 = new HtmlTableCell(); HtmlGenericControl inputelement = new HtmlGenericControl("input"); inputelement.Attributes.Add("type", "text"); inputelement.Attributes.Add("name", "step" + tasknumber); inputelement.Attributes.Add("value", positionData.SelectTasks[j]); inputelement.Attributes.Add("id", "step" + tasknumber); inputelement.Style.Add("width", "80%"); inputelement.Style.Add("height", "10%"); tb2.Style.Add("width", "80%"); tb2.Style.Add("height", "10%"); tb2.Controls.Add(inputelement); tRow.Controls.Add(tb2); task.Rows.Add(tRow); } } for (int j = 0; j < positionData.SelectCountries.Count; j++) { HtmlGenericControl iDiv = new HtmlGenericControl("div"); iDiv.Attributes.Add("id", positionData.SelectCountries[j]); iDiv.Attributes.Add("class", "form-control"); iDiv.Attributes.CssStyle.Add("height", "auto"); iDiv.InnerHtml = positionData.SelectCountries[j] + " <button class=\"glyphicon glyphicon-remove\" style=\"display:inline;background-color:white\" onclick=\"deleteCountry(\'" + positionData.SelectCountries[j] + "\')\" />"; addcountry.Controls.Add(iDiv); } notes.Value = positionData.Note.ToString(); ListItem Selectedwebsite = selectwebsite.Items.FindByText(positionData.PositionWebsite); if (null == Selectedwebsite) { selectwebsite.Items.Add(positionData.PositionWebsite); Selectedwebsite = selectwebsite.Items.FindByText(positionData.PositionWebsite); } Selectedwebsite.Selected = true; List <string> selectedIdentities = new List <string>(); int i = 0; for (var j = 1; j < taskIdentities.Rows.Count; j++) { foreach (var positionEmail in positionData.SelectedIdentities) { var row = taskIdentities.Rows[j]; if (row.ID == positionEmail) { var htmlcontrol = row.Cells[0]; //foreach ( HtmlTableCell item in row.Cells ) // { HtmlControl object1 = (HtmlControl)row.Cells[0].Controls[0]; if (null != object1) { object1.Attributes.Add("checked", "checked"); if (!(selectedIdentities.Contains(positionEmail))) { selectedIdentities.Add(positionEmail); i++; break; } } //} } } //foreach 2nd } } Count = Identities.Count; } countDiv.InnerText = DashBoard.Count.ToString(); } }
private void displaySessions(List <Workshop> s) { Random random = new Random(); //if there are no classes in the database show error message if (s.Count == 0) { //create a generic html control (paragraph <p>) HtmlGenericControl error = new HtmlGenericControl("p"); //insert the content of a paragraph (<p>CONTENT</p>) error.InnerHtml = "<h2>Unfortunately, we do not have any sessions on selected day"; //add the html control to a div container with an ID of "extraThing" :) extraThing.Controls.Add(error); } else { for (int i = 0; i < s.Count; i++) { //create a HTML table row using HTML controlls and add it to //the table with ID of "sessionTable" HtmlTableRow tr = new HtmlTableRow(); sessionsTable.Controls.Add(tr); //create a table cell/column HtmlTableCell td1 = new HtmlTableCell(); //add this table cell to a table row tr.Controls.Add(td1); //create a generic <img> html tag HtmlGenericControl img = new HtmlGenericControl("img"); //give src attribute to the img tag and assign a path to it //this path contains a random number that randomly chooses image for each session img.Attributes.Add("src", "images/" + random.Next(1, 6) + ".jpg"); //add image to the table cell td1.Controls.Add(img); //tile & description column HtmlTableCell td2 = new HtmlTableCell(); tr.Controls.Add(td2); HtmlGenericControl title = new HtmlGenericControl("a"); title.InnerHtml = "<h2>" + s[i].Title + "</h2>"; //pass the session type and session ID to querry string //querry string with these information will be used on ReservationPage.aspx page title.Attributes.Add("href", "ReservationPage.aspx?id=" + s[i].Id + "&type2=Workshop"); td2.Controls.Add(title); HtmlGenericControl description = new HtmlGenericControl("p"); description.InnerText = s[i].Description; td2.Controls.Add(description); //Additional information column HtmlTableCell td3 = new HtmlTableCell(); tr.Controls.Add(td3); //create a html unordered list and populate it with list elements HtmlGenericControl ul = new HtmlGenericControl("ul"); td3.Controls.Add(ul); HtmlGenericControl li1 = new HtmlGenericControl("li"); //date and time ul.Controls.Add(li1); li1.InnerText = s[i].StartDate.ToShortDateString() + " at " + s[i].Time.ToString(@"hh\:mm"); HtmlGenericControl li2 = new HtmlGenericControl("li"); //level ul.Controls.Add(li2); li2.InnerText = s[i].Level; HtmlGenericControl li3 = new HtmlGenericControl("li"); //duration ul.Controls.Add(li3); li3.InnerText = "Duration: " + s[i].Duration.ToString() + " min"; HtmlGenericControl li4 = new HtmlGenericControl("li"); //available spaces ul.Controls.Add(li4); li4.InnerText = "Available: " + (s[i].Capacity - s[i].Reservations).ToString(); HtmlGenericControl li5 = new HtmlGenericControl("li"); //sessions status ul.Controls.Add(li5); li5.InnerText = s[i].Status; HtmlGenericControl li6 = new HtmlGenericControl("li"); ul.Controls.Add(li6); li6.InnerText = "With " + DBconnection.getUser(s[i].InstructorID).Name; //book column //contains a link to ReservationPage with parameters for querry string HtmlTableCell book = new HtmlTableCell(); tr.Controls.Add(book); HtmlGenericControl link = new HtmlGenericControl("a"); if (s[i].Status.Equals("Cancelled")) { book.Controls.Add(link); link.Attributes.Add("class", "bookLink"); link.Attributes.Add("href", "#"); link.InnerText = "Session cancelled"; } else { book.Controls.Add(link); link.Attributes.Add("class", "bookLink"); link.Attributes.Add("href", "ReservationPage.aspx?id=" + s[i].Id + "&type2=Workshop"); link.InnerText = "Book"; } } } }
protected void Page_Load(object sender, EventArgs e) { try { // Load sve zaposlene ISession sesija = DataLayer.DataLayer.GetSession(); IQuery sql = sesija.CreateQuery("FROM Saradnik"); this.saradnici = sql.List <Saradnik>(); // Html table head HtmlTable table = new HtmlTable(); table.Attributes["class"] = "table table-striped table-hover"; HtmlTableRow row1 = new HtmlTableRow(); row1.Cells.Add(new HtmlTableCell() { InnerHtml = "#" }); row1.Cells.Add(new HtmlTableCell() { InnerHtml = "Ime" }); row1.Cells.Add(new HtmlTableCell() { InnerHtml = "Prezime" }); row1.Cells.Add(new HtmlTableCell() { InnerHtml = "Telefon" }); row1.Cells.Add(new HtmlTableCell() { InnerHtml = "Angažovao ga" }); table.Rows.Add(row1); int i = 1; foreach (Saradnik sar in saradnici) { HtmlTableRow row = new HtmlTableRow(); HtmlTableCell cell = new HtmlTableCell(); string link = "SaradnikProfile?sid=" + sar.SID.ToString(); row.Cells.Add(new HtmlTableCell() { InnerHtml = (i++).ToString() }); row.Cells.Add(new HtmlTableCell() { InnerHtml = "<a href='" + link + "'>" + sar.ime + "</a>" }); row.Cells.Add(new HtmlTableCell() { InnerHtml = "<a href='" + link + "'>" + sar.prezime + "</a>" }); row.Cells.Add(new HtmlTableCell() { InnerHtml = sar.telefon }); row.Cells.Add(new HtmlTableCell() { InnerHtml = sar.nadredjeni.ime + " " + sar.nadredjeni.prezime }); table.Rows.Add(row); } this.panel.Controls.Add(table); sesija.Close(); } catch (Exception ex) { displayError = true; this.error.Controls.Add(new LiteralControl(ex.Message)); } }
protected void Page_Load(object sender, EventArgs e) { // Retrieve session id stepid = (int)Session["stepid"]; // Specify connection string to database // Microsoft Access //connection = new SqlConnection("Driver={Microsoft Access Driver (*.mdb)};DBQ=" + Server.MapPath("/App_Data/database.mdb") + ";UID=;PWD=;"); // Microsoft SQL Server connection = new SqlConnection("Data Source=localhost;Initial Catalog=DMP;UId=webapp;Password=123;"); // Create SQL query to find out table size string tablesize_query = "WEBAPP_TABLESIZE " + algorithmid + "," + stepid; // Establish connection reader = openconnection(tablesize_query, connection); // Read table size reader.Read(); max_layout_cols = (int)reader[0] + 1; max_layout_rows = (int)reader[1] + 1; closeconnection(reader, connection); // Create SQL query to pull table layout information for this job and step string layout_query = "WEBAPP_GETLAYOUT " + algorithmid + "," + stepid; command = new SqlCommand(layout_query, connection); // Open connection and execute query using SQL Reader connection.Open(); reader = command.ExecuteReader(); // Control array - last index is for control type (0), fill data name (1), and output data name (2) controlarray = new string[max_layout_cols, max_layout_rows, 3]; // Span array control row and column spans int[, ,] spanarray = new int[max_layout_cols, max_layout_rows, 2]; int layout_x, layout_y; // Read through layout table for this step and algorithm if (reader.HasRows) { while (reader.Read()) { // Populate control array layout_x = (int)reader[0]; // Table x index layout_y = (int)reader[1]; // Table y index controlarray[layout_x, layout_y, 0] = (string)reader[4]; // Control type controlarray[layout_x, layout_y, 1] = (string)reader[5]; // Fill data name controlarray[layout_x, layout_y, 2] = (string)reader[6]; // Output data name spanarray[layout_x, layout_y, 0] = (int)reader[2]; // Rowspan spanarray[layout_x, layout_y, 1] = (int)reader[3]; // Colspan } } connection.Close(); // Build interface // Evenly distribute width and height of cells to conform to panel // Panel is designed to show scroll bars in case cell contents force size larger than specified here string html_cellwidth = Convert.ToString((Convert.ToInt16(mainpanel.Width.ToString().Substring(0, mainpanel.Width.ToString().Length - 2)) - ((max_layout_cols) * layouttable.Border) - layouttable.CellPadding) / max_layout_cols) + "px"; string html_cellheight = Convert.ToString((Convert.ToInt16(mainpanel.Height.ToString().Substring(0, mainpanel.Height.ToString().Length - 2)) - ((max_layout_rows) * layouttable.Border) - layouttable.CellPadding) / max_layout_rows) + "px"; // Run through rows for (int row_traverse = 0; row_traverse < max_layout_rows; row_traverse++) { // Add row HtmlTableRow newrow = new HtmlTableRow(); newrow.Height = html_cellheight; layouttable.Rows.Add(newrow); // Run through columns for (int col_traverse = 0; col_traverse < max_layout_cols; col_traverse++) { // Check if this is a valid cell if (spanarray[col_traverse, row_traverse, 0] > 0 && spanarray[col_traverse, row_traverse, 1] > 0) { // Create new cell object HtmlTableCell newcell = new HtmlTableCell(); // Set column and row span properties (merge cells) newcell.RowSpan = spanarray[col_traverse, row_traverse, 0]; newcell.ColSpan = spanarray[col_traverse, row_traverse, 1]; // Set cell width and height based on prior calculation newcell.Width = html_cellwidth; newcell.VAlign = "top"; // Add cell to table layouttable.Rows[row_traverse].Cells.Add(newcell); // Add control, if applicable Control newcontrol = addcontrol(controlarray, newcell, newrow, col_traverse, row_traverse); // Fill data into control fillcontrol(newcontrol, controlarray, col_traverse, row_traverse, jobid, algorithmid, stepid, reader, connection); } } } }
/// <summary> /// 加载报销明细 /// </summary> private void LoadDetialData() { string jbid = Request.QueryString["id"]; //获取工作流的id值 DataTable tbl = EtNet_BLL.AusDetialInfoManager.GetLists(jbid); HtmlTableRow row = null; HtmlTableCell cell = null; string strnumeral = ""; for (int i = 0; i < tbl.Rows.Count; i++) { row = new HtmlTableRow(); cell = new HtmlTableCell(); cell.InnerHtml = DateTime.Parse(tbl.Rows[i]["happendate"].ToString()).ToString("yyyy-MM-dd"); cell.Attributes.Add("class", "clshdate"); cell.Height = "30px"; row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerHtml = (string)tbl.Rows[i]["ausname"]; cell.Attributes.Add("class", "clshdate"); cell.Height = "30px"; row.Controls.Add(cell); //EtNet_Models.DepartmentInfo departmentInfo = EtNet_BLL.DepartmentInfoManager.getDepartmentInfoById(Convert.ToInt32(tbl.Rows[i]["belongsort"])); cell = new HtmlTableCell(); cell.Height = "30px"; cell.InnerHtml = (string)tbl.Rows[i]["belongsort"]; cell.Attributes.Add("class", "clshdate"); row.Controls.Add(cell); //EtNet_Models.LoginInfo loginInfo = EtNet_BLL.LoginInfoManager.getLoginInfoById(Convert.ToInt32(tbl.Rows[i]["Salesman"])); cell = new HtmlTableCell(); cell.Height = "30px"; cell.InnerHtml = (string)tbl.Rows[i]["Salesman"]; cell.Attributes.Add("class", "clshdate"); row.Controls.Add(cell); cell = new HtmlTableCell(); cell.Height = "30px"; strnumeral = tbl.Rows[i]["billnum"].ToString(); cell.Attributes.Add("class", "clsdigit"); cell.InnerHtml = ShowNumeral(strnumeral); row.Controls.Add(cell); cell = new HtmlTableCell(); cell.Height = "30px"; strnumeral = tbl.Rows[i]["ausmoney"].ToString(); cell.Attributes.Add("class", "clsmoney"); cell.InnerHtml = ShowNumeral(strnumeral); row.Controls.Add(cell); cell = new HtmlTableCell(); cell.Height = "30px"; cell.InnerHtml = tbl.Rows[i]["remark"].ToString(); row.Controls.Add(cell); this.tblprocess.Controls.Add(row); } }