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.
 
 
 
 
 
 

98 lines
3.9 KiB

namespace CounsellorBL.BLStructure.SYS
{
using CounsellorBL.Helper;
using MonumentDefine;
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 ManualLogService : SingleDataTableTemplate<tb_sys_manuallog>
{
public override string MainTable => typeof(tb_sys_manuallog).Name;
public ManualLogService()
{
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
{
sMsg = ScheduleRange.ParseLogStartEnd(tb_sys_manuallog.CN_CREATE_DATE, i_jaData, out ScheduleRange sr);
if (sMsg != null)
{
break;
}
QueryJsonElementCollection lBlocks = new QueryJsonElementCollection();
QueryJsonElement qjeA = lBlocks.GetInst<tb_sys_manuallog>();
qjeA.SetFullDirty();
qjeA.wherecols = WhereNode.GenNode<tb_sys_manuallog>(f => f.create_date >= sr.Start && f.create_date < sr.End);
qjeA.ordercols = new List<Tuple<QueryJsonElement, string, string>>() {
new Tuple<QueryJsonElement, string, string>(qjeA, tb_sys_manuallog.CN_CREATE_DATE, BLWording.ORDER_DESC) };
lBlocks.Add(qjeA);
QueryJsonElement qjeB = lBlocks.GetInst<tb_sys_program>();
qjeB.aliascols = new Dictionary<string, List<string>>() {
{ tb_sys_program.CN_NAME, new List<string>(){ "program_name" } }
};
qjeB.jointype = QueryJsonElement.LEFT_JOIN;
qjeB.jointable = qjeA;
qjeB.joincols = new Dictionary<string, string>() {
{tb_sys_program.CN_UID, tb_sys_manuallog.CN_PROGRAM_UID }
};
lBlocks.Add(qjeB);
QueryJsonElement qjeC = lBlocks.GetInst();
qjeC.table = tb_hr_employee.TABLENAME;
qjeC.aliascols = new Dictionary<string, List<string>>() {
{ tb_hr_employee.CN_NAME, new List<string>(){ "user_name" } }
};
qjeC.jointype = QueryJsonElement.LEFT_JOIN;
qjeC.jointable = qjeA;
qjeC.joincols = new Dictionary<string, string>() {
{tb_hr_employee.CN_UID, tb_sys_manuallog.CN_CREATE_USER_UID }
};
lBlocks.Add(qjeC);
sMsg = MakeSelectJoinByBlocks(lBlocks, out Command cRead);
if (sMsg != null)
{
break;
}
cRes = cRead;
}
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;
}
}
}