Session data.
This commit is contained in:
@@ -493,13 +493,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
List<String> filter = new List<String>();
|
||||
|
||||
// Vehicle Id.
|
||||
String includedIds = prm.IdsIncluded.Concat(",");
|
||||
String colVehicle_Id = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SaVehicle_Id, aliasVehicle);
|
||||
if (!StringUtil.IsEmpty(includedIds))
|
||||
filter.Add($"{colVehicle_Id} IN ({includedIds})");
|
||||
String excludedIds = prm.IdsExcluded.Concat(",");
|
||||
if (!StringUtil.IsEmpty(excludedIds))
|
||||
filter.Add($"{colVehicle_Id} NOT IN ({excludedIds})");
|
||||
if (prm.IdsIncluded.HasValidIds())
|
||||
filter.Add($"{colVehicle_Id} IN ({prm.IdsIncluded.Concat(",")})");
|
||||
if (prm.IdsExcluded.HasValidIds())
|
||||
filter.Add($"{colVehicle_Id} NOT IN ({prm.IdsExcluded.Concat(",")})");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Vehicle Class.
|
||||
String colVehicle_VehicleClassId = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SaVehicle_VehicleClassId, aliasVehicle);
|
||||
@@ -519,14 +518,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
// Partial Registration.
|
||||
String regNumber = DbQuery.FormatForCondition(prm.RegNumberPartial);
|
||||
if (!StringUtil.IsEmpty(regNumber))
|
||||
filter.Add($"{DbQuery.FormatFn_Left(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SaVehicle_RegNumber, aliasVehicle), prm.RegNumberPartial.Length)}='{regNumber}'");
|
||||
if (!StringUtil.IsBlank(prm.RegNumberPartial))
|
||||
filter.Add($"{SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SaVehicle_RegNumber, aliasVehicle)} Like '%{DbQuery.FormatForLike(prm.RegNumberPartial)}%'");
|
||||
|
||||
// Partial VIN:
|
||||
String vin = DbQuery.FormatForCondition(prm.VinPartial);
|
||||
if (!StringUtil.IsEmpty(vin))
|
||||
filter.Add($"{DbQuery.FormatFn_Left(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SaVehicle_VIN, aliasVehicle), prm.VinPartial.Length)}='{vin}'");
|
||||
if (!StringUtil.IsBlank(prm.VinPartial))
|
||||
filter.Add($"{SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SaVehicle_VIN, aliasVehicle)} Like '%{DbQuery.FormatForLike(prm.VinPartial)}%'");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Associated Assets.
|
||||
@@ -555,10 +552,17 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
// Restrict to active:
|
||||
String colVehicle_Status = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SaVehicle_Status, aliasVehicle);
|
||||
if (!StringUtil.IsEmpty(prm.RestrictToActive))
|
||||
filter.Add($"{colVehicle_Status}='{StatusActive}'");
|
||||
// Status.
|
||||
if (prm.StatusCat != SbmVehicle.StatusCat.Any)
|
||||
{
|
||||
String colStatus = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.SaVehicle_Status, aliasVehicle);
|
||||
if (prm.StatusCat == SbmVehicle.StatusCat.ActiveOnly)
|
||||
filter.Add($"{colStatus}='{StatusCurrent}'");
|
||||
else if (prm.StatusCat == SbmVehicle.StatusCat.NotDeleted)
|
||||
filter.Add($"{colStatus}!='{SacsSystem.GetStatusCode(SaStatus.Deleted)}'");
|
||||
else if (prm.StatusCat == SbmVehicle.StatusCat.DeletedOnly)
|
||||
filter.Add($"{colStatus}='{SacsSystem.GetStatusCode(SaStatus.Deleted)}'");
|
||||
}
|
||||
|
||||
if (filter.Count < 1 && prm.IncludeDefaultFilter) filter.Add("1=1");
|
||||
return filter;
|
||||
|
||||
Reference in New Issue
Block a user