UU跑腿标准版

BasePage.cs 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Data;
  6. using HySoft.Common;
  7. using System.Web.UI;
  8. public class BasePage : System.Web.UI.Page
  9. {
  10. public string PageTitle = "";//页面标题文本信息
  11. protected override void OnLoad(EventArgs e)
  12. {
  13. try
  14. {
  15. LoginUser p_LoginUser = new LoginUser(this.Context);
  16. if (p_LoginUser.UserID == 0)
  17. {
  18. string url = Request.Url.AbsoluteUri.Replace(Request.Path, "");
  19. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>top.location='" + url + "/login.aspx';</script>");
  20. }
  21. else
  22. {
  23. base.OnLoad(e);
  24. }
  25. }
  26. catch (Exception ex)
  27. {
  28. SysLog.WriteLog(ex);
  29. }
  30. //设置基类 每个页面继承该类,该类判断是否存在该用户,如果不存在则返回重新登录
  31. }
  32. /// <summary>
  33. /// 操作日志
  34. /// </summary>
  35. /// <param name="F_FunctionId">页面ID</param>
  36. /// <param name="F_FunctionItemId">按钮ID</param>
  37. /// <param name="F_Descript">内容</param>
  38. /// <param name="F_State">操作类型,0正常,1失败,2异常</param>
  39. /// <returns></returns>
  40. public bool InsertOptLogs(int F_FunctionId, int F_FunctionItemId, string F_Descript, int F_State)
  41. {
  42. try
  43. {
  44. LoginUser p_LoginUser = new LoginUser(this.Context);
  45. bool bl = false;
  46. DataTable dt = new DataTable();
  47. HySoft.BaseCallCenter.Model.T_Sys_OperateLogs model = new HySoft.BaseCallCenter.Model.T_Sys_OperateLogs();
  48. model.F_Descript = F_Descript;
  49. model.F_DeletionStateCode = 0;
  50. model.F_FunctionId = F_FunctionId;
  51. model.F_FunctionItemId = F_FunctionItemId;
  52. model.F_OptBy = p_LoginUser.UserID;
  53. model.F_OptName = p_LoginUser.UserName;
  54. model.F_OptOn = DateTime.Now;
  55. model.F_State = F_State;
  56. HySoft.BaseCallCenter.BLL.T_Sys_OperateLogs bll = new HySoft.BaseCallCenter.BLL.T_Sys_OperateLogs();
  57. if (bll.Add(model) > 0)
  58. {
  59. bl = true;
  60. }
  61. return bl;
  62. }
  63. catch
  64. {
  65. return false;
  66. }
  67. }
  68. /// <summary>
  69. /// 话务日志
  70. /// </summary>
  71. /// <param name="type"></param>
  72. /// <param name="F_Name"></param>
  73. /// <param name="F_Description"></param>
  74. public void AddCallLog(string type, string F_Name, string F_Description)
  75. {
  76. LoginUser p_LoginUser = new LoginUser(this.Context);
  77. int userId = p_LoginUser.UserID;
  78. string userName = p_LoginUser.UserName;
  79. new HySoft.BaseCallCenter.BLL.T_Sys_CallOptLogs().AddCallLog(Convert.ToInt32(userId), userName, type, F_Name, F_Description);
  80. }
  81. }