You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
3.8 KiB

2 years ago
  1. using Entity.Sugar;
  2. using Newtonsoft.Json;
  3. using SqlSugar;
  4. using SqlSugar.Base;
  5. using System.Collections.Generic;
  6. namespace WebApp.Hubs
  7. {
  8. public class MsgHubService
  9. {
  10. /// <summary>
  11. /// </summary>
  12. /// <param name="sOrgId">todo: describe sOrgId parameter on GetBillsString</param>
  13. /// <param name="sId">todo: describe sId parameter on GetBillsString</param>
  14. /// <returns></returns>
  15. public static string GetBillsString(string sOrgId, string sId)
  16. {
  17. var sBills = "";
  18. var db = SugarBase.DB;
  19. var saBills = db.Queryable<OTB_OPM_Bills>()
  20. .Where(it => it.OrgID == sOrgId)
  21. .WhereIF(sId != "", it => it.BillNO == sId).ToList();
  22. sBills = JsonConvert.SerializeObject(saBills, Formatting.Indented);
  23. return sBills;
  24. }
  25. /// <summary>
  26. /// </summary>
  27. /// <param name="sOrgId">todo: describe sOrgId parameter on GetCustomersString</param>
  28. /// <param name="sId">todo: describe sId parameter on GetCustomersString</param>
  29. /// <returns></returns>
  30. public static string GetCustomersString(string sOrgId, string sId)
  31. {
  32. var sCustomers = "";
  33. var db = SugarBase.DB;
  34. var saCustomers = db.Queryable<OTB_CRM_CustomersTransfer>()
  35. .Where(it => it.OrgID == sOrgId)
  36. .WhereIF(sId != "", it => it.Feild01 == sId).ToList();
  37. sCustomers = JsonConvert.SerializeObject(saCustomers, Formatting.Indented);
  38. return sCustomers;
  39. }
  40. /// <summary> </summary> <param name="sOrgId">todo: describe sOrgId parameter on
  41. /// GetExhibitionsString</param> <param name="sId">todo: describe sId parameter on
  42. /// GetExhibitionsString</param> <returns></ returns>
  43. public static string GetExhibitionsString(string sOrgId, string sId)
  44. {
  45. var sExhibitions = "";
  46. var db = SugarBase.DB;
  47. var saExhibitions = db.Queryable<OTB_OPM_ExhibitionsTransfer>()
  48. .Where(it => it.OrgID == sOrgId)
  49. .WhereIF(sId != "", it => it.PrjNO == sId).ToList();
  50. sExhibitions = JsonConvert.SerializeObject(saExhibitions, Formatting.Indented);
  51. return sExhibitions;
  52. }
  53. /// <summary>
  54. /// </summary>
  55. /// <param name="data">todo: describe data parameter on RemoveBills</param>
  56. /// <returns></returns>
  57. public static void RemoveBills(string data)
  58. {
  59. var listBills = JsonConvert.DeserializeObject<List<OTB_OPM_Bills>>(data);
  60. var db = SugarBase.DB;
  61. var sdb = new SimpleClient<OTB_OPM_Bills>(db);
  62. var iRel = db.Deleteable(listBills).ExecuteCommand();
  63. }
  64. /// <summary>
  65. /// </summary>
  66. /// <param name="data">todo: describe data parameter on RemoveCustomers</param>
  67. /// <returns></returns>
  68. public static void RemoveCustomers(string data)
  69. {
  70. var listCustomers = JsonConvert.DeserializeObject<List<OTB_CRM_CustomersTransfer>>(data);
  71. var db = SugarBase.DB;
  72. var sdb = new SimpleClient<OTB_CRM_CustomersTransfer>(db);
  73. var iRel = db.Deleteable(listCustomers).ExecuteCommand();
  74. }
  75. /// <summary>
  76. /// </summary>
  77. /// <param name="data">todo: describe data parameter on RemoveExhibitions</param>
  78. /// <returns></returns>
  79. public static void RemoveExhibitions(string data)
  80. {
  81. var listExhibitions = JsonConvert.DeserializeObject<List<OTB_OPM_ExhibitionsTransfer>>(data);
  82. var db = SugarBase.DB;
  83. var sdb = new SimpleClient<OTB_OPM_ExhibitionsTransfer>(db);
  84. var iRel = db.Deleteable(listExhibitions).ExecuteCommand();
  85. }
  86. }
  87. }