3.0.0.1 Demo repository registration
This commit is contained in:
@@ -0,0 +1,580 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Bus.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Internal.Control;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Dbas.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
// Control - Account Manager - Account Registrations.
|
||||
//=======================================================================
|
||||
partial class SbmcAccountMgr_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
private List<StringPair> GetLogProperties(SbmcAccountRegistration accountRegistration)
|
||||
{
|
||||
return new List<StringPair>()
|
||||
{
|
||||
new StringPair("Id",SysId.ToString(accountRegistration.Id)),
|
||||
new StringPair("Email",accountRegistration.EmailAddress),
|
||||
new StringPair("Token",accountRegistration.RegisterAccountToken.ToString()),
|
||||
new StringPair("Status",accountRegistration.StatusCode)
|
||||
};
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create Item.
|
||||
public override SbmcAccountRegistration CreateAccountRegistration(String emailAddress, Guid registerAccountToken)
|
||||
{
|
||||
return new SbmcAccountRegistration_Dbas(null, emailAddress, registerAccountToken, 0);
|
||||
}
|
||||
private SbmcAccountRegistration_Dbas CreateAccountRegistration(AccountRegistration_Db dbAccountRegistration)
|
||||
{
|
||||
ClearErrorState();
|
||||
SbmcAccountRegistration_Dbas accountRegistration = new SbmcAccountRegistration_Dbas(new SysId(dbAccountRegistration._Id), dbAccountRegistration._EmailAddress, dbAccountRegistration._RegisterAccountToken, (ushort)dbAccountRegistration._Flags);
|
||||
PopulateFrom(dbAccountRegistration, accountRegistration);
|
||||
return accountRegistration;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Item.
|
||||
public override SbmcAccountRegistration GetAccountRegistration(SbmcAccountRegistration.Params prm)
|
||||
{
|
||||
return GetAccountRegistration(GetAccountRegistrationQueryFilter(prm).Concat(" AND ", "(", ")"));
|
||||
}
|
||||
private SbmcAccountRegistration GetAccountRegistration(String filter)
|
||||
{
|
||||
ClearErrorState();
|
||||
long count = GetAccountRegistrationCount(filter);
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmcAccountRegistration accountRegistration = null;
|
||||
// Query data.
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
dbConnection.Open();
|
||||
AccountRegistration_Db dbAccountRegistration = new AccountRegistration_Db(DbInfo);
|
||||
dbAccountRegistration.PopulateFrom(dbCommand, aliasAccountRegistration, filter);
|
||||
accountRegistration = CreateAccountRegistration(dbAccountRegistration);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
return accountRegistration;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate Item.
|
||||
public override bool IsValidAccountRegistrationData(SbmcAccountRegistration.Data data, SbmcAccountRegistration.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!base.IsValidAccountRegistrationData(data, errField)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert Item.
|
||||
public override bool InsertAccountRegistration(SbmcAccountRegistration accountRegistration, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!IsValidAccountRegistration(accountRegistration)) return false;
|
||||
if (SysId.IsValid(accountRegistration.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
dbConnection.Open();
|
||||
AccountRegistration_Db dbAccountRegistration = new AccountRegistration_Db(DbInfo);
|
||||
PopulateTo(dbAccountRegistration, accountRegistration, dbUpdateInfo);
|
||||
if (AccountRegistration_Db.FieldsNonId.Contains("Id"))
|
||||
{
|
||||
// Generate next Id.
|
||||
dbAccountRegistration._Id = SysId.ToInt(db.GetNextId("AccountRegistration", dbUpdateInfo));
|
||||
}
|
||||
dbAccountRegistration.ExecuteInsertCommand(dbCommand);
|
||||
accountRegistration.Id = new SysId(dbAccountRegistration._Id);
|
||||
accountRegistration.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. {GetLogProperties(accountRegistration).Concat(": ").Concat("", "\n\t")}");
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update Item.
|
||||
public override bool UpdateAccountRegistration(SbmcAccountRegistration accountRegistration, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!IsValidAccountRegistration(accountRegistration)) return false;
|
||||
if (!SysId.IsValid(accountRegistration.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!accountRegistration.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. {GetLogProperties(accountRegistration).Concat(": ").Concat("", "\n\t")}");
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve AccountRegistration.
|
||||
dbConnection.Open();
|
||||
AccountRegistration_Db dbAccountRegistration = new AccountRegistration_Db(DbInfo);
|
||||
dbAccountRegistration.PopulateFrom(dbCommand, aliasAccountRegistration, $"Id={SysId.ToString(accountRegistration.Id)}");
|
||||
//SbmUpdateLogItemMonitor_AccountRegistration updateLogMonitor = new SbmUpdateLogItemMonitor_AccountRegistration(Internals, CreateAccountRegistration(dbAccountRegistration));
|
||||
|
||||
// Update properties.
|
||||
PopulateTo(dbAccountRegistration, accountRegistration, dbUpdateInfo);
|
||||
dbAccountRegistration.ExecuteUpdateCommand(dbCommand);
|
||||
accountRegistration.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. {GetLogProperties(accountRegistration).Concat(": ").Concat("", "\n\t")}");
|
||||
|
||||
// Record updates.
|
||||
//updateLogMonitor.RecordUpdatedValues(accountRegistration);
|
||||
//updateLogMonitor.LogUpdates();
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Delete Item.
|
||||
public override bool AccountRegistrationCanBeDeleted(SbmcAccountRegistration accountRegistration)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!base.AccountRegistrationCanBeDeleted(accountRegistration)) return false;
|
||||
return true;
|
||||
}
|
||||
public override bool DeleteAccountRegistration(SbmcAccountRegistration accountRegistration, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!AccountRegistrationCanBeDeleted(accountRegistration)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve AccountRegistration.
|
||||
dbConnection.Open();
|
||||
AccountRegistration_Db dbAccountRegistration = new AccountRegistration_Db(DbInfo);
|
||||
dbAccountRegistration.PopulateFrom(dbCommand, aliasAccountRegistration, "Id=" + accountRegistration.Id.ToString());
|
||||
// Delete AccountRegistration.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn_Control.GetTableName(SbmDbDfn_Control.TableIdx.AccountRegistration) + " WHERE Id=" + SysId.ToString(accountRegistration.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
accountRegistration.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. {GetLogProperties(accountRegistration).Concat(": ").Concat("", "\n\t")}");
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Copy data properties to and from Item.
|
||||
private void PopulateTo(AccountRegistration_Db dbAccountRegistration, SbmcAccountRegistration accountRegistration, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
// Properties.
|
||||
dbAccountRegistration._Id = accountRegistration.Id.ToInt();
|
||||
dbAccountRegistration._EmailAddress = accountRegistration.EmailAddress;
|
||||
dbAccountRegistration._FirstName = accountRegistration.FirstName;
|
||||
dbAccountRegistration._LastName = accountRegistration.LastName;
|
||||
dbAccountRegistration._PhoneMain = accountRegistration.PhoneMain;
|
||||
dbAccountRegistration._PhoneAlt = accountRegistration.PhoneAlt;
|
||||
// Registration.
|
||||
dbAccountRegistration._InstanceContext = accountRegistration.InstanceContext;
|
||||
dbAccountRegistration._RequestAccountAt = accountRegistration.RequestAccountAt;
|
||||
dbAccountRegistration._RegisterAccountToken = accountRegistration.RegisterAccountToken;
|
||||
dbAccountRegistration._RegisterAccountAt = accountRegistration.RegisterAccountAt;
|
||||
// Security.
|
||||
dbAccountRegistration._AccountPasswordSalt = accountRegistration.AccountPasswordSalt;
|
||||
dbAccountRegistration._AccountPasswordHash = accountRegistration.AccountPasswordHash;
|
||||
// Common.
|
||||
dbAccountRegistration._Notes = accountRegistration.Notes;
|
||||
dbAccountRegistration._Status = SacsSystem.GetStatusCode(accountRegistration.Status);
|
||||
dbAccountRegistration._Flags = (short)accountRegistration.Flags;
|
||||
if (!SysId.IsValid(accountRegistration.Id))
|
||||
{
|
||||
dbAccountRegistration._CreateOn = DateTime.UtcNow;
|
||||
dbAccountRegistration._CreateBy = dbUpdateInfo.UserId.ToInt();
|
||||
dbAccountRegistration._CreateHost = dbUpdateInfo.Host;
|
||||
}
|
||||
dbAccountRegistration._UpdateOn = DateTime.UtcNow;
|
||||
dbAccountRegistration._UpdateBy = dbUpdateInfo.UserId.ToInt();
|
||||
dbAccountRegistration._UpdateHost = dbUpdateInfo.Host;
|
||||
}
|
||||
private void PopulateFrom(AccountRegistration_Db dbAccountRegistration, SbmcAccountRegistration accountRegistration)
|
||||
{
|
||||
// Properties.
|
||||
//accountRegistration.Id = new SysId(dbAccountRegistration._Id);
|
||||
//accountRegistration.EmailAddress = dbAccountRegistration._EmailAddress;
|
||||
accountRegistration.FirstName = dbAccountRegistration._FirstName;
|
||||
accountRegistration.LastName = dbAccountRegistration._LastName;
|
||||
accountRegistration.PhoneMain = dbAccountRegistration._PhoneMain;
|
||||
accountRegistration.PhoneAlt = dbAccountRegistration._PhoneAlt;
|
||||
// Registration.
|
||||
accountRegistration.InstanceContext = dbAccountRegistration._InstanceContext;
|
||||
accountRegistration.RequestAccountAt = dbAccountRegistration._RequestAccountAt;
|
||||
//accountRegistration.RegisterAccountToken = dbAccountRegistration._RegisterAccountToken;
|
||||
accountRegistration.RegisterAccountAt = dbAccountRegistration._RegisterAccountAt;
|
||||
// Security.
|
||||
accountRegistration.AccountPasswordSalt = dbAccountRegistration._AccountPasswordSalt;
|
||||
accountRegistration.AccountPasswordHash = dbAccountRegistration._AccountPasswordHash;
|
||||
// Common.
|
||||
accountRegistration.Notes = dbAccountRegistration._Notes;
|
||||
accountRegistration.Status = SacsSystem.GetStatusForCode(dbAccountRegistration._Status);
|
||||
accountRegistration.SetCreateStamp(dbAccountRegistration._CreateOn, new SysId(dbAccountRegistration._CreateBy), dbAccountRegistration._CreateHost);
|
||||
accountRegistration.SetUpdateStamp(dbAccountRegistration._UpdateOn, new SysId(dbAccountRegistration._UpdateBy), dbAccountRegistration._UpdateHost);
|
||||
accountRegistration.AcceptChanges();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item column definitions.
|
||||
private static readonly String aliasAccountRegistration = "Acr";
|
||||
private void SetAccountRegistrationColDfn
|
||||
(ColumnDfn col, String caption, int width, SbmDbDfn_Control.ColumnIdx dbCol,
|
||||
ColumnAlignment align = ColumnAlignment.Default, DataValue.DataType dataType = DataValue.DataType.String,
|
||||
String alias = "", String prefix = "")
|
||||
{
|
||||
if (String.IsNullOrEmpty(alias) && SbmDbDfn_Control.GetTableForColumn(dbCol) == SbmDbDfn_Control.TableIdx.AccountRegistration)
|
||||
alias = aliasAccountRegistration;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn_Control.GetColumnName(dbCol, false), SbmDbDfn_Control.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn_Control.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn_Control.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Item column definition.
|
||||
public override ColumnDfn GetAccountRegistrationColumnDfn(SbmcAccountRegistration.Column columnId, string caption = "", int width = 0)
|
||||
{
|
||||
ColumnDfn columnDfn = new ColumnDfn((int)columnId, caption, width);
|
||||
switch (columnId)
|
||||
{
|
||||
case SbmcAccountRegistration.Column.Pos:
|
||||
SetAccountRegistrationColDfn(columnDfn, "Pos", 45, SbmDbDfn_Control.ColumnIdx.Unknown, ColumnAlignment.Right);
|
||||
columnDfn.SortMode = ColumnDfn.ColumnSortMode.Off;
|
||||
columnDfn.ReadOnly = true;
|
||||
columnDfn.Resizable = false;
|
||||
break;
|
||||
case SbmcAccountRegistration.Column.Id:
|
||||
SetAccountRegistrationColDfn(columnDfn, "Id", 60, SbmDbDfn_Control.ColumnIdx.AccountRegistration_Id, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
// AccountRegistration Properties.
|
||||
case SbmcAccountRegistration.Column.EmailAddress:
|
||||
SetAccountRegistrationColDfn(columnDfn, "Email", 120, SbmDbDfn_Control.ColumnIdx.AccountRegistration_EmailAddress);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SbmcAccountRegistration.Column.FirstName:
|
||||
SetAccountRegistrationColDfn(columnDfn, "FirstName", 100, SbmDbDfn_Control.ColumnIdx.AccountRegistration_FirstName);
|
||||
break;
|
||||
case SbmcAccountRegistration.Column.LastName:
|
||||
SetAccountRegistrationColDfn(columnDfn, "LastName", 100, SbmDbDfn_Control.ColumnIdx.AccountRegistration_LastName);
|
||||
break;
|
||||
case SbmcAccountRegistration.Column.PhoneMain:
|
||||
SetAccountRegistrationColDfn(columnDfn, "Phone main", 100, SbmDbDfn_Control.ColumnIdx.AccountRegistration_PhoneMain);
|
||||
break;
|
||||
case SbmcAccountRegistration.Column.PhoneAlt:
|
||||
SetAccountRegistrationColDfn(columnDfn, "Phone alt", 100, SbmDbDfn_Control.ColumnIdx.AccountRegistration_PhoneAlt);
|
||||
break;
|
||||
|
||||
// Registration.
|
||||
case SbmcAccountRegistration.Column.InstanceContext:
|
||||
SetAccountRegistrationColDfn(columnDfn, "Instance context", 100, SbmDbDfn_Control.ColumnIdx.AccountRegistration_InstanceContext);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SbmcAccountRegistration.Column.RequestAccountAt:
|
||||
SetAccountRegistrationColDfn(columnDfn, "Account requested", 120, SbmDbDfn_Control.ColumnIdx.AccountRegistration_RequestAccountAt, ColumnAlignment.Center, DataValue.DataType.DateTime);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SbmcAccountRegistration.Column.RegisterAccountToken:
|
||||
SetAccountRegistrationColDfn(columnDfn, "Registration token", 120, SbmDbDfn_Control.ColumnIdx.AccountRegistration_RegisterAccountToken);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SbmcAccountRegistration.Column.RegisterAccountAt:
|
||||
SetAccountRegistrationColDfn(columnDfn, "Account registered", 120, SbmDbDfn_Control.ColumnIdx.AccountRegistration_RegisterAccountAt, ColumnAlignment.Center, DataValue.DataType.DateTime);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
// Common.
|
||||
case SbmcAccountRegistration.Column.Notes:
|
||||
SetAccountRegistrationColDfn(columnDfn, "Notes", 200, SbmDbDfn_Control.ColumnIdx.AccountRegistration_Notes);
|
||||
break;
|
||||
case SbmcAccountRegistration.Column.Status:
|
||||
SetAccountRegistrationColDfn(columnDfn, "Status", 50, SbmDbDfn_Control.ColumnIdx.AccountRegistration_Status, ColumnAlignment.Center);
|
||||
break;
|
||||
case SbmcAccountRegistration.Column.Status_Desc:
|
||||
SetAccountRegistrationColDfn(columnDfn, "Status", 50, SbmDbDfn_Control.ColumnIdx.AccountRegistration_Status, ColumnAlignment.Center);
|
||||
break;
|
||||
case SbmcAccountRegistration.Column.Status_Ind:
|
||||
SetAccountRegistrationColDfn(columnDfn, "Status", 50, SbmDbDfn_Control.ColumnIdx.AccountRegistration_Status, ColumnAlignment.Center, DataValue.DataType.TriState);
|
||||
columnDfn.TriStateFormat = ColumnTriStateFormat.Lights;
|
||||
break;
|
||||
case SbmcAccountRegistration.Column.CreateOn_Date:
|
||||
SetAccountRegistrationColDfn(columnDfn, "Created", 65, SbmDbDfn_Control.ColumnIdx.AccountRegistration_CreateOn, ColumnAlignment.Center, DataValue.DataType.Date);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SbmcAccountRegistration.Column.UpdateOn_Date:
|
||||
SetAccountRegistrationColDfn(columnDfn, "Updated", 65, SbmDbDfn_Control.ColumnIdx.AccountRegistration_UpdateOn, ColumnAlignment.Center, DataValue.DataType.Date);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
}
|
||||
if (!String.IsNullOrEmpty(caption))
|
||||
columnDfn.Caption = caption;
|
||||
if (width > 0)
|
||||
columnDfn.Width = width;
|
||||
return columnDfn;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item query filter.
|
||||
public override List<string> GetAccountRegistrationQueryFilter(SbmcAccountRegistration.Params prm)
|
||||
{
|
||||
List<String> filter = new List<String>();
|
||||
String colId = SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_Id, aliasAccountRegistration);
|
||||
String colEmail = SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_EmailAddress, aliasAccountRegistration);
|
||||
|
||||
// AccountRegistration Id.
|
||||
if (prm.IdsIncluded.HasValidIds())
|
||||
filter.Add($"{colId} IN ({prm.IdsIncluded.Concat(",")})");
|
||||
if (prm.IdsExcluded.HasValidIds())
|
||||
filter.Add($"{colId} NOT IN ({prm.IdsExcluded.Concat(",")})");
|
||||
|
||||
// Generic search.
|
||||
if (!StringUtil.IsBlank(prm.Search))
|
||||
{
|
||||
String colFirstName = SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_FirstName, aliasAccountRegistration);
|
||||
String colLastName = SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_LastName, aliasAccountRegistration);
|
||||
String colPhoneMain = SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_PhoneMain, aliasAccountRegistration);
|
||||
String colPhoneAlt = SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_PhoneAlt, aliasAccountRegistration);
|
||||
foreach (String search in Regex.Split(prm.Search, "[\\s,;\\-+]+"))
|
||||
{
|
||||
if (StringUtil.IsBlank(search)) continue;
|
||||
String searchForLike = DbQuery.FormatForLike(search, true);
|
||||
List<String> searchFilter = new List<string>();
|
||||
searchFilter.Add($"{colEmail} LIKE '%{searchForLike}%'");
|
||||
searchFilter.Add($"{colFirstName} LIKE '%{searchForLike}%'");
|
||||
searchFilter.Add($"{colLastName} LIKE '%{searchForLike}%'");
|
||||
searchFilter.Add($"{colPhoneMain} LIKE '%{searchForLike}%'");
|
||||
searchFilter.Add($"{colPhoneAlt} LIKE '%{searchForLike}%'");
|
||||
filter.Add(searchFilter.Concat(" OR ", "(", ")"));
|
||||
}
|
||||
}
|
||||
|
||||
// Email.
|
||||
if (!StringUtil.IsBlank(prm.EmailAddress))
|
||||
filter.Add($"{colEmail}='{DbQuery.FormatForCondition(prm.EmailAddress)}'");
|
||||
|
||||
// Token.
|
||||
if (prm.RegisterAccountToken != Guid.Empty)
|
||||
{
|
||||
String colToken = SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_RegisterAccountToken, aliasAccountRegistration);
|
||||
filter.Add($"{colToken}='{prm.RegisterAccountToken.ToString()}'");
|
||||
}
|
||||
|
||||
// Common Properties.
|
||||
|
||||
// Notes.
|
||||
if (!StringUtil.IsEmpty(prm.NotesPartial))
|
||||
filter.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_Notes, aliasAccountRegistration) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
String statusFilter = GetAccountRegistrationStatusCatFilterCondition(prm.StatusCat);
|
||||
if (!StringUtil.IsBlank(statusFilter))
|
||||
filter.Add($"{SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_Status, aliasAccountRegistration)}{statusFilter}");
|
||||
|
||||
if (filter.Count < 1 && prm.IncludeDefaultFilter) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
internal static String GetAccountRegistrationStatusCatFilterCondition(SbmcAccountRegistration.StatusCat statusCat)
|
||||
{
|
||||
if (statusCat == SbmcAccountRegistration.StatusCat.AwaitingOnly)
|
||||
return $"='{SacsSystem.GetStatusCode(SaStatus.Awaiting)}'";
|
||||
if (statusCat == SbmcAccountRegistration.StatusCat.CompletedOnly)
|
||||
return $"='{SacsSystem.GetStatusCode(SaStatus.Completed)}'";
|
||||
if (statusCat == SbmcAccountRegistration.StatusCat.CancelledOnly)
|
||||
return $"='{SacsSystem.GetStatusCode(SaStatus.Cancelled)}'";
|
||||
if (statusCat == SbmcAccountRegistration.StatusCat.NotDeleted)
|
||||
return $"!='{SacsSystem.GetStatusCode(SaStatus.Deleted)}'";
|
||||
if (statusCat == SbmcAccountRegistration.StatusCat.DeletedOnly)
|
||||
return $"='{SacsSystem.GetStatusCode(SaStatus.Deleted)}'";
|
||||
return "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item sort columns.
|
||||
public List<String> GetAccountRegistrationSortColumns(SbmcAccountRegistration.Params prm)
|
||||
{
|
||||
// Sort sequence:
|
||||
List<String> sortColumnNames = new List<String>();
|
||||
foreach (var columnDfn in prm.SortColumns)
|
||||
{
|
||||
// Need to ensure correct alias used for AccountRegistration columns in case of conflict.
|
||||
String sortCol = String.Empty;
|
||||
if (SbmDbDfn_Control.GetTableForColumn((SbmDbDfn_Control.ColumnIdx)columnDfn.DbColumn) == SbmDbDfn_Control.TableIdx.AccountRegistration)
|
||||
{
|
||||
sortCol = SbmDbDfn_Control.GetColumnNameQual((SbmDbDfn_Control.ColumnIdx)columnDfn.DbColumn, aliasAccountRegistration);
|
||||
}
|
||||
else
|
||||
{
|
||||
sortCol = columnDfn.DataName;
|
||||
if (!StringUtil.IsEmpty(columnDfn.SortDataName))
|
||||
sortCol = columnDfn.SortDataName;
|
||||
}
|
||||
if (!sortCol.IsEmpty())
|
||||
{
|
||||
DbOrderByNullMode orderByNullMode = DbOrderByNullMode.Default; // eSaOrderByDemoteNulls, eSaOrderByPromoteNulls
|
||||
sortColumnNames.Add(DbQuery.FormatForOrderBy(sortCol, columnDfn.SortAscending, orderByNullMode).Concat(", "));
|
||||
}
|
||||
}
|
||||
sortColumnNames.RemoveBlanks();
|
||||
if (sortColumnNames.IsEmpty())
|
||||
{
|
||||
// Default sort columns:
|
||||
sortColumnNames.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_Id, aliasAccountRegistration) + " DESC");
|
||||
}
|
||||
return sortColumnNames;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item count.
|
||||
private long GetAccountRegistrationCount(String filter)
|
||||
{
|
||||
ClearErrorState();
|
||||
return db.GetRowCount(SbmDbDfn_Control.GetTableName(SbmDbDfn_Control.TableIdx.AccountRegistration) + " As " + aliasAccountRegistration, filter);
|
||||
}
|
||||
public override long GetAccountRegistrationCount(SbmcAccountRegistration.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
return GetAccountRegistrationCount(GetAccountRegistrationQueryFilter(prm).Concat(" AND ", "(", ")"));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public override List<SbmcAccountRegistration> GetAccountRegistrationList(SbmcAccountRegistration.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
List<SbmcAccountRegistration> addresses = new List<SbmcAccountRegistration>();
|
||||
DbQuery qry = new DbQuery(db.DbmsType);
|
||||
qry.Tables.Add(SbmDbDfn_Control.GetTableName(SbmDbDfn_Control.TableIdx.AccountRegistration), aliasAccountRegistration);
|
||||
AccountRegistration_Db dbAccountRegistration = new AccountRegistration_Db(DbInfo);
|
||||
qry.Columns.AddRange(dbAccountRegistration.ExistingColumnNames);
|
||||
qry.Filters.AddRange(GetAccountRegistrationQueryFilter(prm));
|
||||
qry.OrderBy.AddRange(GetAccountRegistrationSortColumns(prm));
|
||||
// Query data.
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
dbConnection.Open();
|
||||
dbCommand.CommandText = qry.BuildQuery(prm.ResultsPaging);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
{
|
||||
while (dbDataReader.Read())
|
||||
{
|
||||
dbAccountRegistration = new AccountRegistration_Db(DbInfo);
|
||||
dbAccountRegistration.PopulateFrom(dbDataReader);
|
||||
addresses.Add(CreateAccountRegistration(dbAccountRegistration));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
return addresses;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item query execution.
|
||||
public override DbResultSet ExecuteAccountRegistrationQuery(List<ColumnDfn> columns, SbmcAccountRegistration.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Construct query.
|
||||
DbQuery query = new DbQuery(db.DbmsType);
|
||||
query.Tables.Add(SbmDbDfn_Control.GetTableName(SbmDbDfn_Control.TableIdx.AccountRegistration), aliasAccountRegistration);
|
||||
|
||||
// AccountRegistration Properties - add columns as defined in query list.
|
||||
if (columns.HasId(SbmcAccountRegistration.Column.Id))
|
||||
query.Columns.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_Id, aliasAccountRegistration));
|
||||
if (columns.HasId(SbmcAccountRegistration.Column.EmailAddress))
|
||||
query.Columns.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_EmailAddress, aliasAccountRegistration));
|
||||
if (columns.HasId(SbmcAccountRegistration.Column.FirstName))
|
||||
query.Columns.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_FirstName, aliasAccountRegistration));
|
||||
if (columns.HasId(SbmcAccountRegistration.Column.LastName))
|
||||
query.Columns.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_LastName, aliasAccountRegistration));
|
||||
if (columns.HasId(SbmcAccountRegistration.Column.PhoneMain))
|
||||
query.Columns.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_PhoneMain, aliasAccountRegistration));
|
||||
if (columns.HasId(SbmcAccountRegistration.Column.PhoneAlt))
|
||||
query.Columns.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_PhoneAlt, aliasAccountRegistration));
|
||||
|
||||
// Registration.
|
||||
if (columns.HasId(SbmcAccountRegistration.Column.InstanceContext))
|
||||
query.Columns.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_InstanceContext, aliasAccountRegistration));
|
||||
if (columns.HasId(SbmcAccountRegistration.Column.RequestAccountAt))
|
||||
query.Columns.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_RequestAccountAt, aliasAccountRegistration));
|
||||
if (columns.HasId(SbmcAccountRegistration.Column.RegisterAccountToken))
|
||||
query.Columns.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_RegisterAccountToken, aliasAccountRegistration));
|
||||
if (columns.HasId(SbmcAccountRegistration.Column.RegisterAccountAt))
|
||||
query.Columns.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_RegisterAccountAt, aliasAccountRegistration));
|
||||
|
||||
// Common.
|
||||
if (columns.HasId(SbmcAccountRegistration.Column.Notes))
|
||||
query.Columns.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_Notes, aliasAccountRegistration));
|
||||
if (columns.HasId(SbmcAccountRegistration.Column.Status) || columns.HasId(SbmcAccountRegistration.Column.Status_Desc) || columns.HasId(SbmcAccountRegistration.Column.Status_Ind))
|
||||
query.Columns.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_Status, aliasAccountRegistration));
|
||||
if (columns.HasId(SbmcAccountRegistration.Column.CreateOn_Date))
|
||||
query.Columns.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_CreateOn, aliasAccountRegistration));
|
||||
if (columns.HasId(SbmcAccountRegistration.Column.UpdateOn_Date))
|
||||
query.Columns.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.AccountRegistration_UpdateOn, aliasAccountRegistration));
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Populate filter.
|
||||
query.Filters.AddRange(GetAccountRegistrationQueryFilter(prm));
|
||||
|
||||
if (prm.IdsIncluded.Count != 1)
|
||||
{
|
||||
// Configure sort sequence.
|
||||
foreach (String sortColumn in GetAccountRegistrationSortColumns(prm))
|
||||
query.OrderBy.Add(sortColumn);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
//return new DbResultSet_DataTableReader(db, query.BuildQuery());
|
||||
return DbResultSet_DataReader.ExecuteQuery(db, query.BuildQuery(prm.ResultsPaging));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -1,13 +1,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Bus.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Internal;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Internal.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.UpdateLog;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -23,7 +17,7 @@ using System.Text.RegularExpressions;
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
// Control - Account Manager - UserAccounts.
|
||||
// Control - Account Manager - User Accounts.
|
||||
//=======================================================================
|
||||
partial class SbmcAccountMgr_Dbas
|
||||
{
|
||||
@@ -40,7 +34,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create UserAccount.
|
||||
// Create Item.
|
||||
public override SbmcUserAccount CreateUserAccount()
|
||||
{
|
||||
return new SbmcUserAccount_Dbas(null, 0);
|
||||
@@ -54,7 +48,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get UserAccount.
|
||||
// Get Item.
|
||||
public override SbmcUserAccount GetUserAccount(SbmcUserAccount.Params prm)
|
||||
{
|
||||
return GetUserAccount(GetUserAccountQueryFilter(prm).Concat(" AND ", "(", ")"));
|
||||
@@ -66,7 +60,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple UserAccountes found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmcUserAccount userAccount = null;
|
||||
@@ -83,7 +77,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("UserAccount query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -91,7 +85,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate UserAccount.
|
||||
// Validate Item.
|
||||
public override bool IsValidUserAccountData(SbmcUserAccount.Data data, SbmcUserAccount.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -100,7 +94,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert UserAccount.
|
||||
// Insert UserAItemccount.
|
||||
public override bool InsertUserAccount(SbmcUserAccount userAccount, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -126,11 +120,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update UserAccount.
|
||||
// Update Item.
|
||||
public override bool UpdateUserAccount(SbmcUserAccount userAccount, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -164,11 +158,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Delete UserAccount.
|
||||
// Delete Item.
|
||||
public override bool UserAccountCanBeDeleted(SbmcUserAccount userAccount)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -197,11 +191,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Copy data properties to and from userAccount.
|
||||
// Copy data properties to and from Item.
|
||||
private void PopulateTo(UserAccount_Db dbUserAccount, SbmcUserAccount userAccount, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
dbUserAccount._Id = userAccount.Id.ToInt();
|
||||
@@ -266,7 +260,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// UserAccount column definitions.
|
||||
// Item column definitions.
|
||||
private static readonly String aliasUserAccount = "Uac";
|
||||
private void SetUserAccountColDfn
|
||||
(ColumnDfn col, String caption, int width, SbmDbDfn_Control.ColumnIdx dbCol,
|
||||
@@ -280,7 +274,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
col.MaxLength = (int)SbmDbDfn_Control.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting prmUserAccount column definition.
|
||||
// Item column definition.
|
||||
public override ColumnDfn GetUserAccountColumnDfn(SbmcUserAccount.Column columnId, string caption = "", int width = 0)
|
||||
{
|
||||
ColumnDfn columnDfn = new ColumnDfn((int)columnId, caption, width);
|
||||
@@ -377,7 +371,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// UserAccount query filter.
|
||||
// Item query filter.
|
||||
public override List<string> GetUserAccountQueryFilter(SbmcUserAccount.Params prm)
|
||||
{
|
||||
List<String> filter = new List<String>();
|
||||
@@ -424,8 +418,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
filter.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.UserAccount_Notes, aliasUserAccount) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SbmcUserAccount.StatusCat.ActiveOnly)
|
||||
filter.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.UserAccount_Status, aliasUserAccount) + " = '" + StatusActive + "'");
|
||||
String statusFilter = GetUserAccountStatusCatFilterCondition(prm.StatusCat);
|
||||
if (!StringUtil.IsBlank(statusFilter))
|
||||
filter.Add($"{SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.UserAccount_Status, aliasUserAccount)}{statusFilter}");
|
||||
|
||||
if (filter.Count < 1 && prm.IncludeDefaultFilter) filter.Add("1=1");
|
||||
return filter;
|
||||
@@ -444,7 +439,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// UserAccount sort columns.
|
||||
// Item sort columns.
|
||||
public List<String> GetUserAccountSortColumns(SbmcUserAccount.Params prm)
|
||||
{
|
||||
// Sort sequence:
|
||||
@@ -479,7 +474,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// UserAccount count.
|
||||
// Item count.
|
||||
private long GetUserAccountCount(String filter)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -492,7 +487,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// UserAccount list.
|
||||
// Item list.
|
||||
public override List<SbmcUserAccount> GetUserAccountList(SbmcUserAccount.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -523,7 +518,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("UserAccount query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -531,7 +526,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// UserAccount query execution.
|
||||
// Item query execution.
|
||||
public override DbResultSet ExecuteUserAccountQuery(List<ColumnDfn> columns, SbmcUserAccount.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Bus.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Internal;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Internal.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.UpdateLog;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -40,7 +34,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create Owner.
|
||||
// Create Item.
|
||||
public override SbmcOwner CreateOwner()
|
||||
{
|
||||
return new SbmcOwner_Dbas(null, 0);
|
||||
@@ -54,7 +48,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Owner.
|
||||
// Get Item.
|
||||
public override SbmcOwner GetOwner(SbmcOwner.Params prm)
|
||||
{
|
||||
return GetOwner(GetOwnerQueryFilter(prm).Concat(" AND ", "(", ")"));
|
||||
@@ -66,7 +60,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Owneres found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmcOwner owner = null;
|
||||
@@ -83,7 +77,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Owner query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -91,7 +85,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate Owner.
|
||||
// Validate Item.
|
||||
public override bool IsValidOwnerData(SbmcOwner.Data data, SbmcOwner.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -100,7 +94,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert Owner.
|
||||
// Insert Item.
|
||||
public override bool InsertOwner(SbmcOwner owner, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -126,11 +120,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update Owner.
|
||||
// Update Item.
|
||||
public override bool UpdateOwner(SbmcOwner owner, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -146,7 +140,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve Owner.
|
||||
// Retrieve Item.
|
||||
dbConnection.Open();
|
||||
Owner_Db dbOwner = new Owner_Db(DbInfo);
|
||||
dbOwner.PopulateFrom(dbCommand, aliasOwner, $"Id={SysId.ToString(owner.Id)}");
|
||||
@@ -164,11 +158,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Delete Owner.
|
||||
// Delete Item.
|
||||
public override bool OwnerCanBeDeleted(SbmcOwner owner)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -197,11 +191,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Copy data properties to and from owner.
|
||||
// Copy data properties to and from Item.
|
||||
private void PopulateTo(Owner_Db dbOwner, SbmcOwner owner, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
dbOwner._Id = owner.Id.ToInt();
|
||||
@@ -241,7 +235,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Owner column definitions.
|
||||
// Item column definitions.
|
||||
private static readonly String aliasOwner = "Onr";
|
||||
private static readonly String colOwner_Repository_Count = "Onr_Rpo_Count";
|
||||
private void SetOwnerColDfn
|
||||
@@ -256,7 +250,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
col.MaxLength = (int)SbmDbDfn_Control.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting prmOwner column definition.
|
||||
// Item column definition.
|
||||
public override ColumnDfn GetOwnerColumnDfn(SbmcOwner.Column columnId, string caption = "", int width = 0)
|
||||
{
|
||||
ColumnDfn columnDfn = new ColumnDfn((int)columnId, caption, width);
|
||||
@@ -327,7 +321,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Owner query filter.
|
||||
// Item query filter.
|
||||
public override List<string> GetOwnerQueryFilter(SbmcOwner.Params prm)
|
||||
{
|
||||
List<String> filter = new List<String>();
|
||||
@@ -363,8 +357,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
filter.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.Owner_Notes, aliasOwner) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SbmcOwner.StatusCat.ActiveOnly)
|
||||
filter.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.Owner_Status, aliasOwner) + " = '" + StatusActive + "'");
|
||||
String statusFilter = GetOwnerStatusCatFilterCondition(prm.StatusCat);
|
||||
if (!StringUtil.IsBlank(statusFilter))
|
||||
filter.Add($"{SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.Owner_Status, aliasOwner)}{statusFilter}");
|
||||
|
||||
if (filter.Count < 1 && prm.IncludeDefaultFilter) filter.Add("1=1");
|
||||
return filter;
|
||||
@@ -385,7 +380,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Owner sort columns.
|
||||
// Item sort columns.
|
||||
public List<String> GetOwnerSortColumns(SbmcOwner.Params prm)
|
||||
{
|
||||
// Sort sequence:
|
||||
@@ -420,7 +415,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Owner count.
|
||||
// Item count.
|
||||
private long GetOwnerCount(String filter)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -433,7 +428,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Owner list.
|
||||
// Item list.
|
||||
public override List<SbmcOwner> GetOwnerList(SbmcOwner.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -464,7 +459,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Owner query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -472,7 +467,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Owner query execution.
|
||||
// Item query execution.
|
||||
public override DbResultSet ExecuteOwnerQuery(List<ColumnDfn> columns, SbmcOwner.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Bus.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Internal;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Internal.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.UpdateLog;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -40,7 +34,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create Repository.
|
||||
// Create Item.
|
||||
public override SbmcRepository CreateRepository()
|
||||
{
|
||||
return new SbmcRepository_Dbas(null, 0);
|
||||
@@ -54,7 +48,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Repository.
|
||||
// Get Item.
|
||||
public override SbmcRepository GetRepository(SbmcRepository.Params prm)
|
||||
{
|
||||
return GetRepository(GetRepositoryQueryFilter(prm).Concat(" AND ", "(", ")"));
|
||||
@@ -66,7 +60,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Repositories found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmcRepository repository = null;
|
||||
@@ -83,7 +77,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Repository query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -91,7 +85,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate Repository.
|
||||
// Validate Item.
|
||||
public override bool IsValidRepositoryData(SbmcRepository.Data data, SbmcRepository.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -100,7 +94,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert Repository.
|
||||
// Insert Item.
|
||||
public override bool InsertRepository(SbmcRepository repository, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -126,11 +120,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update Repository.
|
||||
// Update Item.
|
||||
public override bool UpdateRepository(SbmcRepository repository, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -164,11 +158,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Delete Repository.
|
||||
// Delete Item.
|
||||
public override bool RepositoryCanBeDeleted(SbmcRepository repository)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -197,11 +191,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Copy data properties to and from repository.
|
||||
// Copy data properties to and from Item.
|
||||
private void PopulateTo(Repository_Db dbRepository, SbmcRepository repository, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
dbRepository._Id = repository.Id.ToInt();
|
||||
@@ -245,7 +239,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Repository column definitions.
|
||||
// Item column definitions.
|
||||
private static readonly String aliasRepository = "Rpo";
|
||||
private static readonly String aliasRepository_Owner = "Rpo_Onr";
|
||||
private static readonly String prefixRepository_Owner = aliasRepository_Owner + "_";
|
||||
@@ -261,7 +255,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
col.MaxLength = (int)SbmDbDfn_Control.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting prmRepository column definition.
|
||||
// Item column definition.
|
||||
public override ColumnDfn GetRepositoryColumnDfn(SbmcRepository.Column columnId, string caption = "", int width = 0)
|
||||
{
|
||||
ColumnDfn columnDfn = new ColumnDfn((int)columnId, caption, width);
|
||||
@@ -351,7 +345,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Repository query filter.
|
||||
// Item query filter.
|
||||
public override List<string> GetRepositoryQueryFilter(SbmcRepository.Params prm)
|
||||
{
|
||||
List<String> filter = new List<String>();
|
||||
@@ -399,8 +393,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
filter.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.Repository_Notes, aliasRepository) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SbmcRepository.StatusCat.ActiveOnly)
|
||||
filter.Add(SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.Repository_Status, aliasRepository) + " = '" + StatusActive + "'");
|
||||
String statusFilter = GetRepositoryStatusCatFilterCondition(prm.StatusCat);
|
||||
if (!StringUtil.IsBlank(statusFilter))
|
||||
filter.Add($"{SbmDbDfn_Control.GetColumnNameQual(SbmDbDfn_Control.ColumnIdx.Repository_Status, aliasRepository)}{statusFilter}");
|
||||
|
||||
if (filter.Count < 1 && prm.IncludeDefaultFilter) filter.Add("1=1");
|
||||
return filter;
|
||||
@@ -421,7 +416,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Repository sort columns.
|
||||
// Item sort columns.
|
||||
public List<String> GetRepositorySortColumns(SbmcRepository.Params prm)
|
||||
{
|
||||
// Sort sequence:
|
||||
@@ -456,7 +451,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Repository count.
|
||||
// Item count.
|
||||
private long GetRepositoryCount(String filter)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -469,7 +464,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Repository list.
|
||||
// Item list.
|
||||
public override List<SbmcRepository> GetRepositoryList(SbmcRepository.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -500,7 +495,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Repository query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -508,7 +503,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Repository query execution.
|
||||
// Item query execution.
|
||||
public override DbResultSet ExecuteRepositoryQuery(List<ColumnDfn> columns, SbmcRepository.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Bus.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Internal;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Internal.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.UpdateLog;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -23,7 +17,7 @@ using System.Text.RegularExpressions;
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
// Control - Item Manager - ItemParams.
|
||||
// Control - Item Manager - Item Params.
|
||||
//=======================================================================
|
||||
partial class SbmcItemMgr_Dbas
|
||||
{
|
||||
@@ -42,7 +36,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
// Create Item.
|
||||
public override SbmcItemParam CreateItemParam(ItemId itemId)
|
||||
{
|
||||
return new SbmcItemParam_Dbas(null, itemId, 0);
|
||||
@@ -56,7 +50,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get item.
|
||||
// Get Item.
|
||||
public override SbmcItemParam GetItemParam(SbmcItemParam.Params prm)
|
||||
{
|
||||
return GetItemParam(GetItemParamQueryFilter(prm).Concat(" AND ", "(", ")"));
|
||||
@@ -68,7 +62,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple ItemParames found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmcItemParam itemParam = null;
|
||||
@@ -85,7 +79,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("ItemParam query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -93,7 +87,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item.
|
||||
// Validate Item.
|
||||
public override bool IsValidItemParamData(SbmcItemParam.Data data, SbmcItemParam.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -102,7 +96,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert item.
|
||||
// Insert Item.
|
||||
public override bool InsertItemParam(SbmcItemParam itemParam, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -128,11 +122,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update item.
|
||||
// Update Item.
|
||||
public override bool UpdateItemParam(SbmcItemParam itemParam, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -166,11 +160,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Delete item.
|
||||
// Delete Item.
|
||||
public override bool ItemParamCanBeDeleted(SbmcItemParam itemParam)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -199,11 +193,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Copy data properties to and from item.
|
||||
// Copy data properties to and from Item.
|
||||
private void PopulateTo(ItemParam_Db dbItemParam, SbmcItemParam itemParam, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
dbItemParam._Id = itemParam.Id.ToInt();
|
||||
@@ -494,7 +488,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("ItemParam query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
// Check that this is the only primary address for the item.
|
||||
ClearErrorState();
|
||||
if (addressPrimary == null) return SetErrorState("item not specified");
|
||||
if (addressPrimary == null) return SetErrorState(Msg_ItemNotSpecified);
|
||||
if (!SysId.IsValid(addressPrimary.Id)) return SetErrorState("invalid item id");
|
||||
if (!addressPrimary.IsPrimary) return SetErrorState("address is not primary");
|
||||
if (Database == null) return SetErrorState("database not available");
|
||||
@@ -71,7 +71,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
}
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -115,7 +115,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
else SetErrorState("Data item manager is not available");
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -158,7 +158,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Addresses found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmAddress address = null;
|
||||
@@ -175,7 +175,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -218,7 +218,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -256,7 +256,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -289,7 +289,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -393,7 +393,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasAddress;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting prmAddress column definition.
|
||||
@@ -750,7 +750,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Org.BouncyCastle.Asn1.Cmp;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Internal;
|
||||
@@ -149,7 +151,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
else SetErrorState("Data item manager is not available");
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -179,7 +181,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Contacts found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmAffiliate affiliate = null;
|
||||
@@ -196,7 +198,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -313,7 +315,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -351,7 +353,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -384,7 +386,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -498,7 +500,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasAffiliate;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting prmAffiliate column definition.
|
||||
@@ -916,23 +918,27 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
filter.Add($"{colAffiliate_Notes} LIKE '%{DbQuery.FormatForLike(prm.NotesPartial)}%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat != SbmAffiliate.StatusCat.Any)
|
||||
{
|
||||
String colStatus = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Affiliate_Status, aliasAffiliate);
|
||||
if (prm.StatusCat == SbmAffiliate.StatusCat.CurrentOnly)
|
||||
filter.Add($"{colStatus}='{StatusCurrent}'");
|
||||
else if (prm.StatusCat == SbmAffiliate.StatusCat.OnHoldOnly)
|
||||
filter.Add($"{colStatus}='{SacsSystem.GetStatusCode(SaStatus.OnHold)}'");
|
||||
else if (prm.StatusCat == SbmAffiliate.StatusCat.NotDeleted)
|
||||
filter.Add($"{colStatus}!='{SacsSystem.GetStatusCode(SaStatus.Deleted)}'");
|
||||
else if (prm.StatusCat == SbmAffiliate.StatusCat.DeletedOnly)
|
||||
filter.Add($"{colStatus}='{SacsSystem.GetStatusCode(SaStatus.Deleted)}'");
|
||||
}
|
||||
String statusCatCondition = GetAffiliateStatusCatFilterCondition(prm.StatusCat);
|
||||
if (!StringUtil.IsBlank(statusCatCondition))
|
||||
filter.Add($"{SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Affiliate_Status, aliasAffiliate)}{statusCatCondition}");
|
||||
|
||||
if (filter.Count < 1 && prm.IncludeDefaultFilter) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
|
||||
internal static String GetAffiliateStatusCatFilterCondition(SbmAffiliate.StatusCat statusCat)
|
||||
{
|
||||
if (statusCat == SbmAffiliate.StatusCat.CurrentOnly)
|
||||
return $"='{StatusCurrent}'";
|
||||
else if (statusCat == SbmAffiliate.StatusCat.OnHoldOnly)
|
||||
return $"='{StatusOnHold}'";
|
||||
else if (statusCat == SbmAffiliate.StatusCat.NotDeleted)
|
||||
return $"!='{StatusDeleted}'";
|
||||
else if (statusCat == SbmAffiliate.StatusCat.DeletedOnly)
|
||||
return $"='{StatusDeleted}'";
|
||||
return "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Affiliate sort columns.
|
||||
public List<String> GetAffiliateSortColumns(SbmAffiliate.Params prm)
|
||||
@@ -1029,7 +1035,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,258 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Internal;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.UpdateLog;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Interfaces;
|
||||
using Sarand.Net.Standard.Base.ItemDocs;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Dbas.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using static Sarand.BusinessMgr.Net.Standard.Base.App.Sbm;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
// Account manager - Associations - Utilities.
|
||||
//=======================================================================
|
||||
partial class SbmAccountMgr_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
private List<StringPair> GetLogProperties(SbmAssociation association)
|
||||
{
|
||||
return new List<StringPair>()
|
||||
{
|
||||
new StringPair("Id",SysId.ToString(association.Id)),
|
||||
new StringPair("Code",association.Code),
|
||||
new StringPair("Status",association.StatusCode)
|
||||
};
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Association types in use.
|
||||
public override List<Sbm.AssociationType> GetAssociationTypesInUse()
|
||||
{
|
||||
List<Sbm.AssociationType> types = new List<Sbm.AssociationType>();
|
||||
String colAssociation_Type = SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.Association_Type);
|
||||
// Construct the query.
|
||||
DbQuery qry = new DbQuery(Database.DbmsType);
|
||||
qry.Tables.Add(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Association));
|
||||
qry.Columns.Add("DISTINCT " + SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Type), colAssociation_Type);
|
||||
qry.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdOwner) + "=" + AffiliateId_Owner.ToString());
|
||||
using (DbResultSet dbResultSet = DbResultSet_DataReader.ExecuteQuery(Database, qry.BuildQuery()))
|
||||
{
|
||||
if (dbResultSet != null && dbResultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = dbResultSet.GetRecordValues();
|
||||
types.Add((Sbm.AssociationType)values.GetValue(colAssociation_Type).AsLong());
|
||||
}
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Internal associations.
|
||||
public override HashSet<SysId> GetInternalAssociationAffiliateIdsOwner()
|
||||
{
|
||||
ClearErrorState();
|
||||
HashSet<SysId> affiliateIdsOwner = new HashSet<SysId>();
|
||||
String colAffIdOwner = SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.Association_AffIdOwner);
|
||||
SbmAssociation.Params prmAssociation = new SbmAssociation.Params();
|
||||
prmAssociation.AssociationType = AssociationType.Internal;
|
||||
prmAssociation.StatusCat = SbmAssociation.StatusCat.Active;
|
||||
// Construct the query.
|
||||
DbQuery qry = new DbQuery(Database.DbmsType);
|
||||
qry.Tables.Add(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Association), aliasAssociation);
|
||||
qry.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Type, aliasAssociation), colAffIdOwner);
|
||||
qry.Filters.AddRange(GetAssociationQueryFilter(prmAssociation));
|
||||
using (DbResultSet dbResultSet = DbResultSet_DataReader.ExecuteQuery(Database, qry.BuildQuery()))
|
||||
{
|
||||
if (dbResultSet != null && dbResultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = dbResultSet.GetRecordValues();
|
||||
SysId affiliteIdOwner = new SysId(values.GetValue(colAffIdOwner).AsLong());
|
||||
if (SysId.IsValid(affiliteIdOwner))
|
||||
affiliateIdsOwner.Add(affiliteIdOwner);
|
||||
}
|
||||
}
|
||||
return affiliateIdsOwner;
|
||||
}
|
||||
|
||||
public override List<SysId> GetMemberTargetIds(SysId affiliateIdOwner)
|
||||
{
|
||||
List<SysId> affiliateIncludeIds = new List<SysId>();
|
||||
List<SysId> affiliateExcludeIds = new List<SysId>();
|
||||
return GetTargetIds(affiliateIdOwner, Sbm.AssociationType.Member, affiliateIncludeIds, affiliateExcludeIds);
|
||||
}
|
||||
public override List<SysId> GetCustomerTargetIds(List<SysId> affiliateIncludeIds, List<SysId> affiliateExcludeIds)
|
||||
{
|
||||
return GetTargetIds(AffiliateId_Owner, Sbm.AssociationType.Customer, affiliateIncludeIds, affiliateExcludeIds);
|
||||
}
|
||||
public List<SysId> GetTargetIds(SysId affiliateIdOwner, Sbm.AssociationType associationType, List<SysId> affiliateIncludeIds, List<SysId> affiliateExcludeIds)
|
||||
{
|
||||
List<SysId> affiliateIdsTarget = new List<SysId>();
|
||||
if (Database == null) return affiliateIdsTarget;
|
||||
bool validConfig = true;
|
||||
if (!SysId.IsValid(affiliateIdOwner) || (int)associationType < 1)
|
||||
{
|
||||
#if _DEBUG
|
||||
SATRACE("SapAssociationMgr_Odbc::GetTargetIds Invalid owner or association type.\n");
|
||||
#endif
|
||||
validConfig = false;
|
||||
}
|
||||
else if (associationType == Sbm.AssociationType.Customer || associationType == Sbm.AssociationType.Supplier)
|
||||
{
|
||||
if (affiliateIdOwner != AffiliateId_Owner)
|
||||
{
|
||||
#if _DEBUG
|
||||
SATRACE("SapAssociationMgr_Odbc::GetTargetIds Invalid customer/supplier owner.\n");
|
||||
#endif
|
||||
validConfig = false;
|
||||
}
|
||||
}
|
||||
if (validConfig)
|
||||
{
|
||||
String colAffiliateIdTarget = "AffIdTgt";
|
||||
DbQuery qry = new DbQuery(Database.DbmsType);
|
||||
qry.Tables.Add(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Association));
|
||||
qry.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdTarget), colAffiliateIdTarget);
|
||||
qry.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdOwner) + "=" + affiliateIdOwner.ToString());
|
||||
qry.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Type) + "=" + ((int)associationType).ToString());
|
||||
if (affiliateIncludeIds.Count > 0)
|
||||
qry.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdTarget) + " IN(" + affiliateIncludeIds.Concat(",") + ")");
|
||||
if (affiliateExcludeIds.Count > 0)
|
||||
qry.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdTarget) + " NOT IN(" + affiliateExcludeIds.Concat(",") + ")");
|
||||
|
||||
using (DbResultSet dbResultSet = DbResultSet_DataReader.ExecuteQuery(Database, qry.ToString()))
|
||||
{
|
||||
if (dbResultSet != null && dbResultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = dbResultSet.GetRecordValues();
|
||||
affiliateIdsTarget.Add(new SysId(StringUtil.ToInt(values.GetValue(colAffiliateIdTarget))));
|
||||
}
|
||||
}
|
||||
}
|
||||
return affiliateIdsTarget;
|
||||
}
|
||||
public override List<SysId> GetCustomerAssocIdsForTargets(List<SysId> affiliateIdsTarget)
|
||||
{
|
||||
return GetAssocIdsForTargets(AffiliateId_Owner, Sbm.AssociationType.Customer, affiliateIdsTarget);
|
||||
}
|
||||
public override List<SysId> GetAssocIdsForTargets(SysId affiliateIdOwner, Sbm.AssociationType associationType, List<SysId> affiliateIdsTarget)
|
||||
{
|
||||
List<SysId> associations = new List<SysId>();
|
||||
if (Database == null) return associations;
|
||||
bool validConfig = true;
|
||||
if (!SysId.IsValid(affiliateIdOwner) || (int)associationType < 1)
|
||||
{
|
||||
#if _DEBUG
|
||||
SATRACE("SapAssociationMgr_Odbc::GetAssocIdsForTargets Invalid owner or association type.\n");
|
||||
#endif
|
||||
validConfig = false;
|
||||
}
|
||||
else if (associationType == Sbm.AssociationType.Customer || associationType == Sbm.AssociationType.Supplier)
|
||||
{
|
||||
if (affiliateIdOwner != AffiliateId_Owner)
|
||||
{
|
||||
#if _DEBUG
|
||||
SATRACE("SapAssociationMgr_Odbc::GetAssocIdsForTargets Invalid customer/supplier owner.\n");
|
||||
#endif
|
||||
validConfig = false;
|
||||
}
|
||||
}
|
||||
if (validConfig)
|
||||
{
|
||||
String colAssociationId = "AssocId";
|
||||
DbQuery qry = new DbQuery(Database.DbmsType);
|
||||
qry.Tables.Add(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Association));
|
||||
qry.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Id), colAssociationId);
|
||||
qry.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdOwner) + "=" + affiliateIdOwner.ToString());
|
||||
qry.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Type) + "=" + ((int)associationType).ToString());
|
||||
qry.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdTarget) + " IN " + affiliateIdsTarget.Concat(","));
|
||||
|
||||
using (DbResultSet dbResultSet = DbResultSet_DataReader.ExecuteQuery(Database, qry.ToString()))
|
||||
{
|
||||
if (dbResultSet != null && dbResultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = dbResultSet.GetRecordValues();
|
||||
associations.Add(new SysId(StringUtil.ToInt(values.GetValue(colAssociationId))));
|
||||
}
|
||||
}
|
||||
}
|
||||
return associations;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Associated data.
|
||||
public override bool AssociationHasTransactions(SysId associationId)
|
||||
{
|
||||
if (!SysId.IsValid(associationId)) return false;
|
||||
String filter = $"{SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.Transaction_AssocId)}={associationId}";
|
||||
return Database.GetRowCount(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Transaction), filter) > 0;
|
||||
}
|
||||
public override bool AssociationHasRequirements(SysId associationId)
|
||||
{
|
||||
if (!SysId.IsValid(associationId)) return false;
|
||||
String filter = $"{SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.Requirement_AssocId)}={associationId}";
|
||||
return Database.GetRowCount(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Requirement), filter) > 0;
|
||||
}
|
||||
public override bool AssociationHasConstituents(SysId associationId)
|
||||
{
|
||||
if (!SysId.IsValid(associationId)) return false;
|
||||
String filter = $"{SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.Constituent_AssocId)}={associationId}";
|
||||
return Database.GetRowCount(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Constituent), filter) > 0;
|
||||
}
|
||||
public override bool AssociationIsDeliveryContractor(SysId associationId)
|
||||
{
|
||||
// Is associated with transaction for delivery.
|
||||
if (!SysId.IsValid(associationId)) return false;
|
||||
String filter = $"{SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.Transaction_AssIdDeliver)}={associationId}";
|
||||
return Database.GetRowCount(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Transaction), filter) > 0;
|
||||
}
|
||||
public override bool ClearAssociationDependentData(SbmAssociation association, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (association == null || !SysId.IsValid(association.Id)) return false;
|
||||
|
||||
// Delete interface data items.
|
||||
if (!HasErrorState())
|
||||
{
|
||||
if (InterfaceConsole != null)
|
||||
{
|
||||
if (!InterfaceConsole.ClearInterfaceDataItems(association.GetItemId(), DbUpdateInfo))
|
||||
SetErrorState("Failed to clear interface data items - " + InterfaceConsole.ErrorStateMessage);
|
||||
}
|
||||
else SetErrorState("failed to initialise interface console");
|
||||
}
|
||||
// Remove document references
|
||||
if (!HasErrorState())
|
||||
{
|
||||
if (ItemDocConsole != null)
|
||||
{
|
||||
if (!ItemDocConsole.ClearItemDocs(association.GetItemId(), DbUpdateInfo))
|
||||
SetErrorState(ItemDocConsole.ErrorStateMessage);
|
||||
}
|
||||
else SetErrorState("Failed to retrieve item document console");
|
||||
}
|
||||
// Remove data item references.
|
||||
if (!HasErrorState())
|
||||
{
|
||||
if (!DataItemMgr.ClearDataItem(association.GetItemId(), dbUpdateInfo))
|
||||
SetErrorState(DataItemMgr.ErrorStateMessage);
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -16,6 +16,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using static Sarand.BusinessMgr.Net.Standard.Base.App.Sbm;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
@@ -25,202 +26,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
partial class SbmAccountMgr_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities - Association List Target.
|
||||
private List<StringPair> GetLogProperties(SbmAssociation association)
|
||||
{
|
||||
return new List<StringPair>()
|
||||
{
|
||||
new StringPair("Id",SysId.ToString(association.Id)),
|
||||
new StringPair("Code",association.Code),
|
||||
new StringPair("Status",association.StatusCode)
|
||||
};
|
||||
}
|
||||
|
||||
public override List<Sbm.AssociationType> GetAssociationTypesInUse()
|
||||
{
|
||||
List<Sbm.AssociationType> types = new List<Sbm.AssociationType>();
|
||||
// Construct the query.
|
||||
DbQuery qry = new DbQuery(Database.DbmsType);
|
||||
qry.Tables.Add(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Association));
|
||||
qry.Columns.Add("DISTINCT " + SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Type));
|
||||
qry.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdOwner) + "=" + AffiliateId_Owner.ToString());
|
||||
using (DbResultSet dbResultSet = DbResultSet_DataReader.ExecuteQuery(Database, qry.ToString()))
|
||||
{
|
||||
if (dbResultSet != null && dbResultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = dbResultSet.GetRecordValues();
|
||||
types.Add((Sbm.AssociationType)values.GetValue(SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.Association_Type)).AsLong());
|
||||
}
|
||||
}
|
||||
return types;
|
||||
}
|
||||
public override List<SysId> GetMemberTargetIds(SysId affiliateIdOwner)
|
||||
{
|
||||
List<SysId> affiliateIncludeIds = new List<SysId>();
|
||||
List<SysId> affiliateExcludeIds = new List<SysId>();
|
||||
return GetTargetIds(affiliateIdOwner, Sbm.AssociationType.Member, affiliateIncludeIds, affiliateExcludeIds);
|
||||
}
|
||||
public override List<SysId> GetCustomerTargetIds(List<SysId> affiliateIncludeIds, List<SysId> affiliateExcludeIds)
|
||||
{
|
||||
return GetTargetIds(AffiliateId_Owner, Sbm.AssociationType.Customer, affiliateIncludeIds, affiliateExcludeIds);
|
||||
}
|
||||
public List<SysId> GetTargetIds(SysId affiliateIdOwner, Sbm.AssociationType associationType, List<SysId> affiliateIncludeIds, List<SysId> affiliateExcludeIds)
|
||||
{
|
||||
List<SysId> affiliateIdsTarget = new List<SysId>();
|
||||
if (Database == null) return affiliateIdsTarget;
|
||||
bool validConfig = true;
|
||||
if (!SysId.IsValid(affiliateIdOwner) || (int)associationType < 1)
|
||||
{
|
||||
#if _DEBUG
|
||||
SATRACE("SapAssociationMgr_Odbc::GetTargetIds Invalid owner or association type.\n");
|
||||
#endif
|
||||
validConfig = false;
|
||||
}
|
||||
else if (associationType == Sbm.AssociationType.Customer || associationType == Sbm.AssociationType.Supplier)
|
||||
{
|
||||
if (affiliateIdOwner != AffiliateId_Owner)
|
||||
{
|
||||
#if _DEBUG
|
||||
SATRACE("SapAssociationMgr_Odbc::GetTargetIds Invalid customer/supplier owner.\n");
|
||||
#endif
|
||||
validConfig = false;
|
||||
}
|
||||
}
|
||||
if (validConfig)
|
||||
{
|
||||
String colAffiliateIdTarget = "AffIdTgt";
|
||||
DbQuery qry = new DbQuery(Database.DbmsType);
|
||||
qry.Tables.Add(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Association));
|
||||
qry.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdTarget), colAffiliateIdTarget);
|
||||
qry.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdOwner) + "=" + affiliateIdOwner.ToString());
|
||||
qry.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Type) + "=" + ((int)associationType).ToString());
|
||||
if (affiliateIncludeIds.Count > 0)
|
||||
qry.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdTarget) + " IN(" + affiliateIncludeIds.Concat(",") + ")");
|
||||
if (affiliateExcludeIds.Count > 0)
|
||||
qry.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdTarget) + " NOT IN(" + affiliateExcludeIds.Concat(",") + ")");
|
||||
|
||||
using (DbResultSet dbResultSet = DbResultSet_DataReader.ExecuteQuery(Database, qry.ToString()))
|
||||
{
|
||||
if (dbResultSet != null && dbResultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = dbResultSet.GetRecordValues();
|
||||
affiliateIdsTarget.Add(new SysId(StringUtil.ToInt(values.GetValue(colAffiliateIdTarget))));
|
||||
}
|
||||
}
|
||||
}
|
||||
return affiliateIdsTarget;
|
||||
}
|
||||
public override List<SysId> GetCustomerAssocIdsForTargets(List<SysId> affiliateIdsTarget)
|
||||
{
|
||||
return GetAssocIdsForTargets(AffiliateId_Owner, Sbm.AssociationType.Customer, affiliateIdsTarget);
|
||||
}
|
||||
public override List<SysId> GetAssocIdsForTargets(SysId affiliateIdOwner, Sbm.AssociationType associationType, List<SysId> affiliateIdsTarget)
|
||||
{
|
||||
List<SysId> associations = new List<SysId>();
|
||||
if (Database == null) return associations;
|
||||
bool validConfig = true;
|
||||
if (!SysId.IsValid(affiliateIdOwner) || (int)associationType < 1)
|
||||
{
|
||||
#if _DEBUG
|
||||
SATRACE("SapAssociationMgr_Odbc::GetAssocIdsForTargets Invalid owner or association type.\n");
|
||||
#endif
|
||||
validConfig = false;
|
||||
}
|
||||
else if (associationType == Sbm.AssociationType.Customer || associationType == Sbm.AssociationType.Supplier)
|
||||
{
|
||||
if (affiliateIdOwner != AffiliateId_Owner)
|
||||
{
|
||||
#if _DEBUG
|
||||
SATRACE("SapAssociationMgr_Odbc::GetAssocIdsForTargets Invalid customer/supplier owner.\n");
|
||||
#endif
|
||||
validConfig = false;
|
||||
}
|
||||
}
|
||||
if (validConfig)
|
||||
{
|
||||
String colAssociationId = "AssocId";
|
||||
DbQuery qry = new DbQuery(Database.DbmsType);
|
||||
qry.Tables.Add(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Association));
|
||||
qry.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Id), colAssociationId);
|
||||
qry.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdOwner) + "=" + affiliateIdOwner.ToString());
|
||||
qry.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Type) + "=" + ((int)associationType).ToString());
|
||||
qry.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdTarget) + " IN " + affiliateIdsTarget.Concat(","));
|
||||
|
||||
using (DbResultSet dbResultSet = DbResultSet_DataReader.ExecuteQuery(Database, qry.ToString()))
|
||||
{
|
||||
if (dbResultSet != null && dbResultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = dbResultSet.GetRecordValues();
|
||||
associations.Add(new SysId(StringUtil.ToInt(values.GetValue(colAssociationId))));
|
||||
}
|
||||
}
|
||||
}
|
||||
return associations;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Associated data.
|
||||
public override bool AssociationHasTransactions(SysId associationId)
|
||||
{
|
||||
if (!SysId.IsValid(associationId)) return false;
|
||||
String filter = $"{SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.Transaction_AssocId)}={associationId}";
|
||||
return Database.GetRowCount(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Transaction), filter) > 0;
|
||||
}
|
||||
public override bool AssociationHasRequirements(SysId associationId)
|
||||
{
|
||||
if (!SysId.IsValid(associationId)) return false;
|
||||
String filter = $"{SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.Requirement_AssocId)}={associationId}";
|
||||
return Database.GetRowCount(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Requirement), filter) > 0;
|
||||
}
|
||||
public override bool AssociationHasConstituents(SysId associationId)
|
||||
{
|
||||
if (!SysId.IsValid(associationId)) return false;
|
||||
String filter = $"{SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.Constituent_AssocId)}={associationId}";
|
||||
return Database.GetRowCount(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Constituent), filter) > 0;
|
||||
}
|
||||
public override bool AssociationIsDeliveryContractor(SysId associationId)
|
||||
{
|
||||
// Is associated with transaction for delivery.
|
||||
if (!SysId.IsValid(associationId)) return false;
|
||||
String filter = $"{SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.Transaction_AssIdDeliver)}={associationId}";
|
||||
return Database.GetRowCount(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Transaction), filter) > 0;
|
||||
}
|
||||
public override bool ClearAssociationDependentData(SbmAssociation association, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (association == null || !SysId.IsValid(association.Id)) return false;
|
||||
|
||||
// Delete interface data items.
|
||||
if (!HasErrorState())
|
||||
{
|
||||
if (InterfaceConsole != null)
|
||||
{
|
||||
if (!InterfaceConsole.ClearInterfaceDataItems(association.GetItemId(), DbUpdateInfo))
|
||||
SetErrorState("Failed to clear interface data items - " + InterfaceConsole.ErrorStateMessage);
|
||||
}
|
||||
else SetErrorState("failed to initialise interface console");
|
||||
}
|
||||
// Remove document references
|
||||
if (!HasErrorState())
|
||||
{
|
||||
if (ItemDocConsole != null)
|
||||
{
|
||||
if (!ItemDocConsole.ClearItemDocs(association.GetItemId(), DbUpdateInfo))
|
||||
SetErrorState(ItemDocConsole.ErrorStateMessage);
|
||||
}
|
||||
else SetErrorState("Failed to retrieve item document console");
|
||||
}
|
||||
// Remove data item references.
|
||||
if (!HasErrorState())
|
||||
{
|
||||
if (!DataItemMgr.ClearDataItem(association.GetItemId(), dbUpdateInfo))
|
||||
SetErrorState(DataItemMgr.ErrorStateMessage);
|
||||
}
|
||||
return !HasErrorState();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create Association.
|
||||
// Create Item.
|
||||
public override SbmAssociation CreateAssociation(SysId affiliateIdOwner, Sbm.AssociationType associationType, SysId affiliateIdTarget)
|
||||
{
|
||||
return new SbmAssociation_Dbas(null, affiliateIdOwner, associationType, affiliateIdTarget, 0);
|
||||
@@ -246,7 +52,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Associations found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmAssociation association = null;
|
||||
@@ -263,7 +69,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -365,7 +171,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -403,7 +209,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -436,7 +242,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -747,7 +553,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasAssociation;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting prmAssociation column definition.
|
||||
@@ -1789,20 +1595,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
filterTrans.Add(colTransaction_InProgress + "<" + DbQuery.FormatDateForCondition(DateUtil.IncrementDate(prm.TransactionActiveTo, 1)));
|
||||
}
|
||||
}
|
||||
// Check whether a Transaction status has been specified:
|
||||
String transtatuscatPending = TransactionStatusCats.GetCodeForType(SbmTransaction.StatusCat.Pending);
|
||||
String transtatuscatOpen = TransactionStatusCats.GetCodeForType(SbmTransaction.StatusCat.Open);
|
||||
String transtatuscatClosed = TransactionStatusCats.GetCodeForType(SbmTransaction.StatusCat.Closed);
|
||||
if (prm.TransactionStatusCat == SbmTransaction.StatusCat.NotDeleted)
|
||||
filterTrans.Add(colTransaction_Status + "<>'" + StatusDeleted + "'");
|
||||
else if (prm.TransactionStatusCat == SbmTransaction.StatusCat.Completed)
|
||||
filterTrans.Add(colTransaction_Status + "='" + TransactionStatusCats.GetCodeForType(SbmTransaction.StatusCat.Completed) + "'");
|
||||
else if (prm.TransactionStatusCat == SbmTransaction.StatusCat.NotClosed)
|
||||
filterTrans.Add(colTransaction_StatusCat + "<>'" + TransactionStatusCats.GetCodeForType(SbmTransaction.StatusCat.Closed) + "'");
|
||||
else if (prm.TransactionStatusCat == SbmTransaction.StatusCat.NotCancelled)
|
||||
filterTrans.Add(colTransaction_Status + "<>'" + StatusCancelled + "'");
|
||||
else if (!StringUtil.IsEmpty(TransactionStatusCats.GetCodeForType(prm.TransactionStatusCat)))
|
||||
filterTrans.Add(colTransaction_StatusCat + "='" + TransactionStatusCats.GetCodeForType(prm.TransactionStatusCat) + "'");
|
||||
// Transaction status.
|
||||
filterTrans.Add(SbmTransactionMgr_Dbas.GetTransactionStatusCatFilter(prm.TransactionStatusCat, "", TransactionStatusCats));
|
||||
filterTrans.RemoveBlanks();
|
||||
filterTrans.RemoveDuplicatesCI();
|
||||
if (!filterTrans.IsEmpty())
|
||||
{
|
||||
@@ -1864,12 +1659,32 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SbmAssociation.StatusCat.Active)
|
||||
filter.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Status, aliasAssociation) + " = '" + StatusActive + "'");
|
||||
String statusCatCondition = GetAssociationStatusCatFilterCondition(prm.StatusCat);
|
||||
if (!StringUtil.IsBlank(statusCatCondition))
|
||||
filter.Add($"{SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Status, aliasAssociation)}{statusCatCondition}");
|
||||
|
||||
if (filter.Count < 1 && prm.IncludeDefaultFilter) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
|
||||
internal static String GetAssociationStatusCatFilterCondition(SbmAssociation.StatusCat statusCat)
|
||||
{
|
||||
if (statusCat == SbmAssociation.StatusCat.CurrentOnly)
|
||||
return $"='{StatusCurrent}'";
|
||||
else if (statusCat == SbmAssociation.StatusCat.OnHoldOnly)
|
||||
return $"='{StatusOnHold}'";
|
||||
else if (statusCat == SbmAssociation.StatusCat.Active)
|
||||
return $" In('{StatusCurrent}','{StatusOnHold}')";
|
||||
else if (statusCat == SbmAssociation.StatusCat.DisabledOnly)
|
||||
return $"='{StatusDisabled}'";
|
||||
else if (statusCat == SbmAssociation.StatusCat.NotDeleted)
|
||||
return $"!='{StatusDeleted}'";
|
||||
else if (statusCat == SbmAssociation.StatusCat.DeletedOnly)
|
||||
return $"='{StatusDeleted}'";
|
||||
return "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Association sort columns.
|
||||
public List<String> GetAssociationSortColumns(SbmAssociation.Params prm)
|
||||
{
|
||||
@@ -1927,7 +1742,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
DbQuery qry = new DbQuery(Database.DbmsType);
|
||||
qry.Tables.Add(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Association), aliasAssociation);
|
||||
Association_Db dbAssociation = new Association_Db(DbInfo);
|
||||
qry.Columns.AddRange(dbAssociation.ExistingColumnNames);
|
||||
qry.Columns.AddRange(dbAssociation.ExistingColumnNames.Select(col => $"[{col}]"));
|
||||
qry.Filters.AddRange(GetAssociationQueryFilter(prm));
|
||||
qry.OrderBy.AddRange(GetAssociationSortColumns(prm));
|
||||
// Query data.
|
||||
@@ -1950,7 +1765,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Sys Params found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmSysParam sysParam = null;
|
||||
@@ -77,7 +77,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -158,7 +158,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -191,7 +191,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -202,9 +202,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbSysParam._Cat = (short)sysparam.Category;
|
||||
dbSysParam._Name = sysparam.Name;
|
||||
dbSysParam._Value = sysparam.Value;
|
||||
dbSysParam._AffIdOwner = sysparam.AffiliateIdOwner.ToInt();
|
||||
dbSysParam._AffIdTarget = sysparam.AffiliateIdTarget.ToInt();
|
||||
dbSysParam._AssocId = sysparam.AssociationId.ToInt();
|
||||
dbSysParam._AffIdOwner = SysId.ToInt(sysparam.AffiliateIdOwner);
|
||||
dbSysParam._AffIdTarget = SysId.ToInt(sysparam.AffiliateIdTarget);
|
||||
dbSysParam._AssocId = SysId.ToInt(sysparam.AssociationId);
|
||||
// Common properties.
|
||||
//dbSysParam._Notes = sysparam.Notes;
|
||||
dbSysParam._Status = SacsSystem.GetStatusCode(sysparam.Status);
|
||||
@@ -250,7 +250,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasSysParam;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting prmSysParam column definition.
|
||||
@@ -455,7 +455,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple System Accounts found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmSystemAccount systemAccount = null;
|
||||
@@ -100,7 +100,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -143,7 +143,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -181,7 +181,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -214,7 +214,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -282,7 +282,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasSystemAccount;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting SystemAccount column definition.
|
||||
@@ -504,7 +504,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple System Account Users found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmSystemAccountUser SystemAccountUser = null;
|
||||
@@ -77,7 +77,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -153,7 +153,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -186,7 +186,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -242,7 +242,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasSystemAccountUser;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting SystemAccountUser column definition.
|
||||
@@ -475,7 +475,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple System Users found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmSystemUser SystemUser = null;
|
||||
@@ -80,7 +80,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -161,7 +161,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -194,7 +194,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -259,7 +259,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasSystemUser;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting SystemUser column definition.
|
||||
@@ -485,7 +485,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
else SetErrorState("Failed to retrieve interface console");
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -137,7 +137,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
}
|
||||
SetErrorState(ProcessMgr.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool PopulateAssetDefaultProcesses(SbmAsset asset)
|
||||
{
|
||||
@@ -150,7 +150,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
|
||||
// Store this list of processes against this asset.
|
||||
if (!HasErrorState()) StoreAssetProcesses(asset, itemProcesses);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -210,7 +210,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Store these details.
|
||||
if (!DataItemMgr.StoreFromItemLinks(Sbm.ItemLinkType.ItemPrice, asset.GetItemId(), itemLinks, DbUpdateInfo))
|
||||
SetErrorState("Failed to save asset price item links - " + DataItemMgr.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -226,7 +226,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Assets found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmAsset asset = null;
|
||||
@@ -243,7 +243,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -305,7 +305,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -343,7 +343,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -376,7 +376,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -503,7 +503,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasAsset;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataCategoryId, align);
|
||||
if (dataCategoryId == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -798,7 +798,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
else SetErrorState("Failed to retrieve interface console");
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -96,7 +96,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
ClearErrorState();
|
||||
if (!ProcessMgr.UpdateProcessesForItem(assetCategory.GetItemId(), itemProcesses, dbUpdateInfo))
|
||||
SetErrorState(ProcessMgr.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -112,7 +112,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Asset Categories found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmAssetCategory assetCategory = null;
|
||||
@@ -129,7 +129,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -232,7 +232,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -270,7 +270,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -303,7 +303,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -382,7 +382,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = AliasAssetCategory;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting prmAssetCategory column definition.
|
||||
@@ -596,7 +596,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Asset Processes found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmAssetProcess assetProcess = null;
|
||||
@@ -66,7 +66,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -166,7 +166,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -199,7 +199,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -256,7 +256,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasAssetProcess;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting prmAssetProcess column definition.
|
||||
@@ -428,7 +428,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Vehicles found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmVehicle vehicle = null;
|
||||
@@ -67,7 +67,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -126,7 +126,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -164,7 +164,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -197,7 +197,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -304,7 +304,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasVehicle;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting prm column definition.
|
||||
@@ -647,7 +647,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Vehicle Classes found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmVehicleClass vehicleClass = null;
|
||||
@@ -145,7 +145,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -216,7 +216,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -254,7 +254,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -287,7 +287,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -372,7 +372,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasVehicleClass;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -648,7 +648,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Vehicle Events found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmVehicleEvent vehicleEvent = null;
|
||||
@@ -66,7 +66,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -166,7 +166,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -199,7 +199,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -274,7 +274,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasVehicleEvent;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting prm column definition.
|
||||
@@ -499,7 +499,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Vehicle Features found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmVehicleFeature vehicleFeature = null;
|
||||
@@ -160,7 +160,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -218,7 +218,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -256,7 +256,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -289,7 +289,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -348,7 +348,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasVehicleFeature;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting prm column definition.
|
||||
@@ -548,7 +548,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,8 +199,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
SacsDatabase.AddValuePair(values, SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.Requirement_ProductCode), commodity.Code, true);
|
||||
Database.ExecuteUpdate(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Requirement), values, filter.Concat(" And ", "(", ")"));
|
||||
if (Database.HasErrorState())
|
||||
SetErrorState($"{Database.ErrorStateMessage}.");
|
||||
return !HasErrorState();
|
||||
SetErrorState($"{Database.ErrorStateMessage.TrimEnd('.')}.");
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -279,7 +279,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (itemLinks != null)
|
||||
itemLinks.Clear();
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -315,7 +315,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (commodity.ItemProcesses != null) commodity.ItemProcesses.Clear();
|
||||
// Copy all items from the specified list.
|
||||
commodity.ItemProcesses = itemProcessesNew.Clone();
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool CommitCommodityProcesses(SbmCommodity commodity)
|
||||
{
|
||||
@@ -323,7 +323,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (commodity.ItemProcesses == null) return true;
|
||||
if (!ProcessMgr.StoreItemProcesses(commodity.GetItemId(), commodity.ItemProcesses, DbUpdateInfo))
|
||||
SetErrorState(ProcessMgr.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
public override bool UpdateReferencesToSalesTemplate(SbmCommodity commodity)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (commodity == null) return SetErrorState("item not specified");
|
||||
if (commodity == null) return SetErrorState(Msg_ItemNotSpecified);
|
||||
|
||||
// Build update query to refresh all commodities that refer to this template.
|
||||
List<String> filters = new List<String>();
|
||||
@@ -189,7 +189,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (Database.HasErrorState())
|
||||
SetErrorState($"{Database.ErrorStateMessage}");
|
||||
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -575,7 +575,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Commodities found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmCommodity commodity = null;
|
||||
@@ -592,7 +592,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -649,7 +649,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -687,7 +687,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -720,7 +720,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -1066,7 +1066,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasCommodity;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting Commodity column definition.
|
||||
@@ -2691,7 +2691,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
}
|
||||
else SetErrorState(msg_UnableToManageCommodityCustomers);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
public override bool StoreCommodityCustomersForCommodity(SysId commodityId, List<SbmCommodityCustomer> commodityCustomers)
|
||||
@@ -68,7 +68,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
List<SbmCommodityCustomer> commodityCustomersCopy = commodityCustomers;
|
||||
}
|
||||
else SetErrorState(msg_UnableToManageCommodityCustomers);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
public override bool StoreCommodityCustomersForCustomer(SysId assocIdCustomer, List<SbmCommodityCustomer> commodityCustomers)
|
||||
@@ -81,7 +81,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
List<SbmCommodityCustomer> commodityCustomersCopy = commodityCustomers;
|
||||
}
|
||||
else SetErrorState(msg_UnableToManageCommodityCustomers);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
public override bool Store(SbmCommodityCustomer commodityCustomer)
|
||||
@@ -108,7 +108,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
}
|
||||
else SetErrorState(msg_UnableToManageCommodityCustomers);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
public override bool ClearCustomersForCommodity(SysId commodityId)
|
||||
@@ -126,7 +126,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
}
|
||||
else SetErrorState(msg_UnableToManageCommodityCustomers);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
public override bool ClearCommoditiesForCustomer(SysId assocCustomerId)
|
||||
@@ -143,7 +143,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
}
|
||||
else SetErrorState(msg_UnableToManageCommodityCustomers);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -159,7 +159,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Commodity Customer found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmCommodityCustomer prmCommodityCustomer = null;
|
||||
@@ -176,7 +176,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -227,7 +227,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -265,7 +265,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -298,7 +298,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -365,7 +365,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasCommodityCustomer;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
public override ColumnDfn GetCommodityCustomerColumnDfn(SbmCommodityCustomer.Column columnId, string caption = "", int width = 0)
|
||||
{
|
||||
@@ -614,7 +614,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Commodity Suppliers found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmCommoditySupplier commoditySupplier = null;
|
||||
@@ -69,7 +69,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
foreach (SbmCommoditySupplier commoditySupplier in commoditySuppliers)
|
||||
{
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
public override bool Store(SbmCommoditySupplier commoditySupplier)
|
||||
@@ -118,7 +118,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (Database != null && Database.TableExists(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.CommoditySupplier)))
|
||||
{
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -142,7 +142,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -180,7 +180,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -213,7 +213,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -276,7 +276,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasCommoditySupplier;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
public override ColumnDfn GetCommoditySupplierColumnDfn(SbmCommoditySupplier.Column columnId, string caption = "", int width = 0)
|
||||
{
|
||||
@@ -515,7 +515,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Container found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmContainer container = null;
|
||||
@@ -108,7 +108,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -203,7 +203,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -236,7 +236,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -310,7 +310,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasContainer;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting Container column definition.
|
||||
@@ -602,7 +602,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple ContainerItem found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmContainerItem containerItem = null;
|
||||
@@ -101,7 +101,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -190,7 +190,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -223,7 +223,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -300,7 +300,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasContainerItem;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting ContainerItem column definition.
|
||||
@@ -684,7 +684,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Internal;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.UpdateLog;
|
||||
@@ -16,7 +15,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using static Sarand.BusinessMgr.Net.Standard.Base.App.Sbm.Config;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
@@ -236,7 +234,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (!UpdatePortfolioItem(portfolioItem, DbUpdateInfo))
|
||||
SetErrorState(ErrorStateMessage);
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -297,7 +295,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (Database.HasErrorState())
|
||||
return SetErrorState(Database.ErrorStateMessage);
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -327,7 +325,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Portfolio Items found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmPortfolioItem portfolioItem = null;
|
||||
@@ -344,7 +342,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -390,7 +388,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -431,7 +429,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -507,7 +505,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update the item's sequence.
|
||||
portfolioItem.Sequence = sequencePrev;
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool MoveItemDown(SbmPortfolioItem portfolioItem, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
@@ -563,7 +561,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update the item's sequence.
|
||||
portfolioItem.Sequence = sequenceNext;
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -599,7 +597,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -671,7 +669,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasPortfolioItem;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting PortfolioItem column definition.
|
||||
@@ -986,7 +984,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Item Batches found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmItemBatch itemBatch = null;
|
||||
@@ -63,7 +63,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -163,7 +163,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -196,7 +196,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -255,7 +255,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasItemBatch;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -443,7 +443,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
SATRACE("\nSapDataItemMgr_Odbc::DoDbCleanup\n\tParent items found: " + String(iParentItemsFound) + "\n\tRows modified: " + String(iRowsModified) + "\n\n");
|
||||
//---------------------------------------------------------------
|
||||
}*/
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -145,7 +145,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
return SetErrorState($"Failed to store associated items - {DataItemMgr.ErrorStateMessage}");
|
||||
}
|
||||
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Item Links found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmItemLink itemLink = null;
|
||||
@@ -51,7 +51,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -161,7 +161,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -222,7 +222,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
else SetErrorState("failed to add link");
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
public override bool StoreToItemLinks(Sbm.ItemLinkType itemLinkType, ItemId itemIdTo, List<SbmItemLink> itemLinks, DbUpdateInfo dbUpdateInfo)
|
||||
@@ -274,7 +274,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
else SetErrorState("failed to add link");
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -307,7 +307,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -370,7 +370,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasItemLink;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting ItemLink column definition.
|
||||
@@ -567,7 +567,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Prices found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmPrice price = null;
|
||||
@@ -63,7 +63,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -155,7 +155,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -188,7 +188,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -255,7 +255,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasPrice;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataCategoryId, align);
|
||||
if (dataCategoryId == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -505,7 +505,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Price Sets found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmPriceSet priceSet = null;
|
||||
@@ -80,7 +80,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -138,7 +138,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -176,7 +176,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -209,7 +209,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -269,7 +269,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasPriceSet;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataCategoryId, align);
|
||||
if (dataCategoryId == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -477,7 +477,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using static Sarand.BusinessMgr.Net.Standard.Base.Bus.SbmProcess;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
@@ -43,13 +42,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (!SysId.IsValid(processId)) return false;
|
||||
SaItemData.Params prmItemData = new SaItemData.Params();
|
||||
prmItemData.ItemIdsIncluded.Add(new SbmItemId(Sbm.ItemType.Process, processId));
|
||||
prmItemData.DataTypesIncluded.Add(GetItemDataCodeForProcessCostCode(SbmProcessCostCode.Fixed_Unit));
|
||||
prmItemData.DataTypesIncluded.Add(GetItemDataCodeForProcessCostCode(SbmProcessCostCode.Fixed_Job));
|
||||
prmItemData.DataTypesIncluded.Add(GetItemDataCodeForProcessCostCode(SbmProcessCostCode.Labour_Unit));
|
||||
prmItemData.DataTypesIncluded.Add(GetItemDataCodeForProcessCostCode(SbmProcessCostCode.Labour_Job));
|
||||
prmItemData.DataTypesIncluded.Add(GetItemDataCodeForProcessCostCode(SbmProcess.SbmProcessCostCode.Fixed_Unit));
|
||||
prmItemData.DataTypesIncluded.Add(GetItemDataCodeForProcessCostCode(SbmProcess.SbmProcessCostCode.Fixed_Job));
|
||||
prmItemData.DataTypesIncluded.Add(GetItemDataCodeForProcessCostCode(SbmProcess.SbmProcessCostCode.Labour_Unit));
|
||||
prmItemData.DataTypesIncluded.Add(GetItemDataCodeForProcessCostCode(SbmProcess.SbmProcessCostCode.Labour_Job));
|
||||
return ItemDataConsole.ItemDataExists(prmItemData);
|
||||
}
|
||||
public override bool ProcessHasCostCodes(SysId processId, SbmProcessCostCode processCostCode)
|
||||
public override bool ProcessHasCostCodes(SysId processId, SbmProcess.SbmProcessCostCode processCostCode)
|
||||
{
|
||||
ClearErrorState();
|
||||
// Identify process code type code.
|
||||
@@ -65,7 +64,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
private const String processCodeDelim = ",";
|
||||
public override List<String> GetProcessCostCodes(SysId processId, SbmProcessCostCode processCostCode)
|
||||
public override List<String> GetProcessCostCodes(SysId processId, SbmProcess.SbmProcessCostCode processCostCode)
|
||||
{
|
||||
List<String> costCodes = new List<String>();
|
||||
ClearErrorState();
|
||||
@@ -87,7 +86,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
return costCodes;
|
||||
}
|
||||
public override bool StoreProcessCostCodes(SbmProcess process, SbmProcessCostCode processCostCode, List<String> costCodes, DbUpdateInfo dbUpdateInfo)
|
||||
public override bool StoreProcessCostCodes(SbmProcess process, SbmProcess.SbmProcessCostCode processCostCode, List<String> costCodes, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!costCodes.Any()) return ClearProcessCostCodes(process, processCostCode, dbUpdateInfo);
|
||||
@@ -117,9 +116,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
SetErrorState(ItemDataConsole.ErrorStateMessage);
|
||||
}
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool ClearProcessCostCodes(SbmProcess process, SbmProcessCostCode processCostCode, DbUpdateInfo dbUpdateInfo)
|
||||
public override bool ClearProcessCostCodes(SbmProcess process, SbmProcess.SbmProcessCostCode processCostCode, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
// Identify process code type code.
|
||||
@@ -129,7 +128,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (!ItemDataConsole.ClearItemData(process.GetItemId(), itemDataTypeCode, dbUpdateInfo))
|
||||
SetErrorState(ItemDataConsole.ErrorStateMessage);
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool ClearAllProcessCostCodes(SbmProcess process, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
@@ -137,7 +136,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (process == null || !SysId.IsValid(process.Id)) return false;
|
||||
if (!ItemDataConsole.ClearItemData(process.GetItemId(), dbUpdateInfo))
|
||||
SetErrorState(ItemDataConsole.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -161,11 +160,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
public override bool ClearProcessAssociatedData(SbmProcess process, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (process == null || !SysId.IsValid(process.Id)) return SetErrorState("item not specified");
|
||||
if (process == null || !SysId.IsValid(process.Id)) return SetErrorState(Msg_ItemNotSpecified);
|
||||
// Clear Item data records.
|
||||
if (!ItemDataConsole.ClearItemData(process.GetItemId(), dbUpdateInfo))
|
||||
SetErrorState(ItemDataConsole.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -223,7 +222,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Asset Processes found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmProcess prmProcess = null;
|
||||
@@ -240,7 +239,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -309,7 +308,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -347,7 +346,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -380,7 +379,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -437,7 +436,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasProcess;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting Process column definition.
|
||||
@@ -642,7 +641,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Commodity Customer found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmLocation location = null;
|
||||
@@ -93,7 +93,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -188,7 +188,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -221,7 +221,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -277,7 +277,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasLocation;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -498,7 +498,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
SetErrorState($"{Database.ErrorStateMessage}");
|
||||
|
||||
// ToDo CalculateStockLevels(commodityIds); > in Stock-MgrDbas
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
public override bool ClearMovementsForSourceItem(Sbm.ItemType itemType, SysId itemId)
|
||||
@@ -113,7 +113,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
Database.ExecuteDelete(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Movement), filtersSourceItem.Concat(" AND ", "(", ")"));
|
||||
|
||||
// ToDo CalculateStockLevels(commodityIds); > in Stock-MgrDbas
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
// Check for references to source item.
|
||||
@@ -139,7 +139,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Movement found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmMovement movement = null;
|
||||
@@ -156,7 +156,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -213,7 +213,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -251,7 +251,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -284,7 +284,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -361,7 +361,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasMovement;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -833,7 +833,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,11 @@ using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using static Sarand.Net.Standard.Dbas.Base.DatabaseDefinitionGenerator;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
@@ -49,7 +47,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple StockLevel found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmStockLevel stockLevel = null;
|
||||
@@ -66,7 +64,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -123,7 +121,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -161,7 +159,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -194,7 +192,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -263,7 +261,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasStockLevel;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -566,7 +564,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ using Sarand.Net.Standard.Dbas.Base;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static Sarand.BusinessMgr.Net.Standard.Base.App.Sbm.Config;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
@@ -322,7 +321,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -322,7 +322,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Constituent found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmConstituent prmituent = null;
|
||||
@@ -339,7 +339,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -401,7 +401,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -439,7 +439,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -472,7 +472,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -601,7 +601,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasConstituent;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -963,7 +963,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
public override bool ClearRequirementDependentData(SbmRequirement requirement, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (requirement == null||!SysId.IsValid(requirement.Id)) return SetErrorState(Msg_InvalidItemSpecified);
|
||||
if (requirement == null || !SysId.IsValid(requirement.Id)) return SetErrorState(Msg_InvalidItemSpecified);
|
||||
// Clear any references to this requirement from other requirements.
|
||||
if (!HasErrorState())
|
||||
ClearRequirementAssociatedRequirements(requirement, dbUpdateInfo);
|
||||
@@ -237,27 +237,27 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
SetErrorState(msg);
|
||||
}
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool ClearRequirementAssociatedRequirements(SbmRequirement requirement, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
// Clear ReqntIdSource for any requirements that reference this one.
|
||||
ClearErrorState();
|
||||
if (requirement == null||!SysId.IsValid(requirement.Id)) return SetErrorState(Msg_InvalidItemSpecified);
|
||||
if (requirement == null || !SysId.IsValid(requirement.Id)) return SetErrorState(Msg_InvalidItemSpecified);
|
||||
String filter = $"{SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.Requirement_ReqntIdSource)}={SysId.ToLong(requirement.Id)}";
|
||||
List<StringPair> values = new List<StringPair>();
|
||||
SacsDatabase.AddValuePair(values, SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.Requirement_ReqntIdSource), "0", false);
|
||||
Database.ExecuteUpdate(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Requirement), values, filter);
|
||||
if (Database.HasErrorState())
|
||||
SetErrorState("Failed to clear requirement references");
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public override bool CalculateTotal(SbmRequirement.Data requirement)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (requirement == null) return SetErrorState("item not specified");
|
||||
if (requirement == null) return SetErrorState(Msg_ItemNotSpecified);
|
||||
int decimalsCurrency = 2;
|
||||
|
||||
// Calculate intermediate amounts.
|
||||
@@ -287,7 +287,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
requirement.TaxRate = rateTax;
|
||||
requirement.AmountTax = Math.Round(amountTax, decimalsCurrency);
|
||||
requirement.AmountTot = Math.Round(amountTot, decimalsCurrency);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -397,7 +397,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
ClearErrorState();
|
||||
// Do not attempt any updates unless the list has been populated.
|
||||
if (requirement == null || !SysId.IsValid(requirement.Id)||requirement.Processes == null) return true;
|
||||
if (requirement == null || !SysId.IsValid(requirement.Id) || requirement.Processes == null) return true;
|
||||
|
||||
// Make a copy of the process list so that we can track those that have been updated.
|
||||
List<SbmItemProcess> itemProcesses = new List<SbmItemProcess>(requirement.Processes);
|
||||
@@ -449,7 +449,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
else SetErrorState("failed to create constituent - " + TransactionMgr.ErrorState);
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
// Item Process - Constituent Interface.
|
||||
@@ -471,7 +471,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
public override bool SetTaxCode(SbmRequirement requirement, DateTime effective)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (requirement == null) return SetErrorState("item not specified");
|
||||
if (requirement == null) return SetErrorState(Msg_ItemNotSpecified);
|
||||
if (!effective.IsValid()) return SetErrorState("invalid effective date specified");
|
||||
|
||||
// Locate the specified tax code in the list:
|
||||
@@ -492,7 +492,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
if (taxCodeApplicable != null)
|
||||
requirement.TaxCodeId = taxCodeApplicable.Id;
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -517,7 +517,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Requirements found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmRequirement prmRequirement = null;
|
||||
@@ -534,7 +534,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -596,7 +596,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -634,7 +634,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -666,7 +666,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -854,7 +854,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasRequirement;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -2307,7 +2307,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
ChangeTransactionsAssociation(transaction, transaction.AssociationId); // To reset changes.
|
||||
}
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -190,7 +190,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
ClearErrorState();
|
||||
if (transaction == null || !SysId.IsValid(transaction.Id)) return false;
|
||||
if (!HasErrorState()) CommitTransactionPayments(transaction, dbUpdateInfo);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool TransactionHasPayments(SysId transactionId)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,6 @@ using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Interfaces;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.Data;
|
||||
@@ -16,8 +15,6 @@ using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Transactions;
|
||||
using static Sarand.BusinessMgr.Net.Standard.Base.App.Sbm;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
@@ -158,7 +155,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
// Clean-up:
|
||||
requirementsNotUpdated.Clear();
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
public override bool RefreshAssociatedData(SbmTransaction transaction, List<SbmRequirement> requirements, DbUpdateInfo dbUpdateInfo)
|
||||
@@ -184,7 +181,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
UpdateTransaction(transaction, dbUpdateInfo);
|
||||
else SetErrorState(transaction.ErrorStateMessage);
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
// Refresh associated transactions (eg. stock allocations on associated sames order when dispatch updated and stock actioned by dispatch).
|
||||
@@ -226,7 +223,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
}
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -481,7 +478,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (Database.HasErrorState())
|
||||
SetErrorState($"{Database.ErrorStateMessage}");
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -497,7 +494,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple Transactions found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SbmTransaction prmTransaction = null;
|
||||
@@ -514,7 +511,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -607,7 +604,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -645,7 +642,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -655,7 +652,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
ClearErrorState();
|
||||
if (!base.TransactionCanBeDeleted(transaction)) return false;
|
||||
|
||||
if (transaction == null) return SetErrorState("item not specified");
|
||||
if (transaction == null) return SetErrorState(Msg_ItemNotSpecified);
|
||||
|
||||
// Associated transactions.
|
||||
if (TransactionIsReferencedByOtherTransactions(transaction.Id)) return SetErrorState("linked transactions are present");
|
||||
@@ -706,7 +703,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -895,7 +892,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
alias = aliasTransaction;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SbmDbDfn.GetColumnName(dbCol, false), SbmDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SbmDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SbmDbDfn.GetColTextLen(dbCol);
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -1366,8 +1363,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
String colTransaction_RefInt = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Transaction_RefInt, tableAlias);
|
||||
String colTransaction_RefExt = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Transaction_RefExt, tableAlias);
|
||||
String colTransaction_DescBrief = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Transaction_DescBrief, tableAlias);
|
||||
String colTransaction_StatusCat = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Transaction_StatusCat, tableAlias);
|
||||
String colTransaction_Status = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Transaction_Status, tableAlias);
|
||||
String colTransaction_Notes = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Transaction_Notes, tableAlias);
|
||||
|
||||
//---------------------------------------------------------------
|
||||
@@ -1565,16 +1560,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
filter.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Transaction_LocationIdStock, tableAlias) + "=" + SysId.ToString(prm.LocationIdStock));
|
||||
|
||||
// Transaction Status.
|
||||
if (prm.StatusCat == SbmTransaction.StatusCat.NotDeleted)
|
||||
filter.Add(colTransaction_Status + "<>'" + StatusDeleted + "'");
|
||||
else if (prm.StatusCat == SbmTransaction.StatusCat.Completed)
|
||||
filter.Add(colTransaction_Status + "='" + StatusCompleted + "'");
|
||||
else if (prm.StatusCat == SbmTransaction.StatusCat.NotClosed)
|
||||
filter.Add(colTransaction_StatusCat + "<>'" + TransactionStatusCats.GetCodeForType(SbmTransaction.StatusCat.Closed) + "'");
|
||||
else if (prm.StatusCat == SbmTransaction.StatusCat.NotCancelled)
|
||||
filter.Add(colTransaction_Status + "<>'" + StatusCancelled + "'");
|
||||
else if (!StringUtil.IsEmpty(TransactionStatusCats.GetCodeForType(prm.StatusCat)))
|
||||
filter.Add(colTransaction_StatusCat + "='" + TransactionStatusCats.GetCodeForType(prm.StatusCat) + "'");
|
||||
String statusCatCondition = GetTransactionStatusCatFilter(prm.StatusCat, tableAlias, TransactionStatusCats);
|
||||
if (!StringUtil.IsBlank(statusCatCondition))
|
||||
filter.Add(statusCatCondition);
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Raised date.
|
||||
@@ -1776,6 +1764,24 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
return filter;
|
||||
}
|
||||
|
||||
internal static String GetTransactionStatusCatFilter(SbmTransaction.StatusCat statusCat, String aliasTransaction, List<TypeCodeDesc> transactionStatusCats)
|
||||
{
|
||||
String colTransaction_StatusCat = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Transaction_StatusCat, aliasTransaction);
|
||||
String colTransaction_Status = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Transaction_Status, aliasTransaction);
|
||||
|
||||
if (statusCat == SbmTransaction.StatusCat.NotDeleted)
|
||||
return $"{colTransaction_Status}<>'{StatusDeleted}'";
|
||||
else if (statusCat == SbmTransaction.StatusCat.Completed)
|
||||
return $"{colTransaction_Status}='{StatusCompleted}'";
|
||||
else if (statusCat == SbmTransaction.StatusCat.NotClosed)
|
||||
return $"{colTransaction_StatusCat}<>'{transactionStatusCats.GetCodeForType(SbmTransaction.StatusCat.Closed)}'";
|
||||
else if (statusCat == SbmTransaction.StatusCat.NotCancelled)
|
||||
return $"{colTransaction_Status}<>'{StatusCancelled}'";
|
||||
else if (!StringUtil.IsBlank(transactionStatusCats.GetCodeForType(statusCat)))
|
||||
return $"{colTransaction_StatusCat}='{transactionStatusCats.GetCodeForType(statusCat)}'";
|
||||
return "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Sort columns.
|
||||
public List<String> GetTransactionSortColumns(SbmTransaction.Params prm)
|
||||
@@ -1857,7 +1863,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
@@ -14,7 +13,6 @@ using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static Sarand.BusinessMgr.Net.Standard.Base.App.Sbm;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user