public ExcelResult(IQueryable rows, string fileName, string[] headers, string[] properties, string title, TableStyle tableStyle, TableItemStyle headerStyle, TableItemStyle itemStyle) { _rows = rows; _fileName = fileName; _headers = headers; _properties = properties; _title = title; _tableStyle = tableStyle; _headerStyle = headerStyle; _itemStyle = itemStyle; // provide defaults if (_tableStyle == null) { _tableStyle = new TableStyle(); _tableStyle.BorderStyle = BorderStyle.Solid; _tableStyle.BorderColor = Color.Black; _tableStyle.BorderWidth = Unit.Parse("2px"); } if (_headerStyle == null) { _headerStyle = new TableItemStyle(); _headerStyle.BackColor = Color.LightGray; } }
public void MergeWith_Self() { TableItemStyle tis = GetTableItemStyle(); tis.MergeWith(tis); CheckTableStyle(tis); }
/// <summary> /// Konstruktor /// </summary> /// <param name="dt">Die zu exportierende DataTable</param> /// <param name="tableStyle">Styling für gesamgte Tabelle</param> /// <param name="headerStyle">Styling für Kopfzeile</param> /// <param name="itemStyle">Styling für die einzelnen Zellen</param> public ExcelFileResult(DataTable dt, TableStyle tableStyle, TableItemStyle headerStyle, TableItemStyle itemStyle) : base("application/ms-excel") { this.dt = dt; TitleExportDate = "Exportdatum: {0}"; this.tableStyle = tableStyle; this.headerStyle = headerStyle; this.itemStyle = itemStyle; // provide defaults if (this.tableStyle == null) { this.tableStyle = new TableStyle(); this.tableStyle.BorderStyle = BorderStyle.Solid; this.tableStyle.BorderColor = Color.Black; //this.tableStyle.GridLines = GridLines.Both; this.tableStyle.BorderWidth = Unit.Parse("2px"); } if (this.headerStyle == null) { this.headerStyle = new TableItemStyle(); this.headerStyle.BackColor = Color.LightGray; } if (this.itemStyle == null) { this.itemStyle = new TableItemStyle(); this.itemStyle.BorderStyle = BorderStyle.Groove; this.itemStyle.BorderColor = Color.Black; } }
public void CopyFrom_Self() { TableItemStyle tis = GetTableItemStyle(); tis.CopyFrom(tis); CheckTableStyle(tis); }
public void AddAttributesToRender_Null_WebControl() { TableItemStyle tis = new TableItemStyle(); tis.AddAttributesToRender(null, new TableRow()); // no exception }
private void RenderTitle(HtmlTextWriter writer, EditorPart editorPart) { string displayTitle = editorPart.DisplayTitle; if (!string.IsNullOrEmpty(displayTitle)) { TableItemStyle partTitleStyle = this.Zone.PartTitleStyle; if (this._titleTextStyle == null) { Style style2 = new Style(); style2.CopyFrom(partTitleStyle); this._titleTextStyle = style2; } if (!this._titleTextStyle.IsEmpty) { this._titleTextStyle.AddAttributesToRender(writer, this.Zone); } string description = editorPart.Description; if (!string.IsNullOrEmpty(description)) { writer.AddAttribute(HtmlTextWriterAttribute.Title, description); } string accessKey = editorPart.AccessKey; if (!string.IsNullOrEmpty(accessKey)) { writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, accessKey); } writer.RenderBeginTag(HtmlTextWriterTag.Legend); writer.Write(displayTitle); writer.RenderEndTag(); } }
/// <summary> /// Datatable to Excel带自定文件名的导出 /// </summary> /// <param name="dt">数据表</param> /// <param name="FileName">文件名</param> public static void DataTable4Excel(DataTable dt, string FileName, int[] aColTxtFormat) { StringWriter stringWriter = new StringWriter(); HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter); DataGrid excel = new DataGrid(); //TableItemStyle AlternatingStyle = new TableItemStyle(); TableItemStyle headerStyle = new TableItemStyle(); //TableItemStyle itemStyle = new TableItemStyle(); //AlternatingStyle.BackColor = System.Drawing.Color.LightGray; headerStyle.BackColor = System.Drawing.Color.LightGray; headerStyle.Font.Bold = true; headerStyle.HorizontalAlign = HorizontalAlign.Center; //itemStyle.HorizontalAlign = HorizontalAlign.Center; ; //excel.AlternatingItemStyle.MergeWith(AlternatingStyle); excel.HeaderStyle.MergeWith(headerStyle); //excel.ItemStyle.MergeWith(itemStyle); excel.GridLines = GridLines.Both; excel.HeaderStyle.Font.Bold = true; excel.DataSource = dt.DefaultView; //输出DataTable的内容 excel.DataBind(); for (int i = 0; i < excel.Items.Count; i++) { excel.Columns[3].ItemStyle.CssClass = "xlsText"; excel.Items[i].Cells[3].Style.Add("mso-number-format", ""); for (int j = 0; j < aColTxtFormat.Length; j++) { int nCol = aColTxtFormat[j]; excel.Items[i].Cells[nCol].Attributes.Add("style", "vnd.ms-excel.numberformat:@"); } } }
private void SetDayStyles(TableItemStyle style, int styleMask, Unit defaultWidth) { style.Width = defaultWidth; style.HorizontalAlign = HorizontalAlign.Center; if ((styleMask & 16) != 0) { style.CopyFrom(this.DayStyle); } if ((styleMask & 1) != 0) { style.CopyFrom(this.WeekendDayStyle); } if ((styleMask & 2) != 0) { style.CopyFrom(this.OtherMonthDayStyle); } if ((styleMask & 4) != 0) { style.CopyFrom(this.TodayDayStyle); } if ((styleMask & 8) != 0) { style.ForeColor = Color.White; style.BackColor = Color.Silver; style.CopyFrom(this.SelectedDayStyle); } }
/// <summary> /// Create sort arrows. /// </summary> /// <param name="sortedCell"></param> protected virtual void CreateSortArrows(TableCell sortedCell) { // Add the appropriate arrow image and apply the appropriate state, depending on whether we're // sorting the results in ascending or descending order TableItemStyle sortStyle = null; string imgUrl = null; SortDirection sortDirection = (SortDirection)ViewState["SortDirection"]; if (sortDirection == SortDirection.Ascending) { imgUrl = this.ArrowUpImageUrlInternal; sortStyle = _sortAscendingStyle; } else { imgUrl = this.ArrowDownImageUrlInternal; sortStyle = _sortDescendingStyle; } Image arrow = new Image(); arrow.ImageUrl = imgUrl; arrow.ToolTip = sortDirection.ToString(); // arrow.BorderStyle = BorderStyle.None; sortedCell.Controls.Add(arrow); sortedCell.Attributes.Add("noWrap", "true"); if (sortStyle != null) { sortedCell.MergeStyle(sortStyle); } }
private void RenderMonthTitle(HtmlTextWriter writer, TableItemStyle titleStyle, DateTime visibleDate) { var monthNameStyle = new TableItemStyle { HorizontalAlign = (titleStyle.HorizontalAlign != HorizontalAlign.NotSet ? titleStyle.HorizontalAlign : HorizontalAlign.Center), Wrap = titleStyle.Wrap, Width = Unit.Percentage(70.0) }; string renderingTitle; switch (this.TitleFormat) { default: case TitleFormat.Month: renderingTitle = GetMonthName(visibleDate); break; case TitleFormat.MonthYear: renderingTitle = GetMonthYear(visibleDate); break; } this.OnRenderCalendarCell(writer, monthNameStyle, renderingTitle, null, false, null); }
protected override void Render(HtmlTextWriter writer) { if (this.Controls.Count >= 1) { Table table = (Table)this.Controls[0]; table.CopyBaseAttributes(this); if (base.ControlStyleCreated && !base.ControlStyle.IsEmpty) { table.ApplyStyle(base.ControlStyle); } else { table.GridLines = GridLines.None; table.CellSpacing = 0; } table.Caption = this.Caption; table.CaptionAlign = this.CaptionAlign; foreach (TableRow row in table.Rows) { Style s = new TableItemStyle(); s.CopyFrom(_rowStyle); if ((s != null) && row.Visible) { row.MergeStyle(s); } } } base.Render(writer); }
public void CopyFrom_Null() { TableItemStyle tis = GetTableItemStyle(); tis.CopyFrom(null); CheckTableStyle(tis); }
public void MergeWith_Null() { TableItemStyle tis = GetTableItemStyle(); tis.MergeWith(null); CheckTableStyle(tis); }
private void RenderTitleBar(HtmlTextWriter writer, WebPart webPart) { writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0"); writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0"); writer.AddAttribute(HtmlTextWriterAttribute.Border, "0"); writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%"); writer.RenderBeginTag(HtmlTextWriterTag.Table); writer.RenderBeginTag(HtmlTextWriterTag.Tr); int colspan = 1; bool showTitleIcons = this.Zone.ShowTitleIcons; string titleIconImageUrl = null; if (showTitleIcons) { titleIconImageUrl = webPart.TitleIconImageUrl; if (!string.IsNullOrEmpty(titleIconImageUrl)) { colspan++; writer.RenderBeginTag(HtmlTextWriterTag.Td); this.RenderTitleIcon(writer, webPart); writer.RenderEndTag(); } } writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%"); TableItemStyle partTitleStyle = this.Zone.PartTitleStyle; if (!partTitleStyle.Wrap) { writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap"); } HorizontalAlign horizontalAlign = partTitleStyle.HorizontalAlign; if (horizontalAlign != HorizontalAlign.NotSet) { TypeConverter converter = TypeDescriptor.GetConverter(typeof(HorizontalAlign)); writer.AddAttribute(HtmlTextWriterAttribute.Align, converter.ConvertToString(horizontalAlign).ToLower(CultureInfo.InvariantCulture)); } VerticalAlign verticalAlign = partTitleStyle.VerticalAlign; if (verticalAlign != VerticalAlign.NotSet) { TypeConverter converter2 = TypeDescriptor.GetConverter(typeof(VerticalAlign)); writer.AddAttribute(HtmlTextWriterAttribute.Valign, converter2.ConvertToString(verticalAlign).ToLower(CultureInfo.InvariantCulture)); } if (this.Zone.RenderClientScript) { writer.AddAttribute(HtmlTextWriterAttribute.Id, this.GetWebPartTitleClientID(webPart)); } writer.RenderBeginTag(HtmlTextWriterTag.Td); if (showTitleIcons && !string.IsNullOrEmpty(titleIconImageUrl)) { writer.Write(" "); } this.RenderTitleText(writer, webPart); writer.RenderEndTag(); this.RenderVerbsInTitleBar(writer, webPart, colspan); writer.RenderEndTag(); writer.RenderEndTag(); }
/// <summary> /// Applies the specified style to the specified row. /// </summary> /// <param name="row"> Table row to be applied style </param> /// <param name="style">Style to be applied to table row</param> private static void ApplyRowStyle(TableRow row, TableItemStyle style) { for (int cellIndex = 0; cellIndex < row.Cells.Count; cellIndex++) { TableCell cell = row.Cells[cellIndex]; cell.MergeStyle(style); } }
public void AddAttributesToRender() { TableItemStyle tis = GetTableItemStyle(); HtmlTextWriter writer = new HtmlTextWriter(new StringWriter()); tis.AddAttributesToRender(writer, new Table()); Assert.AreEqual(String.Empty, writer.InnerWriter.ToString(), "empty"); }
private TableItemStyle GetTableItemStyle() { TableItemStyle tis = new TableItemStyle(); tis.HorizontalAlign = HorizontalAlign.Justify; tis.VerticalAlign = VerticalAlign.Bottom; tis.Wrap = false; return(tis); }
//Used to apply default style to cells public void applyMyStyle(WebControl webcontrol) { TableItemStyle itemstyle = new TableItemStyle(); itemstyle.BorderWidth = 1; itemstyle.Font.Size = FONTSIZE; itemstyle.BorderColor = System.Drawing.Color.DarkBlue; webcontrol.ApplyStyle(itemstyle); }
public static ExcelResult Excel(this Controller controller, IQueryable rows, string fileName, string[] headers, TableStyle tableStyle, TableItemStyle headerStyle, TableItemStyle itemStyle) { return(new ExcelResult(rows, fileName, headers, tableStyle, headerStyle, itemStyle)); }
private TableRow CreateDayHeader(DateTime firstDay, DateTime visibleDate, System.Globalization.Calendar threadCalendar) { TableRow row = new TableRow(); DateTimeFormatInfo dtf = DateTimeFormatInfo.CurrentInfo; TableItemStyle dayNameStyle = new TableItemStyle(); dayNameStyle.HorizontalAlign = HorizontalAlign.Center; dayNameStyle.CopyFrom(DayHeaderStyle); DayNameFormat dayNameFormat = DayNameFormat; int numericFirstDay = (int)threadCalendar.GetDayOfWeek(firstDay); for (int i = numericFirstDay; i < numericFirstDay + 7; i++) { string dayName; int dayOfWeek = i % 7; switch (dayNameFormat) { case DayNameFormat.FirstLetter: dayName = dtf.GetDayName((DayOfWeek)dayOfWeek).Substring(0, 1); break; case DayNameFormat.FirstTwoLetters: dayName = dtf.GetDayName((DayOfWeek)dayOfWeek).Substring(0, 2); break; case DayNameFormat.Full: dayName = dtf.GetDayName((DayOfWeek)dayOfWeek); break; case DayNameFormat.Short: dayName = dtf.GetAbbreviatedDayName((DayOfWeek)dayOfWeek); break; case DayNameFormat.Shortest: dayName = dtf.GetShortestDayName((DayOfWeek)dayOfWeek); break; default: System.Diagnostics.Debug.Assert(false, "Unknown DayNameFormat value!"); goto case DayNameFormat.Short; } TableCell cell = new TableCell(); cell.ApplyStyle(dayNameStyle); cell.Text = dayName; row.Cells.Add(cell); } return(row); }
void OutputNode(XmlNode node) // recursive function that does preorder traversal of xml tree { TableRow tempRow = new TableRow(); // create new tablerow TableItemStyle tableStyle = new TableItemStyle(); // Creating a tablestyle tableStyle.HorizontalAlign = HorizontalAlign.Center; // setting the horizontal alignment to center tableStyle.VerticalAlign = VerticalAlign.Middle; // setting the vertical alignment to middle tableStyle.BorderColor = System.Drawing.Color.Black; // setting the border color to black tableStyle.BorderWidth = 1; // setting the border width to 1 XmlAttributeCollection x; // create new XmlAttributeCollection object string s; // create string s to store attributes if (node == null) // checking if current node is null or not { return; // return if current node is null } { TableCell tempCell1 = new TableCell(); // creating new table cell to store node name TableCell tempCell2 = new TableCell(); // creating new table cell to store node type TableCell tempCell3 = new TableCell(); // creating new table cell to store node attributes TableCell tempCell4 = new TableCell(); // creating new table cell to store node value tempCell1.Text = node.Name; // storing node name into tempCell1 tempCell2.Text = node.NodeType.ToString(); // storing node type into tempCell2 tempCell4.Text = node.Value; // storing node value into tempCell4 x = node.Attributes; // x will contain the attributes collection s = ""; // setting string s to empty if (x != null) // checking if x is empty { s = ""; // setting string s to empty foreach (XmlAttribute ss in x) // traversing through each attribute in x { s = s + ss.Name + " = '" + ss.Value + "'" + Environment.NewLine; // storing the attribute name and value into "s" } } tempCell3.Text = s; // storing the list of attributes into tableCell3 tempCell1.ApplyStyle(tableStyle); // applying style tableStyle to cell tempCell1 tempCell2.ApplyStyle(tableStyle); // applying style tableStyle to cell tempCell2 tempCell3.ApplyStyle(tableStyle); // applying style tableStyle to cell tempCell3 tempCell4.ApplyStyle(tableStyle); // applying style tableStyle to cell tempCell4 tempRow.Cells.Add(tempCell1); // adding cell tempCell1 to row tempRow tempRow.Cells.Add(tempCell2); // adding cell tempCell2 to row tempRow tempRow.Cells.Add(tempCell3); // adding cell tempCell3 to row tempRow tempRow.Cells.Add(tempCell4); // adding cell tempCell4 to row tempRow myTable.Rows.Add(tempRow); // adding row tempRow to myTable } if (node.HasChildNodes) // checking if the current node has child nodes { XmlNodeList children = node.ChildNodes; // getting a list of all child nodes of current node foreach (XmlNode child in children) // traversing through each child node { OutputNode(child); // calling OutputNode() for each child } } }
public static string Export(System.Data.DataTable dt, string fileName) { System.Web.UI.Page page = System.Web.HttpContext.Current.Handler as System.Web.UI.Page; StringWriter stringWriter = new StringWriter(); HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter); DataGrid dGrid = new DataGrid(); TableItemStyle alternatingStyle = new TableItemStyle(); TableItemStyle headerStyle = new TableItemStyle(); TableItemStyle itemStyle = new TableItemStyle(); alternatingStyle.BackColor = Color.LightGray; headerStyle.BackColor = Color.LightGray; headerStyle.Font.Bold = true; headerStyle.HorizontalAlign = HorizontalAlign.Center; itemStyle.HorizontalAlign = HorizontalAlign.Center; dGrid.GridLines = GridLines.Both; dGrid.HeaderStyle.MergeWith(headerStyle); dGrid.HeaderStyle.Font.Bold = true; dGrid.AlternatingItemStyle.MergeWith(alternatingStyle); dGrid.ItemStyle.MergeWith(itemStyle); dGrid.DataSource = dt.DefaultView; dGrid.DataBind(); dGrid.RenderControl(htmlWriter); string filePath = Path.Combine(excelFullFolder, fileName + ext); if (System.IO.File.Exists(filePath)) { System.IO.File.Delete(filePath); } StreamWriter sw = new StreamWriter(filePath, false, System.Text.Encoding.UTF8); sw.Write(stringWriter.ToString()); sw.Close(); int pos = page.Request.Url.ToString().LastIndexOf(page.Request.Path); string fileUrl = page.Request.Url.ToString().Substring(0, pos); fileUrl += page.Request.ApplicationPath + excelFolder.Replace("\\", "/") + fileName + ext; HttpContext.Current.Response.Redirect(fileUrl); return(fileUrl); }
public void CopyFrom() { TableItemStyle tis = new TableItemStyle(); tis.HorizontalAlign = HorizontalAlign.Left; tis.VerticalAlign = VerticalAlign.Top; tis.Wrap = true; tis.CopyFrom(GetTableItemStyle()); CheckTableStyle(tis); }
/// <summary> /// 将DataTable导出到Excel,调用如:m_ExportExcel(dt,new int[]{3}); /// </summary> /// <param name="dt">要导出的DataTable</param> /// <param name="aColTxtFormat">要设置为字符串格式的列,比如银行帐号等</param> private void m_ExportExcel(DataTable dt, int[] aColTxtFormat) { System.IO.StringWriter stringWriter = new System.IO.StringWriter(); HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter); DataGrid excel = new DataGrid(); //System.Web.UI.WebControls.TableItemStyle AlternatingStyle = new TableItemStyle(); System.Web.UI.WebControls.TableItemStyle headerStyle = new TableItemStyle(); //System.Web.UI.WebControls.TableItemStyle itemStyle = new TableItemStyle(); //AlternatingStyle.BackColor = System.Drawing.Color.LightGray; headerStyle.BackColor = System.Drawing.Color.LightGray; headerStyle.Font.Bold = true; headerStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center; //itemStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center; ; //excel.AlternatingItemStyle.MergeWith(AlternatingStyle); excel.HeaderStyle.MergeWith(headerStyle); //excel.ItemStyle.MergeWith(itemStyle); excel.GridLines = GridLines.Both; excel.HeaderStyle.Font.Bold = true; excel.DataSource = dt.DefaultView; //输出DataTable的内容 excel.DataBind(); for (int i = 0; i < excel.Items.Count; i++) { //excel.Columns[3].ItemStyle.CssClass = "xlsText"; //excel.Items[i].Cells[3].Style.Add("mso-number-format", "\"@\""); for (int j = 0; j < aColTxtFormat.Length; j++) { int nCol = aColTxtFormat[j]; excel.Items[i].Cells[nCol].Attributes.Add("style", "vnd.ms-excel.numberformat:@"); } } excel.RenderControl(htmlWriter); HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=Excel.xls"); HttpContext.Current.Response.Charset = "UTF-8"; HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); //设置导出的格式 //HttpContext.Current.Response.ContentType=".xls/.txt/.doc";image/JPEG;text/HTML;image/GIF;vnd.ms-excel/msword HttpContext.Current.Response.ContentType = ".xls"; HttpContext.Current.Response.Write(stringWriter.ToString()); HttpContext.Current.Response.End(); //string filestr = "d:\\data\\" + filePath; //filePath是文件的路径 //int pos = filestr.LastIndexOf("\\"); //string file = filestr.Substring(0, pos); //if (!Directory.Exists(file)) { // Directory.CreateDirectory(file); //} //System.IO.StreamWriter sw = new StreamWriter(filestr); //sw.Write(stringWriter.ToString()); //sw.Close(); }
public override void LoadFormatInfo() { TableItemStyle headerStyle = this.runtimeColumn.HeaderStyle; if (!headerStyle.Width.IsEmpty) { this.width = headerStyle.Width.ToString(NumberFormatInfo.CurrentInfo); } else { this.width = null; } }
private static void FormatStyle(Telerik.Web.UI.GridColumn column, CodeTorch.Core.GridColumn config) { TableItemStyle itemStyle = null; itemStyle = column.ItemStyle; FormatColumnItemStyle(config.ItemStyle, itemStyle); itemStyle = column.HeaderStyle; FormatColumnItemStyle(config.HeaderStyle, itemStyle); itemStyle = column.FooterStyle; FormatColumnItemStyle(config.FooterStyle, itemStyle); }
public static ActionResult Excel ( this Controller controller, DataContext dataContext, IQueryable rows, string fileName, string[][] headers, TableStyle tableStyle, TableItemStyle headerStyle, TableItemStyle itemStyle ) { return(new ExcelResult(dataContext, rows, fileName, headers, tableStyle, headerStyle, itemStyle)); }
/// <summary> /// 根据制定属性导出Excel /// </summary> /// <param name="controller"></param> /// <param name="rows">IList格式数据源</param> /// <param name="fileName">文件名</param> /// <param name="headers">表头</param> /// <param name="properties">属性</param> /// <param name="tableStyle">表格样式</param> /// <param name="headerStyle">表头样式</param> /// <param name="itemStyle">每列样式</param> /// <returns></returns> public static ActionResult Excel ( this Controller controller, IList rows, string fileName, string[] headers, string[] properties, TableStyle tableStyle, TableItemStyle headerStyle, TableItemStyle itemStyle ) { return(new ExcelResult(rows.AsQueryable(), fileName, headers, properties, null, tableStyle, headerStyle, itemStyle)); }
static private void DoInitialization() { mcStyle = new TableItemStyle(); mcStyle.HorizontalAlign = HorizontalAlign.Center; mcStyle.BackColor = teColors.eeRowBg; mcStyle.BorderColor = Color.Black; mcStyle.BorderStyle = BorderStyle.None; mcStyle.BorderWidth = 0; mcStyle.ForeColor = teColors.eeText; mcStyle.Font.Name = "Arial"; mcStyle.Font.Size = 10; mcStyle.HorizontalAlign = HorizontalAlign.Left; }
public void MergeWith() { TableItemStyle tis = new TableItemStyle(); tis.HorizontalAlign = HorizontalAlign.Left; tis.VerticalAlign = VerticalAlign.Top; tis.Wrap = true; tis.MergeWith(GetTableItemStyle()); Assert.AreEqual(HorizontalAlign.Left, tis.HorizontalAlign, "HorizontalAlign"); Assert.AreEqual(VerticalAlign.Top, tis.VerticalAlign, "VerticalAlign"); Assert.IsTrue(tis.Wrap, "Wrap"); }
private void LoadCommonIndicesData() { string commonIndices = ""; foreach (DictionaryEntry de in indicesTable) { commonIndices = commonIndices + de.Key + ","; } if (!string.IsNullOrEmpty(commonIndices)) { TableItemStyle tableStyle = new TableItemStyle(); tableStyle.HorizontalAlign = HorizontalAlign.Right; tableStyle.VerticalAlign = VerticalAlign.Middle; tableStyle.Width = Unit.Pixel(200); TableRow row = new TableRow(); TableCell symbolCell = new TableCell(); TableCell priceCell = new TableCell(); TableCell changeCell = new TableCell(); CommonIndicesTable.BorderColor = System.Drawing.Color.Silver; CommonIndicesTable.BorderStyle = BorderStyle.Solid; string stock = ""; string currentPrice = ""; string change = ""; // DataSet ds = stockService.YahooCSVGetQuotesMatrix(commonIndices); DataSet ds = GetCommonIndicesQuotesMatrix(commonIndices, false); if (ds != null) { // Column Namesof the DataSet: [Stock | Price | Change | PreviousClose] foreach (DataRow dr in ds.Tables["StockData"].Rows) { if (indicesTable.ContainsKey(dr["stock"].ToString())) { stock = indicesTable[dr["Stock"].ToString()].ToString(); // +"(" + dr["Stock"].ToString() + ")"; currentPrice = dr["Price"].ToString(); change = dr["Change"].ToString(); row = new TableRow(); symbolCell = new TableCell(); symbolCell.Text = stock; priceCell = new TableCell(); priceCell.Text = currentPrice; changeCell = new TableCell(); if (change.StartsWith("-")) { // changeCell.BackColor = System.Drawing.Color.Red; change = gui.RedFontStart + change + gui.RedFontEnd; } else { // changeCell.BackColor = System.Drawing.Color.LightGreen; change = gui.GreenFontStart + change + gui.GreenFontEnd; } changeCell.Text = change; row.Cells.Add(symbolCell); row.Cells.Add(priceCell); row.Cells.Add(changeCell); CommonIndicesTable.Rows.Add(row); } } } foreach (TableRow r in CommonIndicesTable.Rows) foreach (TableCell c in r.Cells) c.ApplyStyle(tableStyle); IndicesTimeLabel.Text = gui.GrayFontStart + stockService.GetTimeOfLastTrade("^DJI") + gui.GrayFontEnd; } }
private void LoadStoockerAccuracy(string[] interestedStocks) { if (interestedStocks != null && interestedStocks.Length > 0) { // DB Variables. string queryString = ""; TableItemStyle tableStyle = new TableItemStyle(); tableStyle.HorizontalAlign = HorizontalAlign.Center; tableStyle.VerticalAlign = VerticalAlign.Middle; tableStyle.Width = Unit.Pixel(2000); TableRow row = new TableRow(); TableCell symbolCell = new TableCell(); // TableCell yourAccuracyCell = new TableCell(); TableCell stoockerAccuracyCell = new TableCell(); symbolCell.Controls.Add(new LiteralControl(gui.BoldFontStart + "Stock" + gui.BoldFontEnd)); // yourAccuracyCell.Controls.Add(new LiteralControl(gui.BoldFontStart + "Your Accuracy" + gui.BoldFontEnd)); stoockerAccuracyCell.Controls.Add(new LiteralControl(gui.BoldFontStart + "Accuracy of Stoocker Algorithm" + gui.BoldFontEnd)); row.Cells.Add(symbolCell); // row.Cells.Add(yourAccuracyCell); row.Cells.Add(stoockerAccuracyCell); StoockerAccuracyTable.Rows.Add(row); StockTable.BorderColor = System.Drawing.Color.Silver; StockTable.BorderStyle = BorderStyle.Solid; for (int i = 0; i < interestedStocks.Length; i++) { row = new TableRow(); string symbol = interestedStocks[i].Trim().ToUpper(); queryString = "SELECT Count(*) FROM stoocks.stockprediction WHERE stocksymbol='" + symbol + "' AND PredictedMovement = ActualMovement;"; int correctPredictions = dbOps.ExecuteScalar(queryString); queryString = "SELECT Count(*) FROM stoocks.stockprediction WHERE stocksymbol='" + symbol + "' AND ActualMovement <> 0;"; int totalPredictions = dbOps.ExecuteScalar(queryString); if (correctPredictions != -1 && totalPredictions != -1) { float symbolAccuracy; if (totalPredictions != 0) symbolAccuracy = (float)(((float)correctPredictions / (float)totalPredictions) * 100); else symbolAccuracy = 0; string highlightedSymbolAccuracy = symbolAccuracy > 50 ? gui.GreenFontStart + symbolAccuracy.ToString() + "%" + gui.GreenFontEnd : gui.RedFontStart + symbolAccuracy.ToString() + "%" + gui.RedFontEnd; string stoockerAccuracyString = ""; if (symbolAccuracy != 0) stoockerAccuracyString = "[" + correctPredictions.ToString() + "/" + totalPredictions.ToString() + "]" + "=" + highlightedSymbolAccuracy; else stoockerAccuracyString = gui.GrayFontStart + "-" + gui.GreenFontEnd; symbolCell = new TableCell(); // yourAccuracyCell = new TableCell(); stoockerAccuracyCell = new TableCell(); symbolCell.Text = symbol; // yourAccuracyCell.Text = ""; stoockerAccuracyCell.Text = stoockerAccuracyString; row.Cells.Add(symbolCell); // row.Cells.Add(yourAccuracyCell); row.Cells.Add(stoockerAccuracyCell); StoockerAccuracyTable.Rows.Add(row); } } foreach (TableRow r in StoockerAccuracyTable.Rows) foreach (TableCell c in r.Cells) c.ApplyStyle(tableStyle); StoockerAccuracyLabel.Text = gui.BoldFontStart + gui.GrayFontStart + "Performance of the Stoocker Algorithm over your Portfolio" + gui.GrayFontEnd + gui.BoldFontEnd; } }
// New LoadCurrentData. Test Mode. Uses YahooCSVGetQuotesMatrix private void LoadCurrentData() { if (interestedStocks != null && interestedStocks.Length > 0) { TableItemStyle tableStyle = new TableItemStyle(); tableStyle.HorizontalAlign = HorizontalAlign.Center; tableStyle.VerticalAlign = VerticalAlign.Middle; tableStyle.Width = Unit.Pixel(2000); PortfolioLabel.Text = gui.BoldFontStart + gui.RedFontStart + username + "'s " + gui.RedFontEnd + "Prediction Portfolio:" + gui.BoldFontEnd; TableRow row = new TableRow(); TableCell symbolCell = new TableCell(); TableCell priceCell = new TableCell(); TableCell changeCell = new TableCell(); TableCell previousCloseCell = new TableCell(); TableCell upVotesVSdownVotesCell = new TableCell(); TableCell predictionCell = new TableCell(); TableCell currentUserPredictedValueCell = new TableCell(); // TableCell analysisCell = new TableCell(); //// Fill the Table Header START //// symbolCell.Controls.Add(new LiteralControl(gui.BoldFontStart + "Stock Analysis" + gui.BoldFontEnd)); priceCell.Controls.Add(new LiteralControl(gui.BoldFontStart + "Current Price" + gui.BoldFontEnd)); changeCell.Controls.Add(new LiteralControl(gui.BoldFontStart + "Change" + gui.BoldFontEnd)); previousCloseCell.Controls.Add(new LiteralControl(gui.BoldFontStart + "Previous Close" + gui.BoldFontEnd)); upVotesVSdownVotesCell.Controls.Add(new LiteralControl(gui.BoldFontStart + "Number of Recommendations " + "[" + gui.GreenFontStart + "Buy" + gui.GreenFontEnd + "|" + gui.GrayFontStart + "Hold" + gui.GrayFontEnd + "|" + gui.RedFontStart + "Sell" + gui.RedFontEnd + "]" + gui.BoldFontEnd)); currentUserPredictedValueCell.Controls.Add(new LiteralControl(gui.BoldFontStart + "What Other Users Recommend" + gui.BoldFontEnd)); string clickToRecommend = gui.BoldFontStart + "What" + gui.HTMLSpace + "Do" + gui.HTMLSpace + "You" + gui.LineBreak + "Recommend" + gui.BoldFontEnd; predictionCell.Controls.Add(new LiteralControl(clickToRecommend)); // predictionCell.Controls.Add(new LiteralControl(gui.BoldFontStart + "Click to Recommend" + gui.BoldFontEnd)); // analysisCell.Controls.Add(new LiteralControl(gui.BoldFontStart + "Analysis" + gui.BoldFontEnd)); row.Cells.Add(symbolCell); row.Cells.Add(priceCell); row.Cells.Add(previousCloseCell); row.Cells.Add(changeCell); row.Cells.Add(upVotesVSdownVotesCell); row.Cells.Add(currentUserPredictedValueCell); row.Cells.Add(predictionCell); // row.Cells.Add(analysisCell); StockTable.Rows.Add(row); StockTable.BorderColor = System.Drawing.Color.Silver; StockTable.BorderStyle = BorderStyle.Solid; //// Fill the Table Header END //// //ListBox TradeSignalLB = new ListBox(); //TradeSignalLB.Items.Add(new ListItem(ProcessingEngine.TradeSignal.Buy.ToString(), ProcessingEngine.TradeSignal.Buy.ToString())); //TradeSignalLB.Items.Add(new ListItem(ProcessingEngine.TradeSignal.Hold.ToString(), ProcessingEngine.TradeSignal.Hold.ToString())); //TradeSignalLB.Items.Add(new ListItem(ProcessingEngine.TradeSignal.Sell.ToString(), ProcessingEngine.TradeSignal.Sell.ToString())); //TradeSignalLB.SelectedIndexChanged += new EventHandler(TradeSignalLB_SelectedIndexChanged); //TradeSignalLB.SelectionMode = ListSelectionMode.Single; // ImageButton upPredictionButton = new ImageButton(); // ImageButton downPredictionButton = new ImageButton(); // upPredictionButton.ImageUrl = @"~/Images/upmod.png"; // downPredictionButton.ImageUrl = @"~/Images/downmod.png"; // upPredictionButton.Click += new ImageClickEventHandler(this.UpPredictionButton_Click); // downPredictionButton.Click += new ImageClickEventHandler(this.DownPredictionButton_Click); //Literal SpaceLiteral = new Literal(); //SpaceLiteral.Text = gui.HTMLSpace; LinkButton BuyButton = new LinkButton(); LinkButton HoldButton = new LinkButton(); LinkButton SellButton = new LinkButton(); BuyButton.Text = gui.GreenFontStart + ProcessingEngine.TradeSignal.Buy.ToString() + gui.GreenFontEnd; HoldButton.Text = gui.GrayFontStart + ProcessingEngine.TradeSignal.Hold.ToString() + gui.GrayFontEnd; SellButton.Text = gui.RedFontStart + ProcessingEngine.TradeSignal.Sell.ToString() + gui.RedFontEnd; //BuyButton.Attributes.Add("Font-Underline", "false"); //HoldButton.Attributes.Add("Font-Underline", "false"); //SellButton.Attributes.Add("Font-Underline", "false"); BuyButton.Font.Underline = false; HoldButton.Font.Underline = false; SellButton.Font.Underline = false; // <td style="background-color:#c8d2ff; width: 100px; height: 21px" onmouseover="this.style.backgroundColor='#e8e8ff'" onmouseout="this.style.backgroundColor='#c8d2ff'"> // <asp:LinkButton ID="HomeLinkButton" runat="server" OnClick="HomeLinkButton_Click" Font-Underline="false">Home</asp:LinkButton></td> BuyButton.Attributes.Add("onmouseover", "this.style.backgroundColor='#e8e8ff'"); HoldButton.Attributes.Add("onmouseover", "this.style.backgroundColor='#e8e8ff'"); SellButton.Attributes.Add("onmouseover", "this.style.backgroundColor='#e8e8ff'"); BuyButton.Attributes.Add("onmouseout", "this.style.backgroundColor='white'"); HoldButton.Attributes.Add("onmouseout", "this.style.backgroundColor='white'"); SellButton.Attributes.Add("onmouseout", "this.style.backgroundColor='white'"); BuyButton.Click += new EventHandler(BuyButton_Click); HoldButton.Click += new EventHandler(HoldButton_Click); SellButton.Click += new EventHandler(SellButton_Click); string stock = ""; string currentPrice = ""; string change = ""; string previousClose = ""; string queryString = ""; // DataSet ds = stockService.YahooCSVGetQuotesMatrix(alreadySelectedStocks); DataSet ds = GetUserStockQuotesMatrix(false); if (ds != null) { // Column Namesof the DataSet: [Stock | Price | Change | PreviousClose] foreach (DataRow dr in ds.Tables["StockData"].Rows) { stock = dr["Stock"].ToString(); currentPrice = dr["Price"].ToString(); change = dr["Change"].ToString(); previousClose = dr["PreviousClose"].ToString(); row = new TableRow(); symbolCell = new TableCell(); symbolCell.Text = stock; HyperLink symbolLink = new HyperLink(); symbolLink.NavigateUrl = "~/Analysis.aspx?stock=" + stock; symbolLink.Text = stock; symbolCell.Controls.Add(symbolLink); // Fetch the Current Stock Price, Change, Previous Close Price. // stockService.XIgniteGetQuoteData(interestedStocks[i], out currentPrice, out change, out previousClose); // stockService.YahooCSVGetQuoteData(interestedStocks[i], out currentPrice, out change, out previousClose); priceCell = new TableCell(); priceCell.Text = currentPrice; previousCloseCell = new TableCell(); previousCloseCell.Text = previousClose; //if (!change.StartsWith("-")) // Has been removed since the YahooCSV Comes with a + Sign. //{ // change = "+" + change; //} changeCell = new TableCell(); if (change.StartsWith("-")) { // changeCell.BackColor = System.Drawing.Color.Red; change = gui.RedFontStart + change + gui.RedFontEnd; } else { // changeCell.BackColor = System.Drawing.Color.LightGreen; change = gui.GreenFontStart + change + gui.GreenFontEnd; } changeCell.Text = change; // Fetch HighVotes | LowVotes per Stock for Tomorrow. int currentPrediction = 0; queryString = @"SELECT PredictedMovement, HighVotes, LowVotes FROM stoocks.stockprediction WHERE StockSymbol='" + stock + "' AND Date='" + tomorrow + "';"; MySqlDataReader retList = dbOps.ExecuteReader(queryString); currentUserPredictedValueCell = new TableCell(); upVotesVSdownVotesCell = new TableCell(); string currentUserPredictedValueCellString = ""; string upVotesVSdownVotesCellString = ""; if (retList != null && retList.HasRows) while (retList.Read()) { currentPrediction = retList.GetInt32(0); string highVotes = retList.GetString(1); string lowVotes = retList.GetString(2); if (currentPrediction > 0) { currentUserPredictedValueCellString = gui.BoldFontStart + gui.GreenFontStart + "Up" + gui.GreenFontEnd + gui.BoldFontEnd; } else { currentUserPredictedValueCellString = gui.BoldFontStart + gui.RedFontStart + "Down" + gui.RedFontEnd + gui.BoldFontEnd; } upVotesVSdownVotesCellString = gui.BoldFontStart + gui.GreenFontStart + highVotes + gui.GreenFontEnd + " | " + gui.RedFontStart + lowVotes + gui.RedFontEnd + gui.BoldFontEnd; } retList.Close(); currentUserPredictedValueCell.Text = currentUserPredictedValueCellString; upVotesVSdownVotesCell.Text = upVotesVSdownVotesCellString; // priceCell.Controls.Add(new LiteralControl(currentPrice)); //TradeSignalLB = new ListBox(); //TradeSignalLB.Items.Add(new ListItem(ProcessingEngine.TradeSignal.Buy.ToString(), ProcessingEngine.TradeSignal.Buy.ToString())); //TradeSignalLB.Items.Add(new ListItem(ProcessingEngine.TradeSignal.Hold.ToString(), ProcessingEngine.TradeSignal.Hold.ToString())); //TradeSignalLB.Items.Add(new ListItem(ProcessingEngine.TradeSignal.Sell.ToString(), ProcessingEngine.TradeSignal.Sell.ToString())); //TradeSignalLB.SelectedIndexChanged += new EventHandler(TradeSignalLB_SelectedIndexChanged); //TradeSignalLB.SelectionMode = ListSelectionMode.Single; //predictionCell = new TableCell(); //predictionCell.Controls.Add(TradeSignalLB); //upPredictionButton = new ImageButton(); //downPredictionButton = new ImageButton(); //upPredictionButton.ImageUrl = @"~/Images/upmod.png"; //downPredictionButton.ImageUrl = @"~/Images/downmod.png"; //upPredictionButton.Click += new ImageClickEventHandler(this.UpPredictionButton_Click); //downPredictionButton.Click += new ImageClickEventHandler(this.DownPredictionButton_Click); //predictionCell = new TableCell(); //predictionCell.Controls.Add(upPredictionButton); //predictionCell.Controls.Add(downPredictionButton); BuyButton = new LinkButton(); HoldButton = new LinkButton(); SellButton = new LinkButton(); BuyButton.Text = gui.GreenFontStart + ProcessingEngine.TradeSignal.Buy.ToString() + gui.GreenFontEnd; HoldButton.Text = gui.GrayFontStart + ProcessingEngine.TradeSignal.Hold.ToString() + gui.GrayFontEnd; SellButton.Text = gui.RedFontStart + ProcessingEngine.TradeSignal.Sell.ToString() + gui.RedFontEnd; BuyButton.Font.Underline = false; HoldButton.Font.Underline = false; SellButton.Font.Underline = false; //BuyButton.Attributes.Add("Font-Underline","false"); //HoldButton.Attributes.Add("Font-Underline", "false"); //SellButton.Attributes.Add("Font-Underline", "false"); BuyButton.Attributes.Add("onmouseover", "this.style.backgroundColor='#e8e8ff'"); HoldButton.Attributes.Add("onmouseover", "this.style.backgroundColor='#e8e8ff'"); SellButton.Attributes.Add("onmouseover", "this.style.backgroundColor='#e8e8ff'"); BuyButton.Attributes.Add("onmouseout", "this.style.backgroundColor='white'"); HoldButton.Attributes.Add("onmouseout", "this.style.backgroundColor='white'"); SellButton.Attributes.Add("onmouseout", "this.style.backgroundColor='white'"); BuyButton.Click += new EventHandler(BuyButton_Click); HoldButton.Click += new EventHandler(BuyButton_Click); SellButton.Click += new EventHandler(BuyButton_Click); predictionCell = new TableCell(); predictionCell.Controls.Add(BuyButton); predictionCell.Controls.Add(new LiteralControl(gui.HTMLSpace)); predictionCell.Controls.Add(HoldButton); predictionCell.Controls.Add(new LiteralControl(gui.HTMLSpace)); predictionCell.Controls.Add(SellButton); // // Analysis now covered in SymbolCell (i.e. Cell[0]); //HyperLink analysisLink = new HyperLink(); //analysisLink.NavigateUrl = "~/Analysis.aspx?stock=" + interestedStocks[i]; //analysisLink.Text = interestedStocks[i]; //analysisCell = new TableCell(); //analysisCell.Controls.Add(analysisLink); row.Cells.Add(symbolCell); row.Cells.Add(priceCell); row.Cells.Add(previousCloseCell); row.Cells.Add(changeCell); row.Cells.Add(upVotesVSdownVotesCell); row.Cells.Add(currentUserPredictedValueCell); row.Cells.Add(predictionCell); // row.Cells.Add(analysisCell); StockTable.Rows.Add(row); } } // ds.Dispose(); // ds = null; foreach (TableRow r in StockTable.Rows) foreach (TableCell c in r.Cells) c.ApplyStyle(tableStyle); TimeLabel.Text = gui.GrayFontStart + stockService.GetTimeOfLastTrade("YHOO") + gui.GrayFontEnd; ExplanationLabel.Text = gui.SmallFontStart + gui.GrayFontStart + "The 'Users Recommend' & 'Number of Predictions' columns show Stock-Predictions from Users for the Next Business Day" + gui.GrayFontEnd + gui.SmallFontEnd; } else { string interestsLink = "<a href='Interests.aspx'>Interests</a>"; PortfolioLabel.Text = gui.BlueFontStart + "You have not yet added any stocks to your portfolio." + gui.LineBreak + "Please visit the " + interestsLink + " Page to add your favorite stocks to your account and start " + gui.BlueFontEnd + gui.BoldFontStart + gui.RedFontStart + "Stoocking" + gui.RedFontEnd + "!" + gui.BoldFontEnd; RefreshLink.Visible = false; } }
private void LoadUserPredictionHistory() { // DB Variables. string queryString = ""; // int retVal = 0; // ArrayList retList; MySqlDataReader retList; TableItemStyle tableStyle = new TableItemStyle(); tableStyle.HorizontalAlign = HorizontalAlign.Center; tableStyle.VerticalAlign = VerticalAlign.Middle; tableStyle.Width = Unit.Pixel(2000); TableRow row = new TableRow(); TableCell symbolCell = new TableCell(); TableCell dateCell = new TableCell(); TableCell predictedMovementCell = new TableCell(); TableCell actualMovementCell = new TableCell(); //// Fill the Table Header START //// symbolCell.Controls.Add(new LiteralControl(gui.BoldFontStart + "Stock" + gui.BoldFontEnd)); dateCell.Controls.Add(new LiteralControl(gui.BoldFontStart + "Date" + gui.BoldFontEnd)); predictedMovementCell.Controls.Add(new LiteralControl(gui.BoldFontStart + "You Predicted" + gui.BoldFontEnd)); actualMovementCell.Controls.Add(new LiteralControl(gui.BoldFontStart + "Actual Movement" + gui.BoldFontEnd)); row.Cells.Add(symbolCell); row.Cells.Add(dateCell); row.Cells.Add(predictedMovementCell); row.Cells.Add(actualMovementCell); StockTable.Rows.Add(row); StockTable.BorderColor = System.Drawing.Color.Silver; StockTable.BorderStyle = BorderStyle.Solid; //// Fill the Table Header END //// //ImageButton upPredictionButton = new ImageButton(); //ImageButton downPredictionButton = new ImageButton(); //upPredictionButton.ImageUrl = @"~/Images/upmod.png"; //downPredictionButton.ImageUrl = @"~/Images/downmod.png"; //upPredictionButton.Enabled = false; //downPredictionButton.Enabled = false; Image upPredictionImage = new Image(); Image downPredictionImage = new Image(); upPredictionImage.ImageUrl = @"~/Images/upmod.png"; downPredictionImage.ImageUrl = @"~/Images/downmod.png"; // queryString = @"SELECT Symbol, Date, PredictedMovement, ActualMovement FROM Stoocks.UserPrediction WHERE Username = '******';"; // Do not show the entire User Prediction History, show only the most recent n (n between 25 and 100) rows. queryString = @"SELECT Symbol, Date, PredictedMovement, ActualMovement FROM stoocks.userprediction WHERE Username = '******' ORDER BY Date DESC LIMIT " + maxPredictionHistoryRows + ";"; // retList = dbOps.QueryMultipleRowSelect(queryString); retList = dbOps.ExecuteReader(queryString); // for (int i = 0; i < retList.Count; i++) if(retList != null && retList.HasRows) while(retList.Read()) { row = new TableRow(); /* // Before // StringCollection sc = (StringCollection)retList[i]; // sc[0] = Symbol, sc[1] = Date, sc[2] = PredictedMovement, sc[3] = ActualMovement string symbol = sc[0]; string[] splitter = {" "}; string[] dateSplit = sc[1].Split(splitter,StringSplitOptions.RemoveEmptyEntries); string date = dateSplit[0]; string predictedMovement = sc[2]; string actualMovement = sc[3]; */ string symbol = retList.GetString(0); string[] splitter = { " " }; string[] dateSplit = retList.GetString(1).Split(splitter, StringSplitOptions.RemoveEmptyEntries); string date = dateSplit[0]; int predictedMovement = retList.GetInt32(2); int actualMovement = retList.GetInt32(3); symbolCell = new TableCell(); dateCell = new TableCell(); predictedMovementCell = new TableCell(); actualMovementCell = new TableCell(); symbolCell.Text = symbol; dateCell.Text = date; //upPredictionButton = new ImageButton(); //downPredictionButton = new ImageButton(); //upPredictionButton.ImageUrl = @"~/Images/upmod.png"; //downPredictionButton.ImageUrl = @"~/Images/downmod.png"; //upPredictionButton.Enabled = false; //downPredictionButton.Enabled = false; if (predictedMovement == (int)ProcessingEngine.Movement.Up) // if (predictedMovement == "-1") { upPredictionImage = new Image(); upPredictionImage.ImageUrl = @"~/Images/upmod.png"; // predictedMovementCell.Controls.Add(upPredictionButton); predictedMovementCell.Controls.Add(upPredictionImage); } else if (predictedMovement == (int)ProcessingEngine.Movement.Down) // else if (predictedMovement == "-1") { downPredictionImage = new Image(); downPredictionImage.ImageUrl = @"~/Images/downmod.png"; // predictedMovementCell.Controls.Add(downPredictionButton); predictedMovementCell.Controls.Add(downPredictionImage); } if (actualMovement == (int)ProcessingEngine.Movement.Up) // if (actualMovement == "1") { upPredictionImage = new Image(); upPredictionImage.ImageUrl = @"~/Images/upmod.png"; // actualMovementCell.Controls.Add(upPredictionButton); actualMovementCell.Controls.Add(upPredictionImage); } else if (actualMovement == (int)ProcessingEngine.Movement.Down) // else if (actualMovement == "-1") { downPredictionImage = new Image(); downPredictionImage.ImageUrl = @"~/Images/downmod.png"; // actualMovementCell.Controls.Add(downPredictionButton); actualMovementCell.Controls.Add(downPredictionImage); } row.Cells.Add(symbolCell); row.Cells.Add(dateCell); row.Cells.Add(predictedMovementCell); row.Cells.Add(actualMovementCell); StockTable.Rows.Add(row); } retList.Close(); foreach (TableRow r in StockTable.Rows) foreach (TableCell c in r.Cells) c.ApplyStyle(tableStyle); StockLabel.Text = gui.BoldFontStart + gui.GrayFontStart + "Your Prediction History (Last 25 Predictions)" + gui.GrayFontEnd + gui.BoldFontEnd; }