using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Bowin.Web.Controls.Mvc { public class SystemClock : BaseControl { public bool? IsJump { get; set; } public SystemClock() { } public static SystemClock CreateControl(SystemClockOptions options, Dictionary attributes = null) { SystemClock systemClock = new SystemClock(); if (attributes != null) systemClock.Attributes = attributes; systemClock.CssClass = options.CssClass; systemClock.ID = options.ID; systemClock.IsJump = options.IsJump; return systemClock; } public override string Render() { StringBuilder sb = new StringBuilder(); sb.Append(" string.Format("{0}=\"{1}\"", x.Key, x.Value)))); sb.Append(" >"); sb.AppendFormat("{0} {1}", DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss"), System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(DateTime.Now.DayOfWeek) ); sb.Append(""); if (IsJump.HasValue && IsJump.Value) sb.Append(""); return sb.ToString(); } public Dictionary GetAttributesList() { Dictionary attributesList = new Dictionary(); if (!string.IsNullOrEmpty(this.CssClass)) attributesList.Add("class", this.CssClass); attributesList.Add("id", this.ID); return attributesList; } } }