This commit is contained in:
Andy Howard
2024-11-26 11:33:22 +00:00
parent 8b872cc8f3
commit c8b5df5909
56 changed files with 1122 additions and 860 deletions
@@ -99,7 +99,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
// Insert item.
public override bool InsertPriceSet(SbmPriceSet priceSet, DbUpdateInfo dbUpdateInfo)
{
String fn = GetType().Name + ".InsertPriceSet";
ClearErrorState();
if (!IsValidPriceSet(priceSet)) return false;
if (SysId.IsValid(priceSet.Id)) return SetErrorState(ErrorMessage.ValiditemId);
@@ -119,7 +118,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
dbPriceSet.ExecuteInsertCommand(dbCommand);
priceSet.Id = new SysId(dbPriceSet._Id);
priceSet.Changed = false;
if (DebugMode) SaLogger.Debug(fn + " Inserted." + GetLogProperties(priceSet).Concat(": ").Concat("", "\n\t"));
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted." + GetLogProperties(priceSet).Concat(": ").Concat("", "\n\t"));
}
catch (Exception exc) { SetErrorState(exc.Message); }
}
@@ -130,13 +129,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
// Update item.
public override bool UpdatePriceSet(SbmPriceSet priceSet, DbUpdateInfo dbUpdateInfo)
{
String fn = GetType().Name + ".UpdatePriceSet";
ClearErrorState();
if (!IsValidPriceSet(priceSet)) return false;
if (!SysId.IsValid(priceSet.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
if (!priceSet.Changed)
{
if (DebugMode) SaLogger.Debug(fn + " Data not changed." + GetLogProperties(priceSet).Concat(": ").Concat("", "\n\t"));
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed." + GetLogProperties(priceSet).Concat(": ").Concat("", "\n\t"));
return true;
}
using (var dbConnection = db.CreateConnection())
@@ -154,7 +152,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
PopulateTo(dbPriceSet, priceSet, dbUpdateInfo);
dbPriceSet.ExecuteUpdateCommand(dbCommand);
priceSet.Changed = false;
if (DebugMode) SaLogger.Debug(fn + " Updated." + GetLogProperties(priceSet).Concat(": ").Concat("", "\n\t"));
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated." + GetLogProperties(priceSet).Concat(": ").Concat("", "\n\t"));
// Record updates.
updateLogMonitor.RecordUpdatedValues(priceSet);
@@ -175,7 +173,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
}
public override bool DeletePriceSet(SbmPriceSet priceSet, DbUpdateInfo dbUpdateInfo)
{
String fn = GetType().Name + ".DeletePriceSet";
ClearErrorState();
if (!PriceSetCanBeDeleted(priceSet)) return false;
using (var dbConnection = db.CreateConnection())
@@ -192,7 +189,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.SaPriceSet) + " WHERE Id=" + SysId.ToString(priceSet.Id) + ";";
dbCommand.ExecuteNonQuery();
priceSet.Changed = false;
if (DebugMode) SaLogger.Debug(fn + " Deleted." + GetLogProperties(priceSet).Concat(": ").Concat("", "\n\t"));
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted." + GetLogProperties(priceSet).Concat(": ").Concat("", "\n\t"));
}
catch (Exception exc) { SetErrorState(exc.Message); }
}