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.

80 lines
3.5 KiB

  1. namespace CounsellorBL.BLStructure.SYS
  2. {
  3. using CounsellorBL.Helper;
  4. using Newtonsoft.Json;
  5. using Newtonsoft.Json.Linq;
  6. using OT.COM.ArsenalDB;
  7. using OT.COM.LogisticsUtil;
  8. using OT.COM.SignalerMessage;
  9. using SoldierData.EnterprizeV4;
  10. using System;
  11. using System.Collections.Generic;
  12. public class ProgramActionService : SingleDataTableTemplate<tb_sys_program2action>
  13. {
  14. public ProgramActionService()
  15. {
  16. dgReadCommandGenerator = readCommandGenerator;
  17. }
  18. protected string readCommandGenerator(CRequestMessage i_crmInput, JArray i_jaData, tb_sys_session i_sSessionUser, out Command o_c,
  19. [System.Runtime.CompilerServices.CallerLineNumber] int i_nCodeLine = 0,
  20. [System.Runtime.CompilerServices.CallerMemberName] string i_sMemberName = "",
  21. [System.Runtime.CompilerServices.CallerFilePath] string i_sSourcePath = "")
  22. {
  23. string sMsg ;
  24. Command cRes = null;
  25. try
  26. {
  27. do
  28. {
  29. Dictionary<string, object> qry_data = GetQueryMasterFirstWhereData(i_crmInput);
  30. var program_id = qry_data.ContainsKey(tb_sys_program2action.CN_PROGRAM_UID) ? qry_data[tb_sys_program2action.CN_PROGRAM_UID].ToString() : "";
  31. QueryJsonElementCollection lBlocks = new QueryJsonElementCollection();
  32. QueryJsonElement qjeA = lBlocks.GetInst();
  33. qjeA.table = tb_sys_program2action.TABLENAME;
  34. qjeA.displaycols = new List<string>() {
  35. tb_sys_program2action.CN_UID,
  36. tb_sys_program2action.CN_PROGRAM_UID,
  37. tb_sys_program2action.CN_ACTION_NAME,
  38. tb_sys_program2action.CN_SEQUENCE ,
  39. tb_sys_program2action.CN_STATUS_FLAG
  40. };
  41. if (!string.IsNullOrEmpty(program_id))
  42. {
  43. qjeA.wherecols = new WhereNode(tb_sys_program2action.CN_PROGRAM_UID, WhereNode.EColumnOperation.EOT_EQ, typeof(tb_sys_program2action), program_id);
  44. }
  45. QueryJsonElement qjeB = lBlocks.GetInst();
  46. qjeB.table = tb_sys_action.TABLENAME;
  47. qjeB.jointype = QueryJsonElement.LEFT_JOIN;
  48. qjeB.jointable = qjeA;
  49. qjeB.joincols = new Dictionary<string, string>() {
  50. { tb_sys_action.CN_UID,tb_sys_program2action.CN_ACTION_NAME }};
  51. qjeB.displaycols = new List<string>() { tb_sys_action.CN_NAME };
  52. qjeB.aliascols = new Dictionary<string, List<string>>() { { tb_sys_action.CN_NAME, new List<string>() { "displayname" } } };
  53. lBlocks.Add(qjeA);
  54. lBlocks.Add(qjeB);
  55. sMsg = MakeSelectJoinByBlocks(lBlocks, out cRes);
  56. }
  57. while (false);
  58. }
  59. catch (Exception ex)
  60. {
  61. LogHelper.DBLog(Util.GetLastExceptionMsg(ex), i_nCodeLine, i_sMemberName, i_sSourcePath);
  62. sMsg = $"{nameof(readCommandGenerator)} unknwon exception. i_crmInput={JsonConvert.SerializeObject(i_crmInput)}. Call from {i_sMemberName} {i_sSourcePath}({i_nCodeLine}).";
  63. #if DEBUG
  64. System.Diagnostics.Debug.WriteLine(sMsg);
  65. #endif
  66. }
  67. o_c = cRes;
  68. return sMsg;
  69. }
  70. }
  71. }