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 { 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(); qjeA.SetFullDirty(); qjeA.wherecols = WhereNode.GenNode(f => f.create_date >= sr.Start && f.create_date < sr.End); qjeA.ordercols = new List>() { new Tuple(qjeA, tb_sys_manuallog.CN_CREATE_DATE, BLWording.ORDER_DESC) }; lBlocks.Add(qjeA); QueryJsonElement qjeB = lBlocks.GetInst(); qjeB.aliascols = new Dictionary>() { { tb_sys_program.CN_NAME, new List(){ "program_name" } } }; qjeB.jointype = QueryJsonElement.LEFT_JOIN; qjeB.jointable = qjeA; qjeB.joincols = new Dictionary() { {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>() { { tb_hr_employee.CN_NAME, new List(){ "user_name" } } }; qjeC.jointype = QueryJsonElement.LEFT_JOIN; qjeC.jointable = qjeA; qjeC.joincols = new Dictionary() { {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; } } }