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.
 
 
 
 
 
 

81 lines
3.5 KiB

namespace CounsellorBL.BLStructure.SYS
{
using CounsellorBL.Helper;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using OT.COM.ArsenalDB;
using OT.COM.LogisticsUtil;
using OT.COM.SignalerMessage;
using SoldierData.EnterprizeV4;
using System;
using System.Collections.Generic;
public class ProgramActionService : SingleDataTableTemplate<tb_sys_program2action>
{
public ProgramActionService()
{
dgReadCommandGenerator = readCommandGenerator;
}
protected string readCommandGenerator(CRequestMessage i_crmInput, JArray i_jaData, tb_sys_session i_sSessionUser, out Command o_c,
[System.Runtime.CompilerServices.CallerLineNumber] int i_nCodeLine = 0,
[System.Runtime.CompilerServices.CallerMemberName] string i_sMemberName = "",
[System.Runtime.CompilerServices.CallerFilePath] string i_sSourcePath = "")
{
string sMsg ;
Command cRes = null;
try
{
do
{
Dictionary<string, object> qry_data = GetQueryMasterFirstWhereData(i_crmInput);
var program_id = qry_data.ContainsKey(tb_sys_program2action.CN_PROGRAM_UID) ? qry_data[tb_sys_program2action.CN_PROGRAM_UID].ToString() : "";
QueryJsonElementCollection lBlocks = new QueryJsonElementCollection();
QueryJsonElement qjeA = lBlocks.GetInst();
qjeA.table = tb_sys_program2action.TABLENAME;
qjeA.displaycols = new List<string>() {
tb_sys_program2action.CN_UID,
tb_sys_program2action.CN_PROGRAM_UID,
tb_sys_program2action.CN_ACTION_NAME,
tb_sys_program2action.CN_SEQUENCE ,
tb_sys_program2action.CN_STATUS_FLAG
};
if (!string.IsNullOrEmpty(program_id))
{
qjeA.wherecols = new WhereNode(tb_sys_program2action.CN_PROGRAM_UID, WhereNode.EColumnOperation.EOT_EQ, typeof(tb_sys_program2action), program_id);
}
QueryJsonElement qjeB = lBlocks.GetInst();
qjeB.table = tb_sys_action.TABLENAME;
qjeB.jointype = QueryJsonElement.LEFT_JOIN;
qjeB.jointable = qjeA;
qjeB.joincols = new Dictionary<string, string>() {
{ tb_sys_action.CN_UID,tb_sys_program2action.CN_ACTION_NAME }};
qjeB.displaycols = new List<string>() { tb_sys_action.CN_NAME };
qjeB.aliascols = new Dictionary<string, List<string>>() { { tb_sys_action.CN_NAME, new List<string>() { "displayname" } } };
lBlocks.Add(qjeA);
lBlocks.Add(qjeB);
sMsg = MakeSelectJoinByBlocks(lBlocks, out cRes);
}
while (false);
}
catch (Exception ex)
{
LogHelper.DBLog(Util.GetLastExceptionMsg(ex), i_nCodeLine, i_sMemberName, i_sSourcePath);
sMsg = $"{nameof(readCommandGenerator)} unknwon exception. i_crmInput={JsonConvert.SerializeObject(i_crmInput)}. Call from {i_sMemberName} {i_sSourcePath}({i_nCodeLine}).";
#if DEBUG
System.Diagnostics.Debug.WriteLine(sMsg);
#endif
}
o_c = cRes;
return sMsg;
}
}
}