3.0.2 .Net8

This commit is contained in:
Andy Howard
2025-11-20 17:17:57 +00:00
parent 1075e9eef5
commit 0c43bbad77
58 changed files with 382 additions and 343 deletions
@@ -1,14 +1,10 @@
using Sarand.BusinessMgr.Net.Core.Procs.Procs;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
{
@@ -29,11 +25,11 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
//-------------------------------------------------------------------
// F T P U t i l i t i e s
//-------------------------------------------------------------------
private String GetFtpUrl (FtpConfig ftpConfig, String path)
private String GetFtpUrl(FtpConfig ftpConfig, String path)
{
return "ftp://" + ftpConfig.Host + "/" + FtpUtil.CleansePath(path);
}
private FtpWebRequest CreateFtpRequest (FtpConfig ftpConfig, String path, bool keepAlive = true)
private FtpWebRequest CreateFtpRequest(FtpConfig ftpConfig, String path, bool keepAlive = true)
{
FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create(GetFtpUrl(ftpConfig, path));
// Credentials.
@@ -49,7 +45,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
ftpRequest.UsePassive = true;
return ftpRequest;
}
private WebClient CreateFtpWebClient (FtpConfig ftpConfig)
private WebClient CreateFtpWebClient(FtpConfig ftpConfig)
{
WebClient webClient = new WebClient();
// Credentials.
@@ -60,7 +56,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
//-------------------------------------------------------------------
// Test connection.
protected bool TestFtpConnection (FtpConfig ftpConfig)
protected bool TestFtpConnection(FtpConfig ftpConfig)
{
WebResponse response = null;
try
@@ -79,7 +75,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
}
catch (Exception exc)
{
SaLogger.Warn($"{SysUtil.Fn} " + exc.GetType().Name + ": " + exc.Message, true);
SaLogger.Warn($"{SysUtil.Fn} {ExceptionUtil.GetErrorStateMessage(exc)}", true);
return AddErrorMessage("Unable to connect to FTP host");
}
finally
@@ -88,7 +84,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
}
return true;
}
protected bool CloseFtpConnection (FtpConfig ftpConfig)
protected bool CloseFtpConnection(FtpConfig ftpConfig)
{
WebResponse response = null;
try
@@ -107,7 +103,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
}
//-------------------------------------------------------------------
protected bool FtpFolderExists (FtpConfig ftpConfig, String folder)
protected bool FtpFolderExists(FtpConfig ftpConfig, String folder)
{
WebResponse response = null;
try
@@ -135,7 +131,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
}
catch (Exception exc)
{
SaLogger.Warn($"{SysUtil.Fn} " + exc.GetType().Name + ": " + exc.Message, true);
SaLogger.Warn($"{SysUtil.Fn} {ExceptionUtil.GetErrorStateMessage(exc)}", true);
return false;
}
finally
@@ -147,12 +143,12 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
//-------------------------------------------------------------------
/// <summary>Get list of items in remote FTP folder.</summary>
protected List<FtpUtil.FtpDirectoryItem> GetFtpFileItems (FtpConfig ftpConfig, String folder)
protected List<FtpUtil.FtpDirectoryItem> GetFtpFileItems(FtpConfig ftpConfig, String folder)
{
return GetFtpItems(ftpConfig, folder).FindAll(item => !item.IsDirectory);
}
/// <summary>Get list of items in remote FTP folder.</summary>
protected List<FtpUtil.FtpDirectoryItem> GetFtpItems (FtpConfig ftpConfig, String folder)
protected List<FtpUtil.FtpDirectoryItem> GetFtpItems(FtpConfig ftpConfig, String folder)
{
List<FtpUtil.FtpDirectoryItem> files = new List<FtpUtil.FtpDirectoryItem>();
WebResponse response = null;
@@ -180,7 +176,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
}
catch (Exception exc)
{
SaLogger.Warn($"{SysUtil.Fn} " + exc.GetType().Name + ": " + exc.Message, true);
SaLogger.Warn($"{SysUtil.Fn} {ExceptionUtil.GetErrorStateMessage(exc)}", true);
}
finally
{
@@ -190,7 +186,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
}
//-------------------------------------------------------------------
protected String GetFtpFileData (FtpConfig ftpConfig, String folder, String filename)
protected String GetFtpFileData(FtpConfig ftpConfig, String folder, String filename)
{
WebClient ftpClient = null;
try
@@ -202,7 +198,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
}
catch (Exception exc)
{
SaLogger.Warn($"{SysUtil.Fn} " + exc.GetType().Name + ": " + exc.Message, true);
SaLogger.Warn($"{SysUtil.Fn} {ExceptionUtil.GetErrorStateMessage(exc)}", true);
}
finally
{
@@ -212,7 +208,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
}
//-------------------------------------------------------------------
protected bool WriteDataToFtpFile (FtpConfig ftpConfig, String folder, String filename, String data)
protected bool WriteDataToFtpFile(FtpConfig ftpConfig, String folder, String filename, String data)
{
bool dataWrittenToFile = false;
FtpWebResponse response = null;
@@ -230,7 +226,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
}
catch (Exception exc)
{
SaLogger.Warn($"{SysUtil.Fn} " + exc.GetType().Name + ": " + exc.Message, true);
SaLogger.Warn($"{SysUtil.Fn} {ExceptionUtil.GetErrorStateMessage(exc)}", true);
}
finally
{
@@ -240,7 +236,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
}
//-------------------------------------------------------------------
protected bool DeleteFtpFile (FtpConfig ftpConfig, String folder, String filename)
protected bool DeleteFtpFile(FtpConfig ftpConfig, String folder, String filename)
{
bool fileDeleted = false;
FtpWebResponse response = null;
@@ -255,7 +251,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
}
catch (Exception exc)
{
SaLogger.Warn($"{SysUtil.Fn} " + exc.GetType().Name + ": " + exc.Message, true);
SaLogger.Warn($"{SysUtil.Fn} {ExceptionUtil.GetErrorStateMessage(exc)}", true);
}
finally
{
+1 -1
View File
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Sarand.BusinessMgr.Net.Core</RootNamespace>
</PropertyGroup>
+1 -1
View File
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Sarand.BusinessMgr.Net.Core</RootNamespace>
</PropertyGroup>
@@ -1,42 +1,21 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Localization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Routing;
using Microsoft.Net.Http.Headers;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using Sacs.Web.Components;
using Sarand.BusinessMgr.Net.Core.Web.App;
using Sarand.BusinessMgr.Net.Standard.Base.App;
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
using Sarand.BusinessMgr.Net.Standard.Base.Core;
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
using Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control;
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.Email;
using Sarand.Net.Standard.Base.Helpers;
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;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
namespace Sarand.BusinessMgr.Net.Core.Web.Components
{
@@ -113,9 +92,9 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Components
{
if (Response.Headers.ContainsKey(HeaderNames.CacheControl))
Response.Headers.Remove(HeaderNames.CacheControl);
Response.Headers.Add(HeaderNames.CacheControl, "no-cache, no-store, must-revalidate");
Response.Headers.Add(HeaderNames.Pragma, "no-cache");
Response.Headers.Add(HeaderNames.Expires, "0");
Response.Headers.Append(HeaderNames.CacheControl, "no-cache, no-store, must-revalidate");
Response.Headers.Append(HeaderNames.Pragma, "no-cache");
Response.Headers.Append(HeaderNames.Expires, "0");
}
base.OnActionExecuted(filterContext);
@@ -233,7 +212,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Components
}
catch (Exception exc)
{
SaLogger.Warn($"{SysUtil.Fn} {exc.GetType().Name} - {exc.Message}{exc.GetStackEntries().Concat("", "\n\t")}");
SaLogger.Warn($"{SysUtil.Fn} {ExceptionUtil.GetErrorStateMessage(exc)}{exc.GetStackEntries().Concat("", "\n\t")}");
}
return null;
}
@@ -1,10 +1,7 @@
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Net;
using System.Text;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
@@ -20,8 +17,8 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Middleware
// Data members.
//-------------------------------------------------------------------
public SbmAuthenticationHandler(IOptionsMonitor<AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock) :
base(options, logger, encoder, clock)
public SbmAuthenticationHandler(IOptionsMonitor<AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder)
: base(options, logger, encoder)
{
}
+3 -1
View File
@@ -13,7 +13,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
public static class Version
{
private static String version { get; } = "3.0.1.9";
private static String version { get; } = "3.0.2.0";
// Retrieve version.
public static String GetFullVersion() { return version; }
public static String GetAppVersion()
@@ -35,6 +35,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
// Version history.
//-------------------------------------------------------------------
// 3.0.2 20-Nov-25 .Net 8.
//-------------------------------------------------------------------
// 3.0.1 19-Feb-25 Portal Transactions.
// 3.0.1.1 19-Feb-25 Portal tidy.
// 3.0.1.2 26-Feb-25 Requirements & tidy.
@@ -1,5 +1,6 @@
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Data;
using Sarand.Net.Standard.Base.Utils;
using System;
namespace Sarand.BusinessMgr.Net.Standard.Base.Data
@@ -25,7 +26,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Data
{
return SacsAesIvCrypter.Encrypt(value, requestDataKey);
}
catch (Exception exc) { SaLogger.Debug("EncryptRequestData " + exc.GetType().Name + ": " + exc.Message); }
catch (Exception exc) { SaLogger.Debug($"EncryptRequestData {ExceptionUtil.GetErrorStateMessage(exc)}"); }
return value;
}
/// <summary>Decrypt request data</summary>
@@ -35,7 +36,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Data
{
return SacsAesIvCrypter.Decrypt(value, requestDataKey);
}
catch (Exception exc) { SaLogger.Debug("DecryptRequestData " + exc.GetType().Name + ": " + exc.Message); }
catch (Exception exc) { SaLogger.Debug($"DecryptRequestData {ExceptionUtil.GetErrorStateMessage(exc)}"); }
return value;
}
@@ -49,7 +50,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Data
{
return SacsAesIvCrypter.Encrypt(value, responseDataKey);
}
catch (Exception exc) { SaLogger.Debug("EncryptResponseData " + exc.GetType().Name + ": " + exc.Message); }
catch (Exception exc) { SaLogger.Debug($"EncryptRequestData {ExceptionUtil.GetErrorStateMessage(exc)}"); }
return value;
}
/// <summary>Decrypt response data</summary>
@@ -59,7 +60,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Data
{
return SacsAesIvCrypter.Decrypt(value, responseDataKey);
}
catch (Exception exc) { SaLogger.Debug("DecryptResponseData " + exc.GetType().Name + ": " + exc.Message); }
catch (Exception exc) { SaLogger.Debug($"EncryptRequestData {ExceptionUtil.GetErrorStateMessage(exc)}"); }
return value;
}
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Sarand.BusinessMgr.Net.Standard</RootNamespace>
</PropertyGroup>
@@ -1,5 +1,5 @@
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.IO;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.IO;
@@ -33,7 +33,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Utils
{
return Directory.Exists(directoryPath);
}
catch (Exception exc) { SaLogger.Debug("SbmFileUtil.IsDirectory " + exc.GetType().Name + ": " + exc.Message); }
catch (Exception exc) { SaLogger.Debug($"SbmFileUtil.IsDirectory {ExceptionUtil.GetErrorStateMessage(exc)}"); }
return false;
}
public static String GetParentDirectory(String filepath)
@@ -44,7 +44,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Utils
if (parentDirectoryInfo != null)
return parentDirectoryInfo.FullName;
}
catch (Exception exc) { SaLogger.Debug("SbmFileUtil.GetParentDirectory " + exc.GetType().Name + ": " + exc.Message); }
catch (Exception exc) { SaLogger.Debug($"SbmFileUtil.GetParentDirectory {ExceptionUtil.GetErrorStateMessage(exc)}"); }
return String.Empty;
}
public static bool CreateDirectory(String directoryPath)
@@ -54,7 +54,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Utils
DirectoryInfo info = Directory.CreateDirectory(directoryPath);
return info.Exists;
}
catch (Exception exc) { SaLogger.Debug("SbmFileUtil.CreateDirectory " + exc.GetType().Name + ": " + exc.Message); }
catch (Exception exc) { SaLogger.Debug($"SbmFileUtil.CreateDirectory {ExceptionUtil.GetErrorStateMessage(exc)}"); }
return false;
}
//-------------------------------------------------------------------
@@ -66,7 +66,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Utils
{
return File.Exists(filePath);
}
catch (Exception exc) { SaLogger.Debug("SbmFileUtil.IsFile " + exc.GetType().Name + ": " + exc.Message); }
catch (Exception exc) { SaLogger.Debug($"SbmFileUtil.IsFile {ExceptionUtil.GetErrorStateMessage(exc)}"); }
return false;
}
public static String[] FileReadAllLines(String filePath)
@@ -75,7 +75,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Utils
{
return File.ReadAllLines(filePath);
}
catch (Exception exc) { SaLogger.Debug("SbmFileUtil.FileReadAllLines " + exc.GetType().Name + ": " + exc.Message); }
catch (Exception exc) { SaLogger.Debug($"SbmFileUtil.FileReadAllLines {ExceptionUtil.GetErrorStateMessage(exc)}"); }
return new String[0];
}
//-------------------------------------------------------------------
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Sarand.BusinessMgr.Net.Standard</RootNamespace>
</PropertyGroup>
@@ -187,14 +187,14 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Account
// Identify item.
SysId userAccountId = SysId.ToSysId(model.User.Id);
if (!SysId.IsValid(userAccountId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SbmcUserAccount user = ControlAccountMgr.GetUserAccountById(userAccountId);
if (user == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve user for Id: '" + userAccountId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Construct response.
@@ -267,12 +267,12 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Account
if (StringUtil.ToBool(model.User.Exists) && !SysId.IsValid(userAccountId))
{
SaLogger.Warn($"{SysUtil.Fn} User Id not supplied for existing item.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (!StringUtil.ToBool(model.User.Exists) && SysId.IsValid(userAccountId))
{
SaLogger.Warn($"{SysUtil.Fn} User Id supplied for new item.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Validate item properties.
@@ -289,7 +289,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Account
if (user == null && SysId.IsValid(userAccountId))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve user for Id: '" + model.User.Id + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Create new item if required.
@@ -324,18 +324,18 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Account
if (!ControlAccountMgr.InsertUserAccount(user, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to insert user: " + ControlAccountMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"] + "\n\n" + ControlAccountMgr.ErrorStateMessage));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.insert.failed"] + "\n\n" + ControlAccountMgr.ErrorStateMessage));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.created"]);
}
else
{
if (!ControlAccountMgr.UpdateUserAccount(user, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to update user [Id:" + SysId.ToString(user.Id) + "]: " + ControlAccountMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"] + "\n\n" + ControlAccountMgr.ErrorStateMessage));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.update.failed"] + "\n\n" + ControlAccountMgr.ErrorStateMessage));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.updated"]);
}
// Construct response.
@@ -370,7 +370,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Account
if (userAccount == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve user for Id: '" + model.User.Id + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Email types to send.
@@ -378,32 +378,32 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Account
bool sendRequestPasswordPortal = StringUtil.ToBool(model.UserEmailRequestPasswordPortal);
bool sendRequestPasswordControl = StringUtil.ToBool(model.UserEmailRequestPasswordControl);
if (!sendAcountActivationPortal && !sendRequestPasswordPortal && !sendRequestPasswordControl)
return Json(responseData.SetMessage(messageTitle, Localiser["msg.validation.select.option"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.validation.select.option"]));
// Send emails.
int emailsSentCount = 0;
if (sendAcountActivationPortal)
{
//if (!OrganisationController.SendAccountActivatedEmail(this, userAccount))
return Json(responseData.SetMessage(messageTitle, "Failed to send Online Account Activation email."));
return Json(responseData.SetPopupMessage(messageTitle, "Failed to send Online Account Activation email."));
//emailsSentCount++;
}
if (sendRequestPasswordPortal)
{
if (!SecurityController.SendRequestPasswordEmail(this, userAccount, true))
return Json(responseData.SetMessage(messageTitle, "Failed to send Online Request Password email."));
return Json(responseData.SetPopupMessage(messageTitle, "Failed to send Online Request Password email."));
emailsSentCount++;
}
if (sendRequestPasswordControl)
{
if (!SecurityController.SendRequestPasswordEmail(this, userAccount, false))
return Json(responseData.SetMessage(messageTitle, "Failed to send Control Request Password email."));
return Json(responseData.SetPopupMessage(messageTitle, "Failed to send Control Request Password email."));
emailsSentCount++;
}
// Construct response.
PopulateUserResponseItemData(model, responseData.user, userAccount);
responseData.SetNotification(messageTitle, "Emails sent: " + emailsSentCount);
responseData.SetNotifyMessage(messageTitle, "Emails sent: " + emailsSentCount);
responseData.Success = true;
}
return Json(responseData);
@@ -171,14 +171,14 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
// Identify item.
SysId ownerId = SysId.ToSysId(model.Owner.Id);
if (!SysId.IsValid(ownerId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SbmcOwner owner = ControlInstanceMgr.GetOwnerById(ownerId);
if (owner == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve owner for Id: '" + ownerId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Construct response.
@@ -209,12 +209,12 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (StringUtil.ToBool(model.Owner.Exists) && !SysId.IsValid(ownerId))
{
SaLogger.Warn($"{SysUtil.Fn} Owner Id not supplied for existing item.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (!StringUtil.ToBool(model.Owner.Exists) && SysId.IsValid(ownerId))
{
SaLogger.Warn($"{SysUtil.Fn} Owner Id supplied for new item.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Validate item properties.
@@ -231,7 +231,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (owner == null && SysId.IsValid(ownerId))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve owner for Id: '" + model.Owner.Id + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Create new item if required.
@@ -260,18 +260,18 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (!ControlInstanceMgr.InsertOwner(owner, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to insert owner: " + ControlInstanceMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"] + "\n\n" + ControlInstanceMgr.ErrorStateMessage));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.insert.failed"] + "\n\n" + ControlInstanceMgr.ErrorStateMessage));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.created"]);
}
else
{
if (!ControlInstanceMgr.UpdateOwner(owner, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to update owner [Id:" + SysId.ToString(owner.Id) + "]: " + ControlInstanceMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"] + "\n\n" + ControlInstanceMgr.ErrorStateMessage));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.update.failed"] + "\n\n" + ControlInstanceMgr.ErrorStateMessage));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.updated"]);
}
// Construct response.
@@ -170,14 +170,14 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
// Identify item.
SysId repositoryId = SysId.ToSysId(model.Repository.Id);
if (!SysId.IsValid(repositoryId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SbmcRepository repository = ControlInstanceMgr.GetRepositoryById(repositoryId);
if (repository == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve repository for Id: '" + repositoryId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Owner.
@@ -185,7 +185,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (owner == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve owner for Id: '" + repository.OwnerId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Construct response.
@@ -235,14 +235,14 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
// Identify item.
SysId repositoryId = SysId.ToSysId(model.Repository.Id);
if (!SysId.IsValid(repositoryId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SbmcRepository repository = ControlInstanceMgr.GetRepositoryById(repositoryId);
if (repository == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve repository for Id: '" + repositoryId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
responseData.repository.Id = SysId.ToString(repository.Id);
@@ -292,12 +292,12 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (StringUtil.ToBool(model.Repository.Exists) && !SysId.IsValid(repositoryId))
{
SaLogger.Warn($"{SysUtil.Fn} Repository Id not supplied for existing item.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (!StringUtil.ToBool(model.Repository.Exists) && SysId.IsValid(repositoryId))
{
SaLogger.Warn($"{SysUtil.Fn} Repository Id supplied for new item.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Validate item properties.
@@ -314,7 +314,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (repository == null && SysId.IsValid(repositoryId))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve repository for Id: '" + model.Repository.Id + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Owner.
@@ -323,7 +323,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (owner == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve owner for Id: '" + ownerId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Create new item if required.
@@ -355,18 +355,18 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (!ControlInstanceMgr.InsertRepository(repository, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to insert repository: " + ControlInstanceMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"] + "\n\n" + ControlInstanceMgr.ErrorStateMessage));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.insert.failed"] + "\n\n" + ControlInstanceMgr.ErrorStateMessage));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.created"]);
}
else
{
if (!ControlInstanceMgr.UpdateRepository(repository, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to update repository [Id:" + SysId.ToString(repository.Id) + "]: " + ControlInstanceMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"] + "\n\n" + ControlInstanceMgr.ErrorStateMessage));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.update.failed"] + "\n\n" + ControlInstanceMgr.ErrorStateMessage));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.updated"]);
// In case Repository definition has changed since Instance was registered with Application.
App_Control.RefreshInstanceSessionProperties(repository);
}
@@ -1,6 +1,4 @@
using DocumentFormat.OpenXml.Drawing.Charts;
using Microsoft.AspNetCore.Mvc;
using NPOI.SS.Formula.Functions;
using Microsoft.AspNetCore.Mvc;
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
using Sarand.BusinessMgr.Net.Standard.Dbas.Consoles;
using Sarand.BusinessMgr.Web.Control.Components;
@@ -67,13 +65,13 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (StringUtil.IsBlank(model.DatabaseFilter.Context))
{
SaLogger.Warn($"{SysUtil.Fn} Repository Context not supplied.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
SbmcRepository repository = ControlInstanceMgr.GetRepositoryByContext(model.DatabaseFilter.Context);
if (repository == null)
{
SaLogger.Warn($"{SysUtil.Fn} Repository does not exist. Context: {model.DatabaseFilter.Context}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Repository Console.
@@ -123,6 +121,13 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
};
responseData.Tables.Add(tableData);
}
if (!responseData.Tables.Any())
{
if (resultSet?.HasErrorState() ?? false)
return Json(responseData.SetErrorMessage(resultSet.ErrorStateMessage));
if (instanceConsole.Database.HasErrorState())
return Json(responseData.SetErrorMessage(instanceConsole.Database.ErrorStateMessage));
}
}
if (model.Paging.IsPaged)
model.Paging.ItemCount = (ushort)responseData.Tables.Count;
@@ -172,13 +177,13 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (StringUtil.IsBlank(model.DatabaseFilter.Context))
{
SaLogger.Warn($"{SysUtil.Fn} Repository Context not supplied.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
SbmcRepository repository = ControlInstanceMgr.GetRepositoryByContext(model.DatabaseFilter.Context);
if (repository == null)
{
SaLogger.Warn($"{SysUtil.Fn} Repository does not exist. Context: {model.DatabaseFilter.Context}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Repository Console.
@@ -192,7 +197,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
SacsDatabaseConsole.IndexStats indexStats = new SacsDatabaseConsole.IndexStats();
dbConsole.InstallDbIndices(indexStats);
if (dbConsole.HasErrorState())
return Json(responseData.SetMessage(messageTitle, $"Error encountered: {dbConsole.ErrorStateMessage.Trim('.')}."));
return Json(responseData.SetPopupMessage(messageTitle, $"Error encountered: {dbConsole.ErrorStateMessage.Trim('.')}."));
// Statistics.
if (indexStats.PrimaryIndicesCreated > 0)
@@ -208,7 +213,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
statsOutput.Add($"Indices Created: {indexStats.IndicesCreated}.");
if (indexStats.IndicesDropped > 0)
statsOutput.Add($"Indices dropped: {indexStats.IndicesDropped}.");
responseData.SetMessage(messageTitle, $"Indices populated.\n{statsOutput.Concat("", "\n")}");
responseData.SetPopupMessage(messageTitle, $"Indices populated.\n{statsOutput.Concat("", "\n")}");
}
// Complete response.
@@ -103,13 +103,13 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (!SysId.IsValid(repositoryId))
{
SaLogger.Warn($"{SysUtil.Fn} Repository Id not supplied.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
SbmcRepository repository = ControlInstanceMgr.GetRepositoryById(repositoryId);
if (repository == null)
{
SaLogger.Warn($"{SysUtil.Fn} Repository does not exist. Id: {repositoryId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
responseData.Repository.Id = $"{SysId.ToLong(repository.Id)}";
responseData.Repository.Context = repository.Context;
@@ -119,7 +119,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (owner == null)
{
SaLogger.Warn($"{SysUtil.Fn} Owner does not exist. Id: {repository.OwnerId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
responseData.Repository.OwnerId = $"{SysId.ToLong(owner.Id)}";
responseData.Repository.OwnerName = owner.Name;
@@ -219,19 +219,19 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (!SysId.IsValid(repositoryId))
{
SaLogger.Warn($"{SysUtil.Fn} Repository Id not supplied.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
SbmcRepository repository = ControlInstanceMgr.GetRepositoryById(repositoryId);
if (repository == null)
{
SaLogger.Warn($"{SysUtil.Fn} Repository does not exist. Id: {repositoryId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
SbmcOwner owner = ControlInstanceMgr.GetOwnerById(repository.OwnerId);
if (owner == null)
{
SaLogger.Warn($"{SysUtil.Fn} Owner does not exist. Id: {repository.OwnerId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Core Instance Console.
@@ -246,7 +246,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (!SysId.IsValid(affiliateIdOrganisation))
{
SaLogger.Warn($"{SysUtil.Fn} Affiliate Id not specified for existing Organisation.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Validate Organisation Affiliate.
@@ -254,12 +254,12 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (affiliateOrganisation == null)
{
SaLogger.Warn($"{SysUtil.Fn} Affiliate not found for existing Organisation. Id: {model.Organisation.AffiliateId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (!affiliateOrganisation.IsOrganisation())
{
SaLogger.Warn($"{SysUtil.Fn} Affiliate for existing Organisation is not an organisation. Id: {model.Organisation.AffiliateId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
@@ -268,7 +268,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (!SysId.IsValid(associationIdInternal))
{
SaLogger.Warn($"{SysUtil.Fn} Association Id not specified for existing Organisation.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
else
{
@@ -277,22 +277,22 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (associationOrganisation == null)
{
SaLogger.Warn($"{SysUtil.Fn} Association not found for existing Organisation. Id: {model.Organisation.AssociationId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (!associationOrganisation.AffiliateIdOwner.Equals(affiliateIdOrganisation))
{
SaLogger.Warn($"{SysUtil.Fn} Association for existing Organisation does not match Owner Affiliate. Id: {model.Organisation.AssociationId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (!associationOrganisation.AffiliateIdTarget.Equals(affiliateIdOrganisation))
{
SaLogger.Warn($"{SysUtil.Fn} Association for existing Organisation does not match Target Affiliate. Id: {model.Organisation.AssociationId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (!associationOrganisation.IsInternal())
{
SaLogger.Warn($"{SysUtil.Fn} Association for existing Organisation is not internal. Id: {model.Organisation.AssociationId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
}
}
@@ -302,12 +302,12 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (SysId.IsValid(SysId.ToSysId(model.Organisation.AffiliateId)))
{
SaLogger.Warn($"{SysUtil.Fn} Affiliate Id specified for new Organisation. Id: {model.Organisation.AffiliateId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (SysId.IsValid(SysId.ToSysId(model.Organisation.AssociationId)))
{
SaLogger.Warn($"{SysUtil.Fn} Association Id specified for new Organisation. Id: {model.Organisation.AssociationId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
}
@@ -319,7 +319,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (!SysId.IsValid(affiliateIdUser))
{
SaLogger.Warn($"{SysUtil.Fn} Affiliate Id not specified for existing User.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Validate User Affiliate.
@@ -327,12 +327,12 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (affiliateUser == null)
{
SaLogger.Warn($"{SysUtil.Fn} Affiliate not found for existing User. Id: {model.User.AffiliateId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (!affiliateUser.IsIndividual())
{
SaLogger.Warn($"{SysUtil.Fn} Affiliate for existing User is not an individual. Id: {model.User.AffiliateId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Validate existing User Security Item.
@@ -340,7 +340,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (!SysId.IsValid(secItemIdUser))
{
SaLogger.Warn($"{SysUtil.Fn} Security Item Id not specified for existing User.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
else
{
@@ -349,12 +349,12 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (securityItemUser == null)
{
SaLogger.Warn($"{SysUtil.Fn} Security Item not found for existing User. Id: {model.User.SecurityItemId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (!securityItemUser.Id.Equals(affiliateUser.UserId))
{
SaLogger.Warn($"{SysUtil.Fn} Security Item for existing User does not match User Id on Affilliate. Expected: {model.User.SecurityItemId}. Found: {affiliateUser.UserId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
}
}
@@ -364,12 +364,12 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
if (SysId.IsValid(SysId.ToSysId(model.User.AffiliateId)))
{
SaLogger.Warn($"{SysUtil.Fn} Affiliate Id specified for new User. Id: {model.User.AffiliateId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (SysId.IsValid(SysId.ToSysId(model.User.SecurityItemId)))
{
SaLogger.Warn($"{SysUtil.Fn} Security Item Id specified for new User. Id: {model.User.SecurityItemId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
}
@@ -399,7 +399,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
repoInitData.User.Password = model.User.Password;
repoInitData.User.PasswordSet = StringUtil.ToBool(model.User.PasswordSet);
if (!repositoryConsole.InitialiseRepository(repoInitData))
return Json(responseData.SetMessage(messageTitle, repositoryConsole.ErrorStateMessage));
return Json(responseData.SetPopupMessage(messageTitle, repositoryConsole.ErrorStateMessage));
// Complete response.
RepositoryController.PopulateRepositoryResponseListData(model, responseData.Repository, owner, repository);
@@ -283,14 +283,14 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Param
// Identify item.
SysId itemParamId = SysId.ToSysId(model.Param.Id);
if (!SysId.IsValid(itemParamId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SbmcItemParam itemParam = ControlItemMgr.GetItemParamById(itemParamId);
if (itemParam == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve itemParam for Id: '" + itemParamId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Construct response.
@@ -321,12 +321,12 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Param
if (StringUtil.ToBool(model.Param.Exists) && !SysId.IsValid(itemParamId))
{
SaLogger.Warn($"{SysUtil.Fn} Id not supplied for existing Item Param.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (!StringUtil.ToBool(model.Param.Exists) && SysId.IsValid(itemParamId))
{
SaLogger.Warn($"{SysUtil.Fn} Id supplied for new Item Param.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Validate item properties.
@@ -343,7 +343,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Param
if (itemParam == null && SysId.IsValid(itemParamId))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve Item Param for Id: '" + model.Param.Id + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Contruct item id.
@@ -352,7 +352,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Param
if (itemParam != null && !itemParam.ItemId.Equals(itemId))
{
SaLogger.Warn($"{SysUtil.Fn} Inconsistent Item Id specified for Item Param. Expected - Type: {(SbmcHierarchyItem.ItemType)itemParam.ItemId.Type}, Id: {itemParam.ItemId.Id}. Submitted - Type: {(SbmcHierarchyItem.ItemType)itemId.Type}, Id: {itemId.Id} ");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Ensure combination of item, name and context not duplicate.
@@ -375,17 +375,17 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Param
if (!ItemId.IsValid(itemId))
{
SaLogger.Warn($"{SysUtil.Fn} Item Id not specified for new Item Param.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (!SbmcItemParam.ValidItemTypes.Contains((SbmcHierarchyItem.ItemType)itemId.Type))
{
SaLogger.Warn($"{SysUtil.Fn} Invalid item type ({(SbmcHierarchyItem.ItemType)itemId.Type}) specified for new Item Param.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (StringUtil.IsBlank(ControlItemMgr.GetItemCaption(itemId)))
{
SaLogger.Warn($"{SysUtil.Fn} Invalid item (type: {(SbmcHierarchyItem.ItemType)itemId.Type}, id: {itemId.Id}) specified for new Item Param.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Create parameter.
@@ -410,18 +410,18 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Param
if (!ControlItemMgr.InsertItemParam(itemParam, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to insert Item Param: " + ControlItemMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"] + "\n\n" + ControlItemMgr.ErrorStateMessage));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.insert.failed"] + "\n\n" + ControlItemMgr.ErrorStateMessage));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.created"]);
}
else
{
if (!ControlItemMgr.UpdateItemParam(itemParam, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to update Item Param [Id:" + SysId.ToString(itemParam.Id) + "]: " + ControlItemMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"] + "\n\n" + ControlItemMgr.ErrorStateMessage));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.update.failed"] + "\n\n" + ControlItemMgr.ErrorStateMessage));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.updated"]);
}
// Construct response.
@@ -171,7 +171,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers
if (userAccount == null)
{
SaLogger.Warn($"{SysUtil.Fn} System error on sign-out - failed to retrieve account details. Id: " + SysId.ToInt(SessionData_Control.User.UserAccountId));
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Clear user session.
@@ -301,7 +301,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers
// Construct response.
responseData.Success = true;
if (validRequestPasswordParams)
responseData.SetMessage(messageTitle, Localiser["security.msg.request.password.saved"]);
responseData.SetPopupMessage(messageTitle, Localiser["security.msg.request.password.saved"]);
}
return Json(responseData);
@@ -65,18 +65,18 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.System
// Database instance.
Sbm.Database databaseInstance = EnumUtil.ParseEnum(StringUtil.EmptyOnNull(model.DatabaseFilter.Instance), Sbm.Database.Unknown);
if (databaseInstance <= 0)
return Json(responseData.SetMessage(messageTitle, $"Database instance must be specified."));
return Json(responseData.SetPopupMessage(messageTitle, $"Database instance must be specified."));
// Context.
if (databaseInstance == Sbm.Database.BusMgr)
{
if (StringUtil.IsBlank(model.DatabaseFilter.Context))
return Json(responseData.SetMessage(messageTitle, "BusMgr Database context must be specified"));
return Json(responseData.SetPopupMessage(messageTitle, "BusMgr Database context must be specified"));
}
ISacsDatabase db = GetDatabase(databaseInstance, model.DatabaseFilter.Context);
if (db == null)
return Json(responseData.SetMessage(messageTitle, $"Database unavailable for instance '{databaseInstance}'."));
return Json(responseData.SetPopupMessage(messageTitle, $"Database unavailable for instance '{databaseInstance}'."));
// Database table row counts.
Dictionary<String, int> tableRowCounts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
@@ -92,6 +92,13 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.System
{
tableRowCounts.Add(dbResultSet.GetRecordValues().GetValue("TableName").ToString(), (int)dbResultSet.GetRecordValues().GetValue("RowCount").AsLong());
}
if (!responseData.Tables.Any())
{
if (!responseData.Tables.Any() && (dbResultSet?.HasErrorState() ?? false))
return Json(responseData.SetErrorMessage(dbResultSet.ErrorStateMessage));
if (db.HasErrorState())
return Json(responseData.SetErrorMessage(db.ErrorStateMessage));
}
}
// Database tables.
@@ -196,26 +203,26 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.System
// Database instance.
Sbm.Database databaseInstance = EnumUtil.ParseEnum(StringUtil.EmptyOnNull(model.DatabaseFilter.Instance), Sbm.Database.Unknown);
if (databaseInstance <= 0)
return Json(responseData.SetMessage(messageTitle, "Database instance must be specified"));
return Json(responseData.SetPopupMessage(messageTitle, "Database instance must be specified"));
responseData.Instance = databaseInstance.ToString();
// Context.
if (databaseInstance == Sbm.Database.BusMgr)
{
if (StringUtil.IsBlank(model.DatabaseFilter.Context))
return Json(responseData.SetMessage(messageTitle, "BusMgr Database context must be specified"));
return Json(responseData.SetPopupMessage(messageTitle, "BusMgr Database context must be specified"));
responseData.Context = model.DatabaseFilter.Context;
}
// Database connection.
ISacsDatabase db = GetDatabase(databaseInstance, model.DatabaseFilter.Context);
if (db == null)
return Json(responseData.SetMessage(messageTitle, $"Unrecognised database instance specified: '{model.DatabaseFilter.Instance}'."));
return Json(responseData.SetPopupMessage(messageTitle, $"Unrecognised database instance specified: '{model.DatabaseFilter.Instance}'."));
// Retrieve XML database schema definition.
Dictionary<String, String> xmlSchemas = GetSmlSchemas(databaseInstance);
if (!xmlSchemas.Any())
return Json(responseData.SetMessage(messageTitle, "Failed to extract XML schema definitions."));
return Json(responseData.SetPopupMessage(messageTitle, "Failed to extract XML schema definitions."));
// Extract schema from XML definition.
SaDbProcess_ConvertDbSchema.Config cfgSchemaConvert = new SaDbProcess_ConvertDbSchema.Config();
@@ -234,7 +241,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.System
tables.Add(table);
}
if (procSchemaConvert.HasErrorMessage())
return Json(responseData.SetMessage(messageTitle, $"Failed to convert XML schema '{schemaName}': {procSchemaConvert.GetErrorMessage().TrimEnd('.')}."));
return Json(responseData.SetPopupMessage(messageTitle, $"Failed to convert XML schema '{schemaName}': {procSchemaConvert.GetErrorMessage().TrimEnd('.')}."));
}
SaDbProcess_CompareDatabaseSchemas.Config cfgSchemaCompare = new SaDbProcess_CompareDatabaseSchemas.Config(tables, db);
@@ -243,6 +250,8 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.System
SaDbProcess_CompareDatabaseSchemas procSchemaCompare = new SaDbProcess_CompareDatabaseSchemas(cfgSchemaCompare);
procSchemaCompare.OnSchemaComparisonItemAdded += OnSchemaComparisonItemAdded;
procSchemaCompare.RunProcess();
if (procSchemaCompare.HasErrorMessage())
return Json(responseData.SetErrorMessage(procSchemaCompare.GetErrorMessage()));
List<SaDbProcess_CompareDatabaseSchemas.SchemaComparisonItem> schemaComparisonItems = procSchemaCompare.GetSchemaComparisonItems();
foreach (SaDbProcess_CompareDatabaseSchemas.SchemaComparisonItem schemaComparisonItem in schemaComparisonItems)
@@ -443,18 +452,18 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.System
// Parameters.
if (StringUtil.IsEmpty(model.DatabaseTable.Name))
return Json(responseData.SetMessage(messageTitle, "Table name must be supplied."));
return Json(responseData.SetPopupMessage(messageTitle, "Table name must be supplied."));
// Database instance.
Sbm.Database databaseInstance = EnumUtil.ParseEnum(StringUtil.EmptyOnNull(model.DatabaseTable.Instance), Sbm.Database.Unknown);
if (databaseInstance <= 0)
return Json(responseData.SetMessage(messageTitle, "Database instance must be specified"));
return Json(responseData.SetPopupMessage(messageTitle, "Database instance must be specified"));
// Context.
if (databaseInstance == Sbm.Database.BusMgr)
{
if (StringUtil.IsBlank(model.DatabaseFilter.Context))
return Json(responseData.SetMessage(messageTitle, "BusMgr Database context must be specified"));
return Json(responseData.SetPopupMessage(messageTitle, "BusMgr Database context must be specified"));
}
// Database connection.
@@ -463,7 +472,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.System
// Table definition.
DbDfnTable tableDfn = db.GetTableDfn(model.DatabaseTable.Name, true);
if (tableDfn == null)
return Json(responseData.SetMessage(messageTitle, "Invalid Table name supplied."));
return Json(responseData.SetPopupMessage(messageTitle, "Invalid Table name supplied."));
// Populate table response.
responseData.Table = new AjaxResponseData_Table(tableDfn);
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<CopyRefAssembliesToPublishDirectory>false</CopyRefAssembliesToPublishDirectory>
<RootNamespace>Sarand.BusinessMgr.Web</RootNamespace>
<AssemblyName>Sarand.BusinessMgr.Web</AssemblyName>
@@ -152,8 +152,9 @@ ul.nav.sbc-burger .dropdown:hover
opacity: .75;
}
.navbar-light .navbar-toggler-icon {
background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3e%3cpath stroke='rgba(0, 0, 0, 0.8)' stroke-width='4' stroke-linecap='round' stroke-miterlimit='10' d='M4 6h22M4 14h22M4 22h22'/%3e%3c/svg%3e");
.navbar-light .navbar-toggler-icon
{
background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3e%3cpath stroke='rgba(0, 0, 0, 0.8)' stroke-width='4' stroke-linecap='round' stroke-miterlimit='10' d='M4 6h22M4 14h22M4 22h22'/%3e%3c/svg%3e");
}
ul.nav.sbc-burger.navbar-light .dropdown:hover
@@ -338,16 +339,31 @@ ul.nav.sbc-burger ul.sbc-dropdown-menu li.sbc-action.sbc-dropdown-item:hover .sb
.sbc-panel-messages .sbc-message
{
min-height: 20px;
margin: 4px 0;
padding-left: 24px;
padding-top: 2px;
padding-left: 28px;
background-position: left top;
background-repeat: no-repeat;
background-size: 20px 20px;
}
.sbc-panel-messages .sbc-message.sbc-info
{
color: #28a745;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%2328a745' viewBox='0 0 512 512'%3e%3cpath d='M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 110c23.2 0 42 18.8 42 42s-18.8 42-42 42-42-18.8-42-42 18.8-42 42-42zm56 308c0 6.6-5.4 12-12 12h-88c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h12v-86h-12c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h64c6.6 0 12 5.4 12 12v106h12c6.6 0 12 5.4 12 12v8z'/%3e%3c/svg%3e");
}
.sbc-panel-messages .sbc-message.sbc-warn
{
color: #ffc107;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23ffc107' viewBox='0 0 512 512'%3e%3cpath d='M256 48C141.1 48 48 141.1 48 256s93.1 208 208 208 208-93.1 208-208S370.9 48 256 48zm0 96c13.3 0 24 10.7 24 24v112c0 13.3-10.7 24-24 24s-24-10.7-24-24V168c0-13.3 10.7-24 24-24zm0 272a32 32 0 1 1 0-64 32 32 0 1 1 0 64z'/%3e%3c/svg%3e");
}
.sbc-panel-messages .sbc-message.sbc-error
{
color: #e3120b;
background-image: url("../img/icon/error-18.png");
color: #dc3545;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23dc3545' viewBox='0 0 576 512'%3e%3cpath d='M569.5 440.6 327.4 69.5c-18.8-29.3-61.1-29.3-79.9 0L6.5 440.6C-12.3 469.9 9.5 512 48 512h480c38.5 0 60.3-42.1 41.5-71.4zM288 392c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zm44-144c0 6.6-5.4 12-12 12h-64c-6.6 0-12-5.4-12-12v-72c0-6.6 5.4-12 12-12h64c6.6 0 12 5.4 12 12v72z'/%3e%3c/svg%3e");
}
/* Item List table */
@@ -27,7 +27,7 @@
var $msgs = $('.sbc-panel-messages', $pnlSchema).hide().empty().append($('<div class="sbc-message">' + sbc.msg.dataQuerying + '</div>')).fadeIn(200);
}
$('.DatabaseInstance', $frm.dbSchema).val(instance);
sbc.ajax.dbSchema = sbc.ajax.dbSchema || { url: sbc.url.base + 'System/Ajax/ValidateDatabaseSchema', formSel: $frm.dbSchema, callbackFn: ch.handleDbSchemaResponse, noWaitIcon: true };
sbc.ajax.dbSchema = sbc.ajax.dbSchema || { url: sbc.url.base + 'System/Ajax/ValidateDatabaseSchema', formSel: $frm.dbSchema, $msgs: $msgs, callbackFn: ch.handleDbSchemaResponse, noWaitIcon: true };
sbc.doAjaxRequest(sbc.ajax.dbSchema, delay || 50);
ch.awaitingSchemaResponse = true;
}
@@ -17,7 +17,7 @@
$pnl.table.find('tbody tr').remove();
$pnl.msgs.hide().empty().append($('<div class="sbc-message">' + sbc.msg.dataQuerying + '</div>')).fadeIn(200);
}
io.ajax.owners = io.ajax.owners || { url: sbc.url.base + 'Instance/Owner/Ajax/GetOwners', formId: $frm.filter.prop('id'), callbackFn: io.handleOwners };
io.ajax.owners = io.ajax.owners || { url: sbc.url.base + 'Instance/Owner/Ajax/GetOwners', formId: $frm.filter.prop('id'), $msgs: $pnl.msgs, callbackFn: io.handleOwners };
sbc.doAjaxRequest(io.ajax.owners, delay || 50);
io.awaitingRefreshResponse = true;
}
@@ -18,7 +18,7 @@
env.$pnl.table.find('tbody tr').remove();
env.$pnl.msgs.hide().empty().append($('<div class="sbc-message">' + sbc.msg.dataQuerying + '</div>')).fadeIn(200);
}
env.ajax.tables = env.ajax.tables || { url: sbc.url.base + 'Instance/Repository/Ajax/GetTables', formSel: env.$frm.filter, callbackFn: function (response) { cd.displayItems(env, response); } };
env.ajax.tables = env.ajax.tables || { url: sbc.url.base + 'Instance/Repository/Ajax/GetTables', formSel: env.$frm.filter, $msgs: env.$pnl.msgs, callbackFn: function (response) { cd.displayItems(env, response); } };
sbc.doAjaxRequest(env.ajax.tables, delay || 50);
cd.awaitingRefreshResponse = true;
}
@@ -26,7 +26,6 @@
{
//sbc.debug('displayItems', env, response);
delete cd.awaitingRefreshResponse;
env.$pnl.msgs.hide().empty();
let $table = $('table', env.$pnl.table).find('tbody tr').remove().end();
if (!response.success) return;
env.config = response.config || {};
@@ -43,7 +42,7 @@
// Items.
var items = response.tables || [];
if (!items.length)
return env.$pnl.msgs.append($('<div class="sbc-message">' + sbc.msg.dataNoneFound + '</div>')).fadeIn(500);
return env.$pnl.msgs.append($(`<div class="sbc-message">'${sbc.msg.dataNoneFound}</div>`)).fadeIn(500);
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
$table.append(cd.populateItem(env, cd.getItemTemplate(env), items[itemIdx]));
sbc.configureItemTable(env.config, $table);
@@ -16,9 +16,9 @@
{
env.$pnl.bgr.invisible();
rs.clearItems(env);
env.$pnl.msgs.hide().empty().append($('<div class="sbc-message">' + sbc.msg.dataQuerying + '</div>')).fadeIn(200);
env.$pnl.msgs.hide().empty().append($(`<div class="sbc-message">${sbc.msg.dataQuerying}</div>`)).fadeIn(200);
}
env.ajax.dbSchema = env.ajax.dbSchema || { url: sbc.url.base + 'System/Ajax/ValidateDatabaseSchema', formSel: env.$frm.filter, callbackFn: function (response) { rs.handleDbSchemaResponse(env, response); }, noWaitIcon: true };
env.ajax.dbSchema = env.ajax.dbSchema || { url: sbc.url.base + 'System/Ajax/ValidateDatabaseSchema', formSel: env.$frm.filter, $msgs: env.$pnl.msgs, callbackFn: function (response) { rs.handleDbSchemaResponse(env, response); }, noWaitIcon: true };
sbc.doAjaxRequest(env.ajax.dbSchema, delay || 50);
rs.awaitingSchemaResponse = true;
}
@@ -26,7 +26,6 @@
{
//sbc.debug('handleDbSchemaResponse', response);
delete rs.awaitingSchemaResponse;
env.$pnl.msgs.hide().empty();
var $table = env.$pnl.table.find('table.sbc-item-list');
rs.clearItems(env);
if (!response.success) return;
@@ -17,7 +17,7 @@
$pnl.table.find('tbody tr').remove();
$pnl.msgs.hide().empty().append($('<div class="sbc-message">' + sbc.msg.dataQuerying + '</div>')).fadeIn(200);
}
ir.ajax.repositories = ir.ajax.repositories || { url: sbc.url.base + 'Instance/Repository/Ajax/GetRepositories', formSel: $frm.filter, callbackFn: ir.handleRepositories };
ir.ajax.repositories = ir.ajax.repositories || { url: sbc.url.base + 'Instance/Repository/Ajax/GetRepositories', formSel: $frm.filter, $msgs: $pnl.msgs, callbackFn: ir.handleRepositories };
sbc.doAjaxRequest(ir.ajax.repositories, delay || 50);
ir.awaitingRefreshResponse = true;
}
@@ -322,21 +322,21 @@
//--------------------------------------------------------------
// Notifications.
sbc.showNotification = function (title, msg)
sbc.showNotification = function (title, msg, selParent)
{
win.clearTimeout(sbc.toNotification);
var $win = $(win);
var $par = selParent ? $(selParent) : $('#sbc-page-body main');
var $not = $('#sbc-notification').hide();
var $main = $('#sbc-page-body main');
if (!$not.length)
{
$not = $('<div id="sbc-notification"><div class="content"><div class="heading"><div class="close" onclick="sbc.hideNotification()">&#10006;</div><div class="title"></div></div><div class="message"></div></div></div>');
($main.length ? $main : $('body')).append($not);
($par.length ? $par : $('body')).append($not);
}
var $hdr = $('.heading', $not).css({ 'background-color': 'rgba(247,217,0,0.7)' });
$not.find('.title').html(title).end().find('.message').html(msg);
$not.show(500, function () { $hdr.delay(1500).animate({ backgroundColor: '#f0f0f0' }, 500); });
sbc.toNotification = setTimeout(sbc.hideNotification, 4000);
$not.show(500, function () { $hdr.delay(1500).animate({ backgroundColor: '#f0f0f0' }, 1000); });
sbc.toNotification = setTimeout(sbc.hideNotification, 6000);
}
sbc.hideNotification = function ()
{
@@ -382,9 +382,18 @@
{
if (!ajax.noWaitIcon) sbc.hidePleaseWait();
ajax.status = status;
if (response.notification)
sbc.showNotification(response.notification.title, response.notification.message);
if (response.message)
ajax.$msgs?.hide().empty();
const notifyMsg = response.notifyMesage;
if (notifyMsg)
sbc.showNotification(notifyMsg.title, notifyMsg.message, ajax.selNotifyParent);
let popupMsg = response.popupMessage;
const inlineMsg = response.inlineMessage;
if (inlineMsg)
{
if (ajax.$msgs?.length) ajax.$msgs.append($(`<div class="sbc-message sbc-${inlineMsg.error ? 'error' : inlineMsg.warning ? 'warn' : 'info'}">'${inlineMsg.text.replace('\n', '<br>')}</div>`)).fadeIn(500);
else if (!popupMsg) popupMsg = { title: inlineMsg.error ? 'Error' : inlineMsg.warning ? 'Warning' : 'Info', text: inlineMsg.text };
}
if (popupMsg)
{
var fnCloseAlert = function ()
{
@@ -392,7 +401,7 @@
if (response.goHome) return sbc.redirectHome();
if (ajax.callbackFn) ajax.callbackFn(response);
}
sbc.doAlert(response.message.title, response.message.text, function () { fnCloseAlert(); });
sbc.doAlert(popupMsg.title, popupMsg.text, function () { fnCloseAlert(); });
}
else if (response.sessionExpired)
return sbc.redirectHomeExp();
@@ -405,6 +414,7 @@
{
if (!ajax.noWaitIcon) sbc.hidePleaseWait();
ajax.status = status;
ajax.$msgs?.hide().empty();
if (status == "abort") return;
sbc.doAlert(sbc.dlg.title.alert, sbc.msg.somethingGoneWrong, sbc.redirectHome);
},
@@ -23,7 +23,7 @@
}
$pnl.msgs.append($('<div class="sbc-message">' + sbc.msg.dataQuerying + '</div>')).fadeIn(200);
}
ip.ajax.params = ip.ajax.params || { url: sbc.url.base + 'Param/Param/Ajax/GetList', formId: $frm.filter.prop('id'), callbackFn: ip.handleParams };
ip.ajax.params = ip.ajax.params || { url: sbc.url.base + 'Param/Param/Ajax/GetList', formId: $frm.filter.prop('id'), $msgs: $pnl.msgs, callbackFn: ip.handleParams };
sbc.doAjaxRequest(ip.ajax.params, delay || 50);
ip.awaitingRefreshResponse = true;
}
@@ -16,7 +16,7 @@
sl.clearFiles();
//$pnl.msgs.hide().empty().append($('<div class="sbc-message">' + sbc.msg.dataQuerying + '</div>')).fadeIn(200);
}
sbc.ajax.refreshFolders = sbc.ajax.refreshFolders || { url: sbc.url.base + 'System/Ajax/Logs/GetFolders', formSel: sl.$frm.filter, callbackFn: sl.doRefreshFolders };
sbc.ajax.refreshFolders = sbc.ajax.refreshFolders || { url: sbc.url.base + 'System/Ajax/Logs/GetFolders', formSel: sl.$frm.filter, $msgs: $pnl.msgs, callbackFn: sl.doRefreshFolders };
sbc.doAjaxRequest(sbc.ajax.refreshFolders, delay || 50);
sl.data.awaitingRefreshFoldersResponse = true;
}
@@ -17,7 +17,7 @@
$pnl.table.find('tbody tr').remove();
$pnl.msgs.hide().empty().append($('<div class="sbc-message">' + sbc.msg.dataQuerying + '</div>')).fadeIn(200);
}
ua.ajax.users = ua.ajax.users || { url: sbc.url.base + 'Account/UserAccount/Ajax/GetUsers', formId: $frm.filter.prop('id'), callbackFn: ua.handleUsers };
ua.ajax.users = ua.ajax.users || { url: sbc.url.base + 'Account/UserAccount/Ajax/GetUsers', formId: $frm.filter.prop('id'), $msgs: $pnl.msgs, callbackFn: ua.handleUsers };
sbc.doAjaxRequest(ua.ajax.users, delay || 50);
ua.awaitingRefreshResponse = true;
}
@@ -343,14 +343,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Addresses
// Identify item.
SysId addressId = SysId.ToSysId(model.Address.Id);
if (!SysId.IsValid(addressId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SbmAddress address = AccountMgr.GetAddressById(addressId);
if (address == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve address for Id: '{model.Address.Id}'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Construct response.
@@ -405,7 +405,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Addresses
if (address == null && SysId.IsValid(addressId))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve address for Id: '{model.Address.Id}'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Address item.
@@ -493,18 +493,18 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Addresses
if (!AccountMgr.InsertAddress(address, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to insert address: {AccountMgr.ErrorStateMessage}");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.created"]);
}
else
{
if (!AccountMgr.UpdateAddress(address, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to update address [Id:{SysId.ToLong(address.Id)}]: {AccountMgr.ErrorStateMessage}");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.updated"]);
}
if (address.IsPrimary) AccountMgr.VerifyAsPrimaryAddress(address, DbUpdateInfo);
@@ -539,14 +539,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Addresses
// Identify item.
SysId addressId = SysId.ToSysId(model.Address.Id);
if (!SysId.IsValid(addressId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SbmAddress address = AccountMgr.GetAddressById(addressId);
if (address == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve address for Id: '{model.Address.Id}'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Set this address as primary and clear primary against othe addresses for the same item.
@@ -554,10 +554,10 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Addresses
if (!AccountMgr.UpdateAddress(address, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to update address [Id:{SysId.ToLong(address.Id)}]: {AccountMgr.ErrorStateMessage}");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
}
AccountMgr.VerifyAsPrimaryAddress(address, DbUpdateInfo);
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.updated"]);
// Construct response.
model.PopulateItemConfig(responseData.Config, address);
@@ -267,14 +267,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
// Identify item.
SysId assetCategoryId = SysId.ToSysId(model.AssetCategory.Id);
if (!SysId.IsValid(assetCategoryId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SbmAssetCategory assetCategory = AssetMgr.GetAssetCategoryById(assetCategoryId);
if (assetCategory == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve assetCategory for Id: '" + assetCategoryId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Construct response.
@@ -306,12 +306,12 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
if (StringUtil.ToBool(model.AssetCategory.Exists) && !SysId.IsValid(assetCategoryId))
{
SaLogger.Warn($"{SysUtil.Fn} AssetCategory Id not supplied for existing item.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (!StringUtil.ToBool(model.AssetCategory.Exists) && SysId.IsValid(assetCategoryId))
{
SaLogger.Warn($"{SysUtil.Fn} AssetCategory Id supplied for new item.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Validate item properties.
@@ -328,7 +328,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
if (assetCategory == null && SysId.IsValid(assetCategoryId))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve Asset Category for Id: '" + model.AssetCategory.Id + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Create new item if required.
@@ -338,7 +338,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
{
// Should be picked up by model validation unless form doesn't include Asset Type.
SaLogger.Warn($"{SysUtil.Fn} Asset Type not specified for new Asset Category.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
assetCategory = AssetMgr.CreateAssetCategory(model.AssetCategory.AssetType);
}
@@ -359,18 +359,18 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
if (!AssetMgr.InsertAssetCategory(assetCategory, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to insert Asset Category: " + AssetMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.created"]);
}
else
{
if (!AssetMgr.UpdateAssetCategory(assetCategory, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to update Asset Category [Id:" + SysId.ToString(assetCategory.Id) + "]: " + AssetMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.updated"]);
}
// Construct response.
@@ -262,14 +262,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
// Identify item.
SysId assetId = SysId.ToSysId(model.Asset.Id);
if (!SysId.IsValid(assetId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SbmAsset asset = AssetMgr.GetAssetById(assetId);
if (asset == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve asset for Id: '" + assetId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Retrieve category.
@@ -277,7 +277,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
if (assetCategory == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve asset category for Id: '" + asset.AssetCategoryId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Construct response.
@@ -309,12 +309,12 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
if (StringUtil.ToBool(model.Asset.Exists) && !SysId.IsValid(assetId))
{
SaLogger.Warn($"{SysUtil.Fn} Asset Id not supplied for existing item.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (!StringUtil.ToBool(model.Asset.Exists) && SysId.IsValid(assetId))
{
SaLogger.Warn($"{SysUtil.Fn} Asset Id supplied for new item.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Validate item properties.
@@ -331,7 +331,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
if (asset == null && SysId.IsValid(assetId))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve Asset for Id: '" + model.Asset.Id + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Retrieve category.
@@ -342,7 +342,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
if (assetCategory == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve Asset Category for existing Asset. Id: '" + asset.AssetCategoryId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
}
else
@@ -351,7 +351,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
if (assetCategory == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve Asset Category for new Asset. Id: '" + model.Asset.CategoryId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
}
@@ -362,7 +362,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
{
// Should be picked up by model validation unless form doesn't include Asset Category.
SaLogger.Warn($"{SysUtil.Fn} Asset Category not specified for new Asset.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
asset = AssetMgr.CreateAsset(assetCategory.Id);
}
@@ -383,18 +383,18 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
if (!AssetMgr.InsertAsset(asset, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to insert Asset: " + AssetMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.created"]);
}
else
{
if (!AssetMgr.UpdateAsset(asset, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to update Asset [Id:" + SysId.ToString(asset.Id) + "]: " + AssetMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.updated"]);
}
// Construct response.
@@ -186,14 +186,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
// Identify item.
SysId codeId = SysId.ToSysId(model.Code.Id);
if (!SysId.IsValid(codeId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SaCode code = CodeTypeConsole.GetCodeById(codeId);
if (code == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve code for Id: '" + codeId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Retrieve code type.
@@ -201,7 +201,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
if (codeType == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve code type for Id: '" + code.CodeTypeId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Construct response.
@@ -232,12 +232,12 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
if (StringUtil.ToBool(model.Code.Exists) && !SysId.IsValid(codeId))
{
SaLogger.Warn($"{SysUtil.Fn} Code Id not supplied for existing item.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (!StringUtil.ToBool(model.Code.Exists) && SysId.IsValid(codeId))
{
SaLogger.Warn($"{SysUtil.Fn} Code Id supplied for new item.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Validate item properties.
@@ -254,7 +254,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
if (code == null && SysId.IsValid(codeId))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve Code Type for Id: '" + model.Code.Id + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Retrieve code type.
@@ -265,7 +265,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
if (codeType == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve Code Type for existing Code. Id: '" + code.CodeTypeId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
}
else
@@ -274,7 +274,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
if (codeType == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve Code Type for new Code. Code: '" + model.Code.CodeTypeCode + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
}
@@ -285,7 +285,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
{
// Should be picked up by model validation unless form doesn't include Code Type.
SaLogger.Warn($"{SysUtil.Fn} Code Type not specified for new Code.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
code = CodeTypeConsole.CreateCode(codeType.Id, model.Code.Code);
}
@@ -304,18 +304,18 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
if (!CodeTypeConsole.InsertCode(code, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to insert Code: " + CodeTypeConsole.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.created"]);
}
else
{
if (!CodeTypeConsole.UpdateCode(code, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to update Code [Id:" + SysId.ToString(code.Id) + "]: " + CodeTypeConsole.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.updated"]);
}
// Construct response.
@@ -210,14 +210,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
// Identify item.
SysId codeTypeId = SysId.ToSysId(model.CodeType.Id);
if (!SysId.IsValid(codeTypeId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SaCodeType codeType = CodeTypeConsole.GetCodeTypeById(codeTypeId);
if (codeType == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve Code Type for Id: {codeTypeId}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Construct response.
@@ -248,12 +248,12 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
if (StringUtil.ToBool(model.CodeType.Exists) && !SysId.IsValid(codeTypeId))
{
SaLogger.Warn($"{SysUtil.Fn} CodeType Id not supplied for existing item.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (!StringUtil.ToBool(model.CodeType.Exists) && SysId.IsValid(codeTypeId))
{
SaLogger.Warn($"{SysUtil.Fn} CodeType Id supplied for new item.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Validate item properties.
@@ -270,12 +270,12 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
if (codeType == null && SysId.IsValid(codeTypeId))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve Asset Category for Id: {model.CodeType.Id}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
if (codeType != null && model.CodeType.Code != null && !model.CodeType.Code.Equals(codeType.Code))
{
SaLogger.Warn($"{SysUtil.Fn} Inconsistent code returned for Code Type Id: {model.CodeType.Id}. Expected: {codeType.Code}. Found: {model.CodeType.Code}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Create new item if required.
@@ -285,7 +285,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
{
// Should be picked up by model validation unless form doesn't include Code Type code.
SaLogger.Warn($"{SysUtil.Fn} Code not specified for new Code Type.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
codeType = CodeTypeConsole.CreateCodeType(model.CodeType.Code);
}
@@ -306,18 +306,18 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
if (!CodeTypeConsole.InsertCodeType(codeType, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to insert Asset Category: {CodeTypeConsole.ErrorStateMessage}");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.created"]);
}
else
{
if (!CodeTypeConsole.UpdateCodeType(codeType, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to update Asset Category [Id: {SysId.ToString(codeType.Id)}]: {CodeTypeConsole.ErrorStateMessage}");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.updated"]);
}
// Construct response.
@@ -373,14 +373,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Commodities
// Identify item.
SysId commodityId = SysId.ToSysId(model.Commodity.Id);
if (!SysId.IsValid(commodityId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SbmCommodity commodity = CommodityMgr.GetCommodityById(commodityId);
if (commodity == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve commodity for Id: '{model.Commodity.Id}'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Construct response.
@@ -435,7 +435,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Commodities
if (commodity == null && SysId.IsValid(commodityId))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve commodity for Id: '{model.Commodity.Id}'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Create new item if required.
@@ -472,18 +472,18 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Commodities
if (!CommodityMgr.InsertCommodity(commodity, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to insert commodity: {CommodityMgr.ErrorStateMessage}");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.created"]);
}
else
{
if (!CommodityMgr.UpdateCommodity(commodity, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to update commodity [Id:{SysId.ToLong(commodity.Id)}]: {CommodityMgr.ErrorStateMessage}");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.updated"]);
}
UpdateAssociatedData(commodity);
@@ -305,14 +305,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
// Identify item.
SysId associationId = SysId.ToSysId(model.Association.Id);
if (!SysId.IsValid(associationId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SbmAssociation association = AccountMgr.GetAssociationById(associationId);
if (association == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve association for Id: '" + model.Association.Id + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
SbmAffiliate affiliateTarget = AccountMgr.GetAffiliateById(association.AffiliateIdTarget);
@@ -372,7 +372,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
if (association == null && SysId.IsValid(associationId))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve association for Id: '" + model.Association.Id + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Create new item if required.
@@ -477,18 +477,18 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
if (!AccountMgr.InsertAssociation(association, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to insert association: " + AccountMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.created"]);
}
else
{
if (!AccountMgr.UpdateAssociation(association, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to update association [Id:" + SysId.ToString(association.Id) + "]: " + AccountMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.updated"]);
}
SbmAffiliate affiliateTarget = AccountMgr.GetAffiliateById(association.AffiliateIdTarget);
@@ -351,14 +351,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
// Identify item.
SysId affiliateId = SysId.ToSysId(model.Contact.Id);
if (!SysId.IsValid(affiliateId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SbmAffiliate affiliate = AccountMgr.GetAffiliateById(affiliateId);
if (affiliate == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve affiliate for Id: '{model.Contact.Id}'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Construct response.
@@ -411,7 +411,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
if (affiliate == null && SysId.IsValid(affiliateId))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve affiliate for Id: '{model.Contact.Id}'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Create new item if required.
@@ -483,18 +483,18 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
if (!AccountMgr.InsertAffiliate(affiliate, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to insert affiliate: {AccountMgr.ErrorStateMessage}");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.created"]);
}
else
{
if (!AccountMgr.UpdateAffiliate(affiliate, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to update affiliate [Id: {SysId.ToLong(affiliate.Id)}]: {AccountMgr.ErrorStateMessage}");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.updated"]);
}
// Construct response.
@@ -45,7 +45,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Home
String messageTitle = Localiser["caption.demo.account.request"];
// Validate session and referrer.
if (ValidUserSession) return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
if (ValidUserSession) return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
RefreshModel(model);
// Validate item properties.
@@ -62,7 +62,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Home
if (!ControlAccountMgr.InsertAccountRegistration(accountRegistration, new DbUpdateInfo(null, "Registration", SacsSystem.ComputerName)))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to insert Account Registration - {ControlAccountMgr.ErrorStateMessage.TrimEnd('.')}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
}
else
@@ -72,7 +72,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Home
if (!ControlAccountMgr.UpdateAccountRegistration(accountRegistration, new DbUpdateInfo(null, "Registration", SacsSystem.ComputerName)))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to update Account Registration - {ControlAccountMgr.ErrorStateMessage.TrimEnd('.')}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
}
@@ -94,7 +94,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Home
else
{
SaLogger.Warn($"{SysUtil.Fn} Failed to send Demo Account Registration email to {model.EmailAddress}.");
return Json(responseData.SetMessage(messageTitle, "Unfortunately it has not been possible to send your Demo Account Registration email. Please try again at a later time."));
return Json(responseData.SetPopupMessage(messageTitle, "Unfortunately it has not been possible to send your Demo Account Registration email. Please try again at a later time."));
}
// Complete response.
@@ -119,7 +119,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Home
String messageTitle = Localiser["caption.demo.account.register"];
// Validate session and referrer.
if (ValidUserSession) return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
if (ValidUserSession) return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
RefreshModel(model);
// Validate item properties.
@@ -136,14 +136,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Home
if (!requestParams.IsValid())
{
SaLogger.Warn($"{SysUtil.Fn} Incomplete Account Registration Request parameters.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Verify Demo Account Registration Params Email.
if (!requestParams.EmailAddress.EqualsCI(model.EmailAddress))
{
SaLogger.Warn($"{SysUtil.Fn} Invalid Account Registration parameters email. Expected: {model.EmailAddress}. Found: {requestParams.EmailAddress}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
//---------------------------------------------------------------
@@ -152,21 +152,21 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Home
if (accountRegistration == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve Account Registration for token - {requestParams.Token}. Email: {model.EmailAddress}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Verify Account Registration Email.
if (!accountRegistration.EmailAddress.EqualsCI(model.EmailAddress))
{
SaLogger.Warn($"{SysUtil.Fn} Invalid Account Registration email. Expected: {model.EmailAddress}. Found: {accountRegistration.EmailAddress}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Verify Password.
if (!SbmPasswordHelper.IsValidPassword(model.Password))
{
SaLogger.Warn($"{SysUtil.Fn} Invalid Password. Email: {model.EmailAddress}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
//---------------------------------------------------------------
@@ -177,14 +177,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Home
if (!demoInstanceConsole.IsRepositoryValid())
{
SaLogger.Warn($"{SysUtil.Fn} Demo Instance is not valid. {demoInstanceConsole.ErrorStateMessage.TrimEnd('.')}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
SbmRepositoryPopulationData demoData = demoInstanceConsole.PrepareDemoPopulationData();
if (!demoInstanceConsole.PopulateRepository(demoData))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to populate Demo instance. {demoInstanceConsole.ErrorStateMessage.TrimEnd('.')}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
@@ -216,12 +216,12 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Home
if (!SysId.IsValid(userAccount.AffiliateIdOwner))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to add User Account. Unable to identify Internal Association Owner.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (!demoInstanceConsole.AddUserAccount(userAccount))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to add User Account. {demoInstanceConsole.ErrorStateMessage.TrimEnd('.')}.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
//---------------------------------------------------------------
@@ -254,7 +254,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Home
else
{
SaLogger.Warn($"{SysUtil.Fn} Failed to send Demo Account Registration email to {model.EmailAddress}.");
return Json(responseData.SetMessage(messageTitle, "Unfortunately it has not been possible to send your Demo Account Registration email. Please try again at a later time."));
return Json(responseData.SetPopupMessage(messageTitle, "Unfortunately it has not been possible to send your Demo Account Registration email. Please try again at a later time."));
}
}
@@ -250,14 +250,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Interfaces
// Identify item.
SysId interfaceObjId = SysId.ToSysId(model.Interface.Id);
if (!SysId.IsValid(interfaceObjId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SaInterface interfaceObj = InterfaceConsole.GetInterfaceById(interfaceObjId);
if (interfaceObj == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve interfaceObj for Id: '" + interfaceObjId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Construct response.
@@ -289,12 +289,12 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Interfaces
if (StringUtil.ToBool(model.Interface.Exists) && !SysId.IsValid(interfaceObjId))
{
SaLogger.Warn($"{SysUtil.Fn} Interface Id not supplied for existing item.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (!StringUtil.ToBool(model.Interface.Exists) && SysId.IsValid(interfaceObjId))
{
SaLogger.Warn($"{SysUtil.Fn} Interface Id supplied for new item.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Validate item properties.
@@ -311,7 +311,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Interfaces
if (interfaceObj == null && SysId.IsValid(interfaceObjId))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve Interface for Id: '" + model.Interface.Id + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Create new item if required.
@@ -320,7 +320,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Interfaces
if (!InterfaceConsole.HasInterfaceDfns(SessionData_Portal.OrganisationInterfaceContext, model.GetInterfaceCategory(), model.GetInterfaceType(), true))
{
SaLogger.Warn($"{SysUtil.Fn} No Interface definitions exist for Category: " + model.Interface.CategoryCode + ", Type: " + model.Interface.Type);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.definition.missing"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.definition.missing"]));
}
SysId interfaceId = InterfaceConsole.CreateInterface
(SessionData_Portal.OrganisationInterfaceContext, model.GetInterfaceCategory(), model.GetInterfaceType(),
@@ -329,7 +329,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Interfaces
if (interfaceObj is null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to create new Interface: " + InterfaceConsole.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
}
}
@@ -347,9 +347,9 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Interfaces
if (!InterfaceConsole.UpdateInterface(interfaceObj, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to update Interface [Id:" + SysId.ToString(interfaceObj.Id) + "]: " + InterfaceConsole.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.updated"]);
// Construct response.
model.PopulateItemConfig(responseData.Config, interfaceObj);
@@ -390,14 +390,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Requirements
// Identify item.
SysId requirementId = model.GetRequirementId();
if (!SysId.IsValid(requirementId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SbmRequirement requirement = TransactionMgr.GetRequirementById(requirementId);
if (requirement == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve requirement for Id: '{model.Requirement.Id}'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Transaction.
@@ -405,7 +405,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Requirements
if (transaction == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve transaction for Id: '{requirement.TransactionId}'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Commodity.
@@ -589,7 +589,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Requirements
if (requirement == null && SysId.IsValid(requirementId))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve transaction for Id: '{model.Requirement.Id}'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Transaction.
@@ -600,7 +600,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Requirements
if (transaction == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve transaction for Id: '{requirement.TransactionId}'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
}
@@ -618,7 +618,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Requirements
if (transaction == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve transaction for Id: '{transactionId}'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Create Requirement.
@@ -705,18 +705,18 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Requirements
if (!TransactionMgr.InsertRequirement(requirement, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to insert transaction: {TransactionMgr.ErrorStateMessage}");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.created"]);
}
else
{
if (!TransactionMgr.UpdateRequirement(requirement, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to update transaction [Id:{SysId.ToLong(requirement.Id)}]: {TransactionMgr.ErrorStateMessage}");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.updated"]);
}
UpdateAssociatedData(transaction, requirement);
@@ -295,7 +295,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Security
if (affiliateUser == null)
{
SaLogger.Warn($"{SysUtil.Fn} System error - failed to retrieve account details.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Clear user session.
@@ -455,7 +455,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Security
// Construct response.
responseData.Success = true;
if (validRequestPasswordParams)
responseData.SetMessage(messageTitle, Localiser["security.msg.request.password.saved"]);
responseData.SetPopupMessage(messageTitle, Localiser["security.msg.request.password.saved"]);
return Json(responseData);
}
@@ -360,14 +360,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Transactions
// Identify item.
SysId transactionId = SysId.ToSysId(model.Transaction.Id);
if (!SysId.IsValid(transactionId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SbmTransaction transaction = TransactionMgr.GetTransactionById(transactionId);
if (transaction == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve transaction for Id: '{model.Transaction.Id}'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
messageTitle = model.GetTransactionsTypeCaption(transaction.TransactionType);
@@ -430,7 +430,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Transactions
if (transaction == null && SysId.IsValid(transactionId))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve transaction for Id: '{model.Transaction.Id}'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Create new item if required.
@@ -496,18 +496,18 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Transactions
if (!TransactionMgr.InsertTransaction(transaction, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to insert transaction: {TransactionMgr.ErrorStateMessage}");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.created"]);
}
else
{
if (!TransactionMgr.UpdateTransaction(transaction, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to update transaction [Id:{SysId.ToLong(transaction.Id)}]: {TransactionMgr.ErrorStateMessage}");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.updated"]);
}
UpdateAssociatedData(transaction);
@@ -176,14 +176,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Vehicles
// Identify item.
SysId vehicleClassId = SysId.ToSysId(model.VehicleClass.Id);
if (!SysId.IsValid(vehicleClassId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SbmVehicleClass vehicleClass = AssetMgr.GetVehicleClassById(vehicleClassId);
if (vehicleClass == null)
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve vehicleClass for Id: '" + vehicleClassId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Construct response.
@@ -214,12 +214,12 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Vehicles
if (StringUtil.ToBool(model.VehicleClass.Exists) && !SysId.IsValid(vehicleClassId))
{
SaLogger.Warn($"{SysUtil.Fn} VehicleClass Id not supplied for existing item.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
if (!StringUtil.ToBool(model.VehicleClass.Exists) && SysId.IsValid(vehicleClassId))
{
SaLogger.Warn($"{SysUtil.Fn} VehicleClass Id supplied for new item.");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.system"]));
}
// Validate item properties.
@@ -236,7 +236,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Vehicles
if (vehicleClass == null && SysId.IsValid(vehicleClassId))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve Vehicle Class for Id: '" + model.VehicleClass.Id + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Create new item if required.
@@ -265,18 +265,18 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Vehicles
if (!AssetMgr.InsertVehicleClass(vehicleClass, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to insert Vehicle Class: " + AssetMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.created"]);
}
else
{
if (!AssetMgr.UpdateVehicleClass(vehicleClass, DbUpdateInfo))
{
SaLogger.Warn($"{SysUtil.Fn} Failed to update Vehicle Class [Id:" + SysId.ToString(vehicleClass.Id) + "]: " + AssetMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
return Json(responseData.SetPopupMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
}
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
responseData.SetNotifyMessage(messageTitle, Localiser["msg.item.updated"]);
}
// Construct response.
@@ -225,7 +225,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Commodities
{
commodity = CommodityMgr.GetCommodityById(SysId.ToSysId(Commodity.Id));
if (commodity == null)
responseData.SetMessage(Localiser["label.commodity"], Localiser["msg.something.gone.wrong"]);
responseData.SetPopupMessage(Localiser["label.commodity"], Localiser["msg.something.gone.wrong"]);
}
if (!responseData.HasControlErrors())
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<CopyRefAssembliesToPublishDirectory>false</CopyRefAssembliesToPublishDirectory>
<RootNamespace>Sarand.BusinessMgr.Web</RootNamespace>
<AssemblyName>Sarand.BusinessMgr.Web</AssemblyName>
@@ -351,16 +351,31 @@ ul.nav.sbm-burger ul.sbm-dropdown-menu li.sbm-action.sbm-dropdown-item:hover .sb
.sbm-panel-messages .sbm-message
{
min-height: 20px;
margin: 4px 0;
padding-left: 24px;
padding-top: 2px;
padding-left: 28px;
background-position: left top;
background-repeat: no-repeat;
background-size: 20px 20px;
}
.sbm-panel-messages .sbm-message.sbm-info
{
color: #28a745;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%2328a745' viewBox='0 0 512 512'%3e%3cpath d='M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 110c23.2 0 42 18.8 42 42s-18.8 42-42 42-42-18.8-42-42 18.8-42 42-42zm56 308c0 6.6-5.4 12-12 12h-88c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h12v-86h-12c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h64c6.6 0 12 5.4 12 12v106h12c6.6 0 12 5.4 12 12v8z'/%3e%3c/svg%3e");
}
.sbm-panel-messages .sbm-message.sbm-warn
{
color: #ffc107;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23ffc107' viewBox='0 0 512 512'%3e%3cpath d='M256 48C141.1 48 48 141.1 48 256s93.1 208 208 208 208-93.1 208-208S370.9 48 256 48zm0 96c13.3 0 24 10.7 24 24v112c0 13.3-10.7 24-24 24s-24-10.7-24-24V168c0-13.3 10.7-24 24-24zm0 272a32 32 0 1 1 0-64 32 32 0 1 1 0 64z'/%3e%3c/svg%3e");
}
.sbm-panel-messages .sbm-message.sbm-error
{
color: #e3120b;
background-image: url("../img/icon/error-18.png");
color: #dc3545;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23dc3545' viewBox='0 0 576 512'%3e%3cpath d='M569.5 440.6 327.4 69.5c-18.8-29.3-61.1-29.3-79.9 0L6.5 440.6C-12.3 469.9 9.5 512 48 512h480c38.5 0 60.3-42.1 41.5-71.4zM288 392c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zm44-144c0 6.6-5.4 12-12 12h-64c-6.6 0-12-5.4-12-12v-72c0-6.6 5.4-12 12-12h64c6.6 0 12 5.4 12 12v72z'/%3e%3c/svg%3e");
}
/* Item List table */
@@ -29,7 +29,7 @@
env.$pnl.table.find('tbody tr').remove();
env.$pnl.msgs.hide().empty().append($('<div class="sbm-message">' + sbm.msg.dataQuerying + '</div>')).fadeIn(200);
}
env.ajax.refreshResults = env.ajax.refreshResults || { url: sbm.url.base + 'Address/Ajax/List', formSel: env.$frm.filter, callbackFn: function (response) { ad.doRefreshResults(env, response); } };
env.ajax.refreshResults = env.ajax.refreshResults || { url: sbm.url.base + 'Address/Ajax/List', formSel: env.$frm.filter, $msgs: env.$pnl.msgs, callbackFn: function (response) { ad.doRefreshResults(env, response); } };
sbm.doAjaxRequest(env.ajax.refreshResults, delay || 50);
ad.awaitingRefreshResponse = true;
}
@@ -28,7 +28,7 @@
env.$pnl.table.find('tbody tr').remove();
env.$pnl.msgs.hide().empty().append($('<div class="sbm-message">' + sbm.msg.dataQuerying + '</div>')).fadeIn(200);
}
sbm.doAjaxRequest(env.ajax.assetCategories = env.ajax.assetCategories || { url: sbm.url.base + 'Assets/AssetCategory/Ajax/GetAssetCategories', formSel: env.$frm.filter, callbackFn: function (response) { ac.doRefreshResults(env, response); } }, delay || 50);
sbm.doAjaxRequest(env.ajax.assetCategories = env.ajax.assetCategories || { url: sbm.url.base + 'Assets/AssetCategory/Ajax/GetAssetCategories', formSel: env.$frm.filter, $msgs: env.$pnl.msgs, callbackFn: function (response) { ac.doRefreshResults(env, response); } }, delay || 50);
env.data.awaitingRefreshResponse = true;
}
ac.doRefreshResults = function (env, response)
@@ -30,7 +30,7 @@
env.$pnl.table.find('tbody tr').remove();
env.$pnl.msgs.hide().empty().append($('<div class="sbm-message">' + sbm.msg.dataQuerying + '</div>')).fadeIn(200);
}
env.ajax.assets = env.ajax.assets || { url: sbm.url.base + 'Assets/Asset/Ajax/GetAssets', formSel: env.$frm.filter, callbackFn: function (response) { as.doRefreshResults(env, response); } };
env.ajax.assets = env.ajax.assets || { url: sbm.url.base + 'Assets/Asset/Ajax/GetAssets', formSel: env.$frm.filter, $msgs: env.$pnl.msgs, callbackFn: function (response) { as.doRefreshResults(env, response); } };
sbm.doAjaxRequest(env.ajax.assets, delay || 50);
env.data.awaitingRefreshResponse = true;
}
@@ -26,7 +26,7 @@
env.$pnl.table.find('tbody tr').remove();
env.$pnl.msgs.hide().empty().append($('<div class="sbm-message">' + sbm.msg.dataQuerying + '</div>')).fadeIn(200);
}
sbm.doAjaxRequest(env.ajax.refreshResults = env.ajax.refreshResults || { url: sbm.url.base + 'Association/Ajax/List', formSel: env.$frm.filter, callbackFn: function (response) { as.doRefreshResults(env, response); } }, delay || 50);
sbm.doAjaxRequest(env.ajax.refreshResults = env.ajax.refreshResults || { url: sbm.url.base + 'Association/Ajax/List', formSel: env.$frm.filter, $msgs: env.$pnl.msgs, callbackFn: function (response) { as.doRefreshResults(env, response); } }, delay || 50);
as.awaitingRefreshResponse = true;
}
as.doRefreshResults = function (env, response)
@@ -29,7 +29,7 @@
env.$pnl.table.find('tbody tr').remove();
env.$pnl.msgs.hide().empty().append($('<div class="sbm-message">' + sbm.msg.dataQuerying + '</div>')).fadeIn(200);
}
env.ajax.refreshResults = env.ajax.refreshResults || { url: sbm.url.base + 'Commodity/Ajax/List', formSel: env.$frm.filter, callbackFn: function (response) { co.doRefreshResults(env, response); } };
env.ajax.refreshResults = env.ajax.refreshResults || { url: sbm.url.base + 'Commodity/Ajax/List', formSel: env.$frm.filter, $msgs: env.$pnl.msgs, callbackFn: function (response) { co.doRefreshResults(env, response); } };
sbm.doAjaxRequest(env.ajax.refreshResults, delay || 50);
co.awaitingRefreshResponse = true;
}
@@ -17,7 +17,7 @@
env.$pnl.table.find('tbody tr').remove();
env.$pnl.msgs.hide().empty().append($('<div class="sbm-message">' + sbm.msg.dataQuerying + '</div>')).fadeIn(200);
}
sbm.doAjaxRequest(env.ajax.codeTypes = env.ajax.codeTypes || { url: sbm.url.base + 'Codes/CodeType/Ajax/GetCodeTypes', formSel: env.$frm.filter, callbackFn: function (response) { ct.handleCodeTypes(env, response); } }, delay || 50);
sbm.doAjaxRequest(env.ajax.codeTypes = env.ajax.codeTypes || { url: sbm.url.base + 'Codes/CodeType/Ajax/GetCodeTypes', formSel: env.$frm.filter, $msgs: env.$pnl.msgs, callbackFn: function (response) { ct.handleCodeTypes(env, response); } }, delay || 50);
ct.awaitingRefreshResponse = true;
}
ct.handleCodeTypes = function (env, response)
@@ -17,7 +17,7 @@
env.$pnl.table.find('tbody tr').remove();
env.$pnl.msgs.hide().empty().append($('<div class="sbm-message">' + sbm.msg.dataQuerying + '</div>')).fadeIn(200);
}
sbm.doAjaxRequest(env.ajax.codes = env.ajax.codes || { url: sbm.url.base + 'Codes/Code/Ajax/GetCodes', formSel: env.$frm.filter, callbackFn: function (response) { cd.handleCodes(env, response); } }, delay || 50);
sbm.doAjaxRequest(env.ajax.codes = env.ajax.codes || { url: sbm.url.base + 'Codes/Code/Ajax/GetCodes', formSel: env.$frm.filter, $msgs: env.$pnl.msgs, callbackFn: function (response) { cd.handleCodes(env, response); } }, delay || 50);
cd.awaitingRefreshResponse = true;
}
cd.handleCodes = function (env, response)
@@ -26,7 +26,7 @@
env.$pnl.table.find('tbody tr').remove();
env.$pnl.msgs.hide().empty().append($('<div class="sbm-message">' + sbm.msg.dataQuerying + '</div>')).fadeIn(200);
}
sbm.doAjaxRequest(env.ajax.refreshResults = env.ajax.refreshResults || { url: sbm.url.base + 'Contact/Ajax/List', formSel: env.$frm.filter, callbackFn: function (response) { co.doRefreshResults(env, response); } }, delay || 50);
sbm.doAjaxRequest(env.ajax.refreshResults = env.ajax.refreshResults || { url: sbm.url.base + 'Contact/Ajax/List', formSel: env.$frm.filter, $msgs: env.$pnl.msgs, callbackFn: function (response) { co.doRefreshResults(env, response); } }, delay || 50);
co.awaitingRefreshResponse = true;
}
co.doRefreshResults = function (env, response)
@@ -386,9 +386,19 @@
{
if (!ajax.noWaitIcon) sbm.hidePleaseWait();
ajax.status = status;
if (response.notification)
sbm.showNotification(response.notification.title, response.notification.message, ajax.selNotifyParent);
if (response.message)
ajax.$msgs?.hide().empty();
const notifyMsg = response.notifyMesage;
if (notifyMsg)
sbm.showNotification(notifyMsg.title, notifyMsg.message, ajax.selNotifyParent);
let popupMsg = response.popupMessage;
const inlineMsg = response.inlineMessage;
if (inlineMsg)
{
console.log(ajax.$msgs, inlineMsg);
if (ajax.$msgs?.length) ajax.$msgs.append($(`<div class="sbm-message sbm-${inlineMsg.error ? 'error' : inlineMsg.warning ? 'warn' : 'info'}">'${inlineMsg.text.replace('\n', '<br>')}</div>`)).fadeIn(500);
else if (!popupMsg) popupMsg = { title: inlineMsg.error ? 'Error' : inlineMsg.warning ? 'Warning' : 'Info', text: inlineMsg.text };
}
if (popupMsg)
{
var fnCloseAlert = function ()
{
@@ -396,7 +406,7 @@
if (response.goHome) return sbm.redirectHome();
if (ajax.callbackFn) ajax.callbackFn(response);
}
sbm.doAlert(response.message.title, response.message.text, function () { fnCloseAlert(); });
sbm.doAlert(popupMsg.title, popupMsg.text, function () { fnCloseAlert(); });
}
else if (response.sessionExpired)
return sbm.redirectHomeExp();
@@ -409,6 +419,7 @@
{
if (!ajax.noWaitIcon) sbm.hidePleaseWait();
ajax.status = status;
ajax.$msgs?.hide().empty();
if (status == "abort") return;
sbm.doAlert(sbm.dlg.title.alert, sbm.msg.somethingGoneWrong, sbm.redirectHome);
},
@@ -26,7 +26,7 @@
env.$pnl.table.find('tbody tr').remove();
env.$pnl.msgs.hide().empty().append($('<div class="sbm-message">' + sbm.msg.dataQuerying + '</div>')).fadeIn(200);
}
sbm.doAjaxRequest(env.ajax.refreshResults = env.ajax.refreshResults || { url: sbm.url.base + 'Requirement/Ajax/List', formSel: env.$frm.filter, callbackFn: function (response) { re.doRefreshResults(env, response); } }, delay || 50);
sbm.doAjaxRequest(env.ajax.refreshResults = env.ajax.refreshResults || { url: sbm.url.base + 'Requirement/Ajax/List', formSel: env.$frm.filter, $msgs: env.$pnl.msgs, callbackFn: function (response) { re.doRefreshResults(env, response); } }, delay || 50);
re.awaitingRefreshResponse = true;
}
re.doRefreshResults = function (env, response)
@@ -26,7 +26,7 @@
env.$pnl.table.find('tbody tr').remove();
env.$pnl.msgs.hide().empty().append($('<div class="sbm-message">' + sbm.msg.dataQuerying + '</div>')).fadeIn(200);
}
sbm.doAjaxRequest(env.ajax.refreshResults = env.ajax.refreshResults || { url: sbm.url.base + 'Transaction/Ajax/List', formSel: env.$frm.filter, callbackFn: function (response) { tr.displayItems(env, response); } }, delay || 50);
sbm.doAjaxRequest(env.ajax.refreshResults = env.ajax.refreshResults || { url: sbm.url.base + 'Transaction/Ajax/List', formSel: env.$frm.filter, $msgs: env.$pnl.msgs, callbackFn: function (response) { tr.displayItems(env, response); } }, delay || 50);
tr.awaitingRefreshResponse = true;
}
tr.displayItems = function (env, response)
@@ -18,7 +18,7 @@
$pnl.table.find('tbody tr').remove();
$pnl.msgs.hide().empty().append($('<div class="sbm-message">' + sbm.msg.dataQuerying + '</div>')).fadeIn(200);
}
vc.ajax.vehicleClasses = vc.ajax.vehicleClasses || { url: sbm.url.base + 'Assets/VehicleClass/Ajax/GetVehicleClasses', formId: $frm.filter.prop('id'), callbackFn: vc.handleVehicleClasses };
vc.ajax.vehicleClasses = vc.ajax.vehicleClasses || { url: sbm.url.base + 'Assets/VehicleClass/Ajax/GetVehicleClasses', formId: $frm.filter.prop('id'), $msgs: env.$pnl.msgs, callbackFn: vc.handleVehicleClasses };
sbm.doAjaxRequest(vc.ajax.vehicleClasses, delay || 50);
vc.awaitingRefreshResponse = true;
}