Contacts
This commit is contained in:
@@ -217,7 +217,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
|||||||
itemTypes.Add(Sbm.ItemType.Interface, "Interface", "Interface");
|
itemTypes.Add(Sbm.ItemType.Interface, "Interface", "Interface");
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
// A s s o c i a t i o n s
|
// Accounts.
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
// Affiliate Type.
|
// Affiliate Type.
|
||||||
affiliateTypes.Add(Sbm.AffiliateType.Individual, "IND", "Individual");
|
affiliateTypes.Add(Sbm.AffiliateType.Individual, "IND", "Individual");
|
||||||
@@ -238,7 +238,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
|||||||
associationTypes.Add(Sbm.AssociationType.FinanceAgency, "FIN", "Finance agency");
|
associationTypes.Add(Sbm.AssociationType.FinanceAgency, "FIN", "Finance agency");
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
// T r a n s a c t i o n s
|
// Transactions.
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
// Transaction StatusCat.
|
// Transaction StatusCat.
|
||||||
transactionStatusCats.Add(SbmTransaction.StatusCat.Pending, "PEN", "Pending");
|
transactionStatusCats.Add(SbmTransaction.StatusCat.Pending, "PEN", "Pending");
|
||||||
|
|||||||
@@ -455,6 +455,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
|||||||
return IsContactGroup(AffiliateType);
|
return IsContactGroup(AffiliateType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Most significant phone number.</summary>
|
||||||
|
public String GetPhone()
|
||||||
|
{
|
||||||
|
return StringUtil.OnBlank(PhoneMain, PhoneAlt, PhoneMobile, PhoneDirect);
|
||||||
|
}
|
||||||
|
|
||||||
// Email validation.
|
// Email validation.
|
||||||
public static bool IsValidEmail(String email)
|
public static bool IsValidEmail(String email)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -280,10 +280,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbAffiliate._Website = affiliate.Website;
|
dbAffiliate._Website = affiliate.Website;
|
||||||
// Ogranisation.
|
// Ogranisation.
|
||||||
dbAffiliate._AffIdParent = affiliate.AffiliateIdParent.ToInt();
|
dbAffiliate._AffIdParent = affiliate.AffiliateIdParent.ToInt();
|
||||||
if (!affiliate.IsIndividual())
|
if (affiliate.IsIndividual())
|
||||||
dbAffiliate._Name = affiliate.Name;
|
affiliate.Name = affiliate.GetDisplayName();
|
||||||
else
|
dbAffiliate._Name = affiliate.Name;
|
||||||
dbAffiliate._Name = affiliate.GetDisplayName();
|
|
||||||
dbAffiliate._Abbrev = affiliate.Abbr;
|
dbAffiliate._Abbrev = affiliate.Abbr;
|
||||||
dbAffiliate._Nature = affiliate.Nature;
|
dbAffiliate._Nature = affiliate.Nature;
|
||||||
dbAffiliate._Contact = affiliate.Contact;
|
dbAffiliate._Contact = affiliate.Contact;
|
||||||
@@ -293,8 +292,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Individual.
|
// Individual.
|
||||||
dbAffiliate._Title = affiliate.Title;
|
dbAffiliate._Title = affiliate.Title;
|
||||||
dbAffiliate._Initials = affiliate.Initials;
|
dbAffiliate._Initials = affiliate.Initials;
|
||||||
if (affiliate.AffiliateType == Sbm.AffiliateType.Individual)
|
|
||||||
dbAffiliate._Name = affiliate.GetDisplayName();
|
|
||||||
dbAffiliate._FirstName = affiliate.FirstName;
|
dbAffiliate._FirstName = affiliate.FirstName;
|
||||||
dbAffiliate._LastName = affiliate.LastName;
|
dbAffiliate._LastName = affiliate.LastName;
|
||||||
dbAffiliate._Salutation = affiliate.Salutation;
|
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);
|
String colAffiliate_Id = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Affiliate_Id, aliasAffiliate);
|
||||||
if (prm.IdsIncluded.HasValidIds())
|
if (prm.IdsIncluded.HasValidIds())
|
||||||
filter.Add($"{colAffiliate_Id} IN ({prm.IdsIncluded.Concat(",")})");
|
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(",")})");
|
filter.Add($"{colAffiliate_Id} NOT IN ({prm.IdsExcluded.Concat(",")})");
|
||||||
|
|
||||||
// Type.
|
// Type.
|
||||||
@@ -832,6 +829,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
{
|
{
|
||||||
// Default sort columns:
|
// Default sort columns:
|
||||||
sortColumnNames.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Affiliate_Type, aliasAffiliate) + " ASC");
|
sortColumnNames.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Affiliate_Type, aliasAffiliate) + " ASC");
|
||||||
|
sortColumnNames.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Affiliate_Name, aliasAffiliate) + " ASC");
|
||||||
}
|
}
|
||||||
return sortColumnNames;
|
return sortColumnNames;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1321,30 +1321,28 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
// Association Id.
|
// Association Id.
|
||||||
String colAssociation_Id = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Id, aliasAssociation);
|
String colAssociation_Id = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Id, aliasAssociation);
|
||||||
String includedIds = prm.IdsIncluded.Concat(",");
|
if (prm.IdsIncluded.HasValidIds())
|
||||||
if (!includedIds.IsEmpty())
|
filter.Add($"{colAssociation_Id} IN ({prm.IdsIncluded.Concat(",")})");
|
||||||
filter.Add(colAssociation_Id + " IN (" + includedIds + ")");
|
if (prm.IdsExcluded.HasValidIds())
|
||||||
String excludedIds = prm.IdsExcluded.Concat(",");
|
filter.Add($"{colAssociation_Id} NOT IN ({prm.IdsExcluded.Concat(",")})");
|
||||||
if (!excludedIds.IsEmpty())
|
|
||||||
filter.Add(colAssociation_Id + " NOT IN (" + excludedIds + ")");
|
|
||||||
|
|
||||||
// Association Type.
|
// Association Type.
|
||||||
String colAssociation_Type = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Type, aliasAssociation);
|
String colAssociation_Type = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Type, aliasAssociation);
|
||||||
if (prm.AssociationType > 0)
|
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)
|
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.
|
// Owner affiliate.
|
||||||
String colAssociation_AffIdOwner = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdOwner, aliasAssociation);
|
String colAssociation_AffIdOwner = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdOwner, aliasAssociation);
|
||||||
if (SysId.IsValid(prm.AffiliateIdOwner))
|
if (SysId.IsValid(prm.AffiliateIdOwner))
|
||||||
filter.Add(colAssociation_AffIdOwner + "=" + prm.AffiliateIdOwner.ToString());
|
filter.Add($"{colAssociation_AffIdOwner}={prm.AffiliateIdOwner}");
|
||||||
|
|
||||||
// Target Affiliate.
|
// Target Affiliate.
|
||||||
String colAssociation_AffIdTarget = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdTarget, aliasAssociation);
|
String colAssociation_AffIdTarget = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdTarget, aliasAssociation);
|
||||||
if (SysId.IsValid(prm.AffiliateIdTarget))
|
if (SysId.IsValid(prm.AffiliateIdTarget))
|
||||||
filter.Add(colAssociation_AffIdTarget + "=" + prm.AffiliateIdTarget.ToString());
|
filter.Add($"{colAssociation_AffIdTarget}={prm.AffiliateIdTarget}");
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
// Contact Group.
|
// Contact Group.
|
||||||
|
|||||||
@@ -329,40 +329,38 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
List<String> filter = new List<String>();
|
List<String> filter = new List<String>();
|
||||||
|
|
||||||
// Param Id.
|
// Param Id.
|
||||||
String includedIds = prm.IdsIncluded.Concat(",");
|
|
||||||
String colSysParam_Id = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SysParam_Id, aliasSysParam);
|
String colSysParam_Id = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SysParam_Id, aliasSysParam);
|
||||||
if (!includedIds.IsEmpty())
|
if (prm.IdsIncluded.HasValidIds())
|
||||||
filter.Add(colSysParam_Id + " IN (" + includedIds + ")");
|
filter.Add($"{colSysParam_Id} IN ({prm.IdsIncluded.Concat(",")})");
|
||||||
String excludedIds = prm.IdsExcluded.Concat(",");
|
if (prm.IdsExcluded.HasValidIds() )
|
||||||
if (!excludedIds.IsEmpty())
|
filter.Add($"{colSysParam_Id} NOT IN ({prm.IdsExcluded.Concat(",")})");
|
||||||
filter.Add(colSysParam_Id + " NOT IN (" + excludedIds + ")");
|
|
||||||
|
|
||||||
// Category.
|
// Category.
|
||||||
String colSysParam_Cat = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SysParam_Cat, aliasSysParam);
|
String colSysParam_Cat = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SysParam_Cat, aliasSysParam);
|
||||||
if (prm.Category > 0)
|
if (prm.Category > 0)
|
||||||
filter.Add(colSysParam_Cat + " = '" + ((int)prm.Category).ToString() + "'");
|
filter.Add($"{colSysParam_Cat}={(int)prm.Category}");
|
||||||
|
|
||||||
// Name.
|
// Name.
|
||||||
String colSysParam_Name = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SysParam_Name, aliasSysParam);
|
String colSysParam_Name = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SysParam_Name, aliasSysParam);
|
||||||
if (!StringUtil.IsEmpty(prm.Name))
|
if (!StringUtil.IsEmpty(prm.Name))
|
||||||
filter.Add(colSysParam_Name + " = '" + DbQuery.FormatForCondition(prm.Name) + "'");
|
filter.Add($"{colSysParam_Name}='{DbQuery.FormatForCondition(prm.Name)}'");
|
||||||
if (!StringUtil.IsEmpty(prm.NamePartial))
|
else if (!StringUtil.IsEmpty(prm.NamePartial))
|
||||||
filter.Add(colSysParam_Name + " LIKE '%" + DbQuery.FormatForLike(prm.NamePartial) + "%'");
|
filter.Add($"{colSysParam_Name} LIKE '%{DbQuery.FormatForLike(prm.NamePartial)}%'");
|
||||||
|
|
||||||
// Affiliate Owner Id.
|
// Affiliate Owner Id.
|
||||||
String colSysParam_AffIdOwner = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SysParam_AffIdOwner, aliasSysParam);
|
String colSysParam_AffIdOwner = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SysParam_AffIdOwner, aliasSysParam);
|
||||||
if (SysId.IsValid(prm.AffIdOwner))
|
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.
|
// Affiliate Target Id.
|
||||||
String colSysParam_AffIdTarget = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SysParam_AffIdTarget, aliasSysParam);
|
String colSysParam_AffIdTarget = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SysParam_AffIdTarget, aliasSysParam);
|
||||||
if (SysId.IsValid(prm.AssocId))
|
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.
|
// Association Id.
|
||||||
String colSysParam_AssocId = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SysParam_AssocId, aliasSysParam);
|
String colSysParam_AssocId = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SysParam_AssocId, aliasSysParam);
|
||||||
if (SysId.IsValid(prm.AssocId))
|
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
|
// Common Properties
|
||||||
/* Notes.
|
/* Notes.
|
||||||
|
|||||||
@@ -196,7 +196,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Insert VehicleClass.
|
// Insert VehicleClass.
|
||||||
public override bool InsertVehicleClass(SbmVehicleClass vehicleClass, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertVehicleClass(SbmVehicleClass vehicleClass, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".InsertVehicleClass";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidVehicleClass(vehicleClass)) return false;
|
if (!IsValidVehicleClass(vehicleClass)) return false;
|
||||||
if (SysId.IsValid(vehicleClass.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
if (SysId.IsValid(vehicleClass.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
@@ -216,7 +215,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbVehicleClass.ExecuteInsertCommand(dbCommand);
|
dbVehicleClass.ExecuteInsertCommand(dbCommand);
|
||||||
vehicleClass.Id = new SysId(dbVehicleClass._Id);
|
vehicleClass.Id = new SysId(dbVehicleClass._Id);
|
||||||
vehicleClass.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -227,13 +226,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update VehicleClass.
|
// Update VehicleClass.
|
||||||
public override bool UpdateVehicleClass(SbmVehicleClass vehicleClass, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdateVehicleClass(SbmVehicleClass vehicleClass, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdateVehicleClass";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidVehicleClass(vehicleClass)) return false;
|
if (!IsValidVehicleClass(vehicleClass)) return false;
|
||||||
if (!SysId.IsValid(vehicleClass.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(vehicleClass.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!vehicleClass.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -251,7 +249,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbVehicleClass, vehicleClass, dbUpdateInfo);
|
PopulateTo(dbVehicleClass, vehicleClass, dbUpdateInfo);
|
||||||
dbVehicleClass.ExecuteUpdateCommand(dbCommand);
|
dbVehicleClass.ExecuteUpdateCommand(dbCommand);
|
||||||
vehicleClass.Changed = false;
|
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.
|
// Record updates.
|
||||||
updateLogMonitor.RecordUpdatedValues(vehicleClass);
|
updateLogMonitor.RecordUpdatedValues(vehicleClass);
|
||||||
@@ -272,7 +270,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
}
|
}
|
||||||
public override bool DeleteVehicleClass(SbmVehicleClass vehicleClass, DbUpdateInfo dbUpdateInfo)
|
public override bool DeleteVehicleClass(SbmVehicleClass vehicleClass, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeleteVehicleClass";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!VehicleClassCanBeDeleted(vehicleClass)) return false;
|
if (!VehicleClassCanBeDeleted(vehicleClass)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.SaVehicleClass) + " WHERE Id=" + SysId.ToString(vehicleClass.Id) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
vehicleClass.Changed = false;
|
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); }
|
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)}'");
|
filter.Add($"{colModel} Like '{DbQuery.FormatForLike(prm.ModelPartial)}'");
|
||||||
|
|
||||||
// Description.
|
// Description.
|
||||||
String descBrief = DbQuery.FormatForCondition(prm.DescBrief);
|
if (!StringUtil.IsBlank(prm.DescBrief))
|
||||||
String descBriefPartial = DbQuery.FormatForCondition(prm.DescBriefPartial);
|
filter.Add($"{colDescBrief}='{DbQuery.FormatForCondition(prm.DescBrief)}'");
|
||||||
if (!StringUtil.IsBlank(descBrief))
|
else if (!StringUtil.IsBlank(prm.DescBriefPartial))
|
||||||
filter.Add(colDescBrief + "='" + descBrief + "'");
|
filter.Add($"{colDescBrief} LIKE '%{DbQuery.FormatForLike(prm.DescBriefPartial)}%'");
|
||||||
else if (!StringUtil.IsBlank(descBriefPartial))
|
|
||||||
filter.Add(DbQuery.FormatFn_Left(colDescBrief, prm.DescBriefPartial.Length) + "='" + descBriefPartial + "'");
|
|
||||||
|
|
||||||
// Vehicle Category code.
|
// Vehicle Category code.
|
||||||
String colVehicleClass_VehicleCategoryCode = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SaVehicleClass_VehicleCategoryCode, aliasVehicleClass);
|
String colVehicleClass_VehicleCategoryCode = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SaVehicleClass_VehicleCategoryCode, aliasVehicleClass);
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Insert VehicleEvent.
|
// Insert VehicleEvent.
|
||||||
public override bool InsertVehicleEvent(SbmVehicleEvent vehicleEvent, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertVehicleEvent(SbmVehicleEvent vehicleEvent, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".InsertVehicleEvent";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidVehicleEvent(vehicleEvent)) return false;
|
if (!IsValidVehicleEvent(vehicleEvent)) return false;
|
||||||
if (SysId.IsValid(vehicleEvent.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
if (SysId.IsValid(vehicleEvent.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
@@ -125,7 +124,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbVehicleEvent.ExecuteInsertCommand(dbCommand);
|
dbVehicleEvent.ExecuteInsertCommand(dbCommand);
|
||||||
vehicleEvent.Id = new SysId(dbVehicleEvent._Id);
|
vehicleEvent.Id = new SysId(dbVehicleEvent._Id);
|
||||||
vehicleEvent.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -136,13 +135,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update VehicleEvent.
|
// Update VehicleEvent.
|
||||||
public override bool UpdateVehicleEvent(SbmVehicleEvent vehicleEvent, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdateVehicleEvent(SbmVehicleEvent vehicleEvent, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdateVehicleEvent";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidVehicleEvent(vehicleEvent)) return false;
|
if (!IsValidVehicleEvent(vehicleEvent)) return false;
|
||||||
if (!SysId.IsValid(vehicleEvent.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(vehicleEvent.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!vehicleEvent.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -160,7 +158,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbVehicleEvent, vehicleEvent, dbUpdateInfo);
|
PopulateTo(dbVehicleEvent, vehicleEvent, dbUpdateInfo);
|
||||||
dbVehicleEvent.ExecuteUpdateCommand(dbCommand);
|
dbVehicleEvent.ExecuteUpdateCommand(dbCommand);
|
||||||
vehicleEvent.Changed = false;
|
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.
|
// Record updates.
|
||||||
updateLogMonitor.RecordUpdatedValues(vehicleEvent);
|
updateLogMonitor.RecordUpdatedValues(vehicleEvent);
|
||||||
@@ -181,7 +179,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
}
|
}
|
||||||
public override bool DeleteVehicleEvent(SbmVehicleEvent vehicleEvent, DbUpdateInfo dbUpdateInfo)
|
public override bool DeleteVehicleEvent(SbmVehicleEvent vehicleEvent, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeleteVehicleEvent";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!VehicleEventCanBeDeleted(vehicleEvent)) return false;
|
if (!VehicleEventCanBeDeleted(vehicleEvent)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.SaVehicleEvent) + " WHERE Id=" + SysId.ToString(vehicleEvent.Id) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
vehicleEvent.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -204,7 +204,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Insert VehicleFeature.
|
// Insert VehicleFeature.
|
||||||
public override bool InsertVehicleFeature(SbmVehicleFeature vehicleFeature, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertVehicleFeature(SbmVehicleFeature vehicleFeature, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".InsertVehicleFeature";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidVehicleFeature(vehicleFeature)) return false;
|
if (!IsValidVehicleFeature(vehicleFeature)) return false;
|
||||||
if (SysId.IsValid(vehicleFeature.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
if (SysId.IsValid(vehicleFeature.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
@@ -224,7 +223,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbVehicleFeature.ExecuteInsertCommand(dbCommand);
|
dbVehicleFeature.ExecuteInsertCommand(dbCommand);
|
||||||
vehicleFeature.Id = new SysId(dbVehicleFeature._VehicleId);
|
vehicleFeature.Id = new SysId(dbVehicleFeature._VehicleId);
|
||||||
vehicleFeature.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -235,13 +234,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update VehicleFeature.
|
// Update VehicleFeature.
|
||||||
public override bool UpdateVehicleFeature(SbmVehicleFeature vehicleFeature, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdateVehicleFeature(SbmVehicleFeature vehicleFeature, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdateVehicleFeature";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidVehicleFeature(vehicleFeature)) return false;
|
if (!IsValidVehicleFeature(vehicleFeature)) return false;
|
||||||
if (!SysId.IsValid(vehicleFeature.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(vehicleFeature.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!vehicleFeature.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -259,7 +257,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbVehicleFeature, vehicleFeature, dbUpdateInfo);
|
PopulateTo(dbVehicleFeature, vehicleFeature, dbUpdateInfo);
|
||||||
dbVehicleFeature.ExecuteUpdateCommand(dbCommand);
|
dbVehicleFeature.ExecuteUpdateCommand(dbCommand);
|
||||||
vehicleFeature.Changed = false;
|
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.
|
// Record updates.
|
||||||
updateLogMonitor.RecordUpdatedValues(vehicleFeature);
|
updateLogMonitor.RecordUpdatedValues(vehicleFeature);
|
||||||
@@ -280,7 +278,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
}
|
}
|
||||||
public override bool DeleteVehicleFeature(SbmVehicleFeature vehicleFeature, DbUpdateInfo dbUpdateInfo)
|
public override bool DeleteVehicleFeature(SbmVehicleFeature vehicleFeature, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeleteVehicleFeature";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!VehicleFeatureCanBeDeleted(vehicleFeature)) return false;
|
if (!VehicleFeatureCanBeDeleted(vehicleFeature)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.SaVehicleFeature) + " WHERE Id=" + SysId.ToString(vehicleFeature.Id) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
vehicleFeature.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -624,7 +624,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Insert Commodity.
|
// Insert Commodity.
|
||||||
public override bool InsertCommodity(SbmCommodity commodity, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertCommodity(SbmCommodity commodity, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".InsertCommodity";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidCommodity(commodity)) return false;
|
if (!IsValidCommodity(commodity)) return false;
|
||||||
if (SysId.IsValid(commodity.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
if (SysId.IsValid(commodity.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
@@ -644,7 +643,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbCommodity.ExecuteInsertCommand(dbCommand);
|
dbCommodity.ExecuteInsertCommand(dbCommand);
|
||||||
commodity.Id = new SysId(dbCommodity._Id);
|
commodity.Id = new SysId(dbCommodity._Id);
|
||||||
commodity.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -655,13 +654,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update Commodity.
|
// Update Commodity.
|
||||||
public override bool UpdateCommodity(SbmCommodity commodity, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdateCommodity(SbmCommodity commodity, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdateCommodity";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidCommodity(commodity)) return false;
|
if (!IsValidCommodity(commodity)) return false;
|
||||||
if (!SysId.IsValid(commodity.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(commodity.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!commodity.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -679,7 +677,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbCommodity, commodity, dbUpdateInfo);
|
PopulateTo(dbCommodity, commodity, dbUpdateInfo);
|
||||||
dbCommodity.ExecuteUpdateCommand(dbCommand);
|
dbCommodity.ExecuteUpdateCommand(dbCommand);
|
||||||
commodity.Changed = false;
|
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.
|
// Record updates.
|
||||||
updateLogMonitor.RecordUpdatedValues(commodity);
|
updateLogMonitor.RecordUpdatedValues(commodity);
|
||||||
@@ -700,7 +698,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
}
|
}
|
||||||
public override bool DeleteCommodity(SbmCommodity commodity, DbUpdateInfo dbUpdateInfo)
|
public override bool DeleteCommodity(SbmCommodity commodity, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeleteCommodity";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!CommodityCanBeDeleted(commodity)) return false;
|
if (!CommodityCanBeDeleted(commodity)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Commodity) + " WHERE Id=" + SysId.ToString(commodity.Id) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
commodity.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -2281,7 +2278,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Commodity query filter.
|
// Commodity query filter.
|
||||||
public override List<string> GetCommodityQueryFilter(SbmCommodity.Params prm)
|
public override List<string> GetCommodityQueryFilter(SbmCommodity.Params prm)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".GetCommodityQueryFilter";
|
|
||||||
List<String> filter = new List<String>();
|
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() + ")");
|
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.
|
// Insert CommodityCustomer.
|
||||||
public override bool InsertCommodityCustomer(SbmCommodityCustomer commodityCustomer, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertCommodityCustomer(SbmCommodityCustomer commodityCustomer, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".InsertCommodityCustomer";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidCommodityCustomer(commodityCustomer)) return false;
|
if (!IsValidCommodityCustomer(commodityCustomer)) return false;
|
||||||
if (SysId.IsValid(commodityCustomer.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
if (SysId.IsValid(commodityCustomer.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
@@ -230,7 +229,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbCommodityCustomer.ExecuteInsertCommand(dbCommand);
|
dbCommodityCustomer.ExecuteInsertCommand(dbCommand);
|
||||||
commodityCustomer.Id = new SysId(dbCommodityCustomer._CommodityId);
|
commodityCustomer.Id = new SysId(dbCommodityCustomer._CommodityId);
|
||||||
commodityCustomer.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -241,13 +240,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update CommodityCustomer.
|
// Update CommodityCustomer.
|
||||||
public override bool UpdateCommodityCustomer(SbmCommodityCustomer commodityCustomer, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdateCommodityCustomer(SbmCommodityCustomer commodityCustomer, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdateCommodityCustomer";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidCommodityCustomer(commodityCustomer)) return false;
|
if (!IsValidCommodityCustomer(commodityCustomer)) return false;
|
||||||
if (!SysId.IsValid(commodityCustomer.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(commodityCustomer.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!commodityCustomer.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -265,7 +263,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbCommodityCustomer, commodityCustomer, dbUpdateInfo);
|
PopulateTo(dbCommodityCustomer, commodityCustomer, dbUpdateInfo);
|
||||||
dbCommodityCustomer.ExecuteUpdateCommand(dbCommand);
|
dbCommodityCustomer.ExecuteUpdateCommand(dbCommand);
|
||||||
commodityCustomer.Changed = false;
|
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.
|
// Record updates.
|
||||||
updateLogMonitor.RecordUpdatedValues(commodityCustomer);
|
updateLogMonitor.RecordUpdatedValues(commodityCustomer);
|
||||||
@@ -286,7 +284,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
}
|
}
|
||||||
public override bool DeleteCommodityCustomer(SbmCommodityCustomer commodityCustomer, DbUpdateInfo dbUpdateInfo)
|
public override bool DeleteCommodityCustomer(SbmCommodityCustomer commodityCustomer, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeleteCommodityCustomer";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!CommodityCustomerCanBeDeleted(commodityCustomer)) return false;
|
if (!CommodityCustomerCanBeDeleted(commodityCustomer)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.CommodityCustomer) + " WHERE Id=" + SysId.ToString(commodityCustomer.Id) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
commodityCustomer.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Insert CommoditySupplier.
|
// Insert CommoditySupplier.
|
||||||
public override bool InsertCommoditySupplier(SbmCommoditySupplier commoditySupplier, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertCommoditySupplier(SbmCommoditySupplier commoditySupplier, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".InsertCommoditySupplier";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidCommoditySupplier(commoditySupplier)) return false;
|
if (!IsValidCommoditySupplier(commoditySupplier)) return false;
|
||||||
if (SysId.IsValid(commoditySupplier.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
if (SysId.IsValid(commoditySupplier.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
@@ -145,7 +144,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbCommoditySupplier.ExecuteInsertCommand(dbCommand);
|
dbCommoditySupplier.ExecuteInsertCommand(dbCommand);
|
||||||
commoditySupplier.Id = new SysId(dbCommoditySupplier._CommodityId);
|
commoditySupplier.Id = new SysId(dbCommoditySupplier._CommodityId);
|
||||||
commoditySupplier.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -156,13 +155,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update CommoditySupplier.
|
// Update CommoditySupplier.
|
||||||
public override bool UpdateCommoditySupplier(SbmCommoditySupplier commoditySupplier, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdateCommoditySupplier(SbmCommoditySupplier commoditySupplier, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdateCommoditySupplier";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidCommoditySupplier(commoditySupplier)) return false;
|
if (!IsValidCommoditySupplier(commoditySupplier)) return false;
|
||||||
if (!SysId.IsValid(commoditySupplier.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(commoditySupplier.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!commoditySupplier.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -180,7 +178,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbCommoditySupplier, commoditySupplier, dbUpdateInfo);
|
PopulateTo(dbCommoditySupplier, commoditySupplier, dbUpdateInfo);
|
||||||
dbCommoditySupplier.ExecuteUpdateCommand(dbCommand);
|
dbCommoditySupplier.ExecuteUpdateCommand(dbCommand);
|
||||||
commoditySupplier.Changed = false;
|
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.
|
/* Record updates.
|
||||||
updateLogMonitor.RecordUpdatedValues(commoditySupplier);
|
updateLogMonitor.RecordUpdatedValues(commoditySupplier);
|
||||||
@@ -201,7 +199,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
}
|
}
|
||||||
public override bool DeleteCommoditySupplier(SbmCommoditySupplier commoditySupplier, DbUpdateInfo dbUpdateInfo)
|
public override bool DeleteCommoditySupplier(SbmCommoditySupplier commoditySupplier, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeleteCommoditySupplier";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!CommoditySupplierCanBeDeleted(commoditySupplier)) return false;
|
if (!CommoditySupplierCanBeDeleted(commoditySupplier)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.CommoditySupplier) + " WHERE Id=" + SysId.ToString(commoditySupplier.Id) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
commoditySupplier.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Insert Container.
|
// Insert Container.
|
||||||
public override bool InsertContainer(SbmContainer container, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertContainer(SbmContainer container, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".InsertContainer";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidContainer(container)) return false;
|
if (!IsValidContainer(container)) return false;
|
||||||
if (SysId.IsValid(container.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
if (SysId.IsValid(container.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
@@ -120,7 +119,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbContainer.ExecuteInsertCommand(dbCommand);
|
dbContainer.ExecuteInsertCommand(dbCommand);
|
||||||
container.Id = new SysId(dbContainer._Id);
|
container.Id = new SysId(dbContainer._Id);
|
||||||
container.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -131,13 +130,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update Container.
|
// Update Container.
|
||||||
public override bool UpdateContainer(SbmContainer container, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdateContainer(SbmContainer container, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdateContainer";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidContainer(container)) return false;
|
if (!IsValidContainer(container)) return false;
|
||||||
if (!SysId.IsValid(container.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(container.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!container.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -155,7 +153,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbContainer, container, dbUpdateInfo);
|
PopulateTo(dbContainer, container, dbUpdateInfo);
|
||||||
dbContainer.ExecuteUpdateCommand(dbCommand);
|
dbContainer.ExecuteUpdateCommand(dbCommand);
|
||||||
container.Changed = false;
|
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.
|
// Record updates.
|
||||||
updateLogMonitor.RecordUpdatedValues(container);
|
updateLogMonitor.RecordUpdatedValues(container);
|
||||||
@@ -176,7 +174,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
}
|
}
|
||||||
public override bool DeleteContainer(SbmContainer container, DbUpdateInfo dbUpdateInfo)
|
public override bool DeleteContainer(SbmContainer container, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeleteContainer";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!ContainerCanBeDeleted(container)) return false;
|
if (!ContainerCanBeDeleted(container)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Container) + " WHERE Id=" + SysId.ToString(container.Id) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
container.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,7 +136,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Insert ContainerItem.
|
// Insert ContainerItem.
|
||||||
public override bool InsertContainerItem(SbmContainerItem containerItem, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertContainerItem(SbmContainerItem containerItem, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".InsertContainerItem";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidContainerItem(containerItem)) return false;
|
if (!IsValidContainerItem(containerItem)) return false;
|
||||||
if (SysId.IsValid(containerItem.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
if (SysId.IsValid(containerItem.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
@@ -156,7 +155,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbContainerItem.ExecuteInsertCommand(dbCommand);
|
dbContainerItem.ExecuteInsertCommand(dbCommand);
|
||||||
containerItem.Id = new SysId(dbContainerItem._ContainerId);
|
containerItem.Id = new SysId(dbContainerItem._ContainerId);
|
||||||
containerItem.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -167,13 +166,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update ContainerItem.
|
// Update ContainerItem.
|
||||||
public override bool UpdateContainerItem(SbmContainerItem containerItem, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdateContainerItem(SbmContainerItem containerItem, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdateContainerItem";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidContainerItem(containerItem)) return false;
|
if (!IsValidContainerItem(containerItem)) return false;
|
||||||
if (!SysId.IsValid(containerItem.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(containerItem.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!containerItem.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -191,7 +189,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbContainerItem, containerItem, dbUpdateInfo);
|
PopulateTo(dbContainerItem, containerItem, dbUpdateInfo);
|
||||||
dbContainerItem.ExecuteUpdateCommand(dbCommand);
|
dbContainerItem.ExecuteUpdateCommand(dbCommand);
|
||||||
containerItem.Changed = false;
|
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.
|
// Record updates.
|
||||||
updateLogMonitor.RecordUpdatedValues(containerItem);
|
updateLogMonitor.RecordUpdatedValues(containerItem);
|
||||||
@@ -212,7 +210,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
}
|
}
|
||||||
public override bool DeleteContainerItem(SbmContainerItem containerItem, DbUpdateInfo dbUpdateInfo)
|
public override bool DeleteContainerItem(SbmContainerItem containerItem, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeleteContainerItem";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!ContainerItemCanBeDeleted(containerItem)) return false;
|
if (!ContainerItemCanBeDeleted(containerItem)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.ContainerItem) + " WHERE Id=" + SysId.ToString(containerItem.Id) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
containerItem.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -295,7 +295,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Insert PortfolioItem.
|
// Insert PortfolioItem.
|
||||||
public override bool InsertPortfolioItem(SbmPortfolioItem portfolioItem, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertPortfolioItem(SbmPortfolioItem portfolioItem, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".AddPortfolioItem";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidPortfolioItem(portfolioItem)) return false;
|
if (!IsValidPortfolioItem(portfolioItem)) return false;
|
||||||
if (SysId.IsValid(portfolioItem.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
if (SysId.IsValid(portfolioItem.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
@@ -315,7 +314,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbPortfolioItem.ExecuteInsertCommand(dbCommand);
|
dbPortfolioItem.ExecuteInsertCommand(dbCommand);
|
||||||
portfolioItem.Id = new SysId(dbPortfolioItem._Id);
|
portfolioItem.Id = new SysId(dbPortfolioItem._Id);
|
||||||
portfolioItem.Changed = false;
|
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.
|
// Move other items for same parent down sequence.
|
||||||
ResequenceSubsequentItems(portfolioItem);
|
ResequenceSubsequentItems(portfolioItem);
|
||||||
@@ -329,13 +328,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update PortfolioItem.
|
// Update PortfolioItem.
|
||||||
public override bool UpdatePortfolioItem(SbmPortfolioItem portfolioItem, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdatePortfolioItem(SbmPortfolioItem portfolioItem, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdatePortfolioItem";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidPortfolioItem(portfolioItem)) return false;
|
if (!IsValidPortfolioItem(portfolioItem)) return false;
|
||||||
if (!SysId.IsValid(portfolioItem.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(portfolioItem.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!portfolioItem.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -353,7 +351,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbPortfolioItem, portfolioItem, dbUpdateInfo);
|
PopulateTo(dbPortfolioItem, portfolioItem, dbUpdateInfo);
|
||||||
dbPortfolioItem.ExecuteUpdateCommand(dbCommand);
|
dbPortfolioItem.ExecuteUpdateCommand(dbCommand);
|
||||||
portfolioItem.Changed = false;
|
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.
|
// Record updates.
|
||||||
updateLogMonitor.RecordUpdatedValues(portfolioItem);
|
updateLogMonitor.RecordUpdatedValues(portfolioItem);
|
||||||
@@ -509,7 +507,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
}
|
}
|
||||||
public override bool DeletePortfolioItem(SbmPortfolioItem portfolioItem, DbUpdateInfo dbUpdateInfo)
|
public override bool DeletePortfolioItem(SbmPortfolioItem portfolioItem, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeletePortfolioItem";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!PortfolioItemCanBeDeleted(portfolioItem)) return false;
|
if (!PortfolioItemCanBeDeleted(portfolioItem)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.PortfolioItem) + " WHERE Id=" + SysId.ToString(portfolioItem.Id) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
portfolioItem.Changed = false;
|
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.
|
// Move other items for same parent down sequence.
|
||||||
ResequenceSubsequentItems(portfolioItem);
|
ResequenceSubsequentItems(portfolioItem);
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Insert ItemBatch.
|
// Insert ItemBatch.
|
||||||
public override bool InsertItemBatch(SbmItemBatch itemBatch, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertItemBatch(SbmItemBatch itemBatch, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".InsertItemBatch";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidItemBatch(itemBatch)) return false;
|
if (!IsValidItemBatch(itemBatch)) return false;
|
||||||
if (SysId.IsValid(itemBatch.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
if (SysId.IsValid(itemBatch.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
@@ -125,7 +124,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbItemBatch.ExecuteInsertCommand(dbCommand);
|
dbItemBatch.ExecuteInsertCommand(dbCommand);
|
||||||
itemBatch.Id = new SysId(dbItemBatch._Id);
|
itemBatch.Id = new SysId(dbItemBatch._Id);
|
||||||
itemBatch.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -136,13 +135,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update ItemBatch.
|
// Update ItemBatch.
|
||||||
public override bool UpdateItemBatch(SbmItemBatch itemBatch, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdateItemBatch(SbmItemBatch itemBatch, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdateItemBatch";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidItemBatch(itemBatch)) return false;
|
if (!IsValidItemBatch(itemBatch)) return false;
|
||||||
if (!SysId.IsValid(itemBatch.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(itemBatch.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!itemBatch.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -160,7 +158,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbItemBatch, itemBatch, dbUpdateInfo);
|
PopulateTo(dbItemBatch, itemBatch, dbUpdateInfo);
|
||||||
dbItemBatch.ExecuteUpdateCommand(dbCommand);
|
dbItemBatch.ExecuteUpdateCommand(dbCommand);
|
||||||
itemBatch.Changed = false;
|
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.
|
// Record updates.
|
||||||
updateLogMonitor.RecordUpdatedValues(itemBatch);
|
updateLogMonitor.RecordUpdatedValues(itemBatch);
|
||||||
@@ -181,7 +179,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
}
|
}
|
||||||
public override bool DeleteItemBatch(SbmItemBatch itemBatch, DbUpdateInfo dbUpdateInfo)
|
public override bool DeleteItemBatch(SbmItemBatch itemBatch, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeleteXXX";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!ItemBatchCanBeDeleted(itemBatch)) return false;
|
if (!ItemBatchCanBeDeleted(itemBatch)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.ItemBatch) + " WHERE Id=" + SysId.ToString(itemBatch.Id) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
itemBatch.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Insert Item.
|
// Insert Item.
|
||||||
public override bool InsertItemLink(SbmItemLink itemLink, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertItemLink(SbmItemLink itemLink, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".InsertItemLink";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidItemLink(itemLink)) return false;
|
if (!IsValidItemLink(itemLink)) return false;
|
||||||
if (SysId.IsValid(itemLink.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
if (SysId.IsValid(itemLink.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
@@ -129,7 +128,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbItemLink.ExecuteInsertCommand(dbCommand);
|
dbItemLink.ExecuteInsertCommand(dbCommand);
|
||||||
itemLink.Id = new SysId(0);
|
itemLink.Id = new SysId(0);
|
||||||
itemLink.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -140,13 +139,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update Item.
|
// Update Item.
|
||||||
public override bool UpdateItemLink(SbmItemLink itemLink, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdateItemLink(SbmItemLink itemLink, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdateItemLink";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidItemLink(itemLink)) return false;
|
if (!IsValidItemLink(itemLink)) return false;
|
||||||
if (!SysId.IsValid(itemLink.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(itemLink.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!itemLink.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -164,7 +162,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbItemLink, itemLink, dbUpdateInfo);
|
PopulateTo(dbItemLink, itemLink, dbUpdateInfo);
|
||||||
dbItemLink.ExecuteUpdateCommand(dbCommand);
|
dbItemLink.ExecuteUpdateCommand(dbCommand);
|
||||||
itemLink.Changed = false;
|
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.
|
// Record updates.
|
||||||
updateLogMonitor.RecordUpdatedValues(itemLink);
|
updateLogMonitor.RecordUpdatedValues(itemLink);
|
||||||
@@ -298,7 +296,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
}
|
}
|
||||||
public override bool DeleteItemLink(SbmItemLink itemLink, DbUpdateInfo dbUpdateInfo)
|
public override bool DeleteItemLink(SbmItemLink itemLink, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeleteItemLink";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!ItemLinkCanBeDeleted(itemLink)) return false;
|
if (!ItemLinkCanBeDeleted(itemLink)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.ItemLink) + " WHERE Id=" + SysId.ToString(itemLink.Id) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
itemLink.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Insert item.
|
// Insert item.
|
||||||
public override bool InsertPrice(SbmPrice price, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertPrice(SbmPrice price, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".InsertPrice";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidPrice(price)) return false;
|
if (!IsValidPrice(price)) return false;
|
||||||
if (SysId.IsValid(price.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
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.
|
// NB Prices don't have their own Ids.
|
||||||
dbPrice.ExecuteInsertCommand(dbCommand);
|
dbPrice.ExecuteInsertCommand(dbCommand);
|
||||||
price.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -124,14 +123,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update item.
|
// Update item.
|
||||||
public override bool UpdatePrice(SbmPrice price, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdatePrice(SbmPrice price, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdatePrice";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidPrice(price)) return false;
|
if (!IsValidPrice(price)) return false;
|
||||||
if (!SysId.IsValid(price.PriceSetId)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(price.PriceSetId)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!SysId.IsValid(price.CommodityId)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(price.CommodityId)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!price.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -149,7 +147,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbPrice, price, dbUpdateInfo);
|
PopulateTo(dbPrice, price, dbUpdateInfo);
|
||||||
dbPrice.ExecuteUpdateCommand(dbCommand);
|
dbPrice.ExecuteUpdateCommand(dbCommand);
|
||||||
price.Changed = false;
|
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.
|
// Record updates.
|
||||||
//updateLogMonitor.RecordUpdatedValues(price);
|
//updateLogMonitor.RecordUpdatedValues(price);
|
||||||
@@ -170,7 +168,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
}
|
}
|
||||||
public override bool DeletePrice(SbmPrice price, DbUpdateInfo dbUpdateInfo)
|
public override bool DeletePrice(SbmPrice price, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeletePrice";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!PriceCanBeDeleted(price)) return false;
|
if (!PriceCanBeDeleted(price)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.SaPrice) + " WHERE PriceSetId = " + SysId.ToString(price.PriceSetId) + " And CommodityId=" + SysId.ToString(price.CommodityId) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
price.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Insert item.
|
// Insert item.
|
||||||
public override bool InsertPriceSet(SbmPriceSet priceSet, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertPriceSet(SbmPriceSet priceSet, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".InsertPriceSet";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidPriceSet(priceSet)) return false;
|
if (!IsValidPriceSet(priceSet)) return false;
|
||||||
if (SysId.IsValid(priceSet.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
if (SysId.IsValid(priceSet.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
@@ -119,7 +118,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbPriceSet.ExecuteInsertCommand(dbCommand);
|
dbPriceSet.ExecuteInsertCommand(dbCommand);
|
||||||
priceSet.Id = new SysId(dbPriceSet._Id);
|
priceSet.Id = new SysId(dbPriceSet._Id);
|
||||||
priceSet.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -130,13 +129,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update item.
|
// Update item.
|
||||||
public override bool UpdatePriceSet(SbmPriceSet priceSet, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdatePriceSet(SbmPriceSet priceSet, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdatePriceSet";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidPriceSet(priceSet)) return false;
|
if (!IsValidPriceSet(priceSet)) return false;
|
||||||
if (!SysId.IsValid(priceSet.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(priceSet.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!priceSet.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -154,7 +152,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbPriceSet, priceSet, dbUpdateInfo);
|
PopulateTo(dbPriceSet, priceSet, dbUpdateInfo);
|
||||||
dbPriceSet.ExecuteUpdateCommand(dbCommand);
|
dbPriceSet.ExecuteUpdateCommand(dbCommand);
|
||||||
priceSet.Changed = false;
|
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.
|
// Record updates.
|
||||||
updateLogMonitor.RecordUpdatedValues(priceSet);
|
updateLogMonitor.RecordUpdatedValues(priceSet);
|
||||||
@@ -175,7 +173,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
}
|
}
|
||||||
public override bool DeletePriceSet(SbmPriceSet priceSet, DbUpdateInfo dbUpdateInfo)
|
public override bool DeletePriceSet(SbmPriceSet priceSet, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeletePriceSet";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!PriceSetCanBeDeleted(priceSet)) return false;
|
if (!PriceSetCanBeDeleted(priceSet)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.SaPriceSet) + " WHERE Id=" + SysId.ToString(priceSet.Id) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
priceSet.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,7 +151,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Insert Process.
|
// Insert Process.
|
||||||
public override bool InsertProcess(SbmProcess process, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertProcess(SbmProcess process, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".InsertProcess";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidProcess(process)) return false;
|
if (!IsValidProcess(process)) return false;
|
||||||
if (SysId.IsValid(process.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
if (SysId.IsValid(process.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
@@ -171,7 +170,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbProcess.ExecuteInsertCommand(dbCommand);
|
dbProcess.ExecuteInsertCommand(dbCommand);
|
||||||
process.Id = new SysId(dbProcess._Id);
|
process.Id = new SysId(dbProcess._Id);
|
||||||
process.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -182,13 +181,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update Process.
|
// Update Process.
|
||||||
public override bool UpdateProcess(SbmProcess process, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdateProcess(SbmProcess process, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdateProcess";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidProcess(process)) return false;
|
if (!IsValidProcess(process)) return false;
|
||||||
if (!SysId.IsValid(process.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(process.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!process.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -206,7 +204,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbProcess, process, dbUpdateInfo);
|
PopulateTo(dbProcess, process, dbUpdateInfo);
|
||||||
dbProcess.ExecuteUpdateCommand(dbCommand);
|
dbProcess.ExecuteUpdateCommand(dbCommand);
|
||||||
process.Changed = false;
|
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.
|
// Record updates.
|
||||||
updateLogMonitor.RecordUpdatedValues(process);
|
updateLogMonitor.RecordUpdatedValues(process);
|
||||||
@@ -227,7 +225,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
}
|
}
|
||||||
public override bool DeleteProcess(SbmProcess process, DbUpdateInfo dbUpdateInfo)
|
public override bool DeleteProcess(SbmProcess process, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeleteProcess";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!ProcessCanBeDeleted(process)) return false;
|
if (!ProcessCanBeDeleted(process)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Process) + " WHERE Id=" + SysId.ToString(process.Id) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
process.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Insert Location.
|
// Insert Location.
|
||||||
public override bool InsertLocation(SbmLocation location, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertLocation(SbmLocation location, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".InsertLocation";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidLocation(location)) return false;
|
if (!IsValidLocation(location)) return false;
|
||||||
if (SysId.IsValid(location.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
if (SysId.IsValid(location.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
@@ -120,7 +119,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbLocation.ExecuteInsertCommand(dbCommand);
|
dbLocation.ExecuteInsertCommand(dbCommand);
|
||||||
location.Id = new SysId(dbLocation._Id);
|
location.Id = new SysId(dbLocation._Id);
|
||||||
location.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -131,13 +130,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update Location.
|
// Update Location.
|
||||||
public override bool UpdateLocation(SbmLocation location, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdateLocation(SbmLocation location, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdateLocation";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidLocation(location)) return false;
|
if (!IsValidLocation(location)) return false;
|
||||||
if (!SysId.IsValid(location.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(location.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!location.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -155,7 +153,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbLocation, location, dbUpdateInfo);
|
PopulateTo(dbLocation, location, dbUpdateInfo);
|
||||||
dbLocation.ExecuteUpdateCommand(dbCommand);
|
dbLocation.ExecuteUpdateCommand(dbCommand);
|
||||||
location.Changed = false;
|
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.
|
// Record updates.
|
||||||
updateLogMonitor.RecordUpdatedValues(location);
|
updateLogMonitor.RecordUpdatedValues(location);
|
||||||
@@ -176,7 +174,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
}
|
}
|
||||||
public override bool DeleteLocation(SbmLocation location, DbUpdateInfo dbUpdateInfo)
|
public override bool DeleteLocation(SbmLocation location, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeleteLocation";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!LocationCanBeDeleted(location)) return false;
|
if (!LocationCanBeDeleted(location)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Location) + " WHERE Id=" + SysId.ToString(location.Id) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
location.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,7 +221,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Insert Movement.
|
// Insert Movement.
|
||||||
public override bool InsertMovement(SbmMovement movement, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertMovement(SbmMovement movement, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".InsertMovement";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidMovement(movement)) return false;
|
if (!IsValidMovement(movement)) return false;
|
||||||
if (SysId.IsValid(movement.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
if (SysId.IsValid(movement.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
@@ -241,7 +240,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbMovement.ExecuteInsertCommand(dbCommand);
|
dbMovement.ExecuteInsertCommand(dbCommand);
|
||||||
movement.Id = new SysId(dbMovement._Id);
|
movement.Id = new SysId(dbMovement._Id);
|
||||||
movement.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -252,13 +251,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update Movement.
|
// Update Movement.
|
||||||
public override bool UpdateMovement(SbmMovement movement, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdateMovement(SbmMovement movement, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdateMovement";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidMovement(movement)) return false;
|
if (!IsValidMovement(movement)) return false;
|
||||||
if (!SysId.IsValid(movement.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(movement.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!movement.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -276,7 +274,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbMovement, movement, dbUpdateInfo);
|
PopulateTo(dbMovement, movement, dbUpdateInfo);
|
||||||
dbMovement.ExecuteUpdateCommand(dbCommand);
|
dbMovement.ExecuteUpdateCommand(dbCommand);
|
||||||
movement.Changed = false;
|
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.
|
// Record updates.
|
||||||
updateLogMonitor.RecordUpdatedValues(movement);
|
updateLogMonitor.RecordUpdatedValues(movement);
|
||||||
@@ -297,7 +295,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
}
|
}
|
||||||
public override bool DeleteMovement(SbmMovement movement, DbUpdateInfo dbUpdateInfo)
|
public override bool DeleteMovement(SbmMovement movement, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeleteMovement";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!MovementCanBeDeleted(movement)) return false;
|
if (!MovementCanBeDeleted(movement)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Movement) + " WHERE Id=" + SysId.ToString(movement.Id) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
movement.Changed = false;
|
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); }
|
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>
|
/// <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)
|
public override List<DataItem> GetPeriodTimeBooked(SysId affiliateIdEmployee, DateTime periodStart, DateTime periodEnd, SaUomType uomPeriod)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".GetPeriodTimeBooked";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
List<DataItem> dataItems = new List<DataItem>();
|
List<DataItem> dataItems = new List<DataItem>();
|
||||||
if (!SysId.IsValid(affiliateIdEmployee))
|
if (!SysId.IsValid(affiliateIdEmployee))
|
||||||
@@ -181,7 +180,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
SaLogger.Warn(fn + " Period unit defaulted to working week.");
|
SaLogger.Warn($"{SysUtil.Fn} Period unit defaulted to working week.");
|
||||||
#endif
|
#endif
|
||||||
uomPeriod = SaUomType.Time_WorkingWeek;
|
uomPeriod = SaUomType.Time_WorkingWeek;
|
||||||
break;
|
break;
|
||||||
@@ -369,7 +368,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Insert Constituent.
|
// Insert Constituent.
|
||||||
public override bool InsertConstituent(SbmConstituent constituent, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertConstituent(SbmConstituent constituent, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".InsertConstituent";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidConstituent(constituent)) return false;
|
if (!IsValidConstituent(constituent)) return false;
|
||||||
if (SysId.IsValid(constituent.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
if (SysId.IsValid(constituent.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
@@ -389,7 +387,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbConstituent.ExecuteInsertCommand(dbCommand);
|
dbConstituent.ExecuteInsertCommand(dbCommand);
|
||||||
constituent.Id = new SysId(dbConstituent._Id);
|
constituent.Id = new SysId(dbConstituent._Id);
|
||||||
constituent.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -400,13 +398,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update Constituent.
|
// Update Constituent.
|
||||||
public override bool UpdateConstituent(SbmConstituent constituent, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdateConstituent(SbmConstituent constituent, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdateConstituent";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidConstituent(constituent)) return false;
|
if (!IsValidConstituent(constituent)) return false;
|
||||||
if (!SysId.IsValid(constituent.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(constituent.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!constituent.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -424,7 +421,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbConstituent, constituent, dbUpdateInfo);
|
PopulateTo(dbConstituent, constituent, dbUpdateInfo);
|
||||||
dbConstituent.ExecuteUpdateCommand(dbCommand);
|
dbConstituent.ExecuteUpdateCommand(dbCommand);
|
||||||
constituent.Changed = false;
|
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.
|
// Record updates.
|
||||||
updateLogMonitor.RecordUpdatedValues(constituent);
|
updateLogMonitor.RecordUpdatedValues(constituent);
|
||||||
@@ -445,7 +442,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
}
|
}
|
||||||
public override bool DeleteConstituent(SbmConstituent constituent, DbUpdateInfo dbUpdateInfo)
|
public override bool DeleteConstituent(SbmConstituent constituent, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeleteConstituent";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!ConstituentCanBeDeleted(constituent)) return false;
|
if (!ConstituentCanBeDeleted(constituent)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Constituent) + " WHERE Id=" + SysId.ToString(constituent.Id) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
constituent.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -432,7 +432,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Insert Requirement.
|
// Insert Requirement.
|
||||||
public override bool InsertRequirement(SbmRequirement requirement, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertRequirement(SbmRequirement requirement, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".InsertRequirement";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidRequirement(requirement)) return false;
|
if (!IsValidRequirement(requirement)) return false;
|
||||||
if (SysId.IsValid(requirement.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
if (SysId.IsValid(requirement.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
@@ -452,7 +451,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbRequirement.ExecuteInsertCommand(dbCommand);
|
dbRequirement.ExecuteInsertCommand(dbCommand);
|
||||||
requirement.Id = new SysId(dbRequirement._Id);
|
requirement.Id = new SysId(dbRequirement._Id);
|
||||||
requirement.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -463,13 +462,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update Requirement.
|
// Update Requirement.
|
||||||
public override bool UpdateRequirement(SbmRequirement requirement, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdateRequirement(SbmRequirement requirement, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdateRequirement";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidRequirement(requirement)) return false;
|
if (!IsValidRequirement(requirement)) return false;
|
||||||
if (!SysId.IsValid(requirement.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(requirement.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!requirement.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -487,7 +485,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbRequirement, requirement, dbUpdateInfo);
|
PopulateTo(dbRequirement, requirement, dbUpdateInfo);
|
||||||
dbRequirement.ExecuteUpdateCommand(dbCommand);
|
dbRequirement.ExecuteUpdateCommand(dbCommand);
|
||||||
requirement.Changed = false;
|
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.
|
// Record updates.
|
||||||
updateLogMonitor.RecordUpdatedValues(requirement);
|
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)
|
public override bool DeleteRequirement(SbmRequirement requirement, Sbm.TransactionType transactionType, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeleteRequirement";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!RequirementCanBeDeleted(requirement, transactionType)) return false;
|
if (!RequirementCanBeDeleted(requirement, transactionType)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Requirement) + " WHERE Id=" + SysId.ToString(requirement.Id) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
requirement.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -492,7 +492,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Insert Transaction.
|
// Insert Transaction.
|
||||||
public override bool InsertTransaction(SbmTransaction transaction, DbUpdateInfo dbUpdateInfo)
|
public override bool InsertTransaction(SbmTransaction transaction, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".InsertTransaction";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidTransaction(transaction)) return false;
|
if (!IsValidTransaction(transaction)) return false;
|
||||||
if (SysId.IsValid(transaction.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
if (SysId.IsValid(transaction.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
@@ -512,7 +511,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
dbTransaction.ExecuteInsertCommand(dbCommand);
|
dbTransaction.ExecuteInsertCommand(dbCommand);
|
||||||
transaction.Id = new SysId(dbTransaction._Id);
|
transaction.Id = new SysId(dbTransaction._Id);
|
||||||
transaction.Changed = false;
|
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); }
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
}
|
}
|
||||||
@@ -523,13 +522,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
// Update Transaction.
|
// Update Transaction.
|
||||||
public override bool UpdateTransaction(SbmTransaction transaction, DbUpdateInfo dbUpdateInfo)
|
public override bool UpdateTransaction(SbmTransaction transaction, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".UpdateTransaction";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!IsValidTransaction(transaction)) return false;
|
if (!IsValidTransaction(transaction)) return false;
|
||||||
if (!SysId.IsValid(transaction.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
if (!SysId.IsValid(transaction.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
if (!transaction.Changed)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
using (var dbConnection = db.CreateConnection())
|
using (var dbConnection = db.CreateConnection())
|
||||||
@@ -547,7 +545,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
PopulateTo(dbTransaction, transaction, dbUpdateInfo);
|
PopulateTo(dbTransaction, transaction, dbUpdateInfo);
|
||||||
dbTransaction.ExecuteUpdateCommand(dbCommand);
|
dbTransaction.ExecuteUpdateCommand(dbCommand);
|
||||||
transaction.Changed = false;
|
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.
|
// Record updates.
|
||||||
updateLogMonitor.RecordUpdatedValues(transaction);
|
updateLogMonitor.RecordUpdatedValues(transaction);
|
||||||
@@ -596,7 +594,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
|||||||
}
|
}
|
||||||
public override bool DeleteTransaction(SbmTransaction transaction, DbUpdateInfo dbUpdateInfo)
|
public override bool DeleteTransaction(SbmTransaction transaction, DbUpdateInfo dbUpdateInfo)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".DeleteTransaction";
|
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!TransactionCanBeDeleted(transaction)) return false;
|
if (!TransactionCanBeDeleted(transaction)) return false;
|
||||||
using (var dbConnection = db.CreateConnection())
|
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.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Transaction) + " WHERE Id=" + SysId.ToString(transaction.Id) + ";";
|
||||||
dbCommand.ExecuteNonQuery();
|
dbCommand.ExecuteNonQuery();
|
||||||
transaction.Changed = false;
|
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); }
|
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.
|
// 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)
|
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>();
|
List<Sbm.TransactionType> transactionTypes = new List<Sbm.TransactionType>();
|
||||||
if (!SysId.IsValid(commodityId)) return transactionTypes;
|
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));
|
joinReqnt.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_CommodityId, aliasReqnt) + "=" + SysId.ToString(commodityId));
|
||||||
qry.Joins.Add(joinReqnt);
|
qry.Joins.Add(joinReqnt);
|
||||||
// Execute the query.
|
// 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()))
|
using (DbResultSet dbResultSet = DbResultSet_DataReader.ExecuteQuery(db, qry.ToString()))
|
||||||
{
|
{
|
||||||
while (!HasErrorState() && dbResultSet != null && dbResultSet.NextRecord())
|
while (!HasErrorState() && dbResultSet != null && dbResultSet.NextRecord())
|
||||||
{
|
{
|
||||||
NamedValue.Map values = dbResultSet.GetRecordValues();
|
NamedValue.Map values = dbResultSet.GetRecordValues();
|
||||||
Sbm.TransactionType transactionType = (Sbm.TransactionType)StringUtil.ToShort(values.GetValue(colTransactionType));
|
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.
|
// Add this transaction type to the list.
|
||||||
if (!transactionTypes.Contains(transactionType))
|
if (!transactionTypes.Contains(transactionType))
|
||||||
transactionTypes.Add(transactionType);
|
transactionTypes.Add(transactionType);
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Account
|
|||||||
[Route("Account/UserAccount/Ajax/GetUserList")]
|
[Route("Account/UserAccount/Ajax/GetUserList")]
|
||||||
public IActionResult Ajax_GetUserList(Model_UserAccount model)
|
public IActionResult Ajax_GetUserList(Model_UserAccount model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetUserList";
|
|
||||||
String messageTitle = Localiser["label.users"];
|
String messageTitle = Localiser["label.users"];
|
||||||
AjaxResponse_UserList responseData = new AjaxResponse_UserList(model);
|
AjaxResponse_UserList responseData = new AjaxResponse_UserList(model);
|
||||||
|
|
||||||
@@ -173,7 +172,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Account
|
|||||||
[Route("Account/UserAccount/Ajax/GetUser")]
|
[Route("Account/UserAccount/Ajax/GetUser")]
|
||||||
public IActionResult Ajax_GetUser(Model_UserAccount model)
|
public IActionResult Ajax_GetUser(Model_UserAccount model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetUser";
|
|
||||||
String messageTitle = Localiser["label.user"];
|
String messageTitle = Localiser["label.user"];
|
||||||
AjaxResponse_User responseData = new AjaxResponse_User(model);
|
AjaxResponse_User responseData = new AjaxResponse_User(model);
|
||||||
|
|
||||||
@@ -214,7 +212,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Account
|
|||||||
[Route("Account/UserAccount/Ajax/GetUserByEmail")]
|
[Route("Account/UserAccount/Ajax/GetUserByEmail")]
|
||||||
public IActionResult Ajax_GetUserByEmail(Model_UserAccount model)
|
public IActionResult Ajax_GetUserByEmail(Model_UserAccount model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetUserByEmail";
|
|
||||||
String messageTitle = Localiser["label.user"];
|
String messageTitle = Localiser["label.user"];
|
||||||
AjaxResponse_User responseData = new AjaxResponse_User(model);
|
AjaxResponse_User responseData = new AjaxResponse_User(model);
|
||||||
StoreSessionData = false;
|
StoreSessionData = false;
|
||||||
@@ -259,7 +256,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Account
|
|||||||
[Route("Account/UserAccount/Ajax/StoreUser")]
|
[Route("Account/UserAccount/Ajax/StoreUser")]
|
||||||
public IActionResult Ajax_StoreUser(Model_UserAccount model)
|
public IActionResult Ajax_StoreUser(Model_UserAccount model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_StoreUser";
|
|
||||||
String messageTitle = Localiser["label.user"];
|
String messageTitle = Localiser["label.user"];
|
||||||
AjaxResponse_User responseData = new AjaxResponse_User(model);
|
AjaxResponse_User responseData = new AjaxResponse_User(model);
|
||||||
|
|
||||||
@@ -357,7 +353,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Account
|
|||||||
[Route("Account/UserAccount/Ajax/SendEmails")]
|
[Route("Account/UserAccount/Ajax/SendEmails")]
|
||||||
public IActionResult Ajax_SendEmails(Model_UserAccount model)
|
public IActionResult Ajax_SendEmails(Model_UserAccount model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_SendEmails";
|
|
||||||
String messageTitle = Localiser["label.emails"];
|
String messageTitle = Localiser["label.emails"];
|
||||||
AjaxResponse_User responseData = new AjaxResponse_User(model);
|
AjaxResponse_User responseData = new AjaxResponse_User(model);
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
|||||||
[Route("Instance/Owner/Ajax/GetOwnerList")]
|
[Route("Instance/Owner/Ajax/GetOwnerList")]
|
||||||
public IActionResult Ajax_GetOwnerList(Model_Owner model)
|
public IActionResult Ajax_GetOwnerList(Model_Owner model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetOwnerList";
|
|
||||||
String messageTitle = Localiser["label.owners"];
|
String messageTitle = Localiser["label.owners"];
|
||||||
AjaxResponse_OwnerList responseData = new AjaxResponse_OwnerList(model);
|
AjaxResponse_OwnerList responseData = new AjaxResponse_OwnerList(model);
|
||||||
|
|
||||||
@@ -157,7 +156,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
|||||||
[Route("Instance/Owner/Ajax/GetOwner")]
|
[Route("Instance/Owner/Ajax/GetOwner")]
|
||||||
public IActionResult Ajax_GetOwner(Model_Owner model)
|
public IActionResult Ajax_GetOwner(Model_Owner model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetOwner";
|
|
||||||
String messageTitle = Localiser["label.owner"];
|
String messageTitle = Localiser["label.owner"];
|
||||||
AjaxResponse_Owner responseData = new AjaxResponse_Owner(model);
|
AjaxResponse_Owner responseData = new AjaxResponse_Owner(model);
|
||||||
|
|
||||||
@@ -199,7 +197,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
|||||||
[Route("Instance/Owner/Ajax/StoreOwner")]
|
[Route("Instance/Owner/Ajax/StoreOwner")]
|
||||||
public IActionResult Ajax_StoreOwner(Model_Owner model)
|
public IActionResult Ajax_StoreOwner(Model_Owner model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_StoreOwner";
|
|
||||||
String messageTitle = Localiser["label.owner"];
|
String messageTitle = Localiser["label.owner"];
|
||||||
AjaxResponse_Owner responseData = new AjaxResponse_Owner(model);
|
AjaxResponse_Owner responseData = new AjaxResponse_Owner(model);
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
|||||||
[Route("Instance/Repository/Ajax/GetRepositoryList")]
|
[Route("Instance/Repository/Ajax/GetRepositoryList")]
|
||||||
public IActionResult Ajax_GetRepositoryList(Model_Repository model)
|
public IActionResult Ajax_GetRepositoryList(Model_Repository model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetRepositoryList";
|
|
||||||
String messageTitle = Localiser["label.repositories"];
|
String messageTitle = Localiser["label.repositories"];
|
||||||
AjaxResponse_RepositoryList responseData = new AjaxResponse_RepositoryList(model);
|
AjaxResponse_RepositoryList responseData = new AjaxResponse_RepositoryList(model);
|
||||||
|
|
||||||
@@ -156,7 +155,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
|||||||
[Route("Instance/Repository/Ajax/GetRepository")]
|
[Route("Instance/Repository/Ajax/GetRepository")]
|
||||||
public IActionResult Ajax_GetRepository(Model_Repository model)
|
public IActionResult Ajax_GetRepository(Model_Repository model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetRepository";
|
|
||||||
String messageTitle = Localiser["label.repository"];
|
String messageTitle = Localiser["label.repository"];
|
||||||
AjaxResponse_Repository responseData = new AjaxResponse_Repository(model);
|
AjaxResponse_Repository responseData = new AjaxResponse_Repository(model);
|
||||||
|
|
||||||
@@ -207,7 +205,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
|||||||
[Route("Instance/Repository/Ajax/StoreRepository")]
|
[Route("Instance/Repository/Ajax/StoreRepository")]
|
||||||
public IActionResult Ajax_StoreRepository(Model_Repository model)
|
public IActionResult Ajax_StoreRepository(Model_Repository model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_StoreRepository";
|
|
||||||
String messageTitle = Localiser["label.repository"];
|
String messageTitle = Localiser["label.repository"];
|
||||||
AjaxResponse_Repository responseData = new AjaxResponse_Repository(model);
|
AjaxResponse_Repository responseData = new AjaxResponse_Repository(model);
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers
|
|||||||
[HttpGet, HttpPost]
|
[HttpGet, HttpPost]
|
||||||
public IActionResult ChangePassword(Model_Security model)
|
public IActionResult ChangePassword(Model_Security model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".ChangePassword";
|
|
||||||
bool validSessionRequired = true;
|
bool validSessionRequired = true;
|
||||||
|
|
||||||
if (Request.Method.EqualsCI(HttpMethods.Get))
|
if (Request.Method.EqualsCI(HttpMethods.Get))
|
||||||
@@ -79,19 +78,19 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers
|
|||||||
model.rpe = encryptedParams;
|
model.rpe = encryptedParams;
|
||||||
validSessionRequired = false;
|
validSessionRequired = false;
|
||||||
}
|
}
|
||||||
else SaLogger.Warn(fn + " 'Request Password' parameters supplied but invalid. " + logSuffix);
|
else SaLogger.Warn($"{SysUtil.Fn} 'Request Password' parameters supplied but invalid. {logSuffix}");
|
||||||
}
|
}
|
||||||
else SaLogger.Warn(fn + " 'Request Password' parameters supplied but account is not active. " + logSuffix);
|
else SaLogger.Warn($"{SysUtil.Fn} 'Request Password' parameters supplied but account is not active. {logSuffix}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// User Account not found - redirect to Portal application.
|
// User Account not found - redirect to Portal application.
|
||||||
String redirectParamName = ParamName_RequestPasswordEncrypted + "2";
|
String redirectParamName = ParamName_RequestPasswordEncrypted + "2";
|
||||||
SaLogger.Warn(fn + " 'Request Password' parameters supplied but account is not 'Admin'. " + logSuffix);
|
SaLogger.Warn($"{SysUtil.Fn} 'Request Password' parameters supplied but account is not 'Admin'. {logSuffix}");
|
||||||
if (!Request.Query.Keys.Contains(redirectParamName) && !StringUtil.IsEmpty(AppConfig.URL.Portal.Root))
|
if (!Request.Query.Keys.Contains(redirectParamName) && !StringUtil.IsEmpty(AppConfig.URL.Portal.Root))
|
||||||
{
|
{
|
||||||
UriBuilder uri = new UriBuilder(Regex.Replace(AppConfig.URL.Portal.Root, "/$", "") + "/Security/ChangePassword");
|
UriBuilder uri = new UriBuilder(Regex.Replace(AppConfig.URL.Portal.Root, "/$", "") + "/Security/ChangePassword");
|
||||||
uri.Query = ParamName_RequestPasswordEncrypted + "=" + Uri.EscapeDataString(encryptedParams) + "&" + redirectParamName;
|
uri.Query = $"{ParamName_RequestPasswordEncrypted}={Uri.EscapeDataString(encryptedParams)}&{redirectParamName}";
|
||||||
return Redirect(uri.Uri.OriginalString);
|
return Redirect(uri.Uri.OriginalString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,12 +109,12 @@ table.sbmc-striped
|
|||||||
|
|
||||||
table.sbmc-striped tr.sbmc-odd
|
table.sbmc-striped tr.sbmc-odd
|
||||||
{
|
{
|
||||||
background-color:#fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.sbmc-striped tr.sbmc-even
|
table.sbmc-striped tr.sbmc-even
|
||||||
{
|
{
|
||||||
background-color:#f8f8f8;
|
background-color: #f8f8f8;
|
||||||
}
|
}
|
||||||
|
|
||||||
th, td
|
th, td
|
||||||
@@ -215,7 +215,32 @@ td.action
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fullwidth
|
.width5pc
|
||||||
|
{
|
||||||
|
width: 5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.width10pc
|
||||||
|
{
|
||||||
|
width: 10%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.width20pc
|
||||||
|
{
|
||||||
|
width: 20%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.width25pc
|
||||||
|
{
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.width50pc
|
||||||
|
{
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fullwidth, .width100pc
|
||||||
{
|
{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
@@ -409,9 +434,9 @@ td.action
|
|||||||
z-index: 99;
|
z-index: 99;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hidden
|
.hidden, .sbm-hidden
|
||||||
{
|
{
|
||||||
display: none;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.shadow
|
.shadow
|
||||||
|
|||||||
@@ -13,10 +13,6 @@
|
|||||||
--color-primary: #4b0082;
|
--color-primary: #4b0082;
|
||||||
--color-light: #9b71b9;
|
--color-light: #9b71b9;
|
||||||
--color-pale: #ebe2f1;
|
--color-pale: #ebe2f1;
|
||||||
/* Tetrad/Square colors */
|
|
||||||
--color-alt1: #820a00;
|
|
||||||
--color-alt2: #378200;
|
|
||||||
--color-alt3: #007882;
|
|
||||||
/* Data panels */
|
/* Data panels */
|
||||||
--color-panel-data: var(--color-Purple);
|
--color-panel-data: var(--color-Purple);
|
||||||
--color-panel-data-background: var(--color-Purple);
|
--color-panel-data-background: var(--color-Purple);
|
||||||
@@ -391,7 +387,7 @@ a:focus
|
|||||||
|
|
||||||
.ui-dialog.no-close .ui-dialog-titlebar-close
|
.ui-dialog.no-close .ui-dialog-titlebar-close
|
||||||
{
|
{
|
||||||
/*display: none;*/
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-dialog .ui-dialog-buttonpane
|
.ui-dialog .ui-dialog-buttonpane
|
||||||
|
|||||||
@@ -219,7 +219,7 @@
|
|||||||
sbc.$dlg.alert = $('<div id="dlgAlert"><div id="dlgAlertMsg"></div></div>').dialog(opt);
|
sbc.$dlg.alert = $('<div id="dlgAlert"><div id="dlgAlertMsg"></div></div>').dialog(opt);
|
||||||
}
|
}
|
||||||
$('#dlgAlertMsg', sbc.$dlg.alert).html(msg.replace(/\\n/g, '<br>'));
|
$('#dlgAlertMsg', sbc.$dlg.alert).html(msg.replace(/\\n/g, '<br>'));
|
||||||
let btns = [];
|
let btns = {};
|
||||||
btns[sbc.lbl.ok] = function () { $(this).dialog('close'); if (onOk) onOk(); };
|
btns[sbc.lbl.ok] = function () { $(this).dialog('close'); if (onOk) onOk(); };
|
||||||
sbc.$dlg.alert.dialog('option', { title: title || sbc.dlg.title.alert, buttons: btns });
|
sbc.$dlg.alert.dialog('option', { title: title || sbc.dlg.title.alert, buttons: btns });
|
||||||
sbc.openDialog(sbc.$dlg.alert);
|
sbc.openDialog(sbc.$dlg.alert);
|
||||||
@@ -236,7 +236,7 @@
|
|||||||
var opt = sbc.dlgOpts();
|
var opt = sbc.dlgOpts();
|
||||||
sbc.$dlg.confirm = $('<div id="dlgConfirm"><div class="spacer2"></div><div id="dlgConfirmMsg"></div></div>').dialog(opt);
|
sbc.$dlg.confirm = $('<div id="dlgConfirm"><div class="spacer2"></div><div id="dlgConfirmMsg"></div></div>').dialog(opt);
|
||||||
}
|
}
|
||||||
var btns = [];
|
let btns = {};
|
||||||
btns[sbc.lbl.yes] = function () { $(this).dialog('close'); if (onOk) onOk(); };
|
btns[sbc.lbl.yes] = function () { $(this).dialog('close'); if (onOk) onOk(); };
|
||||||
btns[sbc.lbl.no] = function () { $(this).dialog('close'); if (onCancel) onCancel(); };
|
btns[sbc.lbl.no] = function () { $(this).dialog('close'); if (onCancel) onCancel(); };
|
||||||
sbc.$dlg.confirm.dialog('option', { title: title || sbc.dlg.title.confirm, buttons: btns });
|
sbc.$dlg.confirm.dialog('option', { title: title || sbc.dlg.title.confirm, buttons: btns });
|
||||||
|
|||||||
@@ -591,4 +591,22 @@
|
|||||||
<data name="label.email.domain" xml:space="preserve">
|
<data name="label.email.domain" xml:space="preserve">
|
||||||
<value>Email domain</value>
|
<value>Email domain</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="caption.customer.create" xml:space="preserve">
|
||||||
|
<value>Create Customer</value>
|
||||||
|
</data>
|
||||||
|
<data name="caption.supplier.create" xml:space="preserve">
|
||||||
|
<value>Create Supplier</value>
|
||||||
|
</data>
|
||||||
|
<data name="caption.supplier.update" xml:space="preserve">
|
||||||
|
<value>Update Supplier</value>
|
||||||
|
</data>
|
||||||
|
<data name="caption.customer.update" xml:space="preserve">
|
||||||
|
<value>Update Customer</value>
|
||||||
|
</data>
|
||||||
|
<data name="label.organisation" xml:space="preserve">
|
||||||
|
<value>Organisation</value>
|
||||||
|
</data>
|
||||||
|
<data name="label.reference.external" xml:space="preserve">
|
||||||
|
<value>Ext. reference</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -69,7 +69,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
|
|||||||
[Route("Assets/AssetCategory/Ajax/GetAssetCategoryList")]
|
[Route("Assets/AssetCategory/Ajax/GetAssetCategoryList")]
|
||||||
public IActionResult Ajax_GetAssetCategoryList(Model_AssetCategory model)
|
public IActionResult Ajax_GetAssetCategoryList(Model_AssetCategory model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetAssetCategoryList";
|
|
||||||
String messageTitle = Localiser["caption.asset.categories"];
|
String messageTitle = Localiser["caption.asset.categories"];
|
||||||
AjaxResponse_AssetCategoryList responseData = new AjaxResponse_AssetCategoryList(model);
|
AjaxResponse_AssetCategoryList responseData = new AjaxResponse_AssetCategoryList(model);
|
||||||
|
|
||||||
@@ -154,7 +153,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
|
|||||||
[Route("Assets/AssetCategory/Ajax/GetAssetCategory")]
|
[Route("Assets/AssetCategory/Ajax/GetAssetCategory")]
|
||||||
public IActionResult Ajax_GetAssetCategory(Model_AssetCategory model)
|
public IActionResult Ajax_GetAssetCategory(Model_AssetCategory model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetAssetCategory";
|
|
||||||
String messageTitle = Localiser["caption.asset.category"];
|
String messageTitle = Localiser["caption.asset.category"];
|
||||||
AjaxResponse_AssetCategory responseData = new AjaxResponse_AssetCategory(model);
|
AjaxResponse_AssetCategory responseData = new AjaxResponse_AssetCategory(model);
|
||||||
|
|
||||||
@@ -196,7 +194,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
|
|||||||
[Route("Assets/AssetCategory/Ajax/StoreAssetCategory")]
|
[Route("Assets/AssetCategory/Ajax/StoreAssetCategory")]
|
||||||
public IActionResult Ajax_StoreAssetCategory(Model_AssetCategory model)
|
public IActionResult Ajax_StoreAssetCategory(Model_AssetCategory model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_StoreAssetCategory";
|
|
||||||
String messageTitle = Localiser["caption.asset.category"];
|
String messageTitle = Localiser["caption.asset.category"];
|
||||||
AjaxResponse_AssetCategory responseData = new AjaxResponse_AssetCategory(model);
|
AjaxResponse_AssetCategory responseData = new AjaxResponse_AssetCategory(model);
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
|
|||||||
[Route("Assets/Asset/Ajax/GetAssetList")]
|
[Route("Assets/Asset/Ajax/GetAssetList")]
|
||||||
public IActionResult Ajax_GetAssetList(Model_Asset model)
|
public IActionResult Ajax_GetAssetList(Model_Asset model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetAssetList";
|
|
||||||
String messageTitle = Localiser["label.assets"];
|
String messageTitle = Localiser["label.assets"];
|
||||||
AjaxResponse_AssetList responseData = new AjaxResponse_AssetList(model);
|
AjaxResponse_AssetList responseData = new AjaxResponse_AssetList(model);
|
||||||
|
|
||||||
@@ -160,7 +159,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
|
|||||||
[Route("Assets/Asset/Ajax/GetAsset")]
|
[Route("Assets/Asset/Ajax/GetAsset")]
|
||||||
public IActionResult Ajax_GetAsset(Model_Asset model)
|
public IActionResult Ajax_GetAsset(Model_Asset model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetAsset";
|
|
||||||
String messageTitle = Localiser["label.asset"];
|
String messageTitle = Localiser["label.asset"];
|
||||||
AjaxResponse_Asset responseData = new AjaxResponse_Asset(model);
|
AjaxResponse_Asset responseData = new AjaxResponse_Asset(model);
|
||||||
|
|
||||||
@@ -211,7 +209,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
|
|||||||
[Route("Assets/Asset/Ajax/StoreAsset")]
|
[Route("Assets/Asset/Ajax/StoreAsset")]
|
||||||
public IActionResult Ajax_StoreAsset(Model_Asset model)
|
public IActionResult Ajax_StoreAsset(Model_Asset model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_StoreAsset";
|
|
||||||
String messageTitle = Localiser["label.asset"];
|
String messageTitle = Localiser["label.asset"];
|
||||||
AjaxResponse_Asset responseData = new AjaxResponse_Asset(model);
|
AjaxResponse_Asset responseData = new AjaxResponse_Asset(model);
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
|
|||||||
[Route("Assets/VehicleClass/Ajax/GetVehicleClassList")]
|
[Route("Assets/VehicleClass/Ajax/GetVehicleClassList")]
|
||||||
public IActionResult Ajax_GetVehicleClassList(Model_VehicleClass model)
|
public IActionResult Ajax_GetVehicleClassList(Model_VehicleClass model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetVehicleClassList";
|
|
||||||
String messageTitle = Localiser["caption.vehicle.classes"];
|
String messageTitle = Localiser["caption.vehicle.classes"];
|
||||||
AjaxResponse_VehicleClassList responseData = new AjaxResponse_VehicleClassList(model);
|
AjaxResponse_VehicleClassList responseData = new AjaxResponse_VehicleClassList(model);
|
||||||
|
|
||||||
@@ -162,7 +161,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
|
|||||||
[Route("Assets/VehicleClass/Ajax/GetVehicleClass")]
|
[Route("Assets/VehicleClass/Ajax/GetVehicleClass")]
|
||||||
public IActionResult Ajax_GetVehicleClass(Model_VehicleClass model)
|
public IActionResult Ajax_GetVehicleClass(Model_VehicleClass model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetVehicleClass";
|
|
||||||
String messageTitle = Localiser["caption.vehicle.class"];
|
String messageTitle = Localiser["caption.vehicle.class"];
|
||||||
AjaxResponse_VehicleClass responseData = new AjaxResponse_VehicleClass(model);
|
AjaxResponse_VehicleClass responseData = new AjaxResponse_VehicleClass(model);
|
||||||
|
|
||||||
@@ -204,7 +202,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
|
|||||||
[Route("Assets/VehicleClass/Ajax/StoreVehicleClass")]
|
[Route("Assets/VehicleClass/Ajax/StoreVehicleClass")]
|
||||||
public IActionResult Ajax_StoreVehicleClass(Model_VehicleClass model)
|
public IActionResult Ajax_StoreVehicleClass(Model_VehicleClass model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_StoreVehicleClass";
|
|
||||||
String messageTitle = Localiser["caption.vehicle.class"];
|
String messageTitle = Localiser["caption.vehicle.class"];
|
||||||
AjaxResponse_VehicleClass responseData = new AjaxResponse_VehicleClass(model);
|
AjaxResponse_VehicleClass responseData = new AjaxResponse_VehicleClass(model);
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
|||||||
[Route("Codes/Code/Ajax/GetCodeList")]
|
[Route("Codes/Code/Ajax/GetCodeList")]
|
||||||
public IActionResult Ajax_GetCodeList(Model_Code model)
|
public IActionResult Ajax_GetCodeList(Model_Code model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetCodeList";
|
|
||||||
String messageTitle = Localiser["label.codes"];
|
String messageTitle = Localiser["label.codes"];
|
||||||
AjaxResponse_CodeList responseData = new AjaxResponse_CodeList(model);
|
AjaxResponse_CodeList responseData = new AjaxResponse_CodeList(model);
|
||||||
|
|
||||||
@@ -163,7 +162,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
|||||||
[Route("Codes/Code/Ajax/GetCode")]
|
[Route("Codes/Code/Ajax/GetCode")]
|
||||||
public IActionResult Ajax_GetCode(Model_Code model)
|
public IActionResult Ajax_GetCode(Model_Code model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetCode";
|
|
||||||
String messageTitle = Localiser["label.code"];
|
String messageTitle = Localiser["label.code"];
|
||||||
AjaxResponse_Code responseData = new AjaxResponse_Code(model);
|
AjaxResponse_Code responseData = new AjaxResponse_Code(model);
|
||||||
|
|
||||||
@@ -214,7 +212,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
|||||||
[Route("Codes/Code/Ajax/StoreCode")]
|
[Route("Codes/Code/Ajax/StoreCode")]
|
||||||
public IActionResult Ajax_StoreCode(Model_Code model)
|
public IActionResult Ajax_StoreCode(Model_Code model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_StoreCode";
|
|
||||||
String messageTitle = Localiser["label.code"];
|
String messageTitle = Localiser["label.code"];
|
||||||
AjaxResponse_Code responseData = new AjaxResponse_Code(model);
|
AjaxResponse_Code responseData = new AjaxResponse_Code(model);
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
|||||||
[Route("Codes/CodeType/Ajax/GetCodeTypeList")]
|
[Route("Codes/CodeType/Ajax/GetCodeTypeList")]
|
||||||
public IActionResult Ajax_GetCodeTypeList(Model_CodeType model)
|
public IActionResult Ajax_GetCodeTypeList(Model_CodeType model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetCodeTypeList";
|
|
||||||
String messageTitle = Localiser["caption.code.types"];
|
String messageTitle = Localiser["caption.code.types"];
|
||||||
AjaxResponse_CodeTypeList responseData = new AjaxResponse_CodeTypeList(model);
|
AjaxResponse_CodeTypeList responseData = new AjaxResponse_CodeTypeList(model);
|
||||||
|
|
||||||
@@ -155,7 +154,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
|||||||
[Route("Codes/CodeType/Ajax/GetCodeType")]
|
[Route("Codes/CodeType/Ajax/GetCodeType")]
|
||||||
public IActionResult Ajax_GetCodeType(Model_CodeType model)
|
public IActionResult Ajax_GetCodeType(Model_CodeType model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetCodeType";
|
|
||||||
String messageTitle = Localiser["caption.asset.category"];
|
String messageTitle = Localiser["caption.asset.category"];
|
||||||
AjaxResponse_CodeType responseData = new AjaxResponse_CodeType(model);
|
AjaxResponse_CodeType responseData = new AjaxResponse_CodeType(model);
|
||||||
|
|
||||||
@@ -197,7 +195,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
|||||||
[Route("Codes/CodeType/Ajax/StoreCodeType")]
|
[Route("Codes/CodeType/Ajax/StoreCodeType")]
|
||||||
public IActionResult Ajax_StoreCodeType(Model_CodeType model)
|
public IActionResult Ajax_StoreCodeType(Model_CodeType model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_StoreCodeType";
|
|
||||||
String messageTitle = Localiser["caption.asset.category"];
|
String messageTitle = Localiser["caption.asset.category"];
|
||||||
AjaxResponse_CodeType responseData = new AjaxResponse_CodeType(model);
|
AjaxResponse_CodeType responseData = new AjaxResponse_CodeType(model);
|
||||||
|
|
||||||
|
|||||||
+6
-9
@@ -175,7 +175,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Commodities
|
|||||||
[Route("Commodity/Ajax/GetList")]
|
[Route("Commodity/Ajax/GetList")]
|
||||||
public IActionResult Ajax_CommodityList(Model_Commodity model)
|
public IActionResult Ajax_CommodityList(Model_Commodity model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_CommodityList";
|
|
||||||
AjaxResponse_CommodityList responseData = new AjaxResponse_CommodityList(model);
|
AjaxResponse_CommodityList responseData = new AjaxResponse_CommodityList(model);
|
||||||
String messageTitle = Localiser["caption.commodities"];
|
String messageTitle = Localiser["caption.commodities"];
|
||||||
|
|
||||||
@@ -303,7 +302,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Commodities
|
|||||||
[Route("Commodity/Ajax/GetItem")]
|
[Route("Commodity/Ajax/GetItem")]
|
||||||
public IActionResult Ajax_GetItem(Model_Commodity model)
|
public IActionResult Ajax_GetItem(Model_Commodity model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetItem";
|
|
||||||
String messageTitle = Localiser["caption.commodity"];
|
String messageTitle = Localiser["caption.commodity"];
|
||||||
AjaxResponse_Commodity responseData = new AjaxResponse_Commodity(model);
|
AjaxResponse_Commodity responseData = new AjaxResponse_Commodity(model);
|
||||||
|
|
||||||
@@ -321,7 +319,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Commodities
|
|||||||
SbmCommodity commodity = CommodityMgr.GetCommodityById(commodityId);
|
SbmCommodity commodity = CommodityMgr.GetCommodityById(commodityId);
|
||||||
if (commodity == null)
|
if (commodity == null)
|
||||||
{
|
{
|
||||||
SaLogger.Warn(fn + " Failed to retrieve commodity for Id: '" + model.Commodity.Id + "'");
|
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve commodity for Id: '{model.Commodity.Id}'");
|
||||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,7 +340,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Commodities
|
|||||||
[Route("Commodity/Ajax/StoreItem")]
|
[Route("Commodity/Ajax/StoreItem")]
|
||||||
public IActionResult Ajax_StoreItem(Model_Commodity model)
|
public IActionResult Ajax_StoreItem(Model_Commodity model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_StoreItem";
|
|
||||||
String messageTitle = Localiser["caption.commodity"];
|
String messageTitle = Localiser["caption.commodity"];
|
||||||
AjaxResponse_Commodity responseData = new AjaxResponse_Commodity(model);
|
AjaxResponse_Commodity responseData = new AjaxResponse_Commodity(model);
|
||||||
|
|
||||||
@@ -361,12 +358,12 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Commodities
|
|||||||
bool commodityExists = StringUtil.ToBool(model.Commodity.Exists);
|
bool commodityExists = StringUtil.ToBool(model.Commodity.Exists);
|
||||||
if (commodityExists && !SysId.IsValid(commodityId))
|
if (commodityExists && !SysId.IsValid(commodityId))
|
||||||
{
|
{
|
||||||
SaLogger.Warn(fn + " Id not specified for existing Commodity.");
|
SaLogger.Warn($"{SysUtil.Fn} Id not specified for existing Commodity.");
|
||||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||||
}
|
}
|
||||||
if (!commodityExists && SysId.IsValid(commodityId))
|
if (!commodityExists && SysId.IsValid(commodityId))
|
||||||
{
|
{
|
||||||
SaLogger.Warn(fn + " Id specified for new Commodity: '" + model.Commodity.Id + "'");
|
SaLogger.Warn($"{SysUtil.Fn} Id specified for new Commodity: '{model.Commodity.Id}'");
|
||||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,7 +371,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Commodities
|
|||||||
SbmCommodity commodity = CommodityMgr.GetCommodityById(commodityId);
|
SbmCommodity commodity = CommodityMgr.GetCommodityById(commodityId);
|
||||||
if (commodity == null && SysId.IsValid(commodityId))
|
if (commodity == null && SysId.IsValid(commodityId))
|
||||||
{
|
{
|
||||||
SaLogger.Warn(fn + " Failed to retrieve commodity for Id: '" + model.Commodity.Id + "'");
|
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve commodity for Id: '{model.Commodity.Id}'");
|
||||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,7 +401,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Commodities
|
|||||||
{
|
{
|
||||||
if (!CommodityMgr.InsertCommodity(commodity, DbUpdateInfo))
|
if (!CommodityMgr.InsertCommodity(commodity, DbUpdateInfo))
|
||||||
{
|
{
|
||||||
SaLogger.Warn(fn + " Failed to insert commodity: " + CommodityMgr.ErrorStateMessage);
|
SaLogger.Warn($"{SysUtil.Fn} Failed to insert commodity: {CommodityMgr.ErrorStateMessage}");
|
||||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
|
||||||
}
|
}
|
||||||
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
|
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
|
||||||
@@ -413,7 +410,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Commodities
|
|||||||
{
|
{
|
||||||
if (!CommodityMgr.UpdateCommodity(commodity, DbUpdateInfo))
|
if (!CommodityMgr.UpdateCommodity(commodity, DbUpdateInfo))
|
||||||
{
|
{
|
||||||
SaLogger.Warn(fn + " Failed to update commodity [Id:" + SysId.ToString(commodity.Id) + "]: " + CommodityMgr.ErrorStateMessage);
|
SaLogger.Warn($"{SysUtil.Fn} Failed to update commodity [Id:{SysId.ToLong(commodity.Id)}]: {CommodityMgr.ErrorStateMessage}");
|
||||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
|
||||||
}
|
}
|
||||||
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
|
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
|
||||||
|
|||||||
+116
-60
@@ -1,4 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using DocumentFormat.OpenXml.EMMA;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using NPOI.OpenXmlFormats.Dml.Diagram;
|
||||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||||
using Sarand.BusinessMgr.Web.Portal.Models;
|
using Sarand.BusinessMgr.Web.Portal.Models;
|
||||||
@@ -28,6 +30,13 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
|||||||
public String Code { get; set; }
|
public String Code { get; set; }
|
||||||
// Address.
|
// Address.
|
||||||
public String AddressSummary { get; set; }
|
public String AddressSummary { get; set; }
|
||||||
|
// Fields.
|
||||||
|
public class FieldData
|
||||||
|
{
|
||||||
|
// Item property values keyed to match field name.
|
||||||
|
public Dictionary<string, string> Value { get; } = new Dictionary<string, string>();
|
||||||
|
}
|
||||||
|
public FieldData Field { get; } = new FieldData();
|
||||||
}
|
}
|
||||||
private class AssociationItemData : AssociationListData
|
private class AssociationItemData : AssociationListData
|
||||||
{
|
{
|
||||||
@@ -36,60 +45,121 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
|||||||
public String OwnerName { get; set; }
|
public String OwnerName { get; set; }
|
||||||
public String TargetId { get; set; }
|
public String TargetId { get; set; }
|
||||||
public String TypeCode { get; set; }
|
public String TypeCode { get; set; }
|
||||||
public String ReferenceExt { get; set; }
|
|
||||||
public String Group { get; set; }
|
|
||||||
public String DescDetail { get; set; }
|
|
||||||
public String Location { get; set; }
|
|
||||||
public String Role { get; set; }
|
|
||||||
public String PhoneMain { get; set; }
|
|
||||||
public String Email { get; set; }
|
|
||||||
public String NominalCodeDefault { get; set; }
|
|
||||||
}
|
}
|
||||||
private void PopulateAssociationResponseListData(SbmAssociation association, SbmAffiliate affiliateTarget, AssociationListData data)
|
private void PopulateAssociationResponseListData(SbmAssociation association, SbmAffiliate affiliateTarget, AssociationListData data)
|
||||||
{
|
{
|
||||||
data.Id = SysId.ToString(association.Id);
|
data.Id = SysId.ToString(association.Id);
|
||||||
data.TargetName = affiliateTarget.GetDisplayName();
|
|
||||||
data.TypeDesc = Internals.AssociationTypeCodes.GetDescForType(association.AssociationType);
|
|
||||||
data.Code = association.Code;
|
|
||||||
// Common properties.
|
|
||||||
data.Notes = association.Notes;
|
|
||||||
data.StatusCode = association.StatusCode;
|
|
||||||
data.StatusDesc = association.StatusDesc;
|
|
||||||
}
|
}
|
||||||
private void PopulateAssociationResponseItemData(SbmAssociation association, SbmAffiliate affiliateTarget, AssociationItemData data)
|
private void PopulateAssociationResponseItemData(SbmAssociation association, SbmAffiliate affiliateTarget, AssociationItemData data)
|
||||||
{
|
{
|
||||||
// List data.
|
// List data.
|
||||||
PopulateAssociationResponseListData(association, affiliateTarget, data as AssociationListData);
|
PopulateAssociationResponseListData(association, affiliateTarget, data as AssociationListData);
|
||||||
// Association properties.
|
// Association properties.
|
||||||
|
data.OwnerId = SysId.ToString(association.AffiliateIdOwner);
|
||||||
data.TargetId = SysId.ToString(association.AffiliateIdTarget);
|
data.TargetId = SysId.ToString(association.AffiliateIdTarget);
|
||||||
data.TypeCode = Internals.AssociationTypeCodes.GetCodeForType(association.AssociationType);
|
data.TypeCode = Internals.AssociationTypeCodes.GetCodeForType(association.AssociationType);
|
||||||
data.ReferenceExt = association.RefExt;
|
data.TypeDesc = Internals.AssociationTypeCodes.GetDescForType(association.AssociationType);
|
||||||
data.Group = association.Group;
|
// Owner - Check if current organisation.
|
||||||
data.DescDetail = association.DescDetail;
|
if (association.AffiliateIdOwner.Equals(SessionData_Portal.Organisation.AffiliateId))
|
||||||
data.Location = association.Location;
|
data.Field.Value.Add($"{Model_Association.ItemField.Owner}", SessionData_Portal.Organisation.DisplayName);
|
||||||
data.Role = association.Role;
|
else
|
||||||
data.PhoneMain = association.PhoneMain;
|
{
|
||||||
data.Email = association.Email;
|
// REtrieve owner contact details.
|
||||||
data.NominalCodeDefault = association.DefaultNominalCode;
|
using (SbmAffiliate affiliateOwner = AccountMgr.GetAffiliateById(association.AffiliateIdOwner))
|
||||||
// Address.
|
{
|
||||||
//data.AddressSummary = AccountMgr.GetAddressSummaryFor(new ItemId((short)Sbm.ItemType.Affiliate, association.AffiliateIdTarget));
|
if (affiliateOwner != null)
|
||||||
|
data.Field.Value.Add($"{Model_Association.ItemField.Owner}", affiliateOwner.GetDisplayName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.Field.Value.Add($"{Model_Association.ItemField.Target}", affiliateTarget.GetDisplayName());
|
||||||
|
data.Field.Value.Add($"{Model_Association.ItemField.ReferenceExt}", association.RefExt);
|
||||||
|
data.Field.Value.Add($"{Model_Association.ItemField.Group}", association.Group);
|
||||||
|
data.Field.Value.Add($"{Model_Association.ItemField.DescDetail}", association.DescDetail);
|
||||||
|
data.Field.Value.Add($"{Model_Association.ItemField.Location}", association.Location);
|
||||||
|
data.Field.Value.Add($"{Model_Association.ItemField.Role}", association.Role);
|
||||||
|
data.Field.Value.Add($"{Model_Association.ItemField.PhoneMain}", association.PhoneMain);
|
||||||
|
data.Field.Value.Add($"{Model_Association.ItemField.Email}", association.Email);
|
||||||
|
data.Field.Value.Add($"{Model_Association.ItemField.DefaultNominalCode}", association.DefaultNominalCode);
|
||||||
|
// Flags.
|
||||||
|
// Common properties.
|
||||||
|
data.StatusCode = association.StatusCode;
|
||||||
|
data.StatusDesc = association.StatusDesc;
|
||||||
|
// Cleanse field values.
|
||||||
|
data.Field.Value.RemoveAll(item => StringUtil.IsBlank(item.Value));
|
||||||
|
// Populate item list values that might be cleared during update after removing blank values to ensure that blank values are published.
|
||||||
|
data.Field.Value.Add($"{Model_Association.ItemField.Code}", association.Code);
|
||||||
|
data.Field.Value.Add($"{Model_Association.ItemField.Notes}", association.Notes);
|
||||||
|
data.Field.Value.Add($"{Model_Contact.ItemField.UpdatedOn}", Localiser.FormatDate(association.UpdateStamp.On));
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Association configuration.
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
private class AjaxResponse_AssociationConfig : AjaxResponse_Data
|
||||||
|
{
|
||||||
|
// Construction.
|
||||||
|
public AjaxResponse_AssociationConfig(SbmModel_Portal model) : base(model) { }
|
||||||
|
// Configuration.
|
||||||
|
public Model_Association.ListConfigData Config { get; } = new Model_Association.ListConfigData();
|
||||||
|
public Model_Association.ItemConfigData ConfigCust { get; } = new Model_Association.ItemConfigData();
|
||||||
|
public Model_Association.ItemConfigData ConfigSupp { get; } = new Model_Association.ItemConfigData();
|
||||||
|
// Reference data.
|
||||||
|
public List<CodeDesc> AssociationTypes { get; } = new List<CodeDesc>();
|
||||||
|
public List<CodeDesc> Statuses { get; } = new List<CodeDesc>();
|
||||||
|
public String DefaultStatusCode { get; set; }
|
||||||
|
}
|
||||||
|
// Ajax request.
|
||||||
|
[HttpPost]
|
||||||
|
[Route("Association/Ajax/Config")]
|
||||||
|
[Route("Association/Ajax/GetConfig")]
|
||||||
|
public IActionResult Ajax_AssociationConfig(Model_Association model)
|
||||||
|
{
|
||||||
|
AjaxResponse_AssociationConfig responseData = new AjaxResponse_AssociationConfig(model);
|
||||||
|
String messageTitle = Localiser["label.associations"];
|
||||||
|
|
||||||
|
// Validate session and referrer.
|
||||||
|
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||||
|
if (!ValidReferer) return Forbid();
|
||||||
|
RefreshModel(model);
|
||||||
|
|
||||||
|
// Populate configuration data.
|
||||||
|
PopulateAssociationConfig(model, responseData);
|
||||||
|
|
||||||
|
// Complete response.
|
||||||
|
responseData.Success = true;
|
||||||
|
return Json(responseData);
|
||||||
|
}
|
||||||
|
private void PopulateAssociationConfig(Model_Association model, AjaxResponse_AssociationConfig responseData)
|
||||||
|
{
|
||||||
|
// Configuration.
|
||||||
|
model.PopulateListConfig(responseData.Config);
|
||||||
|
model.PopulateItemConfig(responseData.ConfigCust, null, SessionData_Portal.Organisation.AffiliateId, Sbm.AssociationType.Customer);
|
||||||
|
model.PopulateItemConfig(responseData.ConfigSupp, null, SessionData_Portal.Organisation.AffiliateId, Sbm.AssociationType.Supplier);
|
||||||
|
|
||||||
|
// Reference data - types.
|
||||||
|
List<TypeCodeDesc> associationTypes = Internals.AssociationTypeCodes;
|
||||||
|
foreach (Sbm.AssociationType associationType in EnumUtil.GetValues<Sbm.AssociationType>())
|
||||||
|
{
|
||||||
|
if (associationType <= 0 || associationType == Sbm.AssociationType.Internal) continue;
|
||||||
|
if (!SessionConsole.AllowAssociationType(associationType)) continue;
|
||||||
|
responseData.AssociationTypes.Add(associationTypes.GetCodeForType(associationType), Localiser.GetAssociationTypeCaption(associationType));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reference data - statuses.
|
||||||
|
foreach (SaStatus status in SbmAssociation.ValidStatuses.FindAll(item => item != SaStatus.Deleted))
|
||||||
|
responseData.Statuses.Add(SacsSystem.GetStatusCode(status), Localiser.GetStatusCaption(status));
|
||||||
|
responseData.DefaultStatusCode = SacsSystem.GetStatusCode(SbmAssociation.DefaultStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Association list.
|
// Association list.
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
private class AjaxResponse_AssociationList : AjaxResponse_Data
|
private class AjaxResponse_AssociationList : AjaxResponse_AssociationConfig
|
||||||
{
|
{
|
||||||
// Construction.
|
// Construction.
|
||||||
public AjaxResponse_AssociationList(SbmModel_Portal model) : base(model) { }
|
public AjaxResponse_AssociationList(SbmModel_Portal model) : base(model) { }
|
||||||
// Configuration.
|
|
||||||
public Model_Association.ListConfigData Config { get; } = new Model_Association.ListConfigData();
|
|
||||||
// Association list.
|
// Association list.
|
||||||
public List<AssociationListData> Associations { get; } = new List<AssociationListData>();
|
public List<AssociationListData> Associations { get; } = new List<AssociationListData>();
|
||||||
// Reference data.
|
|
||||||
public List<CodeDesc> AssociationTypes { get; } = new List<CodeDesc>();
|
|
||||||
public List<CodeDesc> Statuses { get; } = new List<CodeDesc>();
|
|
||||||
public String DefaultStatusCode { get; set; }
|
|
||||||
}
|
}
|
||||||
// Ajax request.
|
// Ajax request.
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
@@ -105,22 +175,8 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
|||||||
if (!ValidReferer) return Forbid();
|
if (!ValidReferer) return Forbid();
|
||||||
RefreshModel(model);
|
RefreshModel(model);
|
||||||
|
|
||||||
// Configuration.
|
// Populate configuration data.
|
||||||
model.PopulateListConfig(responseData.Config);
|
PopulateAssociationConfig(model, responseData);
|
||||||
|
|
||||||
// Reference data - types.
|
|
||||||
List<TypeCodeDesc> associationTypes = Internals.AssociationTypeCodes;
|
|
||||||
foreach (Sbm.AssociationType associationType in EnumUtil.GetValues<Sbm.AssociationType>())
|
|
||||||
{
|
|
||||||
if (associationType <= 0 || associationType == Sbm.AssociationType.Internal) continue;
|
|
||||||
if (!SessionConsole.AllowAssociationType(associationType)) continue;
|
|
||||||
responseData.AssociationTypes.Add(associationTypes.GetCodeForType(associationType), Localiser.GetAssociationTypeCaption(associationType));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reference data - statuses.
|
|
||||||
foreach (SaStatus status in SbmAssociation.ValidStatuses.FindAll(item => item != SaStatus.Deleted))
|
|
||||||
responseData.Statuses.Add(SacsSystem.GetStatusCode(status), Localiser.GetStatusCaption(status));
|
|
||||||
responseData.DefaultStatusCode = SacsSystem.GetStatusCode(SbmAssociation.DefaultStatus);
|
|
||||||
|
|
||||||
// Item filter.
|
// Item filter.
|
||||||
SbmAssociation.Params prmAssociation = new SbmAssociation.Params();
|
SbmAssociation.Params prmAssociation = new SbmAssociation.Params();
|
||||||
@@ -160,18 +216,18 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
|||||||
AssociationListData associationData = new AssociationListData()
|
AssociationListData associationData = new AssociationListData()
|
||||||
{
|
{
|
||||||
Id = values.GetString(colId.DataName),
|
Id = values.GetString(colId.DataName),
|
||||||
TargetName = values.GetString(colTargetName.DataName),
|
|
||||||
TypeDesc = Internals.AssociationTypeCodes.GetDescForType(associationType),
|
|
||||||
Code = values.GetString(colCode.DataName),
|
|
||||||
AddressSummary = AccountMgr.GetAssociationDataValue(colAddress, values).ToString(),
|
|
||||||
Notes = values.GetString(colNotes.DataName),
|
|
||||||
StatusCode = values.GetString(colStatus.DataName),
|
StatusCode = values.GetString(colStatus.DataName),
|
||||||
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName)),
|
|
||||||
CreatedOn = DateUtil.Format(values.GetDate(colCreatedOn.DataName), "yyyyMMdd"),
|
|
||||||
CreatedOnFmt = Localiser.FormatDate(values.GetDate(colCreatedOn.DataName)),
|
|
||||||
UpdatedOn = DateUtil.Format(values.GetDate(colUpdatedOn.DataName), "yyyyMMdd"),
|
|
||||||
UpdatedOnFmt = Localiser.FormatDate(values.GetDate(colUpdatedOn.DataName))
|
|
||||||
};
|
};
|
||||||
|
associationData.Field.Value.Add($"{Model_Association.ItemField.Type}", Internals.AssociationTypeCodes.GetDescForType(associationType));
|
||||||
|
associationData.Field.Value.Add($"{Model_Association.ItemField.Target}", values.GetString(colTargetName.DataName));
|
||||||
|
associationData.Field.Value.Add($"{Model_Association.ItemField.Code}", values.GetString(colCode.DataName));
|
||||||
|
associationData.Field.Value.Add($"{Model_Association.ItemField.Address}", AccountMgr.GetAssociationDataValue(colAddress, values).ToString());
|
||||||
|
associationData.Field.Value.Add($"{Model_Association.ItemField.Notes}", AccountMgr.GetAssociationDataValue(colNotes, values).ToString());
|
||||||
|
associationData.Field.Value.Add($"{Model_Association.ItemField.Status}", SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName)));
|
||||||
|
associationData.Field.Value.Add($"{Model_Association.ItemField.CreatedOn}", Localiser.FormatDate(values.GetDate(colCreatedOn.DataName)));
|
||||||
|
associationData.Field.Value.Add($"{Model_Association.ItemField.UpdatedOn}", Localiser.FormatDate(values.GetDate(colUpdatedOn.DataName)));
|
||||||
|
// Cleanse item values.
|
||||||
|
associationData.Field.Value.RemoveAll(item => StringUtil.IsBlank(item.Value));
|
||||||
responseData.Associations.Add(associationData);
|
responseData.Associations.Add(associationData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -304,7 +360,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
|||||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||||
}
|
}
|
||||||
// New item.
|
// New item.
|
||||||
association = AccountMgr.CreateAssociation(SessionData_Portal.Organisation.AffiliateId, associationType, model.Association.AffiliateIdTarget.ToSysId());
|
association = AccountMgr.CreateAssociation(SessionData_Portal.Organisation.AffiliateId, associationType, model.Association.ContactIdTarget.ToSysId());
|
||||||
disposables.Add(association);
|
disposables.Add(association);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using DocumentFormat.OpenXml.EMMA;
|
using DocumentFormat.OpenXml.EMMA;
|
||||||
|
using DocumentFormat.OpenXml.ExtendedProperties;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||||
@@ -26,78 +27,73 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
|||||||
// Affiliate data.
|
// Affiliate data.
|
||||||
private class AffiliateListData : AjaxResponse_Data.ItemData_Base
|
private class AffiliateListData : AjaxResponse_Data.ItemData_Base
|
||||||
{
|
{
|
||||||
public String DisplayName { get; set; }
|
// Affiliate properties for list with specific handling.
|
||||||
public String TypeDesc { get; set; }
|
|
||||||
public bool? IsIndividual { get; set; }
|
|
||||||
public bool? IsGroup { get; set; }
|
|
||||||
public String AddressSummary { get; set; }
|
|
||||||
public String Contact { get; set; }
|
|
||||||
public String Phone { get; set; }
|
|
||||||
public String Email { get; set; }
|
|
||||||
public long? AssociationCount { get; set; }
|
public long? AssociationCount { get; set; }
|
||||||
}
|
|
||||||
private class AffiliateItemData : AffiliateListData
|
|
||||||
{
|
|
||||||
// Affiliate properties.
|
|
||||||
public String TypeCode { get; set; }
|
|
||||||
// Fields.
|
// Fields.
|
||||||
public class FieldData
|
public class FieldData
|
||||||
{
|
{
|
||||||
|
// Item property values keyed to match field name.
|
||||||
public Dictionary<string, string> Value { get; } = new Dictionary<string, string>();
|
public Dictionary<string, string> Value { get; } = new Dictionary<string, string>();
|
||||||
}
|
}
|
||||||
public FieldData Field { get; } = new FieldData();
|
public FieldData Field { get; } = new FieldData();
|
||||||
}
|
}
|
||||||
|
private class AffiliateItemData : AffiliateListData
|
||||||
|
{
|
||||||
|
// Affiliate properties with specific handling.
|
||||||
|
public String TypeCode { get; set; }
|
||||||
|
public String TypeDesc { get; set; }
|
||||||
|
}
|
||||||
private void PopulateAffiliateResponseListData(Model_Contact model, SbmAffiliate affiliate, AffiliateListData data)
|
private void PopulateAffiliateResponseListData(Model_Contact model, SbmAffiliate affiliate, AffiliateListData data)
|
||||||
{
|
{
|
||||||
data.Id = SysId.ToString(affiliate.Id);
|
data.Id = SysId.ToString(affiliate.Id);
|
||||||
data.DisplayName = affiliate.GetDisplayName();
|
|
||||||
data.TypeDesc = Internals.AffiliateTypeCodes.GetDescForType(affiliate.AffiliateType);
|
|
||||||
if (affiliate.IsIndividual()) data.IsIndividual = true;
|
|
||||||
if (affiliate.IsContactGroup()) data.IsGroup = true;
|
|
||||||
// Common properties.
|
|
||||||
data.StatusCode = affiliate.StatusCode;
|
|
||||||
data.StatusDesc = affiliate.StatusDesc;
|
|
||||||
}
|
}
|
||||||
private void PopulateAffiliateResponseItemData(Model_Contact model, SbmAffiliate affiliate, AffiliateItemData data)
|
private void PopulateAffiliateResponseItemData(Model_Contact model, SbmAffiliate affiliate, AffiliateItemData data)
|
||||||
{
|
{
|
||||||
PopulateAffiliateResponseListData(model, affiliate, data as AffiliateListData);
|
PopulateAffiliateResponseListData(model, affiliate, data as AffiliateListData);
|
||||||
// Affiliate properties.
|
// Affiliate type - populate for list ('Type' property populated with desc) and form (Type Code & Desc).
|
||||||
data.TypeCode = Internals.AffiliateTypeCodes.GetCodeForType(affiliate.AffiliateType);
|
data.TypeCode = Internals.AffiliateTypeCodes.GetCodeForType(affiliate.AffiliateType);
|
||||||
|
data.TypeDesc = Internals.AffiliateTypeCodes.GetDescForType(affiliate.AffiliateType);
|
||||||
|
data.Field.Value.Add($"{Model_Contact.ItemField.Type}", Internals.AffiliateTypeCodes.GetDescForType(affiliate.AffiliateType));
|
||||||
// Ogranisation.
|
// Ogranisation.
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.Parent.ToString(), SysId.ToString(affiliate.AffiliateIdParent));
|
data.Field.Value.Add($"{Model_Contact.ItemField.Parent}", SysId.ToString(affiliate.AffiliateIdParent));
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.Name.ToString(), affiliate.Name);
|
data.Field.Value.Add($"{Model_Contact.ItemField.Name}", affiliate.Name);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.Abbreviation.ToString(), affiliate.Abbr);
|
data.Field.Value.Add($"{Model_Contact.ItemField.Abbreviation}", affiliate.Abbr);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.Nature.ToString(), affiliate.Nature);
|
data.Field.Value.Add($"{Model_Contact.ItemField.PhoneMain}", affiliate.PhoneMain);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.Contact.ToString(), affiliate.Contact);
|
data.Field.Value.Add($"{Model_Contact.ItemField.PhoneAlt}", affiliate.PhoneAlt);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.PhoneMain.ToString(), affiliate.PhoneMain);
|
data.Field.Value.Add($"{Model_Contact.ItemField.PhoneDirect}", affiliate.PhoneDirect);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.PhoneAlt.ToString(), affiliate.PhoneAlt);
|
data.Field.Value.Add($"{Model_Contact.ItemField.PhoneFax}", affiliate.PhoneFax);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.PhoneDirect.ToString(), affiliate.PhoneDirect);
|
data.Field.Value.Add($"{Model_Contact.ItemField.Website}", affiliate.Website);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.PhoneFax.ToString(), affiliate.PhoneFax);
|
data.Field.Value.Add($"{Model_Contact.ItemField.CompanyNo}", affiliate.CompanyNo);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.Email.ToString(), affiliate.Email);
|
data.Field.Value.Add($"{Model_Contact.ItemField.VatReg}", affiliate.VatReg);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.Website.ToString(), affiliate.Website);
|
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.CompanyNo.ToString(), affiliate.CompanyNo);
|
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.VatReg.ToString(), affiliate.VatReg);
|
|
||||||
// Individual.
|
// Individual.
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.Title.ToString(), affiliate.Title);
|
data.Field.Value.Add($"{Model_Contact.ItemField.Title}", affiliate.Title);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.Salutation.ToString(), affiliate.Salutation);
|
data.Field.Value.Add($"{Model_Contact.ItemField.Salutation}", affiliate.Salutation);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.FirstName.ToString(), affiliate.FirstName);
|
data.Field.Value.Add($"{Model_Contact.ItemField.FirstName}", affiliate.FirstName);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.Initials.ToString(), affiliate.Initials);
|
data.Field.Value.Add($"{Model_Contact.ItemField.Initials}", affiliate.Initials);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.LastName.ToString(), affiliate.LastName);
|
data.Field.Value.Add($"{Model_Contact.ItemField.LastName}", affiliate.LastName);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.PhoneMobile.ToString(), affiliate.PhoneMobile);
|
data.Field.Value.Add($"{Model_Contact.ItemField.PhoneMobile}", affiliate.PhoneMobile);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.BirthDay.ToString(), affiliate.BirthDay > 0 ? affiliate.BirthDay.ToString() : "");
|
data.Field.Value.Add($"{Model_Contact.ItemField.BirthDay}", affiliate.BirthDay > 0 ? affiliate.BirthDay.ToString() : "");
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.BirthMonth.ToString(), affiliate.BirthMonth > 0 ? affiliate.BirthMonth.ToString() : "");
|
data.Field.Value.Add($"{Model_Contact.ItemField.BirthMonth}", affiliate.BirthMonth > 0 ? affiliate.BirthMonth.ToString() : "");
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.BirthYear.ToString(), affiliate.BirthYear > 0 ? affiliate.BirthYear.ToString() : "");
|
data.Field.Value.Add($"{Model_Contact.ItemField.BirthYear}", affiliate.BirthYear > 0 ? affiliate.BirthYear.ToString() : "");
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.MaritalStatus.ToString(), affiliate.MaritalStatus);
|
data.Field.Value.Add($"{Model_Contact.ItemField.MaritalStatus}", affiliate.MaritalStatus);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.Spouse.ToString(), affiliate.Spouse);
|
data.Field.Value.Add($"{Model_Contact.ItemField.Spouse}", affiliate.Spouse);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.Children.ToString(), affiliate.Children);
|
data.Field.Value.Add($"{Model_Contact.ItemField.Children}", affiliate.Children);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.Hometown.ToString(), affiliate.Hometown);
|
data.Field.Value.Add($"{Model_Contact.ItemField.Hometown}", affiliate.Hometown);
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.UserId.ToString(), SysId.ToString(affiliate.UserId));
|
data.Field.Value.Add($"{Model_Contact.ItemField.UserId}", SysId.ToString(affiliate.UserId));
|
||||||
// Flags.
|
// Flags.
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.Prospect.ToString(), affiliate.Prospect ? "1" : "");
|
data.Field.Value.Add($"{Model_Contact.ItemField.Prospect}", affiliate.Prospect ? "1" : "");
|
||||||
// Common properties.
|
// Common properties.
|
||||||
data.Field.Value.Add(Model_Contact.ItemField.Notes.ToString(), affiliate.Notes);
|
data.StatusCode = affiliate.StatusCode;
|
||||||
|
data.StatusDesc = affiliate.StatusDesc;
|
||||||
// Cleanse field values.
|
// Cleanse field values.
|
||||||
data.Field.Value.RemoveAll(item => StringUtil.IsBlank(item.Value));
|
data.Field.Value.RemoveAll(item => StringUtil.IsBlank(item.Value));
|
||||||
|
// Populate item list values that might be cleared during update after removing blank values to ensure that blank values are published.
|
||||||
|
data.Field.Value.Add($"{Model_Contact.ItemField.Nature}", affiliate.Nature);
|
||||||
|
data.Field.Value.Add($"{Model_Contact.ItemField.Contact}", affiliate.Contact);
|
||||||
|
data.Field.Value.Add($"{Model_Contact.ItemField.Phone}", affiliate.GetPhone());
|
||||||
|
data.Field.Value.Add($"{Model_Contact.ItemField.Email}", affiliate.Email);
|
||||||
|
data.Field.Value.Add($"{Model_Contact.ItemField.Notes}", affiliate.Notes);
|
||||||
|
data.Field.Value.Add($"{Model_Contact.ItemField.UpdatedOn}", Localiser.FormatDate(affiliate.UpdateStamp.On));
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@@ -127,7 +123,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
|||||||
[Route("Contact/Ajax/GetConfig")]
|
[Route("Contact/Ajax/GetConfig")]
|
||||||
public IActionResult Ajax_ContactConfig(Model_Contact model)
|
public IActionResult Ajax_ContactConfig(Model_Contact model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_ContactConfig";
|
|
||||||
AjaxResponse_ContactConfig responseData = new AjaxResponse_ContactConfig(model);
|
AjaxResponse_ContactConfig responseData = new AjaxResponse_ContactConfig(model);
|
||||||
String messageTitle = Localiser["label.contacts"];
|
String messageTitle = Localiser["label.contacts"];
|
||||||
|
|
||||||
@@ -156,10 +151,12 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
|||||||
responseData.OrganisationTypes.Add(new AjaxResponse_Data.ItemCodeDesc(affiliateType.Code, affiliateType.Desc));
|
responseData.OrganisationTypes.Add(new AjaxResponse_Data.ItemCodeDesc(affiliateType.Code, affiliateType.Desc));
|
||||||
|
|
||||||
// Reference data - titles.
|
// Reference data - titles.
|
||||||
|
responseData.Titles.Add(new AjaxResponse_Data.ItemCodeDesc("", ""));
|
||||||
foreach (SaCode title in CodeTypeConsole.GetCodesForCodeType(SbmSystem.GetCodeTypeCode(Sbm.ApplCodeType.ContactTitle)))
|
foreach (SaCode title in CodeTypeConsole.GetCodesForCodeType(SbmSystem.GetCodeTypeCode(Sbm.ApplCodeType.ContactTitle)))
|
||||||
responseData.Titles.Add(new AjaxResponse_Data.ItemCodeDesc(title.Code, title.Description));
|
responseData.Titles.Add(new AjaxResponse_Data.ItemCodeDesc(title.Code, title.Description));
|
||||||
|
|
||||||
// Reference data - salutation.
|
// Reference data - salutation.
|
||||||
|
responseData.Salutations.Add(new AjaxResponse_Data.ItemCodeDesc("", ""));
|
||||||
responseData.Salutations.Add(new AjaxResponse_Data.ItemCodeDesc("Dear", "Dear"));
|
responseData.Salutations.Add(new AjaxResponse_Data.ItemCodeDesc("Dear", "Dear"));
|
||||||
|
|
||||||
// Reference data - statuses.
|
// Reference data - statuses.
|
||||||
@@ -184,7 +181,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
|||||||
[Route("Contact/Ajax/GetList")]
|
[Route("Contact/Ajax/GetList")]
|
||||||
public IActionResult Ajax_ContactList(Model_Contact model)
|
public IActionResult Ajax_ContactList(Model_Contact model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_ContactList";
|
|
||||||
AjaxResponse_ContactList responseData = new AjaxResponse_ContactList(model);
|
AjaxResponse_ContactList responseData = new AjaxResponse_ContactList(model);
|
||||||
String messageTitle = Localiser["label.contacts"];
|
String messageTitle = Localiser["label.contacts"];
|
||||||
|
|
||||||
@@ -228,11 +224,15 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
|||||||
colAddress, colContact, colPhoneMain, colPhoneAlt, colPhoneMobile, colPhoneDirect, colEmail, colAssocCount,
|
colAddress, colContact, colPhoneMain, colPhoneAlt, colPhoneMobile, colPhoneDirect, colEmail, colAssocCount,
|
||||||
colNotes, colStatus, colCreatedOn, colUpdatedOn
|
colNotes, colStatus, colCreatedOn, colUpdatedOn
|
||||||
};
|
};
|
||||||
if (responseData.Config.Column.Hide.Contains(Model_Contact.ItemColumn.Address.ToString()))
|
if (responseData.Config.Column.Hide.Contains($"{Model_Contact.ItemField.Address}"))
|
||||||
columns.Remove(colAddress);
|
columns.Remove(colAddress);
|
||||||
if (responseData.Config.Column.Hide.Contains(Model_Contact.ItemColumn.Email.ToString()))
|
if (responseData.Config.Column.Hide.Contains($"{Model_Contact.ItemField.Email}"))
|
||||||
columns.Remove(colEmail);
|
columns.Remove(colEmail);
|
||||||
|
|
||||||
|
// Sort Columns.
|
||||||
|
if (!prmAffiliate.SortColumns.Any())
|
||||||
|
prmAffiliate.SortColumns.Add(colName);
|
||||||
|
|
||||||
// Query items.
|
// Query items.
|
||||||
using (DbResultSet resultSet = AccountMgr.ExecuteAffiliateQuery(columns, prmAffiliate))
|
using (DbResultSet resultSet = AccountMgr.ExecuteAffiliateQuery(columns, prmAffiliate))
|
||||||
{
|
{
|
||||||
@@ -243,25 +243,23 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
|||||||
AffiliateListData affiliateData = new AffiliateListData()
|
AffiliateListData affiliateData = new AffiliateListData()
|
||||||
{
|
{
|
||||||
Id = values.GetString(colId.DataName),
|
Id = values.GetString(colId.DataName),
|
||||||
DisplayName = values.GetString(colName.DataName),
|
|
||||||
TypeDesc = Internals.AffiliateTypeCodes.GetDescForType(affiliateType),
|
|
||||||
AddressSummary = StringUtil.NullOnBlank(AccountMgr.GetAffiliateDataValue(colAddress, values).AsString()),
|
|
||||||
Contact = StringUtil.NullOnBlank(values.GetString(colContact.DataName)),
|
|
||||||
Phone = StringUtil.NullOnBlank(StringUtil.OnBlank(values.GetString(colPhoneMain.DataName), values.GetString(colPhoneAlt.DataName), values.GetString(colPhoneMobile.DataName), values.GetString(colPhoneDirect.DataName))),
|
|
||||||
Email = StringUtil.NullOnBlank(values.GetString(colEmail.DataName)),
|
|
||||||
Notes = StringUtil.NullOnBlank(AccountMgr.GetAffiliateDataValue(colNotes, values).ToString()),
|
|
||||||
StatusCode = values.GetString(colStatus.DataName),
|
StatusCode = values.GetString(colStatus.DataName),
|
||||||
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName)),
|
|
||||||
CreatedOn = DateUtil.Format(values.GetDate(colCreatedOn.DataName), "yyyyMMdd"),
|
|
||||||
CreatedOnFmt = Localiser.FormatDate(values.GetDate(colCreatedOn.DataName)),
|
|
||||||
UpdatedOn = DateUtil.Format(values.GetDate(colUpdatedOn.DataName), "yyyyMMdd"),
|
|
||||||
UpdatedOnFmt = Localiser.FormatDate(values.GetDate(colUpdatedOn.DataName))
|
|
||||||
};
|
};
|
||||||
if (SbmAffiliate.IsIndividual(affiliateType)) affiliateData.IsIndividual = true;
|
affiliateData.Field.Value.Add($"{Model_Contact.ItemField.Name}", values.GetString(colName.DataName));
|
||||||
if (SbmAffiliate.IsContactGroup(affiliateType)) affiliateData.IsGroup = true;
|
affiliateData.Field.Value.Add($"{Model_Contact.ItemField.Type}", Internals.AffiliateTypeCodes.GetDescForType(affiliateType));
|
||||||
|
affiliateData.Field.Value.Add($"{Model_Contact.ItemField.Address}", StringUtil.NullOnBlank(AccountMgr.GetAffiliateDataValue(colAddress, values).AsString()));
|
||||||
|
affiliateData.Field.Value.Add($"{Model_Contact.ItemField.Contact}", StringUtil.NullOnBlank(values.GetString(colContact.DataName)));
|
||||||
|
affiliateData.Field.Value.Add($"{Model_Contact.ItemField.Phone}", StringUtil.NullOnBlank(StringUtil.OnBlank(values.GetString(colPhoneMain.DataName), values.GetString(colPhoneAlt.DataName), values.GetString(colPhoneMobile.DataName), values.GetString(colPhoneDirect.DataName))));
|
||||||
|
affiliateData.Field.Value.Add($"{Model_Contact.ItemField.Email}", StringUtil.NullOnBlank(values.GetString(colEmail.DataName)));
|
||||||
|
affiliateData.Field.Value.Add($"{Model_Contact.ItemField.Notes}", StringUtil.NullOnBlank(AccountMgr.GetAffiliateDataValue(colNotes, values).ToString()));
|
||||||
|
affiliateData.Field.Value.Add($"{Model_Contact.ItemField.Status}", SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName)));
|
||||||
|
affiliateData.Field.Value.Add($"{Model_Contact.ItemField.CreatedOn}", Localiser.FormatDate(values.GetDate(colCreatedOn.DataName)));
|
||||||
|
affiliateData.Field.Value.Add($"{Model_Contact.ItemField.UpdatedOn}", Localiser.FormatDate(values.GetDate(colUpdatedOn.DataName)));
|
||||||
long assocCount = values.GetLong(colAssocCount.DataName);
|
long assocCount = values.GetLong(colAssocCount.DataName);
|
||||||
if (assocCount > 0)
|
if (assocCount > 0)
|
||||||
affiliateData.AssociationCount = assocCount;
|
affiliateData.AssociationCount = assocCount;
|
||||||
|
// Cleanse item values.
|
||||||
|
affiliateData.Field.Value.RemoveAll(item => StringUtil.IsBlank(item.Value));
|
||||||
responseData.Contacts.Add(affiliateData);
|
responseData.Contacts.Add(affiliateData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -296,7 +294,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
|||||||
[Route("Contact/Ajax/GetItem")]
|
[Route("Contact/Ajax/GetItem")]
|
||||||
public IActionResult Ajax_GetItem(Model_Contact model)
|
public IActionResult Ajax_GetItem(Model_Contact model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_GetItem";
|
|
||||||
String messageTitle = Localiser["label.contact"];
|
String messageTitle = Localiser["label.contact"];
|
||||||
AjaxResponse_Affiliate responseData = new AjaxResponse_Affiliate(model);
|
AjaxResponse_Affiliate responseData = new AjaxResponse_Affiliate(model);
|
||||||
|
|
||||||
@@ -314,7 +311,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
|||||||
SbmAffiliate affiliate = AccountMgr.GetAffiliateById(affiliateId);
|
SbmAffiliate affiliate = AccountMgr.GetAffiliateById(affiliateId);
|
||||||
if (affiliate == null)
|
if (affiliate == null)
|
||||||
{
|
{
|
||||||
SaLogger.Warn(fn + " Failed to retrieve affiliate for Id: '" + model.Contact.Id + "'");
|
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve affiliate for Id: '{model.Contact.Id}'");
|
||||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +333,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
|||||||
[Route("Contact/Ajax/StoreItem")]
|
[Route("Contact/Ajax/StoreItem")]
|
||||||
public IActionResult Ajax_StoreItem(Model_Contact model)
|
public IActionResult Ajax_StoreItem(Model_Contact model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_StoreItem";
|
|
||||||
String messageTitle = Localiser["label.contact"];
|
String messageTitle = Localiser["label.contact"];
|
||||||
AjaxResponse_Affiliate responseData = new AjaxResponse_Affiliate(model);
|
AjaxResponse_Affiliate responseData = new AjaxResponse_Affiliate(model);
|
||||||
|
|
||||||
@@ -355,12 +351,12 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
|||||||
bool contactExists = StringUtil.ToBool(model.Contact.Exists);
|
bool contactExists = StringUtil.ToBool(model.Contact.Exists);
|
||||||
if (contactExists && !SysId.IsValid(affiliateId))
|
if (contactExists && !SysId.IsValid(affiliateId))
|
||||||
{
|
{
|
||||||
SaLogger.Warn(fn + " Id not specified for existing Affiliate.");
|
SaLogger.Warn($"{SysUtil.Fn} Id not specified for existing Affiliate.");
|
||||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||||
}
|
}
|
||||||
if (!contactExists && SysId.IsValid(affiliateId))
|
if (!contactExists && SysId.IsValid(affiliateId))
|
||||||
{
|
{
|
||||||
SaLogger.Warn(fn + " Id specified for new Affiliate: '" + model.Contact.Id + "'");
|
SaLogger.Warn($"{SysUtil.Fn} Id specified for new Affiliate: '{model.Contact.Id}'");
|
||||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,19 +364,19 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
|||||||
SbmAffiliate affiliate = AccountMgr.GetAffiliateById(affiliateId);
|
SbmAffiliate affiliate = AccountMgr.GetAffiliateById(affiliateId);
|
||||||
if (affiliate == null && SysId.IsValid(affiliateId))
|
if (affiliate == null && SysId.IsValid(affiliateId))
|
||||||
{
|
{
|
||||||
SaLogger.Warn(fn + " Failed to retrieve affiliate for Id: '" + model.Contact.Id + "'");
|
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve affiliate for Id: '{model.Contact.Id}'");
|
||||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new item if required.
|
// Create new item if required.
|
||||||
if (affiliate == null)
|
if (affiliate == null)
|
||||||
{
|
{
|
||||||
affiliate = AccountMgr.CreateAffiliate(model.GetContactType());
|
affiliate = AccountMgr.CreateAffiliate(model.GetAffiliateType());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (model.Contact.Type != null)
|
if (model.Contact.Type != null)
|
||||||
affiliate.AffiliateType = model.GetContactType();
|
affiliate.AffiliateType = model.GetAffiliateType();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate item properties.
|
// Populate item properties.
|
||||||
@@ -440,7 +436,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
|||||||
{
|
{
|
||||||
if (!AccountMgr.InsertAffiliate(affiliate, DbUpdateInfo))
|
if (!AccountMgr.InsertAffiliate(affiliate, DbUpdateInfo))
|
||||||
{
|
{
|
||||||
SaLogger.Warn(fn + " Failed to insert affiliate: " + AccountMgr.ErrorStateMessage);
|
SaLogger.Warn($"{SysUtil.Fn} Failed to insert affiliate: {AccountMgr.ErrorStateMessage}");
|
||||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
|
||||||
}
|
}
|
||||||
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
|
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
|
||||||
@@ -449,7 +445,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
|||||||
{
|
{
|
||||||
if (!AccountMgr.UpdateAffiliate(affiliate, DbUpdateInfo))
|
if (!AccountMgr.UpdateAffiliate(affiliate, DbUpdateInfo))
|
||||||
{
|
{
|
||||||
SaLogger.Warn(fn + " Failed to update affiliate [Id:" + SysId.ToString(affiliate.Id) + "]: " + AccountMgr.ErrorStateMessage);
|
SaLogger.Warn($"{SysUtil.Fn} Failed to update affiliate [Id: {SysId.ToLong(affiliate.Id)}]: {AccountMgr.ErrorStateMessage}");
|
||||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
|
||||||
}
|
}
|
||||||
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
|
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||||
|
using Sarand.Net.Standard.Accounts.Sage.App;
|
||||||
using Sarand.Net.Standard.Base.Bus;
|
using Sarand.Net.Standard.Base.Bus;
|
||||||
using Sarand.Net.Standard.Base.Utils;
|
using Sarand.Net.Standard.Base.Utils;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Buffers;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
||||||
{
|
{
|
||||||
@@ -14,44 +18,92 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
|||||||
partial class Model_Association
|
partial class Model_Association
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
|
/// <summary>Prefix for field names.</summary>
|
||||||
|
public const String FieldNamePrefix = "Assoc";
|
||||||
|
|
||||||
|
/// <summary>Item fields.</summary>
|
||||||
|
public enum ItemField
|
||||||
|
{
|
||||||
|
Id,
|
||||||
|
Type,
|
||||||
|
Owner,
|
||||||
|
/// <summary>Target name.</summary>
|
||||||
|
Target,
|
||||||
|
Code,
|
||||||
|
ReferenceExt,
|
||||||
|
Primary,
|
||||||
|
Technician,
|
||||||
|
DescDetail,
|
||||||
|
Location,
|
||||||
|
Role,
|
||||||
|
Group,
|
||||||
|
Terminated,
|
||||||
|
/// <summary>Address summary. [list only]</summary>
|
||||||
|
Address,
|
||||||
|
/// <summary>Significant phone number. [list only]</summary>
|
||||||
|
Phone,
|
||||||
|
PhoneMain,
|
||||||
|
Email,
|
||||||
|
// Financials.
|
||||||
|
AnnualSalesTarget,
|
||||||
|
CreditLimit,
|
||||||
|
AccountBalance,
|
||||||
|
DiscountType,
|
||||||
|
DiscountRate,
|
||||||
|
PriceSet,
|
||||||
|
TaxCode,
|
||||||
|
/// <summary>Last sales transaction raised. [list only]</summary>
|
||||||
|
TransLastSaleRaised,
|
||||||
|
/// <summary>Open sales transaction value. [list only]</summary>
|
||||||
|
TransSalesValueOpen,
|
||||||
|
/// <summary>Sales transaction value current year to date. [list only]</summary>
|
||||||
|
TransSalesValueCytd,
|
||||||
|
/// <summary>Sales transaction value last calendar year. [list only]</summary>
|
||||||
|
TransSalesValueLcy,
|
||||||
|
// Accounts.
|
||||||
|
DefaultNominalCode,
|
||||||
|
// Commodities.
|
||||||
|
/// <summary>Commodity count. [list only]</summary>
|
||||||
|
CommodityCount,
|
||||||
|
CommoditySalesDefault,
|
||||||
|
// Customer codes.
|
||||||
|
AccountManager,
|
||||||
|
AccountHandler,
|
||||||
|
AccountType,
|
||||||
|
AccountRating,
|
||||||
|
ContactArea,
|
||||||
|
ContactHandler,
|
||||||
|
ContactMethod,
|
||||||
|
ContactCallCycle,
|
||||||
|
// Common.
|
||||||
|
Notes,
|
||||||
|
Status,
|
||||||
|
CreatedOn,
|
||||||
|
UpdatedOn,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifier used by form fields to show control specific messages generated by model validation etc.
|
||||||
|
/// <para>- Both page and model should use this method to consistently generate the field name.</para>
|
||||||
|
/// </summary>
|
||||||
|
public String GetFieldName(ItemField field)
|
||||||
|
{
|
||||||
|
return $"{FieldNamePrefix}{field}";
|
||||||
|
}
|
||||||
|
|
||||||
// List configuration.
|
// List configuration.
|
||||||
public class ListConfigData
|
public class ListConfigData
|
||||||
{
|
{
|
||||||
// List columns.
|
// List columns.
|
||||||
public class ColumnData
|
public class ColumnData
|
||||||
{
|
{
|
||||||
// Show column.
|
// Column name prefix.
|
||||||
public class ShowData
|
public String Prefix { get; } = Model_Association.FieldNamePrefix;
|
||||||
{
|
// Hide column.
|
||||||
public bool? Owner_Name { get; set; }
|
public HashSet<string> Hide { get; } = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
||||||
// Customer.
|
|
||||||
public bool? Trans_SalesValue_Open { get; set; }
|
|
||||||
public bool? Trans_LastSaleRaised { get; set; }
|
|
||||||
public bool? AnnualSalesTarget { get; set; }
|
|
||||||
public bool? Trans_SalesValue_Cytd { get; set; }
|
|
||||||
public bool? Trans_SalesValue_Lcy { get; set; }
|
|
||||||
public bool? CommodityCount { get; set; }
|
|
||||||
public bool? DiscountRate { get; set; }
|
|
||||||
public bool? PriceSet { get; set; }
|
|
||||||
public bool? Group { get; set; }
|
|
||||||
// Customer codes.
|
|
||||||
public bool? AccountManager { get; set; }
|
|
||||||
public bool? AccountHandler { get; set; }
|
|
||||||
public bool? ContactArea { get; set; }
|
|
||||||
public bool? ContactHandler { get; set; }
|
|
||||||
// Members.
|
|
||||||
public bool? Technician { get; set; }
|
|
||||||
public bool? Terminated { get; set; }
|
|
||||||
}
|
|
||||||
public ShowData Show { get; } = new ShowData();
|
|
||||||
// Column labels.
|
// Column labels.
|
||||||
public class LabelData
|
public Dictionary<String, String> Label { get; } = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
|
||||||
{
|
|
||||||
// Members.
|
|
||||||
public String Technician { get; set; }
|
|
||||||
public String Terminated { get; set; }
|
|
||||||
}
|
|
||||||
public LabelData Label { get; } = new LabelData();
|
|
||||||
}
|
}
|
||||||
public ColumnData Column { get; } = new ColumnData();
|
public ColumnData Column { get; } = new ColumnData();
|
||||||
}
|
}
|
||||||
@@ -66,71 +118,85 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
|||||||
ListConfig = new ListConfigData();
|
ListConfig = new ListConfigData();
|
||||||
PopulateListConfig(ListConfig);
|
PopulateListConfig(ListConfig);
|
||||||
}
|
}
|
||||||
public void PopulateListConfig(ListConfigData listConfig)
|
public void PopulateListConfig(ListConfigData config)
|
||||||
{
|
{
|
||||||
bool isCustomer = GetAssociationType() == Sbm.AssociationType.Customer;
|
bool modeIsRelationships = Mode == AssociationPageMode.Relationships;
|
||||||
bool isSupplier = GetAssociationType() == Sbm.AssociationType.Supplier;
|
bool modeIsMaintain = Mode == AssociationPageMode.Maintain;
|
||||||
|
Sbm.AssociationType associationType = GetAssociationType();
|
||||||
|
bool typeIsCustomer = associationType == Sbm.AssociationType.Customer;
|
||||||
|
bool typeIsSupplier = associationType == Sbm.AssociationType.Supplier;
|
||||||
|
bool typeIsMember = associationType == Sbm.AssociationType.Member;
|
||||||
|
|
||||||
bool userCanViewFinancials = SessionData_Portal.SecurityProfile_Core.UserCanViewFinancials();
|
bool userCanViewFinancials = SessionData_Portal.SecurityProfile_Core.UserCanViewFinancials();
|
||||||
|
|
||||||
// List columns.
|
// List columns.
|
||||||
if (Mode == AssociationPageMode.Relationships)
|
|
||||||
listConfig.Column.Show.Owner_Name = true;
|
if (associationType > 0)
|
||||||
if (Mode == AssociationPageMode.Maintain)
|
config.Column.Hide.Add($"{ItemField.Type}");
|
||||||
{
|
|
||||||
if (GetAssociationType() == Sbm.AssociationType.Customer)
|
// Owner name.
|
||||||
{
|
if (!modeIsRelationships)
|
||||||
// Customers.
|
config.Column.Hide.Add($"{ItemField.Owner}");
|
||||||
if (userCanViewFinancials && SessionData_Portal.GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn.Association_Trans_SalesValue_Open))
|
|
||||||
listConfig.Column.Show.Trans_SalesValue_Open = true;
|
// Target name.
|
||||||
if (SessionData_Portal.GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn.Association_Trans_LastSaleRaised))
|
if (modeIsRelationships)
|
||||||
listConfig.Column.Show.Trans_LastSaleRaised = true;
|
config.Column.Hide.Add($"{ItemField.Target}");
|
||||||
if (userCanViewFinancials && SessionData_Portal.GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn.Association_AnnualSalesTarget))
|
|
||||||
listConfig.Column.Show.AnnualSalesTarget = true;
|
// Phone
|
||||||
if (userCanViewFinancials && SessionData_Portal.GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn.Association_Trans_SalesValue_Cytd))
|
if (modeIsRelationships)
|
||||||
listConfig.Column.Show.Trans_SalesValue_Cytd = true;
|
config.Column.Hide.Add($"{ItemField.Phone}");
|
||||||
if (userCanViewFinancials && SessionData_Portal.GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn.Association_Trans_SalesValue_Lcy))
|
|
||||||
listConfig.Column.Show.Trans_SalesValue_Lcy = true;
|
// Address.
|
||||||
// Commodities.
|
if (modeIsRelationships)
|
||||||
if (CommodityMgr.CanManageCommodityCustomers())
|
config.Column.Hide.Add($"{ItemField.Address}");
|
||||||
listConfig.Column.Show.CommodityCount = true;
|
|
||||||
// Customer pricing.
|
// Customer financials.
|
||||||
if (userCanViewFinancials && SessionConsole.AllowOption(Sbm.ConfigOption.CustomerDiscount))
|
if (!modeIsMaintain || !typeIsCustomer || !userCanViewFinancials || !SessionData_Portal.GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn.Association_Trans_SalesValue_Open))
|
||||||
listConfig.Column.Show.DiscountRate = true;
|
config.Column.Hide.Add($"{ItemField.TransSalesValueOpen}");
|
||||||
if (userCanViewFinancials && SessionConsole.AllowOption(Sbm.ConfigOption.CustomerPriceSet) && PriceMgr.PriceDatabaseIsValid)
|
if (!modeIsMaintain || !typeIsCustomer || !SessionData_Portal.GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn.Association_Trans_LastSaleRaised))
|
||||||
listConfig.Column.Show.PriceSet = true;
|
config.Column.Hide.Add($"{ItemField.TransLastSaleRaised}");
|
||||||
// Association group.
|
if (!modeIsMaintain || !typeIsCustomer || !userCanViewFinancials || !SessionData_Portal.GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn.Association_AnnualSalesTarget))
|
||||||
if (SessionData_Portal.GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn.Association_Group))
|
config.Column.Hide.Add($"{ItemField.AnnualSalesTarget}");
|
||||||
listConfig.Column.Show.Group = true;
|
if (!modeIsMaintain || !typeIsCustomer || !userCanViewFinancials || !SessionData_Portal.GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn.Association_Trans_SalesValue_Cytd))
|
||||||
// Codes.
|
config.Column.Hide.Add($"{ItemField.TransSalesValueCytd}");
|
||||||
if (CodeTypeConsole.CodeTypeHasCodes(Internals.GetCodeTypeCode(Sbm.ApplCodeType.AccountManager)))
|
if (!modeIsMaintain || !typeIsCustomer || !userCanViewFinancials || !SessionData_Portal.GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn.Association_Trans_SalesValue_Lcy))
|
||||||
listConfig.Column.Show.AccountManager = true;
|
config.Column.Hide.Add($"{ItemField.TransSalesValueLcy}");
|
||||||
if (CodeTypeConsole.CodeTypeHasCodes(Internals.GetCodeTypeCode(Sbm.ApplCodeType.AccountHandler)))
|
// Customer commodities.
|
||||||
listConfig.Column.Show.AccountHandler = true;
|
if (!modeIsMaintain || !typeIsCustomer || !CommodityMgr.CanManageCommodityCustomers())
|
||||||
if (CodeTypeConsole.CodeTypeHasCodes(Internals.GetCodeTypeCode(Sbm.ApplCodeType.ContactArea)))
|
config.Column.Hide.Add($"{ItemField.CommodityCount}");
|
||||||
listConfig.Column.Show.ContactArea = true;
|
// Customer pricing.
|
||||||
if (CodeTypeConsole.CodeTypeHasCodes(Internals.GetCodeTypeCode(Sbm.ApplCodeType.ContactHandler)))
|
if (!modeIsMaintain || !typeIsCustomer || !userCanViewFinancials || !SessionConsole.AllowOption(Sbm.ConfigOption.CustomerDiscount))
|
||||||
listConfig.Column.Show.ContactHandler = true;
|
config.Column.Hide.Add($"{ItemField.DiscountRate}");
|
||||||
}
|
if (!modeIsMaintain || !typeIsCustomer || !userCanViewFinancials || !SessionConsole.AllowOption(Sbm.ConfigOption.CustomerPriceSet) && PriceMgr.PriceDatabaseIsValid)
|
||||||
else if (GetAssociationType() == Sbm.AssociationType.Supplier)
|
config.Column.Hide.Add($"{ItemField.PriceSet}");
|
||||||
{
|
// Association group.
|
||||||
// Suppliers.
|
if (!modeIsMaintain || !typeIsCustomer || !SessionData_Portal.GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn.Association_Group))
|
||||||
// Commodities.
|
config.Column.Hide.Add($"{ItemField.Group}");
|
||||||
if (CommodityMgr.CanManageCommoditySuppliers())
|
// Customer codes.
|
||||||
listConfig.Column.Show.CommodityCount = true;
|
if (!modeIsMaintain || !typeIsCustomer || !CodeTypeConsole.CodeTypeHasCodes(Internals.GetCodeTypeCode(Sbm.ApplCodeType.AccountManager)))
|
||||||
}
|
config.Column.Hide.Add($"{ItemField.AccountManager}");
|
||||||
else if (GetAssociationType() == Sbm.AssociationType.Member)
|
if (!modeIsMaintain || !typeIsCustomer || !CodeTypeConsole.CodeTypeHasCodes(Internals.GetCodeTypeCode(Sbm.ApplCodeType.AccountHandler)))
|
||||||
{
|
config.Column.Hide.Add($"{ItemField.AccountHandler}");
|
||||||
// Members.
|
if (!modeIsMaintain || !typeIsCustomer || !CodeTypeConsole.CodeTypeHasCodes(Internals.GetCodeTypeCode(Sbm.ApplCodeType.ContactArea)))
|
||||||
if (StringUtil.ToSysId(Filter.OwnerId).Equals(SessionData_Portal.Organisation.AffiliateId))
|
config.Column.Hide.Add($"{ItemField.ContactArea}");
|
||||||
listConfig.Column.Show.Technician = true;
|
if (!modeIsMaintain || !typeIsCustomer || !CodeTypeConsole.CodeTypeHasCodes(Internals.GetCodeTypeCode(Sbm.ApplCodeType.ContactHandler)))
|
||||||
listConfig.Column.Show.Terminated = true;
|
config.Column.Hide.Add($"{ItemField.ContactHandler}");
|
||||||
listConfig.Column.Label.Terminated = "Terminated";
|
|
||||||
}
|
// Supplier Commodities.
|
||||||
}
|
if (!modeIsMaintain || !typeIsSupplier || !CommodityMgr.CanManageCommoditySuppliers())
|
||||||
|
config.Column.Hide.Add($"{ItemField.CommodityCount}");
|
||||||
|
|
||||||
|
// Members.
|
||||||
|
if (!typeIsMember || !StringUtil.ToSysId(Filter.OwnerId).Equals(SessionData_Portal.Organisation.AffiliateId))
|
||||||
|
config.Column.Hide.Add($"{ItemField.Technician}");
|
||||||
|
if (!typeIsMember)
|
||||||
|
config.Column.Hide.Add($"{ItemField.Terminated}");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Item configuration.
|
// Item configuration.
|
||||||
|
//-------------------------------------------------------------------
|
||||||
// Legacy Association dialog tabs and panels.
|
// Legacy Association dialog tabs and panels.
|
||||||
// Tab 1:
|
// Tab 1:
|
||||||
// Organisation - Organisation
|
// Organisation - Organisation
|
||||||
@@ -153,6 +219,11 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
|||||||
|
|
||||||
public class ItemConfigData
|
public class ItemConfigData
|
||||||
{
|
{
|
||||||
|
// Update dialog title.
|
||||||
|
public String Title{ get; set; }
|
||||||
|
// Field name prefix.
|
||||||
|
public String Prefix { get; } = Model_Association.FieldNamePrefix;
|
||||||
|
// Control flags.
|
||||||
public bool? ManagedByAccounts { get; set; }
|
public bool? ManagedByAccounts { get; set; }
|
||||||
public bool? LocalPricing { get; set; }
|
public bool? LocalPricing { get; set; }
|
||||||
// Allowed actions.
|
// Allowed actions.
|
||||||
@@ -164,47 +235,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
|||||||
// Item fields.
|
// Item fields.
|
||||||
public class FieldData
|
public class FieldData
|
||||||
{
|
{
|
||||||
// Show field.
|
// Field name prefix.
|
||||||
public class ShowData
|
public String Prefix { get; } = Model_Association.FieldNamePrefix;
|
||||||
{
|
// Hide field.
|
||||||
public bool? Owner { get; set; }
|
public HashSet<string> Hide { get; } = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
||||||
public bool? Code { get; set; }
|
|
||||||
public bool? ExtRef { get; set; }
|
|
||||||
public bool? Primary { get; set; }
|
|
||||||
public bool? Technician { get; set; }
|
|
||||||
public bool? Status { get; set; }
|
|
||||||
// Financials.
|
|
||||||
public bool? AnnualSalesTarget { get; set; }
|
|
||||||
public bool? CreditLimit { get; set; }
|
|
||||||
public bool? AccountBalance { get; set; }
|
|
||||||
public bool? DiscountType { get; set; }
|
|
||||||
public bool? DiscountRate { get; set; }
|
|
||||||
public bool? PriceSet { get; set; }
|
|
||||||
// Accounts.
|
|
||||||
public bool? DefaultNominalCode { get; set; }
|
|
||||||
// Customer.
|
|
||||||
public bool? Group { get; set; }
|
|
||||||
public bool? CommoditySalesDefault { get; set; }
|
|
||||||
// Customer codes.
|
|
||||||
public bool? AccountManager { get; set; }
|
|
||||||
public bool? AccountHandler { get; set; }
|
|
||||||
public bool? ContactArea { get; set; }
|
|
||||||
public bool? ContactHandler { get; set; }
|
|
||||||
}
|
|
||||||
public ShowData Show { get; } = new ShowData();
|
|
||||||
// Read-only field.
|
// Read-only field.
|
||||||
public class ReadOnlyData
|
public HashSet<string> Readonly { get; } = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
||||||
{
|
// Field labels.
|
||||||
}
|
public Dictionary<String, String> Label { get; } = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
|
||||||
public ReadOnlyData ReadOnly { get; } = new ReadOnlyData();
|
|
||||||
// Field label.
|
|
||||||
public class LabelData
|
|
||||||
{
|
|
||||||
// Members.
|
|
||||||
public String Technician { get; set; }
|
|
||||||
public String Terminated { get; set; }
|
|
||||||
}
|
|
||||||
public LabelData Label { get; } = new LabelData();
|
|
||||||
}
|
}
|
||||||
public FieldData Field { get; } = new FieldData();
|
public FieldData Field { get; } = new FieldData();
|
||||||
}
|
}
|
||||||
@@ -229,54 +267,151 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
|||||||
bool isInternal = (associationType == Sbm.AssociationType.Internal);
|
bool isInternal = (associationType == Sbm.AssociationType.Internal);
|
||||||
|
|
||||||
// Accounts interface.
|
// Accounts interface.
|
||||||
if (Internals.AccountsDfn.ItemIsImportedFromAccounts(associationItemId))
|
bool managedByAccounts = Internals.AccountsDfn.ItemIsImportedFromAccounts(associationItemId);
|
||||||
config.ManagedByAccounts = true;
|
if (managedByAccounts) config.ManagedByAccounts = true;
|
||||||
|
|
||||||
// Determine pricing options.
|
// Determine pricing options.
|
||||||
if (isCustomer && Internals.AccountsDfn.UseLocalCustomerPricing())
|
bool localPricing =
|
||||||
config.LocalPricing = true;
|
(isCustomer && Internals.AccountsDfn.UseLocalCustomerPricing()) ||
|
||||||
if (isSupplier && Internals.AccountsDfn.UseLocalSupplierPricing())
|
(isSupplier && Internals.AccountsDfn.UseLocalSupplierPricing());
|
||||||
config.LocalPricing = true;
|
if (localPricing) config.LocalPricing = true;
|
||||||
|
|
||||||
|
// Update dialog title.
|
||||||
|
config.Title =
|
||||||
|
isCustomer ? Localiser["caption.customer.update"] :
|
||||||
|
isSupplier ? Localiser["caption.supplier.update"] :
|
||||||
|
Localiser["caption.association.update"];
|
||||||
|
|
||||||
// Allow actions.
|
// Allow actions.
|
||||||
if (SessionData_Portal.GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption.UpdateAssociationCode))
|
if (SessionData_Portal.GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption.UpdateAssociationCode))
|
||||||
config.Allow.UpdateCode = true;
|
config.Allow.UpdateCode = true;
|
||||||
|
|
||||||
// Show fields.
|
// Item Fields.
|
||||||
if (ItemId.IsValid(associationItemId) && !ownerIsInternal)
|
|
||||||
config.Field.Show.Owner = true;
|
// Type.
|
||||||
if (!isInternal)
|
config.Field.Readonly.Add($"{ItemField.Type}");
|
||||||
config.Field.Show.Code = true;
|
|
||||||
if (!isInternal && !isMember)
|
// Owner.
|
||||||
config.Field.Show.Status = true;
|
if (!ItemId.IsValid(associationItemId) || ownerIsInternal)
|
||||||
if ((config.Field.Show.Code ?? false) && (isCustomer || isSupplier))
|
config.Field.Hide.Add($"{ItemField.Owner}");
|
||||||
config.Field.Show.ExtRef = true;
|
else
|
||||||
if ((config.Field.Show.Code ?? false) && !(config.Field.Show.ExtRef ?? false) && !ownerIsInternal && isMember)
|
config.Field.Readonly.Add($"{ItemField.Owner}");
|
||||||
config.Field.Show.Primary = true;
|
|
||||||
if ((config.Field.Show.Code ?? false) && !(config.Field.Show.ExtRef ?? false) && !(config.Field.Show.Primary ?? false) && ownerIsInternal && isMember)
|
// Target.
|
||||||
config.Field.Show.Technician = true;
|
config.Field.Readonly.Add($"{ItemField.Target}");
|
||||||
if (canViewFinancials)
|
|
||||||
|
// Code.
|
||||||
|
if (isInternal)
|
||||||
|
config.Field.Hide.Add($"{ItemField.Code}");
|
||||||
|
|
||||||
|
// Status.
|
||||||
|
bool showCode = !isInternal && !isMember;
|
||||||
|
if (!showCode)
|
||||||
|
config.Field.Hide.Add($"{ItemField.Status}");
|
||||||
|
|
||||||
|
// External reference.
|
||||||
|
bool showExtRef = showCode && (isCustomer || isSupplier);
|
||||||
|
if (!showExtRef)
|
||||||
|
config.Field.Hide.Add($"{ItemField.ReferenceExt}");
|
||||||
|
|
||||||
|
// Primary.
|
||||||
|
bool showPrimary = showCode && !showExtRef && !ownerIsInternal && isMember;
|
||||||
|
if (!showPrimary)
|
||||||
|
config.Field.Hide.Add($"{ItemField.Primary}");
|
||||||
|
|
||||||
|
// Technician.
|
||||||
|
bool showTechnician = showCode && !showExtRef && !showPrimary && ownerIsInternal && isMember;
|
||||||
|
if (!showTechnician)
|
||||||
|
config.Field.Hide.Add($"{ItemField.Technician}");
|
||||||
|
|
||||||
|
// Desc detail.
|
||||||
|
if (managedByAccounts)
|
||||||
|
config.Field.Readonly.Add($"{ItemField.DescDetail}");
|
||||||
|
|
||||||
|
// Financials.
|
||||||
|
|
||||||
|
// Annual Sales Target.
|
||||||
|
if (!canViewFinancials)
|
||||||
|
config.Field.Hide.Add($"{ItemField.AnnualSalesTarget}");
|
||||||
|
else if (!canUpdateFinancials)
|
||||||
|
config.Field.Readonly.Add($"{ItemField.AnnualSalesTarget}");
|
||||||
|
|
||||||
|
// Default Nominal Code.
|
||||||
|
if (!managedByAccounts)
|
||||||
|
config.Field.Hide.Add($"{ItemField.DefaultNominalCode}");
|
||||||
|
else
|
||||||
|
config.Field.Readonly.Add($"{ItemField.DefaultNominalCode}");
|
||||||
|
|
||||||
|
// Credit limit.
|
||||||
|
if (!canViewFinancials || !managedByAccounts)
|
||||||
|
config.Field.Hide.Add($"{ItemField.CreditLimit}");
|
||||||
|
else if (managedByAccounts||!canUpdateFinancials)
|
||||||
|
config.Field.Readonly.Add($"{ItemField.CreditLimit}");
|
||||||
|
|
||||||
|
// Account balance.
|
||||||
|
if (!canViewFinancials || !managedByAccounts)
|
||||||
|
config.Field.Hide.Add($"{ItemField.AccountBalance}");
|
||||||
|
else if (managedByAccounts || !canUpdateFinancials)
|
||||||
|
config.Field.Readonly.Add($"{ItemField.AccountBalance}");
|
||||||
|
|
||||||
|
// Discount.
|
||||||
|
if (!canViewFinancials || (!managedByAccounts && !SessionConsole.AllowOption(isSupplier ? Sbm.ConfigOption.SupplierDiscount : Sbm.ConfigOption.CustomerDiscount)))
|
||||||
{
|
{
|
||||||
config.Field.Show.AnnualSalesTarget = true;
|
config.Field.Hide.Add($"{ItemField.DiscountType}");
|
||||||
if (config.ManagedByAccounts ?? false)
|
config.Field.Hide.Add($"{ItemField.DiscountRate}");
|
||||||
{
|
|
||||||
config.Field.Show.CreditLimit = true;
|
|
||||||
config.Field.Show.AccountBalance = true;
|
|
||||||
}
|
|
||||||
if (SessionConsole.AllowOption(isSupplier ? Sbm.ConfigOption.SupplierDiscount : Sbm.ConfigOption.CustomerDiscount))
|
|
||||||
{
|
|
||||||
config.Field.Show.DiscountType = true;
|
|
||||||
config.Field.Show.DiscountRate = true;
|
|
||||||
}
|
|
||||||
if (SessionConsole.AllowOption(isSupplier ? Sbm.ConfigOption.SupplierPriceSet : Sbm.ConfigOption.CustomerPriceSet) && PriceMgr.PriceDatabaseIsValid)
|
|
||||||
config.Field.Show.PriceSet = true;
|
|
||||||
}
|
}
|
||||||
if (config.ManagedByAccounts ?? false)
|
else if (!localPricing || !canUpdateFinancials)
|
||||||
{
|
{
|
||||||
config.Field.Show.DefaultNominalCode = true;
|
config.Field.Readonly.Add($"{ItemField.DiscountType}");
|
||||||
|
config.Field.Readonly.Add($"{ItemField.DiscountRate}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Price set.
|
||||||
|
if (!canViewFinancials || (!managedByAccounts && !SessionConsole.AllowOption(isSupplier ? Sbm.ConfigOption.SupplierPriceSet : Sbm.ConfigOption.CustomerPriceSet)) || !PriceMgr.PriceDatabaseIsValid)
|
||||||
|
config.Field.Hide.Add($"{ItemField.PriceSet}");
|
||||||
|
else if (!localPricing || !canUpdateFinancials)
|
||||||
|
config.Field.Readonly.Add($"{ItemField.PriceSet}");
|
||||||
|
|
||||||
|
// Tax code.
|
||||||
|
if (managedByAccounts || !canUpdateFinancials)
|
||||||
|
config.Field.Readonly.Add($"{ItemField.TaxCode}");
|
||||||
|
|
||||||
|
// Default sales commodity.
|
||||||
|
if (!isCustomer || !CommodityMgr.ColumnExists(SbmDbDfn.ColumnIdx.Association_CommodityIdSalesDefault))
|
||||||
|
config.Field.Hide.Add($"{ItemField.CommoditySalesDefault}");
|
||||||
|
|
||||||
|
// Association codes.
|
||||||
|
if (!isCustomer && !isSupplier)
|
||||||
|
{
|
||||||
|
config.Field.Hide.Add($"{ItemField.AccountManager}");
|
||||||
|
config.Field.Hide.Add($"{ItemField.AccountHandler}");
|
||||||
|
config.Field.Hide.Add($"{ItemField.AccountType}");
|
||||||
|
config.Field.Hide.Add($"{ItemField.AccountRating}");
|
||||||
|
config.Field.Hide.Add($"{ItemField.ContactArea}");
|
||||||
|
config.Field.Hide.Add($"{ItemField.ContactHandler}");
|
||||||
|
config.Field.Hide.Add($"{ItemField.ContactMethod}");
|
||||||
|
config.Field.Hide.Add($"{ItemField.ContactCallCycle}");
|
||||||
|
}
|
||||||
|
else if (managedByAccounts)
|
||||||
|
{
|
||||||
|
Sage.ItemType sageItemType = isCustomer ? Sage.ItemType.Customer : Sage.ItemType.Supplier;
|
||||||
|
if (Internals.AccountsDfn.SourcedFromSage(SbmDbDfn.ColumnIdx.Association_AccountManagerCode, sageItemType))
|
||||||
|
config.Field.Readonly.Add($"{ItemField.AccountManager}");
|
||||||
|
if (Internals.AccountsDfn.SourcedFromSage(SbmDbDfn.ColumnIdx.Association_AccountHandlerCode, sageItemType))
|
||||||
|
config.Field.Readonly.Add($"{ItemField.AccountHandler}");
|
||||||
|
if (Internals.AccountsDfn.SourcedFromSage(SbmDbDfn.ColumnIdx.Association_AccountTypeCode, sageItemType))
|
||||||
|
config.Field.Readonly.Add($"{ItemField.AccountType}");
|
||||||
|
if (Internals.AccountsDfn.SourcedFromSage(SbmDbDfn.ColumnIdx.Association_AccountRatingCode, sageItemType))
|
||||||
|
config.Field.Readonly.Add($"{ItemField.AccountRating}");
|
||||||
|
if (Internals.AccountsDfn.SourcedFromSage(SbmDbDfn.ColumnIdx.Association_ContactAreaCode, sageItemType))
|
||||||
|
config.Field.Readonly.Add($"{ItemField.ContactArea}");
|
||||||
|
if (Internals.AccountsDfn.SourcedFromSage(SbmDbDfn.ColumnIdx.Association_ContactHandlerCode, sageItemType))
|
||||||
|
config.Field.Readonly.Add($"{ItemField.ContactHandler}");
|
||||||
|
if (Internals.AccountsDfn.SourcedFromSage(SbmDbDfn.ColumnIdx.Association_ContactMethodCode, sageItemType))
|
||||||
|
config.Field.Readonly.Add($"{ItemField.ContactMethod}");
|
||||||
|
if (Internals.AccountsDfn.SourcedFromSage(SbmDbDfn.ColumnIdx.Association_ContactCallCycleCode, sageItemType))
|
||||||
|
config.Field.Readonly.Add($"{ItemField.ContactCallCycle}");
|
||||||
}
|
}
|
||||||
if (isCustomer && CommodityMgr.ColumnExists(SbmDbDfn.ColumnIdx.Association_CommodityIdSalesDefault))
|
|
||||||
config.Field.Show.CommoditySalesDefault = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
|||||||
{
|
{
|
||||||
public string Exists { get; set; }
|
public string Exists { get; set; }
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public string AffiliateIdOwner { get; set; }
|
public string ContactIdOwner { get; set; }
|
||||||
public string AffiliateIdTarget { get; set; }
|
public string ContactIdTarget { get; set; }
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
public string Code { get; set; }
|
public string Code { get; set; }
|
||||||
public string ReferenceExt { get; set; }
|
public string ReferenceExt { get; set; }
|
||||||
|
|||||||
@@ -14,35 +14,74 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
|||||||
partial class Model_Contact
|
partial class Model_Contact
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
// Contact fields.
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
/// <summary>Prefix for column names.</summary>
|
/// <summary>Prefix for field names.</summary>
|
||||||
public const String ColumnNamePrefix = "Contact";
|
public const String FieldNamePrefix = "Contact";
|
||||||
|
|
||||||
/// <summary>Item columns.</summary>
|
/// <summary>Item fields.</summary>
|
||||||
public enum ItemColumn
|
public enum ItemField
|
||||||
{
|
{
|
||||||
Id,
|
Id,
|
||||||
Type,
|
Type,
|
||||||
|
Parent,
|
||||||
Name,
|
Name,
|
||||||
|
FirstName,
|
||||||
|
LastName,
|
||||||
|
Initials,
|
||||||
|
Title,
|
||||||
|
Salutation,
|
||||||
|
Abbreviation,
|
||||||
Nature,
|
Nature,
|
||||||
Contact,
|
Contact,
|
||||||
Email,
|
Email,
|
||||||
|
/// <summary>Most significant phone number. [list only]</summary>
|
||||||
Phone,
|
Phone,
|
||||||
|
PhoneMain,
|
||||||
|
PhoneAlt,
|
||||||
|
PhoneDirect,
|
||||||
|
PhoneFax,
|
||||||
|
PhoneMobile,
|
||||||
|
/// <summary>Address summary. [list only]</summary>
|
||||||
Address,
|
Address,
|
||||||
Members,
|
Website,
|
||||||
|
CompanyNo,
|
||||||
|
VatReg,
|
||||||
|
DateOfBirth,
|
||||||
|
BirthDay,
|
||||||
|
BirthMonth,
|
||||||
|
BirthYear,
|
||||||
|
MaritalStatus,
|
||||||
|
Spouse,
|
||||||
|
Children,
|
||||||
|
Hometown,
|
||||||
|
UserId,
|
||||||
|
/// <summary>Form option group.</summary>
|
||||||
|
Options,
|
||||||
Prospect,
|
Prospect,
|
||||||
|
/// <summary>Number of target associations. [list only]</summary>
|
||||||
|
Associations,
|
||||||
|
/// <summary>Number of members. [list only]</summary>
|
||||||
|
Members,
|
||||||
|
// Common properties.
|
||||||
Notes,
|
Notes,
|
||||||
|
Status,
|
||||||
|
CreatedOn,
|
||||||
|
UpdatedOn,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Identifier used by list columns to show/hide column etc.
|
/// Identifier used by form fields to show control specific messages generated by model validation etc.
|
||||||
/// <para>- Both page and model should use this method to consistently generate the column name.</para>
|
/// <para>- Both page and model should use this method to consistently generate the field name.</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public String GetColumnName(ItemField field)
|
public String GetFieldName(ItemField field)
|
||||||
{
|
{
|
||||||
return ColumnNamePrefix + field.ToString();
|
return $"{FieldNamePrefix}{field}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
// List configuration.
|
// List configuration.
|
||||||
public class ListConfigData
|
public class ListConfigData
|
||||||
{
|
{
|
||||||
@@ -50,7 +89,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
|||||||
public class ColumnData
|
public class ColumnData
|
||||||
{
|
{
|
||||||
// Column name prefix.
|
// Column name prefix.
|
||||||
public String Prefix { get; } = Model_Contact.ColumnNamePrefix;
|
public String Prefix { get; } = Model_Contact.FieldNamePrefix;
|
||||||
// Hide column.
|
// Hide column.
|
||||||
public HashSet<string> Hide { get; } = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
public HashSet<string> Hide { get; } = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
||||||
// Column labels.
|
// Column labels.
|
||||||
@@ -74,126 +113,75 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void PopulateListConfig(ListConfigData config)
|
public void PopulateListConfig(ListConfigData config)
|
||||||
{
|
{
|
||||||
Sbm.AffiliateType affiliateType = GetContactType();
|
Sbm.AffiliateType affiliateType = GetFilterContactType();
|
||||||
bool contactGroupsOnly = affiliateType == Sbm.AffiliateType.ContactGroup;
|
bool contactGroupsOnly = affiliateType == Sbm.AffiliateType.ContactGroup;
|
||||||
|
|
||||||
// Contact type.
|
// Contact type.
|
||||||
if (affiliateType <= 0)
|
if (affiliateType <= 0)
|
||||||
config.Column.Label.Add(ItemColumn.Type.ToString(), Localiser["label.type"]);
|
config.Column.Label.Add($"{ItemField.Type}", Localiser["label.type"]);
|
||||||
else
|
else
|
||||||
config.Column.Hide.Add(ItemColumn.Type.ToString());
|
config.Column.Hide.Add($"{ItemField.Type}");
|
||||||
|
|
||||||
// Contact name.
|
// Contact name.
|
||||||
config.Column.Label.Add(ItemColumn.Name.ToString(), Localiser["label.name"]);
|
config.Column.Label.Add($"{ItemField.Name}", Localiser["label.name"]);
|
||||||
|
|
||||||
// Nature.
|
// Nature.
|
||||||
bool showNature = false;
|
bool showNature = false;
|
||||||
if (!contactGroupsOnly && showNature)
|
if (!contactGroupsOnly && showNature)
|
||||||
config.Column.Label.Add(ItemColumn.Nature.ToString(), Localiser["label.nature"]);
|
config.Column.Label.Add($"{ItemField.Nature}", Localiser["label.nature"]);
|
||||||
else
|
else
|
||||||
config.Column.Hide.Add(ItemColumn.Nature.ToString());
|
config.Column.Hide.Add($"{ItemField.Nature}");
|
||||||
|
|
||||||
// Email.
|
// Email.
|
||||||
if (!contactGroupsOnly && (affiliateType == Sbm.AffiliateType.Individual || !StringUtil.IsBlank(Filter.Email)))
|
if (!contactGroupsOnly && (affiliateType == Sbm.AffiliateType.Individual || !StringUtil.IsBlank(Filter.Email)))
|
||||||
config.Column.Label.Add(ItemColumn.Email.ToString(), Localiser["label.email"]);
|
config.Column.Label.Add($"{ItemField.Email}", Localiser["label.email"]);
|
||||||
else
|
else
|
||||||
config.Column.Hide.Add(ItemColumn.Email.ToString());
|
config.Column.Hide.Add($"{ItemField.Email}");
|
||||||
|
|
||||||
// Contact.
|
// Contact.
|
||||||
if (!contactGroupsOnly && (affiliateType != Sbm.AffiliateType.Individual))
|
if (!contactGroupsOnly && (affiliateType != Sbm.AffiliateType.Individual))
|
||||||
config.Column.Label.Add(ItemColumn.Contact.ToString(), Localiser["label.contact"]);
|
config.Column.Label.Add($"{ItemField.Contact}", Localiser["label.contact"]);
|
||||||
else
|
else
|
||||||
config.Column.Hide.Add(ItemColumn.Contact.ToString());
|
config.Column.Hide.Add($"{ItemField.Contact}");
|
||||||
|
|
||||||
// Phone.
|
// Phone.
|
||||||
if (!contactGroupsOnly)
|
if (!contactGroupsOnly)
|
||||||
config.Column.Label.Add(ItemColumn.Phone.ToString(), Localiser["label.phone"]);
|
config.Column.Label.Add($"{ItemField.Phone}", Localiser["label.phone"]);
|
||||||
else
|
else
|
||||||
config.Column.Hide.Add(ItemColumn.Phone.ToString());
|
config.Column.Hide.Add($"{ItemField.Phone}");
|
||||||
|
|
||||||
// Address.
|
// Address.
|
||||||
if (!contactGroupsOnly)
|
if (!contactGroupsOnly)
|
||||||
config.Column.Label.Add(ItemColumn.Address.ToString(), Localiser["label.address"]);
|
config.Column.Label.Add($"{ItemField.Address}", Localiser["label.address"]);
|
||||||
else
|
else
|
||||||
config.Column.Hide.Add(ItemColumn.Address.ToString());
|
config.Column.Hide.Add($"{ItemField.Address}");
|
||||||
|
|
||||||
// Group members.
|
// Group members.
|
||||||
if (contactGroupsOnly)
|
if (contactGroupsOnly)
|
||||||
config.Column.Label.Add(ItemColumn.Members.ToString(), Localiser["label.members"]);
|
config.Column.Label.Add($"{ItemField.Members}", Localiser["label.members"]);
|
||||||
else
|
else
|
||||||
config.Column.Hide.Add(ItemColumn.Members.ToString());
|
config.Column.Hide.Add($"{ItemField.Members}");
|
||||||
|
|
||||||
// Prospect group.
|
// Prospect group.
|
||||||
if (contactGroupsOnly)
|
if (contactGroupsOnly)
|
||||||
config.Column.Label.Add(ItemColumn.Prospect.ToString(), Localiser["label.prospect"]);
|
config.Column.Label.Add($"{ItemField.Prospect}", Localiser["label.prospect"]);
|
||||||
else
|
else
|
||||||
config.Column.Hide.Add(ItemColumn.Prospect.ToString());
|
config.Column.Hide.Add($"{ItemField.Prospect}");
|
||||||
|
|
||||||
// Contact notes.
|
// Contact notes.
|
||||||
config.Column.Label.Add(ItemColumn.Notes.ToString(), Localiser["label.notes"]);
|
config.Column.Label.Add($"{ItemField.Notes}", Localiser["label.notes"]);
|
||||||
|
|
||||||
// Contact Id.
|
// Contact Id.
|
||||||
if (SbmSystem.DebugMode)
|
if (SbmSystem.DebugMode)
|
||||||
config.Column.Label.Add(ItemColumn.Id.ToString(), Localiser["label.id"]);
|
config.Column.Label.Add($"{ItemField.Id}", Localiser["label.id"]);
|
||||||
else
|
else
|
||||||
config.Column.Hide.Add(ItemColumn.Id.ToString());
|
config.Column.Hide.Add($"{ItemField.Id}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Item configuration.
|
// Item configuration.
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
/// <summary>Prefix for field names.</summary>
|
|
||||||
public const String FieldNamePrefix = "Contact";
|
|
||||||
|
|
||||||
/// <summary>Item fields.</summary>
|
|
||||||
public enum ItemField
|
|
||||||
{
|
|
||||||
Id,
|
|
||||||
Type,
|
|
||||||
Parent,
|
|
||||||
Name,
|
|
||||||
FirstName,
|
|
||||||
LastName,
|
|
||||||
Initials,
|
|
||||||
Title,
|
|
||||||
Salutation,
|
|
||||||
Abbreviation,
|
|
||||||
Nature,
|
|
||||||
Contact,
|
|
||||||
Email,
|
|
||||||
PhoneMain,
|
|
||||||
PhoneAlt,
|
|
||||||
PhoneDirect,
|
|
||||||
PhoneFax,
|
|
||||||
PhoneMobile,
|
|
||||||
Website,
|
|
||||||
CompanyNo,
|
|
||||||
VatReg,
|
|
||||||
DateOfBirth,
|
|
||||||
BirthDay,
|
|
||||||
BirthMonth,
|
|
||||||
BirthYear,
|
|
||||||
MaritalStatus,
|
|
||||||
Spouse,
|
|
||||||
Children,
|
|
||||||
Hometown,
|
|
||||||
UserId,
|
|
||||||
Options,
|
|
||||||
Prospect,
|
|
||||||
Notes,
|
|
||||||
Status,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Identifier used by form fields to show control specific messages generated by model validation etc.
|
|
||||||
/// <para>- Both page and model should use this method to consistently generate the field name.</para>
|
|
||||||
/// </summary>
|
|
||||||
public String GetFieldName(ItemField field)
|
|
||||||
{
|
|
||||||
return FieldNamePrefix + field.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Legacy Contact dialog tabs and panels.
|
// Legacy Contact dialog tabs and panels.
|
||||||
// - Individual
|
// - Individual
|
||||||
// - Organisation
|
// - Organisation
|
||||||
@@ -213,7 +201,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
|||||||
// Hide field.
|
// Hide field.
|
||||||
public HashSet<string> Hide { get; } = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
public HashSet<string> Hide { get; } = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
||||||
// Read-only field.
|
// Read-only field.
|
||||||
public HashSet<string> ReadOnly { get; } = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
public HashSet<string> Readonly { get; } = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
||||||
// Field labels.
|
// Field labels.
|
||||||
public Dictionary<String, String> Label { get; } = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
|
public Dictionary<String, String> Label { get; } = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
|
||||||
}
|
}
|
||||||
@@ -244,149 +232,149 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
|||||||
|
|
||||||
// Id.
|
// Id.
|
||||||
if (SbmSystem.DebugMode)
|
if (SbmSystem.DebugMode)
|
||||||
config.Field.ReadOnly.Add(ItemField.Id.ToString());
|
config.Field.Readonly.Add($"{ItemField.Id}");
|
||||||
else
|
else
|
||||||
config.Field.Hide.Add(ItemField.Id.ToString());
|
config.Field.Hide.Add($"{ItemField.Id}");
|
||||||
|
|
||||||
// Contact type.
|
// Contact type.
|
||||||
if (!isOrganisation)
|
if (!isOrganisation)
|
||||||
config.Field.Hide.Add(ItemField.Type.ToString());
|
config.Field.Hide.Add($"{ItemField.Type}");
|
||||||
|
|
||||||
// Organisation name.
|
// Organisation name.
|
||||||
if (!isOrganisation && !isGroup)
|
if (!isOrganisation && !isGroup)
|
||||||
{
|
{
|
||||||
config.Field.Hide.Add(ItemField.Name.ToString());
|
config.Field.Hide.Add($"{ItemField.Name}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (isIndividual)
|
if (isIndividual)
|
||||||
config.Field.Label.Add(ItemField.Name.ToString(), Localiser["label.phone.home"]);
|
config.Field.Label.Add($"{ItemField.Name}", Localiser["label.phone.home"]);
|
||||||
else
|
else
|
||||||
config.Field.Label.Add(ItemField.Name.ToString(), Localiser["label.phone"]);
|
config.Field.Label.Add($"{ItemField.Name}", Localiser["label.phone"]);
|
||||||
if (importedFromAccounts)
|
if (importedFromAccounts)
|
||||||
{
|
{
|
||||||
config.Field.ReadOnly.Add(ItemField.Name.ToString());
|
config.Field.Readonly.Add($"{ItemField.Name}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Individual name.
|
// Individual name.
|
||||||
if (!isIndividual)
|
if (!isIndividual)
|
||||||
{
|
{
|
||||||
config.Field.Hide.Add(ItemField.FirstName.ToString());
|
config.Field.Hide.Add($"{ItemField.FirstName}");
|
||||||
config.Field.Hide.Add(ItemField.LastName.ToString());
|
config.Field.Hide.Add($"{ItemField.LastName}");
|
||||||
config.Field.Hide.Add(ItemField.Initials.ToString());
|
config.Field.Hide.Add($"{ItemField.Initials}");
|
||||||
config.Field.Hide.Add(ItemField.Title.ToString());
|
config.Field.Hide.Add($"{ItemField.Title}");
|
||||||
config.Field.Hide.Add(ItemField.Salutation.ToString());
|
config.Field.Hide.Add($"{ItemField.Salutation}");
|
||||||
}
|
}
|
||||||
if (importedFromAccounts)
|
if (importedFromAccounts)
|
||||||
{
|
{
|
||||||
config.Field.ReadOnly.Add(ItemField.FirstName.ToString());
|
config.Field.Readonly.Add($"{ItemField.FirstName}");
|
||||||
config.Field.ReadOnly.Add(ItemField.LastName.ToString());
|
config.Field.Readonly.Add($"{ItemField.LastName}");
|
||||||
config.Field.ReadOnly.Add(ItemField.Initials.ToString());
|
config.Field.Readonly.Add($"{ItemField.Initials}");
|
||||||
config.Field.ReadOnly.Add(ItemField.Title.ToString());
|
config.Field.Readonly.Add($"{ItemField.Title}");
|
||||||
config.Field.ReadOnly.Add(ItemField.Salutation.ToString());
|
config.Field.Readonly.Add($"{ItemField.Salutation}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Organisation - Abbreviation.
|
// Organisation - Abbreviation.
|
||||||
if (!isOrganisation)
|
if (!isOrganisation)
|
||||||
config.Field.Hide.Add(ItemField.Abbreviation.ToString());
|
config.Field.Hide.Add($"{ItemField.Abbreviation}");
|
||||||
else if (importedFromAccounts)
|
else if (importedFromAccounts)
|
||||||
config.Field.ReadOnly.Add(ItemField.Abbreviation.ToString());
|
config.Field.Readonly.Add($"{ItemField.Abbreviation}");
|
||||||
|
|
||||||
// Organisation - Nature.
|
// Organisation - Nature.
|
||||||
if (!isOrganisation)
|
if (!isOrganisation)
|
||||||
config.Field.Hide.Add(ItemField.Nature.ToString());
|
config.Field.Hide.Add($"{ItemField.Nature}");
|
||||||
|
|
||||||
// Organisation - Contact.
|
// Organisation - Contact.
|
||||||
if (!isOrganisation)
|
if (!isOrganisation)
|
||||||
config.Field.Hide.Add(ItemField.Contact.ToString());
|
config.Field.Hide.Add($"{ItemField.Contact}");
|
||||||
else if (importedFromAccounts)
|
else if (importedFromAccounts)
|
||||||
config.Field.ReadOnly.Add(ItemField.Contact.ToString());
|
config.Field.Readonly.Add($"{ItemField.Contact}");
|
||||||
|
|
||||||
// Phone numbers.
|
// Phone numbers.
|
||||||
// NB Main Phone is shared between Organisations and Individuals (home phone).
|
// NB Main Phone is shared between Organisations and Individuals (home phone).
|
||||||
if (!isOrganisation && !isIndividual)
|
if (!isOrganisation && !isIndividual)
|
||||||
config.Field.Hide.Add(ItemField.PhoneMain.ToString());
|
config.Field.Hide.Add($"{ItemField.PhoneMain}");
|
||||||
else if (importedFromAccounts)
|
else if (importedFromAccounts)
|
||||||
config.Field.ReadOnly.Add(ItemField.PhoneMain.ToString());
|
config.Field.Readonly.Add($"{ItemField.PhoneMain}");
|
||||||
|
|
||||||
// Organisation - Phone numbers.
|
// Organisation - Phone numbers.
|
||||||
if (!isOrganisation)
|
if (!isOrganisation)
|
||||||
{
|
{
|
||||||
config.Field.Hide.Add(ItemField.PhoneAlt.ToString());
|
config.Field.Hide.Add($"{ItemField.PhoneAlt}");
|
||||||
config.Field.Hide.Add(ItemField.PhoneDirect.ToString());
|
config.Field.Hide.Add($"{ItemField.PhoneDirect}");
|
||||||
config.Field.Hide.Add(ItemField.PhoneFax.ToString());
|
config.Field.Hide.Add($"{ItemField.PhoneFax}");
|
||||||
}
|
}
|
||||||
else if (importedFromAccounts)
|
else if (importedFromAccounts)
|
||||||
{
|
{
|
||||||
config.Field.ReadOnly.Add(ItemField.PhoneAlt.ToString());
|
config.Field.Readonly.Add($"{ItemField.PhoneAlt}");
|
||||||
config.Field.ReadOnly.Add(ItemField.PhoneFax.ToString());
|
config.Field.Readonly.Add($"{ItemField.PhoneFax}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Individual - Phone numbers.
|
// Individual - Phone numbers.
|
||||||
if (!isIndividual)
|
if (!isIndividual)
|
||||||
{
|
{
|
||||||
config.Field.Hide.Add(ItemField.PhoneMobile.ToString());
|
config.Field.Hide.Add($"{ItemField.PhoneMobile}");
|
||||||
}
|
}
|
||||||
else if (importedFromAccounts)
|
else if (importedFromAccounts)
|
||||||
{
|
{
|
||||||
config.Field.ReadOnly.Add(ItemField.PhoneMobile.ToString());
|
config.Field.Readonly.Add($"{ItemField.PhoneMobile}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Email.
|
// Email.
|
||||||
if (!isOrganisation && !isIndividual)
|
if (!isOrganisation && !isIndividual)
|
||||||
config.Field.Hide.Add(ItemField.Email.ToString());
|
config.Field.Hide.Add($"{ItemField.Email}");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (isOrganisation)
|
if (isOrganisation)
|
||||||
config.Field.Label.Add(ItemField.Email.ToString(), Localiser["label.email.domain"]);
|
config.Field.Label.Add($"{ItemField.Email}", Localiser["label.email.domain"]);
|
||||||
else
|
else
|
||||||
config.Field.Label.Add(ItemField.Email.ToString(), Localiser["label.email"]);
|
config.Field.Label.Add($"{ItemField.Email}", Localiser["label.email"]);
|
||||||
if (importedFromAccounts)
|
if (importedFromAccounts)
|
||||||
config.Field.ReadOnly.Add(ItemField.Email.ToString());
|
config.Field.Readonly.Add($"{ItemField.Email}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Individual.
|
// Individual.
|
||||||
if (!isIndividual)
|
if (!isIndividual)
|
||||||
{
|
{
|
||||||
config.Field.Hide.Add(ItemField.DateOfBirth.ToString());
|
config.Field.Hide.Add($"{ItemField.DateOfBirth}");
|
||||||
config.Field.Hide.Add(ItemField.MaritalStatus.ToString());
|
config.Field.Hide.Add($"{ItemField.MaritalStatus}");
|
||||||
config.Field.Hide.Add(ItemField.Spouse.ToString());
|
config.Field.Hide.Add($"{ItemField.Spouse}");
|
||||||
config.Field.Hide.Add(ItemField.Children.ToString());
|
config.Field.Hide.Add($"{ItemField.Children}");
|
||||||
config.Field.Hide.Add(ItemField.Hometown.ToString());
|
config.Field.Hide.Add($"{ItemField.Hometown}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Organisation - Website.
|
// Organisation - Website.
|
||||||
if (!isOrganisation)
|
if (!isOrganisation)
|
||||||
config.Field.Hide.Add(ItemField.Website.ToString());
|
config.Field.Hide.Add($"{ItemField.Website}");
|
||||||
else if (importedFromAccounts)
|
else if (importedFromAccounts)
|
||||||
config.Field.ReadOnly.Add(ItemField.Website.ToString());
|
config.Field.Readonly.Add($"{ItemField.Website}");
|
||||||
|
|
||||||
// Organisation - Company Number.
|
// Organisation - Company Number.
|
||||||
if (!isOrganisation)
|
if (!isOrganisation)
|
||||||
config.Field.Hide.Add(ItemField.CompanyNo.ToString());
|
config.Field.Hide.Add($"{ItemField.CompanyNo}");
|
||||||
|
|
||||||
// Organisation - VatReg.
|
// Organisation - VatReg.
|
||||||
if (!isOrganisation)
|
if (!isOrganisation)
|
||||||
config.Field.Hide.Add(ItemField.VatReg.ToString());
|
config.Field.Hide.Add($"{ItemField.VatReg}");
|
||||||
else if (importedFromAccounts)
|
else if (importedFromAccounts)
|
||||||
config.Field.ReadOnly.Add(ItemField.VatReg.ToString());
|
config.Field.Readonly.Add($"{ItemField.VatReg}");
|
||||||
|
|
||||||
// Prospect.
|
// Prospect.
|
||||||
if (!isGroup)
|
if (!isGroup)
|
||||||
config.Field.Hide.Add(ItemField.Prospect.ToString());
|
config.Field.Hide.Add($"{ItemField.Prospect}");
|
||||||
|
|
||||||
// Options - hidden if no options shown.
|
// Options - hidden if no options shown.
|
||||||
if (config.Field.Hide.ContainsCI(ItemField.Prospect.ToString()))
|
if (config.Field.Hide.ContainsCI($"{ItemField.Prospect}"))
|
||||||
config.Field.Hide.Add(ItemField.Options.ToString());
|
config.Field.Hide.Add($"{ItemField.Options}");
|
||||||
|
|
||||||
// Notes.
|
// Notes.
|
||||||
if (!showNotes)
|
if (!showNotes)
|
||||||
config.Field.Hide.Add(ItemField.Notes.ToString());
|
config.Field.Hide.Add($"{ItemField.Notes}");
|
||||||
|
|
||||||
// Status.
|
// Status.
|
||||||
if (importedFromAccounts)
|
if (importedFromAccounts)
|
||||||
config.Field.ReadOnly.Add(ItemField.Status.ToString());
|
config.Field.Readonly.Add($"{ItemField.Status}");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using DocumentFormat.OpenXml.EMMA;
|
using DocumentFormat.OpenXml.EMMA;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
using Sarand.BusinessMgr.Net.Core.Web.App;
|
using Sarand.BusinessMgr.Net.Core.Web.App;
|
||||||
using Sarand.BusinessMgr.Net.Core.Web.Controllers;
|
using Sarand.BusinessMgr.Net.Core.Web.Controllers;
|
||||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||||
@@ -40,7 +41,19 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
|||||||
public FilterData Filter { get; } = new FilterData();
|
public FilterData Filter { get; } = new FilterData();
|
||||||
public Sbm.AffiliateType GetFilterContactType()
|
public Sbm.AffiliateType GetFilterContactType()
|
||||||
{
|
{
|
||||||
return (Sbm.AffiliateType)Internals.AffiliateTypeCodes.GetTypeForCode(Filter.ContactType);
|
Sbm.AffiliateType affiliateType = (Sbm.AffiliateType)Internals.AffiliateTypeCodes.GetTypeForCode(Filter.ContactType);
|
||||||
|
if (affiliateType == 0 && !StringUtil.IsBlank(Filter.ContactType) && StringUtil.IsNumeric(Filter.ContactType, true))
|
||||||
|
affiliateType = (Sbm.AffiliateType)StringUtil.ToInt(Filter.ContactType);
|
||||||
|
return affiliateType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>List of Affiliate Types for filter dropdown.</summary>
|
||||||
|
public IEnumerable<SelectListItem> GetAffiliateTypeCodesForFilterSelect()
|
||||||
|
{
|
||||||
|
List<TypeCodeDesc> affiliateTypes = GetCodesOfType(Sbm.SystemCode.AffiliateType);
|
||||||
|
if (!affiliateTypes.Any(item => item.Type == (int)Sbm.AffiliateType.AnyOrganisation))
|
||||||
|
affiliateTypes.Insert(0, new TypeCodeDesc((int)Sbm.AffiliateType.AnyOrganisation, ((short)Sbm.AffiliateType.AnyOrganisation).ToString(), Localiser["label.organisation"]));
|
||||||
|
return new SelectList(affiliateTypes, "Code", "Desc");
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@@ -85,7 +98,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
|||||||
public SysId GetAffiliateId() { return StringUtil.ToSysId(Contact.Id); }
|
public SysId GetAffiliateId() { return StringUtil.ToSysId(Contact.Id); }
|
||||||
public SaStatus GetAffiliateStatus() { return SacsSystem.GetStatusForCode(Contact.StatusCode); }
|
public SaStatus GetAffiliateStatus() { return SacsSystem.GetStatusForCode(Contact.StatusCode); }
|
||||||
public ContactData Contact { get; } = new ContactData();
|
public ContactData Contact { get; } = new ContactData();
|
||||||
public Sbm.AffiliateType GetContactType()
|
public Sbm.AffiliateType GetAffiliateType()
|
||||||
{
|
{
|
||||||
if (StringUtil.ToBool(Contact.IsIndividual))
|
if (StringUtil.ToBool(Contact.IsIndividual))
|
||||||
return Sbm.AffiliateType.Individual;
|
return Sbm.AffiliateType.Individual;
|
||||||
@@ -109,8 +122,9 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
|||||||
if (StringUtil.IsBlank(Contact.Type))
|
if (StringUtil.IsBlank(Contact.Type))
|
||||||
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
|
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
|
||||||
}
|
}
|
||||||
bool isIndividual = SbmAffiliate.IsIndividual(GetContactType());
|
Sbm.AffiliateType affiliateType = GetAffiliateType();
|
||||||
bool isContactGroup = SbmAffiliate.IsContactGroup(GetContactType());
|
bool isIndividual = SbmAffiliate.IsIndividual(affiliateType);
|
||||||
|
bool isContactGroup = SbmAffiliate.IsContactGroup(affiliateType);
|
||||||
bool isOrganisation = !isIndividual && !isContactGroup;
|
bool isOrganisation = !isIndividual && !isContactGroup;
|
||||||
|
|
||||||
// Organisation Name.
|
// Organisation Name.
|
||||||
@@ -289,6 +303,18 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
|||||||
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
|
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
|
||||||
else if (StringUtil.GetLength(Contact.LastName) > GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_LastName))
|
else if (StringUtil.GetLength(Contact.LastName) > GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_LastName))
|
||||||
responseData.SetControlError(controlName, Localiser["msg.validation.maximum.length", GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_LastName)]);
|
responseData.SetControlError(controlName, Localiser["msg.validation.maximum.length", GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_LastName)]);
|
||||||
|
else if (isIndividual)
|
||||||
|
{
|
||||||
|
// Check that the individual name is unique.
|
||||||
|
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
|
||||||
|
if (SysId.IsValid(GetAffiliateId()) && StringUtil.ToBool(Contact.Exists))
|
||||||
|
prmAffiliate.IdsExcluded.Add(GetAffiliateId());
|
||||||
|
prmAffiliate.AffiliateType = Sbm.AffiliateType.Individual;
|
||||||
|
prmAffiliate.Name = SbmAffiliate.GetDisplayName(affiliateType, "", Contact.FirstName, Contact.LastName);
|
||||||
|
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.NotDeleted;
|
||||||
|
if (AccountMgr.GetAffiliateCount(prmAffiliate) > 0)
|
||||||
|
responseData.SetControlError(controlName, Localiser["msg.validation.duplicate.value"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Individual Phone Mobile.
|
// Individual Phone Mobile.
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
<div class="sbm-panel Associations fullheight">
|
<div class="sbm-panel Associations fullheight">
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
sbm.lbl.createCust= '@(Localiser.GetJavascriptText("caption.customer.create"))';
|
||||||
|
sbm.lbl.createSupp= '@(Localiser.GetJavascriptText("caption.supplier.create"))';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="sbm-panel-data sbm-flex">
|
<div class="sbm-panel-data sbm-flex">
|
||||||
@@ -37,23 +39,21 @@
|
|||||||
|
|
||||||
@* Filter Panel *@
|
@* Filter Panel *@
|
||||||
<div class="sbm-panel-filter">
|
<div class="sbm-panel-filter">
|
||||||
<div class="row pb4">
|
<div class="row">
|
||||||
<div class="col-sm-4 row pb4">
|
|
||||||
@* Association filter - name etc. *@
|
|
||||||
<div class="col-4 col-sm-5 sbm-label text-left text-sm-right">@Localiser["label.search"]</div>
|
|
||||||
<div class="col-7 col-sm-7">
|
|
||||||
@Html.TextBoxFor(model => model.Filter.Search, new { @id = "", @class = "FilterSearch sbm-input", @maxlength = "32" })
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-4 row pb4">
|
<div class="col-sm-4 row pb4">
|
||||||
@* Association Category *@
|
@* Association Category *@
|
||||||
<div class="col-4 col-sm-5 sbm-label text-left text-sm-right">@Localiser["label.type"]</div>
|
<div class="col-4 col-sm-4 sbm-label text-left text-sm-right">@Localiser["label.type"]</div>
|
||||||
<div class="col-7 col-sm-7">
|
<div class="col-7 col-sm-8">
|
||||||
@Html.DropDownListFor(model => model.Filter.AssociationType, Model.GetAssociationTypeCodesForSelect(), Localiser["label.any"], new { @id = "", @class = "FilterAssociationType sbm-select" })
|
@Html.DropDownListFor(model => model.Filter.AssociationType, Model.GetAssociationTypeCodesForSelect(), Localiser["label.any"], new { @id = "", @class = "FilterAssociationType sbm-select" })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-sm-4 row pb4">
|
||||||
<div class="col-sm-4 row pb4">
|
@* Association filter - name etc. *@
|
||||||
|
<div class="col-4 col-sm-4 sbm-label text-left text-sm-right">@Localiser["label.search"]</div>
|
||||||
|
<div class="col-7 col-sm-8">
|
||||||
|
@Html.TextBoxFor(model => model.Filter.Search, new { @id = "", @class = "FilterSearch sbm-input", @maxlength = "32" })
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -62,12 +62,12 @@
|
|||||||
<table class="sbm-item-list">
|
<table class="sbm-item-list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="pl-2">@Localiser["label.type"]</th>
|
<th class="@Model.GetFieldName(Model_Association.ItemField.Type) width10pc pl-1">@Localiser["label.type"]</th>
|
||||||
<th class="">@Localiser["label.code"]</th>
|
<th class="@Model.GetFieldName(Model_Association.ItemField.Code) width10pc pl-1">@Localiser["label.code"]</th>
|
||||||
<th class="">@Localiser["label.name"]</th>
|
<th class="@Model.GetFieldName(Model_Association.ItemField.Target) width25pc">@Localiser["label.name"]</th>
|
||||||
<th class="d-none d-md-table-cell">@Localiser["label.address"]</th>
|
<th class="@Model.GetFieldName(Model_Association.ItemField.Address) width25pc d-none d-md-table-cell">@Localiser["label.address"]</th>
|
||||||
<th class="d-none d-md-table-cell">@Localiser["label.notes"]</th>
|
<th class="@Model.GetFieldName(Model_Association.ItemField.Notes) width25pc d-none d-md-table-cell">@Localiser["label.notes"]</th>
|
||||||
<th class="center">@Localiser["label.status"]</th>
|
<th class="@Model.GetFieldName(Model_Association.ItemField.Status) width10pc center">@Localiser["label.status"]</th>
|
||||||
<th class="right" style="width:2%;"></th>
|
<th class="right" style="width:2%;"></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td colspan="6"><div class="sbm-panel-messages"></div></td></tr>
|
<tr><td colspan="6"><div class="sbm-panel-messages"></div></td></tr>
|
||||||
@@ -87,12 +87,12 @@
|
|||||||
@* Association row template - table is ignored. *@
|
@* Association row template - table is ignored. *@
|
||||||
<table>
|
<table>
|
||||||
<tr class="sbm-row-item Association">
|
<tr class="sbm-row-item Association">
|
||||||
<td><div class="AssociationType pl-1"></div></td>
|
<td class="@Model.GetFieldName(Model_Association.ItemField.Type) pl-1"></td>
|
||||||
<td><div class="AssociationCode"></div></td>
|
<td class="@Model.GetFieldName(Model_Association.ItemField.Code) pl-1"></td>
|
||||||
<td><div class="AssociationTargetName"></div></td>
|
<td class="@Model.GetFieldName(Model_Association.ItemField.Target)"></td>
|
||||||
<td class="d-none d-md-table-cell"><div class="AssociationAddress"></div></td>
|
<td class="@Model.GetFieldName(Model_Association.ItemField.Address) d-none d-md-table-cell"></td>
|
||||||
<td class="d-none d-md-table-cell"><div class="AssociationNotes"></div></td>
|
<td class="@Model.GetFieldName(Model_Association.ItemField.Notes) d-none d-md-table-cell"></td>
|
||||||
<td><div class="AssociationStatusDesc center"></div></td>
|
<td class="@Model.GetFieldName(Model_Association.ItemField.Status) center"></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
@* Burger menu *@
|
@* Burger menu *@
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
@Html.HiddenFor(model => model.Association.Exists, new { @id = "", @class = "AssociationExists sbm-input" })
|
@Html.HiddenFor(model => model.Association.Exists, new { @id = "", @class = "AssociationExists sbm-input" })
|
||||||
|
|
||||||
@* Association Type *@
|
@* Association Type *@
|
||||||
<div class="sbm-form-control AssociationType">
|
<div class="sbm-form-control @Model.GetFieldName(Model_Association.ItemField.Type)">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
<div class="sbm-label">
|
<div class="sbm-label">
|
||||||
@@ -31,7 +31,30 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.DropDownListFor(model => model.Association.Type, Model.GetAssociationTypeCodesForSelect(), Localiser["label.select"], new { @id = "cbAssociationType", @class = "AssociationType sbm-select" })
|
@Html.DropDownListFor(model => model.Association.Type, Model.GetAssociationTypeCodesForSelect(), Localiser["label.select"], new { @id = "cbAssociationType", @class = "AssociationType sbm-select sbm-auto-val" })
|
||||||
|
</div>
|
||||||
|
<div class="sbm-message"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@* Owner contact *@
|
||||||
|
<div class="sbm-form-control @Model.GetFieldName(Model_Association.ItemField.Owner)">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<div class="sbm-label">
|
||||||
|
<label for="ifAssociationOwner"><span>@Localiser["label.owner"]</span><span class="required"> *</span></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm">
|
||||||
|
<div class="sbc-control row">
|
||||||
|
<div class="col">
|
||||||
|
@Html.HiddenFor(model => model.Association.ContactIdOwner, new { @id = "", @class = "AssociationOwnerId sbm-input" })
|
||||||
|
<input type="text" id="ifAssociationOwner" class="AssociationOwner sbm-input sbm-auto-val" readonly="readonly" />
|
||||||
|
</div>
|
||||||
|
<div class="fixed">
|
||||||
|
@* <div class="sbc-action AssetOwnerSearch"><img src="~/img/action/search24.png" alt="" title="" /></div> *@
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="sbm-message"></div>
|
<div class="sbm-message"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -39,7 +62,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@* Target contact *@
|
@* Target contact *@
|
||||||
<div class="sbm-form-control AssociationTarget">
|
<div class="sbm-form-control @Model.GetFieldName(Model_Association.ItemField.Target)">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
<div class="sbm-label">
|
<div class="sbm-label">
|
||||||
@@ -49,8 +72,8 @@
|
|||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbc-control row">
|
<div class="sbc-control row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
@Html.HiddenFor(model => model.Association.AffiliateIdTarget, new { @id = "", @class = "AssociationId sbm-input" })
|
@Html.HiddenFor(model => model.Association.ContactIdTarget, new { @id = "", @class = "AssociationTargetId sbm-input" })
|
||||||
<input type="text" id="ifAssociationTarget" class="AssociationTarget sbm-input" readonly="readonly" />
|
<input type="text" id="ifAssociationTarget" class="AssociationTarget sbm-input sbm-auto-val" readonly="readonly" />
|
||||||
</div>
|
</div>
|
||||||
<div class="fixed">
|
<div class="fixed">
|
||||||
<div class="sbc-action AssetTargetSearch"><img src="~/img/action/search24.png" alt="" title="" /></div>
|
<div class="sbc-action AssetTargetSearch"><img src="~/img/action/search24.png" alt="" title="" /></div>
|
||||||
@@ -61,25 +84,52 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@* Association Code *@
|
<div class="row">
|
||||||
<div class="sbm-form-control AssociationCode">
|
<div class="col-sm-6">
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-3">
|
@* Association Code *@
|
||||||
<div class="sbm-label">
|
<div class="sbm-form-control @Model.GetFieldName(Model_Association.ItemField.Code)">
|
||||||
<label for="ifAssociationCode"><span>@Localiser["label.code"]</span></label>
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="sbm-label">
|
||||||
|
<label for="ifAssociationCode"><span>@Localiser["label.code"]</span></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm">
|
||||||
|
<div class="sbm-control">
|
||||||
|
@Html.TextBoxFor(model => model.Association.Code, new { @id = "ifAssociationCode", @class = "AssociationCode sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Association_Code) })
|
||||||
|
</div>
|
||||||
|
<div class="sbm-message"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
|
||||||
<div class="sbm-control">
|
</div>
|
||||||
@Html.TextBoxFor(model => model.Association.Code, new { @id = "ifAssociationCode", @class = "AssociationCode sbm-input", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Association_Code) })
|
<div class="col-sm-1"></div>
|
||||||
|
<div class="col-sm">
|
||||||
|
|
||||||
|
@* Association ExtRef *@
|
||||||
|
<div class="sbm-form-control @Model.GetFieldName(Model_Association.ItemField.ReferenceExt)">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-5">
|
||||||
|
<div class="sbm-label">
|
||||||
|
<label for="ifAssociationExtRef"><span>@Localiser["label.reference.external"]</span></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm">
|
||||||
|
<div class="sbm-control">
|
||||||
|
@Html.TextBoxFor(model => model.Association.ReferenceExt, new { @id = "ifAssociationExtRef", @class = "AssociationExtRef sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Association_ExtRef) })
|
||||||
|
</div>
|
||||||
|
<div class="sbm-message"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="sbm-message"></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@* Association status *@
|
@* Association status *@
|
||||||
<div class="sbm-form-control AssociationStatus">
|
<div class="sbm-form-control @Model.GetFieldName(Model_Association.ItemField.Status)">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
<div class="sbm-label">
|
<div class="sbm-label">
|
||||||
@@ -88,7 +138,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
<select id="cbAssociationStatus" class="sbm-select AssociationStatus" name="Association.StatusCode"></select>
|
<select id="cbAssociationStatus" class="AssociationStatus sbm-select sbm-auto-val" name="Association.StatusCode"></select>
|
||||||
</div>
|
</div>
|
||||||
<div class="sbm-message"></div>
|
<div class="sbm-message"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -96,7 +146,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@* Association Notes *@
|
@* Association Notes *@
|
||||||
<div class="sbm-form-control AssociationNotes">
|
<div class="sbm-form-control @Model.GetFieldName(Model_Association.ItemField.Notes)">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
<div class="sbm-label">
|
<div class="sbm-label">
|
||||||
@@ -105,7 +155,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextAreaFor(model => model.Association.Notes, new { @id = "ifAssociationNotes", @class = "AssociationNotes sbm-textarea", @rows = "3", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Association_Notes) })
|
@Html.TextAreaFor(model => model.Association.Notes, new { @id = "ifAssociationNotes", @class = "AssociationNotes sbm-textarea sbm-auto-val", @rows = "3", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Association_Notes) })
|
||||||
</div>
|
</div>
|
||||||
<div class="sbm-message"></div>
|
<div class="sbm-message"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -38,16 +38,20 @@
|
|||||||
|
|
||||||
@* Filter Panel *@
|
@* Filter Panel *@
|
||||||
<div class="sbm-panel-filter">
|
<div class="sbm-panel-filter">
|
||||||
<div class="row pb4">
|
<div class="row">
|
||||||
@* Contact filter - name etc. *@
|
<div class="col-sm-4 row pb4">
|
||||||
<div class="col-4 col-sm-2 sbm-label text-left text-sm-right">@Localiser["label.search"]</div>
|
@* Contact type *@
|
||||||
<div class="col-8 col-sm-4">
|
<div class="col-4 col-sm-4 sbm-label text-left text-sm-right">@Localiser["label.type"]</div>
|
||||||
@Html.TextBoxFor(model => model.Filter.Search, new { @id = "", @class = "FilterSearch sbm-input", @maxlength = "32" })
|
<div class="col-8 col-sm-8">
|
||||||
|
@Html.DropDownListFor(model => model.Filter.ContactType, Model.GetAffiliateTypeCodesForFilterSelect(), Localiser["label.any"], new { @id = "", @class = "FilterContactType sbm-select" })
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@* Contact type *@
|
<div class="col-sm-4 row pb4">
|
||||||
<div class="col-4 col-sm-2 sbm-label text-left text-sm-right">@Localiser["label.type"]</div>
|
@* Contact filter - name etc. *@
|
||||||
<div class="col-8 col-sm-4">
|
<div class="col-4 col-sm-4 sbm-label text-left text-sm-right">@Localiser["label.search"]</div>
|
||||||
@Html.DropDownListFor(model => model.Filter.ContactType, Model.GetAffiliateTypeCodesForSelect(), Localiser["label.any"], new { @id = "", @class = "FilterContactType sbm-select" })
|
<div class="col-8 col-sm-8">
|
||||||
|
@Html.TextBoxFor(model => model.Filter.Search, new { @id = "", @class = "FilterSearch sbm-input", @maxlength = "32" })
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -58,14 +62,14 @@
|
|||||||
<table class="sbm-item-list">
|
<table class="sbm-item-list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="pl-2">@Localiser["label.type"]</th>
|
<th class="@Model.GetFieldName(Model_Contact.ItemField.Type) width10pc pl-1">@Localiser["label.type"]</th>
|
||||||
<th class="">@Localiser["label.name"]</th>
|
<th class="@Model.GetFieldName(Model_Contact.ItemField.Name) width25pc pl-1">@Localiser["label.name"]</th>
|
||||||
<th class="d-none d-md-table-cell">@Localiser["label.address"]</th>
|
<th class="@Model.GetFieldName(Model_Contact.ItemField.Address) width25pc d-none d-md-table-cell">@Localiser["label.address"]</th>
|
||||||
<th class="d-none d-md-table-cell">@Localiser["label.contact"]</th>
|
<th class="@Model.GetFieldName(Model_Contact.ItemField.Contact) width10pc d-none d-md-table-cell">@Localiser["label.contact"]</th>
|
||||||
<th class="d-none d-sm-table-cell">@Localiser["label.phone"]</th>
|
<th class="@Model.GetFieldName(Model_Contact.ItemField.Phone) width10pc d-none d-sm-table-cell">@Localiser["label.phone"]</th>
|
||||||
<th class="d-none d-md-table-cell">@Localiser["label.notes"]</th>
|
<th class="@Model.GetFieldName(Model_Contact.ItemField.Notes) width25pc d-none d-md-table-cell">@Localiser["label.notes"]</th>
|
||||||
<th class="center">@Localiser["label.associations"]</th>
|
<th class="@Model.GetFieldName(Model_Contact.ItemField.Associations) width10pc center">@Localiser["label.associations"]</th>
|
||||||
<th class="center">@Localiser["label.status"]</th>
|
<th class="@Model.GetFieldName(Model_Contact.ItemField.Status) width10pc center">@Localiser["label.status"]</th>
|
||||||
<th class="right" style="width:2%;"></th>
|
<th class="right" style="width:2%;"></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td colspan="6"><div class="sbm-panel-messages"></div></td></tr>
|
<tr><td colspan="6"><div class="sbm-panel-messages"></div></td></tr>
|
||||||
@@ -85,14 +89,14 @@
|
|||||||
@* Item row template - table is ignored. *@
|
@* Item row template - table is ignored. *@
|
||||||
<table>
|
<table>
|
||||||
<tr class="sbm-row-item Contact">
|
<tr class="sbm-row-item Contact">
|
||||||
<td><div class="ContactType pl-1"></div></td>
|
<td class="@Model.GetFieldName(Model_Contact.ItemField.Type) pl-1"></td>
|
||||||
<td><div class="ContactName"></div></td>
|
<td class="@Model.GetFieldName(Model_Contact.ItemField.Name) pl-1"></td>
|
||||||
<td class="d-none d-md-table-cell"><div class="ContactAddress"></div></td>
|
<td class="@Model.GetFieldName(Model_Contact.ItemField.Address) d-none d-md-table-cell"></td>
|
||||||
<td class="d-none d-md-table-cell"><div class="ContactContact"></div></td>
|
<td class="@Model.GetFieldName(Model_Contact.ItemField.Contact) d-none d-md-table-cell"></td>
|
||||||
<td class="d-none d-sm-table-cell"><div class="ContactPhone"></div></td>
|
<td class="@Model.GetFieldName(Model_Contact.ItemField.Phone) d-none d-sm-table-cell"></td>
|
||||||
<td class="d-none d-md-table-cell"><div class="ContactNotes"></div></td>
|
<td class="@Model.GetFieldName(Model_Contact.ItemField.Notes) d-none d-md-table-cell"></td>
|
||||||
<td class=""><div class="ContactAssociationCount center"></div></td>
|
<td class="@Model.GetFieldName(Model_Contact.ItemField.Associations) center"></td>
|
||||||
<td><div class="ContactStatusDesc center"></div></td>
|
<td class="@Model.GetFieldName(Model_Contact.ItemField.Status) center"></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
@* Burger menu *@
|
@* Burger menu *@
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextBoxFor(model => model.Contact.Abbreviation, new { @id = "ifContactAbbreviation", @class = "ContactAbbreviation sbm-input upper", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Abbrev) })
|
@Html.TextBoxFor(model => model.Contact.Abbreviation, new { @id = "ifContactAbbreviation", @class = "ContactAbbreviation sbm-input sbm-auto-val upper", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Abbrev) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextBoxFor(model => model.Contact.Name, new { @id = "ifContactName", @class = "ContactName sbm-input", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Name) })
|
@Html.TextBoxFor(model => model.Contact.Name, new { @id = "ifContactName", @class = "ContactName sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Name) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextBoxFor(model => model.Contact.Nature, new { @id = "ifContactNature", @class = "ContactNature sbm-input", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Nature) })
|
@Html.TextBoxFor(model => model.Contact.Nature, new { @id = "ifContactNature", @class = "ContactNature sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Nature) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextBoxFor(model => model.Contact.Contact, new { @id = "ifContactContact", @class = "ContactContact sbm-input", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Contact) })
|
@Html.TextBoxFor(model => model.Contact.Contact, new { @id = "ifContactContact", @class = "ContactContact sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Contact) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -140,7 +140,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.DropDownListFor(model => model.Contact.Title, Model.GetCodeTypeCodesForSelect(Sbm.ApplCodeType.ContactTitle), new { @id = "cbContactTitle", @class = "ContactTitle sbm-select", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Title) })
|
@Html.DropDownListFor(model => model.Contact.Title, Model.GetCodeTypeCodesForSelect(Sbm.ApplCodeType.ContactTitle), new { @id = "cbContactTitle", @class = "ContactTitle sbm-select sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Title) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -161,7 +161,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextBoxFor(model => model.Contact.Salutation, new { @id = "ifContactSalutation", @class = "ContactSalutation sbm-input", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Salutation) })
|
@Html.TextBoxFor(model => model.Contact.Salutation, new { @id = "ifContactSalutation", @class = "ContactSalutation sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Salutation) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextBoxFor(model => model.Contact.FirstName, new { @id = "ifContactFirstName", @class = "ContactFirstName sbm-input", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_FirstName) })
|
@Html.TextBoxFor(model => model.Contact.FirstName, new { @id = "ifContactFirstName", @class = "ContactFirstName sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_FirstName) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -205,7 +205,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextBoxFor(model => model.Contact.Initials, new { @id = "ifContactInitials", @class = "ContactInitials sbm-input", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Initials) })
|
@Html.TextBoxFor(model => model.Contact.Initials, new { @id = "ifContactInitials", @class = "ContactInitials sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Initials) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -225,7 +225,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextBoxFor(model => model.Contact.LastName, new { @id = "ifContactLastName", @class = "ContactLastName sbm-input", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_LastName) })
|
@Html.TextBoxFor(model => model.Contact.LastName, new { @id = "ifContactLastName", @class = "ContactLastName sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_LastName) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -245,7 +245,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextBoxFor(model => model.Contact.PhoneMain, new { @id = "ifContactPhoneMain", @class = "ContactPhoneMain sbm-input", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_PhoneMain) })
|
@Html.TextBoxFor(model => model.Contact.PhoneMain, new { @id = "ifContactPhoneMain", @class = "ContactPhoneMain sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_PhoneMain) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -266,7 +266,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextBoxFor(model => model.Contact.PhoneAlt, new { @id = "ifContactPhoneAlt", @class = "ContactPhoneAlt sbm-input", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_PhoneAlt) })
|
@Html.TextBoxFor(model => model.Contact.PhoneAlt, new { @id = "ifContactPhoneAlt", @class = "ContactPhoneAlt sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_PhoneAlt) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -283,7 +283,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextBoxFor(model => model.Contact.PhoneMobile, new { @id = "ifContactPhoneMobile", @class = "ContactPhoneMobile sbm-input", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_PhoneMobile) })
|
@Html.TextBoxFor(model => model.Contact.PhoneMobile, new { @id = "ifContactPhoneMobile", @class = "ContactPhoneMobile sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_PhoneMobile) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -306,7 +306,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextBoxFor(model => model.Contact.PhoneDirect, new { @id = "ifContactPhoneDirect", @class = "ContactPhoneDirect sbm-input", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_PhoneDirect) })
|
@Html.TextBoxFor(model => model.Contact.PhoneDirect, new { @id = "ifContactPhoneDirect", @class = "ContactPhoneDirect sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_PhoneDirect) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -327,7 +327,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextBoxFor(model => model.Contact.PhoneFax, new { @id = "ifContactPhoneFax", @class = "ContactPhoneFax sbm-input", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_PhoneFax) })
|
@Html.TextBoxFor(model => model.Contact.PhoneFax, new { @id = "ifContactPhoneFax", @class = "ContactPhoneFax sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_PhoneFax) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -347,7 +347,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextBoxFor(model => model.Contact.Email, new { @id = "ifContactEmail", @class = "ContactEmail sbm-input", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Email) })
|
@Html.TextBoxFor(model => model.Contact.Email, new { @id = "ifContactEmail", @class = "ContactEmail sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Email) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -364,7 +364,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextBoxFor(model => model.Contact.Website, new { @id = "ifContactWebsite", @class = "ContactWebsite sbm-input", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Website) })
|
@Html.TextBoxFor(model => model.Contact.Website, new { @id = "ifContactWebsite", @class = "ContactWebsite sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Website) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -384,7 +384,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextBoxFor(model => model.Contact.CompanyNo, new { @id = "ifContactCompanyNo", @class = "ContactCompanyNo sbm-input", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_CompanyNo) })
|
@Html.TextBoxFor(model => model.Contact.CompanyNo, new { @id = "ifContactCompanyNo", @class = "ContactCompanyNo sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_CompanyNo) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -405,7 +405,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextBoxFor(model => model.Contact.VatReg, new { @id = "ifContactVatReg", @class = "ContactVatReg sbm-input", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_VatReg) })
|
@Html.TextBoxFor(model => model.Contact.VatReg, new { @id = "ifContactVatReg", @class = "ContactVatReg sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_VatReg) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -426,7 +426,8 @@
|
|||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-form-control @Model.GetFieldName(Model_Contact.ItemField.Prospect)">
|
<div class="sbm-form-control @Model.GetFieldName(Model_Contact.ItemField.Prospect)">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.CheckBoxFor(Model => Model.Contact.Prospect, new { @id = "chkContactProspect", @class = "ContactProspect sbm-checkbox" })
|
<input type="checkbox" name="Contact.Prospect" id="chkContactProspect" class="ContactProspect sbm-checkbox mt-1" value="true" />
|
||||||
|
<input type="checkbox" name="Contact.Prospect" class="sbm-checkbox hidden" value="false" />
|
||||||
<span class="sbc-label pointer" onclick="$('#chkContactProspect').click();">@Localiser["label.prospect"]</span>
|
<span class="sbc-label pointer" onclick="$('#chkContactProspect').click();">@Localiser["label.prospect"]</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="sbm-message"></div>
|
<div class="sbm-message"></div>
|
||||||
@@ -445,7 +446,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="sbm-control">
|
<div class="sbm-control">
|
||||||
@Html.TextAreaFor(model => model.Contact.Notes, new { @id = "ifContactNotes", @class = "ContactNotes sbm-textarea", @rows = "3", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Notes) })
|
@Html.TextAreaFor(model => model.Contact.Notes, new { @id = "ifContactNotes", @class = "ContactNotes sbm-textarea sbm-auto-val", @rows = "3", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Affiliate_Notes) })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,6 +2,17 @@
|
|||||||
BusMgr Portal - Base stylesheet.
|
BusMgr Portal - Base stylesheet.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
:root
|
||||||
|
{
|
||||||
|
--color-OldGold: #d4af37;
|
||||||
|
--color-OliveGreen: #808000;
|
||||||
|
--color-CornflowerBlue: #6495ed;
|
||||||
|
--color-RoyalBlue: #4169e1;
|
||||||
|
--color-NavyBlue: #000080;
|
||||||
|
--color-DarkBlue: #00008B;
|
||||||
|
--color-Indigo: #4b0082;
|
||||||
|
}
|
||||||
|
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@@ -195,7 +206,32 @@ td.action
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fullwidth
|
.width5pc
|
||||||
|
{
|
||||||
|
width: 5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.width10pc
|
||||||
|
{
|
||||||
|
width: 10%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.width20pc
|
||||||
|
{
|
||||||
|
width: 20%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.width25pc
|
||||||
|
{
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.width50pc
|
||||||
|
{
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fullwidth, .width100pc
|
||||||
{
|
{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
@@ -389,9 +425,9 @@ td.action
|
|||||||
z-index: 99;
|
z-index: 99;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hidden
|
.hidden, .sbm-hidden
|
||||||
{
|
{
|
||||||
display: none;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.shadow
|
.shadow
|
||||||
|
|||||||
@@ -2,14 +2,13 @@
|
|||||||
BusMgr Portal - Data stylesheet.
|
BusMgr Portal - Data stylesheet.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Data panel */
|
||||||
|
|
||||||
:root
|
:root
|
||||||
{
|
{
|
||||||
--color-OliveGreen: #808000;
|
|
||||||
--color-DataPanel-main: var(--color-OliveGreen);
|
--color-DataPanel-main: var(--color-OliveGreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Data panel */
|
|
||||||
|
|
||||||
.sbm-panel-data
|
.sbm-panel-data
|
||||||
{
|
{
|
||||||
margin: 6px auto;
|
margin: 6px auto;
|
||||||
|
|||||||
@@ -133,6 +133,11 @@
|
|||||||
margin: 0 0 16px 0;
|
margin: 0 0 16px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sbm-form .sbm-form-control .sbm-form-control
|
||||||
|
{
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.sbm-form .sbm-form-control .sbm-label
|
.sbm-form .sbm-form-control .sbm-label
|
||||||
{
|
{
|
||||||
margin: 0 0 8px 0;
|
margin: 0 0 8px 0;
|
||||||
@@ -224,8 +229,8 @@
|
|||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: #d4af37;
|
background-color: var(--color-OldGold);
|
||||||
border: 1px solid #d4af37;
|
border: 1px solid var(--color-OldGold);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,10 +11,6 @@
|
|||||||
--color-primary: #4b0082;
|
--color-primary: #4b0082;
|
||||||
--color-light: #9b71b9;
|
--color-light: #9b71b9;
|
||||||
--color-pale: #ebe2f1;
|
--color-pale: #ebe2f1;
|
||||||
/* Tetrad/Square colors */
|
|
||||||
--color-alt1: #820a00;
|
|
||||||
--color-alt2: #378200;
|
|
||||||
--color-alt3: #007882;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Document */
|
/* Document */
|
||||||
@@ -166,7 +162,7 @@ button.accept-policy
|
|||||||
a, a:hover
|
a, a:hover
|
||||||
{
|
{
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
color: #d4af37;
|
color: var(--color-OldGold);
|
||||||
}
|
}
|
||||||
|
|
||||||
a:focus
|
a:focus
|
||||||
@@ -326,6 +322,17 @@ a:focus
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Dialogs */
|
/* Dialogs */
|
||||||
|
|
||||||
|
:root
|
||||||
|
{
|
||||||
|
--color-dialog: var(--color-OldGold);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-dialog.sbm-dark-blue
|
||||||
|
{
|
||||||
|
--color-dialog: var(--color-DarkBlue);
|
||||||
|
}
|
||||||
|
|
||||||
.sbm-dialog
|
.sbm-dialog
|
||||||
{
|
{
|
||||||
display: none;
|
display: none;
|
||||||
@@ -350,7 +357,7 @@ a:focus
|
|||||||
.ui-dialog.ui-widget.ui-widget-content
|
.ui-dialog.ui-widget.ui-widget-content
|
||||||
{
|
{
|
||||||
border-width: 2px;
|
border-width: 2px;
|
||||||
border-color: #d4af37;
|
border-color: var(--color-dialog);
|
||||||
-moz-box-shadow: 4px 4px 6px #ccc;
|
-moz-box-shadow: 4px 4px 6px #ccc;
|
||||||
-webkit-box-shadow: 4px 4px 6px #ccc;
|
-webkit-box-shadow: 4px 4px 6px #ccc;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -365,8 +372,8 @@ a:focus
|
|||||||
{
|
{
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: #d4af37;
|
background-color: var(--color-dialog);
|
||||||
border-color: #d4af37;
|
border-color: var(--color-dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-widget-content
|
.ui-widget-content
|
||||||
@@ -383,12 +390,12 @@ a:focus
|
|||||||
|
|
||||||
.ui-dialog.no-close .ui-dialog-titlebar-close
|
.ui-dialog.no-close .ui-dialog-titlebar-close
|
||||||
{
|
{
|
||||||
/*display: none;*/
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-dialog .ui-dialog-buttonpane
|
.ui-dialog .ui-dialog-buttonpane
|
||||||
{
|
{
|
||||||
border-color: #d4af37;
|
border-color: var(--color-dialog);
|
||||||
margin-top: .25em;
|
margin-top: .25em;
|
||||||
padding: .2em 1em .2em .5em;
|
padding: .2em 1em .2em .5em;
|
||||||
}
|
}
|
||||||
@@ -398,8 +405,8 @@ a:focus
|
|||||||
min-width: 80px;
|
min-width: 80px;
|
||||||
margin: .5em .25em .5em .5em;
|
margin: .5em .25em .5em .5em;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: #d4af37;
|
background-color: var(--color-dialog);
|
||||||
border-color: #d4af37;
|
border-color: var(--color-dialog);
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,7 +424,7 @@ a:focus
|
|||||||
.ui-datepicker .ui-datepicker-header
|
.ui-datepicker .ui-datepicker-header
|
||||||
{
|
{
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border: 1px solid #d4af37;
|
border: 1px solid var(--color-OldGold);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The End */
|
/* The End */
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
}
|
}
|
||||||
as.doRefreshResults = function (response)
|
as.doRefreshResults = function (response)
|
||||||
{
|
{
|
||||||
sbm.debug('doRefreshResults', response);
|
//sbm.debug('doRefreshResults', response);
|
||||||
delete sbm.awaitingRefreshResponse;
|
delete sbm.awaitingRefreshResponse;
|
||||||
$pnl.msgs.hide().empty();
|
$pnl.msgs.hide().empty();
|
||||||
let $table = $('table', $pnl.table).find('tbody tr').remove().end();
|
let $table = $('table', $pnl.table).find('tbody tr').remove().end();
|
||||||
@@ -31,6 +31,9 @@
|
|||||||
if (!response.success) return;
|
if (!response.success) return;
|
||||||
|
|
||||||
// Reference data.
|
// Reference data.
|
||||||
|
as.config = response.config;
|
||||||
|
as.configCust = response.configCust;
|
||||||
|
as.configSupp = response.configSupp;
|
||||||
as.data.associationTypes = response.associationTypes;
|
as.data.associationTypes = response.associationTypes;
|
||||||
as.data.statuses = response.statuses;
|
as.data.statuses = response.statuses;
|
||||||
as.data.defaultStatusCode = response.defaultStatusCode;
|
as.data.defaultStatusCode = response.defaultStatusCode;
|
||||||
@@ -39,26 +42,25 @@
|
|||||||
$pnl.bgr.invisible();
|
$pnl.bgr.invisible();
|
||||||
$pnl.mnu.empty();
|
$pnl.mnu.empty();
|
||||||
$pnl.mnu.append(as.getFilterMenuOption(sbm.lbl.refresh, function () { as.refreshResults(); }, 'sbm-refresh'));
|
$pnl.mnu.append(as.getFilterMenuOption(sbm.lbl.refresh, function () { as.refreshResults(); }, 'sbm-refresh'));
|
||||||
$pnl.mnu.append(as.getFilterMenuOption(sbm.lbl.create, function () { as.createItem(); }, 'sbm-add'));
|
$pnl.mnu.append(as.getFilterMenuOption(sbm.lbl.createCust, function () { as.createItem(as.configCust, sbm.lbl.createCust); }, 'sbm-add'));
|
||||||
|
$pnl.mnu.append(as.getFilterMenuOption(sbm.lbl.createSupp, function () { as.createItem(as.configSupp, sbm.lbl.createSupp); }, 'sbm-add'));
|
||||||
$pnl.bgr.toggleVisibility(!!$('.sbm-dropdown-item', $pnl.mnu).length);
|
$pnl.bgr.toggleVisibility(!!$('.sbm-dropdown-item', $pnl.mnu).length);
|
||||||
|
|
||||||
// Items.
|
// Items.
|
||||||
var items = response.associations || [];
|
var items = response.associations || [];
|
||||||
if (!items.length)
|
if (!items.length)
|
||||||
return $pnl.msgs.append($('<div class="sbm-message">' + sbm.msg.dataNoneFound + '</div>')).fadeIn(500);
|
return $pnl.msgs.append($('<div class="sbm-message">' + sbm.msg.dataNoneFound + '</div>')).fadeIn(500);
|
||||||
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||||
$table.append(as.populateItem(as.getItemTemplate(), items[itemIdx]));
|
$table.append(as.populateItem(as.getItemTemplate(), items[itemIdx]));
|
||||||
|
sbm.configureItemTable(as.config, $table);
|
||||||
}
|
}
|
||||||
as.populateItem = function ($item, item)
|
as.populateItem = function ($item, item)
|
||||||
{
|
{
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
$pnl.msgs.hide().empty();
|
|
||||||
$item.prop('id', as.getItemId(item));
|
$item.prop('id', as.getItemId(item));
|
||||||
$('.AssociationCode', $item).text(item.code);
|
sbm.populateItemValues(as.config, $item, item.field.value);
|
||||||
$('.AssociationTargetName', $item).text(item.targetName);
|
let prefix = as.config.column.prefix;
|
||||||
$('.AssociationType', $item).text(item.typeDesc);
|
$('.' + prefix + 'Status', $item).removeStatusClasses().addClass('sbm-status-' + item.statusCode.toLowerCase());
|
||||||
$('.AssociationAddress', $item).text(item.addressSummary);
|
|
||||||
$('.AssociationNotes', $item).text(item.notes);
|
|
||||||
$('.AssociationStatusDesc', $item).text(item.statusDesc).removeStatusClasses().addClass('sbm-status-' + item.statusCode.toLowerCase());
|
|
||||||
// Actions.
|
// Actions.
|
||||||
var $bgr = $('.sbm-burger', $item).hide();
|
var $bgr = $('.sbm-burger', $item).hide();
|
||||||
let $mnu = $('ul.sbm-dropdown-menu', $bgr).empty();
|
let $mnu = $('ul.sbm-dropdown-menu', $bgr).empty();
|
||||||
@@ -66,7 +68,7 @@
|
|||||||
{
|
{
|
||||||
let fnUpd = function () { as.updateItem(item) };
|
let fnUpd = function () { as.updateItem(item) };
|
||||||
$mnu.append(as.getItemMenuOption(sbm.lbl.edit, fnUpd, 'sbm-edit'));
|
$mnu.append(as.getItemMenuOption(sbm.lbl.edit, fnUpd, 'sbm-edit'));
|
||||||
$('.AssociationTargetName', $item).off('click').on('click', fnUpd).addClass('sbm-action-text');
|
$('.' + prefix + 'Target', $item).off('click').on('click', fnUpd).addClass('sbm-action-text');
|
||||||
$item.off('dblclick').on('dblclick', fnUpd);
|
$item.off('dblclick').on('dblclick', fnUpd);
|
||||||
}
|
}
|
||||||
$bgr.toggle(!!$('.sbm-dropdown-item', $mnu).length);
|
$bgr.toggle(!!$('.sbm-dropdown-item', $mnu).length);
|
||||||
@@ -74,7 +76,7 @@
|
|||||||
}
|
}
|
||||||
as.getItemId = function (item)
|
as.getItemId = function (item)
|
||||||
{
|
{
|
||||||
return 'Ass_' + (item || {}).id;
|
return 'Asn_' + (item || {}).id;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
@@ -106,25 +108,25 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
as.createItem = function ()
|
as.createItem = function (cfg, title)
|
||||||
{
|
{
|
||||||
as.clearItem();
|
as.clearItem(cfg);
|
||||||
let $ctrls = $('.sbm-input,.sbm-textarea,.sbm-select', $frm.item);
|
let $ctrls = $('.sbm-input,.sbm-textarea,.sbm-select', $frm.item);
|
||||||
$ctrls.filter('.AssociationType').val('').prop('disabled', false);
|
$ctrls.filter('.AssociationType').val('').prop('disabled', false);
|
||||||
$ctrls.filter('.AssociationStatus').val(as.data.defaultStatusCode);
|
$ctrls.filter('.AssociationStatus').val(as.data.defaultStatusCode);
|
||||||
$dlg.item.dialog('option', 'title', sbm.dlg.title.createAssociation);
|
as.openItemDlg(cfg, title);
|
||||||
as.openItemDlg();
|
|
||||||
}
|
}
|
||||||
as.clearItem = function ()
|
as.clearItem = function (cfg)
|
||||||
{
|
{
|
||||||
sbm.clearControlErrors($frm.item);
|
sbm.clearItemForm($frm.item);
|
||||||
$('.sbm-input,.sbm-textarea,.sbm-select', $frm.item).val('');
|
|
||||||
sbm.populateSelectCodeDesc('#cbAssociationType', as.data.associationTypes);
|
sbm.populateSelectCodeDesc('#cbAssociationType', as.data.associationTypes);
|
||||||
sbm.populateSelectCodeDesc('#cbAssociationStatus', as.data.statuses);
|
sbm.populateSelectCodeDesc('#cbAssociationStatus', as.data.statuses);
|
||||||
}
|
}
|
||||||
as.openItemDlg = function ()
|
as.openItemDlg = function (cfg, title)
|
||||||
{
|
{
|
||||||
sbm.openDialog($dlg.item, 600, 640);
|
sbm.configureItemControls(cfg, $frm.item);
|
||||||
|
$dlg.item.dialog('option', 'title', title);
|
||||||
|
sbm.openDialog($dlg.item, 640, 600);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
@@ -137,23 +139,22 @@
|
|||||||
as.onUpdateItem = function (response)
|
as.onUpdateItem = function (response)
|
||||||
{
|
{
|
||||||
//sbm.debug('onUpdateItem', response);
|
//sbm.debug('onUpdateItem', response);
|
||||||
as.clearItem();
|
|
||||||
if (!response.success) return;
|
if (!response.success) return;
|
||||||
|
let cfg = response.config || {};
|
||||||
|
let prefix = cfg.field.prefix;
|
||||||
|
as.clearItem(cfg);
|
||||||
let item = response.association;
|
let item = response.association;
|
||||||
|
sbm.populateFormValues(cfg, $frm.item, item.field.value);
|
||||||
let $ctrls = $('.sbm-input,.sbm-textarea,.sbm-select', $frm.item);
|
let $ctrls = $('.sbm-input,.sbm-textarea,.sbm-select', $frm.item);
|
||||||
$ctrls.filter('.AssociationId').val(item.id);
|
$ctrls.filter('.AssociationId').val(item.id);
|
||||||
$ctrls.filter('.AssociationExists').val(1);
|
$ctrls.filter('.AssociationExists').val(1);
|
||||||
let $ctrlType = $ctrls.filter('.AssociationType');
|
let $ctrlType = $ctrls.filter('.AssociationType');
|
||||||
sbm.selectOrAdd($ctrlType, item.typeCode, item.typeDesc)
|
sbm.selectOrAdd($ctrlType, item.typeCode, item.typeDesc)
|
||||||
if ($ctrlType.val()) $ctrlType.prop('disabled', true);
|
//if ($ctrlType.val()) $ctrlType.prop('disabled', true);
|
||||||
|
$ctrls.filter('.AssociationOwnerId').val(item.ownerId);
|
||||||
$ctrls.filter('.AssociationTargetId').val(item.targetId);
|
$ctrls.filter('.AssociationTargetId').val(item.targetId);
|
||||||
$ctrls.filter('.AssociationTarget').val(item.targetName);
|
|
||||||
$ctrls.filter('.AssociationCode').val(item.code);
|
|
||||||
$ctrls.filter('.AssociationDesc').val(item.desc);
|
|
||||||
$ctrls.filter('.AssociationNotes').val(item.notes);
|
|
||||||
sbm.selectOrAdd($ctrls.filter('.AssociationStatus'), item.statusCode, item.statusDesc)
|
sbm.selectOrAdd($ctrls.filter('.AssociationStatus'), item.statusCode, item.statusDesc)
|
||||||
$dlg.item.dialog('option', 'title', sbm.dlg.title.updateAssociation);
|
as.openItemDlg(cfg, cfg.title || sbm.dlg.title.updateAssociation);
|
||||||
as.openItemDlg();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
@@ -168,6 +169,7 @@
|
|||||||
sbm.refreshControlValues(response.controlValues);
|
sbm.refreshControlValues(response.controlValues);
|
||||||
if (!response.success) return;
|
if (!response.success) return;
|
||||||
$dlg.item.dialog('close');
|
$dlg.item.dialog('close');
|
||||||
|
$pnl.msgs.hide().empty();
|
||||||
|
|
||||||
var item = response.association;
|
var item = response.association;
|
||||||
var $item = $('#' + as.getItemId(item), $pnl.table);
|
var $item = $('#' + as.getItemId(item), $pnl.table);
|
||||||
@@ -176,6 +178,7 @@
|
|||||||
$item = as.getItemTemplate();
|
$item = as.getItemTemplate();
|
||||||
$('table tbody', $pnl.table).prepend($item).show();
|
$('table tbody', $pnl.table).prepend($item).show();
|
||||||
}
|
}
|
||||||
|
let cfg = response.config || {};
|
||||||
as.populateItem($item, item);
|
as.populateItem($item, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,21 +56,17 @@
|
|||||||
return $pnl.msgs.append($('<div class="sbm-message">' + sbm.msg.dataNoneFound + '</div>')).fadeIn(500);
|
return $pnl.msgs.append($('<div class="sbm-message">' + sbm.msg.dataNoneFound + '</div>')).fadeIn(500);
|
||||||
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||||
$table.append(co.populateItem(co.getItemTemplate(), items[itemIdx]));
|
$table.append(co.populateItem(co.getItemTemplate(), items[itemIdx]));
|
||||||
|
sbm.configureItemTable(co.config, $table);
|
||||||
}
|
}
|
||||||
co.populateItem = function ($item, item)
|
co.populateItem = function ($item, item)
|
||||||
{
|
{
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
$pnl.msgs.hide().empty();
|
|
||||||
$item.prop('id', co.getItemId(item));
|
$item.prop('id', co.getItemId(item));
|
||||||
$('.ContactName', $item).text(item.displayName);
|
sbm.populateItemValues(co.config, $item, item.field.value);
|
||||||
$('.ContactType', $item).text(item.typeDesc);
|
let prefix = co.config.column.prefix;
|
||||||
if (item.associationCount)
|
if (item.associationCount)
|
||||||
$('.ContactAssociationCount', $item).text(item.associationCount).on('click', function () { co.onClickAssociationCount(item); }).addClass('sbm-action-text');
|
$('.' + prefix + 'Associations', $item).text(item.associationCount).off('click').on('click', function () { co.onClickAssociationCount(item); }).addClass('sbm-action-text');
|
||||||
$('.ContactAddress', $item).text(item.addressSummary);
|
$('.' + prefix + 'Status', $item).removeStatusClasses().addClass('sbm-status-' + item.statusCode.toLowerCase());
|
||||||
$('.ContactContact', $item).text(item.contact);
|
|
||||||
$('.ContactPhone', $item).text(item.phone);
|
|
||||||
$('.ContactNotes', $item).text(item.notes);
|
|
||||||
$('.ContactStatusDesc', $item).text(item.statusDesc).removeStatusClasses().addClass('sbm-status-' + item.statusCode.toLowerCase());
|
|
||||||
// Actions.
|
// Actions.
|
||||||
var $bgr = $('.sbm-burger', $item).hide();
|
var $bgr = $('.sbm-burger', $item).hide();
|
||||||
let $mnu = $('ul.sbm-dropdown-menu', $bgr).empty();
|
let $mnu = $('ul.sbm-dropdown-menu', $bgr).empty();
|
||||||
@@ -78,7 +74,7 @@
|
|||||||
{
|
{
|
||||||
let fnUpd = function () { co.updateItem(item) };
|
let fnUpd = function () { co.updateItem(item) };
|
||||||
$mnu.append(co.getItemMenuOption(sbm.lbl.edit, fnUpd, 'sbm-edit'));
|
$mnu.append(co.getItemMenuOption(sbm.lbl.edit, fnUpd, 'sbm-edit'));
|
||||||
$('.ContactName', $item).off('click').on('click', fnUpd).addClass('sbm-action-text');
|
$('.' + prefix + 'Name', $item).off('click').on('click', fnUpd).addClass('sbm-action-text');
|
||||||
$item.off('dblclick').on('dblclick', fnUpd);
|
$item.off('dblclick').on('dblclick', fnUpd);
|
||||||
}
|
}
|
||||||
$bgr.toggle(!!$('.sbm-dropdown-item', $mnu).length);
|
$bgr.toggle(!!$('.sbm-dropdown-item', $mnu).length);
|
||||||
@@ -121,10 +117,9 @@
|
|||||||
co.createItem = function (cfg, title)
|
co.createItem = function (cfg, title)
|
||||||
{
|
{
|
||||||
co.clearItem(cfg);
|
co.clearItem(cfg);
|
||||||
let frm = $frm.item;
|
let $ctrls = $('.sbm-input,.sbm-textarea,.sbm-select', $frm.item);
|
||||||
$('.ContactStatus', frm).val(co.data.defaultStatusCode).prop('readonly', false);
|
$ctrls.filter('.ContactStatus').val(co.data.defaultStatusCode);
|
||||||
co.configureItemControls(cfg);
|
co.openItemDlg(cfg, title);
|
||||||
co.openItemDlg(title);
|
|
||||||
}
|
}
|
||||||
co.clearItem = function (cfg)
|
co.clearItem = function (cfg)
|
||||||
{
|
{
|
||||||
@@ -135,30 +130,13 @@
|
|||||||
if (cfg.isGroup) $('.ContactIsGroup', frm).val(1);
|
if (cfg.isGroup) $('.ContactIsGroup', frm).val(1);
|
||||||
sbm.populateSelectCodeDesc('#cbContactType', co.data.organisationTypes);
|
sbm.populateSelectCodeDesc('#cbContactType', co.data.organisationTypes);
|
||||||
sbm.populateSelectCodeDesc('#cbContactTitle', co.data.titles);
|
sbm.populateSelectCodeDesc('#cbContactTitle', co.data.titles);
|
||||||
sbm.selectOrAdd('#cbContactTitle', "", "")
|
|
||||||
sbm.populateSelectCodeDesc('#cbContactSalutation', co.data.salutations);
|
sbm.populateSelectCodeDesc('#cbContactSalutation', co.data.salutations);
|
||||||
sbm.populateSelectCodeDesc('#cbContactStatus', co.data.statuses);
|
sbm.populateSelectCodeDesc('#cbContactStatus', co.data.statuses);
|
||||||
}
|
}
|
||||||
sbm.clearItemForm = function ($frm)
|
co.openItemDlg = function (cfg, title)
|
||||||
{
|
{
|
||||||
sbm.clearControlErrors($frm);
|
sbm.configureItemControls(cfg, $frm.item);
|
||||||
$('.sbm-input,.sbm-textarea,.sbm-select,.sbm-checkbox', $frm).val('').prop('readonly', false).prop('disabled', false).removeAttr('checked');
|
$dlg.item.dialog('option', 'title', title);
|
||||||
}
|
|
||||||
co.configureItemControls = function (cfg)
|
|
||||||
{
|
|
||||||
sbm.configureItemControls($frm.item, cfg);
|
|
||||||
}
|
|
||||||
sbm.configureItemControls = function ($frm, cfg)
|
|
||||||
{
|
|
||||||
//sbm.debug('configureItemControls', cfg);
|
|
||||||
let fld = cfg.field || {};
|
|
||||||
let $ctrl = $('.sbm-form-control', $frm.item).show();
|
|
||||||
(fld.hide || []).forEach(function (v, i, a) { $ctrl.filter('.' + cfg.field.prefix + v).hide().find('.sbm-input,.sbm-textarea,.sbm-select,.sbm-checkbox').prop('disabled', true); });
|
|
||||||
(fld.readonly || []).forEach(function (v, i, a) { $ctrl.filter('.' + cfg.field.prefix + v).find('.sbm-input,.sbm.textarea,.sbm-select,.sbm-checkbox').prop('readonly', true).prop('disabled', true); });
|
|
||||||
}
|
|
||||||
co.openItemDlg = function (title)
|
|
||||||
{
|
|
||||||
if (title)$dlg.item.dialog('option', 'title', title);
|
|
||||||
sbm.openDialog($dlg.item, 640, 600);
|
sbm.openDialog($dlg.item, 640, 600);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,25 +150,18 @@
|
|||||||
co.onUpdateItem = function (response)
|
co.onUpdateItem = function (response)
|
||||||
{
|
{
|
||||||
//sbm.debug('onUpdateItem', response);
|
//sbm.debug('onUpdateItem', response);
|
||||||
co.clearItem(response.config);
|
|
||||||
if (!response.success) return;
|
if (!response.success) return;
|
||||||
|
let cfg = response.config || {};
|
||||||
|
co.clearItem(cfg);
|
||||||
let item = response.contact;
|
let item = response.contact;
|
||||||
|
sbm.populateFormValues(cfg, $frm.item, item.field.value);
|
||||||
let $ctrls = $('.sbm-input,.sbm-textarea,.sbm-select,.sbm-checkbox', $frm.item);
|
let $ctrls = $('.sbm-input,.sbm-textarea,.sbm-select,.sbm-checkbox', $frm.item);
|
||||||
$ctrls.filter('.ContactId').val(item.id);
|
$ctrls.filter('.ContactId').val(item.id);
|
||||||
$ctrls.filter('.ContactExists').val(1);
|
$ctrls.filter('.ContactExists').val(1);
|
||||||
$ctrls.filter('.ContactType').val(item.typeCode);
|
$ctrls.filter('.ContactType').val(item.typeCode);
|
||||||
$ctrls.filter('.ContactProspect').prop('checked', !!item.prospect);
|
$ctrls.filter('.ContactProspect').prop('checked', !!item.prospect);
|
||||||
$ctrls.filter('.ContactNotes').val(item.notes);
|
|
||||||
$ctrls.filter('.ContactStatus').val(item.statusCode);
|
$ctrls.filter('.ContactStatus').val(item.statusCode);
|
||||||
sbm.populateFieldValues(response.config, $frm.item, item.field);
|
co.openItemDlg(cfg, sbm.dlg.title.updateContact);
|
||||||
co.configureItemControls(response.config);
|
|
||||||
co.openItemDlg(sbm.dlg.title.updateContact);
|
|
||||||
}
|
|
||||||
sbm.populateFieldValues = function (cfg, $frm, fld)
|
|
||||||
{
|
|
||||||
let val = (fld || {}).value || [];
|
|
||||||
let $ctrl = $('.sbm-form-control', $frm.item).show();
|
|
||||||
for (var name in val) { $ctrl.filter('.' + cfg.field.prefix + name).find('.sbm-input,.sbm-textarea,.sbm-select').val(val[name]).end().find('.sbm-checkbox').prop('checked',!!val[name]); };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
@@ -205,6 +176,7 @@
|
|||||||
sbm.refreshControlValues(response.controlValues);
|
sbm.refreshControlValues(response.controlValues);
|
||||||
if (!response.success) return;
|
if (!response.success) return;
|
||||||
$dlg.item.dialog('close');
|
$dlg.item.dialog('close');
|
||||||
|
$pnl.msgs.hide().empty();
|
||||||
|
|
||||||
var item = response.contact;
|
var item = response.contact;
|
||||||
var $item = $('#' + co.getItemId(item), $pnl.table);
|
var $item = $('#' + co.getItemId(item), $pnl.table);
|
||||||
@@ -219,11 +191,12 @@
|
|||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
co.onClickAssociationCount = function (item)
|
co.onClickAssociationCount = function (item)
|
||||||
{
|
{
|
||||||
|
sbm.debug('onClickAssociationCount');
|
||||||
if (!item.id) return;
|
if (!item.id) return;
|
||||||
sbm.doPleaseWait();
|
//sbm.doPleaseWait();
|
||||||
let frm = $frm.itemId;
|
//let frm = $frm.itemId;
|
||||||
$('.ContactId', frm).val(item.id);
|
//$('.ContactId', frm).val(item.id);
|
||||||
frm.prop('action', sbm.url.base + 'Association').submit();
|
//frm.prop('action', sbm.url.base + 'Association').submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
|
|||||||
@@ -154,6 +154,41 @@
|
|||||||
sbm.resultsPaging.fn.refreshPaging(response.paging, context, refreshFn);
|
sbm.resultsPaging.fn.refreshPaging(response.paging, context, refreshFn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
sbm.configureItemTable = function (cfg, $sel)
|
||||||
|
{
|
||||||
|
//sbm.debug('configureItemTable', cfg, $sel);
|
||||||
|
let col = cfg.column || {};
|
||||||
|
let $cell = $('th,td', $sel).removeClass('hidden');
|
||||||
|
(col.hide || []).forEach(function (v, i, a) { $cell.filter('.' + col.prefix + v).addClass('hidden'); });
|
||||||
|
}
|
||||||
|
sbm.populateItemValues = function (cfg, $item, val)
|
||||||
|
{
|
||||||
|
//sbm.debug('populateItemValues', cfg, $item, val);
|
||||||
|
for (var name in val || []) { $item.find('.' + cfg.column.prefix + name).text(val[name]); };
|
||||||
|
}
|
||||||
|
sbm.clearItemForm = function ($frm)
|
||||||
|
{
|
||||||
|
//sbm.clearControlErrors($frm);
|
||||||
|
$('.sbm-input,.sbm-textarea,.sbm-select', $frm).val('').prop('readonly', false).prop('disabled', false);
|
||||||
|
$('.sbm-checkbox', $frm).prop('readonly', false).prop('disabled', false).removeAttr('checked');
|
||||||
|
}
|
||||||
|
sbm.configureItemControls = function (cfg, $frm)
|
||||||
|
{
|
||||||
|
//sbm.debug('configureItemControls', cfg);
|
||||||
|
let fld = cfg.field || {};
|
||||||
|
let $ctrl = $('.sbm-form-control', $frm).show();
|
||||||
|
for (var name in fld.label || {}) { /* ... */ };
|
||||||
|
(fld.hide || []).forEach(function (v, i, a) { $ctrl.filter('.' + fld.prefix + v).hide().find('.sbm-input,.sbm-textarea,.sbm-select,.sbm-checkbox').prop('disabled', true); });
|
||||||
|
(fld.readonly || []).forEach(function (v, i, a) { $ctrl.filter('.' + fld.prefix + v).find('.sbm-input,.sbm.textarea,.sbm-select,.sbm-checkbox').prop('readonly', true).prop('disabled', true); });
|
||||||
|
}
|
||||||
|
sbm.populateFormValues = function (cfg, $frm, val)
|
||||||
|
{
|
||||||
|
//sbm.debug('populateFormValues', cfg, $frm, val);
|
||||||
|
let $ctrl = $('.sbm-form-control', $frm);
|
||||||
|
for (var name in val || {}) { $ctrl.filter('.' + cfg.field.prefix + name).find('.sbm-input,.sbm-textarea,.sbm-select').filter('.sbm-auto-val').val(val[name]).end().find('.sbm-checkbox').prop('checked', !!val[name]); };
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
// Page navigation.
|
// Page navigation.
|
||||||
sbm.navigateTo = function (action)
|
sbm.navigateTo = function (action)
|
||||||
@@ -221,7 +256,7 @@
|
|||||||
sbm.$dlg.alert = $('<div id="dlgAlert"><div id="dlgAlertMsg"></div></div>').dialog(opt);
|
sbm.$dlg.alert = $('<div id="dlgAlert"><div id="dlgAlertMsg"></div></div>').dialog(opt);
|
||||||
}
|
}
|
||||||
$('#dlgAlertMsg', sbm.$dlg.alert).html(msg.replace(/\\n/g, '<br>'));
|
$('#dlgAlertMsg', sbm.$dlg.alert).html(msg.replace(/\\n/g, '<br>'));
|
||||||
let btns = [];
|
let btns = {};
|
||||||
btns[sbm.lbl.ok] = function () { $(this).dialog('close'); if (onOk) onOk(); };
|
btns[sbm.lbl.ok] = function () { $(this).dialog('close'); if (onOk) onOk(); };
|
||||||
sbm.$dlg.alert.dialog('option', { title: title || sbm.dlg.title.alert, buttons: btns });
|
sbm.$dlg.alert.dialog('option', { title: title || sbm.dlg.title.alert, buttons: btns });
|
||||||
sbm.openDialog(sbm.$dlg.alert);
|
sbm.openDialog(sbm.$dlg.alert);
|
||||||
@@ -236,9 +271,10 @@
|
|||||||
if (!sbm.isDef(sbm.$dlg.confirm))
|
if (!sbm.isDef(sbm.$dlg.confirm))
|
||||||
{
|
{
|
||||||
var opt = sbm.dlgOpts();
|
var opt = sbm.dlgOpts();
|
||||||
|
opt.dialogClass += " sbm-dark-blue";
|
||||||
sbm.$dlg.confirm = $('<div id="dlgConfirm"><div class="spacer2"></div><div id="dlgConfirmMsg"></div></div>').dialog(opt);
|
sbm.$dlg.confirm = $('<div id="dlgConfirm"><div class="spacer2"></div><div id="dlgConfirmMsg"></div></div>').dialog(opt);
|
||||||
}
|
}
|
||||||
var btns = [];
|
let btns = {};
|
||||||
btns[sbm.lbl.yes] = function () { $(this).dialog('close'); if (onOk) onOk(); };
|
btns[sbm.lbl.yes] = function () { $(this).dialog('close'); if (onOk) onOk(); };
|
||||||
btns[sbm.lbl.no] = function () { $(this).dialog('close'); if (onCancel) onCancel(); };
|
btns[sbm.lbl.no] = function () { $(this).dialog('close'); if (onCancel) onCancel(); };
|
||||||
sbm.$dlg.confirm.dialog('option', { title: title || sbm.dlg.title.confirm, buttons: btns });
|
sbm.$dlg.confirm.dialog('option', { title: title || sbm.dlg.title.confirm, buttons: btns });
|
||||||
|
|||||||
Reference in New Issue
Block a user