Portal password request - in progress.
This commit is contained in:
+11
-5
@@ -8,7 +8,9 @@ using System.Text;
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmSessionConfig
|
||||
// BusinessMgr Application Configuration.
|
||||
//=======================================================================
|
||||
public class SbmAppConfig
|
||||
{
|
||||
//---------------------------------------------------------------
|
||||
// Data members.
|
||||
@@ -16,7 +18,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmSessionConfig(String context, ConfigurationSection configSection, SbmSessionConfig defaultConfig)
|
||||
public SbmAppConfig(String context, ConfigurationSection configSection, SbmAppConfig defaultConfig)
|
||||
{
|
||||
Context = context;
|
||||
populateDefaults(defaultConfig);
|
||||
@@ -24,7 +26,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
private void populateDefaults(SbmSessionConfig defaultConfig)
|
||||
private void populateDefaults(SbmAppConfig defaultConfig)
|
||||
{
|
||||
if (defaultConfig == null) return;
|
||||
Security.Password.MinLength = defaultConfig.Security.Password.MinLength;
|
||||
@@ -87,8 +89,10 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
{
|
||||
Logging.RootFolder = StringUtil.OnEmpty(logging["RootFolder"], Logging.RootFolder);
|
||||
}
|
||||
// Database.
|
||||
extractDatabaseConfig(BusMgrDatabase, configSection.GetSection("CoreDatabase"));
|
||||
// Databases.
|
||||
extractDatabaseConfig(ControlDatabase, configSection.GetSection("ControlDatabase"));
|
||||
extractDatabaseConfig(BusMgrDatabase, configSection.GetSection("BusMgrDatabase"));
|
||||
extractDatabaseConfig(TemplateDatabase, configSection.GetSection("TemplateDatabase"));
|
||||
// Variants.
|
||||
foreach (ConfigurationSection variantSection in configSection.GetSection("Variants").GetChildren())
|
||||
{
|
||||
@@ -179,7 +183,9 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
public String User { get; internal set; }
|
||||
public String Password { get; internal set; }
|
||||
}
|
||||
public DatabaseConfig ControlDatabase { get; } = new DatabaseConfig();
|
||||
public DatabaseConfig BusMgrDatabase { get; } = new DatabaseConfig();
|
||||
public DatabaseConfig TemplateDatabase { get; } = new DatabaseConfig();
|
||||
// Documents.
|
||||
public class DocumentsConfig
|
||||
{
|
||||
@@ -5,7 +5,6 @@ using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Diary;
|
||||
using Sarand.Net.Standard.Base.Interfaces;
|
||||
using Sarand.Net.Standard.Base.IO;
|
||||
@@ -16,7 +15,6 @@ using Sarand.Net.Standard.Base.ReferenceData;
|
||||
using Sarand.Net.Standard.Base.Security;
|
||||
using Sarand.Net.Standard.Base.UpdateLog;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Dbas.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -36,24 +34,23 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
// Protected construction.
|
||||
protected SbmApplication_Web() : base(new PropertySet())
|
||||
{
|
||||
WebApp = this;
|
||||
SbmGlobals_Web.Application = this;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public override SbmSystem System { get { return System_Web; } }
|
||||
public SbmSystem_Web System_Web { get; protected set; }
|
||||
public static SbmApplication_Web WebApp { get; private set; }
|
||||
// Application instance.
|
||||
public override Sbm.InstanceType InstanceType { get { return instanceType; } }
|
||||
public override String EnvironmentName { get { return environmentName; } }
|
||||
public bool Development { get; protected set; }
|
||||
public String LoggingRootFolder { get; protected set; } = "";
|
||||
// Application components.
|
||||
public abstract SbmAppConfig AppConfig { get; }
|
||||
public abstract String SessionCookieName { get; }
|
||||
public virtual SbmSessionContext SessionContext { get; protected set; }
|
||||
public abstract SbmSessionConfig SessionConfig { get; }
|
||||
public override IDatabaseInfo CreateBusMgrDbInfo(SbmSessionContext sessionContext) { return new DbDataItem.DatabaseInfo(GetBusMgrDatabase(sessionContext)); }
|
||||
public abstract List<ushort> GetSessionContextIdxs();
|
||||
public abstract SbmSessionContext GetSessionContext(ushort index);
|
||||
// Configuration.
|
||||
public IConfiguration Configuration { get; protected set; }
|
||||
public IConfiguration SbmConfiguration { get; protected set; }
|
||||
@@ -66,14 +63,15 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
List<StringPair> applicationParams = new List<StringPair>();
|
||||
applicationParams.Add("Host", SbmSystem.ComputerName);
|
||||
applicationParams.Add("Version", Sbm.Version.GetFullVersion());
|
||||
applicationParams.Add("Instance", InstanceType.ToString() + (!StringUtil.IsEmpty(SessionConfig.Instance) ? " [" + SessionConfig.Instance + "]" : ""));
|
||||
applicationParams.Add("Instance", InstanceType.ToString() + (!StringUtil.IsEmpty(AppConfig.Instance) ? " [" + AppConfig.Instance + "]" : ""));
|
||||
applicationParams.Add("Configuration", SbmSystem.DebugMode ? "Debug" : "Release");
|
||||
applicationParams.Add("Environment", EnvironmentName);
|
||||
applicationParams.Add("Database", SessionConfig.BusMgrDatabase.Location);
|
||||
applicationParams.Add("Control database", AppConfig.ControlDatabase.Location);
|
||||
applicationParams.Add("BusMgr database", AppConfig.BusMgrDatabase.Location);
|
||||
applicationParams.Add("Application root", SbmSystem.ApplicationFolder);
|
||||
if (!StringUtil.IsEmpty(SessionConfig.Documents.RootFolder))
|
||||
applicationParams.Add("Documents root", SessionConfig.Documents.RootFolder);
|
||||
applicationParams.Add("Email context", SessionConfig.Email.Context + (!StringUtil.IsEmpty(EmailConfig.SMTP.Server) ? " [" + EmailConfig.SMTP.Server + "]" : ""));
|
||||
if (!StringUtil.IsEmpty(AppConfig.Documents.RootFolder))
|
||||
applicationParams.Add("Documents root", AppConfig.Documents.RootFolder);
|
||||
applicationParams.Add("Email context", AppConfig.Email.Context + (!StringUtil.IsEmpty(EmailConfig.SMTP.Server) ? " [" + EmailConfig.SMTP.Server + "]" : ""));
|
||||
SaLogger.Info(fn + " Application start." + applicationParams.Select(item => StringUtil.PadRight(item.Item1 + ":", 20, ' ') + item.Item2).Concat("", "\n\t"), true);
|
||||
}
|
||||
|
||||
@@ -107,7 +105,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
}
|
||||
public override SaSecurityConsole CreateSecurityConsole(SbmUserContext userContext)
|
||||
{
|
||||
return null;
|
||||
return new SbmSecurityConsole_Web(userContext, GetBusMgrDatabase(userContext.SessionContext));
|
||||
}
|
||||
public override SaCodeTypeConsole CreateCodeTypeConsole(SbmUserContext userContext)
|
||||
{
|
||||
@@ -135,7 +133,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
}
|
||||
public override SaUpdateLogConsole CreateUpdateLogConsole(SbmUserContext userContext)
|
||||
{
|
||||
return null;
|
||||
return new SbmUpdateLogConsole_Web(userContext, GetBusMgrDatabase(userContext.SessionContext));
|
||||
}
|
||||
public override SbmEmailConsole CreateEmailConsole(SbmUserContext userContext)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Diary;
|
||||
using Sarand.Net.Standard.Base.Interfaces;
|
||||
using Sarand.Net.Standard.Base.ItemData;
|
||||
using Sarand.Net.Standard.Base.ItemDocs;
|
||||
using Sarand.Net.Standard.Base.ItemOptions;
|
||||
using Sarand.Net.Standard.Base.ReferenceData;
|
||||
using Sarand.Net.Standard.Base.Security;
|
||||
using Sarand.Net.Standard.Base.UpdateLog;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
{
|
||||
//=======================================================================
|
||||
public static class SbmGlobals_Web
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// System.
|
||||
public static SbmSystem_Web System { get; set; } = null;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Application.
|
||||
public static SbmApplication_Web Application { get; set; } = null;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Consoles;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmSecurityConsole_Web : SbmSecurityConsole_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmSecurityConsole_Web(SbmUserContext userContext, ISacsDatabase database) : base(userContext, database)
|
||||
{
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
protected override ShowUserLoginFormFunction ShowUserLoginFormFn => throw new NotImplementedException();
|
||||
protected override ShowManageSecurityDialogFunction ShowManageSecurityDialogFn => throw new NotImplementedException();
|
||||
public override bool OnSecurityGroupModified(SysId userId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public override bool OnUserModified(SysId userId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
protected override bool OnLogin(SysId userId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
protected override void OnLogout()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Consoles;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmUpdateLogConsole_Web : SbmUpdateLogConsole_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmUpdateLogConsole_Web(SbmUserContext userContext, ISacsDatabase database) : base(userContext, database)
|
||||
{
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
protected override ShowUpdateLogDialogFunction ShowUpdateLogDialogFn => throw new NotImplementedException();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -67,9 +67,9 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public bool DebugMode { get; } = SacsSystem.DebugMode;
|
||||
protected SbmApplication_Web App { get { return SbmApplication_Web.WebApp; } }
|
||||
public SbmSessionConfig SessionConfig { get { return App.SessionConfig; } }
|
||||
public SbmSessionContext SessionContext { get { return App.SessionContext; } }
|
||||
protected SbmApplication_Web App { get { return SbmGlobals_Web.Application; } }
|
||||
public SbmAppConfig AppConfig { get { return App.AppConfig; } }
|
||||
public SbmSessionContext SessionContext { get { return UserContext?.SessionContext ?? null; } }
|
||||
public SbmUserContext UserContext { get { return SessionData.UserContext; } }
|
||||
protected SbmLocaliser Localiser { get; }
|
||||
/// <summary>
|
||||
@@ -177,10 +177,10 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
|
||||
if (StoreSessionData)
|
||||
{
|
||||
String sessionDataJson = JsonConvert.SerializeObject(SessionData);
|
||||
HttpContext.Session.Set(SessionStorage.SessionKey_SessionConfig, SessionStorage.sessionDataEncoding.GetBytes(sessionDataJson));
|
||||
HttpContext.Session.Set(SessionStorage.SessionKey_SessionData, SessionStorage.sessionDataEncoding.GetBytes(sessionDataJson));
|
||||
}
|
||||
}
|
||||
else HttpContext.Session.Remove(SessionStorage.SessionKey_SessionConfig);
|
||||
else HttpContext.Session.Remove(SessionStorage.SessionKey_SessionData);
|
||||
|
||||
// Response headers.
|
||||
if (baseModel != null && baseModel.ProhibitCache)
|
||||
@@ -306,7 +306,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
|
||||
public class SessionStorage
|
||||
{
|
||||
public SbmSessionData_Web SessionData { get; set; }
|
||||
public static String SessionKey_SessionConfig { get; } = "SbmSessionData";
|
||||
public static String SessionKey_SessionData { get; } = "SbmSessionData";
|
||||
public static Encoding sessionDataEncoding { get; } = Encoding.UTF8;
|
||||
//JSON Serialisation.
|
||||
public class SbmSessionDataContractResolver : DefaultContractResolver
|
||||
@@ -347,7 +347,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
|
||||
if (sessionStorage.SessionData == null)
|
||||
{
|
||||
byte[] sessionDataBytes = null;
|
||||
HttpContext.Session.TryGetValue(SessionStorage.SessionKey_SessionConfig, out sessionDataBytes);
|
||||
HttpContext.Session.TryGetValue(SessionStorage.SessionKey_SessionData, out sessionDataBytes);
|
||||
if (sessionDataBytes != null)
|
||||
{
|
||||
String sessionDataJson = SessionStorage.sessionDataEncoding.GetString(sessionDataBytes);
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.Helpers
|
||||
{
|
||||
//=======================================================================
|
||||
public static class SbmAppConfigHelper
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
public static Dictionary<String, SbmAppConfig> ExtractAppConfigs(IConfigurationSection appConfigsSection)
|
||||
{
|
||||
// NB The set of configurations will only allow one per context.
|
||||
// Only the last configuration found for each context will be stored (NB usually only one of each apart from 'Defaults').
|
||||
Dictionary<String, SbmAppConfig> appConfigs = new Dictionary<String, SbmAppConfig>();
|
||||
|
||||
// Start the list with a default 'Defaults' configuration - values set to application defaults (defined in Sbm).
|
||||
// NB This can be overridden in each level of configuration.
|
||||
// Settings from the 'Defaults' configuration provide values where they are missing from other configurations.
|
||||
// NB Coverage may not be 100% - just where it's proven needed.
|
||||
SbmAppConfig defaultsAppConfig = new SbmAppConfig(Sbm.Config.Context_Defaults, null, null);
|
||||
appConfigs.Add(defaultsAppConfig.Context, defaultsAppConfig);
|
||||
|
||||
// Load session configurations.
|
||||
foreach (ConfigurationSection appConfigSection in appConfigsSection.GetChildren())
|
||||
{
|
||||
if (StringUtil.IsEmpty(appConfigSection.Key)) continue;
|
||||
|
||||
// Extract the configuration, supplying current 'Defaults' to supply missing values, and add to the list.
|
||||
SbmAppConfig appConfig = new SbmAppConfig(appConfigSection.Key, appConfigSection, defaultsAppConfig);
|
||||
appConfigs.Remove(appConfigSection.Key);
|
||||
appConfigs.Add(appConfigSection.Key, appConfig);
|
||||
|
||||
// Replace the 'Defaults' configuration if this one matches the context.
|
||||
if (appConfig.Context.EqualsCI(Sbm.Config.Context_Defaults))
|
||||
defaultsAppConfig = appConfig;
|
||||
}
|
||||
return appConfigs;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
public static class AppConfigList
|
||||
{
|
||||
public static SbmAppConfig getConfigForApplication(this List<SbmAppConfig> appConfigs)
|
||||
{
|
||||
SbmAppConfig defaultsAppConfig = new SbmAppConfig("", null, null);
|
||||
SbmApplication app = SbmGlobals_Web.Application;
|
||||
if (app != null)
|
||||
{
|
||||
foreach (SbmAppConfig appConfig in appConfigs)
|
||||
{
|
||||
if (appConfig.Environments.ContainsCI(app.EnvironmentName))
|
||||
return appConfig;
|
||||
if (appConfig.Context.EqualsCI(Sbm.Config.Context_Defaults))
|
||||
defaultsAppConfig = appConfig;
|
||||
}
|
||||
}
|
||||
return defaultsAppConfig;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -75,13 +75,13 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Helpers
|
||||
//=======================================================================
|
||||
public static class EmailConfigList
|
||||
{
|
||||
public static SbmEmailConfig getConfigForSession(this List<SbmEmailConfig> emailConfigs, SbmSessionConfig sessionConfig)
|
||||
public static SbmEmailConfig getConfigForSession(this List<SbmEmailConfig> emailConfigs, SbmAppConfig appConfig)
|
||||
{
|
||||
if (sessionConfig != null && !StringUtil.IsEmpty(sessionConfig.Email.Context))
|
||||
if (appConfig != null && !StringUtil.IsEmpty(appConfig.Email.Context))
|
||||
{
|
||||
foreach (SbmEmailConfig emailConfig in emailConfigs)
|
||||
{
|
||||
if (emailConfig.Context.EqualsCI(sessionConfig.Email.Context))
|
||||
if (emailConfig.Context.EqualsCI(appConfig.Email.Context))
|
||||
return emailConfig;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.Helpers
|
||||
{
|
||||
//=======================================================================
|
||||
public static class SbmSessionConfigHelper
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
public static Dictionary<String, SbmSessionConfig> ExtractSessionConfigs(IConfigurationSection sessionConfigsSection)
|
||||
{
|
||||
// NB The set of configurations will only allow one per context.
|
||||
// Only the last configuration found for each context will be stored (NB usually only one of each apart from 'Defaults').
|
||||
Dictionary<String, SbmSessionConfig> sessionConfigs = new Dictionary<String, SbmSessionConfig>();
|
||||
|
||||
// Start the list with a default 'Defaults' configuration - values set to application defaults (defined in Sbm).
|
||||
// NB This can be overridden in each level of configuration.
|
||||
// Settings from the 'Defaults' configuration provide values where they are missing from other configurations.
|
||||
// NB Coverage may not be 100% - just where it's proven needed.
|
||||
SbmSessionConfig defaultsSessionConfig = new SbmSessionConfig(Sbm.Config.Context_Defaults, null, null);
|
||||
sessionConfigs.Add(defaultsSessionConfig.Context, defaultsSessionConfig);
|
||||
|
||||
// Load session configurations.
|
||||
foreach (ConfigurationSection sessionConfigSection in sessionConfigsSection.GetChildren())
|
||||
{
|
||||
if (StringUtil.IsEmpty(sessionConfigSection.Key)) continue;
|
||||
|
||||
// Extract the configuration, supplying current 'Defaults' to supply missing values, and add to the list.
|
||||
SbmSessionConfig sessionConfig = new SbmSessionConfig(sessionConfigSection.Key, sessionConfigSection, defaultsSessionConfig);
|
||||
sessionConfigs.Remove(sessionConfigSection.Key);
|
||||
sessionConfigs.Add(sessionConfigSection.Key, sessionConfig);
|
||||
|
||||
// Replace the 'Defaults' configuration if this one matches the context.
|
||||
if (sessionConfig.Context.EqualsCI(Sbm.Config.Context_Defaults))
|
||||
defaultsSessionConfig = sessionConfig;
|
||||
}
|
||||
return sessionConfigs;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
public static class SessionConfigList
|
||||
{
|
||||
public static SbmSessionConfig getConfigForApplication(this List<SbmSessionConfig> sessionConfigs)
|
||||
{
|
||||
SbmSessionConfig defaultsSessionConfig = new SbmSessionConfig("", null, null);
|
||||
SbmApplication app = SbmGlobals.Application;
|
||||
if (app != null)
|
||||
{
|
||||
foreach (SbmSessionConfig sessionConfig in sessionConfigs)
|
||||
{
|
||||
if (sessionConfig.Environments.ContainsCI(app.EnvironmentName))
|
||||
return sessionConfig;
|
||||
if (sessionConfig.Context.EqualsCI(Sbm.Config.Context_Defaults))
|
||||
defaultsSessionConfig = sessionConfig;
|
||||
}
|
||||
}
|
||||
return defaultsSessionConfig;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using Sarand.BusinessMgr.Net.Core.Web.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Security;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Dbas.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.Helpers
|
||||
{
|
||||
//=======================================================================
|
||||
// Session Context utility functions.
|
||||
//=======================================================================
|
||||
public static class SbmSessionContextHelper_Web
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static String className = typeof(SbmSessionContextHelper_Web).Name;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Session Contexts.
|
||||
//-------------------------------------------------------------------
|
||||
public static SbmSessionContext GetSessionContext (ushort idx)
|
||||
{
|
||||
SbmApplication_Web app = SbmGlobals_Web.Application;
|
||||
return app.GetSessionContext(idx);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Session Contexts for User Email Address
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Identify the session context that corresponds with the BusinessMgr
|
||||
/// database for the specified user by email address.
|
||||
/// </summary>
|
||||
public static List<ushort> GetSessionContextIdxsForUsersBusMgrDatabase(String emailAddress)
|
||||
{
|
||||
String fn = className + ".GetSessionContextIdxForUsersBusMgrDatabase";
|
||||
String alias_SecurityItem = "SecItm";
|
||||
String alias_Affiliate = "Affil";
|
||||
List<ushort> sessionContextIdxs = new List<ushort>();
|
||||
if (StringUtil.IsEmpty(emailAddress)) return sessionContextIdxs;
|
||||
|
||||
// Get the session context indices defined by the application.
|
||||
SbmApplication_Web app = SbmGlobals_Web.Application;
|
||||
foreach (ushort sessionContextIdx in app.GetSessionContextIdxs())
|
||||
{
|
||||
// Retrieve the session context.
|
||||
SbmSessionContext sessionContext = app.GetSessionContext(sessionContextIdx);
|
||||
if (sessionContext == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve SessionContext for idx: " + sessionContextIdx);
|
||||
continue;
|
||||
}
|
||||
// Retrieve the BusinessMgr database.
|
||||
ISacsDatabase db = app.GetBusMgrDatabase(sessionContext);
|
||||
if (db == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve SessionContext for idx: " + sessionContextIdx);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Query to check for Security Item matching the email with associated Affiliate.
|
||||
// NB This is done independently for each database in case there are different
|
||||
// DBMSs involved with different value formatting or syntax rules.
|
||||
DbQuery qry = new DbQuery(db.DbmsType);
|
||||
qry.Tables.Add(SaSecurityDbDfn.GetTableName(SaSecurityDbDfn.TableIdx.SaSecItem), alias_SecurityItem);
|
||||
qry.Columns.Add(SaSecurityDbDfn.GetColumnNameQual(SaSecurityDbDfn.ColumnIdx.SaSecItem_Id, alias_SecurityItem));
|
||||
qry.Filters.Add(SaSecurityDbDfn.GetColumnNameQual(SaSecurityDbDfn.ColumnIdx.SaSecItem_EmailAddress, alias_SecurityItem) + "='" + DbQuery.FormatForCondition(emailAddress) + "'");
|
||||
// Join to the Affiliate table.
|
||||
DbQueryJoin joinAffiliate = new DbQueryJoin(DbJoinType.FullOuter);
|
||||
joinAffiliate.Table = new StringPair(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Affiliate), alias_Affiliate);
|
||||
joinAffiliate.Filters.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Affiliate_UserId, alias_Affiliate) + "=" + SaSecurityDbDfn.GetColumnNameQual(SaSecurityDbDfn.ColumnIdx.SaSecItem_Id, alias_SecurityItem));
|
||||
|
||||
// Execute query.
|
||||
using (DbResultSet resultSet = DbResultSet_DataReader.ExecuteQuery(db, qry.BuildQuery()))
|
||||
{
|
||||
if (resultSet != null && resultSet.NextRecord())
|
||||
sessionContextIdxs.Add(sessionContextIdx);
|
||||
}
|
||||
}
|
||||
return sessionContextIdxs;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -41,13 +41,13 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Application properties.
|
||||
private SbmApplication_Web App { get { return SbmApplication_Web.WebApp; } }
|
||||
protected SbmSessionConfig SessionConfig { get { return App.SessionConfig; } }
|
||||
private SbmApplication_Web App { get { return SbmGlobals_Web.Application; } }
|
||||
protected SbmAppConfig AppConfig { get { return App.AppConfig; } }
|
||||
protected SbmSystem_Web System { get { return App.System_Web; } }
|
||||
public String SessionCookieName { get { return App.SessionCookieName; } }
|
||||
public SbmSessionData SessionData { get { return SessionData_Web; } }
|
||||
public SbmSessionData_Web SessionData_Web { get; set; }
|
||||
public SbmSessionContext SessionContext { get { return SessionData?.SessionContext ?? App.SessionContext; } }
|
||||
public SbmSessionContext SessionContext { get { return SessionData?.SessionContext ?? null; } }
|
||||
public DbUpdateInfo DbUpdateInfo { get { return SessionData?.DbUpdateInfo ?? new DbUpdateInfo(null, "", SbmSystem.ComputerName); } }
|
||||
public bool DebugMode { get { return SbmSystem.DebugMode; } }
|
||||
public SbmLocaliser Localiser { get; }
|
||||
@@ -57,37 +57,38 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
|
||||
public bool OK { get { return !HasMessages(); } }
|
||||
public virtual bool ProhibitCache { get; set; } = true;
|
||||
public String PageCaption { get; set; }
|
||||
public String InstanceVersion { get { return !StringUtil.IsEmpty(App.SessionConfig.Instance) ? App.SessionConfig.Instance + " v" + Sbm.Version.GetFullVersion() : "v" + Sbm.Version.GetAppVersion(); } }
|
||||
public String InstanceVersion { get { return !StringUtil.IsEmpty(App.AppConfig.Instance) ? App.AppConfig.Instance + " v" + Sbm.Version.GetFullVersion() : "v" + Sbm.Version.GetAppVersion(); } }
|
||||
public bool IncludeGoogleAnalytics { get; set; } = false;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Business components.
|
||||
// NB Keep these accessors protected to avoid them being called by teh model binding logic before the session data is ready.
|
||||
protected SbmInternals Internals { get { if (internals == null) internals = new SbmInternals(SessionData_Web.UserContext); return internals; } }
|
||||
// Managers.
|
||||
public SbmAccountMgr AccountMgr { get { return Internals.AccountMgr; } }
|
||||
public SbmAssetMgr AssetMgr { get { return Internals.AssetMgr; } }
|
||||
public SbmCommodityMgr CommodityMgr { get { return Internals.CommodityMgr; } }
|
||||
public SbmPriceMgr PriceMgr { get { return Internals.PriceMgr; } }
|
||||
public SbmTransactionMgr TransactionMgr { get { return Internals.TransactionMgr; } }
|
||||
public SbmStockMgr StockMgr { get { return Internals.StockMgr; } }
|
||||
public SbmProcessMgr ProcessMgr { get { return Internals.ProcessMgr; } }
|
||||
public SbmDataItemMgr DataItemMgr { get { return Internals.DataItemMgr; } }
|
||||
protected SbmAccountMgr AccountMgr { get { return Internals.AccountMgr; } }
|
||||
protected SbmAssetMgr AssetMgr { get { return Internals.AssetMgr; } }
|
||||
protected SbmCommodityMgr CommodityMgr { get { return Internals.CommodityMgr; } }
|
||||
protected SbmPriceMgr PriceMgr { get { return Internals.PriceMgr; } }
|
||||
protected SbmTransactionMgr TransactionMgr { get { return Internals.TransactionMgr; } }
|
||||
protected SbmStockMgr StockMgr { get { return Internals.StockMgr; } }
|
||||
protected SbmProcessMgr ProcessMgr { get { return Internals.ProcessMgr; } }
|
||||
protected SbmDataItemMgr DataItemMgr { get { return Internals.DataItemMgr; } }
|
||||
// Consoles.
|
||||
public SbmConfigConsole ConfigConsole { get { return Internals.ConfigConsole; } }
|
||||
public SaDiaryConsole DiaryConsole { get { return Internals.DiaryConsole; } }
|
||||
public SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } }
|
||||
public SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
|
||||
public SaReferenceDataConsole ReferenceDataConsole { get { return Internals.ReferenceDataConsole; } }
|
||||
public SaUpdateLogConsole UpdateLogConsole { get { return Internals.UpdateLogConsole; } }
|
||||
public SaInterfaceConsole InterfaceConsole { get { return Internals.InterfaceConsole; } }
|
||||
public SaItemDocConsole ItemDocConsole { get { return Internals.ItemDocConsole; } }
|
||||
public SaItemOptionConsole ItemOptionConsole { get { return Internals.ItemOptionConsole; } }
|
||||
public SaItemDataConsole ItemDataConsole { get { return Internals.ItemDataConsole; } }
|
||||
protected SbmConfigConsole ConfigConsole { get { return Internals.ConfigConsole; } }
|
||||
protected SaDiaryConsole DiaryConsole { get { return Internals.DiaryConsole; } }
|
||||
protected SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } }
|
||||
protected SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
|
||||
protected SaReferenceDataConsole ReferenceDataConsole { get { return Internals.ReferenceDataConsole; } }
|
||||
protected SaUpdateLogConsole UpdateLogConsole { get { return Internals.UpdateLogConsole; } }
|
||||
protected SaInterfaceConsole InterfaceConsole { get { return Internals.InterfaceConsole; } }
|
||||
protected SaItemDocConsole ItemDocConsole { get { return Internals.ItemDocConsole; } }
|
||||
protected SaItemOptionConsole ItemOptionConsole { get { return Internals.ItemOptionConsole; } }
|
||||
protected SaItemDataConsole ItemDataConsole { get { return Internals.ItemDataConsole; } }
|
||||
// Configurations.
|
||||
public SbmStockControlConfig StockControlConfig { get { return Internals.StockControlConfig; } }
|
||||
public SbmRequirementCostingConfig RequirementCostingConfig { get { return Internals.RequirementCostingConfig; } }
|
||||
protected SbmStockControlConfig StockControlConfig { get { return Internals.StockControlConfig; } }
|
||||
protected SbmRequirementCostingConfig RequirementCostingConfig { get { return Internals.RequirementCostingConfig; } }
|
||||
// System codes.
|
||||
public List<TypeCodeDesc> GetCodesOfType(Sbm.SystemCode systemCode) { return Internals.GetCodesOfType(systemCode); }
|
||||
protected List<TypeCodeDesc> GetCodesOfType(Sbm.SystemCode systemCode) { return Internals.GetCodesOfType(systemCode); }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security.
|
||||
@@ -183,29 +184,32 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Form data.
|
||||
// NB Use methods rathe rthan accessors for properties that depend on session data
|
||||
// to avoid the model binding logic invoking a getter before it's ready for use.
|
||||
|
||||
/// <summary>List of Address Types for dropdown.</summary>
|
||||
public IEnumerable<SelectListItem> AddressTypeCodesForSelect
|
||||
public IEnumerable<SelectListItem> GetAddressTypeCodesForSelect()
|
||||
{
|
||||
get { return new SelectList(GetCodesOfType(Sbm.SystemCode.AddressType), "Code", "Desc"); }
|
||||
return new SelectList(GetCodesOfType(Sbm.SystemCode.AddressType), "Code", "Desc");
|
||||
}
|
||||
|
||||
/// <summary>List of Affiliate Types for dropdown.</summary>
|
||||
public IEnumerable<SelectListItem> AffiliateTypeCodesForSelect
|
||||
public IEnumerable<SelectListItem> GetAffiliateTypeCodesForSelect()
|
||||
{
|
||||
get { return new SelectList(GetCodesOfType(Sbm.SystemCode.AffiliateType), "Code", "Desc"); }
|
||||
return new SelectList(GetCodesOfType(Sbm.SystemCode.AffiliateType), "Code", "Desc");
|
||||
}
|
||||
|
||||
/// <summary>List of Association Types for dropdown.</summary>
|
||||
public IEnumerable<SelectListItem> AssociationTypeCodesForSelect
|
||||
public IEnumerable<SelectListItem> GetAssociationTypeCodesForSelect()
|
||||
{
|
||||
get { return new SelectList(GetCodesOfType(Sbm.SystemCode.AssociationType), "Code", "Desc"); }
|
||||
return new SelectList(GetCodesOfType(Sbm.SystemCode.AssociationType), "Code", "Desc");
|
||||
}
|
||||
|
||||
/// <summary>List of Commodity Types for dropdown.</summary>
|
||||
public IEnumerable<SelectListItem> CommodityTypeCodesForSelect
|
||||
public IEnumerable<SelectListItem> GetCommodityTypeCodesForSelect()
|
||||
{
|
||||
get { return new SelectList(GetCodesOfType(Sbm.SystemCode.CommodityType), "Code", "Desc"); }
|
||||
|
||||
return new SelectList(GetCodesOfType(Sbm.SystemCode.CommodityType), "Code", "Desc");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -41,14 +41,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
}
|
||||
}
|
||||
}
|
||||
public class Online
|
||||
public class Portal
|
||||
{
|
||||
public static class Session
|
||||
{
|
||||
public static class Cookie
|
||||
{
|
||||
/// <summary>Default cookie name: '.AspNetCore.Session'</summary>
|
||||
public static String Name { get; } = "BusinessMgr.Online.Session";
|
||||
public static String Name { get; } = "BusinessMgr.Portal.Session";
|
||||
public static bool HttpOnly { get; } = true;
|
||||
public static TimeSpan IdleTimeout { get; } = SacsSystem.DebugMode ? TimeSpan.FromMinutes(5) : TimeSpan.FromMinutes(60);
|
||||
public static long RememberMeTimeoutMilis { get; } = (long)(SacsSystem.DebugMode ? TimeSpan.FromMinutes(2) : TimeSpan.FromMinutes(10)).TotalMilliseconds;
|
||||
@@ -63,14 +63,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
}
|
||||
}
|
||||
}
|
||||
public class Admin
|
||||
public class Control
|
||||
{
|
||||
public static class Session
|
||||
{
|
||||
public static class Cookie
|
||||
{
|
||||
/// <summary>Default cookie name: '.AspNetCore.Session'</summary>
|
||||
public static String Name { get; } = "BusinessMgr.Admin.Session";
|
||||
public static String Name { get; } = "BusinessMgr.Control.Session";
|
||||
public static bool HttpOnly { get; } = true;
|
||||
public static TimeSpan IdleTimeout { get; } = SacsSystem.DebugMode ? TimeSpan.FromMinutes(5) : TimeSpan.FromMinutes(15);
|
||||
public static long KeepLoggedInTimeoutMillis { get; } = (long)(SacsSystem.DebugMode ? TimeSpan.FromMinutes(2) : TimeSpan.FromMinutes(10)).TotalMilliseconds;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Interfaces;
|
||||
using System;
|
||||
|
||||
@@ -228,8 +229,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
if (interfaceConsole == null || !interfaceConsole.DatabaseIsValid) return false;
|
||||
// System Account & User tables must be available.
|
||||
if (!SbmGlobals.Application.BusMgrTableExists(userContext.SessionContext, SbmDbDfn.TableIdx.SystemAccount)) return false;
|
||||
if (!SbmGlobals.Application.BusMgrTableExists(userContext.SessionContext, SbmDbDfn.TableIdx.SystemUser)) return false;
|
||||
ISacsDatabase busMgrDb = SbmGlobals.Application.GetBusMgrDatabase(userContext.SessionContext);
|
||||
if (!SbmGlobals.Application.DbTableExists(busMgrDb, SbmDbDfn.TableIdx.SystemAccount)) return false;
|
||||
if (!SbmGlobals.Application.DbTableExists(busMgrDb, SbmDbDfn.TableIdx.SystemUser)) return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -290,7 +292,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// Actions.
|
||||
case Sbm.MenuOption.Timesheet:
|
||||
return configConsole.AllowOption(userContext, Sbm.ConfigOption.TimeRecording);
|
||||
//-----------------------------------------------------------
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
SaLogger.Warn(fn + " Unsupport menu option - " + menuOption.ToString());
|
||||
return false;
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// Construction.
|
||||
protected SbmApplication(PropertySet properties)
|
||||
{
|
||||
SbmGlobals.Application = this;
|
||||
this.properties = properties;
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
@@ -45,17 +46,29 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public abstract SbmSystem System { get; }
|
||||
// Database.
|
||||
public abstract ISacsDatabase GetBusMgrDatabase(SbmSessionContext sessionContext);
|
||||
public abstract IDatabaseInfo CreateBusMgrDbInfo(SbmSessionContext sessionContext);
|
||||
public bool BusMgrTableExists(SbmSessionContext sessionContext, SbmDbDfn.TableIdx tableIdx)
|
||||
// Control Database.
|
||||
public abstract ISacsDatabase GetControlDatabase(SbmSessionContext sessionContext);
|
||||
public IDatabaseInfo CreateControlDbInfo(SbmSessionContext sessionContext)
|
||||
{
|
||||
return GetControlDatabase(sessionContext).CreateDbInfo();
|
||||
}
|
||||
// Business Mgr Database.
|
||||
public abstract ISacsDatabase GetBusMgrDatabase(SbmSessionContext sessionContext);
|
||||
public IDatabaseInfo CreateBusMgrDbInfo(SbmSessionContext sessionContext)
|
||||
{
|
||||
return GetBusMgrDatabase(sessionContext).CreateDbInfo();
|
||||
}
|
||||
// Database utilities.
|
||||
public IDatabaseInfo CreateDbInfo(ISacsDatabase db)
|
||||
{
|
||||
return db?.CreateDbInfo() ?? null;
|
||||
}
|
||||
public bool DbTableExists(ISacsDatabase db, SbmDbDfn.TableIdx tableIdx)
|
||||
{
|
||||
ISacsDatabase db = GetBusMgrDatabase(sessionContext);
|
||||
return db?.TableExists(SbmDbDfn.GetTableName(tableIdx)) ?? false;
|
||||
}
|
||||
public bool BusMgrColumnExists(SbmSessionContext sessionContext, SbmDbDfn.ColumnIdx columnIdx)
|
||||
public bool DbColumnExists(ISacsDatabase db, SbmDbDfn.ColumnIdx columnIdx)
|
||||
{
|
||||
ISacsDatabase db = GetBusMgrDatabase(sessionContext);
|
||||
return db?.ColumnExists(SbmDbDfn.GetTableName(SbmDbDfn.GetTableForColumn(columnIdx)), SbmDbDfn.GetColumnName(columnIdx, false)) ?? false;
|
||||
}
|
||||
// Application instance.
|
||||
|
||||
@@ -428,10 +428,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth11:
|
||||
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth12:
|
||||
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_SalesProjAnnual);
|
||||
default: // Sep-08: Session profile should be able to handle all fields now (rather than just those that are controled)
|
||||
default: // Sep-08: Session profile should be able to handle all fields now (rather than just those that are controlled)
|
||||
return userContext.GetOwnerOption_ShowField(column);
|
||||
}
|
||||
return true;
|
||||
//return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
@@ -5,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
@@ -1144,17 +1145,17 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static readonly int tableCount = 44;
|
||||
private static readonly int tableCount = 44;
|
||||
private static readonly int columnCount = 1073;
|
||||
private static ulong maxTextLen = 0;
|
||||
private static ulong maxTextLen = 0;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve Table details (eg. name: 'Company').
|
||||
public static int GetTableCount()
|
||||
public static int GetTableCount ()
|
||||
{
|
||||
return tableCount;
|
||||
}
|
||||
public static String GetTableName(TableIdx table, bool delimitReservedWords = true)
|
||||
public static String GetTableName (TableIdx table, bool delimitReservedWords = true)
|
||||
{
|
||||
int tableIdx = (int)table - 1;
|
||||
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
|
||||
@@ -1165,7 +1166,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Identify the table that corresponds with the specified column.
|
||||
public static TableIdx GetTableForColumn(ColumnIdx column)
|
||||
public static TableIdx GetTableForColumn (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return TableIdx.Unknown;
|
||||
@@ -1174,7 +1175,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve the specified Column's name (Qualified include table name: '(<Table>.Column>)').
|
||||
public static String GetColumnName(ColumnIdx column, bool delimitReservedWords = true)
|
||||
public static String GetColumnName (ColumnIdx column, bool delimitReservedWords = true)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return String.Empty;
|
||||
@@ -1182,7 +1183,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
if (delimitReservedWords) columnName = DelimitReservedWord(columnName);
|
||||
return columnName;
|
||||
}
|
||||
public static String GetColumnNameQual(ColumnIdx column, String tableAlias = "", bool braces = false)
|
||||
public static String GetColumnNameQual (ColumnIdx column, String tableAlias = "", bool braces = false)
|
||||
{
|
||||
String columnName = GetColumnName(column);
|
||||
if (!String.IsNullOrEmpty(columnName))
|
||||
@@ -1199,17 +1200,17 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Reserved words.
|
||||
private static DbReservedWordDelim reservedWordDelim = DbReservedWordDelim.SquareBrackets;
|
||||
public static void SetReservedWordDelim(DbReservedWordDelim reservedWordDelim)
|
||||
public static void SetReservedWordDelim (DbReservedWordDelim reservedWordDelim)
|
||||
{
|
||||
SbmDbDfn.reservedWordDelim = reservedWordDelim;
|
||||
}
|
||||
public static bool IsReservedWord(String word)
|
||||
public static bool IsReservedWord (String word)
|
||||
{
|
||||
if (String.IsNullOrEmpty(word)) return false;
|
||||
if (reservedWords.Contains(word, StringComparer.OrdinalIgnoreCase)) return true;
|
||||
return false;
|
||||
}
|
||||
public static String DelimitReservedWord(String word)
|
||||
public static String DelimitReservedWord (String word)
|
||||
{
|
||||
if (!IsReservedWord(word)) return word;
|
||||
switch (reservedWordDelim)
|
||||
@@ -1217,11 +1218,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
case DbReservedWordDelim.None:
|
||||
break;
|
||||
case DbReservedWordDelim.DoubleQuotes:
|
||||
word = "\"" + word + "\"";
|
||||
word = "\"" + word + "\"";
|
||||
break;
|
||||
case DbReservedWordDelim.SquareBrackets:
|
||||
default:
|
||||
word = "[" + word + "]";
|
||||
word = "[" + word + "]";
|
||||
break;
|
||||
}
|
||||
return word;
|
||||
@@ -1229,29 +1230,29 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve information about the specified Column.
|
||||
public static DbColumnDataType GetColDataType(ColumnIdx column)
|
||||
public static DbColumnDataType GetColDataType (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return DbColumnDataType.Unknown;
|
||||
return columns[columnIdx].DataType;
|
||||
}
|
||||
public static short GetColNativeDataType(ColumnIdx column)
|
||||
public static short GetColNativeDataType (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return 0;
|
||||
return columns[columnIdx].NativeDataType;
|
||||
}
|
||||
public static void SetMaxTextLen(ulong maxTextLen)
|
||||
public static void SetMaxTextLen (ulong maxTextLen)
|
||||
{
|
||||
SbmDbDfn.maxTextLen = maxTextLen;
|
||||
}
|
||||
public static bool IsColFmtText(ColumnIdx column)
|
||||
public static bool IsColFmtText (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return false;
|
||||
return (columns[columnIdx].DataType == DbColumnDataType.VarChar);
|
||||
}
|
||||
public static ulong GetColTextLen(ColumnIdx column)
|
||||
public static ulong GetColTextLen (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return 0;
|
||||
@@ -1263,13 +1264,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public static bool IsColFmtBool(ColumnIdx column)
|
||||
public static bool IsColFmtBool (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return false;
|
||||
return (columns[columnIdx].DataType == DbColumnDataType.Bit);
|
||||
}
|
||||
public static bool IsColFmtNumeric(ColumnIdx column)
|
||||
public static bool IsColFmtNumeric (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return false;
|
||||
@@ -1291,55 +1292,55 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// Table definitions.
|
||||
private static readonly String[] tables =
|
||||
{
|
||||
"Address",
|
||||
"Affiliate",
|
||||
"Association",
|
||||
"Commodity",
|
||||
"CommodityCustomer",
|
||||
"CommoditySupplier",
|
||||
"Constituent",
|
||||
"Container",
|
||||
"ContainerItem",
|
||||
"Currency",
|
||||
"IndexDefragLog",
|
||||
"Interface",
|
||||
"InterfaceDataItem",
|
||||
"InterfaceProcess",
|
||||
"InterfaceProcessDataItem",
|
||||
"InterfaceProcessMessage",
|
||||
"ItemBatch",
|
||||
"ItemLink",
|
||||
"Language",
|
||||
"Location",
|
||||
"Movement",
|
||||
"PortfolioItem",
|
||||
"Process",
|
||||
"Region",
|
||||
"Requirement",
|
||||
"SaAsset",
|
||||
"SaAssetCategory",
|
||||
"SaAssetProcess",
|
||||
"SaDiaryEntry",
|
||||
"SaDiaryLink",
|
||||
"SaPrice",
|
||||
"SaPriceSet",
|
||||
"SaVehicle",
|
||||
"SaVehicleClass",
|
||||
"SaVehicleEvent",
|
||||
"SaVehicleFeature",
|
||||
"StockLevel",
|
||||
"SysParam",
|
||||
"SystemAccount",
|
||||
"SystemAccountUser",
|
||||
"SystemUser",
|
||||
"TaxCode",
|
||||
"Transaction",
|
||||
"UnitMeasure",
|
||||
"Address",
|
||||
"Affiliate",
|
||||
"Association",
|
||||
"Commodity",
|
||||
"CommodityCustomer",
|
||||
"CommoditySupplier",
|
||||
"Constituent",
|
||||
"Container",
|
||||
"ContainerItem",
|
||||
"Currency",
|
||||
"IndexDefragLog",
|
||||
"Interface",
|
||||
"InterfaceDataItem",
|
||||
"InterfaceProcess",
|
||||
"InterfaceProcessDataItem",
|
||||
"InterfaceProcessMessage",
|
||||
"ItemBatch",
|
||||
"ItemLink",
|
||||
"Language",
|
||||
"Location",
|
||||
"Movement",
|
||||
"PortfolioItem",
|
||||
"Process",
|
||||
"Region",
|
||||
"Requirement",
|
||||
"SaAsset",
|
||||
"SaAssetCategory",
|
||||
"SaAssetProcess",
|
||||
"SaDiaryEntry",
|
||||
"SaDiaryLink",
|
||||
"SaPrice",
|
||||
"SaPriceSet",
|
||||
"SaVehicle",
|
||||
"SaVehicleClass",
|
||||
"SaVehicleEvent",
|
||||
"SaVehicleFeature",
|
||||
"StockLevel",
|
||||
"SysParam",
|
||||
"SystemAccount",
|
||||
"SystemAccountUser",
|
||||
"SystemUser",
|
||||
"TaxCode",
|
||||
"Transaction",
|
||||
"UnitMeasure",
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Table column definitions.
|
||||
internal class ColumnDfn
|
||||
private class ColumnDfn
|
||||
{
|
||||
internal TableIdx TableIdx { get; set; }
|
||||
internal String Name { get; set; }
|
||||
@@ -1347,7 +1348,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
internal short NativeDataType { get; set; }
|
||||
internal bool IsIdentity { get; set; }
|
||||
internal ulong DataLen { get; set; }
|
||||
internal ColumnDfn(int tableIdx, String name, int dataType, short nativeDataType, bool isIdentity, ulong dataLen)
|
||||
internal ColumnDfn (int tableIdx, String name, int dataType, short nativeDataType, bool isIdentity, ulong dataLen)
|
||||
{
|
||||
this.TableIdx = (TableIdx)tableIdx;
|
||||
this.Name = name;
|
||||
@@ -2440,80 +2441,80 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// Reserved words.
|
||||
private static readonly List<String> reservedWords = new List<String>()
|
||||
{
|
||||
"ADD",
|
||||
"ALL",
|
||||
"ALTER",
|
||||
"AND",
|
||||
"ANY",
|
||||
"AS",
|
||||
"ASC",
|
||||
"AVG",
|
||||
"BEGIN",
|
||||
"BETWEEN",
|
||||
"BY",
|
||||
"CASE",
|
||||
"CAST",
|
||||
"COLUMN",
|
||||
"COMMIT",
|
||||
"CONSTRAINT",
|
||||
"CONVERT",
|
||||
"COUNT",
|
||||
"CREATE",
|
||||
"CURRENCY",
|
||||
"DEFAULT",
|
||||
"DELETE",
|
||||
"DESC",
|
||||
"DISTINCT",
|
||||
"DROP",
|
||||
"ELSE",
|
||||
"END",
|
||||
"EXECUTE",
|
||||
"EXISTS",
|
||||
"FALSE",
|
||||
"FROM",
|
||||
"GRANT",
|
||||
"GROUP",
|
||||
"HAVING",
|
||||
"IN",
|
||||
"INDEX",
|
||||
"INNER",
|
||||
"INSERT",
|
||||
"INTO",
|
||||
"IS",
|
||||
"JOIN",
|
||||
"KEY",
|
||||
"LEFT",
|
||||
"LIKE",
|
||||
"MAX",
|
||||
"MIN",
|
||||
"NOT",
|
||||
"NULL",
|
||||
"ON",
|
||||
"OR",
|
||||
"ORDER",
|
||||
"OUTER",
|
||||
"OUTPUT",
|
||||
"PRIMARY",
|
||||
"PROCEDURE",
|
||||
"REVOKE",
|
||||
"ROLLBACK",
|
||||
"ROWCOUNT",
|
||||
"SELECT",
|
||||
"SET",
|
||||
"SQL",
|
||||
"SUM",
|
||||
"TABLE",
|
||||
"THEN",
|
||||
"TRANSACTION",
|
||||
"TRUE",
|
||||
"UNION",
|
||||
"UNIQUE",
|
||||
"UPDATE",
|
||||
"USER",
|
||||
"VALUES",
|
||||
"VIEW",
|
||||
"WHEN",
|
||||
"WHERE",
|
||||
"ADD",
|
||||
"ALL",
|
||||
"ALTER",
|
||||
"AND",
|
||||
"ANY",
|
||||
"AS",
|
||||
"ASC",
|
||||
"AVG",
|
||||
"BEGIN",
|
||||
"BETWEEN",
|
||||
"BY",
|
||||
"CASE",
|
||||
"CAST",
|
||||
"COLUMN",
|
||||
"COMMIT",
|
||||
"CONSTRAINT",
|
||||
"CONVERT",
|
||||
"COUNT",
|
||||
"CREATE",
|
||||
"CURRENCY",
|
||||
"DEFAULT",
|
||||
"DELETE",
|
||||
"DESC",
|
||||
"DISTINCT",
|
||||
"DROP",
|
||||
"ELSE",
|
||||
"END",
|
||||
"EXECUTE",
|
||||
"EXISTS",
|
||||
"FALSE",
|
||||
"FROM",
|
||||
"GRANT",
|
||||
"GROUP",
|
||||
"HAVING",
|
||||
"IN",
|
||||
"INDEX",
|
||||
"INNER",
|
||||
"INSERT",
|
||||
"INTO",
|
||||
"IS",
|
||||
"JOIN",
|
||||
"KEY",
|
||||
"LEFT",
|
||||
"LIKE",
|
||||
"MAX",
|
||||
"MIN",
|
||||
"NOT",
|
||||
"NULL",
|
||||
"ON",
|
||||
"OR",
|
||||
"ORDER",
|
||||
"OUTER",
|
||||
"OUTPUT",
|
||||
"PRIMARY",
|
||||
"PROCEDURE",
|
||||
"REVOKE",
|
||||
"ROLLBACK",
|
||||
"ROWCOUNT",
|
||||
"SELECT",
|
||||
"SET",
|
||||
"SQL",
|
||||
"SUM",
|
||||
"TABLE",
|
||||
"THEN",
|
||||
"TRANSACTION",
|
||||
"TRUE",
|
||||
"UNION",
|
||||
"UNIQUE",
|
||||
"UPDATE",
|
||||
"USER",
|
||||
"VALUES",
|
||||
"VIEW",
|
||||
"WHEN",
|
||||
"WHERE",
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,400 @@
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:28
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
public class SbmDbDfn_Control
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Table identifiers.
|
||||
public enum TableIdx
|
||||
{
|
||||
Unknown = 0,
|
||||
Database,
|
||||
DatabaseAccount,
|
||||
UserAccount,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Column identifiers.
|
||||
public enum ColumnIdx
|
||||
{
|
||||
Unknown = 0,
|
||||
Database_Id,
|
||||
Database_ServerName,
|
||||
Database_InstanceName,
|
||||
Database_DatabaseName,
|
||||
Database_UserName,
|
||||
Database_Password,
|
||||
Database_OrganisationName,
|
||||
Database_Notes,
|
||||
Database_Flags,
|
||||
Database_Status,
|
||||
Database_CreateOn,
|
||||
Database_CreateBy,
|
||||
Database_CreateHost,
|
||||
Database_UpdateOn,
|
||||
Database_UpdateBy,
|
||||
Database_UpdateHost,
|
||||
DatabaseAccount_Id,
|
||||
DatabaseAccount_DatabaseId,
|
||||
DatabaseAccount_EmailAddress,
|
||||
DatabaseAccount_Notes,
|
||||
DatabaseAccount_Flags,
|
||||
DatabaseAccount_Status,
|
||||
DatabaseAccount_CreateOn,
|
||||
DatabaseAccount_CreateBy,
|
||||
DatabaseAccount_CreateHost,
|
||||
DatabaseAccount_UpdateOn,
|
||||
DatabaseAccount_UpdateBy,
|
||||
DatabaseAccount_UpdateHost,
|
||||
UserAccount_Id,
|
||||
UserAccount_EmailAddress,
|
||||
UserAccount_Title,
|
||||
UserAccount_FirstName,
|
||||
UserAccount_Initials,
|
||||
UserAccount_LastName,
|
||||
UserAccount_PhoneMain,
|
||||
UserAccount_PhoneMobile,
|
||||
UserAccount_PhoneAlt,
|
||||
UserAccount_PasswordToken,
|
||||
UserAccount_PasswordHashed,
|
||||
UserAccount_PasswordHistory,
|
||||
UserAccount_PasswordChangedAt,
|
||||
UserAccount_LastLoginAt,
|
||||
UserAccount_LastInvalidLoginAt,
|
||||
UserAccount_InvalidLoginCount,
|
||||
UserAccount_Notes,
|
||||
UserAccount_Flags,
|
||||
UserAccount_Status,
|
||||
UserAccount_CreateOn,
|
||||
UserAccount_CreateBy,
|
||||
UserAccount_CreateHost,
|
||||
UserAccount_UpdateOn,
|
||||
UserAccount_UpdateBy,
|
||||
UserAccount_UpdateHost,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static readonly int tableCount = 3;
|
||||
private static readonly int columnCount = 53;
|
||||
private static ulong maxTextLen = 0;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve Table details (eg. name: 'Company').
|
||||
public static int GetTableCount ()
|
||||
{
|
||||
return tableCount;
|
||||
}
|
||||
public static String GetTableName (TableIdx table, bool delimitReservedWords = true)
|
||||
{
|
||||
int tableIdx = (int)table - 1;
|
||||
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
|
||||
String tableName = tables[(int)tableIdx];
|
||||
if (delimitReservedWords) tableName = DelimitReservedWord(tableName);
|
||||
return tableName;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Identify the table that corresponds with the specified column.
|
||||
public static TableIdx GetTableForColumn (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return TableIdx.Unknown;
|
||||
return columns[columnIdx].TableIdx;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve the specified Column's name (Qualified include table name: '(<Table>.Column>)').
|
||||
public static String GetColumnName (ColumnIdx column, bool delimitReservedWords = true)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return String.Empty;
|
||||
String columnName = columns[columnIdx].Name;
|
||||
if (delimitReservedWords) columnName = DelimitReservedWord(columnName);
|
||||
return columnName;
|
||||
}
|
||||
public static String GetColumnNameQual (ColumnIdx column, String tableAlias = "", bool braces = false)
|
||||
{
|
||||
String columnName = GetColumnName(column);
|
||||
if (!String.IsNullOrEmpty(columnName))
|
||||
{
|
||||
String tableName = StringUtil.EmptyOnNull(tableAlias);
|
||||
if (tableName.IsEmpty()) tableName = GetTableName(GetTableForColumn(column));
|
||||
columnName = tableName + (tableName.Length > 0 ? "." : "") + columnName;
|
||||
if (braces)
|
||||
columnName = "(" + columnName + ")";
|
||||
}
|
||||
return columnName;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Reserved words.
|
||||
private static DbReservedWordDelim reservedWordDelim = DbReservedWordDelim.SquareBrackets;
|
||||
public static void SetReservedWordDelim (DbReservedWordDelim reservedWordDelim)
|
||||
{
|
||||
SbmDbDfn_Control.reservedWordDelim = reservedWordDelim;
|
||||
}
|
||||
public static bool IsReservedWord (String word)
|
||||
{
|
||||
if (String.IsNullOrEmpty(word)) return false;
|
||||
if (reservedWords.Contains(word, StringComparer.OrdinalIgnoreCase)) return true;
|
||||
return false;
|
||||
}
|
||||
public static String DelimitReservedWord (String word)
|
||||
{
|
||||
if (!IsReservedWord(word)) return word;
|
||||
switch (reservedWordDelim)
|
||||
{
|
||||
case DbReservedWordDelim.None:
|
||||
break;
|
||||
case DbReservedWordDelim.DoubleQuotes:
|
||||
word = "\"" + word + "\"";
|
||||
break;
|
||||
case DbReservedWordDelim.SquareBrackets:
|
||||
default:
|
||||
word = "[" + word + "]";
|
||||
break;
|
||||
}
|
||||
return word;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve information about the specified Column.
|
||||
public static DbColumnDataType GetColDataType (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return DbColumnDataType.Unknown;
|
||||
return columns[columnIdx].DataType;
|
||||
}
|
||||
public static short GetColNativeDataType (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return 0;
|
||||
return columns[columnIdx].NativeDataType;
|
||||
}
|
||||
public static void SetMaxTextLen (ulong maxTextLen)
|
||||
{
|
||||
SbmDbDfn_Control.maxTextLen = maxTextLen;
|
||||
}
|
||||
public static bool IsColFmtText (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return false;
|
||||
return (columns[columnIdx].DataType == DbColumnDataType.VarChar);
|
||||
}
|
||||
public static ulong GetColTextLen (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return 0;
|
||||
if (columns[columnIdx].DataType == DbColumnDataType.VarChar)
|
||||
{
|
||||
ulong textLen = columns[columnIdx].DataLen;
|
||||
if (maxTextLen > 0 && textLen > maxTextLen) textLen = maxTextLen;
|
||||
return textLen;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public static bool IsColFmtBool (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return false;
|
||||
return (columns[columnIdx].DataType == DbColumnDataType.Bit);
|
||||
}
|
||||
public static bool IsColFmtNumeric (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return false;
|
||||
switch (columns[columnIdx].DataType)
|
||||
{
|
||||
case DbColumnDataType.TinyInt:
|
||||
case DbColumnDataType.SmallInt:
|
||||
case DbColumnDataType.Int:
|
||||
case DbColumnDataType.BigInt:
|
||||
case DbColumnDataType.Single:
|
||||
case DbColumnDataType.Double:
|
||||
case DbColumnDataType.Decimal:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Table definitions.
|
||||
private static readonly String[] tables =
|
||||
{
|
||||
"Database",
|
||||
"DatabaseAccount",
|
||||
"UserAccount",
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Table column definitions.
|
||||
private class ColumnDfn
|
||||
{
|
||||
internal TableIdx TableIdx { get; set; }
|
||||
internal String Name { get; set; }
|
||||
internal DbColumnDataType DataType { get; set; }
|
||||
internal short NativeDataType { get; set; }
|
||||
internal bool IsIdentity { get; set; }
|
||||
internal ulong DataLen { get; set; }
|
||||
internal ColumnDfn (int tableIdx, String name, int dataType, short nativeDataType, bool isIdentity, ulong dataLen)
|
||||
{
|
||||
this.TableIdx = (TableIdx)tableIdx;
|
||||
this.Name = name;
|
||||
this.DataType = (DbColumnDataType)dataType;
|
||||
this.NativeDataType = nativeDataType;
|
||||
this.IsIdentity = isIdentity;
|
||||
this.DataLen = dataLen;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private static readonly ColumnDfn[] columns =
|
||||
{
|
||||
new ColumnDfn(1,"Id",4,4,true,10),
|
||||
new ColumnDfn(1,"ServerName",0,-9,false,200),
|
||||
new ColumnDfn(1,"InstanceName",0,-9,false,200),
|
||||
new ColumnDfn(1,"DatabaseName",0,-9,false,200),
|
||||
new ColumnDfn(1,"UserName",0,-9,false,100),
|
||||
new ColumnDfn(1,"Password",0,-9,false,100),
|
||||
new ColumnDfn(1,"OrganisationName",0,-9,false,200),
|
||||
new ColumnDfn(1,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(1,"Flags",3,5,false,5),
|
||||
new ColumnDfn(1,"Status",0,12,false,3),
|
||||
new ColumnDfn(1,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(1,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(1,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(1,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(1,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(1,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(2,"Id",4,4,true,10),
|
||||
new ColumnDfn(2,"DatabaseId",4,4,false,10),
|
||||
new ColumnDfn(2,"EmailAddress",0,-9,false,200),
|
||||
new ColumnDfn(2,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(2,"Flags",3,5,false,5),
|
||||
new ColumnDfn(2,"Status",0,12,false,3),
|
||||
new ColumnDfn(2,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(2,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(2,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(2,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(2,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(2,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(3,"Id",4,4,true,10),
|
||||
new ColumnDfn(3,"EmailAddress",0,-9,false,200),
|
||||
new ColumnDfn(3,"Title",0,-9,false,20),
|
||||
new ColumnDfn(3,"FirstName",0,-9,false,100),
|
||||
new ColumnDfn(3,"Initials",0,-9,false,10),
|
||||
new ColumnDfn(3,"LastName",0,-9,false,100),
|
||||
new ColumnDfn(3,"PhoneMain",0,-9,false,50),
|
||||
new ColumnDfn(3,"PhoneMobile",0,-9,false,50),
|
||||
new ColumnDfn(3,"PhoneAlt",0,-9,false,50),
|
||||
new ColumnDfn(3,"PasswordToken",0,12,false,32),
|
||||
new ColumnDfn(3,"PasswordHashed",0,-9,false,100),
|
||||
new ColumnDfn(3,"PasswordHistory",0,-9,false,0),
|
||||
new ColumnDfn(3,"PasswordChangedAt",9,93,false,16),
|
||||
new ColumnDfn(3,"LastLoginAt",9,93,false,16),
|
||||
new ColumnDfn(3,"LastInvalidLoginAt",9,93,false,16),
|
||||
new ColumnDfn(3,"InvalidLoginCount",3,5,false,5),
|
||||
new ColumnDfn(3,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(3,"Flags",3,5,false,5),
|
||||
new ColumnDfn(3,"Status",0,12,false,3),
|
||||
new ColumnDfn(3,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(3,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(3,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(3,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(3,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(3,"UpdateHost",0,12,false,100),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Reserved words.
|
||||
private static readonly List<String> reservedWords = new List<String>()
|
||||
{
|
||||
"ADD",
|
||||
"ALL",
|
||||
"ALTER",
|
||||
"AND",
|
||||
"ANY",
|
||||
"AS",
|
||||
"ASC",
|
||||
"AVG",
|
||||
"BEGIN",
|
||||
"BETWEEN",
|
||||
"BY",
|
||||
"CASE",
|
||||
"CAST",
|
||||
"COLUMN",
|
||||
"COMMIT",
|
||||
"CONSTRAINT",
|
||||
"CONVERT",
|
||||
"COUNT",
|
||||
"CREATE",
|
||||
"CURRENCY",
|
||||
"DEFAULT",
|
||||
"DELETE",
|
||||
"DESC",
|
||||
"DISTINCT",
|
||||
"DROP",
|
||||
"ELSE",
|
||||
"END",
|
||||
"EXECUTE",
|
||||
"EXISTS",
|
||||
"FALSE",
|
||||
"FROM",
|
||||
"GRANT",
|
||||
"GROUP",
|
||||
"HAVING",
|
||||
"IN",
|
||||
"INDEX",
|
||||
"INNER",
|
||||
"INSERT",
|
||||
"INTO",
|
||||
"IS",
|
||||
"JOIN",
|
||||
"KEY",
|
||||
"LEFT",
|
||||
"LIKE",
|
||||
"MAX",
|
||||
"MIN",
|
||||
"NOT",
|
||||
"NULL",
|
||||
"ON",
|
||||
"OR",
|
||||
"ORDER",
|
||||
"OUTER",
|
||||
"OUTPUT",
|
||||
"PRIMARY",
|
||||
"PROCEDURE",
|
||||
"REVOKE",
|
||||
"ROLLBACK",
|
||||
"ROWCOUNT",
|
||||
"SELECT",
|
||||
"SET",
|
||||
"SQL",
|
||||
"SUM",
|
||||
"TABLE",
|
||||
"THEN",
|
||||
"TRANSACTION",
|
||||
"TRUE",
|
||||
"UNION",
|
||||
"UNIQUE",
|
||||
"UPDATE",
|
||||
"USER",
|
||||
"VALUES",
|
||||
"VIEW",
|
||||
"WHEN",
|
||||
"WHERE",
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
|
||||
// Tag replacement is expanded to avoid reading Footer resource unless required.
|
||||
ReplaceDynamicEmailTag(emailData, EmailTag_Footer, SbmResourceHelper.GetTextResource(SbmResourceHelper.TextResource.Email_Footer_Html));
|
||||
}
|
||||
|
||||
// Session data is optional.
|
||||
if (sessionData != null)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -20,9 +20,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Helpers
|
||||
Email_Header_Html,
|
||||
Email_Footer_Html,
|
||||
// Email templates.
|
||||
Email_ContactUs_Html,
|
||||
Email_Signup_Activate_Html,
|
||||
Email_Signup_Welcome_Html,
|
||||
Email_RequestPassword_Html,
|
||||
// Data - CSV files etc.
|
||||
}
|
||||
@@ -41,27 +38,18 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Helpers
|
||||
{
|
||||
// Email stylesheet.
|
||||
case TextResource.Email_Main_Css:
|
||||
resourceFilename = "sax-email-main.css";
|
||||
resourceFilename = "sbm-email-main.css";
|
||||
break;
|
||||
// Email partial content.
|
||||
case TextResource.Email_Header_Html:
|
||||
resourceFilename = "sax-email-header.html";
|
||||
resourceFilename = "sbm-email-header.html";
|
||||
break;
|
||||
case TextResource.Email_Footer_Html:
|
||||
resourceFilename = "sax-email-footer.html";
|
||||
resourceFilename = "sbm-email-footer.html";
|
||||
break;
|
||||
// Email templates.
|
||||
case TextResource.Email_ContactUs_Html:
|
||||
resourceFilename = "sax-email-contact-us.html";
|
||||
break;
|
||||
case TextResource.Email_Signup_Activate_Html:
|
||||
resourceFilename = "sax-email-signup-activate.html";
|
||||
break;
|
||||
case TextResource.Email_Signup_Welcome_Html:
|
||||
resourceFilename = "sax-email-signup-welcome.html";
|
||||
break;
|
||||
case TextResource.Email_RequestPassword_Html:
|
||||
resourceFilename = "sax-email-request-password.html";
|
||||
resourceFilename = "sbm-email-request-password.html";
|
||||
break;
|
||||
// Data.
|
||||
}
|
||||
|
||||
@@ -232,14 +232,20 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
{
|
||||
SbmApplication application = SbmGlobals.Application;
|
||||
if (application != null)
|
||||
return application.BusMgrTableExists(SessionContext, tableIdx);
|
||||
{
|
||||
ISacsDatabase busMgrDb = application.GetBusMgrDatabase(SessionContext);
|
||||
return application.DbTableExists(busMgrDb, tableIdx);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public bool ColumnExists(SbmDbDfn.ColumnIdx columnIdx)
|
||||
{
|
||||
SbmApplication application = SbmGlobals.Application;
|
||||
if (application != null)
|
||||
return application.BusMgrColumnExists(SessionContext, columnIdx);
|
||||
{
|
||||
ISacsDatabase busMgrDb = application.GetBusMgrDatabase(SessionContext);
|
||||
return application.DbColumnExists(busMgrDb, columnIdx);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Password Request</title>
|
||||
[#Email.MainStylesheet]
|
||||
</head>
|
||||
<body>
|
||||
[#Email.Header]
|
||||
<div class="sax-email-body">
|
||||
<div class="sax-email-panel-caption">
|
||||
<div class="sax-caption">Password Request</div>
|
||||
</div>
|
||||
<div class="sax-email-panel-content">
|
||||
<div class="sax-para">We received a request to re-set your password.</div>
|
||||
<div class="sax-para">Follow <span style="font-weight:bold;"><a href="[#Link.RequestPassword]">this link</a></span> to set a new password against your account.</div>
|
||||
<div class="sax-para">This link will expire in [#Link.ExpiresMinutes] minutes.</div>
|
||||
<div class="sax-para">Thank you.</div>
|
||||
</div>
|
||||
</div>
|
||||
[#Email.Footer]
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,3 @@
|
||||
<div class="sax-email-header">
|
||||
<div class="sax-content">Email Footer</div>
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
<div class="sax-email-header">
|
||||
<div class="sax-content">Sarand BusinessMgr</div>
|
||||
</div>
|
||||
@@ -0,0 +1,89 @@
|
||||
body
|
||||
{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: Verdana, Helvetica, Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
td
|
||||
{
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.sax-email-header
|
||||
{
|
||||
margin: 0 0 12px 0;
|
||||
border-bottom: 1px solid rgba(0,0,0,.1);
|
||||
box-shadow: 0 1px 0 rgba(0,0,0,.1);
|
||||
-moz-box-shadow: 0 1px 0 rgba(0,0,0,.1);
|
||||
-webkit-box-shadow: 0 1px 0 rgba(0,0,0,.1);
|
||||
}
|
||||
|
||||
.sax-email-header .sax-content, .sax-email-body, .sax-email-footer .sax-content
|
||||
{
|
||||
width: 90%;
|
||||
max-width: 1040px;
|
||||
margin:0 auto;
|
||||
padding:12px 24px;
|
||||
}
|
||||
|
||||
.sax-email-header .sax-content
|
||||
{
|
||||
}
|
||||
|
||||
.sax-email-body
|
||||
{
|
||||
}
|
||||
|
||||
.sax-email-panel-caption
|
||||
{
|
||||
margin: 12px 0;
|
||||
font-size: 40px;
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.sax-email-panel-content
|
||||
{
|
||||
margin: 12px 0;
|
||||
}
|
||||
|
||||
.sax-para
|
||||
{
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
td.sax-label
|
||||
{
|
||||
padding: 4px 12px;
|
||||
font-size: 16px;
|
||||
text-align: right;
|
||||
color: #808080;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
td.sax-value
|
||||
{
|
||||
padding-top: 4px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.sax-email-footer
|
||||
{
|
||||
margin: 24px 0 12px 0;
|
||||
border-top: 1px rgba(0,0,0,.1) solid;
|
||||
}
|
||||
|
||||
.sax-email-footer .sax-content
|
||||
{
|
||||
padding:12px 24px;
|
||||
}
|
||||
|
||||
.sax-email-footer .sax-content .sax-footer-lower
|
||||
{
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
@@ -166,9 +166,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Bus
|
||||
}
|
||||
public override bool ItemsRequireJobNumber()
|
||||
{
|
||||
// Check whether Job Number should be allocated:
|
||||
// Check whether Job Number should be allocated.
|
||||
SbmConfigConsole configConsole = internals.ConfigConsole;
|
||||
if (configConsole != null && configConsole.AllowOption(UserContext, Sbm.ConfigOption.SalesOrderItemJobNumber) && SbmGlobals.Application.BusMgrColumnExists(internals.SessionContext, SbmDbDfn.ColumnIdx.Requirement_JobNumber))
|
||||
ISacsDatabase db = internals.BusMgrDatabase;
|
||||
if (configConsole != null && configConsole.AllowOption(UserContext, Sbm.ConfigOption.SalesOrderItemJobNumber) && SbmGlobals.Application.DbColumnExists(db, SbmDbDfn.ColumnIdx.Requirement_JobNumber))
|
||||
return TransactionType == Sbm.TransactionType.SalesOrder;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
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.Security;
|
||||
using Sarand.Net.Standard.Base.UpdateLog;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.Security;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -23,7 +23,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmSecurityConsole_Dbas(SbmUserContext userContext, SacsDatabase database) : base(database)
|
||||
protected SbmSecurityConsole_Dbas(SbmUserContext userContext, ISacsDatabase database) : base(database)
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; set; }
|
||||
public SbmUserContext UserContext { get; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
public override short SecurityItemDataType { get { return (short)Sbm.ItemType.SecurityItem; } }
|
||||
public override short SecurityLinkDataType { get { return (short)Sbm.ItemType.SecurityLink; } }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Security;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.UpdateLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -17,8 +17,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmUpdateLogConsole_Dbas(SacsDatabase database) : base(database)
|
||||
protected SbmUpdateLogConsole_Dbas(SbmUserContext userContext, ISacsDatabase database) : base(database)
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
@@ -31,7 +32,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; set; }
|
||||
public SbmUserContext UserContext { get; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
// Consoles.
|
||||
public SaSecurityConsole SecurityConsole
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -126,7 +126,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal Address_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal Address_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -188,11 +188,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -201,7 +201,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_ItemType = GetFieldInt16(dbDataReader, "ItemType", _ItemType);
|
||||
@@ -249,13 +249,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -317,7 +317,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -325,7 +325,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -118,7 +118,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal Affiliate_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal Affiliate_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -176,11 +176,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -189,7 +189,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_Type = GetFieldInt16(dbDataReader, "Type", _Type);
|
||||
@@ -233,13 +233,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -297,7 +297,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -305,7 +305,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -140,7 +140,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal Association_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal Association_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -209,11 +209,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -222,7 +222,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_AffIdOwner = GetFieldInt32(dbDataReader, "AffIdOwner", _AffIdOwner);
|
||||
@@ -277,13 +277,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -352,7 +352,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -360,7 +360,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -73,7 +73,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal CommodityCustomer_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal CommodityCustomer_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -108,11 +108,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -121,7 +121,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_CommodityId = GetFieldInt32(dbDataReader, "CommodityId", _CommodityId);
|
||||
_AssocIdCustomer = GetFieldInt32(dbDataReader, "AssocIdCustomer", _AssocIdCustomer);
|
||||
@@ -142,13 +142,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -183,7 +183,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -191,7 +191,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE CommodityId=@CommodityId AND AssocIdCustomer=@AssocIdCustomer;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -71,7 +71,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal CommoditySupplier_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal CommoditySupplier_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -105,11 +105,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -118,7 +118,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_CommodityId = GetFieldInt32(dbDataReader, "CommodityId", _CommodityId);
|
||||
_AssocIdSupplier = GetFieldInt32(dbDataReader, "AssocIdSupplier", _AssocIdSupplier);
|
||||
@@ -138,13 +138,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -178,7 +178,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -186,7 +186,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE CommodityId=@CommodityId AND AssocIdSupplier=@AssocIdSupplier;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -232,7 +232,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal Commodity_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal Commodity_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -347,11 +347,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -360,7 +360,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_AffIdOwner = GetFieldInt32(dbDataReader, "AffIdOwner", _AffIdOwner);
|
||||
@@ -461,13 +461,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -582,7 +582,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -590,7 +590,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -130,7 +130,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal Constituent_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal Constituent_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -194,11 +194,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -207,7 +207,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_AffIdOwner = GetFieldInt32(dbDataReader, "AffIdOwner", _AffIdOwner);
|
||||
@@ -257,13 +257,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -327,7 +327,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -335,7 +335,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -77,7 +77,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal ContainerItem_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal ContainerItem_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -113,11 +113,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -126,7 +126,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_ContainerId = GetFieldInt32(dbDataReader, "ContainerId", _ContainerId);
|
||||
_ItemSeq = GetFieldInt16(dbDataReader, "ItemSeq", _ItemSeq);
|
||||
@@ -148,13 +148,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -190,7 +190,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -198,7 +198,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE ContainerId=@ContainerId AND ItemSeq=@ItemSeq AND ItemType=@ItemType AND ItemId=@ItemId;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -80,7 +80,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal Container_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal Container_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -119,11 +119,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -132,7 +132,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_AffIdOwner = GetFieldInt32(dbDataReader, "AffIdOwner", _AffIdOwner);
|
||||
@@ -157,13 +157,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -202,7 +202,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -210,7 +210,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:28
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal.Control
|
||||
{
|
||||
internal class DatabaseAccount_Db : SbmDbDataItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Column definitions.
|
||||
public class ColumnsData
|
||||
{
|
||||
public ColumnDataInt32 _Id { get; } = new ColumnDataInt32("Id", true);
|
||||
public ColumnDataInt32 _DatabaseId { get; } = new ColumnDataInt32("DatabaseId");
|
||||
public ColumnDataString _EmailAddress { get; } = new ColumnDataString("EmailAddress");
|
||||
public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
|
||||
public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
|
||||
public ColumnDataString _Status { get; } = new ColumnDataString("Status");
|
||||
public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
|
||||
public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
|
||||
public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
|
||||
public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
|
||||
public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
|
||||
public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
protected static List<String> fields { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
"DatabaseId",
|
||||
"EmailAddress",
|
||||
"Notes",
|
||||
"Flags",
|
||||
"Status",
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
"CreateHost",
|
||||
"UpdateOn",
|
||||
"UpdateBy",
|
||||
"UpdateHost",
|
||||
};
|
||||
protected static List<String> fieldsId { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
};
|
||||
protected static List<String> fieldsPrimary { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
};
|
||||
protected static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
|
||||
{
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
"CreateHost",
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal DatabaseAccount_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public override String SchemaName { get; } = "dbo";
|
||||
public override String TableName { get; } = "DatabaseAccount";
|
||||
public String TableNameFmt { get { return (!String.IsNullOrEmpty(SchemaName) ? "[" + SchemaName + "]." : "") + "[" + TableName + "]"; } }
|
||||
public static List<String> Fields { get { return new List<String>(fields); } }
|
||||
public static List<String> FieldsId { get { return new List<String>(fieldsId); } }
|
||||
public static List<String> FieldsNonId { get { return fields.FindAll(item => !fieldsId.ContainsCI(item)); } }
|
||||
// Columns.
|
||||
public ColumnsData Cols { get; } = new ColumnsData();
|
||||
public Int32 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } }
|
||||
public Int32 _DatabaseId { get { return Cols._DatabaseId.Value; } set { Cols._DatabaseId.Value = value; } }
|
||||
public String _EmailAddress { get { return Cols._EmailAddress.Value; } set { Cols._EmailAddress.Value = value; } }
|
||||
public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } }
|
||||
public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
|
||||
public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
|
||||
public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
|
||||
public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
|
||||
public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
|
||||
public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
|
||||
public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
|
||||
public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
|
||||
// Existing columns - confirmed on database if table exists.
|
||||
public List<String> ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
|
||||
public List<String> ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
{
|
||||
dbDataReader.Read();
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_DatabaseId = GetFieldInt32(dbDataReader, "DatabaseId", _DatabaseId);
|
||||
_EmailAddress = GetFieldString(dbDataReader, "EmailAddress", _EmailAddress);
|
||||
_Notes = GetFieldString(dbDataReader, "Notes", _Notes);
|
||||
_Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
|
||||
_Status = GetFieldString(dbDataReader, "Status", _Status);
|
||||
_CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
|
||||
_CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
|
||||
_CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
|
||||
_UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
|
||||
_UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
|
||||
_UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Avoid insert if Identity field is already valid.
|
||||
if (_Id != 0) throw new Exception("Invalid for Insert - item already has a valid Id");
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
query += "Output Inserted.Id ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
dbCommand.CommandText = query;
|
||||
Log(GetType().Name + ".ExecuteInsertCommand", dbCommand.CommandText);
|
||||
// Populate parameters.
|
||||
dbCommand.Parameters.Clear();
|
||||
if (columnNames.ContainsCI("DatabaseId")) AddCommandParameter(dbCommand, "@DatabaseId", _DatabaseId);
|
||||
if (columnNames.ContainsCI("EmailAddress")) AddCommandParameter(dbCommand, "@EmailAddress", _EmailAddress);
|
||||
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
|
||||
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
|
||||
if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
|
||||
if (columnNames.ContainsCI("CreateOn")) AddCommandParameter(dbCommand, "@CreateOn", _CreateOn);
|
||||
if (columnNames.ContainsCI("CreateBy")) AddCommandParameter(dbCommand, "@CreateBy", _CreateBy);
|
||||
if (columnNames.ContainsCI("CreateHost")) AddCommandParameter(dbCommand, "@CreateHost", _CreateHost);
|
||||
if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
|
||||
if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
|
||||
if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
|
||||
// Execute insert command.
|
||||
bool commandSuccess = false;
|
||||
int executeNonQuery = dbCommand.ExecuteNonQuery();
|
||||
if (executeNonQuery == 1)
|
||||
{
|
||||
dbCommand.CommandText = "SELECT Max(Id) FROM " + TableNameFmt + ";";
|
||||
_Id = (Int32)Convert.ToInt64(dbCommand.ExecuteScalar());
|
||||
commandSuccess = (_Id > 0);
|
||||
}
|
||||
return commandSuccess;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Avoid update if Identity field isn't valid.
|
||||
if (_Id == 0) throw new Exception("Invalid for Update - item has an invalid Id");
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
// Construct query.
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
{
|
||||
query += columnNames.Concat(", ", "", "=?") + " ";
|
||||
query += "WHERE Id=?;";
|
||||
}
|
||||
dbCommand.CommandText = query;
|
||||
Log(GetType().Name + ".ExecuteUpdateCommand", dbCommand.CommandText);
|
||||
// Populate parameters.
|
||||
dbCommand.Parameters.Clear();
|
||||
if (columnNames.ContainsCI("DatabaseId")) AddCommandParameter(dbCommand, "@DatabaseId", _DatabaseId);
|
||||
if (columnNames.ContainsCI("EmailAddress")) AddCommandParameter(dbCommand, "@EmailAddress", _EmailAddress);
|
||||
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
|
||||
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
|
||||
if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
|
||||
if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
|
||||
if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
|
||||
if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
|
||||
AddCommandParameter(dbCommand, "@Id", _Id);
|
||||
int executeNonQueryResult = dbCommand.ExecuteNonQuery();
|
||||
return (executeNonQueryResult == 1);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:28
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal.Control
|
||||
{
|
||||
internal class Database_Db : SbmDbDataItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Column definitions.
|
||||
public class ColumnsData
|
||||
{
|
||||
public ColumnDataInt32 _Id { get; } = new ColumnDataInt32("Id", true);
|
||||
public ColumnDataString _ServerName { get; } = new ColumnDataString("ServerName");
|
||||
public ColumnDataString _InstanceName { get; } = new ColumnDataString("InstanceName");
|
||||
public ColumnDataString _DatabaseName { get; } = new ColumnDataString("DatabaseName");
|
||||
public ColumnDataString _UserName { get; } = new ColumnDataString("UserName");
|
||||
public ColumnDataString _Password { get; } = new ColumnDataString("Password");
|
||||
public ColumnDataString _OrganisationName { get; } = new ColumnDataString("OrganisationName");
|
||||
public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
|
||||
public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
|
||||
public ColumnDataString _Status { get; } = new ColumnDataString("Status");
|
||||
public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
|
||||
public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
|
||||
public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
|
||||
public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
|
||||
public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
|
||||
public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
protected static List<String> fields { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
"ServerName",
|
||||
"InstanceName",
|
||||
"DatabaseName",
|
||||
"UserName",
|
||||
"Password",
|
||||
"OrganisationName",
|
||||
"Notes",
|
||||
"Flags",
|
||||
"Status",
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
"CreateHost",
|
||||
"UpdateOn",
|
||||
"UpdateBy",
|
||||
"UpdateHost",
|
||||
};
|
||||
protected static List<String> fieldsId { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
};
|
||||
protected static List<String> fieldsPrimary { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
};
|
||||
protected static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
|
||||
{
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
"CreateHost",
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal Database_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public override String SchemaName { get; } = "dbo";
|
||||
public override String TableName { get; } = "Database";
|
||||
public String TableNameFmt { get { return (!String.IsNullOrEmpty(SchemaName) ? "[" + SchemaName + "]." : "") + "[" + TableName + "]"; } }
|
||||
public static List<String> Fields { get { return new List<String>(fields); } }
|
||||
public static List<String> FieldsId { get { return new List<String>(fieldsId); } }
|
||||
public static List<String> FieldsNonId { get { return fields.FindAll(item => !fieldsId.ContainsCI(item)); } }
|
||||
// Columns.
|
||||
public ColumnsData Cols { get; } = new ColumnsData();
|
||||
public Int32 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } }
|
||||
public String _ServerName { get { return Cols._ServerName.Value; } set { Cols._ServerName.Value = value; } }
|
||||
public String _InstanceName { get { return Cols._InstanceName.Value; } set { Cols._InstanceName.Value = value; } }
|
||||
public String _DatabaseName { get { return Cols._DatabaseName.Value; } set { Cols._DatabaseName.Value = value; } }
|
||||
public String _UserName { get { return Cols._UserName.Value; } set { Cols._UserName.Value = value; } }
|
||||
public String _Password { get { return Cols._Password.Value; } set { Cols._Password.Value = value; } }
|
||||
public String _OrganisationName { get { return Cols._OrganisationName.Value; } set { Cols._OrganisationName.Value = value; } }
|
||||
public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } }
|
||||
public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
|
||||
public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
|
||||
public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
|
||||
public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
|
||||
public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
|
||||
public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
|
||||
public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
|
||||
public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
|
||||
// Existing columns - confirmed on database if table exists.
|
||||
public List<String> ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
|
||||
public List<String> ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
{
|
||||
dbDataReader.Read();
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_ServerName = GetFieldString(dbDataReader, "ServerName", _ServerName);
|
||||
_InstanceName = GetFieldString(dbDataReader, "InstanceName", _InstanceName);
|
||||
_DatabaseName = GetFieldString(dbDataReader, "DatabaseName", _DatabaseName);
|
||||
_UserName = GetFieldString(dbDataReader, "UserName", _UserName);
|
||||
_Password = GetFieldString(dbDataReader, "Password", _Password);
|
||||
_OrganisationName = GetFieldString(dbDataReader, "OrganisationName", _OrganisationName);
|
||||
_Notes = GetFieldString(dbDataReader, "Notes", _Notes);
|
||||
_Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
|
||||
_Status = GetFieldString(dbDataReader, "Status", _Status);
|
||||
_CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
|
||||
_CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
|
||||
_CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
|
||||
_UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
|
||||
_UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
|
||||
_UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Avoid insert if Identity field is already valid.
|
||||
if (_Id != 0) throw new Exception("Invalid for Insert - item already has a valid Id");
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
query += "Output Inserted.Id ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
dbCommand.CommandText = query;
|
||||
Log(GetType().Name + ".ExecuteInsertCommand", dbCommand.CommandText);
|
||||
// Populate parameters.
|
||||
dbCommand.Parameters.Clear();
|
||||
if (columnNames.ContainsCI("ServerName")) AddCommandParameter(dbCommand, "@ServerName", _ServerName);
|
||||
if (columnNames.ContainsCI("InstanceName")) AddCommandParameter(dbCommand, "@InstanceName", _InstanceName);
|
||||
if (columnNames.ContainsCI("DatabaseName")) AddCommandParameter(dbCommand, "@DatabaseName", _DatabaseName);
|
||||
if (columnNames.ContainsCI("UserName")) AddCommandParameter(dbCommand, "@UserName", _UserName);
|
||||
if (columnNames.ContainsCI("Password")) AddCommandParameter(dbCommand, "@Password", _Password);
|
||||
if (columnNames.ContainsCI("OrganisationName")) AddCommandParameter(dbCommand, "@OrganisationName", _OrganisationName);
|
||||
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
|
||||
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
|
||||
if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
|
||||
if (columnNames.ContainsCI("CreateOn")) AddCommandParameter(dbCommand, "@CreateOn", _CreateOn);
|
||||
if (columnNames.ContainsCI("CreateBy")) AddCommandParameter(dbCommand, "@CreateBy", _CreateBy);
|
||||
if (columnNames.ContainsCI("CreateHost")) AddCommandParameter(dbCommand, "@CreateHost", _CreateHost);
|
||||
if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
|
||||
if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
|
||||
if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
|
||||
// Execute insert command.
|
||||
bool commandSuccess = false;
|
||||
int executeNonQuery = dbCommand.ExecuteNonQuery();
|
||||
if (executeNonQuery == 1)
|
||||
{
|
||||
dbCommand.CommandText = "SELECT Max(Id) FROM " + TableNameFmt + ";";
|
||||
_Id = (Int32)Convert.ToInt64(dbCommand.ExecuteScalar());
|
||||
commandSuccess = (_Id > 0);
|
||||
}
|
||||
return commandSuccess;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Avoid update if Identity field isn't valid.
|
||||
if (_Id == 0) throw new Exception("Invalid for Update - item has an invalid Id");
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
// Construct query.
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
{
|
||||
query += columnNames.Concat(", ", "", "=?") + " ";
|
||||
query += "WHERE Id=?;";
|
||||
}
|
||||
dbCommand.CommandText = query;
|
||||
Log(GetType().Name + ".ExecuteUpdateCommand", dbCommand.CommandText);
|
||||
// Populate parameters.
|
||||
dbCommand.Parameters.Clear();
|
||||
if (columnNames.ContainsCI("ServerName")) AddCommandParameter(dbCommand, "@ServerName", _ServerName);
|
||||
if (columnNames.ContainsCI("InstanceName")) AddCommandParameter(dbCommand, "@InstanceName", _InstanceName);
|
||||
if (columnNames.ContainsCI("DatabaseName")) AddCommandParameter(dbCommand, "@DatabaseName", _DatabaseName);
|
||||
if (columnNames.ContainsCI("UserName")) AddCommandParameter(dbCommand, "@UserName", _UserName);
|
||||
if (columnNames.ContainsCI("Password")) AddCommandParameter(dbCommand, "@Password", _Password);
|
||||
if (columnNames.ContainsCI("OrganisationName")) AddCommandParameter(dbCommand, "@OrganisationName", _OrganisationName);
|
||||
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
|
||||
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
|
||||
if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
|
||||
if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
|
||||
if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
|
||||
if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
|
||||
AddCommandParameter(dbCommand, "@Id", _Id);
|
||||
int executeNonQueryResult = dbCommand.ExecuteNonQuery();
|
||||
return (executeNonQueryResult == 1);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:28
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal.Control
|
||||
{
|
||||
internal class UserAccount_Db : SbmDbDataItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Column definitions.
|
||||
public class ColumnsData
|
||||
{
|
||||
public ColumnDataInt32 _Id { get; } = new ColumnDataInt32("Id", true);
|
||||
public ColumnDataString _EmailAddress { get; } = new ColumnDataString("EmailAddress");
|
||||
public ColumnDataString _Title { get; } = new ColumnDataString("Title");
|
||||
public ColumnDataString _FirstName { get; } = new ColumnDataString("FirstName");
|
||||
public ColumnDataString _Initials { get; } = new ColumnDataString("Initials");
|
||||
public ColumnDataString _LastName { get; } = new ColumnDataString("LastName");
|
||||
public ColumnDataString _PhoneMain { get; } = new ColumnDataString("PhoneMain");
|
||||
public ColumnDataString _PhoneMobile { get; } = new ColumnDataString("PhoneMobile");
|
||||
public ColumnDataString _PhoneAlt { get; } = new ColumnDataString("PhoneAlt");
|
||||
public ColumnDataString _PasswordToken { get; } = new ColumnDataString("PasswordToken");
|
||||
public ColumnDataString _PasswordHashed { get; } = new ColumnDataString("PasswordHashed");
|
||||
public ColumnDataString _PasswordHistory { get; } = new ColumnDataString("PasswordHistory");
|
||||
public ColumnDataDateTime _PasswordChangedAt { get; } = new ColumnDataDateTime("PasswordChangedAt");
|
||||
public ColumnDataDateTime _LastLoginAt { get; } = new ColumnDataDateTime("LastLoginAt");
|
||||
public ColumnDataDateTime _LastInvalidLoginAt { get; } = new ColumnDataDateTime("LastInvalidLoginAt");
|
||||
public ColumnDataInt16 _InvalidLoginCount { get; } = new ColumnDataInt16("InvalidLoginCount");
|
||||
public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
|
||||
public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
|
||||
public ColumnDataString _Status { get; } = new ColumnDataString("Status");
|
||||
public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
|
||||
public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
|
||||
public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
|
||||
public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
|
||||
public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
|
||||
public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
protected static List<String> fields { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
"EmailAddress",
|
||||
"Title",
|
||||
"FirstName",
|
||||
"Initials",
|
||||
"LastName",
|
||||
"PhoneMain",
|
||||
"PhoneMobile",
|
||||
"PhoneAlt",
|
||||
"PasswordToken",
|
||||
"PasswordHashed",
|
||||
"PasswordHistory",
|
||||
"PasswordChangedAt",
|
||||
"LastLoginAt",
|
||||
"LastInvalidLoginAt",
|
||||
"InvalidLoginCount",
|
||||
"Notes",
|
||||
"Flags",
|
||||
"Status",
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
"CreateHost",
|
||||
"UpdateOn",
|
||||
"UpdateBy",
|
||||
"UpdateHost",
|
||||
};
|
||||
protected static List<String> fieldsId { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
};
|
||||
protected static List<String> fieldsPrimary { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
};
|
||||
protected static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
|
||||
{
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
"CreateHost",
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal UserAccount_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public override String SchemaName { get; } = "dbo";
|
||||
public override String TableName { get; } = "UserAccount";
|
||||
public String TableNameFmt { get { return (!String.IsNullOrEmpty(SchemaName) ? "[" + SchemaName + "]." : "") + "[" + TableName + "]"; } }
|
||||
public static List<String> Fields { get { return new List<String>(fields); } }
|
||||
public static List<String> FieldsId { get { return new List<String>(fieldsId); } }
|
||||
public static List<String> FieldsNonId { get { return fields.FindAll(item => !fieldsId.ContainsCI(item)); } }
|
||||
// Columns.
|
||||
public ColumnsData Cols { get; } = new ColumnsData();
|
||||
public Int32 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } }
|
||||
public String _EmailAddress { get { return Cols._EmailAddress.Value; } set { Cols._EmailAddress.Value = value; } }
|
||||
public String _Title { get { return Cols._Title.Value; } set { Cols._Title.Value = value; } }
|
||||
public String _FirstName { get { return Cols._FirstName.Value; } set { Cols._FirstName.Value = value; } }
|
||||
public String _Initials { get { return Cols._Initials.Value; } set { Cols._Initials.Value = value; } }
|
||||
public String _LastName { get { return Cols._LastName.Value; } set { Cols._LastName.Value = value; } }
|
||||
public String _PhoneMain { get { return Cols._PhoneMain.Value; } set { Cols._PhoneMain.Value = value; } }
|
||||
public String _PhoneMobile { get { return Cols._PhoneMobile.Value; } set { Cols._PhoneMobile.Value = value; } }
|
||||
public String _PhoneAlt { get { return Cols._PhoneAlt.Value; } set { Cols._PhoneAlt.Value = value; } }
|
||||
public String _PasswordToken { get { return Cols._PasswordToken.Value; } set { Cols._PasswordToken.Value = value; } }
|
||||
public String _PasswordHashed { get { return Cols._PasswordHashed.Value; } set { Cols._PasswordHashed.Value = value; } }
|
||||
public String _PasswordHistory { get { return Cols._PasswordHistory.Value; } set { Cols._PasswordHistory.Value = value; } }
|
||||
public DateTime _PasswordChangedAt { get { return Cols._PasswordChangedAt.Value; } set { Cols._PasswordChangedAt.Value = value; } }
|
||||
public DateTime _LastLoginAt { get { return Cols._LastLoginAt.Value; } set { Cols._LastLoginAt.Value = value; } }
|
||||
public DateTime _LastInvalidLoginAt { get { return Cols._LastInvalidLoginAt.Value; } set { Cols._LastInvalidLoginAt.Value = value; } }
|
||||
public Int16 _InvalidLoginCount { get { return Cols._InvalidLoginCount.Value; } set { Cols._InvalidLoginCount.Value = value; } }
|
||||
public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } }
|
||||
public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
|
||||
public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
|
||||
public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
|
||||
public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
|
||||
public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
|
||||
public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
|
||||
public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
|
||||
public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
|
||||
// Existing columns - confirmed on database if table exists.
|
||||
public List<String> ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
|
||||
public List<String> ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
{
|
||||
dbDataReader.Read();
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_EmailAddress = GetFieldString(dbDataReader, "EmailAddress", _EmailAddress);
|
||||
_Title = GetFieldString(dbDataReader, "Title", _Title);
|
||||
_FirstName = GetFieldString(dbDataReader, "FirstName", _FirstName);
|
||||
_Initials = GetFieldString(dbDataReader, "Initials", _Initials);
|
||||
_LastName = GetFieldString(dbDataReader, "LastName", _LastName);
|
||||
_PhoneMain = GetFieldString(dbDataReader, "PhoneMain", _PhoneMain);
|
||||
_PhoneMobile = GetFieldString(dbDataReader, "PhoneMobile", _PhoneMobile);
|
||||
_PhoneAlt = GetFieldString(dbDataReader, "PhoneAlt", _PhoneAlt);
|
||||
_PasswordToken = GetFieldString(dbDataReader, "PasswordToken", _PasswordToken);
|
||||
_PasswordHashed = GetFieldString(dbDataReader, "PasswordHashed", _PasswordHashed);
|
||||
_PasswordHistory = GetFieldString(dbDataReader, "PasswordHistory", _PasswordHistory);
|
||||
_PasswordChangedAt = GetFieldDateTime(dbDataReader, "PasswordChangedAt", _PasswordChangedAt);
|
||||
_LastLoginAt = GetFieldDateTime(dbDataReader, "LastLoginAt", _LastLoginAt);
|
||||
_LastInvalidLoginAt = GetFieldDateTime(dbDataReader, "LastInvalidLoginAt", _LastInvalidLoginAt);
|
||||
_InvalidLoginCount = GetFieldInt16(dbDataReader, "InvalidLoginCount", _InvalidLoginCount);
|
||||
_Notes = GetFieldString(dbDataReader, "Notes", _Notes);
|
||||
_Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
|
||||
_Status = GetFieldString(dbDataReader, "Status", _Status);
|
||||
_CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
|
||||
_CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
|
||||
_CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
|
||||
_UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
|
||||
_UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
|
||||
_UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Avoid insert if Identity field is already valid.
|
||||
if (_Id != 0) throw new Exception("Invalid for Insert - item already has a valid Id");
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
query += "Output Inserted.Id ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
dbCommand.CommandText = query;
|
||||
Log(GetType().Name + ".ExecuteInsertCommand", dbCommand.CommandText);
|
||||
// Populate parameters.
|
||||
dbCommand.Parameters.Clear();
|
||||
if (columnNames.ContainsCI("EmailAddress")) AddCommandParameter(dbCommand, "@EmailAddress", _EmailAddress);
|
||||
if (columnNames.ContainsCI("Title")) AddCommandParameter(dbCommand, "@Title", _Title);
|
||||
if (columnNames.ContainsCI("FirstName")) AddCommandParameter(dbCommand, "@FirstName", _FirstName);
|
||||
if (columnNames.ContainsCI("Initials")) AddCommandParameter(dbCommand, "@Initials", _Initials);
|
||||
if (columnNames.ContainsCI("LastName")) AddCommandParameter(dbCommand, "@LastName", _LastName);
|
||||
if (columnNames.ContainsCI("PhoneMain")) AddCommandParameter(dbCommand, "@PhoneMain", _PhoneMain);
|
||||
if (columnNames.ContainsCI("PhoneMobile")) AddCommandParameter(dbCommand, "@PhoneMobile", _PhoneMobile);
|
||||
if (columnNames.ContainsCI("PhoneAlt")) AddCommandParameter(dbCommand, "@PhoneAlt", _PhoneAlt);
|
||||
if (columnNames.ContainsCI("PasswordToken")) AddCommandParameter(dbCommand, "@PasswordToken", _PasswordToken);
|
||||
if (columnNames.ContainsCI("PasswordHashed")) AddCommandParameter(dbCommand, "@PasswordHashed", _PasswordHashed);
|
||||
if (columnNames.ContainsCI("PasswordHistory")) AddCommandParameter(dbCommand, "@PasswordHistory", _PasswordHistory);
|
||||
if (columnNames.ContainsCI("PasswordChangedAt")) AddCommandParameter(dbCommand, "@PasswordChangedAt", _PasswordChangedAt);
|
||||
if (columnNames.ContainsCI("LastLoginAt")) AddCommandParameter(dbCommand, "@LastLoginAt", _LastLoginAt);
|
||||
if (columnNames.ContainsCI("LastInvalidLoginAt")) AddCommandParameter(dbCommand, "@LastInvalidLoginAt", _LastInvalidLoginAt);
|
||||
if (columnNames.ContainsCI("InvalidLoginCount")) AddCommandParameter(dbCommand, "@InvalidLoginCount", _InvalidLoginCount);
|
||||
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
|
||||
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
|
||||
if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
|
||||
if (columnNames.ContainsCI("CreateOn")) AddCommandParameter(dbCommand, "@CreateOn", _CreateOn);
|
||||
if (columnNames.ContainsCI("CreateBy")) AddCommandParameter(dbCommand, "@CreateBy", _CreateBy);
|
||||
if (columnNames.ContainsCI("CreateHost")) AddCommandParameter(dbCommand, "@CreateHost", _CreateHost);
|
||||
if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
|
||||
if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
|
||||
if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
|
||||
// Execute insert command.
|
||||
bool commandSuccess = false;
|
||||
int executeNonQuery = dbCommand.ExecuteNonQuery();
|
||||
if (executeNonQuery == 1)
|
||||
{
|
||||
dbCommand.CommandText = "SELECT Max(Id) FROM " + TableNameFmt + ";";
|
||||
_Id = (Int32)Convert.ToInt64(dbCommand.ExecuteScalar());
|
||||
commandSuccess = (_Id > 0);
|
||||
}
|
||||
return commandSuccess;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Avoid update if Identity field isn't valid.
|
||||
if (_Id == 0) throw new Exception("Invalid for Update - item has an invalid Id");
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
// Construct query.
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
{
|
||||
query += columnNames.Concat(", ", "", "=?") + " ";
|
||||
query += "WHERE Id=?;";
|
||||
}
|
||||
dbCommand.CommandText = query;
|
||||
Log(GetType().Name + ".ExecuteUpdateCommand", dbCommand.CommandText);
|
||||
// Populate parameters.
|
||||
dbCommand.Parameters.Clear();
|
||||
if (columnNames.ContainsCI("EmailAddress")) AddCommandParameter(dbCommand, "@EmailAddress", _EmailAddress);
|
||||
if (columnNames.ContainsCI("Title")) AddCommandParameter(dbCommand, "@Title", _Title);
|
||||
if (columnNames.ContainsCI("FirstName")) AddCommandParameter(dbCommand, "@FirstName", _FirstName);
|
||||
if (columnNames.ContainsCI("Initials")) AddCommandParameter(dbCommand, "@Initials", _Initials);
|
||||
if (columnNames.ContainsCI("LastName")) AddCommandParameter(dbCommand, "@LastName", _LastName);
|
||||
if (columnNames.ContainsCI("PhoneMain")) AddCommandParameter(dbCommand, "@PhoneMain", _PhoneMain);
|
||||
if (columnNames.ContainsCI("PhoneMobile")) AddCommandParameter(dbCommand, "@PhoneMobile", _PhoneMobile);
|
||||
if (columnNames.ContainsCI("PhoneAlt")) AddCommandParameter(dbCommand, "@PhoneAlt", _PhoneAlt);
|
||||
if (columnNames.ContainsCI("PasswordToken")) AddCommandParameter(dbCommand, "@PasswordToken", _PasswordToken);
|
||||
if (columnNames.ContainsCI("PasswordHashed")) AddCommandParameter(dbCommand, "@PasswordHashed", _PasswordHashed);
|
||||
if (columnNames.ContainsCI("PasswordHistory")) AddCommandParameter(dbCommand, "@PasswordHistory", _PasswordHistory);
|
||||
if (columnNames.ContainsCI("PasswordChangedAt")) AddCommandParameter(dbCommand, "@PasswordChangedAt", _PasswordChangedAt);
|
||||
if (columnNames.ContainsCI("LastLoginAt")) AddCommandParameter(dbCommand, "@LastLoginAt", _LastLoginAt);
|
||||
if (columnNames.ContainsCI("LastInvalidLoginAt")) AddCommandParameter(dbCommand, "@LastInvalidLoginAt", _LastInvalidLoginAt);
|
||||
if (columnNames.ContainsCI("InvalidLoginCount")) AddCommandParameter(dbCommand, "@InvalidLoginCount", _InvalidLoginCount);
|
||||
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
|
||||
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
|
||||
if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
|
||||
if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
|
||||
if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
|
||||
if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
|
||||
AddCommandParameter(dbCommand, "@Id", _Id);
|
||||
int executeNonQueryResult = dbCommand.ExecuteNonQuery();
|
||||
return (executeNonQueryResult == 1);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -74,7 +74,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal Currency_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal Currency_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -110,11 +110,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -123,7 +123,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_Code = GetFieldString(dbDataReader, "Code", _Code);
|
||||
@@ -145,13 +145,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -187,7 +187,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -195,7 +195,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -67,7 +67,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal IndexDefragLog_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal IndexDefragLog_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -99,11 +99,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -112,7 +112,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_IndexDefragId = GetFieldInt32(dbDataReader, "IndexDefragId", _IndexDefragId);
|
||||
_DatabaseID = GetFieldInt32(dbDataReader, "DatabaseID", _DatabaseID);
|
||||
@@ -130,15 +130,15 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Avoid insert if Identity field is already valid.
|
||||
if (_IndexDefragId != 0) throw new Exception("Invalid for Insert - item already has a valid Id");
|
||||
if (_IndexDefragId != 0) throw new Exception("Invalid for Insert - item already has a valid Id");
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
query += "Output Inserted.IndexDefragId ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
@@ -164,7 +164,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
if (executeNonQuery == 1)
|
||||
{
|
||||
dbCommand.CommandText = "SELECT Max(IndexDefragId) FROM " + TableNameFmt + ";";
|
||||
_IndexDefragId = Convert.ToInt32(dbCommand.ExecuteScalar());
|
||||
_IndexDefragId = (Int32)Convert.ToInt64(dbCommand.ExecuteScalar());
|
||||
commandSuccess = (_IndexDefragId > 0);
|
||||
}
|
||||
return commandSuccess;
|
||||
@@ -172,17 +172,17 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Avoid update if Identity field isn't valid.
|
||||
if (_IndexDefragId == 0) throw new Exception("Invalid for Update - item has an invalid Id");
|
||||
if (_IndexDefragId == 0) throw new Exception("Invalid for Update - item has an invalid Id");
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
// Construct query.
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE IndexDefragId=@IndexDefragId;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -82,7 +82,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal InterfaceDataItem_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal InterfaceDataItem_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -122,11 +122,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -135,7 +135,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_InterfaceId = GetFieldInt32(dbDataReader, "InterfaceId", _InterfaceId);
|
||||
@@ -161,13 +161,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -207,7 +207,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -215,7 +215,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -65,7 +65,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal InterfaceProcessDataItem_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal InterfaceProcessDataItem_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -96,11 +96,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -109,7 +109,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_ProcessId = GetFieldInt32(dbDataReader, "ProcessId", _ProcessId);
|
||||
_InterfaceDataItemId = GetFieldInt32(dbDataReader, "InterfaceDataItemId", _InterfaceDataItemId);
|
||||
@@ -126,13 +126,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -163,7 +163,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -171,7 +171,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE ProcessId=@ProcessId AND InterfaceDataItemId=@InterfaceDataItemId;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -74,7 +74,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal InterfaceProcessMessage_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal InterfaceProcessMessage_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -110,11 +110,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -123,7 +123,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_ProcessId = GetFieldInt32(dbDataReader, "ProcessId", _ProcessId);
|
||||
@@ -145,13 +145,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -187,7 +187,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -195,7 +195,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -80,7 +80,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal InterfaceProcess_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal InterfaceProcess_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -119,11 +119,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -132,7 +132,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_InterfaceId = GetFieldInt32(dbDataReader, "InterfaceId", _InterfaceId);
|
||||
@@ -157,13 +157,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -202,7 +202,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -210,7 +210,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -72,7 +72,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal Interface_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal Interface_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -107,11 +107,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -120,7 +120,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_Context = GetFieldString(dbDataReader, "Context", _Context);
|
||||
@@ -141,13 +141,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -182,7 +182,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -190,7 +190,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -72,7 +72,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal ItemBatch_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal ItemBatch_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -107,11 +107,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -120,7 +120,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_AffIdOwner = GetFieldInt32(dbDataReader, "AffIdOwner", _AffIdOwner);
|
||||
@@ -141,13 +141,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -182,7 +182,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -190,7 +190,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -81,7 +81,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal ItemLink_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal ItemLink_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -118,11 +118,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -131,7 +131,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Type = GetFieldInt16(dbDataReader, "Type", _Type);
|
||||
_ItemTypeFrom = GetFieldInt16(dbDataReader, "ItemTypeFrom", _ItemTypeFrom);
|
||||
@@ -154,13 +154,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -197,7 +197,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -205,7 +205,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Type=@Type AND ItemTypeFrom=@ItemTypeFrom AND ItemIdFrom=@ItemIdFrom AND ItemTypeTo=@ItemTypeTo AND ItemIdTo=@ItemIdTo AND Seq=@Seq;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -66,7 +66,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal Language_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal Language_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -98,11 +98,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -111,7 +111,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_Code = GetFieldString(dbDataReader, "Code", _Code);
|
||||
@@ -129,13 +129,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -167,7 +167,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -175,7 +175,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -70,7 +70,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal Location_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal Location_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -104,11 +104,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -117,7 +117,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_AffIdOwner = GetFieldInt32(dbDataReader, "AffIdOwner", _AffIdOwner);
|
||||
@@ -137,13 +137,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -177,7 +177,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -185,7 +185,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -82,7 +82,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal Movement_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal Movement_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -122,11 +122,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -135,7 +135,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_ItemType = GetFieldInt16(dbDataReader, "ItemType", _ItemType);
|
||||
@@ -161,13 +161,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -207,7 +207,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -215,7 +215,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -84,7 +84,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal PortfolioItem_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal PortfolioItem_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -125,11 +125,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -138,7 +138,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_AffIdOwner = GetFieldInt32(dbDataReader, "AffIdOwner", _AffIdOwner);
|
||||
@@ -165,13 +165,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -212,7 +212,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -220,7 +220,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -74,7 +74,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal Process_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal Process_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -110,11 +110,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -123,7 +123,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_AffIdOwner = GetFieldInt32(dbDataReader, "AffIdOwner", _AffIdOwner);
|
||||
@@ -145,13 +145,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -187,7 +187,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -195,7 +195,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -68,7 +68,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal Region_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal Region_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -101,11 +101,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -114,7 +114,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_Type = GetFieldString(dbDataReader, "Type", _Type);
|
||||
@@ -133,13 +133,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -172,7 +172,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -180,7 +180,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -162,7 +162,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal Requirement_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal Requirement_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -242,11 +242,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -255,7 +255,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_AffIdOwner = GetFieldInt32(dbDataReader, "AffIdOwner", _AffIdOwner);
|
||||
@@ -321,13 +321,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -407,7 +407,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -415,7 +415,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -94,7 +94,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal SaAssetCategory_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal SaAssetCategory_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -140,11 +140,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -153,7 +153,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_AffIdOwner = GetFieldInt32(dbDataReader, "AffIdOwner", _AffIdOwner);
|
||||
@@ -185,13 +185,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -237,7 +237,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -245,7 +245,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -74,7 +74,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal SaAssetProcess_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal SaAssetProcess_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -110,11 +110,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -123,7 +123,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_AssetId = GetFieldInt32(dbDataReader, "AssetId", _AssetId);
|
||||
@@ -145,13 +145,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -187,7 +187,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -195,7 +195,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -132,7 +132,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal SaAsset_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal SaAsset_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -197,11 +197,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -210,7 +210,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_AssetCategoryId = GetFieldInt32(dbDataReader, "AssetCategoryId", _AssetCategoryId);
|
||||
@@ -261,13 +261,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -332,7 +332,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -340,7 +340,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -74,7 +74,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal SaDiaryEntry_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal SaDiaryEntry_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -110,11 +110,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -123,7 +123,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_Category = GetFieldInt16(dbDataReader, "Category", _Category);
|
||||
@@ -145,13 +145,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -187,7 +187,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -195,7 +195,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -68,7 +68,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal SaDiaryLink_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal SaDiaryLink_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -100,11 +100,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -113,7 +113,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_EntryId = GetFieldInt32(dbDataReader, "EntryId", _EntryId);
|
||||
_ItemType = GetFieldInt16(dbDataReader, "ItemType", _ItemType);
|
||||
@@ -131,13 +131,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -169,7 +169,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -177,7 +177,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE EntryId=@EntryId AND ItemType=@ItemType AND ItemId=@ItemId;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -72,7 +72,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal SaPriceSet_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal SaPriceSet_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -107,11 +107,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -120,7 +120,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_AffIdOwner = GetFieldInt32(dbDataReader, "AffIdOwner", _AffIdOwner);
|
||||
@@ -141,13 +141,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -182,7 +182,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -190,7 +190,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -79,7 +79,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal SaPrice_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal SaPrice_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -117,11 +117,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -130,7 +130,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_PriceSetId = GetFieldInt32(dbDataReader, "PriceSetId", _PriceSetId);
|
||||
_CommodityId = GetFieldInt32(dbDataReader, "CommodityId", _CommodityId);
|
||||
@@ -154,13 +154,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -198,7 +198,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -206,7 +206,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE PriceSetId=@PriceSetId AND CommodityId=@CommodityId;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -98,7 +98,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal SaVehicleClass_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal SaVehicleClass_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -146,11 +146,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -159,7 +159,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_MakeCode = GetFieldString(dbDataReader, "MakeCode", _MakeCode);
|
||||
@@ -193,13 +193,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -247,7 +247,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -255,7 +255,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -86,7 +86,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal SaVehicleEvent_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal SaVehicleEvent_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -128,11 +128,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -141,7 +141,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_VehicleId = GetFieldInt32(dbDataReader, "VehicleId", _VehicleId);
|
||||
@@ -169,13 +169,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -217,7 +217,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -225,7 +225,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -74,7 +74,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal SaVehicleFeature_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal SaVehicleFeature_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -110,11 +110,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -123,7 +123,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_VehicleId = GetFieldInt32(dbDataReader, "VehicleId", _VehicleId);
|
||||
_Source = GetFieldInt16(dbDataReader, "Source", _Source);
|
||||
@@ -145,13 +145,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -187,7 +187,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -195,7 +195,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE VehicleId=@VehicleId;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -116,7 +116,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal SaVehicle_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal SaVehicle_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -173,11 +173,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -186,7 +186,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_VehicleClassId = GetFieldInt32(dbDataReader, "VehicleClassId", _VehicleClassId);
|
||||
@@ -229,13 +229,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -292,7 +292,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -300,7 +300,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -80,7 +80,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal StockLevel_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal StockLevel_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -119,11 +119,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -132,7 +132,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_CommodityId = GetFieldInt32(dbDataReader, "CommodityId", _CommodityId);
|
||||
@@ -157,13 +157,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -202,7 +202,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -210,7 +210,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -72,7 +72,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal SysParam_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal SysParam_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -107,11 +107,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -120,7 +120,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_Cat = GetFieldInt16(dbDataReader, "Cat", _Cat);
|
||||
@@ -141,13 +141,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -182,7 +182,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -190,7 +190,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -65,7 +65,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal SystemAccountUser_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal SystemAccountUser_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -96,11 +96,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -109,7 +109,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_AccountId = GetFieldInt32(dbDataReader, "AccountId", _AccountId);
|
||||
_UserId = GetFieldInt32(dbDataReader, "UserId", _UserId);
|
||||
@@ -126,13 +126,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -163,7 +163,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -171,7 +171,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE AccountId=@AccountId AND UserId=@UserId;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -76,7 +76,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal SystemAccount_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal SystemAccount_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -113,11 +113,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -126,7 +126,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_AffIdOwner = GetFieldInt32(dbDataReader, "AffIdOwner", _AffIdOwner);
|
||||
@@ -149,13 +149,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -192,7 +192,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -200,7 +200,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -72,7 +72,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal SystemUser_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal SystemUser_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -107,11 +107,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -120,7 +120,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_AffIdOwner = GetFieldInt32(dbDataReader, "AffIdOwner", _AffIdOwner);
|
||||
@@ -141,13 +141,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -182,7 +182,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -190,7 +190,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -82,7 +82,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal TaxCode_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal TaxCode_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -122,11 +122,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -135,7 +135,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_Code = GetFieldString(dbDataReader, "Code", _Code);
|
||||
@@ -161,13 +161,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -207,7 +207,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -215,7 +215,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -188,7 +188,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal Transaction_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal Transaction_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -281,11 +281,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -294,7 +294,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_AffIdOwner = GetFieldInt32(dbDataReader, "AffIdOwner", _AffIdOwner);
|
||||
@@ -373,13 +373,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -472,7 +472,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -480,7 +480,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 8-Jun-2020 16:53:26
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -88,7 +88,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal UnitMeasure_Db(IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
internal UnitMeasure_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -131,11 +131,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom(DbCommand dbCommand, String tableAlias, String filter)
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
@@ -144,7 +144,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom(DbDataReader dbDataReader)
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||
_Category = GetFieldInt16(dbDataReader, "Category", _Category);
|
||||
@@ -173,13 +173,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"(" + columnNames.Concat(",", "[", "]") + ") ";
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
@@ -222,7 +222,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand(DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
@@ -230,7 +230,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Internal
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[", "]"), columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Utils
|
||||
public static bool Generate(DatabaseInstance dbInstance, String connectionString)
|
||||
{
|
||||
String fn = nameof(SbmDbDfnGenerator) + ".Generate";
|
||||
SaLogger.Info(fn + " Connection: " + connectionString);
|
||||
|
||||
// Locate output folder:
|
||||
String directory = GetOutputFolder(dbInstance);
|
||||
@@ -70,17 +71,22 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Utils
|
||||
config.DefinitionClass.Usings.Add("Sarand.Net.Standard.Base.Core");
|
||||
config.DefinitionClass.Usings.Add("Sarand.Net.Standard.Base.Utils");
|
||||
config.DefinitionClass.Usings.Add("Sarand.Net.Standard.Base.Dbas");
|
||||
config.DefinitionClass.Namespace = "Sarand.BusinessMgr.Core.App";
|
||||
config.DefinitionClass.Namespace = "Sarand.BusinessMgr.Net.Standard.Base.App";
|
||||
config.DefinitionClass.Classname = "SbmDbDfn";
|
||||
// Table class.
|
||||
config.TableClass.Usings.Clear();
|
||||
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.Core");
|
||||
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.Utils");
|
||||
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.Dbas");
|
||||
config.TableClass.Namespace = "Sarand.BusinessMgr.Net.Standard.Dbas.Internal";
|
||||
config.TableClass.Namespace_BaseClass = "Sarand.BusinessMgr.Net.Standard.Dbas.Data";
|
||||
config.TableClass.BaseClass = "SbmDbDataItem";
|
||||
config.TableClass.ClassName_DatabaseInfo = "IDatabaseInfo";
|
||||
config.TableClass.MandatoryConstructorDbInfo = true;
|
||||
config.TableClass.TreatDoubleFormatAsDecimal = true;
|
||||
if (dbInstance == DatabaseInstance.Control)
|
||||
{
|
||||
config.DefinitionClass.Classname = "SbmControlDbDfn";
|
||||
config.DefinitionClass.Classname = "SbmDbDfn_Control";
|
||||
config.TableClass.Namespace = "Sarand.BusinessMgr.Net.Standard.Dbas.Internal.Control";
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -11,4 +11,9 @@
|
||||
<ProjectReference Include="..\SaBusMgrStandardBase\SaBusMgrStandardBase.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Dbas\Internal\Control\" />
|
||||
<Folder Include="Resources\Database\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Control.App
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<SbmStartup_Admin>();
|
||||
webBuilder.UseStartup<SbmStartup_Control>();
|
||||
});
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
+78
-35
@@ -20,15 +20,18 @@ using System.Threading.Tasks;
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.Control.App
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmApplication_Admin : SbmApplication_Web
|
||||
public class SbmApplication_Control : SbmApplication_Web
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private bool generateDatabaseDefinitions = false;
|
||||
private bool generateDatabaseDefinitions_Control = true;
|
||||
private bool generateDatabaseDefinitions_BusMgr = true;
|
||||
private PropertySet propertySet;
|
||||
private Dictionary<String, SbmSessionConfig> sessionConfigs = new Dictionary<string, SbmSessionConfig>();
|
||||
private Dictionary<String, SbmAppConfig> appConfigs = new Dictionary<string, SbmAppConfig>();
|
||||
private Dictionary<String, SbmEmailConfig> emailConfigs = new Dictionary<string, SbmEmailConfig>();
|
||||
// Session contexts.
|
||||
private static ushort sessionContextIdx_Next = 100;
|
||||
private ushort sessionContextIdx_Control = 0;
|
||||
private class SessionContextData
|
||||
{
|
||||
public SessionContextData(SbmSessionContext_Web sessionContext)
|
||||
@@ -36,19 +39,18 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Control.App
|
||||
SessionContext = sessionContext;
|
||||
}
|
||||
public SbmSessionContext_Web SessionContext { get; }
|
||||
public ISacsDatabase ControlDatabase { get; set; }
|
||||
public ISacsDatabase BusMgrDatabase { get; set; }
|
||||
}
|
||||
private readonly Dictionary<int, SessionContextData> sessionContexts = new Dictionary<int, SessionContextData>();
|
||||
private readonly Dictionary<ushort, SessionContextData> sessionContexts = new Dictionary<ushort, SessionContextData>();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmApplication_Admin(IConfiguration configuration)
|
||||
public SbmApplication_Control(IConfiguration configuration)
|
||||
{
|
||||
InitialiseTemporaryLoggingFolder();
|
||||
try
|
||||
{
|
||||
AppInstance = this;
|
||||
SbmGlobals.Application = this;
|
||||
propertySet = new PropertySet();
|
||||
SbmGlobals.System = (System_Web = new SbmSystem_Web(propertySet));
|
||||
Configuration = configuration;
|
||||
@@ -62,15 +64,27 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Control.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public static SbmApplication_Admin AppInstance { get; private set; }
|
||||
// Application Configuration.
|
||||
public override SbmAppConfig AppConfig { get { return appConfigs.Values.ToList().getConfigForApplication(); } }
|
||||
// Session Configuration.
|
||||
public override String SessionCookieName { get { return Sbm.Config.Control.Session.Cookie.Name; } }
|
||||
public override List<ushort> GetSessionContextIdxs()
|
||||
{
|
||||
return sessionContexts.Values.Select(item => item.SessionContext.Index).ToList();
|
||||
}
|
||||
public override SbmSessionContext GetSessionContext(ushort index)
|
||||
{
|
||||
return sessionContexts.GetValue(index, null)?.SessionContext ?? null;
|
||||
}
|
||||
public override ISacsDatabase GetControlDatabase(SbmSessionContext sessionContext)
|
||||
{
|
||||
return sessionContexts.GetValue(sessionContext.Index, null)?.ControlDatabase;
|
||||
}
|
||||
public override ISacsDatabase GetBusMgrDatabase(SbmSessionContext sessionContext)
|
||||
{
|
||||
return sessionContexts.GetValue(sessionContext.Index, null)?.BusMgrDatabase;
|
||||
}
|
||||
public override String SessionCookieName { get { return Sbm.Config.Admin.Session.Cookie.Name; } }
|
||||
// Configuration.
|
||||
public override SbmSessionConfig SessionConfig { get { return sessionConfigs.Values.ToList().getConfigForApplication(); } }
|
||||
public override SbmEmailConfig EmailConfig { get { return emailConfigs.Values.ToList().getConfigForSession(SessionConfig); } }
|
||||
public override SbmEmailConfig EmailConfig { get { return emailConfigs.Values.ToList().getConfigForSession(AppConfig); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Initialisation.
|
||||
@@ -101,15 +115,15 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Control.App
|
||||
SbmConfiguration = builder.Build();
|
||||
|
||||
// Application configuration.
|
||||
sessionConfigs = SbmSessionConfigHelper.ExtractSessionConfigs(SbmConfiguration.GetSection("SessionConfigs"));
|
||||
appConfigs = SbmAppConfigHelper.ExtractAppConfigs(SbmConfiguration.GetSection("AppConfigs"));
|
||||
emailConfigs = SbmEmailConfigHelper.ExtractEmailConfigs(SbmConfiguration.GetSection("EmailConfigs"));
|
||||
LoggingRootFolder = SessionConfig.Logging.RootFolder;
|
||||
LoggingRootFolder = AppConfig.Logging.RootFolder;
|
||||
|
||||
// Application instance.
|
||||
if (SessionConfig.Instance.EqualsCI("Dev")) instanceType = Sbm.InstanceType.Dev;
|
||||
else if (SessionConfig.Instance.ContainsCI("Q")) instanceType = Sbm.InstanceType.QC;
|
||||
else if (SessionConfig.Instance.ContainsCI("UAT")) instanceType = Sbm.InstanceType.UAT;
|
||||
else if (SessionConfig.Instance.EqualsCI("PreProd")) instanceType = Sbm.InstanceType.UAT;
|
||||
if (AppConfig.Instance.EqualsCI("Dev")) instanceType = Sbm.InstanceType.Dev;
|
||||
else if (AppConfig.Instance.ContainsCI("Q")) instanceType = Sbm.InstanceType.QC;
|
||||
else if (AppConfig.Instance.ContainsCI("UAT")) instanceType = Sbm.InstanceType.UAT;
|
||||
else if (AppConfig.Instance.EqualsCI("PreProd")) instanceType = Sbm.InstanceType.UAT;
|
||||
|
||||
// Initialise hard-coded logging path.
|
||||
if (StringUtil.IsEmpty(LoggingRootFolder))
|
||||
@@ -121,20 +135,30 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Control.App
|
||||
SaLogger.LogFolder = LoggingRootFolder;
|
||||
LogApplicationStart(fn);
|
||||
|
||||
// Configure database connection.
|
||||
// Control database connection.
|
||||
SacsDatabaseConsole.OdbcConfig config = new SacsDatabaseConsole.OdbcConfig();
|
||||
config.location = SessionConfig.BusMgrDatabase.Location;
|
||||
config.user = SessionConfig.BusMgrDatabase.User;
|
||||
config.pword = SessionConfig.BusMgrDatabase.Password;
|
||||
SacsDatabase coreDatabase = SacsDatabaseConsole.OpenOdbcDatabase(config);
|
||||
if (coreDatabase.HasErrorState())
|
||||
SaLogger.Warn(fn + " Database initialisation error: " + coreDatabase.ErrorStateMessage);
|
||||
config.location = AppConfig.ControlDatabase.Location;
|
||||
config.user = AppConfig.ControlDatabase.User;
|
||||
config.pword = AppConfig.ControlDatabase.Password;
|
||||
SacsDatabase controlDatabase = SacsDatabaseConsole.OpenOdbcDatabase(config);
|
||||
if (controlDatabase.HasErrorState())
|
||||
SaLogger.Warn(fn + " Control Database initialisation error: " + controlDatabase.ErrorStateMessage);
|
||||
|
||||
// BusinessMgr database connection.
|
||||
config = new SacsDatabaseConsole.OdbcConfig();
|
||||
config.location = AppConfig.BusMgrDatabase.Location;
|
||||
config.user = AppConfig.BusMgrDatabase.User;
|
||||
config.pword = AppConfig.BusMgrDatabase.Password;
|
||||
SacsDatabase busMgrDatabase = SacsDatabaseConsole.OpenOdbcDatabase(config);
|
||||
if (busMgrDatabase.HasErrorState())
|
||||
SaLogger.Warn(fn + " BusMgr Database initialisation error: " + busMgrDatabase.ErrorStateMessage);
|
||||
|
||||
// Session context - only one context available/necessary (for now).
|
||||
SessionContextData sessionContextData = new SessionContextData(new SbmSessionContext_Web(100, Sbm.Application.WebControl));
|
||||
sessionContextData.BusMgrDatabase = coreDatabase;
|
||||
sessionContextIdx_Control = sessionContextIdx_Next++;
|
||||
SessionContextData sessionContextData = new SessionContextData(new SbmSessionContext_Web(sessionContextIdx_Control, Sbm.Application.WebControl));
|
||||
sessionContextData.ControlDatabase = controlDatabase;
|
||||
sessionContextData.BusMgrDatabase = busMgrDatabase;
|
||||
sessionContexts.Add(sessionContextData.SessionContext.Index, sessionContextData);
|
||||
SessionContext = sessionContextData.SessionContext;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
@@ -142,20 +166,39 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Control.App
|
||||
}
|
||||
|
||||
// Occasional startup processing.
|
||||
if (generateDatabaseDefinitions)
|
||||
GenerateDatabaseDefinition(SessionContext);
|
||||
SbmSessionContext sessionContext = GetSessionContext(sessionContextIdx_Control);
|
||||
if (generateDatabaseDefinitions_Control)
|
||||
GenerateDatabaseDefinition(sessionContext, SbmDbDfnGenerator.DatabaseInstance.Control, GetControlDatabase(sessionContext));
|
||||
if (generateDatabaseDefinitions_BusMgr)
|
||||
{
|
||||
// Use the 'template' database connection parameters.
|
||||
SacsDatabaseConsole.OdbcConfig config = new SacsDatabaseConsole.OdbcConfig();
|
||||
config.location = AppConfig.TemplateDatabase.Location;
|
||||
config.user = AppConfig.TemplateDatabase.User;
|
||||
config.pword = AppConfig.TemplateDatabase.Password;
|
||||
GenerateDatabaseDefinition(sessionContext, SbmDbDfnGenerator.DatabaseInstance.BusinessMgr, SacsDatabaseConsole.GenerateConnectionString(config));
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private void GenerateDatabaseDefinition(SbmSessionContext sessionContext)
|
||||
// Generate database definition.
|
||||
private void GenerateDatabaseDefinition(SbmSessionContext sessionContext, SbmDbDfnGenerator.DatabaseInstance dbInstance, ISacsDatabase db)
|
||||
{
|
||||
if (!generateDatabaseDefinitions || !SbmSystem.DebugMode || SessionContext == null) return;
|
||||
if (!generateDatabaseDefinitions_BusMgr || !SbmSystem.DebugMode || sessionContext == null) return;
|
||||
if (!StringUtil.EmptyOnNull(EnvironmentName).EqualsCI("Development")) return;
|
||||
ISacsDatabase coreDatabase = GetBusMgrDatabase(sessionContext);
|
||||
if (coreDatabase == null || StringUtil.IsEmpty(coreDatabase.ConnectionString)) return;
|
||||
if (db == null || StringUtil.IsEmpty(db.ConnectionString)) return;
|
||||
|
||||
// Generate database definitions.
|
||||
SbmDbDfnGenerator.Generate(SbmDbDfnGenerator.DatabaseInstance.BusinessMgr, coreDatabase.ConnectionString);
|
||||
GenerateDatabaseDefinition(sessionContext, dbInstance, db.ConnectionString);
|
||||
}
|
||||
private void GenerateDatabaseDefinition(SbmSessionContext sessionContext, SbmDbDfnGenerator.DatabaseInstance dbInstance, String connectionString)
|
||||
{
|
||||
if (!generateDatabaseDefinitions_BusMgr || !SbmSystem.DebugMode || sessionContext == null) return;
|
||||
if (!StringUtil.EmptyOnNull(EnvironmentName).EqualsCI("Development")) return;
|
||||
if (StringUtil.IsEmpty(connectionString)) return;
|
||||
|
||||
// Generate database definitions.
|
||||
SbmDbDfnGenerator.Generate(dbInstance, connectionString);
|
||||
//SaUpdateLogDbDfnGenerator.Generate(database.ConnectionString);
|
||||
}
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.Control.App
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmLocaliser_Admin : SbmLocaliser
|
||||
public class SbmLocaliser_Control : SbmLocaliser
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
@@ -32,7 +32,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Control.App
|
||||
/// <summary>
|
||||
/// Localisers are supplied using construction injection.
|
||||
/// </summary>
|
||||
public SbmLocaliser_Admin(IStringLocalizer<SbmControlProperties> webAppProperties)
|
||||
public SbmLocaliser_Control(IStringLocalizer<SbmControlProperties> webAppProperties)
|
||||
{
|
||||
this.webAppProperties = webAppProperties;
|
||||
}
|
||||
+8
-8
@@ -14,19 +14,19 @@ using System.Threading.Tasks;
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.Control.App
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmStartup_Admin : SbmStartup_Web
|
||||
public class SbmStartup_Control : SbmStartup_Web
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private SbmApplication_Admin application = null;
|
||||
private SbmApplication_Control application = null;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmStartup_Admin(IConfiguration configuration) :
|
||||
public SbmStartup_Control(IConfiguration configuration) :
|
||||
base(configuration)
|
||||
{
|
||||
// Initialise application.
|
||||
application = new SbmApplication_Admin(Configuration);
|
||||
application = new SbmApplication_Control(Configuration);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -36,13 +36,13 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Control.App
|
||||
// Common configuration.
|
||||
ConfigureServicesConfig configureServicesConfig = new ConfigureServicesConfig();
|
||||
configureServicesConfig.services = services;
|
||||
configureServicesConfig.sessionCookieName = Sbm.Config.Admin.Session.Cookie.Name;
|
||||
configureServicesConfig.sessionCookieHttpOnly = Sbm.Config.Admin.Session.Cookie.HttpOnly;
|
||||
configureServicesConfig.sessionIdleTimeout = Sbm.Config.Admin.Session.Cookie.IdleTimeout;
|
||||
configureServicesConfig.sessionCookieName = Sbm.Config.Control.Session.Cookie.Name;
|
||||
configureServicesConfig.sessionCookieHttpOnly = Sbm.Config.Control.Session.Cookie.HttpOnly;
|
||||
configureServicesConfig.sessionIdleTimeout = Sbm.Config.Control.Session.Cookie.IdleTimeout;
|
||||
ConfigureServices(configureServicesConfig);
|
||||
|
||||
// Application localisation.
|
||||
services.AddSingleton<SbmLocaliser, SbmLocaliser_Admin>();
|
||||
services.AddSingleton<SbmLocaliser, SbmLocaliser_Control>();
|
||||
|
||||
services.Configure<CookiePolicyOptions>(options =>
|
||||
{
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SaBusinessMgrCoreWebAdmin.Models;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.Control.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SaBusinessMgrCoreWebAdmin.Controllers
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.Control.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace SaBusinessMgrCoreWebAdmin.Models
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.Control.Models
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
@@ -26,4 +26,27 @@
|
||||
<Folder Include="Control\Consoles\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="appsettings.Development.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
<Content Update="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
<Content Update="appsettings.Machine.Sarand107.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
<Content Update="appsettings.Production.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -4,5 +4,4 @@
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">SaBusinessMgrCoreWebAdmin</a>
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">SaBusinessMgr-Control</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
@@ -21,9 +21,6 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -37,7 +34,7 @@
|
||||
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2021 - SaBusinessMgrCoreWebAdmin - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
© 2021 - Sarand BusinessMgr
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
@using SaBusinessMgrCoreWebAdmin
|
||||
@using SaBusinessMgrCoreWebAdmin.Models
|
||||
@using Sarand.BusinessMgr.Net.Core.Web.Control
|
||||
@using Sarand.BusinessMgr.Net.Core.Web.Control.Models
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
||||
@@ -1,9 +1,26 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"EmailConfigs": {
|
||||
"SBM-Dev": {
|
||||
"SMTP": {
|
||||
"Server": "smtp.ionos.co.uk",
|
||||
"ServerPort": 587,
|
||||
"UseSSL": true
|
||||
},
|
||||
"Send": {
|
||||
"Using": 2,
|
||||
"UserName": "businessmgr@sarand.com",
|
||||
"Password": "sarand-busmgr-5apP1re"
|
||||
},
|
||||
"Message": {
|
||||
"AddressFrom": "DoNotReply@SaBusinessMgr.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"AppConfigs": {
|
||||
"SaBusMgr-Dev": {
|
||||
"Environments": [ "Development" ],
|
||||
"Instance": "Dev",
|
||||
"ControlDatabase": {
|
||||
"Location": "MsSql:Sarand107\\SQL2016.SaBusinessMgr_Control",
|
||||
"User": "SaBusMgr-Control",
|
||||
"Password": "sbm-c0Ntrul-dev-2021"
|
||||
},
|
||||
"BusMgrDatabases": [
|
||||
{
|
||||
"Code": "Sarand",
|
||||
"Location": "MsSql:Sarand106\\SQL2014.SaBusinessMgr_Sarand"
|
||||
},
|
||||
{
|
||||
"Code": "Cadix",
|
||||
"Location": "MsSql:Sarand107\\SQL2016.SaBusinessMgr_Cadix",
|
||||
"User": "SaBusMgr-Cadix",
|
||||
"Password": "sbm-cul-dev-2021"
|
||||
}
|
||||
],
|
||||
"BusMgrDatabase": {
|
||||
"Code": "Cadix",
|
||||
"Location": "MsSql:Sarand107\\SQL2016.SaBusinessMgr_Cadix",
|
||||
"User": "SaBusMgr-Cadix",
|
||||
"Password": "sbm-cul-dev-2021"
|
||||
},
|
||||
"TemplateDatabase": {
|
||||
"Location": "MsSql:Sarand107\\SQL2016.SaBusinessMgr_Template",
|
||||
"User": "SaBusMgr-Control",
|
||||
"Password": "sbm-c0Ntrul-dev-2021"
|
||||
},
|
||||
"Email": {
|
||||
"Context": "SBM-Dev",
|
||||
"ContactUs": {
|
||||
"AddressesTo": [ "dev@SaBusinessMgr.com" ]
|
||||
}
|
||||
},
|
||||
"Documents": {
|
||||
"RootFolder": "D:\\Sarand\\Projects\\Users\\AHoward\\VS2019\\BusinessMgr\\Docs"
|
||||
},
|
||||
"Logging": {
|
||||
"RootFolder": "D:\\Sarand\\Projects\\Users\\AHoward\\VS2019\\BusinessMgr\\Logs\\WebControl"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"EmailConfigs": {
|
||||
"SBM-Prod": {
|
||||
"SMTP": {
|
||||
"Server": "smtp.ionos.co.uk",
|
||||
"ServerPort": 587,
|
||||
"UseSSL": true
|
||||
},
|
||||
"Send": {
|
||||
"Using": 2,
|
||||
"UserName": "businessmgr@sarand.com",
|
||||
"Password": "sarand-busmgr-5apP1re"
|
||||
},
|
||||
"Message": {
|
||||
"AddressFrom": "DoNotReply@SaBusinessMgr.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -174,6 +174,9 @@
|
||||
<data name="label.ok" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
</data>
|
||||
<data name="label.password" xml:space="preserve">
|
||||
<value>Password</value>
|
||||
</data>
|
||||
<data name="label.reference" xml:space="preserve">
|
||||
<value>Reference</value>
|
||||
</data>
|
||||
@@ -261,6 +264,9 @@
|
||||
<data name="msg.validation.maximum.length" xml:space="preserve">
|
||||
<value>Value must not exceed {0} characters</value>
|
||||
</data>
|
||||
<data name="security.caption.request.password" xml:space="preserve">
|
||||
<value>Request Password</value>
|
||||
</data>
|
||||
<data name="security.change.password.current.invalid" xml:space="preserve">
|
||||
<value>Current password does not match.</value>
|
||||
</data>
|
||||
|
||||
@@ -24,9 +24,11 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.App
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private PropertySet properties;
|
||||
private Dictionary<String, SbmSessionConfig> sessionConfigs = new Dictionary<string, SbmSessionConfig>();
|
||||
private Dictionary<String, SbmAppConfig> appConfigs = new Dictionary<string, SbmAppConfig>();
|
||||
private Dictionary<String, SbmEmailConfig> emailConfigs = new Dictionary<string, SbmEmailConfig>();
|
||||
// Session contexts.
|
||||
private static ushort sessionContextIdx_Next = 100;
|
||||
private ushort sessionContextIdx_Control = 0;
|
||||
private class SessionContextData
|
||||
{
|
||||
public SessionContextData(SbmSessionContext_Web sessionContext)
|
||||
@@ -34,6 +36,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.App
|
||||
SessionContext = sessionContext;
|
||||
}
|
||||
public SbmSessionContext_Web SessionContext { get; }
|
||||
public ISacsDatabase ControlDatabase { get; set; }
|
||||
public ISacsDatabase BusMgrDatabase { get; set; }
|
||||
}
|
||||
private readonly Dictionary<int, SessionContextData> sessionContexts = new Dictionary<int, SessionContextData>();
|
||||
@@ -45,8 +48,6 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.App
|
||||
InitialiseTemporaryLoggingFolder();
|
||||
try
|
||||
{
|
||||
AppInstance = this;
|
||||
SbmGlobals.Application = this;
|
||||
properties = new PropertySet();
|
||||
SbmGlobals.System = (System_Web = new SbmSystem_Web(properties));
|
||||
Configuration = configuration;
|
||||
@@ -60,15 +61,27 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public static SbmApplication_Portal AppInstance { get; private set; }
|
||||
// Application Configuration.
|
||||
public override SbmAppConfig AppConfig { get { return appConfigs.Values.ToList().getConfigForApplication(); } }
|
||||
// Session Configuration.
|
||||
public override String SessionCookieName { get { return Sbm.Config.Portal.Session.Cookie.Name; } }
|
||||
public override List<ushort> GetSessionContextIdxs()
|
||||
{
|
||||
return sessionContexts.Values.Select(item => item.SessionContext.Index).ToList();
|
||||
}
|
||||
public override SbmSessionContext GetSessionContext(ushort index)
|
||||
{
|
||||
return sessionContexts.GetValue(index, null)?.SessionContext ?? null;
|
||||
}
|
||||
public override ISacsDatabase GetControlDatabase(SbmSessionContext sessionContext)
|
||||
{
|
||||
return sessionContexts.GetValue(sessionContext.Index, null)?.ControlDatabase;
|
||||
}
|
||||
public override ISacsDatabase GetBusMgrDatabase(SbmSessionContext sessionContext)
|
||||
{
|
||||
return sessionContexts.GetValue(sessionContext.Index, null)?.BusMgrDatabase;
|
||||
}
|
||||
public override String SessionCookieName { get { return Sbm.Config.Online.Session.Cookie.Name; } }
|
||||
// Configuration.
|
||||
public override SbmSessionConfig SessionConfig { get { return sessionConfigs.Values.ToList().getConfigForApplication(); } }
|
||||
public override SbmEmailConfig EmailConfig { get { return emailConfigs.Values.ToList().getConfigForSession(SessionConfig); } }
|
||||
public override SbmEmailConfig EmailConfig { get { return emailConfigs.Values.ToList().getConfigForSession(AppConfig); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Initialisation.
|
||||
@@ -99,15 +112,15 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.App
|
||||
SbmConfiguration = builder.Build();
|
||||
|
||||
// Application configuration.
|
||||
sessionConfigs = SbmSessionConfigHelper.ExtractSessionConfigs(SbmConfiguration.GetSection("SessionConfigs"));
|
||||
appConfigs = SbmAppConfigHelper.ExtractAppConfigs(SbmConfiguration.GetSection("AppConfigs"));
|
||||
emailConfigs = SbmEmailConfigHelper.ExtractEmailConfigs(SbmConfiguration.GetSection("EmailConfigs"));
|
||||
LoggingRootFolder = SessionConfig.Logging.RootFolder;
|
||||
LoggingRootFolder = AppConfig.Logging.RootFolder;
|
||||
|
||||
// Application instance.
|
||||
if (SessionConfig.Instance.EqualsCI("Dev")) instanceType = Sbm.InstanceType.Dev;
|
||||
else if (SessionConfig.Instance.ContainsCI("Q")) instanceType = Sbm.InstanceType.QC;
|
||||
else if (SessionConfig.Instance.ContainsCI("UAT")) instanceType = Sbm.InstanceType.UAT;
|
||||
else if (SessionConfig.Instance.EqualsCI("PreProd")) instanceType = Sbm.InstanceType.UAT;
|
||||
if (AppConfig.Instance.EqualsCI("Dev")) instanceType = Sbm.InstanceType.Dev;
|
||||
else if (AppConfig.Instance.ContainsCI("Q")) instanceType = Sbm.InstanceType.QC;
|
||||
else if (AppConfig.Instance.ContainsCI("UAT")) instanceType = Sbm.InstanceType.UAT;
|
||||
else if (AppConfig.Instance.EqualsCI("PreProd")) instanceType = Sbm.InstanceType.UAT;
|
||||
|
||||
// Initialise hard-coded logging path.
|
||||
if (StringUtil.IsEmpty(LoggingRootFolder))
|
||||
@@ -121,18 +134,18 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.App
|
||||
|
||||
// Configure database connection.
|
||||
SacsDatabaseConsole.OdbcConfig config = new SacsDatabaseConsole.OdbcConfig();
|
||||
config.location = SessionConfig.BusMgrDatabase.Location;
|
||||
config.user = SessionConfig.BusMgrDatabase.User;
|
||||
config.pword = SessionConfig.BusMgrDatabase.Password;
|
||||
config.location = AppConfig.BusMgrDatabase.Location;
|
||||
config.user = AppConfig.BusMgrDatabase.User;
|
||||
config.pword = AppConfig.BusMgrDatabase.Password;
|
||||
SacsDatabase coreDatabase = SacsDatabaseConsole.OpenOdbcDatabase(config);
|
||||
if (coreDatabase.HasErrorState())
|
||||
SaLogger.Warn(fn + " Database initialisation error: " + coreDatabase.ErrorStateMessage);
|
||||
|
||||
// Session context - only one context available/necessary (for now).
|
||||
SessionContextData sessionContextData = new SessionContextData(new SbmSessionContext_Web(100, Sbm.Application.WebPortal));
|
||||
sessionContextIdx_Control = sessionContextIdx_Next++;
|
||||
SessionContextData sessionContextData = new SessionContextData(new SbmSessionContext_Web(sessionContextIdx_Control, Sbm.Application.WebPortal));
|
||||
sessionContextData.BusMgrDatabase = coreDatabase;
|
||||
sessionContexts.Add(sessionContextData.SessionContext.Index, sessionContextData);
|
||||
SessionContext = sessionContextData.SessionContext;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
|
||||
@@ -37,9 +37,9 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.App
|
||||
// Common configuration.
|
||||
ConfigureServicesConfig configureServicesConfig = new ConfigureServicesConfig();
|
||||
configureServicesConfig.services = services;
|
||||
configureServicesConfig.sessionCookieName = Sbm.Config.Online.Session.Cookie.Name;
|
||||
configureServicesConfig.sessionCookieHttpOnly = Sbm.Config.Online.Session.Cookie.HttpOnly;
|
||||
configureServicesConfig.sessionIdleTimeout = Sbm.Config.Online.Session.Cookie.IdleTimeout;
|
||||
configureServicesConfig.sessionCookieName = Sbm.Config.Portal.Session.Cookie.Name;
|
||||
configureServicesConfig.sessionCookieHttpOnly = Sbm.Config.Portal.Session.Cookie.HttpOnly;
|
||||
configureServicesConfig.sessionIdleTimeout = Sbm.Config.Portal.Session.Cookie.IdleTimeout;
|
||||
ConfigureServices(configureServicesConfig);
|
||||
|
||||
// Application localisation.
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.App;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.Helpers;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.Portal.Models;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Security;
|
||||
@@ -36,7 +39,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.Controllers
|
||||
|
||||
// Check for 'Keep Logged In' cookie.
|
||||
// NB Only allowed if there isn't a current user session.
|
||||
if (!ValidUserSession && SessionConfig.Security.SignIn.KeepLoggedIn.Allowed)
|
||||
if (!ValidUserSession && AppConfig.Security.SignIn.KeepLoggedIn.Allowed)
|
||||
{
|
||||
String encryptedParams = GetRequestCookie(CookieName_KeepLoggedIn);
|
||||
KeepLoggedInParams keepLoggedInParams = ExtractKeepLoggedInParams(encryptedParams);
|
||||
@@ -44,24 +47,54 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.Controllers
|
||||
|
||||
if (SysId.IsValid(keepLoggedInParams.SecurityItemId) && SysId.IsValid(keepLoggedInParams.AffiliateId))
|
||||
{
|
||||
SaSecurityItem securityItemUser = SecurityConsole.GetSecurityItemById(SaSecurity.ItemType.User, keepLoggedInParams.SecurityItemId);
|
||||
if (securityItemUser != null)
|
||||
// User may be defined on any one of the BusinessMgr databases - need to find out which.
|
||||
// Identify session contexts with a BusMgr database that hosts the specified email address.
|
||||
List<ushort> sessionContextIdxs = SbmSessionContextHelper_Web.GetSessionContextIdxsForUsersBusMgrDatabase(keepLoggedInParams.EmailAddress);
|
||||
foreach (ushort sessionContextIdx in sessionContextIdxs)
|
||||
{
|
||||
SbmAffiliate userAccount = AccountMgr.GetAffiliateById(keepLoggedInParams.AffiliateId);
|
||||
if (userAccount != null)
|
||||
SbmSessionContext sessionContext = SbmSessionContextHelper_Web.GetSessionContext(sessionContextIdx);
|
||||
SbmUserContext_Web userContext = new SbmUserContext_Web(sessionContext);
|
||||
|
||||
using (SaSecurityConsole securityConsole = App.CreateSecurityConsole(userContext))
|
||||
{
|
||||
if (userAccount.IsStatusActive)
|
||||
SaSecurityItem securityItemUser = securityConsole.GetUserByEmail(keepLoggedInParams.EmailAddress);
|
||||
if (securityItemUser != null)
|
||||
{
|
||||
String errorMessage = "";
|
||||
if (SignUserIn(securityItemUser, userAccount, true, ref errorMessage))
|
||||
SaLogger.Info(fn + " Keep Logged In cookie found." + logSuffix);
|
||||
else SaLogger.Warn(fn + " Keep Logged In cookie found but failed to sign user in: " + errorMessage + "." + logSuffix);
|
||||
if (securityItemUser.Id.Equals(keepLoggedInParams.SecurityItemId))
|
||||
{
|
||||
using (SbmAccountMgr accountMgr = App.System.CreateAccountMgr(userContext))
|
||||
{
|
||||
SbmAffiliate affiliateUser = accountMgr.GetAffiliateById(keepLoggedInParams.AffiliateId);
|
||||
if (affiliateUser != null)
|
||||
{
|
||||
if (affiliateUser.Id.Equals(keepLoggedInParams.AffiliateId))
|
||||
{
|
||||
if (affiliateUser.UserId.Equals(securityItemUser.Id))
|
||||
{
|
||||
if (affiliateUser.IsStatusActive)
|
||||
{
|
||||
String errorMessage = "";
|
||||
if (SignUserIn(sessionContext, securityItemUser, affiliateUser, true, ref errorMessage))
|
||||
SaLogger.Info(fn + " Keep Logged In cookie found." + logSuffix);
|
||||
else SaLogger.Warn(fn + " Keep Logged In cookie found but failed to sign user in: " + errorMessage + "." + logSuffix);
|
||||
}
|
||||
else SaLogger.Warn(fn + " Keep Logged In cookie found but Affiliate is not active." + logSuffix);
|
||||
}
|
||||
else SaLogger.Warn(fn + " Keep Logged In cookie found but Affiliate User Id does not match security item." + logSuffix);
|
||||
}
|
||||
else SaLogger.Warn(fn + " Keep Logged In cookie found but Affiliate does nto match Id." + logSuffix);
|
||||
}
|
||||
else SaLogger.Warn(fn + " Keep Logged In cookie found but Affiliate not found." + logSuffix);
|
||||
}
|
||||
}
|
||||
else SaLogger.Warn(fn + " Keep Logged In cookie found but Security Item does not match Id." + logSuffix);
|
||||
}
|
||||
else SaLogger.Warn(fn + " Keep Logged In cookie found but Affiliate is not active." + logSuffix);
|
||||
else SaLogger.Warn(fn + " Keep Logged In cookie found but Security Item not found by email." + logSuffix);
|
||||
}
|
||||
else SaLogger.Warn(fn + " Keep Logged In cookie found but Affiliate not found." + logSuffix);
|
||||
|
||||
if (ValidUserSession)
|
||||
break;
|
||||
}
|
||||
else SaLogger.Warn(fn + " Keep Logged In cookie found but Security Item not found." + logSuffix);
|
||||
}
|
||||
else SaLogger.Warn(fn + " Keep Logged In cookie found but Security Item or Affiliate Ids missing." + logSuffix);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.Controllers
|
||||
/// <para>- Open user session - store details against Sesion Data.</para>
|
||||
/// <para>- Set 'Keep logged in' cookie if required.</para>
|
||||
/// </summary>
|
||||
protected bool SignUserIn(SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, bool keepLoggedIn, ref String errorMessage)
|
||||
protected bool SignUserIn(SbmSessionContext sessionContext, SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, bool keepLoggedIn, ref String errorMessage)
|
||||
{
|
||||
String fn = GetType().Name + ".SignUserIn";
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.Controllers
|
||||
}
|
||||
|
||||
// 'Keep logged in' can be switched off by the application configuration.
|
||||
keepLoggedIn = App.SessionConfig.Security.SignIn.KeepLoggedIn.Allowed && keepLoggedIn;
|
||||
keepLoggedIn = App.AppConfig.Security.SignIn.KeepLoggedIn.Allowed && keepLoggedIn;
|
||||
|
||||
// Log user in.
|
||||
affiliateUser.KeepLoggedIn_Portal = keepLoggedIn;
|
||||
@@ -85,7 +85,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.Controllers
|
||||
SaLogger.Info(fn + " User session opened for " + affiliateUser.Email, true);
|
||||
|
||||
// Create session.
|
||||
OpenUserSession(SessionContext, securityItemUser, affiliateUser);
|
||||
OpenUserSession(sessionContext, securityItemUser, affiliateUser);
|
||||
|
||||
// Send the 'Keep Logged In' cookie if requested.
|
||||
if (affiliateUser.KeepLoggedIn_Portal)
|
||||
@@ -136,7 +136,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.Controllers
|
||||
protected void SetKeepLoggedInCookie()
|
||||
{
|
||||
String keepLoggedInCookieValue = GenerateKeepLoggedInCookieValue();
|
||||
int cookieExpiresDays = Math.Max(Sbm.Config.Security.SignIn.KeepLoggedIn.CookieExpiresDays_Min, Math.Min(Sbm.Config.Security.SignIn.KeepLoggedIn.CookieExpiresDays_Max, SessionConfig.Security.SignIn.KeepLoggedIn.CookieExpiresDays));
|
||||
int cookieExpiresDays = Math.Max(Sbm.Config.Security.SignIn.KeepLoggedIn.CookieExpiresDays_Min, Math.Min(Sbm.Config.Security.SignIn.KeepLoggedIn.CookieExpiresDays_Max, AppConfig.Security.SignIn.KeepLoggedIn.CookieExpiresDays));
|
||||
SetResponseCookie(CookieName_KeepLoggedIn, keepLoggedInCookieValue, DateTime.Now.AddDays(cookieExpiresDays), true);
|
||||
SaLogger.Info(this.GetType().Name + ".SetKeepLoggedInCookie 'Keep Logged In' cookie set. Value: " + keepLoggedInCookieValue);
|
||||
}
|
||||
@@ -164,11 +164,13 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.Controllers
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Keep-logged-in cookie value.
|
||||
private static readonly String ParamName_KeepLoggedIn_EmailAddress = "ema";
|
||||
private static readonly String ParamName_KeepLoggedIn_SecurityItemId = "sii";
|
||||
private static readonly String ParamName_KeepLoggedIn_AffiliateId = "afi";
|
||||
private String GenerateKeepLoggedInCookieValue()
|
||||
{
|
||||
NameValueCollection keepLoggedInParams = new NameValueCollection();
|
||||
keepLoggedInParams.Add(ParamName_KeepLoggedIn_EmailAddress, SessionData_Portal.User.EmailAddress);
|
||||
keepLoggedInParams.Add(ParamName_KeepLoggedIn_SecurityItemId, SysId.ToString(SessionData_Portal.User.SecurityItemId));
|
||||
keepLoggedInParams.Add(ParamName_KeepLoggedIn_AffiliateId, SysId.ToString(SessionData_Portal.User.AffiliateId));
|
||||
return EncryptParameters(keepLoggedInParams, Base64IV_KeepLoggedIn, Base64Key_KeepLoggedIn);
|
||||
@@ -177,6 +179,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.Controllers
|
||||
//-------------------------------------------------------------------
|
||||
public class KeepLoggedInParams
|
||||
{
|
||||
public String EmailAddress { get; set; }
|
||||
public SysId SecurityItemId { get; set; }
|
||||
public SysId AffiliateId { get; set; }
|
||||
/// <summary>Retrieve the list of valid parameters in printable format [Name: Value].</summary>
|
||||
@@ -194,8 +197,9 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.Controllers
|
||||
if (!StringUtil.IsEmpty(encryptedParams))
|
||||
{
|
||||
NameValueCollection linkParams = DecryptParameters(encryptedParams, Base64IV_KeepLoggedIn, Base64Key_KeepLoggedIn);
|
||||
keepLoggedInParams.SecurityItemId = new SysId(StringUtil.ToInt(linkParams.Get(ParamName_KeepLoggedIn_SecurityItemId)));
|
||||
keepLoggedInParams.AffiliateId = new SysId(StringUtil.ToInt(linkParams.Get(ParamName_KeepLoggedIn_AffiliateId)));
|
||||
keepLoggedInParams.EmailAddress = linkParams.Get(ParamName_KeepLoggedIn_EmailAddress);
|
||||
keepLoggedInParams.SecurityItemId = linkParams.Get(ParamName_KeepLoggedIn_SecurityItemId).ToSysId();
|
||||
keepLoggedInParams.AffiliateId = linkParams.Get(ParamName_KeepLoggedIn_AffiliateId).ToSysId();
|
||||
}
|
||||
if (DebugMode) SaLogger.Info(GetType().Name + ".ExtractKeepLoggedInParams UserAccountId: " + SysId.ToString(keepLoggedInParams.AffiliateId));
|
||||
return keepLoggedInParams;
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.App;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.Helpers;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.Portal.Models;
|
||||
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.Helpers;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -43,23 +47,36 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.Controllers
|
||||
String messageTitle = Localiser["signin.caption"];
|
||||
|
||||
// Validate referrer.
|
||||
if (!ValidReferer)
|
||||
return Forbid();
|
||||
if (!ValidReferer) return Forbid();
|
||||
|
||||
// Validate Sign-in data.
|
||||
model.ValidateSignInData(responseData);
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
|
||||
// Get user account.
|
||||
SaSecurityItem securityItemUser = GetSecurityItemForSignin(model, responseData);
|
||||
SbmAffiliate userAccount = GetAffiliateForSignin(model, securityItemUser, responseData);
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
// Identify session contexts with a BusMgr database that hosts the specified email address.
|
||||
List<ushort> sessionContextIdxs = SbmSessionContextHelper_Web.GetSessionContextIdxsForUsersBusMgrDatabase(model.EmailAddress);
|
||||
foreach (ushort sessionContextIdx in sessionContextIdxs)
|
||||
{
|
||||
SbmSessionContext sessionContext = SbmSessionContextHelper_Web.GetSessionContext(sessionContextIdx);
|
||||
SbmUserContext_Web userContext = new SbmUserContext_Web(sessionContext);
|
||||
|
||||
String errorMessage = "";
|
||||
if (!SignUserIn(securityItemUser, userAccount, model.KeepMeSignedIn, ref errorMessage))
|
||||
return Json(responseData.SetControlError(nameof(model.EmailAddress), errorMessage));
|
||||
// Get user security item and affiliate.
|
||||
using (SaSecurityItem securityItemUser = GetSecurityItemForSignin(userContext, model, responseData))
|
||||
{
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
using (SbmAffiliate affiliateUser = GetAffiliateForSignin(userContext, model, securityItemUser, responseData))
|
||||
{
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
|
||||
String errorMessage = "";
|
||||
if (!SignUserIn(sessionContext, securityItemUser, affiliateUser, model.KeepMeSignedIn, ref errorMessage))
|
||||
return Json(responseData.SetControlError(nameof(model.EmailAddress), errorMessage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
responseData.Success = SessionData_Portal?.ValidUserSession ?? false;
|
||||
@@ -87,7 +104,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.Controllers
|
||||
if (!ValidUserSession)
|
||||
return Json(responseData.SetGoHome());
|
||||
|
||||
if (!SessionConfig.Security.SignIn.KeepLoggedIn.Allowed)
|
||||
if (!AppConfig.Security.SignIn.KeepLoggedIn.Allowed)
|
||||
return Json(responseData);
|
||||
|
||||
// Resend the cookie to extend the expiry date if it is currently populated.
|
||||
@@ -101,49 +118,51 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.Controllers
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public SaSecurityItem GetSecurityItemForSignin(Model_Security model, AjaxResponse_Data responseData)
|
||||
private SaSecurityItem GetSecurityItemForSignin(SbmUserContext_Web userContext, Model_Security model, AjaxResponse_Data responseData)
|
||||
{
|
||||
String fn = GetType().Name + ".GetSecurityItemForSignin";
|
||||
|
||||
// Retrieve security item by email address.
|
||||
SaSecurityItem.Params prmSecurityItem = new SaSecurityItem.Params();
|
||||
prmSecurityItem.SecurityItemType = SaSecurity.ItemType.User;
|
||||
prmSecurityItem.EmailAddress = model.EmailAddress;
|
||||
SaSecurityItem securityItemUser = SecurityConsole.GetSecurityItem(prmSecurityItem);
|
||||
|
||||
if (securityItemUser != null)
|
||||
SaSecurityItem securityItemUser = null;
|
||||
using (SaSecurityConsole securityConsole = App.CreateSecurityConsole(userContext))
|
||||
{
|
||||
// Validate password.
|
||||
if (!SbmPasswordHelper.VerifyHashedPassword(securityItemUser, model.Password) && !(DebugMode && model.EmailAddress.EqualsCI("ahoward@sarand.com")))
|
||||
// Retrieve security item by email address.
|
||||
securityItemUser = securityConsole.GetUserByEmail(model.EmailAddress);
|
||||
if (securityItemUser != null)
|
||||
{
|
||||
// Record invalid login attempt.
|
||||
//securityItemUser.InvalidLoginCount++;
|
||||
//securityItemUser.LastInvalidLoginAt = DateTime.Now;
|
||||
//if (!SecurityConsole.Update(securityItemUser, DbUpdateInfo))
|
||||
// SaLogger.Warn(fn + " Failed to store invalid sign-in attempt against User: " + model.EmailAddress + ". " + AccountMgr.ErrorStateMessage, true);
|
||||
SaLogger.Warn(fn + " Attempt to sign-in to User " + model.EmailAddress + " with invalid password."); // " Attempt: " + securityItemUser.InvalidLoginCount, true);
|
||||
securityItemUser = null;
|
||||
// Validate password.
|
||||
if (!SbmPasswordHelper.VerifyHashedPassword(securityItemUser, model.Password) && !(DebugMode && model.EmailAddress.EqualsCI("ahoward@sarand.com")))
|
||||
{
|
||||
// Record invalid login attempt.
|
||||
securityItemUser.InvalidLoginCount++;
|
||||
securityItemUser.LastInvalidLoginAt = DateTime.Now;
|
||||
if (!securityConsole.UpdateSecurityItem(securityItemUser, DbUpdateInfo))
|
||||
SaLogger.Warn(fn + " Failed to store invalid sign-in attempt against User: " + model.EmailAddress + ". " + AccountMgr.ErrorStateMessage, true);
|
||||
SaLogger.Warn(fn + " Attempt to sign-in to User " + model.EmailAddress + " with invalid password. Attempt: " + securityItemUser.InvalidLoginCount, true);
|
||||
responseData.SetControlError(nameof(model.EmailAddress), model.Localiser["security.msg.signin.invalid"]);
|
||||
securityItemUser = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return securityItemUser;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public SbmAffiliate GetAffiliateForSignin(Model_Security model, SaSecurityItem securityItemUser, AjaxResponse_Data responseData)
|
||||
private SbmAffiliate GetAffiliateForSignin(SbmUserContext_Web userContext, Model_Security model, SaSecurityItem securityItemUser, AjaxResponse_Data responseData)
|
||||
{
|
||||
String fn = GetType().Name + ".GetAffiliateForSignin";
|
||||
|
||||
// Identify the contact asociated with the security item.
|
||||
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
|
||||
prmAffiliate.UserId = securityItemUser.Id;
|
||||
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.ActiveOnly;
|
||||
SbmAffiliate affiliate = AccountMgr.GetAffiliate(prmAffiliate);
|
||||
if (affiliate != null)
|
||||
SbmAffiliate affiliate = null;
|
||||
using (SbmAccountMgr accountMgr = App.System.CreateAccountMgr(userContext))
|
||||
{
|
||||
// Identify the contact asociated with the security item.
|
||||
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
|
||||
prmAffiliate.UserId = securityItemUser.Id;
|
||||
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.ActiveOnly;
|
||||
affiliate = accountMgr.GetAffiliate(prmAffiliate);
|
||||
if (affiliate != null)
|
||||
{
|
||||
}
|
||||
if (affiliate == null && !responseData.HasControlErrors())
|
||||
responseData.SetControlError(nameof(model.EmailAddress), model.Localiser["security.msg.signin.invalid"]);
|
||||
}
|
||||
if (affiliate == null && !responseData.HasControlErrors())
|
||||
responseData.SetControlError(nameof(model.EmailAddress), model.Localiser["security.msg.signin.invalid"]);
|
||||
return affiliate;
|
||||
}
|
||||
|
||||
@@ -171,8 +190,8 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.Controllers
|
||||
return Json(responseData.SetSessionExpired(messageTitle, Localiser["security.msg.warn.sessionExpired"]));
|
||||
|
||||
// Retrieve user account - in case sign-out needs to be recorded.
|
||||
SbmAffiliate userAccount = AccountMgr.GetAffiliateById(SessionData_Portal.User.AffiliateId);
|
||||
if (userAccount == null)
|
||||
SbmAffiliate affiliateUser = AccountMgr.GetAffiliateById(SessionData_Portal.User.AffiliateId);
|
||||
if (affiliateUser == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " System error - failed to retrieve account details.");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
|
||||
@@ -339,35 +358,54 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.Controllers
|
||||
String messageTitle = Localiser["security.caption.request.password"];
|
||||
|
||||
// Validate referrer.
|
||||
if (!ValidReferer)
|
||||
return Forbid();
|
||||
if (!ValidReferer) return Forbid();
|
||||
|
||||
// Validate data.
|
||||
model.ValidateRequestPasswordData(responseData);
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
if (responseData.HasControlErrors()) return Json(responseData);
|
||||
|
||||
// Retrieve user account.
|
||||
using (SaSecurityItem securityItemUser = SecurityConsole.GetUserByEmail(model.EmailAddress))
|
||||
using (SbmAffiliate affiliateUser = AccountMgr.GetAffiliateByUserId(securityItemUser?.Id ?? null))
|
||||
// Identify session contexts with a BusMgr database that hosts the specified email address.
|
||||
List<ushort> sessionContextIdxs = SbmSessionContextHelper_Web.GetSessionContextIdxsForUsersBusMgrDatabase(model.EmailAddress);
|
||||
foreach (ushort sessionContextIdx in sessionContextIdxs)
|
||||
{
|
||||
if (securityItemUser == null)
|
||||
SaLogger.Warn(fn + " Unable to send password request email to " + model.EmailAddress + " - security item does not exist");
|
||||
else if (affiliateUser == null)
|
||||
SaLogger.Warn(fn + " Unable to send password request email to " + model.EmailAddress + " - account does not exist");
|
||||
else if (!affiliateUser.IsStatusActive)
|
||||
SaLogger.Warn(fn + " Unable to send password request email to " + model.EmailAddress + " - account is not active");
|
||||
else
|
||||
SbmSessionContext sessionContext = SbmSessionContextHelper_Web.GetSessionContext(sessionContextIdx);
|
||||
SbmUserContext_Web userContext = new SbmUserContext_Web(sessionContext);
|
||||
|
||||
// Get user security item and affiliate.
|
||||
using (SaSecurityConsole securityConsole = App.CreateSecurityConsole(userContext))
|
||||
{
|
||||
// Send password request email.
|
||||
SaEmailData emailData = new SaEmailData();
|
||||
emailData.Config = EmailConfig;
|
||||
emailData.AddressesTo.Add(model.EmailAddress);
|
||||
emailData.Subject = Localiser["security.caption.request.password"];
|
||||
PopulateRequestPasswordEmailBody(emailData, securityItemUser, affiliateUser);
|
||||
if (EmailConsole.SendEmail(emailData))
|
||||
SaLogger.Info(fn + " Password request email sent to " + model.EmailAddress, true);
|
||||
else SaLogger.Warn(fn + " Failed to send password request email to " + model.EmailAddress);
|
||||
using (SaSecurityItem securityItemUser = securityConsole.GetUserByEmail(model.EmailAddress))
|
||||
{
|
||||
if (securityItemUser != null)
|
||||
{
|
||||
using (SbmAccountMgr accountMgr = App.System.CreateAccountMgr(userContext))
|
||||
{
|
||||
using (SbmAffiliate affiliateUser = accountMgr.GetAffiliateByUserId(securityItemUser.Id))
|
||||
{
|
||||
if (affiliateUser != null)
|
||||
{
|
||||
if (affiliateUser.Status == SaStatus.Current || affiliateUser.IsStatusActive)
|
||||
{
|
||||
SbmEmailConsole emailConsole = App.CreateEmailConsole(userContext);
|
||||
|
||||
// Send password request email.
|
||||
SaEmailData emailData = new SaEmailData();
|
||||
emailData.Config = App.EmailConfig;
|
||||
emailData.AddressesTo.Add(model.EmailAddress);
|
||||
emailData.Subject = Localiser["security.caption.request.password"];
|
||||
PopulateRequestPasswordEmailBody(emailConsole, userContext, emailData, securityItemUser, affiliateUser);
|
||||
if (emailConsole.SendEmail(emailData))
|
||||
SaLogger.Info(fn + " Password request email sent to " + model.EmailAddress, true);
|
||||
else SaLogger.Warn(fn + " Failed to send password request email to " + model.EmailAddress);
|
||||
}
|
||||
else SaLogger.Warn(fn + " Unable to send password request email to " + model.EmailAddress + " - affiliate is not active");
|
||||
}
|
||||
else SaLogger.Warn(fn + " Unable to send password request email to " + model.EmailAddress + " - affiliate does not exist. UserId: " + SysId.ToString(securityItemUser.Id));
|
||||
}
|
||||
}
|
||||
}
|
||||
else SaLogger.Warn(fn + " Unable to send password request email to " + model.EmailAddress + " - security item does not exist.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -376,17 +414,17 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.Controllers
|
||||
responseData.SuccessMsg = Localiser["security.msg.request.password.email.sent"];
|
||||
return Json(responseData);
|
||||
}
|
||||
private void PopulateRequestPasswordEmailBody(SaEmailData emailData, SaSecurityItem securityItemUser, SbmAffiliate userAccount)
|
||||
private void PopulateRequestPasswordEmailBody(SbmEmailConsole emailConsole, SbmUserContext userContext, SaEmailData emailData, SaSecurityItem securityItemUser, SbmAffiliate affiliateUser)
|
||||
{
|
||||
// Will need to handle culture (language/country) as and when introduced.
|
||||
emailData.MessageBody = SbmResourceHelper.GetTextResource(SbmResourceHelper.TextResource.Email_RequestPassword_Html);
|
||||
emailData.HtmlBody = true;
|
||||
|
||||
// Replace dynamic tags.
|
||||
EmailConsole.ReplaceDynamicEmailBodyTags(emailData, SessionData);
|
||||
emailConsole.ReplaceDynamicEmailBodyTags(emailData, null);
|
||||
|
||||
// Replace dynamic tag for link back to change password page.
|
||||
SaEmailConsole.ReplaceDynamicEmailTag(emailData, "[#Link.RequestPassword]", GenerateRequestPasswordLink(securityItemUser.Id, userAccount.Id, securityItemUser.EmailAddress, ""));
|
||||
SaEmailConsole.ReplaceDynamicEmailTag(emailData, "[#Link.RequestPassword]", GenerateRequestPasswordLink(securityItemUser.Id, affiliateUser.Id, securityItemUser.EmailAddress, ""));
|
||||
SaEmailConsole.ReplaceDynamicEmailTag(emailData, "[#Link.ExpiresMinutes]", GetRequestPasswordEmailLinkExpiresMinutes().ToString());
|
||||
}
|
||||
|
||||
@@ -401,8 +439,8 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.Controllers
|
||||
// NB IV value is generated from the key and fixed so that it doesn't change when the application restarts.
|
||||
// IV Must be regenerated if key is changed.
|
||||
private static String Base64Key_RequestPassword { get; } = SacsEncryptionHelper.EncodePlainKey("[-SaBusMgr+<Request=Password>!^]", SacsEncryptionHelper.KeyLength);
|
||||
private static String Base64IV_RequestPassword_Generated { get; } = SacsEncryptionHelper.InitSymmetricEncryptionIV(Base64Key_RequestPassword);
|
||||
private static String Base64IV_RequestPassword { get; } = "1VAWYTW6d72n/6HDNhbqow==";
|
||||
//private static String Base64IV_RequestPassword_Generated { get; } = SacsEncryptionHelper.InitSymmetricEncryptionIV(Base64Key_RequestPassword);
|
||||
private static String Base64IV_RequestPassword { get; } = "iALRIxzrZIfrB4boNFRXfA==";
|
||||
private String GenerateRequestPasswordLink(SysId securityItemId, SysId affiliateId, String emailAddress, String requestPasswordToken)
|
||||
{
|
||||
NameValueCollection parameters = new NameValueCollection();
|
||||
@@ -418,7 +456,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.Controllers
|
||||
}
|
||||
private int GetRequestPasswordEmailLinkExpiresMinutes()
|
||||
{
|
||||
int expiresMinutes = SessionConfig.Security.SignIn.PasswordRequest.EmailLinkExpiresMins;
|
||||
int expiresMinutes = AppConfig.Security.SignIn.PasswordRequest.EmailLinkExpiresMins;
|
||||
int expiresMinutes_Min = Sbm.Config.Security.SignIn.PasswordRequest.EmailLinkExpiresMins_Min;
|
||||
int expiresMinutes_Max = Sbm.Config.Security.SignIn.PasswordRequest.EmailLinkExpiresMins_Max;
|
||||
return Math.Max(expiresMinutes_Min, Math.Min(expiresMinutes_Max, expiresMinutes));
|
||||
@@ -456,13 +494,13 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Portal.Controllers
|
||||
DateUtil.IsValid(ExpiresAt) && ExpiresAt >= DateTime.Now;
|
||||
}
|
||||
/// <summary>Verify that the data is valid and the account details match.</summary>
|
||||
public bool IsValid(SaSecurityItem securityItemUser, SbmAffiliate userAccount)
|
||||
public bool IsValid(SaSecurityItem securityItemUser, SbmAffiliate affiliateUser)
|
||||
{
|
||||
return
|
||||
IsValid() &&
|
||||
userAccount != null &&
|
||||
affiliateUser != null &&
|
||||
securityItemUser.Id.Equals(SecurityItemId) &&
|
||||
userAccount.Id.Equals(AffiliateId) &&
|
||||
affiliateUser.Id.Equals(AffiliateId) &&
|
||||
securityItemUser.EmailAddress.EqualsCI(EmailAddress);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,4 +28,12 @@
|
||||
<ProjectReference Include="..\SaBusMgrStandardDbas\SaBusMgrStandardDbas.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="appsettings.Machine.Sarand107.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
{
|
||||
/* Current password - required when setting password within user session. */
|
||||
<div class="spacer4"></div>
|
||||
<div class="sbm-form-control">
|
||||
<div class="sbm-form-control PasswordCurrent">
|
||||
<div class="sbm-label"><label for="ifPasswordCurrent"><span><span class="required">*</span> @Localiser["label.password.current"]</span></label></div>
|
||||
<div class="sbm-control">
|
||||
@Html.PasswordFor(model => model.PasswordCurrent, new { @id = "ifPasswordCurrent", @class = "sbm-input", @maxlength = Model.PasswordMaxLength })
|
||||
@@ -34,7 +34,7 @@
|
||||
}
|
||||
|
||||
<div class="spacer4"></div>
|
||||
<div class="sbm-form-control">
|
||||
<div class="sbm-form-control Password">
|
||||
<div class="sbm-label"><label for="ifPassword"><span><span class="required">*</span> @Localiser["label.password"]</span></label></div>
|
||||
<div class="sbm-control">
|
||||
@Html.PasswordFor(model => model.Password, new { @id = "ifPassword", @class = "sbm-input", @maxlength = Model.PasswordMaxLength })
|
||||
@@ -47,7 +47,7 @@
|
||||
</div>
|
||||
|
||||
<div class="spacer4"></div>
|
||||
<div class="sbm-form-control">
|
||||
<div class="sbm-form-control PasswordConfirm">
|
||||
<div class="sbm-label"><label for="ifPasswordConfirm"><span><span class="required">*</span> @Localiser["label.password.confirm"]</span></label></div>
|
||||
<div class="sbm-control">
|
||||
@Html.PasswordFor(model => model.PasswordConfirm, new { @id = "ifPasswordConfirm", @class = "sbm-input", @maxlength = Model.PasswordMaxLength })
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user