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.
|
|
namespace CounsellorBL.BLStructure.SYS { using CounsellorBL.Common; using CounsellorBL.Helper; using MonumentDefine; 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; using static CounsellorBL.Common.EntityBaseExtension;
public class ParamCatalogService : SingleDataTableTemplate<tb_sys_paramcatalog> { public ParamCatalogService() { dgDeleteCommandGenerator = deleteCommandGenerator;
ldgCopy_ModifyEachCopyItemCommand .Add( _addParams ); }
[Auth(false)] public new CResponseMessage Read(CRequestMessage i_crmInput) => base.Read(i_crmInput);
private string _addParams(ArsenalInterface ai, EntityBase i_ebOld, EntityBase i_oInst, out List<Command> o_lcAddition, [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 = null; try { tb_sys_param pDetailDisplay = new tb_sys_param(); pDetailDisplay.SetFullDirtyEx(EColumnFilter.ES_NO_SYSTEMCOLUMN_NO_UID); string sNewMstUID = (i_oInst as tb_sys_paramcatalog).uid;
tb_sys_param pDetailCond = new tb_sys_param() { paramcatalog = (i_ebOld as tb_sys_paramcatalog).uid };
List<Command> lcTemp = new List<Command>(); Command cSelectPara = Command.SetupSelectCmd(pDetailDisplay, pDetailCond); List<tb_sys_param> lAllDetail = ai.RunQueryList<tb_sys_param>(cSelectPara); foreach (tb_sys_param pa in lAllDetail) { pa.uid = Guid.NewGuid().ToString(); pa.paramcatalog = sNewMstUID; lcTemp.Add(Command.SetupInsertCmd(pa)); }
lCmds = lcTemp; } catch (Exception ex) { LogHelper.DBLog(Util.GetLastExceptionMsg(ex)); sMsg = $"{nameof(_addParams)} unknwon exception. Call from {i_sMemberName} {i_sSourcePath}({i_nCodeLine})."; #if DEBUG
System.Diagnostics.Debug.WriteLine(sMsg); #endif
}
o_lcAddition = lCmds; return sMsg;
}
protected string deleteCommandGenerator(CRequestMessage i_crmInput, JArray i_jaItems, 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> lcCmds = new List<Command>();
try { do { foreach (JToken jtkItem in i_jaItems) { Dictionary<string, object> dicItem = jtkItem.ToObject<Dictionary<string, object>>();
sMsg = getManualLog(i_crmInput, dicItem, BLWording.LOG_ACTION_NAME_DELETESQL, out Command cLog);
if (sMsg != null) { break; }
if (cLog != null) { lcCmds.Add(cLog); }
string sParamCatalogUID = null; if (dicItem.ContainsKey(BLWording.WHEREDATA) && dicItem[BLWording.WHEREDATA] is JObject wheredata) { Dictionary<string, object> wheredataDic = wheredata.ToObject<Dictionary<string, object>>(); // Get all prgram
if (wheredataDic != null && wheredataDic.ContainsKey(BLWording.UID)) { sParamCatalogUID = wheredataDic[tb_sys_paramcatalog.CN_UID].ToString(); lcCmds.Add(Command.SetupDeleteCmd(new tb_sys_param() { paramcatalog = sParamCatalogUID })); lcCmds.Add(Command.SetupDeleteCmd(new tb_sys_paramcatalog() { uid = sParamCatalogUID })); } }
} } while (false); } catch (Exception ex) { LogHelper.DBLog(Util.GetLastExceptionMsg(ex)); sMsg = $"{nameof(_addParams)} unknwon exception. Call from {i_sMemberName} {i_sSourcePath}({i_nCodeLine})."; #if DEBUG
System.Diagnostics.Debug.WriteLine(sMsg); #endif
}
o_lcResult = lcCmds; return sMsg; } } }
|