private void @__BuildControl__control4(System.Web.UI.WebControls.TableItemStyle @__ctrl) { @__ctrl.BackColor = global::System.Drawing.Color.White; @__ctrl.ForeColor = ((System.Drawing.Color)(global::System.Drawing.Color.FromArgb(0, 0, 0, 0))); @__ctrl.Height = new System.Web.UI.WebControls.Unit(30D, global::System.Web.UI.WebControls.UnitType.Pixel); @__ctrl.HorizontalAlign = global::System.Web.UI.WebControls.HorizontalAlign.Left; }
/// <summary> /// constructor /// </summary> /// <param name="dt">To export DataTable</param> /// <param name="tableStyle">Styling for entire table</param> /// <param name="headerStyle">Styling for header</param> /// <param name="itemStyle">Styling for the individual cells</param> public ExcelFileResult(DataTable dt, TableStyle tableStyle, TableItemStyle headerStyle, TableItemStyle itemStyle) : base("application/ms-excel") { this.dt = dt; Title = "Attendance Report "; Footer = "Powered By: Hasib, IT Department"; TitleExportDate = "Export Date: {0}"; this.tableStyle = tableStyle; this.headerStyle = headerStyle; this.itemStyle = itemStyle; ExcelPackage EXPackage = new ExcelPackage(); // provide defaults if (this.tableStyle == null) { this.tableStyle = new TableStyle(); this.tableStyle.BorderStyle = BorderStyle.Solid; this.tableStyle.BorderColor = Color.Black; this.tableStyle.BorderWidth = Unit.Parse("2px"); //this.tableStyle.BackColor = Color.LightGray; this.tableStyle.BackColor = Color.Azure; //this.tableStyle.BackImageUrl = Path.GetFullPath("D:/HOP/BOK.jpg"); //exPackage.Workbook.Properties.Author = "Hasib"; //exPackage.Workbook.Properties.Comments = "HopLunIT"; //exPackage.Workbook.Properties.Title = "HopLun (Bangladesh) Ltd. Reports"; } if (this.headerStyle == null) { this.headerStyle = new TableItemStyle(); this.headerStyle.BackColor = Color.LightGray; } }
public ExcelResult( IQueryable rows, string fileName, string[] headers, TableStyle tableStyle, TableItemStyle headerStyle, TableItemStyle itemStyle) { //_Mapping = mapping; _Rows = rows; _FileName = fileName; _Headers = headers; _TableStyle = tableStyle; _HeaderStyle = headerStyle; _ItemStyle = itemStyle; // provide defaults if (_TableStyle == null) _TableStyle = new TableStyle(); if (_HeaderStyle == null) _HeaderStyle = new TableItemStyle { BackColor = Color.LightGray, }; if (_ItemStyle == null) _ItemStyle = new TableItemStyle { BorderStyle = BorderStyle.Solid, BorderWidth = new Unit("1px"), BorderColor = Color.LightGray }; }
/// <include file='doc\TableItemStyle.uex' path='docs/doc[@for="TableItemStyle.CopyFrom"]/*' /> /// <devdoc> /// <para>Copies non-blank elements from the specified style, overwriting existing /// style elements if necessary.</para> /// </devdoc> public override void CopyFrom(Style s) { if (s != null && !s.IsEmpty) { base.CopyFrom(s); if (s is TableItemStyle) { TableItemStyle ts = (TableItemStyle)s; if (ts.IsSet(PROP_HORZALIGN)) { this.HorizontalAlign = ts.HorizontalAlign; } if (ts.IsSet(PROP_VERTALIGN)) { this.VerticalAlign = ts.VerticalAlign; } if (ts.IsSet(PROP_WRAP)) { this.Wrap = ts.Wrap; } } } }
/// <include file='doc\TableItemStyle.uex' path='docs/doc[@for="TableItemStyle.MergeWith"]/*' /> /// <devdoc> /// <para>Copies non-blank elements from the specified style, but will not overwrite /// any existing style elements.</para> /// </devdoc> public override void MergeWith(Style s) { if (s != null && !s.IsEmpty) { if (IsEmpty) { // merge into an empty style is equivalent to a copy, which // is more efficient CopyFrom(s); return; } base.MergeWith(s); if (s is TableItemStyle) { TableItemStyle ts = (TableItemStyle)s; if (ts.IsSet(PROP_HORZALIGN) && !this.IsSet(PROP_HORZALIGN)) { this.HorizontalAlign = ts.HorizontalAlign; } if (ts.IsSet(PROP_VERTALIGN) && !this.IsSet(PROP_VERTALIGN)) { this.VerticalAlign = ts.VerticalAlign; } if (ts.IsSet(PROP_WRAP) && !this.IsSet(PROP_WRAP)) { this.Wrap = ts.Wrap; } } } }
public override void MergeWith(Style s) { if ((s != null) && !s.IsEmpty) { if (this.IsEmpty) { this.CopyFrom(s); } else { base.MergeWith(s); if (s is TableItemStyle) { TableItemStyle style = (TableItemStyle)s; if (((s.RegisteredCssClass.Length == 0) && style.IsSet(0x40000)) && !base.IsSet(0x40000)) { this.Wrap = style.Wrap; } if (style.IsSet(0x10000) && !base.IsSet(0x10000)) { this.HorizontalAlign = style.HorizontalAlign; } if (style.IsSet(0x20000) && !base.IsSet(0x20000)) { this.VerticalAlign = style.VerticalAlign; } } } } }
private void save(DataTable dt,string filename) { 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; DataSet ds = new DataSet(); ds.Tables.Add(dt); excel.DataSource = ds; //输出DataTable的内容 excel.DataBind(); System.IO.StringWriter oStringWriter = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter); excel.RenderControl(oHtmlTextWriter); Response.AddHeader("Content-Disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode(filename, System.Text.Encoding.UTF8) + ".xls"); Response.ContentType = "application/ms-excel"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); Response.Write(oHtmlTextWriter.InnerWriter.ToString()); Response.End(); }
private void Page_Load(object sender, System.EventArgs e) { //Put user code to initialize the page here base.GHTTestBegin((HtmlForm)this.FindControl("Form1")); System.Web.UI.WebControls.TableItemStyle myStyle = new System.Web.UI.WebControls.TableItemStyle(); try { base.GHTSubTestBegin("TableItemStyle - Wrap"); base.GHTActiveSubTest.Controls.Add(Table1); myStyle.Wrap = false; base.GHTSubTestAddResult(myStyle.Wrap.ToString()); Table1.Rows[0].Cells[0].ApplyStyle(myStyle); Table1.Rows[0].ApplyStyle(myStyle); myStyle.Wrap = true; base.GHTSubTestAddResult(myStyle.Wrap.ToString()); Table1.Rows[0].Cells[1].ApplyStyle(myStyle); Table1.Rows[1].ApplyStyle(myStyle); } catch (Exception ex) { base.GHTSubTestUnexpectedExceptionCaught(ex); } base.GHTSubTestEnd(); base.GHTTestEnd(); }
private void @__BuildControl__control20(System.Web.UI.WebControls.TableItemStyle @__ctrl) { @__ctrl.BackColor = ((System.Drawing.Color)(global::System.Drawing.Color.FromArgb(80, 124, 209))); @__ctrl.Font.Bold = true; @__ctrl.ForeColor = global::System.Drawing.Color.White; @__ctrl.HorizontalAlign = global::System.Web.UI.WebControls.HorizontalAlign.Center; }
public override void CopyFrom(Style s) { if ((s != null) && !s.IsEmpty) { base.CopyFrom(s); if (s is TableItemStyle) { TableItemStyle style = (TableItemStyle)s; if (s.RegisteredCssClass.Length != 0) { if (style.IsSet(0x40000)) { base.ViewState.Remove("Wrap"); base.ClearBit(0x40000); } } else if (style.IsSet(0x40000)) { this.Wrap = style.Wrap; } if (style.IsSet(0x10000)) { this.HorizontalAlign = style.HorizontalAlign; } if (style.IsSet(0x20000)) { this.VerticalAlign = style.VerticalAlign; } } } }
// use ref for some stupid reason even though a class passes by ref otherwise ASP compiler freaks! :P private void SetTableItemStyle(ref ASP.TableItemStyle style) { style = new ASP.TableItemStyle(); if (base.IsTrackingViewState) { ((IStateManager)style).TrackViewState(); } }
/// <summary> /// Creates and returns a new <see cref="System.Web.UI.WebControls.TableItemStyle"/> with /// the specified CSS Class. /// </summary> /// <param name="cssclass">The CSS Class name which is set as the CSS Class of the /// newly created <see cref="System.Web.UI.WebControls.TableItemStyle"/>.</param> /// <returns> /// The newly created <see cref="System.Web.UI.WebControls.TableItemStyle"/>. /// </returns> public static TableItemStyle New(string cssclass) { TableItemStyle style = new TableItemStyle(); style.CssClass = cssclass; return style; }
private void @__BuildControl__control7(System.Web.UI.WebControls.TableItemStyle @__ctrl) { @__ctrl.BackColor = ((System.Drawing.Color)(global::System.Drawing.Color.FromArgb(239, 243, 251))); @__ctrl.HorizontalAlign = global::System.Web.UI.WebControls.HorizontalAlign.Center; @__ctrl.BorderStyle = global::System.Web.UI.WebControls.BorderStyle.Solid; @__ctrl.BorderColor = global::System.Drawing.Color.Black; @__ctrl.BorderWidth = new System.Web.UI.WebControls.Unit(1D, global::System.Web.UI.WebControls.UnitType.Pixel); }
private void @__BuildControl__control18(System.Web.UI.WebControls.TableItemStyle @__ctrl) { @__ctrl.CssClass = "pagination"; @__ctrl.HorizontalAlign = global::System.Web.UI.WebControls.HorizontalAlign.Center; @__ctrl.VerticalAlign = global::System.Web.UI.WebControls.VerticalAlign.Middle; @__ctrl.Wrap = true; @__ctrl.BackColor = global::System.Drawing.Color.White; }
void WriteDay(DateTime date, HtmlTextWriter writer, bool enabled) { TableItemStyle style = new TableItemStyle(); TableCell cell = new TableCell(); CalendarDay day = new CalendarDay(date, IsWeekEnd(date.DayOfWeek), date == TodaysDate, SelectedDates.Contains(date), GetGlobalCalendar().GetMonth(DisplayDate) != GetGlobalCalendar().GetMonth(date), date.Day.ToString()); day.IsSelectable = SelectionMode != CalendarSelectionMode.None; cell.HorizontalAlign = HorizontalAlign.Center; cell.Width = Unit.Percentage(GetCellWidth()); LiteralControl lit = new LiteralControl(day.DayNumberText); cell.Controls.Add(lit); OnDayRender(cell, day); if (dayStyle != null && !dayStyle.IsEmpty) { style.CopyFrom(dayStyle); } if (day.IsWeekend && weekendDayStyle != null && !weekendDayStyle.IsEmpty) { style.CopyFrom(weekendDayStyle); } if (day.IsToday && todayDayStyle != null && !todayDayStyle.IsEmpty) { style.CopyFrom(todayDayStyle); } if (day.IsOtherMonth && otherMonthDayStyle != null && !otherMonthDayStyle.IsEmpty) { style.CopyFrom(otherMonthDayStyle); } if (enabled && day.IsSelected) { style.BackColor = Color.Silver; style.ForeColor = Color.White; if (selectedDayStyle != null && !selectedDayStyle.IsEmpty) { style.CopyFrom(selectedDayStyle); } } cell.ApplyStyle(style); lit.Text = BuildLink(GetDaysFromZenith(date).ToString(), day.DayNumberText, cell.ForeColor, enabled && day.IsSelectable); cell.RenderControl(writer); }
private void @__BuildControl__control5(System.Web.UI.WebControls.TableItemStyle @__ctrl) { @__ctrl.BackColor = ((System.Drawing.Color)(global::System.Drawing.Color.FromArgb(80, 124, 209))); @__ctrl.Font.Bold = true; @__ctrl.ForeColor = global::System.Drawing.Color.White; @__ctrl.BorderStyle = global::System.Web.UI.WebControls.BorderStyle.Solid; @__ctrl.BorderColor = global::System.Drawing.Color.Black; @__ctrl.BorderWidth = new System.Web.UI.WebControls.Unit(1D, global::System.Web.UI.WebControls.UnitType.Pixel); }
private void Page_Load(object sender, System.EventArgs e) { //Put user code to initialize the page here base.GHTTestBegin((HtmlForm)this.FindControl("Form1")); System.Web.UI.WebControls.TableItemStyle tableStyle = new System.Web.UI.WebControls.TableItemStyle(); tableStyle.CopyFrom(Table2.Rows[0].Cells[0].ControlStyle); Table1.Rows[0].Cells[0].ApplyStyle(tableStyle); tableStyle.CopyFrom(Table2.Rows[1].ControlStyle); Table1.Rows[1].ApplyStyle(tableStyle); base.GHTTestEnd(); }
public static void InitGeneralTableLayout(System.Web.UI.WebControls.TableItemStyle TableItemStyle, System.Drawing.Color ForeColor, System.Drawing.Color BackColor, System.Drawing.Color BorderColor, System.Web.UI.WebControls.BorderStyle BorderStyle, System.Web.UI.WebControls.Unit BorderWidth, string MyCsClass, System.Web.UI.WebControls.HorizontalAlign HorizontalAlign, System.Web.UI.WebControls.VerticalAlign VerticalAlign, System.Web.UI.WebControls.Unit Width, System.Web.UI.WebControls.Unit Height) { TableItemStyle.BackColor = BackColor; TableItemStyle.BorderColor = BorderColor; TableItemStyle.BorderStyle = BorderStyle; TableItemStyle.BorderWidth = BorderWidth; TableItemStyle.CssClass = MyCsClass; TableItemStyle.HorizontalAlign = HorizontalAlign; TableItemStyle.VerticalAlign = VerticalAlign; TableItemStyle.ForeColor = ForeColor; TableItemStyle.Width = Width; TableItemStyle.Height = Height; }
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); }
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 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; }
private void Page_Load(object sender, System.EventArgs e) { //Put user code to initialize the page here base.GHTTestBegin((HtmlForm)this.FindControl("Form1")); System.Web.UI.WebControls.TableItemStyle myStyle = new System.Web.UI.WebControls.TableItemStyle(); try { base.GHTSubTestBegin("TableItemStyle - HorizontalAlign"); base.GHTActiveSubTest.Controls.Add(Table1); myStyle.HorizontalAlign = HorizontalAlign.Center; base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString()); Table1.Rows[0].Cells[0].ApplyStyle(myStyle); Table1.Rows[0].ApplyStyle(myStyle); myStyle.HorizontalAlign = HorizontalAlign.Justify; base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString()); Table1.Rows[0].Cells[1].ApplyStyle(myStyle); Table1.Rows[1].ApplyStyle(myStyle); myStyle.HorizontalAlign = HorizontalAlign.Left; base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString()); Table1.Rows[0].Cells[2].ApplyStyle(myStyle); Table1.Rows[2].ApplyStyle(myStyle); myStyle.HorizontalAlign = HorizontalAlign.NotSet; base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString()); Table1.Rows[0].Cells[3].ApplyStyle(myStyle); Table1.Rows[3].ApplyStyle(myStyle); myStyle.HorizontalAlign = HorizontalAlign.Right; base.GHTSubTestAddResult(myStyle.HorizontalAlign.ToString()); Table1.Rows[0].Cells[4].ApplyStyle(myStyle); Table1.Rows[4].ApplyStyle(myStyle); } catch (Exception ex) { base.GHTSubTestUnexpectedExceptionCaught(ex); } base.GHTSubTestEnd(); base.GHTTestEnd(); }
private void Page_Load(object sender, System.EventArgs e) { //Put user code to initialize the page here // System.Web.UI.StateBag base.GHTTestBegin((HtmlForm)this.FindControl("Form1")); try { base.GHTSubTestBegin("TableItemStyle_ctor_S"); System.Web.UI.WebControls.TableItemStyle myStyle; myStyle = new System.Web.UI.WebControls.TableItemStyle(new System.Web.UI.StateBag(true)); base.GHTSubTestAddResult("is (object = null)? " + ((myStyle == null) ? "True" : "False")); } catch (Exception ex) { base.GHTSubTestUnexpectedExceptionCaught(ex); } base.GHTSubTestEnd(); base.GHTTestEnd(); }
private void Page_Load(object sender, System.EventArgs e) { //Put user code to initialize the page here base.GHTTestBegin((HtmlForm)this.FindControl("Form1")); try { base.GHTSubTestBegin("TableItemStyle_ctor"); System.Web.UI.WebControls.TableItemStyle myStyle; myStyle = new System.Web.UI.WebControls.TableItemStyle(); base.GHTSubTestAddResult("is (object = null)? " + ((myStyle == null) ? "True" : "False")); } catch (Exception ex) { base.GHTSubTestUnexpectedExceptionCaught(ex); } base.GHTSubTestEnd(); base.GHTTestEnd(); }
public ExcelFeedGenerator() { _tableStyle = new TableStyle { BorderStyle = BorderStyle.Solid, BorderColor = Color.Black, BorderWidth = Unit.Parse("1px"), }; _headerStyle = new TableItemStyle { VerticalAlign = VerticalAlign.Top, BackColor = Color.DimGray, }; _itemStyle = new TableItemStyle { VerticalAlign = VerticalAlign.Top, BorderStyle = BorderStyle.Solid, BorderColor = Color.DimGray, }; }
/// <devdoc> /// <para>Copies non-blank elements from the specified style, but will not overwrite /// any existing style elements.</para> /// </devdoc> public override void MergeWith(Style s) { if (s != null && !s.IsEmpty) { if (IsEmpty) { // merge into an empty style is equivalent to a copy, which // is more efficient CopyFrom(s); return; } base.MergeWith(s); if (s is TableItemStyle) { TableItemStyle ts = (TableItemStyle)s; // Since we're already copying the registered CSS class in base.MergeWith, we don't // need to any attributes that would be included in that class. if (s.RegisteredCssClass.Length == 0) { if (ts.IsSet(PROP_WRAP) && !this.IsSet(PROP_WRAP)) { this.Wrap = ts.Wrap; } } if (ts.IsSet(PROP_HORZALIGN) && !this.IsSet(PROP_HORZALIGN)) { this.HorizontalAlign = ts.HorizontalAlign; } if (ts.IsSet(PROP_VERTALIGN) && !this.IsSet(PROP_VERTALIGN)) { this.VerticalAlign = ts.VerticalAlign; } } } }
/// <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.BorderWidth = Unit.Parse("2px"); } if (this.headerStyle == null) { this.headerStyle = new TableItemStyle(); this.headerStyle.BackColor = Color.LightGray; } }
public ExcelResult(IQueryable rows, string fileName, Dictionary<string, string> headers, TableStyle tableStyle, TableItemStyle headerStyle, TableItemStyle itemStyle) { _rows = rows; _fileName = fileName; _headers = headers; _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("1px"); } if (_headerStyle == null) { _headerStyle = new TableItemStyle(); _headerStyle.BackColor = Color.LightGray; } }
/// <devdoc> /// <para>Copies non-blank elements from the specified style, overwriting existing /// style elements if necessary.</para> /// </devdoc> public override void CopyFrom(Style s) { if (s != null && !s.IsEmpty) { base.CopyFrom(s); if (s is TableItemStyle) { TableItemStyle ts = (TableItemStyle)s; if (s.RegisteredCssClass.Length != 0) { if (ts.IsSet(PROP_WRAP)) { ViewState.Remove("Wrap"); ClearBit(PROP_WRAP); } } else { if (ts.IsSet(PROP_WRAP)) { this.Wrap = ts.Wrap; } } if (ts.IsSet(PROP_HORZALIGN)) { this.HorizontalAlign = ts.HorizontalAlign; } if (ts.IsSet(PROP_VERTALIGN)) { this.VerticalAlign = ts.VerticalAlign; } } } }
public ExcelResult(IList rows, string fileName, string[] headers, Type resourceSource, TableStyle tableStyle, TableItemStyle headerStyle, TableItemStyle itemStyle) { Rows = rows; ResourceSource = resourceSource; _fileName = fileName; _headers = headers; _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 ExcelResult(DbContext dataContext, IQueryable rows, string fileName, string[] headers, TableStyle tableStyle, TableItemStyle headerStyle, TableItemStyle itemStyle) { _dataContext = dataContext; _rows = rows; _fileName = fileName; _headers = headers; _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; } }
/// <devdoc> /// </devdoc> protected internal virtual void PrepareControlHierarchy() { // The order of rows is autogenerated data rows, declared rows, then autogenerated command rows if (Controls.Count < 1) { return; } Debug.Assert(Controls[0] is Table); Table childTable = (Table)Controls[0]; childTable.CopyBaseAttributes(this); if (ControlStyleCreated && !ControlStyle.IsEmpty) { childTable.ApplyStyle(ControlStyle); } else { // Since we didn't create a ControlStyle yet, the default // settings for the default style of the control need to be applied // to the child table control directly // childTable.GridLines = GridLines.Both; childTable.CellSpacing = 0; } childTable.Caption = Caption; childTable.CaptionAlign = CaptionAlign; // the composite alternating item style, so we need to do just one // merge style on the actual item Style altRowStyle = new TableItemStyle(); altRowStyle.CopyFrom(_rowStyle); if (_alternatingRowStyle != null) { altRowStyle = new TableItemStyle(); altRowStyle.CopyFrom(_alternatingRowStyle); } Style compositeStyle; TableRowCollection rows = childTable.Rows; foreach (DetailsViewRow row in rows) { compositeStyle = new TableItemStyle(); DataControlRowState rowState = row.RowState; DataControlRowType rowType = row.RowType; DataControlFieldCell headerFieldCell = row.Cells[0] as DataControlFieldCell; DataControlField field = null; if (headerFieldCell != null) { field = headerFieldCell.ContainingField; } switch (rowType) { case DataControlRowType.Header: compositeStyle = _headerStyle; break; case DataControlRowType.Footer: compositeStyle = _footerStyle; break; case DataControlRowType.DataRow: compositeStyle.CopyFrom(_rowStyle); if ((rowState & DataControlRowState.Alternate) != 0) { compositeStyle.CopyFrom(altRowStyle); } if (field is ButtonFieldBase) { compositeStyle.CopyFrom(_commandRowStyle); break; } if ((rowState & DataControlRowState.Edit) != 0) { compositeStyle.CopyFrom(_editRowStyle); } if ((rowState & DataControlRowState.Insert) != 0) { if (_insertRowStyle != null) { compositeStyle.CopyFrom(_insertRowStyle); } else { compositeStyle.CopyFrom(_editRowStyle); } } break; case DataControlRowType.Pager: compositeStyle = _pagerStyle; break; case DataControlRowType.EmptyDataRow: compositeStyle = _emptyDataRowStyle; break; } if (compositeStyle != null && row.Visible) { row.MergeStyle(compositeStyle); } if (rowType == DataControlRowType.DataRow && field != null) { if (!field.Visible || (Mode == DetailsViewMode.Insert && !field.InsertVisible)) { row.Visible = false; } else { int contentCellIndex = 0; DataControlFieldCell contentFieldCell = null; if (headerFieldCell != null && headerFieldCell.ContainingField.ShowHeader) { headerFieldCell.MergeStyle(field.HeaderStyleInternal); headerFieldCell.MergeStyle(_fieldHeaderStyle); contentCellIndex = 1; } contentFieldCell = row.Cells[contentCellIndex] as DataControlFieldCell; if (contentFieldCell != null) { contentFieldCell.MergeStyle(field.ItemStyleInternal); } foreach (Control control in contentFieldCell.Controls) { WebControl webControl = control as WebControl; Style fieldControlStyle = field.ControlStyleInternal; if (webControl != null && fieldControlStyle != null && !fieldControlStyle.IsEmpty) { webControl.ControlStyle.CopyFrom(fieldControlStyle); } } } } } }
private void @__BuildControl__control8(System.Web.UI.WebControls.TableItemStyle @__ctrl) { @__ctrl.CssClass = "pagination-ys"; }
private void @__BuildControl__control4(System.Web.UI.WebControls.TableItemStyle @__ctrl) { @__ctrl.BackColor = ((System.Drawing.Color)(global::System.Drawing.Color.FromArgb(74, 60, 140))); @__ctrl.Font.Bold = true; @__ctrl.ForeColor = ((System.Drawing.Color)(global::System.Drawing.Color.FromArgb(247, 247, 247))); }
private void @__BuildControl__control32(System.Web.UI.WebControls.TableItemStyle @__ctrl) { @__ctrl.BackColor = ((System.Drawing.Color)(global::System.Drawing.Color.FromArgb(148, 113, 222))); @__ctrl.Font.Bold = true; @__ctrl.ForeColor = global::System.Drawing.Color.White; }
private void @__BuildControl__control30(System.Web.UI.WebControls.TableItemStyle @__ctrl) { @__ctrl.BackColor = ((System.Drawing.Color)(global::System.Drawing.Color.FromArgb(198, 195, 198))); @__ctrl.ForeColor = global::System.Drawing.Color.Black; @__ctrl.HorizontalAlign = global::System.Web.UI.WebControls.HorizontalAlign.Right; }
internal void ApplyLayoutStyleToInnerCells(TableItemStyle tableItemStyle) { for (int i = 0; i < this._innerCells.Length; i++) { if (tableItemStyle.IsSet(0x10000)) { this._innerCells[i].HorizontalAlign = tableItemStyle.HorizontalAlign; } if (tableItemStyle.IsSet(0x20000)) { this._innerCells[i].VerticalAlign = tableItemStyle.VerticalAlign; } } }
private void ApplyDefaultCreateUserValues() { this._createUserStepContainer.UserNameLabel.Text = this.UserNameLabelText; WebControl userNameTextBox = (WebControl) this._createUserStepContainer.UserNameTextBox; userNameTextBox.TabIndex = this.TabIndex; userNameTextBox.AccessKey = this.AccessKey; this._createUserStepContainer.PasswordLabel.Text = this.PasswordLabelText; WebControl passwordTextBox = (WebControl) this._createUserStepContainer.PasswordTextBox; passwordTextBox.TabIndex = this.TabIndex; this._createUserStepContainer.ConfirmPasswordLabel.Text = this.ConfirmPasswordLabelText; WebControl confirmPasswordTextBox = (WebControl) this._createUserStepContainer.ConfirmPasswordTextBox; confirmPasswordTextBox.TabIndex = this.TabIndex; if (this._textBoxStyle != null) { userNameTextBox.ApplyStyle(this._textBoxStyle); passwordTextBox.ApplyStyle(this._textBoxStyle); confirmPasswordTextBox.ApplyStyle(this._textBoxStyle); } LoginUtil.ApplyStyleToLiteral(this._createUserStepContainer.Title, this.CreateUserStep.Title, this.TitleTextStyle, true); LoginUtil.ApplyStyleToLiteral(this._createUserStepContainer.InstructionLabel, this.InstructionText, this.InstructionTextStyle, true); LoginUtil.ApplyStyleToLiteral(this._createUserStepContainer.UserNameLabel, this.UserNameLabelText, this.LabelStyle, false); LoginUtil.ApplyStyleToLiteral(this._createUserStepContainer.PasswordLabel, this.PasswordLabelText, this.LabelStyle, false); LoginUtil.ApplyStyleToLiteral(this._createUserStepContainer.ConfirmPasswordLabel, this.ConfirmPasswordLabelText, this.LabelStyle, false); if (!string.IsNullOrEmpty(this.PasswordHintText) && !this.AutoGeneratePassword) { LoginUtil.ApplyStyleToLiteral(this._createUserStepContainer.PasswordHintLabel, this.PasswordHintText, this.PasswordHintStyle, false); } else { this._passwordHintTableRow.Visible = false; } bool flag = true; WebControl emailTextBox = null; if (this.RequireEmail) { LoginUtil.ApplyStyleToLiteral(this._createUserStepContainer.EmailLabel, this.EmailLabelText, this.LabelStyle, false); emailTextBox = (WebControl) this._createUserStepContainer.EmailTextBox; ((ITextControl) emailTextBox).Text = this.Email; RequiredFieldValidator emailRequired = this._createUserStepContainer.EmailRequired; emailRequired.ToolTip = this.EmailRequiredErrorMessage; emailRequired.ErrorMessage = this.EmailRequiredErrorMessage; emailRequired.Enabled = flag; emailRequired.Visible = flag; if (this._validatorTextStyle != null) { emailRequired.ApplyStyle(this._validatorTextStyle); } emailTextBox.TabIndex = this.TabIndex; if (this._textBoxStyle != null) { emailTextBox.ApplyStyle(this._textBoxStyle); } } else { this._emailRow.Visible = false; } WebControl questionTextBox = null; WebControl answerTextBox = null; RequiredFieldValidator questionRequired = this._createUserStepContainer.QuestionRequired; RequiredFieldValidator answerRequired = this._createUserStepContainer.AnswerRequired; bool flag2 = flag && this.QuestionAndAnswerRequired; questionRequired.Enabled = flag2; questionRequired.Visible = flag2; answerRequired.Enabled = flag2; answerRequired.Visible = flag2; if (this.QuestionAndAnswerRequired) { LoginUtil.ApplyStyleToLiteral(this._createUserStepContainer.QuestionLabel, this.QuestionLabelText, this.LabelStyle, false); questionTextBox = (WebControl) this._createUserStepContainer.QuestionTextBox; ((ITextControl) questionTextBox).Text = this.Question; questionTextBox.TabIndex = this.TabIndex; LoginUtil.ApplyStyleToLiteral(this._createUserStepContainer.AnswerLabel, this.AnswerLabelText, this.LabelStyle, false); answerTextBox = (WebControl) this._createUserStepContainer.AnswerTextBox; ((ITextControl) answerTextBox).Text = this.Answer; answerTextBox.TabIndex = this.TabIndex; if (this._textBoxStyle != null) { questionTextBox.ApplyStyle(this._textBoxStyle); answerTextBox.ApplyStyle(this._textBoxStyle); } questionRequired.ToolTip = this.QuestionRequiredErrorMessage; questionRequired.ErrorMessage = this.QuestionRequiredErrorMessage; answerRequired.ToolTip = this.AnswerRequiredErrorMessage; answerRequired.ErrorMessage = this.AnswerRequiredErrorMessage; if (this._validatorTextStyle != null) { questionRequired.ApplyStyle(this._validatorTextStyle); answerRequired.ApplyStyle(this._validatorTextStyle); } } else { this._questionRow.Visible = false; this._answerRow.Visible = false; } if (this._defaultCreateUserNavigationTemplate != null) { ((Wizard.BaseNavigationTemplateContainer) this.CreateUserStep.CustomNavigationTemplateContainer).NextButton = this._defaultCreateUserNavigationTemplate.CreateUserButton; ((Wizard.BaseNavigationTemplateContainer) this.CreateUserStep.CustomNavigationTemplateContainer).CancelButton = this._defaultCreateUserNavigationTemplate.CancelButton; } RequiredFieldValidator passwordRequired = this._createUserStepContainer.PasswordRequired; RequiredFieldValidator confirmPasswordRequired = this._createUserStepContainer.ConfirmPasswordRequired; CompareValidator passwordCompareValidator = this._createUserStepContainer.PasswordCompareValidator; RegularExpressionValidator passwordRegExpValidator = this._createUserStepContainer.PasswordRegExpValidator; bool flag3 = flag && !this.AutoGeneratePassword; passwordRequired.Enabled = flag3; passwordRequired.Visible = flag3; confirmPasswordRequired.Enabled = flag3; confirmPasswordRequired.Visible = flag3; passwordCompareValidator.Enabled = flag3; passwordCompareValidator.Visible = flag3; bool flag4 = flag3 && (this.PasswordRegularExpression.Length > 0); passwordRegExpValidator.Enabled = flag4; passwordRegExpValidator.Visible = flag4; if (!flag) { this._passwordRegExpRow.Visible = false; this._passwordCompareRow.Visible = false; this._emailRegExpRow.Visible = false; } if (this.AutoGeneratePassword) { this._passwordTableRow.Visible = false; this._confirmPasswordTableRow.Visible = false; this._passwordRegExpRow.Visible = false; this._passwordCompareRow.Visible = false; } else { passwordRequired.ErrorMessage = this.PasswordRequiredErrorMessage; passwordRequired.ToolTip = this.PasswordRequiredErrorMessage; confirmPasswordRequired.ErrorMessage = this.ConfirmPasswordRequiredErrorMessage; confirmPasswordRequired.ToolTip = this.ConfirmPasswordRequiredErrorMessage; passwordCompareValidator.ErrorMessage = this.ConfirmPasswordCompareErrorMessage; if (this._validatorTextStyle != null) { passwordRequired.ApplyStyle(this._validatorTextStyle); confirmPasswordRequired.ApplyStyle(this._validatorTextStyle); passwordCompareValidator.ApplyStyle(this._validatorTextStyle); } if (flag4) { passwordRegExpValidator.ValidationExpression = this.PasswordRegularExpression; passwordRegExpValidator.ErrorMessage = this.PasswordRegularExpressionErrorMessage; if (this._validatorTextStyle != null) { passwordRegExpValidator.ApplyStyle(this._validatorTextStyle); } } else { this._passwordRegExpRow.Visible = false; } } RequiredFieldValidator userNameRequired = this._createUserStepContainer.UserNameRequired; userNameRequired.ErrorMessage = this.UserNameRequiredErrorMessage; userNameRequired.ToolTip = this.UserNameRequiredErrorMessage; userNameRequired.Enabled = flag; userNameRequired.Visible = flag; if (this._validatorTextStyle != null) { userNameRequired.ApplyStyle(this._validatorTextStyle); } bool flag5 = (flag && (this.EmailRegularExpression.Length > 0)) && this.RequireEmail; RegularExpressionValidator emailRegExpValidator = this._createUserStepContainer.EmailRegExpValidator; emailRegExpValidator.Enabled = flag5; emailRegExpValidator.Visible = flag5; if ((this.EmailRegularExpression.Length > 0) && this.RequireEmail) { emailRegExpValidator.ValidationExpression = this.EmailRegularExpression; emailRegExpValidator.ErrorMessage = this.EmailRegularExpressionErrorMessage; if (this._validatorTextStyle != null) { emailRegExpValidator.ApplyStyle(this._validatorTextStyle); } } else { this._emailRegExpRow.Visible = false; } string helpPageText = this.HelpPageText; bool flag6 = helpPageText.Length > 0; HyperLink helpPageLink = this._createUserStepContainer.HelpPageLink; Image helpPageIcon = this._createUserStepContainer.HelpPageIcon; helpPageLink.Visible = flag6; if (flag6) { helpPageLink.Text = helpPageText; helpPageLink.NavigateUrl = this.HelpPageUrl; helpPageLink.TabIndex = this.TabIndex; } string helpPageIconUrl = this.HelpPageIconUrl; bool flag7 = helpPageIconUrl.Length > 0; helpPageIcon.Visible = flag7; if (flag7) { helpPageIcon.ImageUrl = helpPageIconUrl; helpPageIcon.AlternateText = helpPageText; } LoginUtil.SetTableCellVisible(helpPageLink, flag6 || flag7); if ((this._hyperLinkStyle != null) && (flag6 || flag7)) { TableItemStyle style = new TableItemStyle(); style.CopyFrom(this._hyperLinkStyle); style.Font.Reset(); LoginUtil.SetTableCellStyle(helpPageLink, style); helpPageLink.Font.CopyFrom(this._hyperLinkStyle.Font); helpPageLink.ForeColor = this._hyperLinkStyle.ForeColor; } Control errorMessageLabel = this._createUserStepContainer.ErrorMessageLabel; if (errorMessageLabel != null) { if (this._failure && !string.IsNullOrEmpty(this._unknownErrorMessage)) { ((ITextControl) errorMessageLabel).Text = this._unknownErrorMessage; LoginUtil.SetTableCellStyle(errorMessageLabel, this.ErrorMessageStyle); LoginUtil.SetTableCellVisible(errorMessageLabel, true); } else { LoginUtil.SetTableCellVisible(errorMessageLabel, false); } } }
private void ApplyCompleteValues() { LoginUtil.ApplyStyleToLiteral(this._completeStepContainer.SuccessTextLabel, this.CompleteSuccessText, this._completeSuccessTextStyle, true); switch (this.ContinueButtonType) { case ButtonType.Button: this._completeStepContainer.ContinueLinkButton.Visible = false; this._completeStepContainer.ContinueImageButton.Visible = false; this._completeStepContainer.ContinuePushButton.Text = this.ContinueButtonText; this._completeStepContainer.ContinuePushButton.ValidationGroup = this.ValidationGroup; this._completeStepContainer.ContinuePushButton.TabIndex = this.TabIndex; this._completeStepContainer.ContinuePushButton.AccessKey = this.AccessKey; break; case ButtonType.Image: this._completeStepContainer.ContinueLinkButton.Visible = false; this._completeStepContainer.ContinuePushButton.Visible = false; this._completeStepContainer.ContinueImageButton.ImageUrl = this.ContinueButtonImageUrl; this._completeStepContainer.ContinueImageButton.AlternateText = this.ContinueButtonText; this._completeStepContainer.ContinueImageButton.ValidationGroup = this.ValidationGroup; this._completeStepContainer.ContinueImageButton.TabIndex = this.TabIndex; this._completeStepContainer.ContinueImageButton.AccessKey = this.AccessKey; break; case ButtonType.Link: this._completeStepContainer.ContinuePushButton.Visible = false; this._completeStepContainer.ContinueImageButton.Visible = false; this._completeStepContainer.ContinueLinkButton.Text = this.ContinueButtonText; this._completeStepContainer.ContinueLinkButton.ValidationGroup = this.ValidationGroup; this._completeStepContainer.ContinueLinkButton.TabIndex = this.TabIndex; this._completeStepContainer.ContinueLinkButton.AccessKey = this.AccessKey; break; } if (!base.NavigationButtonStyle.IsEmpty) { this._completeStepContainer.ContinuePushButton.ApplyStyle(base.NavigationButtonStyle); this._completeStepContainer.ContinueImageButton.ApplyStyle(base.NavigationButtonStyle); this._completeStepContainer.ContinueLinkButton.ApplyStyle(base.NavigationButtonStyle); } if (this._continueButtonStyle != null) { this._completeStepContainer.ContinuePushButton.ApplyStyle(this._continueButtonStyle); this._completeStepContainer.ContinueImageButton.ApplyStyle(this._continueButtonStyle); this._completeStepContainer.ContinueLinkButton.ApplyStyle(this._continueButtonStyle); } LoginUtil.ApplyStyleToLiteral(this._completeStepContainer.Title, this.CompleteStep.Title, this._titleTextStyle, true); string editProfileText = this.EditProfileText; bool flag = editProfileText.Length > 0; HyperLink editProfileLink = this._completeStepContainer.EditProfileLink; editProfileLink.Visible = flag; if (flag) { editProfileLink.Text = editProfileText; editProfileLink.NavigateUrl = this.EditProfileUrl; editProfileLink.TabIndex = this.TabIndex; if (this._hyperLinkStyle != null) { Style style = new TableItemStyle(); style.CopyFrom(this._hyperLinkStyle); style.Font.Reset(); LoginUtil.SetTableCellStyle(editProfileLink, style); editProfileLink.Font.CopyFrom(this._hyperLinkStyle.Font); editProfileLink.ForeColor = this._hyperLinkStyle.ForeColor; } } string editProfileIconUrl = this.EditProfileIconUrl; bool flag2 = editProfileIconUrl.Length > 0; Image editProfileIcon = this._completeStepContainer.EditProfileIcon; editProfileIcon.Visible = flag2; if (flag2) { editProfileIcon.ImageUrl = editProfileIconUrl; editProfileIcon.AlternateText = this.EditProfileText; } LoginUtil.SetTableCellVisible(editProfileLink, flag || flag2); Table layoutTable = ((CompleteStepContainer) this.CompleteStep.ContentTemplateContainer).LayoutTable; layoutTable.Height = this.Height; layoutTable.Width = this.Width; }
public ActionResult Detail(int id, int? pageNo, string parm, OpenBidProjectQuery query) { Dictionary<string, string> sitemaster = GetSiteMaster(); ViewData["SiteMaster"] = sitemaster; //SingleProjectDao mDOpenProjectDao = new SingleProjectDao(); SingleProject mDOpenProject = EmedDataCenterMapper.Get().QueryForObject<SingleProject>("SingleProject.Find", id); ViewData["ProjectDescription"] = mDOpenProject.NewProjectDescription; ViewData["Summary"] = mDOpenProject.Summary; ViewData["OID"] = mDOpenProject.OID; //如果有参数 if (query.IsHaveProperty()) { parm = query.GetParameter(); ViewData["Query"] = query; return RedirectToAction("Detail", new { id = id, pageNo = 1, parm = parm }); } else { int PageNo = pageNo ?? 1; //表明第一次进来 if (query.CommonName != null) { query.LoadProperties(parm); } if (string.IsNullOrEmpty(query.CommonName) && string.IsNullOrEmpty(query.ProductEnterpriseName) && string.IsNullOrEmpty(query.TenderEnterpriseName) && query.CommonName.Length < 3) { pageNo = 1; } else { query.IsSearched = "1"; } //页码与记录数 int count = 0; //是否竞品条件 bool compete = false; //取数据与记录数 List<string> th = new List<string>(); SingleMedicineDao m = new SingleMedicineDao(); DataTable data = m.GetData(id, PageNo, PageSizeDetail, query, out count, ref compete, ref th); #region 数据处理 if (data == null) { data = new DataTable(); } if (!data.Columns.Contains("ID")) { DataColumn dc = new DataColumn(); dc.ColumnName = "ID"; data.Columns.Add(dc); } int beginNo = 0; if (!compete) { beginNo = (PageNo - 1) * PageSizeDetail; } for (int i = 1; i <= data.Rows.Count; i++) { data.Rows[i - 1]["ID"] = (beginNo + i).ToString(); } if (data.Columns.Contains("ROWID")) { data.Columns.Remove("ROWID"); } if (data.Columns.Contains("OID")) { data.Columns.Remove("OID"); } List<DataRow> listRow = new List<DataRow>(); foreach (DataRow dr in data.Rows) { listRow.Add(dr); } foreach (DataRow dr in listRow) { if (dr.Table.Columns.Contains("FirstToLimit")) { string strFirstToLimit = dr["FirstToLimit"].ToString(); if (strFirstToLimit.Length > 0) { string subFirstToLimit = strFirstToLimit.Substring(0, strFirstToLimit.Length - 1); decimal fFirstToLimit = decimal.Parse(subFirstToLimit); string resultFirstToLimit = Math.Round(fFirstToLimit, 2).ToString() + "%"; dr["FirstToLimit"] = resultFirstToLimit; } } if (dr.Table.Columns.Contains("SecondToLimit")) { string strSecondToLimit = dr["SecondToLimit"].ToString(); if (strSecondToLimit.Length > 0) { string subSecondToLimit = strSecondToLimit.Substring(0, strSecondToLimit.Length - 1); decimal fSecondToLimit = decimal.Parse(subSecondToLimit); string resultSecondToLimit = Math.Round(fSecondToLimit, 2).ToString() + "%"; dr["SecondToLimit"] = resultSecondToLimit; } } if (dr.Table.Columns.Contains("SSecondToFirst")) { string strSSecondToFirst = dr["SSecondToFirst"].ToString(); if (strSSecondToFirst.Length > 0) { string subSSecondToFirst = strSSecondToFirst.Substring(0, strSSecondToFirst.Length - 1); decimal fSSecondToFirst = decimal.Parse(subSSecondToFirst); string resultSSecondToFirst = Math.Round(fSSecondToFirst, 2).ToString() + "%"; dr["SSecondToFirst"] = resultSSecondToFirst; } } if (dr.Table.Columns.Contains("SBidToFinal")) { string strSBidToFinal = dr["SBidToFinal"].ToString(); if (strSBidToFinal.Length > 0) { string subSBidToFinal = strSBidToFinal.Substring(0, strSBidToFinal.Length - 1); decimal fSBidToFinal = decimal.Parse(subSBidToFinal); string resultSBidToFinal = Math.Round(fSBidToFinal, 2).ToString() + "%"; dr["SBidToFinal"] = resultSBidToFinal; } } if (dr.Table.Columns.Contains("SBidToLimit")) { string strSBidToLimit = dr["SBidToLimit"].ToString(); if (strSBidToLimit.Length > 0) { string subSBidToLimit = strSBidToLimit.Substring(0, strSBidToLimit.Length - 1); decimal fSBidToLimit = decimal.Parse(subSBidToLimit); string resultSBidToLimit = Math.Round(fSBidToLimit, 2).ToString() + "%"; dr["SBidToLimit"] = resultSBidToLimit; } } if (dr.Table.Columns.Contains("STBidToTender")) { string strSTBidToTender = dr["STBidToTender"].ToString(); if (strSTBidToTender.Length > 0) { string subSTBidToTender = strSTBidToTender.Substring(0, strSTBidToTender.Length - 1); decimal fSBidToTender = decimal.Parse(subSTBidToTender); string resultSfSBidToTender = Math.Round(fSBidToTender, 2).ToString() + "%"; dr["STBidToTender"] = resultSfSBidToTender; } } } PagedList<DataRow> list; if (compete) { list = new PagedList<DataRow>(listRow, PageNo, PageSizeDetail); } else { list = new PagedList<DataRow>(listRow, PageNo, PageSizeDetail, count); } ViewData["Compete"] = compete; ViewData["Query"] = query; ViewData["Count"] = count; ViewData["Th"] = th; #endregion #region excel if (sitemaster["istest"]=="0" && query.Excel == "1") { ExcelExport mx = new ExcelExport(); mx.InitTh(); mx._fileName = "Emed-KB-" + DateTime.Now.ToShortDateString() + ".xls"; //项目名称 TableItemStyle tiName = new TableItemStyle(); tiName.Font.Size = 14; tiName.ForeColor = System.Drawing.Color.Red; tiName.HorizontalAlign = HorizontalAlign.Center; mx.HeadExtrInfo.Add(mDOpenProject.NewProjectName, tiName); //项目备注 TableItemStyle tiRemark = new TableItemStyle(); tiRemark.Font.Size = 13; tiRemark.ForeColor = System.Drawing.Color.Red; tiRemark.HorizontalAlign = HorizontalAlign.Left; mx.HeadExtrInfo.Add("项目备注说明:", tiRemark); //项目备注 TableItemStyle tiRemarkContent = new TableItemStyle(); tiRemarkContent.Font.Size = 12; tiRemarkContent.HorizontalAlign = HorizontalAlign.Left; mx.HeadExtrInfo.Add(mDOpenProject.NewProjectDescription, tiRemarkContent); TableItemStyle tiCount = new TableItemStyle(); tiCount.Font.Size = 12; tiCount.HorizontalAlign = HorizontalAlign.Left; mx.HeadExtrInfo.Add("共有" + count.ToString() + "条", tiCount); if (data.Columns.Contains("ID")) { data.Columns.Remove("ID"); } mx.DataTableToExcel(data); } #endregion return View(list); } }
/// <summary> /// Generates Excel document using supplied headers and using supplied styles /// </summary> public ActionResult GenerateExcel3() { var rows = from m in db.tb_bit_usuario select new { nom_user_name = m.nom_user_name, nom_usuario = m.nom_usuario }; var headerStyle = new TableItemStyle(); headerStyle.BackColor = System.Drawing.Color.Orange; return new ExcelResult(db, rows, "data.xls", new[] { "nom_user_name", "nom_usuario" }, null, headerStyle, null); }
private void @__BuildControl__control19(System.Web.UI.WebControls.TableItemStyle @__ctrl) { @__ctrl.Wrap = false; }
protected static HtmlTableCell ComposeCell(TableItemStyle cellstyle, int width, params Control[] controls) { HtmlTableCell cell = null; // Some controls are already HtmlTableCell, in which case they should not be encapsulated. if (controls.Length == 1) { cell = controls[0] as HtmlTableCell; } // If the above is not the case, initialise the HtmlTableCell and add the controls. if (cell == null) { cell = new HtmlTableCell(); foreach (Control control in controls) { cell.Controls.Add(control); } } if (cellstyle != null) cell.Attributes["class"] = cellstyle.CssClass; cell.Width = width + "%"; return cell; }
/// <summary> /// Create html table row /// </summary> /// <param name="cellstyle"><see cref="TableItemStyle"/></param> /// <param name="cellwidth">Cell width.</param> /// <param name="controls">Variable parameters.</param> /// <returns><see cref="HtmlTableRow"/></returns> protected HtmlTableRow ComposeRow(TableItemStyle cellstyle, int cellwidth, params Control[] controls) { HtmlTableRow row = new HtmlTableRow(); HtmlTableCell cell = ComposeCell(cellstyle, cellwidth, controls); row.Attributes["class"] = RowStyle.CssClass; row.Controls.Add(cell); return row; }
private void @__BuildControl__control2(System.Web.UI.WebControls.TableItemStyle @__ctrl) { @__ctrl.Height = new System.Web.UI.WebControls.Unit(40D, global::System.Web.UI.WebControls.UnitType.Pixel); }
private void @__BuildControl__control31(System.Web.UI.WebControls.TableItemStyle @__ctrl) { @__ctrl.ForeColor = global::System.Drawing.Color.Black; @__ctrl.BackColor = ((System.Drawing.Color)(global::System.Drawing.Color.FromArgb(222, 223, 222))); }
void WriteDay (DateTime date, HtmlTextWriter writer) { TableItemStyle style = new TableItemStyle (); TableCell cell = new TableCell (); CalendarDay day = new CalendarDay (date, IsWeekEnd (date.DayOfWeek), date == TodaysDate, SelectedDates.Contains (date), GetGlobalCalendar ().GetMonth (DisplayDate) != GetGlobalCalendar ().GetMonth (date), date.Day.ToString ()); day.IsSelectable = SelectionMode != CalendarSelectionMode.None; cell.HorizontalAlign = HorizontalAlign.Center; cell.Width = Unit.Percentage (GetCellWidth ()); LiteralControl lit = new LiteralControl (day.DayNumberText); cell.Controls.Add (lit); OnDayRender (cell, day); if (dayStyle != null && !dayStyle.IsEmpty) { style.CopyFrom (dayStyle); } if (day.IsWeekend && weekendDayStyle != null && !weekendDayStyle.IsEmpty) { style.CopyFrom (weekendDayStyle); } if (day.IsToday && todayDayStyle != null && !todayDayStyle.IsEmpty) { style.CopyFrom (todayDayStyle); } if (day.IsOtherMonth && otherMonthDayStyle != null && !otherMonthDayStyle.IsEmpty) { style.CopyFrom (otherMonthDayStyle); } if (day.IsSelected && Enabled) { style.BackColor = Color.Silver; style.ForeColor = Color.White; if (selectedDayStyle != null && !selectedDayStyle.IsEmpty) { style.CopyFrom (selectedDayStyle); } } cell.ApplyStyle (style); lit.Text = BuildLink (GetDaysFromZenith (date).ToString (), day.DayNumberText, cell.ForeColor, day.IsSelectable && Enabled); cell.RenderControl (writer); }
private void @__BuildControl__control2(System.Web.UI.WebControls.TableItemStyle @__ctrl) { @__ctrl.BackColor = ((System.Drawing.Color)(global::System.Drawing.Color.FromArgb(247, 247, 247))); }
protected internal override void PrepareControlHierarchy() { ControlCollection controls = this.Controls; int count = controls.Count; if (count != 0) { Style s = null; if (this.alternatingItemStyle != null) { s = new TableItemStyle(); s.CopyFrom(this.itemStyle); s.CopyFrom(this.alternatingItemStyle); } else { s = this.itemStyle; } for (int i = 0; i < count; i++) { DataListItem item = (DataListItem)controls[i]; Style headerStyle = null; switch (item.ItemType) { case ListItemType.Header: if (this.ShowHeader) { headerStyle = this.headerStyle; } goto Label_015B; case ListItemType.Footer: if (this.ShowFooter) { headerStyle = this.footerStyle; } goto Label_015B; case ListItemType.Item: headerStyle = this.itemStyle; goto Label_015B; case ListItemType.AlternatingItem: headerStyle = s; goto Label_015B; case ListItemType.SelectedItem: headerStyle = new TableItemStyle(); if ((item.ItemIndex % 2) == 0) { break; } headerStyle.CopyFrom(s); goto Label_0100; case ListItemType.EditItem: headerStyle = new TableItemStyle(); if ((item.ItemIndex % 2) == 0) { goto Label_0128; } headerStyle.CopyFrom(s); goto Label_0134; case ListItemType.Separator: headerStyle = this.separatorStyle; goto Label_015B; default: goto Label_015B; } headerStyle.CopyFrom(this.itemStyle); Label_0100: headerStyle.CopyFrom(this.selectedItemStyle); goto Label_015B; Label_0128: headerStyle.CopyFrom(this.itemStyle); Label_0134: if (item.ItemIndex == this.SelectedIndex) { headerStyle.CopyFrom(this.selectedItemStyle); } headerStyle.CopyFrom(this.editItemStyle); Label_015B: if (headerStyle != null) { if (!this.extractTemplateRows) { item.MergeStyle(headerStyle); } else { IEnumerator enumerator = item.Controls.GetEnumerator(); while (enumerator.MoveNext()) { Control current = (Control)enumerator.Current; if (current is Table) { IEnumerator enumerator2 = ((Table)current).Rows.GetEnumerator(); while (enumerator2.MoveNext()) { ((TableRow)enumerator2.Current).MergeStyle(headerStyle); } break; } } } } } } }
private void @__BuildControl__control6(System.Web.UI.WebControls.TableItemStyle @__ctrl) { @__ctrl.BackColor = ((System.Drawing.Color)(global::System.Drawing.Color.FromArgb(231, 231, 255))); @__ctrl.ForeColor = ((System.Drawing.Color)(global::System.Drawing.Color.FromArgb(74, 60, 140))); }
public void FormView_AssignToDefaultProperties () { Poker p = new Poker (); MyTemplate customTemplate = new MyTemplate (); TableItemStyle tableStyle = new TableItemStyle (); p.AllowPaging = true; Assert.AreEqual (true, p.AllowPaging, "A40"); p.BackImageUrl = "image.jpg"; Assert.AreEqual ("image.jpg", p.BackImageUrl, "A41"); // ToDo: p.BottomPagerRow p.Caption = "Employee Details"; Assert.AreEqual ("Employee Details", p.Caption, "A42"); p.CaptionAlign = TableCaptionAlign.Bottom; Assert.AreEqual (TableCaptionAlign.Bottom, p.CaptionAlign, "A43"); p.CaptionAlign = TableCaptionAlign.Left; Assert.AreEqual (TableCaptionAlign.Left, p.CaptionAlign, "A44"); p.CaptionAlign = TableCaptionAlign.NotSet; Assert.AreEqual (TableCaptionAlign.NotSet, p.CaptionAlign, "A45"); p.CaptionAlign = TableCaptionAlign.Right; Assert.AreEqual (TableCaptionAlign.Right, p.CaptionAlign, "A46"); p.CaptionAlign = TableCaptionAlign.Top; Assert.AreEqual (TableCaptionAlign.Top, p.CaptionAlign, "A47"); p.CellPadding = 10; Assert.AreEqual (10, p.CellPadding, "A48"); p.CellSpacing = 20; Assert.AreEqual (20, p.CellSpacing, "A49"); Assert.AreEqual (FormViewMode.ReadOnly, p.CurrentMode, "A52"); p.DefaultMode = FormViewMode.Edit; Assert.AreEqual (FormViewMode.Edit, p.DefaultMode, "A53"); p.DefaultMode = FormViewMode.Insert; Assert.AreEqual (FormViewMode.Insert, p.DefaultMode, "A54"); p.DefaultMode = FormViewMode.ReadOnly; Assert.AreEqual (FormViewMode.ReadOnly, p.DefaultMode, "A55"); p.EditRowStyle.BackColor = Color.Red; Assert.AreEqual (Color.Red, p.EditRowStyle.BackColor, "A56"); p.EmptyDataRowStyle.ForeColor = Color.Purple; Assert.AreEqual (Color.Purple, p.EmptyDataRowStyle.ForeColor, "A57"); p.EmptyDataTemplate = customTemplate; Assert.AreEqual (customTemplate, p.EmptyDataTemplate, "A58"); p.EmptyDataText = "No data"; Assert.AreEqual ("No data", p.EmptyDataText, "A59"); p.EditItemTemplate = customTemplate; Assert.AreEqual (customTemplate, p.EditItemTemplate, "A60"); p.FooterTemplate = customTemplate; Assert.AreEqual (customTemplate, p.FooterTemplate, "A61"); p.FooterText = "Test Footer"; Assert.AreEqual ("Test Footer", p.FooterText, "A62"); p.FooterStyle.BorderStyle = BorderStyle.Double; Assert.AreEqual (BorderStyle.Double, p.FooterStyle.BorderStyle, "A63"); p.GridLines = GridLines.Both; Assert.AreEqual (GridLines.Both, p.GridLines, "A64"); p.GridLines = GridLines.Horizontal; Assert.AreEqual (GridLines.Horizontal, p.GridLines, "A65"); p.GridLines = GridLines.None; Assert.AreEqual (GridLines.None, p.GridLines, "A66"); p.GridLines = GridLines.Vertical; Assert.AreEqual (GridLines.Vertical, p.GridLines, "A67"); p.HeaderStyle.HorizontalAlign = HorizontalAlign.Left; Assert.AreEqual (HorizontalAlign.Left, p.HeaderStyle.HorizontalAlign, "A68"); p.HeaderTemplate = customTemplate; Assert.AreEqual (customTemplate, p.HeaderTemplate, "A69"); p.HeaderText = "Test Header"; Assert.AreEqual ("Test Header", p.HeaderText, "A70"); p.HorizontalAlign = HorizontalAlign.Center; Assert.AreEqual (HorizontalAlign.Center, p.HorizontalAlign, "A71"); p.HorizontalAlign = HorizontalAlign.Justify; Assert.AreEqual (HorizontalAlign.Justify, p.HorizontalAlign, "A72"); p.HorizontalAlign = HorizontalAlign.Left; Assert.AreEqual (HorizontalAlign.Left, p.HorizontalAlign, "A73"); p.HorizontalAlign = HorizontalAlign.NotSet; Assert.AreEqual (HorizontalAlign.NotSet, p.HorizontalAlign, "A74"); p.HorizontalAlign = HorizontalAlign.Right; Assert.AreEqual (HorizontalAlign.Right, p.HorizontalAlign, "A75"); p.InsertItemTemplate = customTemplate; Assert.AreEqual (customTemplate, p.InsertItemTemplate, "A76"); p.InsertRowStyle.BorderStyle = BorderStyle.Outset; Assert.AreEqual (BorderStyle.Outset, p.InsertRowStyle.BorderStyle, "A77"); p.ItemTemplate = customTemplate; Assert.AreEqual (customTemplate, p.ItemTemplate, "A78"); p.PagerSettings.FirstPageText = "PagerSettings Test"; Assert.AreEqual ("PagerSettings Test", p.PagerSettings.FirstPageText, "A79"); p.PagerStyle.BorderStyle = BorderStyle.Groove; Assert.AreEqual (BorderStyle.Groove, p.PagerStyle.BorderStyle, "A80"); p.PagerTemplate = customTemplate; Assert.AreEqual (customTemplate, p.PagerTemplate, "A81"); p.RowStyle.ForeColor = Color.Plum; Assert.AreEqual (Color.Plum, p.RowStyle.ForeColor, "A82"); }
protected override void PrepareControlHierarchy() { if (!HasControls() || Controls.Count == 0) { return; // No one called CreateControlHierarchy() with DataSource != null } Style alt = null; foreach (DataListItem item in Controls) { switch (item.ItemType) { case ListItemType.Item: item.MergeStyle(itemStyle); break; case ListItemType.AlternatingItem: if (alt == null) { if (alternatingItemStyle != null) { alt = new TableItemStyle(); alt.CopyFrom(itemStyle); alt.CopyFrom(alternatingItemStyle); } else { alt = itemStyle; } } item.MergeStyle(alt); break; case ListItemType.EditItem: if (editItemStyle != null) { item.MergeStyle(editItemStyle); } else { item.MergeStyle(itemStyle); } break; case ListItemType.Footer: if (!ShowFooter) { item.Visible = false; break; } if (footerStyle != null) { item.MergeStyle(footerStyle); } break; case ListItemType.Header: if (!ShowHeader) { item.Visible = false; break; } if (headerStyle != null) { item.MergeStyle(headerStyle); } break; case ListItemType.SelectedItem: if (selectedItemStyle != null) { item.MergeStyle(selectedItemStyle); } else { item.MergeStyle(itemStyle); } break; case ListItemType.Separator: if (separatorStyle != null) { item.MergeStyle(separatorStyle); } else { item.MergeStyle(itemStyle); } break; } } }
protected override void PrepareControlHierarchy () { if (!HasControls () || Controls.Count == 0) return; // No one called CreateControlHierarchy() with DataSource != null Style alt = null; foreach (DataListItem item in Controls) { switch (item.ItemType) { case ListItemType.Item: item.MergeStyle (itemStyle); break; case ListItemType.AlternatingItem: if (alt == null) { if (alternatingItemStyle != null) { alt = new TableItemStyle (); alt.CopyFrom (itemStyle); alt.CopyFrom (alternatingItemStyle); } else alt = itemStyle; } item.MergeStyle (alt); break; case ListItemType.EditItem: if (editItemStyle != null) item.MergeStyle (editItemStyle); else item.MergeStyle (itemStyle); break; case ListItemType.Footer: if (!ShowFooter) { item.Visible = false; break; } if (footerStyle != null) item.MergeStyle (footerStyle); break; case ListItemType.Header: if (!ShowHeader) { item.Visible = false; break; } if (headerStyle != null) item.MergeStyle (headerStyle); break; case ListItemType.SelectedItem: if (selectedItemStyle != null) item.MergeStyle (selectedItemStyle); else item.MergeStyle (itemStyle); break; case ListItemType.Separator: if (separatorStyle != null) item.MergeStyle(separatorStyle); else item.MergeStyle (itemStyle); break; } } }
/// <summary> /// Prepares our composite controls for rendering by setting /// last-minute (ie: non-viewstate tracked) properties. /// </summary> protected virtual void PrepareControlHierarchy() { if (Controls.Count > 0) { // Setup base table control style Table table = (Table)Controls[0]; table.CopyBaseAttributes(this); if (ControlStyleCreated && !ControlStyle.IsEmpty) { table.ApplyStyle(ControlStyle); } else { table.GridLines = GridLines.None; table.CellPadding = 10; table.CellSpacing = 0; } // Setup label controls. TableRow labelRowTop = (TableRow)FindControl("labelRowTop"); TableRow labelRowBottom = (TableRow)FindControl("labelRowBottom"); labelRowTop.Visible = false; labelRowBottom.Visible = false; if (ShowLabel) { // Setup label row style TableItemStyle style = new TableItemStyle(); style.CopyFrom(LabelRowStyle); style.HorizontalAlign = LabelHorizontalAlign; // Setup appropriate row if (LabelVerticalAlign == VerticalAlign.Top) { labelRowTop.MergeStyle(style); labelRowTop.Visible = true; TableCell labelCell = (TableCell)FindControl("labelCellTop"); labelCell.Text = Text; } else { labelRowBottom.MergeStyle(style); labelRowBottom.Visible = true; TableCell labelCell = (TableCell)FindControl("labelCellBottom"); labelCell.Text = Text; } } // Setup barcode row style TableRow barcodeRow = (TableRow)FindControl("barcodeRow"); barcodeRow.MergeStyle(BarcodeRowStyle); // Setup barcode image url BarcodeImageUriBuilder builder = new BarcodeImageUriBuilder(); builder.Text = Text; builder.Scale = Scale; builder.EncodingScheme = BarcodeEncoding; builder.BarMinHeight = BarMinHeight; builder.BarMaxHeight = BarMaxHeight; builder.BarMinWidth = BarMinWidth; builder.BarMaxWidth = BarMaxWidth; Image barcodeImage = (Image)FindControl("barcodeImage"); barcodeImage.ImageUrl = builder.ToString(); } }
private void Page_Load(object sender, System.EventArgs e) { //Put user code to initialize the page here System.Web.UI.HtmlControls.HtmlForm frm = (HtmlForm)this.FindControl("Form1"); GHTTestBegin(frm); GHTActiveSubTest = GHTSubTest1; try { DataGrid1.DataSource = GHTTests.GHDataSources.DSDataTable(0, 1, "", false); DataGrid1.ShowFooter = true; DataGrid1.DataBind();; } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTActiveSubTest = GHTSubTest2; try { DataGrid2.DataSource = GHTTests.GHDataSources.DSDataTable(0, 1, "", false); DataGrid2.ShowFooter = true; DataGrid2.DataBind();; } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTActiveSubTest = GHTSubTest3; try { DataGrid3.DataSource = GHTTests.GHDataSources.DSDataTable(0, 1, "", false); DataGrid3.ShowFooter = true; DataGrid3.DataBind();; } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTSubTestBegin("GHTSubTest4"); try { System.Web.UI.WebControls.DataGrid dg = new System.Web.UI.WebControls.DataGrid(); GHTActiveSubTest.Controls.Add(dg); TableItemStyle tis = new TableItemStyle(); dg.FooterStyle.HorizontalAlign = HorizontalAlign.Right; dg.ShowFooter = true; dg.DataSource = GHTTests.GHDataSources.DSDataTable(0, 1, "", false); dg.DataBind();; } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTSubTestEnd(); GHTSubTestBegin("GHTSubTest5"); try { System.Web.UI.WebControls.DataGrid dg = new System.Web.UI.WebControls.DataGrid(); GHTActiveSubTest.Controls.Add(dg); TableItemStyle tis = new TableItemStyle(); dg.FooterStyle.HorizontalAlign = HorizontalAlign.Right; dg.FooterStyle.VerticalAlign = VerticalAlign.Top; dg.FooterStyle.Wrap = false; dg.ShowFooter = true; dg.DataSource = GHTTests.GHDataSources.DSDataTable(0, 1, "", false); dg.DataBind();; } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTSubTestEnd(); GHTTestEnd(); }
public ActionResult Detail(int id, int? pageNo, string parm, OpenBidProjectQuery query) { Dictionary<string, string> sitemaster = GetSiteMaster(); ViewData["SiteMaster"] = sitemaster; if (sitemaster["istest"] == "1") { int uid = Int32.Parse(sitemaster["userid"]); IList<int> openprojectlist = CRMMapper.Get().QueryForList<int>("OpenBidNumForTest.myselectopen", uid); //先检查一共看的数目 if (openprojectlist.Count > 0) { //如果有看得记录,先检查是否是看过的 Hashtable htt = new Hashtable(); htt["pid"] = id; htt["uid"] = uid; IList<int> sawid = CRMMapper.Get().QueryForList<int>("OpenBidNumForTest.myselectopenpid", htt); //如果没看过,就检查是否超过最大值 if (sawid.Count == 0) { if (openprojectlist.Count < 5) { //没超过就写入记录 OpenBidNumForTest ob = new OpenBidNumForTest(); ob.OpenprojectNum = id; ob.UserID = uid; new OpenBidNumForTestDao().Insert(ob); } else { //超过了 return RedirectToAction("List"); } } } else { //之前没有看过也写入记录 OpenBidNumForTest ob = new OpenBidNumForTest(); ob.OpenprojectNum = id; ob.UserID = uid; new OpenBidNumForTestDao().Insert(ob); } } DOpenProjectDao mDOpenProjectDao = new DOpenProjectDao(); DOpenProject mDOpenProject = mDOpenProjectDao.Find(id); int interval = 0; if (EnterPriseMemberInfo.Memberlevel == 201) interval = 6; if (EnterPriseMemberInfo.Memberlevel == 301) interval = 12; DateTime limitedate = DateTime.Now.AddMonths(interval); if ((EnterPriseMemberInfo.Memberlevel == 201 || EnterPriseMemberInfo.Memberlevel == 301) && mDOpenProject.OpenDate > limitedate) { return RedirectToAction("MemberLevelError", "Base"); } ViewData["ProjectDescription"] = mDOpenProject.NewProjectDescription; ViewData["Summary"] = mDOpenProject.Summary; ViewData["OID"] = mDOpenProject.OID; //如果有参数 if (query.IsHaveProperty()) { parm = query.GetParameter(); ViewData["Query"] = query; return RedirectToAction("Detail", new { id = id, pageNo = 1, parm = parm }); } else { int PageNo = pageNo ?? 1; //表明第一次进来 if (query.CommonName != null) { query.LoadProperties(parm); } if (string.IsNullOrEmpty(query.CommonName) && string.IsNullOrEmpty(query.ProductEnterpriseName) && string.IsNullOrEmpty(query.TenderEnterpriseName) && query.CommonName.Length < 3) { pageNo = 1; } else { query.IsSearched = "1"; } //页码与记录数 int count = 0; //是否竞品条件 bool compete = false; //取数据与记录数 List<string> th = new List<string>(); DOpenMedicineDao m = new DOpenMedicineDao(); DataTable data = m.GetData(id, PageNo, PageSizeDetail, query, out count, ref compete,ref th); #region 数据处理 if (data == null) { data = new DataTable(); } if (!data.Columns.Contains("ID")) { DataColumn dc = new DataColumn(); dc.ColumnName = "ID"; data.Columns.Add(dc); } int beginNo = 0; if (!compete) { beginNo = (PageNo - 1) * PageSizeDetail; } for (int i = 1; i<= data.Rows.Count; i++) { data.Rows[i-1]["ID"] =(beginNo+ i).ToString(); } if (data.Columns.Contains("ROWID")) { data.Columns.Remove("ROWID"); } if (data.Columns.Contains("OID")) { data.Columns.Remove("OID"); } List<DataRow> listRow = new List<DataRow>(); foreach (DataRow dr in data.Rows) { listRow.Add(dr); } PagedList<DataRow> list; if (compete) { list = new PagedList<DataRow>(listRow, PageNo, PageSizeDetail); } else { list = new PagedList<DataRow>(listRow, PageNo, PageSizeDetail, count); } ViewData["Compete"] = compete; ViewData["Query"] = query; ViewData["Count"] = count; ViewData["Th"] = th; #endregion #region excel if (sitemaster["istest"] == "0" && query.Excel == "1") { ExcelExport mx = new ExcelExport(); mx.InitTh(); if (query.CommonName != null) mx._fileName = query.CommonName + DateTime.Now.ToShortDateString() + ".xls"; else { if (query.ProductEnterpriseName != null) mx._fileName = query.ProductEnterpriseName + DateTime.Now.ToShortDateString() + ".xls"; else mx._fileName = query.TenderEnterpriseName + DateTime.Now.ToShortDateString() + ".xls"; } //项目名称 TableItemStyle tiName = new TableItemStyle(); tiName.Font.Size = 14; tiName.ForeColor = System.Drawing.Color.Red; tiName.HorizontalAlign = HorizontalAlign.Center; mx.HeadExtrInfo.Add(mDOpenProject.NewProjectName, tiName); //项目备注 TableItemStyle tiRemark = new TableItemStyle(); tiRemark.Font.Size = 13; tiRemark.ForeColor = System.Drawing.Color.Red; tiRemark.HorizontalAlign = HorizontalAlign.Left; mx.HeadExtrInfo.Add("项目备注说明:", tiRemark); //项目备注 TableItemStyle tiRemarkContent = new TableItemStyle(); tiRemarkContent.Font.Size = 12; tiRemarkContent.HorizontalAlign = HorizontalAlign.Left; mx.HeadExtrInfo.Add(mDOpenProject.NewProjectDescription, tiRemarkContent); TableItemStyle tiCount = new TableItemStyle(); tiCount.Font.Size = 12; tiCount.HorizontalAlign = HorizontalAlign.Left; mx.HeadExtrInfo.Add("共有" + count.ToString() + "条", tiCount); if (data.Columns.Contains("ID")) { data.Columns.Remove("ID"); } //20111019修改按显示表头导出,去掉多余列 if (data.Columns.Contains("Mine")) { data.Columns.Remove("Mine"); } mx._thName = th.ToArray();//20111019修改按显示表头导出 mx.DataTableToExcel(data); } #endregion return View(list); } }
private void @__BuildControl__control2(System.Web.UI.WebControls.TableItemStyle @__ctrl) { @__ctrl.CssClass = "header"; }