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.
 
 
 
 
 
 

88 lines
3.7 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 ProgramManageService : SingleDataTableTemplate<tb_sys_program>
{
public ProgramManageService():base()
{
dgDeleteCommandGenerator = deleteCommandGenerator;
}
protected string deleteCommandGenerator(CRequestMessage i_crmInput, JArray i_jaData, tb_sys_session i_sSessionUser, out List<Command> o_lcResult, List<string> i_saQryContainKeys,
[System.Runtime.CompilerServices.CallerLineNumber] int i_nCodeLine = 0,
[System.Runtime.CompilerServices.CallerMemberName] string i_sMemberName = "",
[System.Runtime.CompilerServices.CallerFilePath] string i_sSourcePath = "")
{
string sMsg = null;
List<Command> lCmds = new List<Command>();
try
{
do
{
foreach (JToken jtkProg in i_jaData)
{
Dictionary<string, object> dicData = jtkProg.ToObject<Dictionary<string, object>>();
string sProgUID = null;
if (dicData.ContainsKey(BLWording.WHEREDATA) && dicData[BLWording.WHEREDATA] is JObject wheredata)
{
Dictionary<string, object> wheredataDic = wheredata.ToObject<Dictionary<string, object>>();
// Get all prgram
if (wheredataDic.ContainsKey(BLWording.UID))
{
sProgUID = wheredataDic[BLWording.UID].ToString();
// Get all action in this program
tb_sys_program2action p2aDisplay = new tb_sys_program2action();
p2aDisplay.SetDirty(tb_sys_program2action.CN_UID);
tb_sys_program2action p2aCond = new tb_sys_program2action() {
program_uid = sProgUID
};
Command cSelectProgramAction = Command.SetupSelectCmd(p2aDisplay, p2aCond);
ArsenalInterface ai = ArsenalDBMgr.GetInst(cSelectProgramAction);
List<tb_sys_program2action> lAllProgramAction = ai.RunQueryList<tb_sys_program2action>(cSelectProgramAction);
foreach(tb_sys_program2action pa in lAllProgramAction)
{
lCmds.Add(Command.SetupDeleteCmd(new tb_sys_program2action() { uid = pa.uid }));
}
lCmds.Add(Command.SetupDeleteCmd(new tb_sys_program() { uid = sProgUID }));
}
}
}
}
while (false);
}
catch (Exception ex)
{
LogHelper.DBLog(Util.GetLastExceptionMsg(ex), i_nCodeLine, i_sMemberName, i_sSourcePath);
sMsg = $"{nameof(deleteCommandGenerator)} 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_lcResult = lCmds;
return sMsg;
}
}
}