BasePage - 复制.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Configuration;
  4. using System.Reflection;
  5. using System.Text;
  6. using System.Text.RegularExpressions;
  7. using System.Web;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using Utils;
  11. namespace SiteCore
  12. {
  13. public class BasePage:Page
  14. {
  15. public bool _checkRight = true;
  16. public bool _isLoadJs = true;
  17. public bool _addVisible = false;
  18. public int _selfAddVisible = 0;
  19. public bool _refreshVisible = true;
  20. public bool _selfCheckPermission = false;
  21. public bool _keyFilterVisible = false;
  22. public DateTime _filterDate;
  23. public string _searchFilter = "";
  24. public string _searchDate = "";
  25. public string gcTag = "";
  26. public SearchDateEnum _searchDateEnum = SearchDateEnum.Default;
  27. public List<string> _permissions = new List<string>();//权限
  28. public string PmTag = "";
  29. public string tag = "";
  30. public static string SiteVer = webConfig.SiteVer;
  31. public bool _isCheckLogin = true;
  32. private WebUser _currentUser;
  33. public static readonly string TmpFilePath = ConfigurationManager.AppSettings["TempPath"];
  34. public static readonly string AttachPath = ConfigurationManager.AppSettings["AttachPath"];
  35. //获取用户数据
  36. public WebUser CurrentUser
  37. {
  38. get
  39. {
  40. if (_currentUser == null)
  41. {
  42. _currentUser = WebUser.GetUser();
  43. }
  44. return _currentUser;
  45. }
  46. }
  47. public int UserID
  48. {
  49. get
  50. {
  51. if (Session["xyUserID"] == null) return 0;
  52. return Convert.ToInt32(Session["xyUserID"]);
  53. }
  54. }
  55. public StringBuilder _script = new StringBuilder();
  56. public void AppendScript(String str)
  57. {
  58. _script.Append(str);
  59. }
  60. /// <summary>
  61. /// 检测是否登录
  62. /// </summary>
  63. public bool CheckRights()
  64. {
  65. if (Session["xyUserID"] == null)
  66. {
  67. Session["xyUserID"] = "1";
  68. Session["xyUserName"] = "ljq";
  69. }
  70. if (!_isCheckLogin) return true;
  71. string sPath = CommonHelper.GetPrePath();
  72. if (Session["xyUserID"] == null)
  73. {
  74. Response.Write("<script type=\"text/javascript\">window.top.location='" + sPath + "/Login.aspx" + "';</script>");
  75. Response.End();
  76. return false;
  77. }
  78. return true;
  79. }
  80. /// <summary>
  81. /// 检测是否登录
  82. /// </summary>
  83. public bool CheckRightsWithBack()
  84. {
  85. if (!_isCheckLogin) return true;
  86. string sPath = CommonHelper.GetPrePath();
  87. string curUrl = HttpContext.Current.Request.RawUrl;
  88. if (CurrentUser == null)
  89. {
  90. Response.Write("<script type=\"text/javascript\">window.top.location='" + sPath + "login.html?pv=" + curUrl + "';</script>");
  91. Response.End();
  92. return false;
  93. }
  94. return true;
  95. }
  96. /// <summary>
  97. /// 检测是否登录
  98. /// </summary>
  99. public bool CheckMobileRights()
  100. {
  101. if (!_isCheckLogin) return true;
  102. string sPath = CommonHelper.GetPrePath();
  103. string curUrl = HttpContext.Current.Request.Url.AbsolutePath;
  104. if (CurrentUser == null)
  105. {
  106. Response.Write("<script type=\"text/javascript\">window.top.location='m/" + sPath + "login.html?lt=" + GetString("lt") + "';</script>");
  107. Response.End();
  108. return false;
  109. }
  110. return true;
  111. }
  112. public void conSuccess(string msg)
  113. {
  114. Response.Write("{\"res\":1,\"msg\":\"" + msg + "\"}");
  115. }
  116. public void conSuccess(string msg, string ext)
  117. {
  118. Response.Write("{\"res\":1,\"ext\":[" + ext + "],\"msg\":\"" + msg + "\"}");
  119. }
  120. public void conError(string msg)
  121. {
  122. Response.Write("{\"res\":0,\"msg\":\"" + msg + "\"}");
  123. }
  124. public void conGridJson(object total, string json)
  125. {
  126. Response.Write("{" + string.Format("\"res\":1,\"total\":{0},\"data\":{1}", total, json) + "}");
  127. }
  128. public string GetImgUrl(object img)
  129. {
  130. return CommonHelper.GetPrePath() + "d/" + img;
  131. }
  132. public DataStruct GetStruct(int pi,int ps)
  133. {
  134. DataStruct dStruct = new DataStruct();
  135. dStruct.CurrentPage = pi + 1;
  136. dStruct.PageSize = (ps == 0 ? 20 : ps);
  137. return dStruct;
  138. }
  139. /// <summary>
  140. /// 查询时次要过滤条件
  141. /// </summary>
  142. public string SecondWhere
  143. {
  144. get
  145. {
  146. if (ViewState["secondWhere"] == null)
  147. return "";
  148. else
  149. return ViewState["secondWhere"].ToString();
  150. }
  151. set
  152. {
  153. ViewState["secondWhere"] = value;
  154. }
  155. }
  156. public void SelItemSelected(DropDownList ddl,object value)
  157. {
  158. ddl.ClearSelection();
  159. ListItem item=ddl.Items.FindByValue(value.ToString());
  160. if(item!=null)item.Selected=true;
  161. }
  162. public void SelRadioItemSelected(RadioButtonList rbl, object value)
  163. {
  164. rbl.ClearSelection();
  165. ListItem item = rbl.Items.FindByValue(value.ToString());
  166. if (item != null) item.Selected = true;
  167. }
  168. //显示错误页面
  169. public void ShowErrorPage()
  170. {
  171. Response.Redirect(CommonHelper.GetPrePath() + "ErrorPage.htm", true);
  172. }
  173. public void ShowErrorHtml(string url)
  174. {
  175. Response.Write("你访问的页面错误啦!<a href='" + url + "'>点击这里返回</a>");
  176. Response.End();
  177. }
  178. public void ShowErrorHtml(string txt,string url)
  179. {
  180. Response.Write(txt+"!<a href='" + url + "'>点击这里返回</a>");
  181. Response.End();
  182. }
  183. public void ShowError(string txt)
  184. {
  185. Response.Clear();
  186. Response.Write(txt);
  187. Response.End();
  188. }
  189. public object GetReflectionObject(string className)
  190. {
  191. if (string.IsNullOrEmpty(className)) return null;
  192. string tmpName = "BizCom." + className;
  193. return Assembly.Load("BizCom").CreateInstance(tmpName);
  194. }
  195. #region 格式化显示方式
  196. /// <summary>
  197. /// 返回是否过期
  198. /// </summary>
  199. /// <param name="endTime"></param>
  200. /// <returns></returns>
  201. public static bool CheckIsExpire(object endTime)
  202. {
  203. return DateTime.Now.Subtract(Convert.ToDateTime(endTime)).Days > 0;
  204. }
  205. /// <summary>
  206. /// 布尔值显示文字
  207. /// </summary>
  208. /// <param name="result"></param>
  209. /// <param name="tStr"></param>
  210. /// <param name="fStr"></param>
  211. /// <returns></returns>
  212. public string GetBoolenString(object result, string tStr, string fStr)
  213. {
  214. if (result.Equals(DBNull.Value)) return "";
  215. return Convert.ToBoolean(result) ? tStr : fStr;
  216. }
  217. /// <summary>
  218. /// 图片显示
  219. /// </summary>
  220. /// <param name="imgUrl"></param>
  221. /// <returns></returns>
  222. public string GetImgString(object imgUrl)
  223. {
  224. return GetImgString(imgUrl, "");
  225. }
  226. public string GetImgString(object imgUrl, string noPic)
  227. {
  228. string str = "<img alt='' class=\"g_img\" align=\"absmiddle\" src=\"{0}\" />";
  229. string img = noPic == "" ? "images/noImg.gif" : "images/" + noPic;
  230. if (imgUrl.ToString() != "") img = imgUrl.ToString().Replace("images/", "images/i2/");
  231. return string.Format(str, "../../" + img);
  232. }
  233. public string GetCouponImageString(object imgUrl,object type)
  234. {
  235. string str = "<img alt='' class=\"g_img\" align=\"absmiddle\" src=\"{0}\" />";
  236. string img = "images/nocImg.gif";
  237. if (type.ToString() == "1") img = "images/noeImg.gif";
  238. if (imgUrl.ToString() != "") img = "Documents/" + imgUrl;
  239. return string.Format(str, "../../" + img);
  240. }
  241. public string GetMerchantImgString(object imgUrl, string noPic)
  242. {
  243. string str = "<img alt='' class=\"g_img\" align=\"absmiddle\" src=\"{0}\" />";
  244. string img = noPic == "" ? "images/noImg.gif" : "images/" + noPic;
  245. if (imgUrl.ToString() != "") img = "Documents/" + imgUrl;
  246. return string.Format(str, "../../" + img);
  247. }
  248. public string GetSiteImgString(object imgUrl, object title)
  249. {
  250. string str = "<img alt=\"{1}\" title\"{1}\" class=\"g_img\" align=\"absmiddle\" src=\"{0}\" />";
  251. string img = "";
  252. if (imgUrl.ToString() != "") img = "Documents/" + imgUrl;
  253. return string.Format(str, "../../" + img,CommonHelper.FormatForXML(title));
  254. }
  255. public string GetCurrentImgString(object imgUrl, string noPic)
  256. {
  257. string img = noPic == "" ? "images/noImg.gif" : "images/" + noPic;
  258. if (imgUrl.ToString() != "") img = "Documents/" + imgUrl;
  259. return img;
  260. }
  261. /// <summary>
  262. /// 格式化日期
  263. /// </summary>
  264. /// <param name="date"></param>
  265. /// <returns></returns>
  266. public string GetFormatDate(object date)
  267. {
  268. return GetFormatDate(date, "无");
  269. }
  270. public string GetFormatDate(object date, string def)
  271. {
  272. if (date == null) return def;
  273. return date.ToString() == "" ? def : Convert.ToDateTime(date).ToString("yyyy-MM-dd");
  274. }
  275. /// <summary>
  276. /// 过期日期
  277. /// </summary>
  278. /// <param name="sDate"></param>
  279. /// <param name="eDate"></param>
  280. /// <returns></returns>
  281. public string GetFormatExpireDate(object sDate, object eDate)
  282. {
  283. return GetFormatExpireDate(sDate, eDate, "无");
  284. }
  285. public string GetFormatExpireDate(object sDate, object eDate, string defaultTxt)
  286. {
  287. if (sDate.ToString() == "" && eDate.ToString() == "")
  288. {
  289. return defaultTxt;
  290. }
  291. return "<span style=\"color:green\">" + GetFormatDate(sDate) + "<span> 至 <span style=\"color:blue\">" + GetFormatDate(eDate) + "</span>";
  292. }
  293. public string GetFormatapkDate(object sDate, object eDate, string defaultTxt)
  294. {
  295. if (sDate.ToString() == "" && eDate.ToString() == "")
  296. {
  297. return defaultTxt;
  298. }
  299. return "" + GetFormatDate(sDate) + "至" + GetFormatDate(eDate) + "";
  300. }
  301. /// <summary>
  302. /// 格式日期带时间
  303. /// </summary>
  304. /// <param name="date"></param>
  305. /// <returns></returns>
  306. public string GetFormatDateTime(object date)
  307. {
  308. if (date==null || date.Equals(DBNull.Value)) return "";
  309. return date.ToString() == "" ? "" : Convert.ToDateTime(date).ToString("yyyy-MM-dd HH:mm");
  310. }
  311. public string GetCurrentDateTime(object date)
  312. {
  313. if (date.Equals(DBNull.Value) || date.ToString() == "") return "";
  314. DateTime dt1 = DateTime.Now;
  315. DateTime dt2 = Convert.ToDateTime(date);
  316. TimeSpan span = dt1.Subtract(dt2);
  317. if (span.TotalDays > 5)
  318. {
  319. return dt2.ToString("yyyy-MM-dd HH:mm");
  320. }/*
  321. else if (span.TotalDays > 30)
  322. {
  323. return "1个月前";
  324. }
  325. else if (span.TotalDays > 14)
  326. {
  327. return "2周前";
  328. }
  329. else if (span.TotalDays > 7)
  330. {
  331. return "1周前";
  332. }*/
  333. else if (span.TotalDays > 1)
  334. {
  335. return string.Format("{0}天前", (int)Math.Floor(span.TotalDays));
  336. }
  337. else if (span.TotalHours > 1)
  338. {
  339. return string.Format("{0}小时前", (int)Math.Floor(span.TotalHours));
  340. }
  341. else if (span.TotalMinutes > 1)
  342. {
  343. return string.Format("{0}分钟前", (int)Math.Floor(span.TotalMinutes));
  344. }
  345. else if (span.TotalSeconds >= 1)
  346. {
  347. return string.Format("{0}秒前", (int)Math.Floor(span.TotalSeconds));
  348. }
  349. else
  350. {
  351. return "刚刚";
  352. }
  353. }
  354. /// <summary>
  355. /// 格式化时间
  356. /// </summary>
  357. /// <param name="sTime"></param>
  358. /// <param name="eTime"></param>
  359. /// <returns></returns>
  360. public string GetFormatTime(object sTime, object eTime)
  361. {
  362. string tmp = sTime.ToString();
  363. string firstTime = "", endTime = "";
  364. if (tmp == "" || tmp == "-1") return "全天";
  365. if (tmp == "0") firstTime = "00:00";
  366. else if (tmp == "30") firstTime = "00:30";
  367. else firstTime = tmp.Substring(0, tmp.Length - 2).PadLeft(2, '0') + ":" + tmp.Substring(tmp.Length - 2);
  368. tmp = eTime.ToString();
  369. if (tmp == "0") endTime = "00:00";
  370. else if (tmp == "30") endTime = "00:30";
  371. else endTime = tmp.Substring(0, tmp.Length - 2).PadLeft(2, '0') + ":" + tmp.Substring(tmp.Length - 2);
  372. return firstTime + " ~ " + endTime;
  373. }
  374. /// <summary>
  375. /// 获取精度数据
  376. /// </summary>
  377. /// <param name="value"></param>
  378. /// <returns></returns>
  379. public string GetDoubleString(object value)
  380. {
  381. if (string.IsNullOrEmpty(value.ToString())) return "";
  382. string db= Convert.ToDouble(value).ToString("F2");
  383. return db.Replace(".00", "");
  384. }
  385. public string GetDoubleString(object value,int num)
  386. {
  387. if (string.IsNullOrEmpty(value.ToString())) return "";
  388. return Convert.ToDouble(value).ToString("N"+num);
  389. }
  390. public string GetDoubleString(object value, string txt)
  391. {
  392. if (Convert.ToDouble(value) < 1) return txt;
  393. else return GetDoubleString(value);
  394. }
  395. //获取还剩几天
  396. public string GetDayByDate(object date)
  397. {
  398. DateTime curDt = DateTime.Now;
  399. if (date.ToString() == "") return "己过期";
  400. DateTime exDt = Convert.ToDateTime(date);
  401. TimeSpan tdays = exDt - curDt;
  402. if (tdays.Days < 0) return "己过期";
  403. else if (tdays.Days == 0) return "今天";
  404. return tdays.Days + "天";
  405. }
  406. /// <summary>
  407. /// 获取带有空值的字符串
  408. /// </summary>
  409. /// <param name="result">data</param>
  410. /// <param name="nullStr">为空时显示的内容</param>
  411. /// <returns></returns>
  412. public string GetWithEmptyString(object result, string nullStr)
  413. {
  414. if (result == null) return nullStr;
  415. return result.ToString().Length > 0 ? result.ToString() : nullStr;
  416. }
  417. /// <summary>
  418. /// 获取两个数字相差的数量
  419. /// </summary>
  420. /// <param name="aNum"></param>
  421. /// <param name="num"></param>
  422. /// <returns></returns>
  423. public object GetMinuteNum(object aNum, object num)
  424. {
  425. if (aNum.ToString() == "" || num.ToString() == "") return 0;
  426. return Convert.ToInt32(aNum) - Convert.ToInt32(num);
  427. }
  428. public object GetMinusMinuteNum(object aNum, object num)
  429. {
  430. if (aNum.ToString() == "" || num.ToString() == "") return 0;
  431. int tmp=Convert.ToInt32(aNum) - Convert.ToInt32(num);
  432. if(tmp<0)return 0;
  433. return tmp;
  434. }
  435. public double GetDoubleMinuteNum(object aNum,object num)
  436. {
  437. return Convert.ToDouble(aNum) - Convert.ToDouble(num);
  438. }
  439. public string GetDoubleMinuteString(object aNum, object num)
  440. {
  441. return GetDoubleString(Convert.ToDouble(aNum) - Convert.ToDouble(num));
  442. }
  443. #endregion
  444. #region 页面方法
  445. //设置过期
  446. public void SetPageExpires()
  447. {
  448. Response.Buffer = true;
  449. Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
  450. Response.Expires = 0;
  451. Response.AddHeader("pragma","no-cache");
  452. Response.AddHeader("cache-control", "private");
  453. Response.CacheControl = "no-cache";
  454. }
  455. #endregion
  456. #region URL参数
  457. /// <summary>
  458. /// 获取当前Url带完整参数
  459. /// </summary>
  460. /// <param name="url"></param>
  461. /// <param name="parm"></param>
  462. /// <param name="nshow">不加的参数</param>
  463. /// <returns></returns>
  464. public string GetCurrentUrl(string url, string parm, string nshow)
  465. {
  466. string query = HttpContext.Current.Request.Url.Query;
  467. StringBuilder qStr = new StringBuilder();
  468. qStr.Append(url + "?");
  469. if (query != "")
  470. {
  471. query = query.Substring(1);
  472. string key = parm.Split('=')[0];
  473. string[] qArr = query.Split('&');
  474. for (int i = 0; i < qArr.Length; i++)
  475. {
  476. if (qArr[i].Split('=')[0] != key && qArr[i].Split('=')[0] != nshow)
  477. qStr.Append(qArr[i] + "&");
  478. }
  479. }
  480. qStr.Append(parm);
  481. return qStr.ToString();
  482. }
  483. public string GetCurrentUrl(string parm, string nshow)
  484. {
  485. return GetCurrentUrl("", parm, nshow);
  486. }
  487. /// <summary>
  488. /// 获取当前Url带完整参数
  489. /// </summary>
  490. /// <param name="parm"></param>
  491. /// <returns></returns>
  492. public string GetCurrentUrl(string parm)
  493. {
  494. return GetCurrentUrl("", parm, "");
  495. }
  496. /// <summary>
  497. /// 检测URL参数是否存在
  498. /// </summary>
  499. /// <param name="parms"></param>
  500. /// <returns></returns>
  501. public bool UrlParmsCheck(string parms)
  502. {
  503. return CommonHelper.UrlParmsCheck(parms);
  504. }
  505. public static bool UrlPostParmsCheck(string parms)
  506. {
  507. return CommonHelper.UrlPostParmsCheck(parms);
  508. }
  509. public int GetInt(string param)
  510. {
  511. return CommonHelper.GetInt(param);
  512. }
  513. public int GetPostInt(string param)
  514. {
  515. return CommonHelper.GetPostInt(param);
  516. }
  517. public double GetDouble(string param)
  518. {
  519. string v = GetString(param);
  520. if (v == "") return 0;
  521. return Convert.ToDouble(v);
  522. }
  523. public double GetPostDouble(string param)
  524. {
  525. string v = GetPostString(param);
  526. if (v == "") return 0;
  527. return Convert.ToDouble(v);
  528. }
  529. public string GetString(string param)
  530. {
  531. return CommonHelper.GetString(param);
  532. }
  533. public string GetPostString(string param)
  534. {
  535. return CommonHelper.GetPostString(param);
  536. }
  537. public int GetDecodeInt(string param)
  538. {
  539. return GetDecodeInt(param, false);
  540. }
  541. public int GetDecodeInt(string param, bool isPost)
  542. {
  543. string value = null;
  544. if (isPost) value = GetPostString(param);
  545. else value = GetString(param);
  546. if (value.Length < 1) return 0;
  547. return CommonHelper.DecodeInt(value);
  548. }
  549. public string GetDecodeString(string param)
  550. {
  551. return GetDecodeString(param, false);
  552. }
  553. public string GetDecodeString(string param, bool isPost)
  554. {
  555. string value = null;
  556. if (isPost) value = GetPostString(param);
  557. else value = GetString(param);
  558. if (value.Length < 1) return "";
  559. return CommonHelper.DecodeString(value);
  560. }
  561. public string GetDeepString(params string[] parms)
  562. {
  563. return CommonHelper.GetDeepString(parms);
  564. }
  565. public string GetDeepIds(params string[] parms)
  566. {
  567. return CommonHelper.GetDeepIds(parms);
  568. }
  569. public string GetHttpDecodeString(string parm)
  570. {
  571. return HttpUtility.UrlDecode(GetString(parm));
  572. }
  573. public string GetHttpDecodeString(string parm, Encoding coding)
  574. {
  575. return HttpUtility.UrlDecode(GetString(parm),coding);
  576. }
  577. public int GetDeepIndex(params string[] parms)
  578. {
  579. return CommonHelper.GetDeepIndex(parms);
  580. }
  581. #endregion
  582. #region 显示Ajax消息
  583. /// <summary>
  584. /// 显示消息
  585. /// </summary>
  586. /// <param name="msg">信息内容</param>
  587. public void ShowAjaxMsg(string msg)
  588. {
  589. ShowAjaxMsg("提示", msg);
  590. }
  591. /// <summary>
  592. /// 显示消息
  593. /// </summary>
  594. /// <param name="title">提示</param>
  595. /// <param name="msg">信息内容</param>
  596. public void ShowAjaxMsg(string title, string msg)
  597. {
  598. ScriptManager.RegisterStartupScript(Page, GetType(), title, "<script>alert('" + msg + "');</script>", false);
  599. }
  600. /// <summary>
  601. /// 显示消息带JS函数
  602. /// </summary>
  603. /// <param name="func">方法名称</param>
  604. public void ShowAjaxHasFunc(string func)
  605. {
  606. ShowAjaxHasFunc("提示", func);
  607. }
  608. /// <summary>
  609. /// 显示消息带JS函数
  610. /// </summary>
  611. /// <param name="title">提示</param>
  612. /// <param name="func">方法名称</param>
  613. public void ShowAjaxHasFunc(string title, string func)
  614. {
  615. ScriptManager.RegisterStartupScript(Page, GetType(), title, "<script>" + func + "</script>", false);
  616. }
  617. #endregion
  618. #region 运行JS脚本显示
  619. public void ShowScript(string script)
  620. {
  621. Page.ClientScript.RegisterStartupScript(GetType(), "alt", "<script>" + script + "</script>");
  622. }
  623. /// <summary>
  624. /// 显示消息
  625. /// </summary>
  626. /// <param name="msg">信息内容</param>
  627. public void ShowMsg(string msg)
  628. {
  629. ShowMsg("提示", msg);
  630. }
  631. /// <summary>
  632. /// 显示消息
  633. /// </summary>
  634. /// <param name="title">提示</param>
  635. /// <param name="msg">信息内容</param>
  636. public void ShowMsg(string title, string msg)
  637. {
  638. ShowMsg(title, msg, "");
  639. }
  640. /// <summary>
  641. /// 显示消息
  642. /// </summary>
  643. /// <param name="title">提示</param>
  644. /// <param name="msg">信息内容</param>
  645. /// <param name="msg">方法</param>
  646. public void ShowMsg(string title, string msg, string func)
  647. {
  648. Page.ClientScript.RegisterStartupScript(GetType(), title, "<script>alert('" + msg + "');" + func + "</script>");
  649. }
  650. /// <summary>
  651. /// 弹出显示结果
  652. /// </summary>
  653. /// <param name="msg"></param>
  654. public void ShowResult(string msg)
  655. {
  656. ShowResult(msg, "");
  657. }
  658. /// <summary>
  659. /// 弹出显示结果
  660. /// </summary>
  661. /// <param name="msg"></param>
  662. /// <param name="func"></param>
  663. public void ShowResult(string msg, string func)
  664. {
  665. func = func.Replace("'", "\"");
  666. Page.ClientScript.RegisterStartupScript(GetType(), "result", "<script>$(document).ready( function(){ resultShow('" + msg + "','" + func + "');});</script>");
  667. }
  668. #endregion
  669. }
  670. public enum SearchDateEnum
  671. {
  672. Empty = 9,
  673. Default = 0,
  674. OneDay = 1,
  675. OneMonth = 2,
  676. OneYear = 3
  677. }
  678. }