NewClientBrowsingHistoryService.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using Models;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data.SqlClient;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Net;
  10. using System.Text.RegularExpressions;
  11. using System.Management;
  12. using System.Web.UI.HtmlControls;
  13. namespace DAL
  14. {
  15. /// <summary>
  16. /// 客户资料 操作记录
  17. /// </summary>
  18. public class NewClientBrowsingHistoryService
  19. {
  20. List<NewClientBrowsingHistory> excuteSql(string sql, params SqlParameter[] param)
  21. {
  22. return ServiceBase<NewClientBrowsingHistory>.excuteSql(new NewClientBrowsingHistory(), "NewClientBrowsingHistory", sql, CommandType.Text, param);
  23. }
  24. NewClientBrowsingHistory excuteType(string sql, params SqlParameter[] param)
  25. {
  26. //查询结果放入对象集合
  27. List<NewClientBrowsingHistory> hdList = excuteSql(sql, param);
  28. NewClientBrowsingHistory air = new NewClientBrowsingHistory();
  29. //判断集合是否为空
  30. if (hdList == null || hdList.Count == 0)
  31. {
  32. return air;
  33. }
  34. //返回单个对象
  35. return hdList[0];
  36. }
  37. public bool Add(NewClientBrowsingHistory ncbh)
  38. {
  39. string sql = "insert into NewClientBrowsingHistory values(@UserId,@OperationItem,@ClientId,@OperationDt,@Address,@Device,@MacAddress,@RealIP,@IntranetIP,@Browser," +
  40. "@BrowserType,@BrowserVersion,@Remark);SELECT @@IDENTITY";
  41. SqlParameter[] parameter = new SqlParameter[]{
  42. new SqlParameter("@UserId",ncbh.UserId),
  43. new SqlParameter("@OperationItem",ncbh.OperationItem),
  44. new SqlParameter("@ClientId",ncbh.ClientId),
  45. new SqlParameter("@OperationDt",ncbh.OperationDt),
  46. new SqlParameter("@Address",ncbh.Address),
  47. new SqlParameter("@Device",ncbh.Device),
  48. new SqlParameter("@MacAddress",ncbh.MacAddress),
  49. new SqlParameter("@RealIP",ncbh.RealIP),
  50. new SqlParameter("@IntranetIP",ncbh.IntranetIP),
  51. new SqlParameter("@Browser",ncbh.Browser),
  52. new SqlParameter("@BrowserType",ncbh.BrowserType),
  53. new SqlParameter("@BrowserVersion",ncbh.BrowserVersion),
  54. new SqlParameter("@Remark",ncbh.Remark)
  55. };
  56. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  57. return true;
  58. return false;
  59. }
  60. }
  61. }