Exemplo n.º 1
0
 /// <summary>
 /// 获取Url请求参数值
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="key"></param>
 /// <param name="defaultValue">错误或异常返回的默认值</param>
 /// <returns></returns>
 public static T GetRequestQuery <T>(string key, T defaultValue) where T : IConvertible
 {
     try
     {
         return(StringPlus.ConverTValue <T>(HttpContext.Current.Request.QueryString[key], defaultValue));
     }
     catch
     {
         return(defaultValue);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 返回当前系统日期的标准格式 yyyy-MM-dd
 /// </summary>
 public static string GetShortDate(object obj)
 {
     return(StringPlus.ConverTValue <DateTime>(obj, DateTime.Now, Convert.ToDateTime).ToString("yyyy-MM-dd"));
 }