/// <summary> /// 时间选择控件HTML /// </summary> /// <param name="name"></param> /// <param name="value"></param> /// <returns></returns> public static HtmlString DateTimeHTML(string name, BinDateTime value) { return(new HtmlString(string.Format("<input type=\"text\" class=\"datechoose\" name=\"{0}.DateTime\" value=\"{1}\" />", name, value))); }
/// <summary> /// 将一个Model转换为一个集合列表 /// </summary> /// <param name="model"></param> /// <returns></returns> public static Dictionary <string, string> ConvertOneModelToDictionary(T model, bool oracle = true) { Dictionary <string, string> dic = new Dictionary <string, string>(); Dictionary <string, object> dicobj = ConvertOneModelToDic(model); foreach (KeyValuePair <string, object> pair in dicobj) { object value = pair.Value; string memName = pair.Key; string valuestr = null; if (value != null) { if (value is DateTime) { DateTime dt = (DateTime)value; if (dt.IsValid()) { if (oracle) { valuestr = string.Format(",to_date('{0}','yyyy-mm-dd hh24:mi:ss')", dt.ToFormatDateTimeStr()); } else { valuestr = dt.ToFormatDateTimeStr(); } } } else if (value is bool) { bool b = (bool)value; valuestr = b ? "1" : "0"; } else if (value is BinDateTime) { BinDateTime binDateTime = value as BinDateTime; if (binDateTime != null && binDateTime.DateTime.IsValid()) { if (oracle) { valuestr = string.Format(",to_date('{0}','yyyy-mm-dd hh24:mi:ss')", binDateTime.DateTime.ToFormatDateTimeStr()); } else { valuestr = binDateTime.ToString(); } } } else if (value is BoundaryPoint) { BoundaryPoint bp = value as BoundaryPoint; dic.Add(memName.Replace("BP", "X"), bp.X); dic.Add(memName.Replace("BP", "Y"), bp.Y); memName = memName.Replace("BP", "Z"); valuestr = bp.Z; } else { valuestr = value.ToString(); if (valuestr == "undefined" || valuestr == "null") { valuestr = null; } } } dic.Add(memName, valuestr); } return(dic); }