Contacts
This commit is contained in:
@@ -19,6 +19,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Net.Standard.Base.ReferenceData;
|
||||
|
||||
namespace Sarand.BusinessMgr.Web.Control.App
|
||||
{
|
||||
@@ -30,7 +31,7 @@ namespace Sarand.BusinessMgr.Web.Control.App
|
||||
private bool generateDatabaseDefinitions_Control = false;
|
||||
private bool generateDatabaseDefinitions_BusMgr = false;
|
||||
private PropertySet propertySet;
|
||||
private Dictionary<String, SbmAppConfig> appConfigs = new Dictionary<string, SbmAppConfig>();
|
||||
private Dictionary<String, Net.Core.Web.App.SbmAppConfig> appConfigs = new Dictionary<string, Net.Core.Web.App.SbmAppConfig>();
|
||||
private Dictionary<String, SbmEmailConfig> emailConfigs = new Dictionary<string, SbmEmailConfig>();
|
||||
ushort sessionContextIdx_Control = 0;
|
||||
// Singular databases.
|
||||
@@ -71,7 +72,7 @@ namespace Sarand.BusinessMgr.Web.Control.App
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
// Application Configuration.
|
||||
public override SbmAppConfig AppConfig { get { return appConfigs.Values.ToList().getConfigForApplication(); } }
|
||||
public override Net.Core.Web.App.SbmAppConfig AppConfig { get { return appConfigs.Values.ToList().getConfigForApplication(); } }
|
||||
// Session Configuration.
|
||||
public override String SessionCookieName { get { return Sbm.Config.Control.Session.Cookie.Name; } }
|
||||
public override List<ushort> GetSessionContextIdxs()
|
||||
@@ -82,6 +83,7 @@ namespace Sarand.BusinessMgr.Web.Control.App
|
||||
{
|
||||
return sessionContexts.GetValue(index, null)?.SessionContext ?? null;
|
||||
}
|
||||
// Databases.
|
||||
public override ISacsDatabase GetControlDatabase()
|
||||
{
|
||||
return controlDatabase;
|
||||
@@ -98,10 +100,20 @@ namespace Sarand.BusinessMgr.Web.Control.App
|
||||
{
|
||||
return sessionContexts.GetValue(sessionContext.Index, null)?.BusMgrDatabase;
|
||||
}
|
||||
// Instance configuration.
|
||||
public override SbmInstanceConfig GetInstanceConfig(SbmSessionContext sessionContext)
|
||||
{
|
||||
throw new NotSupportedException("InstanceConfig not supported in Control application.");
|
||||
}
|
||||
// Email configuration.
|
||||
public override SbmEmailConfig EmailConfig { get { return emailConfigs.Values.ToList().getConfigForSession(AppConfig); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create Consoles.
|
||||
public override SaReferenceDataConsole CreateReferenceDataConsole(ISbmUserContext_Core userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SbmEmailConsole CreateEmailConsole(ISbmUserContext_Core userContext)
|
||||
{
|
||||
return new SbmEmailConsole_Control(EmailConfig);
|
||||
@@ -177,24 +189,24 @@ namespace Sarand.BusinessMgr.Web.Control.App
|
||||
}
|
||||
|
||||
// BusinessMgr database connections.
|
||||
foreach (SbmAppConfig.DatabaseConfig dbConfig in AppConfig.BusMgrDatabases)
|
||||
foreach (Net.Core.Web.App.SbmAppConfig.DatabaseConfig dbConfig in AppConfig.BusMgrDatabases)
|
||||
{
|
||||
odbcConfig = new SacsDatabaseConsole.OdbcConfig();
|
||||
odbcConfig.location = dbConfig.Location;
|
||||
odbcConfig.user = dbConfig.User;
|
||||
odbcConfig.pword = dbConfig.Password;
|
||||
SacsDatabase busMgrDatabase = SacsDatabaseConsole.OpenOdbcDatabase(odbcConfig);
|
||||
SacsDatabase busMgrDatabase = SacsDatabaseConsole.OpenOdbcDatabase(odbcConfig);
|
||||
if (busMgrDatabase.HasErrorState())
|
||||
SaLogger.Warn($"{SysUtil.Fn} BusMgr Database: " + busMgrDatabase.DatabaseName + ". Initialisation error: " + busMgrDatabase.ErrorStateMessage);
|
||||
SaLogger.Warn($"{SysUtil.Fn} BusMgr Database: " + busMgrDatabase.DatabaseName + ". Initialisation error: " + busMgrDatabase.ErrorStateMessage);
|
||||
|
||||
// Session context.
|
||||
ushort sessionContextIdx = sessionContextIdx_Next++;
|
||||
if (sessionContextIdx_Control < 1)
|
||||
sessionContextIdx_Control = sessionContextIdx;
|
||||
SessionContextData sessionContextData = new SessionContextData(new SbmSessionContext_Web(sessionContextIdx, Sbm.Application.WebControl));
|
||||
sessionContextIdx_Control = sessionContextIdx;
|
||||
SessionContextData sessionContextData = new SessionContextData(new SbmSessionContext_Web(sessionContextIdx, Sbm.Application.WebControl));
|
||||
sessionContextData.DbIdentifiers.UnionWith(dbConfig.Identifiers);
|
||||
sessionContextData.BusMgrDatabase = busMgrDatabase;
|
||||
sessionContexts.Add(sessionContextData.SessionContext.Index, sessionContextData);
|
||||
sessionContexts.Add(sessionContextData.SessionContext.Index, sessionContextData);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
|
||||
+1
-3
@@ -18,7 +18,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
private static String PasswordDummyValue = "********";
|
||||
|
||||
// Repository data.
|
||||
private class RepositoryListData : AjaxResponse_Data.ItemData_Base
|
||||
@@ -33,7 +32,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
{
|
||||
public String OwnerId { get; set; }
|
||||
public String UserName { get; set; }
|
||||
public String PasswordDummy { get; } = PasswordDummyValue;
|
||||
}
|
||||
private void PopulateRepositoryResponseListData(SbmModel_Control model, RepositoryListData data, SbmcOwner owner, SbmcRepository repository)
|
||||
{
|
||||
@@ -277,7 +275,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
repository.DatabaseName = model.Repository.DatabaseName;
|
||||
if (model.Repository.UserName != null)
|
||||
repository.UserName = model.Repository.UserName;
|
||||
if (model.Repository.Password != null && !model.Repository.Password.Equals(PasswordDummyValue))
|
||||
if (model.Repository.Password != null && StringUtil.ToBool(model.Repository.PasswordChanged))
|
||||
repository.Password = model.Repository.Password;
|
||||
if (model.Repository.StatusCode != null)
|
||||
repository.Status = model.Repository.GetStatus();
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers
|
||||
if (StringUtil.IsEmpty(GetRequestCookie(KeepLoggedIn.CookieName))) return;
|
||||
// Clear cookie by setting expiry date in the past.
|
||||
SetResponseCookie(KeepLoggedIn.CookieName, "", DateTime.Today.AddDays(-7), true);
|
||||
SaLogger.Info($"{SysUtil.Fn} 'Keep Logged In' cookie cleared.");
|
||||
SaLogger.Debug($"{SysUtil.Fn} 'Keep Logged In' cookie cleared.");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -48,6 +48,7 @@ namespace Sarand.BusinessMgr.Web.Control.Models.Instance
|
||||
public String DatabaseName { get; set; }
|
||||
public String UserName { get; set; }
|
||||
public String Password { get; set; }
|
||||
public String PasswordChanged { get; set; }
|
||||
public String StatusCode { get; set; }
|
||||
public SaStatus GetStatus() { return SacsSystem.GetStatusForCode(StatusCode); }
|
||||
}
|
||||
|
||||
@@ -8,8 +8,10 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="jQuery.UI.Combined" Version="1.13.2" />
|
||||
<PackageReference Include="jQuery" Version="3.5.1" />
|
||||
<PackageReference Include="jQuery.UI.Combined" Version="1.13.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.31" />
|
||||
<PackageReference Include="System.Data.Odbc" Version="6.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -114,8 +114,8 @@
|
||||
<div class="spacer2"></div>
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmRepository", @class = "sbc-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
@Html.HiddenFor(model => model.Repository.Exists, new { @id = "", @class = "RepositoryExists" })
|
||||
@Html.HiddenFor(model => model.Repository.Id, new { @id = "", @class = "RepositoryId" })
|
||||
@Html.HiddenFor(model => model.Repository.Exists, new { @id = "", @class = "RepositoryExists sbc-input" })
|
||||
@Html.HiddenFor(model => model.Repository.Id, new { @id = "", @class = "RepositoryId sbc-input" })
|
||||
|
||||
@* Repository Owner *@
|
||||
<div class="sbc-form-control RepositoryOwner">
|
||||
@@ -128,7 +128,7 @@
|
||||
<div class="col-sm-9">
|
||||
<div class="sbc-control row">
|
||||
<div class="col">
|
||||
@Html.HiddenFor(model => model.Repository.OwnerId, new { @id = "", @class = "RepositoryOwnerId" })
|
||||
@Html.HiddenFor(model => model.Repository.OwnerId, new { @id = "", @class = "RepositoryOwnerId sbc-input" })
|
||||
<input type="text" class="RepositoryOwner sbc-input" readonly="readonly" />
|
||||
</div>
|
||||
<div class="fixed">
|
||||
@@ -235,6 +235,7 @@
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<div class="sbc-control">
|
||||
@Html.HiddenFor(model => model.Repository.PasswordChanged, new { @id = "", @class = "RepositoryPasswordChanged sbc-input" })
|
||||
@Html.PasswordFor(model => model.Repository.Password, new { @id = "ifRepositoryPassword", @class = "RepositoryPassword sbc-input", @maxlength = @Model.GetControlMaxLength(SbmDbDfn_Control.ColumnIdx.Repository_Password) })
|
||||
</div>
|
||||
<div class="sbc-message"></div>
|
||||
|
||||
@@ -463,22 +463,27 @@ table.sbc-item-list tbody td
|
||||
|
||||
/* Item statuses */
|
||||
|
||||
.sbc-status-awa
|
||||
.sbc-status-awa, .sbc-status-req, .sbc-status-rai, .sbc-status-clo
|
||||
{
|
||||
color: darkorange;
|
||||
}
|
||||
|
||||
.sbc-status-atv, .sbc-status-cur
|
||||
.sbc-status-atv, .sbc-status-ena, .sbc-status-cur, .sbc-status-rei, .sbc-status-ope, .sbc-status-con, .sbc-status-com, .sbc-status-acc, .sbc-status-gra
|
||||
{
|
||||
color: green;
|
||||
}
|
||||
|
||||
.sbc-status-ina
|
||||
.sbc-status-ina, .sbc-status-dis, .sbc-status-dsc, .sbc-status-red, .sbc-status-can, .sbc-status-fai, .sbc-status-rej, .sbc-status-den
|
||||
{
|
||||
color: darkred;
|
||||
}
|
||||
|
||||
.sbc-status-hld
|
||||
.sbc-status-inp, .sbc-status-exp, .sbc-status-inv, .sbc-status-suc, .sbc-status-act, .sbc-status-que, .sbc-status-log
|
||||
{
|
||||
color: darkcyan;
|
||||
}
|
||||
|
||||
.sbc-status-pre, .sbc-status-pro, .sbc-status-inp, .sbc-status-hld, .sbc-status-ups, .sbc-status-sup, .sbc-status-aut, .sbc-status-sub
|
||||
{
|
||||
color: dodgerblue;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
$('.OwnerContactName', $item).text(item.contactName);
|
||||
$('.OwnerContactEmailAddress', $item).text(item.contactEmailAddress);
|
||||
$('.OwnerContactPhone', $item).text(item.contactPhone);
|
||||
$('.OwnerStatusDesc', $item).text(item.statusDesc).removeClass(function (idx, name) { return (name.match(/(^|\s)sbc-status-\S+/g) || []).join(' '); }).addClass('sbc-status-' + item.statusCode.toLowerCase());
|
||||
$('.OwnerStatusDesc', $item).text(item.statusDesc).removeStatusClasses().addClass('sbc-status-' + item.statusCode.toLowerCase());
|
||||
// Actions.
|
||||
let fnUpd = function () { io.updateItem($item, item) };
|
||||
var $bgr = $('.sbc-burger', $item).hide();
|
||||
@@ -111,17 +111,16 @@
|
||||
$dlg.item.dialog('option', 'title', sbc.dlg.title.createItem);
|
||||
io.openOwnerDlg();
|
||||
}
|
||||
io.clearItem = function ()
|
||||
{
|
||||
$('.sbc-input,.sbc-textarea,.sbc-select', $frm.item).val('');
|
||||
sbc.populateSelectCodeDesc('#cbOwnerStatus', sbc.data.statuses);
|
||||
sbc.clearControlErrors();
|
||||
}
|
||||
io.openOwnerDlg = function ()
|
||||
{
|
||||
sbc.openDialog($dlg.item, 600, 600);
|
||||
}
|
||||
io.clearItem = function ()
|
||||
{
|
||||
let frm = $frm.item;
|
||||
$('.OwnerExists,.OwnerId,input[type="text"],textarea,select', frm).val('');
|
||||
sbc.populateSelectCodeDesc('#cbOwnerStatus', sbc.data.statuses);
|
||||
sbc.clearControlErrors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
io.updateItem = function ($item, item)
|
||||
@@ -166,7 +165,7 @@
|
||||
$dlg.item.dialog('close');
|
||||
|
||||
var item = response.owner;
|
||||
var $item = $('#' + io.getItemId(item));
|
||||
var $item = $('#' + io.getItemId(item), $pnl.table);
|
||||
if (!$item.length)
|
||||
{
|
||||
$item = io.getItemRowTemplate();
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
$('.RepositoryServerName', $item).text(item.serverName);
|
||||
$('.RepositoryInstanceName', $item).text(item.instanceName);
|
||||
$('.RepositoryDatabaseName', $item).text(item.databaseName);
|
||||
$('.RepositoryStatusDesc', $item).text(item.statusDesc).removeClass(function (idx, name) { return (name.match(/(^|\s)sbc-status-\S+/g) || []).join(' '); }).addClass('sbc-status-' + item.statusCode.toLowerCase());
|
||||
$('.RepositoryStatusDesc', $item).text(item.statusDesc).removeStatusClasses().addClass('sbc-status-' + item.statusCode.toLowerCase());
|
||||
// Actions.
|
||||
let fnUpd = function () { ir.updateItem($item, item) };
|
||||
var $bgr = $('.sbc-burger', $item).hide();
|
||||
@@ -118,11 +118,14 @@
|
||||
}
|
||||
ir.clearItem = function ()
|
||||
{
|
||||
let frm = $frm.item;
|
||||
$('.RepositoryExists,.RepositoryId,input[type="text"],textarea,select', frm).val('');
|
||||
$('.RepositoryExists,.RepositoryId,input[type="text"],textarea,select', $frm.item).val('');
|
||||
sbc.populateSelectCodeDesc('#cbRepositoryStatus', sbc.data.statuses);
|
||||
sbc.clearControlErrors();
|
||||
}
|
||||
ir.onInputPassword = function ()
|
||||
{
|
||||
$('.RepositoryPasswordChanged', $frm.item).val(1);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
ir.updateItem = function ($item, item)
|
||||
@@ -136,22 +139,22 @@
|
||||
ir.onUpdateItem = function (response)
|
||||
{
|
||||
//sbc.debug('onUpdateItem', response);
|
||||
let frm = $frm.item;
|
||||
let $ctrls = $('.sbc-input,.sbc-textarea,.sbc-select', $frm.item);
|
||||
ir.clearItem();
|
||||
if (!response.success) return;
|
||||
let item = response.repository;
|
||||
$('.RepositoryExists', frm).val(1);
|
||||
$('.RepositoryId', frm).val(item.id);
|
||||
$('.RepositoryOwnerId', frm).val(item.ownerId);
|
||||
$('.RepositoryOwner', frm).val(item.ownerName);
|
||||
$('.RepositoryContext', frm).val(item.context);
|
||||
$('.RepositoryServerName', frm).val(item.serverName);
|
||||
$('.RepositoryInstanceName', frm).val(item.instanceName);
|
||||
$('.RepositoryDatabaseName', frm).val(item.databaseName);
|
||||
$('.RepositoryUserName', frm).val(item.userName);
|
||||
$('.RepositoryPassword', frm).val(item.password);
|
||||
$('.RepositoryNotes', frm).val(item.notes);
|
||||
$('.RepositoryStatus', frm).val(item.statusCode).prop('readonly', true);
|
||||
$ctrls.filter('.RepositoryExists').val(1);
|
||||
$ctrls.filter('.RepositoryId').val(item.id);
|
||||
$ctrls.filter('.RepositoryOwnerId').val(item.ownerId);
|
||||
$ctrls.filter('.RepositoryOwner').val(item.ownerName);
|
||||
$ctrls.filter('.RepositoryContext').val(item.context);
|
||||
$ctrls.filter('.RepositoryServerName').val(item.serverName);
|
||||
$ctrls.filter('.RepositoryInstanceName').val(item.instanceName);
|
||||
$ctrls.filter('.RepositoryDatabaseName').val(item.databaseName);
|
||||
$ctrls.filter('.RepositoryUserName').val(item.userName);
|
||||
$ctrls.filter('.RepositoryPassword').val('######');
|
||||
$ctrls.filter('.RepositoryNotes').val(item.notes);
|
||||
$ctrls.filter('.RepositoryStatus').val(item.statusCode).prop('readonly', true);
|
||||
sbc.clearControlErrors();
|
||||
$dlg.item.dialog('option', 'title', sbc.dlg.title.updateItem);
|
||||
ir.openRepositoryDlg();
|
||||
@@ -192,11 +195,11 @@
|
||||
$dlg.item.dialog('close');
|
||||
|
||||
var item = response.repository;
|
||||
var $item = $('#' + ir.getItemId(item));
|
||||
var $item = $('#' + ir.getItemId(item), $pnl.table);
|
||||
if (!$item.length)
|
||||
{
|
||||
$item = ir.getItemRowTemplate();
|
||||
$('table', $pnl.table).prepend($item).show();
|
||||
$('table tbody', $pnl.table).prepend($item).show();
|
||||
}
|
||||
ir.populateItem($item, item);
|
||||
}
|
||||
@@ -223,6 +226,7 @@
|
||||
$frm.item = $('#frmRepository');
|
||||
$($frm.item).on('input', '.sbc-input, .sbc-textarea', function () { sbc.clearControlError(this); }).on('change', '.sbc-select', function () { sbc.clearControlError(this); });
|
||||
$($frm.item).on('dblclick', '.sbc-input.RepositoryOwner', ir.selectOwner).on('click', '.sbc-action.RepositoryOwnerSearch', ir.selectOwner);
|
||||
$($frm.item).on('input', '.RepositoryPassword', ir.onInputPassword);
|
||||
|
||||
setTimeout(ir.refreshResults, 250);
|
||||
});
|
||||
|
||||
@@ -97,6 +97,12 @@
|
||||
return index % 2 == 1 ? "other" : "";
|
||||
});
|
||||
}
|
||||
sbc.selectOrAdd = function ($sel, code, desc)
|
||||
{
|
||||
if ($sel.val(code) == code) return;
|
||||
$sel.append($('<option>').prop('value', code).text(desc));
|
||||
$sel.val(code);
|
||||
}
|
||||
sbc.populateSelect = function ($sel, values, code, desc)
|
||||
{
|
||||
code = code || 'code';
|
||||
@@ -519,6 +525,11 @@
|
||||
return this.css('visibility', function (i, visibility) { return (visibility == 'visible') ? 'hidden' : 'visible'; });
|
||||
};
|
||||
|
||||
$.fn.removeStatusClasses = function ()
|
||||
{
|
||||
return this.removeClass(function (idx, name) { return (name.match(/(^|\s)sbc-status-\S+/g) || []).join(' '); });
|
||||
};
|
||||
|
||||
if (sbc.kli.active)
|
||||
sbc.configureKeepLoggedIn();
|
||||
else if (!sbc.awaitingLogin)
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
$('.ParamContext', $item).text(item.context);
|
||||
$('.ParamName', $item).text(item.name);
|
||||
$('.ParamValue', $item).text(item.value);
|
||||
$('.ParamStatusDesc', $item).text(item.statusDesc).removeClass(function (idx, name) { return (name.match(/(^|\s)sbc-status-\S+/g) || []).join(' '); }).addClass('sbc-status-' + item.statusCode.toLowerCase());
|
||||
$('.ParamStatusDesc', $item).text(item.statusDesc).removeStatusClasses().addClass('sbc-status-' + item.statusCode.toLowerCase());
|
||||
// Actions.
|
||||
let fnUpd = function () { ip.updateItem($item, item) };
|
||||
var $bgr = $('.sbc-burger', $item).hide();
|
||||
@@ -187,7 +187,7 @@
|
||||
$dlg.item.dialog('close');
|
||||
|
||||
var item = response.param;
|
||||
var $item = $('#' + ip.getItemId(item));
|
||||
var $item = $('#' + ip.getItemId(item), $pnl.table);
|
||||
if (!$item.length)
|
||||
{
|
||||
$item = ip.getItemRowTemplate();
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
$('.UserDisplayName', $item).text(item.displayName);
|
||||
$('.UserPhone', $item).text(item.phone);
|
||||
$('.UserLastLoginOn', $item).text(item.lastLoginOn);
|
||||
$('.UserStatusDesc', $item).text(item.statusDesc).removeClass(function (idx, name) { return (name.match(/(^|\s)sbc-status-\S+/g) || []).join(' '); }).addClass('sbc-status-' + item.statusCode.toLowerCase());
|
||||
$('.UserStatusDesc', $item).text(item.statusDesc).removeStatusClasses().addClass('sbc-status-' + item.statusCode.toLowerCase());
|
||||
// Actions.
|
||||
let fnUpd = function () { ua.updateItem($item, item) };
|
||||
var $bgr = $('.sbc-burger', $item).hide();
|
||||
@@ -169,7 +169,7 @@
|
||||
$dlg.item.dialog('close');
|
||||
|
||||
var item = response.user;
|
||||
var $item = $('#' + ua.getItemId(item));
|
||||
var $item = $('#' + ua.getItemId(item), $pnl.table);
|
||||
if (!$item.length)
|
||||
{
|
||||
$item = ua.getItemRowTemplate();
|
||||
|
||||
Reference in New Issue
Block a user