Contacts
This commit is contained in:
@@ -280,10 +280,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbAffiliate._Website = affiliate.Website;
|
||||
// Ogranisation.
|
||||
dbAffiliate._AffIdParent = affiliate.AffiliateIdParent.ToInt();
|
||||
if (!affiliate.IsIndividual())
|
||||
dbAffiliate._Name = affiliate.Name;
|
||||
else
|
||||
dbAffiliate._Name = affiliate.GetDisplayName();
|
||||
if (affiliate.IsIndividual())
|
||||
affiliate.Name = affiliate.GetDisplayName();
|
||||
dbAffiliate._Name = affiliate.Name;
|
||||
dbAffiliate._Abbrev = affiliate.Abbr;
|
||||
dbAffiliate._Nature = affiliate.Nature;
|
||||
dbAffiliate._Contact = affiliate.Contact;
|
||||
@@ -293,8 +292,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Individual.
|
||||
dbAffiliate._Title = affiliate.Title;
|
||||
dbAffiliate._Initials = affiliate.Initials;
|
||||
if (affiliate.AffiliateType == Sbm.AffiliateType.Individual)
|
||||
dbAffiliate._Name = affiliate.GetDisplayName();
|
||||
dbAffiliate._FirstName = affiliate.FirstName;
|
||||
dbAffiliate._LastName = affiliate.LastName;
|
||||
dbAffiliate._Salutation = affiliate.Salutation;
|
||||
@@ -548,7 +545,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
String colAffiliate_Id = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Affiliate_Id, aliasAffiliate);
|
||||
if (prm.IdsIncluded.HasValidIds())
|
||||
filter.Add($"{colAffiliate_Id} IN ({prm.IdsIncluded.Concat(",")})");
|
||||
if (prm.IdsExcluded.HasValidIds() )
|
||||
if (prm.IdsExcluded.HasValidIds())
|
||||
filter.Add($"{colAffiliate_Id} NOT IN ({prm.IdsExcluded.Concat(",")})");
|
||||
|
||||
// Type.
|
||||
@@ -832,6 +829,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
// Default sort columns:
|
||||
sortColumnNames.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Affiliate_Type, aliasAffiliate) + " ASC");
|
||||
sortColumnNames.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Affiliate_Name, aliasAffiliate) + " ASC");
|
||||
}
|
||||
return sortColumnNames;
|
||||
}
|
||||
|
||||
@@ -1321,30 +1321,28 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
//---------------------------------------------------------------
|
||||
// Association Id.
|
||||
String colAssociation_Id = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Id, aliasAssociation);
|
||||
String includedIds = prm.IdsIncluded.Concat(",");
|
||||
if (!includedIds.IsEmpty())
|
||||
filter.Add(colAssociation_Id + " IN (" + includedIds + ")");
|
||||
String excludedIds = prm.IdsExcluded.Concat(",");
|
||||
if (!excludedIds.IsEmpty())
|
||||
filter.Add(colAssociation_Id + " NOT IN (" + excludedIds + ")");
|
||||
if (prm.IdsIncluded.HasValidIds())
|
||||
filter.Add($"{colAssociation_Id} IN ({prm.IdsIncluded.Concat(",")})");
|
||||
if (prm.IdsExcluded.HasValidIds())
|
||||
filter.Add($"{colAssociation_Id} NOT IN ({prm.IdsExcluded.Concat(",")})");
|
||||
|
||||
// Association Type.
|
||||
String colAssociation_Type = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Type, aliasAssociation);
|
||||
if (prm.AssociationType > 0)
|
||||
filter.Add(colAssociation_Type + "=" + ((int)prm.AssociationType).ToString());
|
||||
filter.Add($"{colAssociation_Type}={(int)prm.AssociationType}");
|
||||
else if (prm.AssociationType == AssociationType.NotInternal)
|
||||
filter.Add(colAssociation_Type + "!=" + ((int)Sbm.AssociationType.Internal).ToString());
|
||||
filter.Add($"{colAssociation_Type}!={(int)Sbm.AssociationType.Internal}");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Owner affiliate.
|
||||
String colAssociation_AffIdOwner = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdOwner, aliasAssociation);
|
||||
if (SysId.IsValid(prm.AffiliateIdOwner))
|
||||
filter.Add(colAssociation_AffIdOwner + "=" + prm.AffiliateIdOwner.ToString());
|
||||
filter.Add($"{colAssociation_AffIdOwner}={prm.AffiliateIdOwner}");
|
||||
|
||||
// Target Affiliate.
|
||||
String colAssociation_AffIdTarget = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdTarget, aliasAssociation);
|
||||
if (SysId.IsValid(prm.AffiliateIdTarget))
|
||||
filter.Add(colAssociation_AffIdTarget + "=" + prm.AffiliateIdTarget.ToString());
|
||||
filter.Add($"{colAssociation_AffIdTarget}={prm.AffiliateIdTarget}");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Contact Group.
|
||||
|
||||
@@ -329,40 +329,38 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
List<String> filter = new List<String>();
|
||||
|
||||
// Param Id.
|
||||
String includedIds = prm.IdsIncluded.Concat(",");
|
||||
String colSysParam_Id = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SysParam_Id, aliasSysParam);
|
||||
if (!includedIds.IsEmpty())
|
||||
filter.Add(colSysParam_Id + " IN (" + includedIds + ")");
|
||||
String excludedIds = prm.IdsExcluded.Concat(",");
|
||||
if (!excludedIds.IsEmpty())
|
||||
filter.Add(colSysParam_Id + " NOT IN (" + excludedIds + ")");
|
||||
if (prm.IdsIncluded.HasValidIds())
|
||||
filter.Add($"{colSysParam_Id} IN ({prm.IdsIncluded.Concat(",")})");
|
||||
if (prm.IdsExcluded.HasValidIds() )
|
||||
filter.Add($"{colSysParam_Id} NOT IN ({prm.IdsExcluded.Concat(",")})");
|
||||
|
||||
// Category.
|
||||
String colSysParam_Cat = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SysParam_Cat, aliasSysParam);
|
||||
if (prm.Category > 0)
|
||||
filter.Add(colSysParam_Cat + " = '" + ((int)prm.Category).ToString() + "'");
|
||||
filter.Add($"{colSysParam_Cat}={(int)prm.Category}");
|
||||
|
||||
// Name.
|
||||
String colSysParam_Name = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SysParam_Name, aliasSysParam);
|
||||
if (!StringUtil.IsEmpty(prm.Name))
|
||||
filter.Add(colSysParam_Name + " = '" + DbQuery.FormatForCondition(prm.Name) + "'");
|
||||
if (!StringUtil.IsEmpty(prm.NamePartial))
|
||||
filter.Add(colSysParam_Name + " LIKE '%" + DbQuery.FormatForLike(prm.NamePartial) + "%'");
|
||||
filter.Add($"{colSysParam_Name}='{DbQuery.FormatForCondition(prm.Name)}'");
|
||||
else if (!StringUtil.IsEmpty(prm.NamePartial))
|
||||
filter.Add($"{colSysParam_Name} LIKE '%{DbQuery.FormatForLike(prm.NamePartial)}%'");
|
||||
|
||||
// Affiliate Owner Id.
|
||||
String colSysParam_AffIdOwner = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SysParam_AffIdOwner, aliasSysParam);
|
||||
if (SysId.IsValid(prm.AffIdOwner))
|
||||
filter.Add(colSysParam_AffIdOwner + " = '" + DbQuery.FormatForCondition(SysId.ToString(prm.AffIdOwner)) + "'");
|
||||
filter.Add($"{colSysParam_AffIdOwner}={SysId.ToLong(prm.AffIdOwner)}");
|
||||
|
||||
// Affiliate Target Id.
|
||||
String colSysParam_AffIdTarget = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SysParam_AffIdTarget, aliasSysParam);
|
||||
if (SysId.IsValid(prm.AssocId))
|
||||
filter.Add(colSysParam_AffIdTarget + " = '" + DbQuery.FormatForCondition(SysId.ToString(prm.AssocId)) + "'");
|
||||
filter.Add($"{colSysParam_AffIdTarget}={SysId.ToLong(prm.AssocId)}");
|
||||
|
||||
// Association Id.
|
||||
String colSysParam_AssocId = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SysParam_AssocId, aliasSysParam);
|
||||
if (SysId.IsValid(prm.AssocId))
|
||||
filter.Add(colSysParam_AssocId + " = '" + DbQuery.FormatForCondition(SysId.ToString(prm.AssocId)) + "'");
|
||||
filter.Add($"{colSysParam_AssocId}={SysId.ToLong(prm.AssocId)}");
|
||||
|
||||
// Common Properties
|
||||
/* Notes.
|
||||
|
||||
@@ -196,7 +196,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert VehicleClass.
|
||||
public override bool InsertVehicleClass(SbmVehicleClass vehicleClass, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertVehicleClass";
|
||||
ClearErrorState();
|
||||
if (!IsValidVehicleClass(vehicleClass)) return false;
|
||||
if (SysId.IsValid(vehicleClass.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -216,7 +215,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbVehicleClass.ExecuteInsertCommand(dbCommand);
|
||||
vehicleClass.Id = new SysId(dbVehicleClass._Id);
|
||||
vehicleClass.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Insert. " + GetLogProperties(vehicleClass).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Insert. " + GetLogProperties(vehicleClass).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -227,13 +226,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update VehicleClass.
|
||||
public override bool UpdateVehicleClass(SbmVehicleClass vehicleClass, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateVehicleClass";
|
||||
ClearErrorState();
|
||||
if (!IsValidVehicleClass(vehicleClass)) return false;
|
||||
if (!SysId.IsValid(vehicleClass.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!vehicleClass.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(vehicleClass).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. " + GetLogProperties(vehicleClass).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -251,7 +249,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbVehicleClass, vehicleClass, dbUpdateInfo);
|
||||
dbVehicleClass.ExecuteUpdateCommand(dbCommand);
|
||||
vehicleClass.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(vehicleClass).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. " + GetLogProperties(vehicleClass).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Record updates.
|
||||
updateLogMonitor.RecordUpdatedValues(vehicleClass);
|
||||
@@ -272,7 +270,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeleteVehicleClass(SbmVehicleClass vehicleClass, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteVehicleClass";
|
||||
ClearErrorState();
|
||||
if (!VehicleClassCanBeDeleted(vehicleClass)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -289,7 +286,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.SaVehicleClass) + " WHERE Id=" + SysId.ToString(vehicleClass.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
vehicleClass.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Delete. " + GetLogProperties(vehicleClass).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Delete. " + GetLogProperties(vehicleClass).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -549,12 +546,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
filter.Add($"{colModel} Like '{DbQuery.FormatForLike(prm.ModelPartial)}'");
|
||||
|
||||
// Description.
|
||||
String descBrief = DbQuery.FormatForCondition(prm.DescBrief);
|
||||
String descBriefPartial = DbQuery.FormatForCondition(prm.DescBriefPartial);
|
||||
if (!StringUtil.IsBlank(descBrief))
|
||||
filter.Add(colDescBrief + "='" + descBrief + "'");
|
||||
else if (!StringUtil.IsBlank(descBriefPartial))
|
||||
filter.Add(DbQuery.FormatFn_Left(colDescBrief, prm.DescBriefPartial.Length) + "='" + descBriefPartial + "'");
|
||||
if (!StringUtil.IsBlank(prm.DescBrief))
|
||||
filter.Add($"{colDescBrief}='{DbQuery.FormatForCondition(prm.DescBrief)}'");
|
||||
else if (!StringUtil.IsBlank(prm.DescBriefPartial))
|
||||
filter.Add($"{colDescBrief} LIKE '%{DbQuery.FormatForLike(prm.DescBriefPartial)}%'");
|
||||
|
||||
// Vehicle Category code.
|
||||
String colVehicleClass_VehicleCategoryCode = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SaVehicleClass_VehicleCategoryCode, aliasVehicleClass);
|
||||
|
||||
@@ -105,7 +105,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert VehicleEvent.
|
||||
public override bool InsertVehicleEvent(SbmVehicleEvent vehicleEvent, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertVehicleEvent";
|
||||
ClearErrorState();
|
||||
if (!IsValidVehicleEvent(vehicleEvent)) return false;
|
||||
if (SysId.IsValid(vehicleEvent.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -125,7 +124,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbVehicleEvent.ExecuteInsertCommand(dbCommand);
|
||||
vehicleEvent.Id = new SysId(dbVehicleEvent._Id);
|
||||
vehicleEvent.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(vehicleEvent).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. " + GetLogProperties(vehicleEvent).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -136,13 +135,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update VehicleEvent.
|
||||
public override bool UpdateVehicleEvent(SbmVehicleEvent vehicleEvent, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateVehicleEvent";
|
||||
ClearErrorState();
|
||||
if (!IsValidVehicleEvent(vehicleEvent)) return false;
|
||||
if (!SysId.IsValid(vehicleEvent.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!vehicleEvent.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(vehicleEvent).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. " + GetLogProperties(vehicleEvent).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -160,7 +158,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbVehicleEvent, vehicleEvent, dbUpdateInfo);
|
||||
dbVehicleEvent.ExecuteUpdateCommand(dbCommand);
|
||||
vehicleEvent.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(vehicleEvent).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. " + GetLogProperties(vehicleEvent).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Record updates.
|
||||
updateLogMonitor.RecordUpdatedValues(vehicleEvent);
|
||||
@@ -181,7 +179,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeleteVehicleEvent(SbmVehicleEvent vehicleEvent, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteVehicleEvent";
|
||||
ClearErrorState();
|
||||
if (!VehicleEventCanBeDeleted(vehicleEvent)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -198,7 +195,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.SaVehicleEvent) + " WHERE Id=" + SysId.ToString(vehicleEvent.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
vehicleEvent.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(vehicleEvent).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. " + GetLogProperties(vehicleEvent).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
|
||||
@@ -204,7 +204,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert VehicleFeature.
|
||||
public override bool InsertVehicleFeature(SbmVehicleFeature vehicleFeature, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertVehicleFeature";
|
||||
ClearErrorState();
|
||||
if (!IsValidVehicleFeature(vehicleFeature)) return false;
|
||||
if (SysId.IsValid(vehicleFeature.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -224,7 +223,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbVehicleFeature.ExecuteInsertCommand(dbCommand);
|
||||
vehicleFeature.Id = new SysId(dbVehicleFeature._VehicleId);
|
||||
vehicleFeature.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(vehicleFeature).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. " + GetLogProperties(vehicleFeature).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -235,13 +234,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update VehicleFeature.
|
||||
public override bool UpdateVehicleFeature(SbmVehicleFeature vehicleFeature, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateVehicleFeature";
|
||||
ClearErrorState();
|
||||
if (!IsValidVehicleFeature(vehicleFeature)) return false;
|
||||
if (!SysId.IsValid(vehicleFeature.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!vehicleFeature.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(vehicleFeature).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. " + GetLogProperties(vehicleFeature).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -259,7 +257,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbVehicleFeature, vehicleFeature, dbUpdateInfo);
|
||||
dbVehicleFeature.ExecuteUpdateCommand(dbCommand);
|
||||
vehicleFeature.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(vehicleFeature).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. " + GetLogProperties(vehicleFeature).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Record updates.
|
||||
updateLogMonitor.RecordUpdatedValues(vehicleFeature);
|
||||
@@ -280,7 +278,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeleteVehicleFeature(SbmVehicleFeature vehicleFeature, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteVehicleFeature";
|
||||
ClearErrorState();
|
||||
if (!VehicleFeatureCanBeDeleted(vehicleFeature)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -297,7 +294,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.SaVehicleFeature) + " WHERE Id=" + SysId.ToString(vehicleFeature.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
vehicleFeature.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(vehicleFeature).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. " + GetLogProperties(vehicleFeature).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
|
||||
@@ -624,7 +624,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert Commodity.
|
||||
public override bool InsertCommodity(SbmCommodity commodity, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertCommodity";
|
||||
ClearErrorState();
|
||||
if (!IsValidCommodity(commodity)) return false;
|
||||
if (SysId.IsValid(commodity.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -644,7 +643,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommodity.ExecuteInsertCommand(dbCommand);
|
||||
commodity.Id = new SysId(dbCommodity._Id);
|
||||
commodity.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(commodity).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. " + GetLogProperties(commodity).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -655,13 +654,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update Commodity.
|
||||
public override bool UpdateCommodity(SbmCommodity commodity, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateCommodity";
|
||||
ClearErrorState();
|
||||
if (!IsValidCommodity(commodity)) return false;
|
||||
if (!SysId.IsValid(commodity.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!commodity.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(commodity).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. " + GetLogProperties(commodity).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -679,7 +677,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbCommodity, commodity, dbUpdateInfo);
|
||||
dbCommodity.ExecuteUpdateCommand(dbCommand);
|
||||
commodity.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(commodity).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. " + GetLogProperties(commodity).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Record updates.
|
||||
updateLogMonitor.RecordUpdatedValues(commodity);
|
||||
@@ -700,7 +698,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeleteCommodity(SbmCommodity commodity, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteCommodity";
|
||||
ClearErrorState();
|
||||
if (!CommodityCanBeDeleted(commodity)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -717,7 +714,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Commodity) + " WHERE Id=" + SysId.ToString(commodity.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
commodity.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(commodity).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. " + GetLogProperties(commodity).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -2281,7 +2278,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Commodity query filter.
|
||||
public override List<string> GetCommodityQueryFilter(SbmCommodity.Params prm)
|
||||
{
|
||||
String fn = GetType().Name + ".GetCommodityQueryFilter";
|
||||
List<String> filter = new List<String>();
|
||||
|
||||
//---------------------------------------------------------------
|
||||
@@ -2598,7 +2594,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
filter.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_Id, aliasCommodity) + " IN (" + qryCmdCust.BuildQuery() + ")");
|
||||
}
|
||||
else SaLogger.Error(fn + " CmdCust filter specified and CmdCust management not allowed");
|
||||
else SaLogger.Error($"{SysUtil.Fn} CmdCust filter specified and CmdCust management not allowed");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -210,7 +210,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert CommodityCustomer.
|
||||
public override bool InsertCommodityCustomer(SbmCommodityCustomer commodityCustomer, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertCommodityCustomer";
|
||||
ClearErrorState();
|
||||
if (!IsValidCommodityCustomer(commodityCustomer)) return false;
|
||||
if (SysId.IsValid(commodityCustomer.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -230,7 +229,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommodityCustomer.ExecuteInsertCommand(dbCommand);
|
||||
commodityCustomer.Id = new SysId(dbCommodityCustomer._CommodityId);
|
||||
commodityCustomer.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(commodityCustomer).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. " + GetLogProperties(commodityCustomer).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -241,13 +240,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update CommodityCustomer.
|
||||
public override bool UpdateCommodityCustomer(SbmCommodityCustomer commodityCustomer, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateCommodityCustomer";
|
||||
ClearErrorState();
|
||||
if (!IsValidCommodityCustomer(commodityCustomer)) return false;
|
||||
if (!SysId.IsValid(commodityCustomer.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!commodityCustomer.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(commodityCustomer).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. " + GetLogProperties(commodityCustomer).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -265,7 +263,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbCommodityCustomer, commodityCustomer, dbUpdateInfo);
|
||||
dbCommodityCustomer.ExecuteUpdateCommand(dbCommand);
|
||||
commodityCustomer.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(commodityCustomer).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. " + GetLogProperties(commodityCustomer).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Record updates.
|
||||
updateLogMonitor.RecordUpdatedValues(commodityCustomer);
|
||||
@@ -286,7 +284,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeleteCommodityCustomer(SbmCommodityCustomer commodityCustomer, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteCommodityCustomer";
|
||||
ClearErrorState();
|
||||
if (!CommodityCustomerCanBeDeleted(commodityCustomer)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -303,7 +300,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.CommodityCustomer) + " WHERE Id=" + SysId.ToString(commodityCustomer.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
commodityCustomer.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(commodityCustomer).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. " + GetLogProperties(commodityCustomer).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
|
||||
@@ -125,7 +125,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert CommoditySupplier.
|
||||
public override bool InsertCommoditySupplier(SbmCommoditySupplier commoditySupplier, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertCommoditySupplier";
|
||||
ClearErrorState();
|
||||
if (!IsValidCommoditySupplier(commoditySupplier)) return false;
|
||||
if (SysId.IsValid(commoditySupplier.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -145,7 +144,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommoditySupplier.ExecuteInsertCommand(dbCommand);
|
||||
commoditySupplier.Id = new SysId(dbCommoditySupplier._CommodityId);
|
||||
commoditySupplier.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(commoditySupplier).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. " + GetLogProperties(commoditySupplier).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -156,13 +155,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update CommoditySupplier.
|
||||
public override bool UpdateCommoditySupplier(SbmCommoditySupplier commoditySupplier, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateCommoditySupplier";
|
||||
ClearErrorState();
|
||||
if (!IsValidCommoditySupplier(commoditySupplier)) return false;
|
||||
if (!SysId.IsValid(commoditySupplier.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!commoditySupplier.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(commoditySupplier).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. " + GetLogProperties(commoditySupplier).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -180,7 +178,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbCommoditySupplier, commoditySupplier, dbUpdateInfo);
|
||||
dbCommoditySupplier.ExecuteUpdateCommand(dbCommand);
|
||||
commoditySupplier.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(commoditySupplier).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. " + GetLogProperties(commoditySupplier).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
/* Record updates.
|
||||
updateLogMonitor.RecordUpdatedValues(commoditySupplier);
|
||||
@@ -201,7 +199,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeleteCommoditySupplier(SbmCommoditySupplier commoditySupplier, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteCommoditySupplier";
|
||||
ClearErrorState();
|
||||
if (!CommoditySupplierCanBeDeleted(commoditySupplier)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -218,7 +215,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.CommoditySupplier) + " WHERE Id=" + SysId.ToString(commoditySupplier.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
commoditySupplier.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(commoditySupplier).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. " + GetLogProperties(commoditySupplier).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
|
||||
@@ -100,7 +100,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert Container.
|
||||
public override bool InsertContainer(SbmContainer container, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertContainer";
|
||||
ClearErrorState();
|
||||
if (!IsValidContainer(container)) return false;
|
||||
if (SysId.IsValid(container.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -120,7 +119,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbContainer.ExecuteInsertCommand(dbCommand);
|
||||
container.Id = new SysId(dbContainer._Id);
|
||||
container.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(container).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. " + GetLogProperties(container).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -131,13 +130,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update Container.
|
||||
public override bool UpdateContainer(SbmContainer container, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateContainer";
|
||||
ClearErrorState();
|
||||
if (!IsValidContainer(container)) return false;
|
||||
if (!SysId.IsValid(container.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!container.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(container).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. " + GetLogProperties(container).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -155,7 +153,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbContainer, container, dbUpdateInfo);
|
||||
dbContainer.ExecuteUpdateCommand(dbCommand);
|
||||
container.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(container).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. " + GetLogProperties(container).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Record updates.
|
||||
updateLogMonitor.RecordUpdatedValues(container);
|
||||
@@ -176,7 +174,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeleteContainer(SbmContainer container, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteContainer";
|
||||
ClearErrorState();
|
||||
if (!ContainerCanBeDeleted(container)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -193,7 +190,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Container) + " WHERE Id=" + SysId.ToString(container.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
container.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(container).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. " + GetLogProperties(container).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
|
||||
@@ -136,7 +136,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert ContainerItem.
|
||||
public override bool InsertContainerItem(SbmContainerItem containerItem, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertContainerItem";
|
||||
ClearErrorState();
|
||||
if (!IsValidContainerItem(containerItem)) return false;
|
||||
if (SysId.IsValid(containerItem.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -156,7 +155,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbContainerItem.ExecuteInsertCommand(dbCommand);
|
||||
containerItem.Id = new SysId(dbContainerItem._ContainerId);
|
||||
containerItem.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(containerItem).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. " + GetLogProperties(containerItem).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -167,13 +166,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update ContainerItem.
|
||||
public override bool UpdateContainerItem(SbmContainerItem containerItem, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateContainerItem";
|
||||
ClearErrorState();
|
||||
if (!IsValidContainerItem(containerItem)) return false;
|
||||
if (!SysId.IsValid(containerItem.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!containerItem.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(containerItem).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. " + GetLogProperties(containerItem).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -191,7 +189,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbContainerItem, containerItem, dbUpdateInfo);
|
||||
dbContainerItem.ExecuteUpdateCommand(dbCommand);
|
||||
containerItem.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(containerItem).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. " + GetLogProperties(containerItem).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Record updates.
|
||||
updateLogMonitor.RecordUpdatedValues(containerItem);
|
||||
@@ -212,7 +210,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeleteContainerItem(SbmContainerItem containerItem, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteContainerItem";
|
||||
ClearErrorState();
|
||||
if (!ContainerItemCanBeDeleted(containerItem)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -229,7 +226,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.ContainerItem) + " WHERE Id=" + SysId.ToString(containerItem.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
containerItem.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(containerItem).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. " + GetLogProperties(containerItem).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
|
||||
@@ -295,7 +295,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert PortfolioItem.
|
||||
public override bool InsertPortfolioItem(SbmPortfolioItem portfolioItem, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".AddPortfolioItem";
|
||||
ClearErrorState();
|
||||
if (!IsValidPortfolioItem(portfolioItem)) return false;
|
||||
if (SysId.IsValid(portfolioItem.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -315,7 +314,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbPortfolioItem.ExecuteInsertCommand(dbCommand);
|
||||
portfolioItem.Id = new SysId(dbPortfolioItem._Id);
|
||||
portfolioItem.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(portfolioItem).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. " + GetLogProperties(portfolioItem).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Move other items for same parent down sequence.
|
||||
ResequenceSubsequentItems(portfolioItem);
|
||||
@@ -329,13 +328,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update PortfolioItem.
|
||||
public override bool UpdatePortfolioItem(SbmPortfolioItem portfolioItem, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdatePortfolioItem";
|
||||
ClearErrorState();
|
||||
if (!IsValidPortfolioItem(portfolioItem)) return false;
|
||||
if (!SysId.IsValid(portfolioItem.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!portfolioItem.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(portfolioItem).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. " + GetLogProperties(portfolioItem).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -353,7 +351,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbPortfolioItem, portfolioItem, dbUpdateInfo);
|
||||
dbPortfolioItem.ExecuteUpdateCommand(dbCommand);
|
||||
portfolioItem.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(portfolioItem).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. " + GetLogProperties(portfolioItem).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Record updates.
|
||||
updateLogMonitor.RecordUpdatedValues(portfolioItem);
|
||||
@@ -509,7 +507,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeletePortfolioItem(SbmPortfolioItem portfolioItem, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeletePortfolioItem";
|
||||
ClearErrorState();
|
||||
if (!PortfolioItemCanBeDeleted(portfolioItem)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -526,7 +523,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.PortfolioItem) + " WHERE Id=" + SysId.ToString(portfolioItem.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
portfolioItem.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(portfolioItem).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. " + GetLogProperties(portfolioItem).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Move other items for same parent down sequence.
|
||||
ResequenceSubsequentItems(portfolioItem);
|
||||
|
||||
@@ -105,7 +105,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert ItemBatch.
|
||||
public override bool InsertItemBatch(SbmItemBatch itemBatch, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertItemBatch";
|
||||
ClearErrorState();
|
||||
if (!IsValidItemBatch(itemBatch)) return false;
|
||||
if (SysId.IsValid(itemBatch.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -125,7 +124,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbItemBatch.ExecuteInsertCommand(dbCommand);
|
||||
itemBatch.Id = new SysId(dbItemBatch._Id);
|
||||
itemBatch.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(itemBatch).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. " + GetLogProperties(itemBatch).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -136,13 +135,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update ItemBatch.
|
||||
public override bool UpdateItemBatch(SbmItemBatch itemBatch, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateItemBatch";
|
||||
ClearErrorState();
|
||||
if (!IsValidItemBatch(itemBatch)) return false;
|
||||
if (!SysId.IsValid(itemBatch.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!itemBatch.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(itemBatch).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. " + GetLogProperties(itemBatch).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -160,7 +158,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbItemBatch, itemBatch, dbUpdateInfo);
|
||||
dbItemBatch.ExecuteUpdateCommand(dbCommand);
|
||||
itemBatch.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(itemBatch).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. " + GetLogProperties(itemBatch).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Record updates.
|
||||
updateLogMonitor.RecordUpdatedValues(itemBatch);
|
||||
@@ -181,7 +179,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeleteItemBatch(SbmItemBatch itemBatch, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteXXX";
|
||||
ClearErrorState();
|
||||
if (!ItemBatchCanBeDeleted(itemBatch)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -198,7 +195,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.ItemBatch) + " WHERE Id=" + SysId.ToString(itemBatch.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
itemBatch.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(itemBatch).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. " + GetLogProperties(itemBatch).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
|
||||
@@ -109,7 +109,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert Item.
|
||||
public override bool InsertItemLink(SbmItemLink itemLink, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertItemLink";
|
||||
ClearErrorState();
|
||||
if (!IsValidItemLink(itemLink)) return false;
|
||||
if (SysId.IsValid(itemLink.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -129,7 +128,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbItemLink.ExecuteInsertCommand(dbCommand);
|
||||
itemLink.Id = new SysId(0);
|
||||
itemLink.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(itemLink).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. " + GetLogProperties(itemLink).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -140,13 +139,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update Item.
|
||||
public override bool UpdateItemLink(SbmItemLink itemLink, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateItemLink";
|
||||
ClearErrorState();
|
||||
if (!IsValidItemLink(itemLink)) return false;
|
||||
if (!SysId.IsValid(itemLink.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!itemLink.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(itemLink).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. " + GetLogProperties(itemLink).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -164,7 +162,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbItemLink, itemLink, dbUpdateInfo);
|
||||
dbItemLink.ExecuteUpdateCommand(dbCommand);
|
||||
itemLink.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(itemLink).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. " + GetLogProperties(itemLink).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Record updates.
|
||||
updateLogMonitor.RecordUpdatedValues(itemLink);
|
||||
@@ -298,7 +296,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeleteItemLink(SbmItemLink itemLink, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteItemLink";
|
||||
ClearErrorState();
|
||||
if (!ItemLinkCanBeDeleted(itemLink)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -315,7 +312,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.ItemLink) + " WHERE Id=" + SysId.ToString(itemLink.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
itemLink.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(itemLink).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. " + GetLogProperties(itemLink).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
|
||||
@@ -98,7 +98,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert item.
|
||||
public override bool InsertPrice(SbmPrice price, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertPrice";
|
||||
ClearErrorState();
|
||||
if (!IsValidPrice(price)) return false;
|
||||
if (SysId.IsValid(price.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -113,7 +112,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// NB Prices don't have their own Ids.
|
||||
dbPrice.ExecuteInsertCommand(dbCommand);
|
||||
price.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted." + GetLogProperties(price).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted." + GetLogProperties(price).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -124,14 +123,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update item.
|
||||
public override bool UpdatePrice(SbmPrice price, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdatePrice";
|
||||
ClearErrorState();
|
||||
if (!IsValidPrice(price)) return false;
|
||||
if (!SysId.IsValid(price.PriceSetId)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!SysId.IsValid(price.CommodityId)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!price.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed." + GetLogProperties(price).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed." + GetLogProperties(price).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -149,7 +147,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbPrice, price, dbUpdateInfo);
|
||||
dbPrice.ExecuteUpdateCommand(dbCommand);
|
||||
price.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated." + GetLogProperties(price).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated." + GetLogProperties(price).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Record updates.
|
||||
//updateLogMonitor.RecordUpdatedValues(price);
|
||||
@@ -170,7 +168,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeletePrice(SbmPrice price, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeletePrice";
|
||||
ClearErrorState();
|
||||
if (!PriceCanBeDeleted(price)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -187,7 +184,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.SaPrice) + " WHERE PriceSetId = " + SysId.ToString(price.PriceSetId) + " And CommodityId=" + SysId.ToString(price.CommodityId) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
price.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted." + GetLogProperties(price).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted." + GetLogProperties(price).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
|
||||
@@ -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); }
|
||||
}
|
||||
|
||||
@@ -151,7 +151,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert Process.
|
||||
public override bool InsertProcess(SbmProcess process, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertProcess";
|
||||
ClearErrorState();
|
||||
if (!IsValidProcess(process)) return false;
|
||||
if (SysId.IsValid(process.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -171,7 +170,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbProcess.ExecuteInsertCommand(dbCommand);
|
||||
process.Id = new SysId(dbProcess._Id);
|
||||
process.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(process).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. " + GetLogProperties(process).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -182,13 +181,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update Process.
|
||||
public override bool UpdateProcess(SbmProcess process, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateProcess";
|
||||
ClearErrorState();
|
||||
if (!IsValidProcess(process)) return false;
|
||||
if (!SysId.IsValid(process.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!process.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(process).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. " + GetLogProperties(process).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -206,7 +204,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbProcess, process, dbUpdateInfo);
|
||||
dbProcess.ExecuteUpdateCommand(dbCommand);
|
||||
process.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(process).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. " + GetLogProperties(process).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Record updates.
|
||||
updateLogMonitor.RecordUpdatedValues(process);
|
||||
@@ -227,7 +225,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeleteProcess(SbmProcess process, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteProcess";
|
||||
ClearErrorState();
|
||||
if (!ProcessCanBeDeleted(process)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -244,7 +241,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Process) + " WHERE Id=" + SysId.ToString(process.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
process.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(process).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. " + GetLogProperties(process).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
|
||||
@@ -100,7 +100,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert Location.
|
||||
public override bool InsertLocation(SbmLocation location, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertLocation";
|
||||
ClearErrorState();
|
||||
if (!IsValidLocation(location)) return false;
|
||||
if (SysId.IsValid(location.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -120,7 +119,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbLocation.ExecuteInsertCommand(dbCommand);
|
||||
location.Id = new SysId(dbLocation._Id);
|
||||
location.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(location).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. " + GetLogProperties(location).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -131,13 +130,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update Location.
|
||||
public override bool UpdateLocation(SbmLocation location, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateLocation";
|
||||
ClearErrorState();
|
||||
if (!IsValidLocation(location)) return false;
|
||||
if (!SysId.IsValid(location.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!location.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(location).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. " + GetLogProperties(location).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -155,7 +153,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbLocation, location, dbUpdateInfo);
|
||||
dbLocation.ExecuteUpdateCommand(dbCommand);
|
||||
location.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(location).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. " + GetLogProperties(location).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Record updates.
|
||||
updateLogMonitor.RecordUpdatedValues(location);
|
||||
@@ -176,7 +174,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeleteLocation(SbmLocation location, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteLocation";
|
||||
ClearErrorState();
|
||||
if (!LocationCanBeDeleted(location)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -193,7 +190,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Location) + " WHERE Id=" + SysId.ToString(location.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
location.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(location).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. " + GetLogProperties(location).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
|
||||
@@ -221,7 +221,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert Movement.
|
||||
public override bool InsertMovement(SbmMovement movement, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertMovement";
|
||||
ClearErrorState();
|
||||
if (!IsValidMovement(movement)) return false;
|
||||
if (SysId.IsValid(movement.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -241,7 +240,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbMovement.ExecuteInsertCommand(dbCommand);
|
||||
movement.Id = new SysId(dbMovement._Id);
|
||||
movement.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(movement).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. " + GetLogProperties(movement).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -252,13 +251,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update Movement.
|
||||
public override bool UpdateMovement(SbmMovement movement, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateMovement";
|
||||
ClearErrorState();
|
||||
if (!IsValidMovement(movement)) return false;
|
||||
if (!SysId.IsValid(movement.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!movement.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(movement).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. " + GetLogProperties(movement).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -276,7 +274,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbMovement, movement, dbUpdateInfo);
|
||||
dbMovement.ExecuteUpdateCommand(dbCommand);
|
||||
movement.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(movement).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. " + GetLogProperties(movement).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Record updates.
|
||||
updateLogMonitor.RecordUpdatedValues(movement);
|
||||
@@ -297,7 +295,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeleteMovement(SbmMovement movement, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteMovement";
|
||||
ClearErrorState();
|
||||
if (!MovementCanBeDeleted(movement)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -314,7 +311,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Movement) + " WHERE Id=" + SysId.ToString(movement.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
movement.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(movement).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. " + GetLogProperties(movement).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
|
||||
@@ -153,7 +153,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
/// <summary>Get the list of time records recorded for the specified parameters.</summary>
|
||||
public override List<DataItem> GetPeriodTimeBooked(SysId affiliateIdEmployee, DateTime periodStart, DateTime periodEnd, SaUomType uomPeriod)
|
||||
{
|
||||
String fn = GetType().Name + ".GetPeriodTimeBooked";
|
||||
ClearErrorState();
|
||||
List<DataItem> dataItems = new List<DataItem>();
|
||||
if (!SysId.IsValid(affiliateIdEmployee))
|
||||
@@ -181,7 +180,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
break;
|
||||
default:
|
||||
#if DEBUG
|
||||
SaLogger.Warn(fn + " Period unit defaulted to working week.");
|
||||
SaLogger.Warn($"{SysUtil.Fn} Period unit defaulted to working week.");
|
||||
#endif
|
||||
uomPeriod = SaUomType.Time_WorkingWeek;
|
||||
break;
|
||||
@@ -369,7 +368,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert Constituent.
|
||||
public override bool InsertConstituent(SbmConstituent constituent, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertConstituent";
|
||||
ClearErrorState();
|
||||
if (!IsValidConstituent(constituent)) return false;
|
||||
if (SysId.IsValid(constituent.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -389,7 +387,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbConstituent.ExecuteInsertCommand(dbCommand);
|
||||
constituent.Id = new SysId(dbConstituent._Id);
|
||||
constituent.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(constituent).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. " + GetLogProperties(constituent).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -400,13 +398,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update Constituent.
|
||||
public override bool UpdateConstituent(SbmConstituent constituent, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateConstituent";
|
||||
ClearErrorState();
|
||||
if (!IsValidConstituent(constituent)) return false;
|
||||
if (!SysId.IsValid(constituent.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!constituent.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(constituent).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. " + GetLogProperties(constituent).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -424,7 +421,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbConstituent, constituent, dbUpdateInfo);
|
||||
dbConstituent.ExecuteUpdateCommand(dbCommand);
|
||||
constituent.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(constituent).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. " + GetLogProperties(constituent).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Record updates.
|
||||
updateLogMonitor.RecordUpdatedValues(constituent);
|
||||
@@ -445,7 +442,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeleteConstituent(SbmConstituent constituent, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteConstituent";
|
||||
ClearErrorState();
|
||||
if (!ConstituentCanBeDeleted(constituent)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -462,7 +458,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Constituent) + " WHERE Id=" + SysId.ToString(constituent.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
constituent.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(constituent).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. " + GetLogProperties(constituent).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
|
||||
@@ -432,7 +432,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert Requirement.
|
||||
public override bool InsertRequirement(SbmRequirement requirement, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertRequirement";
|
||||
ClearErrorState();
|
||||
if (!IsValidRequirement(requirement)) return false;
|
||||
if (SysId.IsValid(requirement.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -452,7 +451,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbRequirement.ExecuteInsertCommand(dbCommand);
|
||||
requirement.Id = new SysId(dbRequirement._Id);
|
||||
requirement.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(requirement).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. " + GetLogProperties(requirement).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -463,13 +462,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update Requirement.
|
||||
public override bool UpdateRequirement(SbmRequirement requirement, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateRequirement";
|
||||
ClearErrorState();
|
||||
if (!IsValidRequirement(requirement)) return false;
|
||||
if (!SysId.IsValid(requirement.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!requirement.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(requirement).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. " + GetLogProperties(requirement).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -487,7 +485,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbRequirement, requirement, dbUpdateInfo);
|
||||
dbRequirement.ExecuteUpdateCommand(dbCommand);
|
||||
requirement.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(requirement).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. " + GetLogProperties(requirement).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Record updates.
|
||||
updateLogMonitor.RecordUpdatedValues(requirement);
|
||||
@@ -507,7 +505,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeleteRequirement(SbmRequirement requirement, Sbm.TransactionType transactionType, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteRequirement";
|
||||
ClearErrorState();
|
||||
if (!RequirementCanBeDeleted(requirement, transactionType)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -524,7 +521,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Requirement) + " WHERE Id=" + SysId.ToString(requirement.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
requirement.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(requirement).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. " + GetLogProperties(requirement).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
|
||||
@@ -492,7 +492,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert Transaction.
|
||||
public override bool InsertTransaction(SbmTransaction transaction, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertTransaction";
|
||||
ClearErrorState();
|
||||
if (!IsValidTransaction(transaction)) return false;
|
||||
if (SysId.IsValid(transaction.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -512,7 +511,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbTransaction.ExecuteInsertCommand(dbCommand);
|
||||
transaction.Id = new SysId(dbTransaction._Id);
|
||||
transaction.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(transaction).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. " + GetLogProperties(transaction).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -523,13 +522,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update Transaction.
|
||||
public override bool UpdateTransaction(SbmTransaction transaction, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateTransaction";
|
||||
ClearErrorState();
|
||||
if (!IsValidTransaction(transaction)) return false;
|
||||
if (!SysId.IsValid(transaction.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!transaction.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(transaction).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. " + GetLogProperties(transaction).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -547,7 +545,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbTransaction, transaction, dbUpdateInfo);
|
||||
dbTransaction.ExecuteUpdateCommand(dbCommand);
|
||||
transaction.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(transaction).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. " + GetLogProperties(transaction).Concat(": ").Concat("", "\n\t"));
|
||||
|
||||
// Record updates.
|
||||
updateLogMonitor.RecordUpdatedValues(transaction);
|
||||
@@ -596,7 +594,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeleteTransaction(SbmTransaction transaction, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteTransaction";
|
||||
ClearErrorState();
|
||||
if (!TransactionCanBeDeleted(transaction)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -613,7 +610,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Transaction) + " WHERE Id=" + SysId.ToString(transaction.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
transaction.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(transaction).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. " + GetLogProperties(transaction).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
|
||||
@@ -55,7 +55,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Retrieve the list of transactions types that reference the specified commodity code.
|
||||
public override List<Sbm.TransactionType> GetTransactionTypesForCommodity(SysId commodityId, SbmTransaction.StatusCat statusCat = SbmTransaction.StatusCat.NotCancelled)
|
||||
{
|
||||
String fn = GetType().Name + ".GetTransactionTypesForCommodity";
|
||||
List<Sbm.TransactionType> transactionTypes = new List<Sbm.TransactionType>();
|
||||
if (!SysId.IsValid(commodityId)) return transactionTypes;
|
||||
|
||||
@@ -85,14 +84,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
joinReqnt.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_CommodityId, aliasReqnt) + "=" + SysId.ToString(commodityId));
|
||||
qry.Joins.Add(joinReqnt);
|
||||
// Execute the query.
|
||||
if (DebugMode) SaLogger.Debug(fn + " Query: " + qry.BuildQuery());
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Query: " + qry.BuildQuery());
|
||||
using (DbResultSet dbResultSet = DbResultSet_DataReader.ExecuteQuery(db, qry.ToString()))
|
||||
{
|
||||
while (!HasErrorState() && dbResultSet != null && dbResultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = dbResultSet.GetRecordValues();
|
||||
Sbm.TransactionType transactionType = (Sbm.TransactionType)StringUtil.ToShort(values.GetValue(colTransactionType));
|
||||
if (DebugMode) SaLogger.Debug(fn + " Transaction type: " + transactionType.ToString());
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Transaction type: " + transactionType.ToString());
|
||||
// Add this transaction type to the list.
|
||||
if (!transactionTypes.Contains(transactionType))
|
||||
transactionTypes.Add(transactionType);
|
||||
|
||||
Reference in New Issue
Block a user