3.0.1.9 Portal styling. Interfaces controller/model.
This commit is contained in:
@@ -181,7 +181,9 @@ namespace Sarand.BusinessMgr.Web.Portal.App
|
||||
}
|
||||
public override ISacsDatabase CreateBusMgrDatabase(SbmSessionContext sessionContext)
|
||||
{
|
||||
ISacsDatabase busMgrDatabase = SacsDatabaseConsole.OpenOdbcDatabase(sessionContexts.GetValue(sessionContext?.Index ?? 0, null)?.OdbcConfig);
|
||||
SacsDatabaseConsole.OdbcConfig odbcConfig = sessionContexts.GetValue(sessionContext?.Index ?? 0, null)?.OdbcConfig;
|
||||
if (odbcConfig is null) return null;
|
||||
ISacsDatabase busMgrDatabase = SacsDatabaseConsole.OpenOdbcDatabase(odbcConfig);
|
||||
if (busMgrDatabase.HasErrorState())
|
||||
SaLogger.Warn($"{SysUtil.Fn} BusMgr Database: " + busMgrDatabase.DatabaseName + ". Initialisation error: " + busMgrDatabase.ErrorStateMessage);
|
||||
return busMgrDatabase;
|
||||
|
||||
@@ -1,35 +1,18 @@
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Newtonsoft.Json;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.App;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.Components;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.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.Web.Portal.App;
|
||||
using Sarand.BusinessMgr.Web.Portal.Helpers;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.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.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Sarand.BusinessMgr.Web.Portal.Components
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using DocumentFormat.OpenXml.EMMA;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Newtonsoft.Json;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.App;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.Components;
|
||||
@@ -9,7 +8,6 @@ using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Web.Portal.App;
|
||||
using Sarand.BusinessMgr.Web.Portal.Helpers;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
@@ -25,10 +23,8 @@ 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.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
@@ -96,7 +92,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Components
|
||||
protected SbmStockControlConfig StockControlConfig { get { return Internals.StockControlConfig; } }
|
||||
protected SbmRequirementCostingConfig RequirementCostingConfig { get { return Internals.RequirementCostingConfig; } }
|
||||
// System codes.
|
||||
protected List<TypeCodeDesc> GetSystemCodes(Sbm.SystemCode systemCode) { return Internals.GetSystemCodes(systemCode); }
|
||||
protected List<TypeCodeDesc> GetSystemCodes(Sbm.ApplicationCode applicationCode) { return Internals.GetApplicationCodes(applicationCode); }
|
||||
// Email.
|
||||
protected SaEmailConfig EmailConfig { get { return Internals.EmailConfig; } }
|
||||
protected SbmEmailConsole EmailConsole { get { return Internals.EmailConsole; } }
|
||||
|
||||
@@ -5,9 +5,7 @@ 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.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.BusinessMgr.Web.Portal.App;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -20,7 +18,6 @@ using Sarand.Net.Standard.Base.ReferenceData;
|
||||
using Sarand.Net.Standard.Base.Security;
|
||||
using Sarand.Net.Standard.Base.UpdateLog;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -131,7 +128,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Components
|
||||
protected SbmStockControlConfig StockControlConfig { get { return Internals.StockControlConfig; } }
|
||||
protected SbmRequirementCostingConfig RequirementCostingConfig { get { return Internals.RequirementCostingConfig; } }
|
||||
// System codes.
|
||||
protected List<TypeCodeDesc> GetSystemCodes(Sbm.SystemCode systemCode) { return Internals.GetSystemCodes(systemCode); }
|
||||
protected List<TypeCodeDesc> GetSystemCodes(Sbm.ApplicationCode applicationCode) { return Internals.GetApplicationCodes(applicationCode); }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Page menu options.
|
||||
@@ -252,7 +249,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Components
|
||||
/// </summary>
|
||||
public IEnumerable<SelectListItem> GetAffiliateTypeCodesForFilterDropdown(IEnumerable<Sbm.AffiliateType> typesExcluded = null)
|
||||
{
|
||||
List<TypeCodeDesc> affiliateTypes = GetSystemCodes(Sbm.SystemCode.AffiliateType);
|
||||
List<TypeCodeDesc> affiliateTypes = GetSystemCodes(Sbm.ApplicationCode.AffiliateType);
|
||||
if (typesExcluded?.Any() ?? false)
|
||||
affiliateTypes.RemoveAll(item => typesExcluded.Contains((Sbm.AffiliateType)item.Type));
|
||||
if (!affiliateTypes.Any(item => item.Type == (int)Sbm.AffiliateType.AnyOrganisation))
|
||||
@@ -267,7 +264,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Components
|
||||
/// </summary>
|
||||
public IEnumerable<SelectListItem> GetAddressTypeCodesForFilterDropdown()
|
||||
{
|
||||
List<TypeCodeDesc> affiliateTypes = GetSystemCodes(Sbm.SystemCode.AddressType);
|
||||
List<TypeCodeDesc> affiliateTypes = GetSystemCodes(Sbm.ApplicationCode.AddressType);
|
||||
affiliateTypes.Insert(0, Sbm.AddressType.Any, "", Localiser["label.any"]);
|
||||
return new SelectList(affiliateTypes, "Code", "Desc");
|
||||
}
|
||||
@@ -278,7 +275,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Components
|
||||
/// </summary>
|
||||
public IEnumerable<SelectListItem> GetAddressTypeCodesForDropdown()
|
||||
{
|
||||
List<TypeCodeDesc> affiliateTypes = GetSystemCodes(Sbm.SystemCode.AddressType);
|
||||
List<TypeCodeDesc> affiliateTypes = GetSystemCodes(Sbm.ApplicationCode.AddressType);
|
||||
return new SelectList(affiliateTypes, "Code", "Desc");
|
||||
}
|
||||
|
||||
@@ -288,7 +285,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Components
|
||||
/// </summary>
|
||||
public IEnumerable<SelectListItem> GetAssociationTypeCodesForFilterDropdown()
|
||||
{
|
||||
List<TypeCodeDesc> associationTypes = GetSystemCodes(Sbm.SystemCode.AssociationType);
|
||||
List<TypeCodeDesc> associationTypes = GetSystemCodes(Sbm.ApplicationCode.AssociationType);
|
||||
associationTypes.Insert(0, Sbm.AssociationType.Any, "", Localiser["label.any"]);
|
||||
associationTypes.RemoveAll(item => item.Type == (short)Sbm.AssociationType.Internal);
|
||||
foreach (Sbm.AssociationType associationType in EnumUtil.GetValues<Sbm.AssociationType>())
|
||||
@@ -309,7 +306,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Components
|
||||
{
|
||||
List<TypeCodeDesc> commodityTypes = new List<TypeCodeDesc>();
|
||||
commodityTypes.Add(Sbm.CommodityType.Any, "", Localiser["label.any"]);
|
||||
foreach (TypeCodeDesc commodityType in GetSystemCodes(Sbm.SystemCode.CommodityType))
|
||||
foreach (TypeCodeDesc commodityType in GetSystemCodes(Sbm.ApplicationCode.CommodityType))
|
||||
{
|
||||
if (commodityType.Type == (int)Sbm.CommodityType.Asset && !SessionConsole.AllowOption(Sbm.ConfigOption.Assets)) continue;
|
||||
commodityTypes.Add(commodityType);
|
||||
@@ -323,7 +320,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Components
|
||||
public IEnumerable<SelectListItem> GetCommodityTypeCodesForDropdown()
|
||||
{
|
||||
List<TypeCodeDesc> commodityTypes = new List<TypeCodeDesc>();
|
||||
foreach (TypeCodeDesc commodityType in GetSystemCodes(Sbm.SystemCode.CommodityType))
|
||||
foreach (TypeCodeDesc commodityType in GetSystemCodes(Sbm.ApplicationCode.CommodityType))
|
||||
{
|
||||
if (commodityType.Type == (int)Sbm.CommodityType.Asset && !SessionConsole.AllowOption(Sbm.ConfigOption.Assets)) continue;
|
||||
commodityTypes.Add(commodityType);
|
||||
@@ -338,7 +335,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Components
|
||||
{
|
||||
List<TypeCodeDesc> assetTypes = new List<TypeCodeDesc>();
|
||||
assetTypes.Add(Sbm.AssetType.Any, "", Localiser["label.any"]);
|
||||
foreach (TypeCodeDesc assetType in GetSystemCodes(Sbm.SystemCode.AssetType))
|
||||
foreach (TypeCodeDesc assetType in GetSystemCodes(Sbm.ApplicationCode.AssetType))
|
||||
{
|
||||
assetTypes.Add(assetType);
|
||||
}
|
||||
@@ -351,7 +348,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Components
|
||||
public IEnumerable<SelectListItem> GetAssetTypeCodesForDropdown()
|
||||
{
|
||||
List<TypeCodeDesc> assetTypes = new List<TypeCodeDesc>();
|
||||
foreach (TypeCodeDesc assetType in GetSystemCodes(Sbm.SystemCode.AssetType))
|
||||
foreach (TypeCodeDesc assetType in GetSystemCodes(Sbm.ApplicationCode.AssetType))
|
||||
{
|
||||
assetTypes.Add(assetType);
|
||||
}
|
||||
@@ -368,7 +365,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Components
|
||||
{
|
||||
List<TypeCodeDesc> transactionTypes = new List<TypeCodeDesc>();
|
||||
transactionTypes.Add(Sbm.TransactionType.Any, "", Localiser["label.any"]);
|
||||
foreach (TypeCodeDesc transactionType in GetSystemCodes(Sbm.SystemCode.TransactionType))
|
||||
foreach (TypeCodeDesc transactionType in GetSystemCodes(Sbm.ApplicationCode.TransactionType))
|
||||
{
|
||||
if (!SessionConsole.AllowTransactionType((Sbm.TransactionType)transactionType.Type)) continue;
|
||||
string description = SessionConsole.GetOwnerOption_Caption(Sbm.TransTypeToOrgOption((Sbm.TransactionType)transactionType.Type), Localiser.GetTransactionTypeCaption((Sbm.TransactionType)transactionType.Type));
|
||||
@@ -383,7 +380,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Components
|
||||
public IEnumerable<SelectListItem> GetTransactionTypeCodesForDropdown()
|
||||
{
|
||||
List<TypeCodeDesc> transactionTypes = new List<TypeCodeDesc>();
|
||||
foreach (TypeCodeDesc transactionType in GetSystemCodes(Sbm.SystemCode.TransactionType))
|
||||
foreach (TypeCodeDesc transactionType in GetSystemCodes(Sbm.ApplicationCode.TransactionType))
|
||||
{
|
||||
if (!SessionConsole.AllowTransactionType((Sbm.TransactionType)transactionType.Type)) continue;
|
||||
string description = SessionConsole.GetOwnerOption_Caption(Sbm.TransTypeToOrgOption((Sbm.TransactionType)transactionType.Type), Localiser.GetTransactionTypeCaption((Sbm.TransactionType)transactionType.Type));
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Addresses
|
||||
model.PopulateItemConfig(responseData.Data.CfgItemNew, null, Sbm.AddressType.Any);
|
||||
|
||||
// Address types.
|
||||
List<TypeCodeDesc> addressTypes = GetSystemCodes(Sbm.SystemCode.AddressType);
|
||||
List<TypeCodeDesc> addressTypes = GetSystemCodes(Sbm.ApplicationCode.AddressType);
|
||||
foreach (TypeCodeDesc addressType in addressTypes.Where(addr => addr.Type > 0))
|
||||
responseData.Data.AddressTypes.Add(new AjaxResponse_Data.ItemCodeDesc(addressType.Code, addressType.Desc));
|
||||
responseData.Data.AddressTypeDefault = addressTypes.GetCodeForType(Sbm.AddressType.Office);
|
||||
|
||||
+2
-2
@@ -116,9 +116,9 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
|
||||
model.PopulateItemConfig(responseData.Data.CfgItemNew, null, Sbm.AssetType.Unknown);
|
||||
|
||||
// Reference data - select lists.
|
||||
foreach (TypeCodeDesc assetType in GetSystemCodes(Sbm.SystemCode.AssetType))
|
||||
foreach (TypeCodeDesc assetType in GetSystemCodes(Sbm.ApplicationCode.AssetType))
|
||||
responseData.Data.AssetTypes.Add(new AjaxResponse_Data.ItemCodeDesc(assetType.Code, assetType.Desc));
|
||||
foreach (TypeCodeDesc incomeType in GetSystemCodes(Sbm.SystemCode.AssetIncomeType))
|
||||
foreach (TypeCodeDesc incomeType in GetSystemCodes(Sbm.ApplicationCode.AssetIncomeType))
|
||||
responseData.Data.IncomeTypes.Add(new AjaxResponse_Data.ItemCodeDesc(incomeType.Code, incomeType.Desc));
|
||||
|
||||
// Reference data - statuses.
|
||||
|
||||
+4
-4
@@ -78,7 +78,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Commodities
|
||||
data.Field.Value.Add($"{Model_Commodity.ItemField.SaleAmount}", StringUtil.NullOnBlank(StringUtil.FormatNumeric(commodity.SalesPrice, SbmInternals.CurrencyDecimalsDefault)));
|
||||
}
|
||||
data.Field.Value.Add($"{Model_Commodity.ItemField.SaleTaxCode}", Internals.GetTaxCodeById(commodity.TaxCodeId)?.Code);
|
||||
data.SalesUnitType = SbmSystem.GetSystemCodes(Sbm.SystemCode.UnitMeasureType).GetCodeForType(Internals.GetUnitOfMeasureType(commodity.UomIdSale));
|
||||
data.SalesUnitType = SbmSystem.GetSystemCodes(Sbm.ApplicationCode.UnitMeasureType).GetCodeForType(Internals.GetUnitOfMeasureType(commodity.UomIdSale));
|
||||
if (commodity.PackQtySale > 0)
|
||||
data.Field.Value.Add($"{Model_Commodity.ItemField.SalePackQty}", $"{commodity.PackQtySale}");
|
||||
data.Field.Value.Add($"{Model_Commodity.ItemField.AssocIdCustomer}", StringUtil.NullOnBlank(SysId.ToString(commodity.AssociationIdCustomer)));
|
||||
@@ -178,7 +178,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Commodities
|
||||
model.PopulateItemConfig(responseData.Data.CfgItemNew, null, Sbm.CommodityType.Unknown);
|
||||
|
||||
// Commodity types.
|
||||
List<TypeCodeDesc> commodityTypes = GetSystemCodes(Sbm.SystemCode.CommodityType);
|
||||
List<TypeCodeDesc> commodityTypes = GetSystemCodes(Sbm.ApplicationCode.CommodityType);
|
||||
foreach (TypeCodeDesc commodityType in commodityTypes)
|
||||
responseData.Data.CommodityTypes.Add(new AjaxResponse_Data.ItemCodeDesc(commodityType.Code, commodityType.Desc));
|
||||
Sbm.CommodityType commodityTypeDefault = SessionConsole.GetOwnerOption_CommodityType(Sbm.OrgOption_CommodityType.CommodityCreationDefault);
|
||||
@@ -192,8 +192,8 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Commodities
|
||||
responseData.Data.TaxCodeDefault = Internals.GetDefaultTaxCode();
|
||||
|
||||
// Units of measure.
|
||||
List<TypeCodeDesc> uomCategories = SbmSystem.GetSystemCodes(Sbm.SystemCode.UnitMeasureCategory);
|
||||
List<TypeCodeDesc> uomTypes = SbmSystem.GetSystemCodes(Sbm.SystemCode.UnitMeasureType);
|
||||
List<TypeCodeDesc> uomCategories = SbmSystem.GetSystemCodes(Sbm.ApplicationCode.UnitMeasureCategory);
|
||||
List<TypeCodeDesc> uomTypes = SbmSystem.GetSystemCodes(Sbm.ApplicationCode.UnitMeasureType);
|
||||
responseData.Data.UomCats.AddRange(uomCategories.Select(item => new AjaxResponse_Data.ItemCodeDesc(item.Code, item.Desc)));
|
||||
responseData.Data.UomTypes.AddRange(uomTypes.Select(item => new AjaxResponse_Data.ItemCodeDesc(item.Code, item.Desc)));
|
||||
foreach (SaUnitMeasure uom in Internals.GetUnitsOfMeasure())
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
||||
model.PopulateItemConfig(responseData.Data.CfgGrp, null, Sbm.AffiliateType.ContactGroup);
|
||||
|
||||
// Reference data - Organisation types.
|
||||
foreach (TypeCodeDesc affiliateType in GetSystemCodes(Sbm.SystemCode.AffiliateType).Where(item => item.Type != (short)Sbm.AffiliateType.Individual && item.Type != (short)Sbm.AffiliateType.ContactGroup))
|
||||
foreach (TypeCodeDesc affiliateType in GetSystemCodes(Sbm.ApplicationCode.AffiliateType).Where(item => item.Type != (short)Sbm.AffiliateType.Individual && item.Type != (short)Sbm.AffiliateType.ContactGroup))
|
||||
responseData.Data.OrganisationTypes.Add(new AjaxResponse_Data.ItemCodeDesc(affiliateType.Code, affiliateType.Desc));
|
||||
|
||||
// Reference data - titles.
|
||||
|
||||
@@ -0,0 +1,365 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Sarand.BusinessMgr.Web.Portal.Components;
|
||||
using Sarand.BusinessMgr.Web.Portal.Models.Interfaces;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Interfaces;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Sarand.BusinessMgr.Web.Portal.Controllers.Interfaces
|
||||
{
|
||||
//=======================================================================
|
||||
// Portal Interface Controller - Ajax actions.
|
||||
//=======================================================================
|
||||
partial class InterfaceController
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Item data.
|
||||
private class InterfaceListData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public String CategoryDesc { get; set; }
|
||||
public String TypeDesc { get; set; }
|
||||
public String Code { get; set; }
|
||||
public String Caption { get; set; }
|
||||
// Field values.
|
||||
public AjaxResponse_Data.FieldValuesData Field { get; } = new AjaxResponse_Data.FieldValuesData();
|
||||
}
|
||||
private class InterfaceItemData : InterfaceListData
|
||||
{
|
||||
public String CategoryCode { get; set; }
|
||||
public String Type { get; set; }
|
||||
}
|
||||
private void PopulateInterfaceResponseListData(SbmModel_Portal model, InterfaceListData data, SaInterface interfaceObj)
|
||||
{
|
||||
// Prominent properties for selecting and editing.
|
||||
data.Id = SysId.ToString(interfaceObj.Id);
|
||||
data.Field.Value.Add($"{Model_Interface.ItemField.Id}", data.Id);
|
||||
data.Field.Value.Add($"{Model_Interface.ItemField.Exists}", "1");
|
||||
data.Field.Value.Add($"{Model_Interface.ItemField.Category}", $"{Internals.InterfaceCategoryCodes.GetDescForType(interfaceObj.Category)}");
|
||||
data.Code = interfaceObj.Code;
|
||||
data.Field.Value.Add($"{Model_Interface.ItemField.Code}", interfaceObj.Code);
|
||||
data.Caption = interfaceObj.Caption;
|
||||
data.Field.Value.Add($"{Model_Interface.ItemField.Caption}", interfaceObj.Caption);
|
||||
}
|
||||
private void PopulateInterfaceResponseItemData(SbmModel_Portal model, InterfaceItemData data, SaInterface interfaceObj)
|
||||
{
|
||||
PopulateInterfaceResponseListData(model, data, interfaceObj);
|
||||
data.CategoryCode = Internals.InterfaceCategoryCodes.GetCodeForType(interfaceObj.Category);
|
||||
data.Field.Value.Add($"{Model_Interface.ItemField.CategoryCode}", data.CategoryCode);
|
||||
// Common properties.
|
||||
data.StatusCode = interfaceObj.StatusCode;
|
||||
data.StatusDesc = interfaceObj.StatusDesc;
|
||||
// Cleanse field values.
|
||||
data.Field.Value.RemoveAll(item => StringUtil.IsBlank(item.Value));
|
||||
// Populate item list values that might be cleared during update after removing blank values to ensure that blank values are published.
|
||||
data.Field.Value.Add($"{Model_Interface.ItemField.Notes}", interfaceObj.Notes);
|
||||
data.Field.Value.Add($"{Model_Interface.ItemField.UpdatedOn}", Localiser.FormatDate(interfaceObj.UpdateStamp.On));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Interface configuration ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_InterfaceConfig : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_InterfaceConfig(SbmModel_Portal model) : base(model) { }
|
||||
// Configuration data - object copied directly to env.datain script.
|
||||
public class ConfigData
|
||||
{
|
||||
// Configuration.
|
||||
public Model_Interface.ListConfigData CfgList { get; } = new Model_Interface.ListConfigData();
|
||||
public Model_Interface.ItemConfigData CfgItemNew { get; } = new Model_Interface.ItemConfigData();
|
||||
// Reference data.
|
||||
public List<ItemCodeDesc> Statuses { get; } = new List<ItemCodeDesc>();
|
||||
public List<ItemCodeDesc> StatusesCreate { get; } = new List<ItemCodeDesc>();
|
||||
public String StatusCodeDefault { get; set; }
|
||||
}
|
||||
public ConfigData Data { get; set; } = new ConfigData();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Interfaces/Interface/Ajax/Config")]
|
||||
[Route("Interfaces/Interface/Ajax/GetConfig")]
|
||||
public IActionResult Ajax_GetInterfaceConfig(Model_Interface model)
|
||||
{
|
||||
String messageTitle = Localiser["label.interfaceObjs"];
|
||||
AjaxResponse_InterfaceConfig responseData = new AjaxResponse_InterfaceConfig(model);
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer) return Forbid();
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
RefreshModel(model);
|
||||
|
||||
// Populate configuration data.
|
||||
PopulateInterfaceConfig(model, responseData);
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
private void PopulateInterfaceConfig(Model_Interface model, AjaxResponse_InterfaceConfig responseData)
|
||||
{
|
||||
// Configuration.
|
||||
model.PopulateListConfig(responseData.Data.CfgList);
|
||||
model.PopulateItemConfig(responseData.Data.CfgItemNew, null, SaInterfaceCategory.Unknown);
|
||||
|
||||
// Reference data - statuses.
|
||||
foreach (SaStatus status in SaInterface.ValidStatuses)
|
||||
{
|
||||
responseData.Data.Statuses.Add(new AjaxResponse_Data.ItemCodeDesc(SacsSystem.GetStatusCode(status), Localiser.GetStatusCaption(status)));
|
||||
if (status != SaStatus.Deleted)
|
||||
responseData.Data.StatusesCreate.Add(new AjaxResponse_Data.ItemCodeDesc(SacsSystem.GetStatusCode(status), Localiser.GetStatusCaption(status)));
|
||||
}
|
||||
responseData.Data.StatusCodeDefault = SacsSystem.GetStatusCode(SaInterface.DefaultStatus);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Interface list ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_InterfaceList : AjaxResponse_InterfaceConfig
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_InterfaceList(SbmModel_Portal model) : base(model) { }
|
||||
// View mode.
|
||||
public class ModeData
|
||||
{
|
||||
public ushort? Search { get; set; }
|
||||
public ushort? Maintain { get; set; }
|
||||
public ushort? InterfacesForItem { get; set; }
|
||||
}
|
||||
public ModeData Mode { get; set; }
|
||||
// Interface list.
|
||||
public List<InterfaceListData> Interfaces { get; } = new List<InterfaceListData>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Interfaces/Interface/Ajax/GetList")]
|
||||
[Route("Interfaces/Interface/Ajax/GetInterfaces")]
|
||||
[Route("Interfaces/Interface/Ajax/GetInterfaceList")]
|
||||
public IActionResult Ajax_GetInterfaceList(Model_Interface model)
|
||||
{
|
||||
String messageTitle = Localiser["label.interfaceObjs"];
|
||||
AjaxResponse_InterfaceList responseData = new AjaxResponse_InterfaceList(model);
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer) return Forbid();
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
RefreshModel(model);
|
||||
|
||||
// Populate configuration data.
|
||||
PopulateInterfaceConfig(model, responseData);
|
||||
|
||||
// View mode.
|
||||
responseData.Mode = new AjaxResponse_InterfaceList.ModeData();
|
||||
Model_Interface.ViewMode viewMode = model.GetFilterMode();
|
||||
if (viewMode == Model_Interface.ViewMode.Maintain)
|
||||
responseData.Mode.Maintain = 1;
|
||||
else if (viewMode == Model_Interface.ViewMode.InterfacesForItem)
|
||||
responseData.Mode.InterfacesForItem = 1;
|
||||
else
|
||||
responseData.Mode.Search = 1;
|
||||
|
||||
// Item filter.
|
||||
SaInterface.Params prmInterface = new SaInterface.Params();
|
||||
prmInterface.InterfaceCategory = model.GetFilterInterfaceCategory();
|
||||
prmInterface.Search = model.Filter.Search;
|
||||
prmInterface.StatusCat = model.GetFilterStatusCat();
|
||||
model.Paging.ItemTotal = (ulong)InterfaceConsole.GetInterfaceCount(prmInterface);
|
||||
model.PopulatePagingTo(prmInterface.ResultsPaging);
|
||||
|
||||
// Item columns.
|
||||
ColumnDfn colId = InterfaceConsole.GetInterfaceColumnDfn(SaInterface.Column.Id);
|
||||
ColumnDfn colCategoryDesc = InterfaceConsole.GetInterfaceColumnDfn(SaInterface.Column.Category_Desc);
|
||||
ColumnDfn colCode = InterfaceConsole.GetInterfaceColumnDfn(SaInterface.Column.Code);
|
||||
ColumnDfn colCaption = InterfaceConsole.GetInterfaceColumnDfn(SaInterface.Column.Caption);
|
||||
ColumnDfn colNotes = InterfaceConsole.GetInterfaceColumnDfn(SaInterface.Column.Notes);
|
||||
ColumnDfn colStatus = InterfaceConsole.GetInterfaceColumnDfn(SaInterface.Column.Status);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
colId, colCategoryDesc, colCode, colCaption,
|
||||
colNotes, colStatus
|
||||
};
|
||||
|
||||
// Query items.
|
||||
using (DbResultSet resultSet = InterfaceConsole.ExecuteInterfaceQuery(columns, prmInterface))
|
||||
{
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
InterfaceListData interfaceObjData = new InterfaceListData()
|
||||
{
|
||||
Id = values.GetLong(colId.DataName).ToString(),
|
||||
CategoryDesc = values.GetString(colCategoryDesc.DataName),
|
||||
Caption = values.GetString(colCaption.DataName),
|
||||
StatusCode = values.GetString(colStatus.DataName),
|
||||
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
|
||||
};
|
||||
interfaceObjData.Field.Value.Add($"{Model_Interface.ItemField.Category}", interfaceObjData.CategoryDesc);
|
||||
interfaceObjData.Field.Value.Add($"{Model_Interface.ItemField.Code}", values.GetString(colCode.DataName));
|
||||
interfaceObjData.Field.Value.Add($"{Model_Interface.ItemField.Caption}", interfaceObjData.Caption);
|
||||
interfaceObjData.Field.Value.Add($"{Model_Interface.ItemField.Notes}", InterfaceConsole.GetInterfaceDataValue(colNotes, values).ToString());
|
||||
interfaceObjData.Field.Value.Add($"{Model_Interface.ItemField.Status}", SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName)));
|
||||
// Cleanse item values.
|
||||
interfaceObjData.Field.Value.RemoveAll(item => StringUtil.IsBlank(item.Value));
|
||||
responseData.Interfaces.Add(interfaceObjData);
|
||||
}
|
||||
}
|
||||
if (model.Paging.IsPaged)
|
||||
model.Paging.ItemCount = (ushort)responseData.Interfaces.Count;
|
||||
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Interface ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_Interface : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_Interface(SbmModel_Portal model) : base(model) { }
|
||||
// Configuration.
|
||||
public Model_Interface.ItemConfigData Config { get; } = new Model_Interface.ItemConfigData();
|
||||
// Interface details.
|
||||
public InterfaceItemData interfaceObj { get; } = new InterfaceItemData();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Interfaces/Interface/Ajax/GetItem")]
|
||||
[Route("Interfaces/Interface/Ajax/GetInterface")]
|
||||
public IActionResult Ajax_GetInterface(Model_Interface model)
|
||||
{
|
||||
String messageTitle = Localiser["label.interfaceObj"];
|
||||
AjaxResponse_Interface responseData = new AjaxResponse_Interface(model);
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer) return Forbid();
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
RefreshModel(model);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// 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"]));
|
||||
|
||||
// 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"]));
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
model.PopulateItemConfig(responseData.Config, interfaceObj);
|
||||
PopulateInterfaceResponseItemData(model, responseData.interfaceObj, interfaceObj);
|
||||
responseData.Success = true;
|
||||
}
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Store Interface ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Interfaces/Interface/Ajax/StoreItem")]
|
||||
[Route("Interfaces/Interface/Ajax/StoreInterface")]
|
||||
public IActionResult Ajax_StoreInterface(Model_Interface model)
|
||||
{
|
||||
String messageTitle = Localiser["label.interfaceObj"];
|
||||
AjaxResponse_Interface responseData = new AjaxResponse_Interface(model);
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer) return Forbid();
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
RefreshModel(model);
|
||||
|
||||
// Validate item Id.
|
||||
SysId interfaceObjId = SysId.ToSysId(model.Interface.Id);
|
||||
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"]));
|
||||
}
|
||||
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"]));
|
||||
}
|
||||
|
||||
// Validate item properties.
|
||||
model.ValidateInterfaceData(responseData);
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Retrieve existing item.
|
||||
SaInterface interfaceObj = InterfaceConsole.GetInterfaceById(interfaceObjId);
|
||||
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"]));
|
||||
}
|
||||
|
||||
// Create new item if required.
|
||||
if (interfaceObj == null)
|
||||
{
|
||||
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"]));
|
||||
}
|
||||
SysId interfaceId = InterfaceConsole.CreateInterface
|
||||
(SessionData_Portal.OrganisationInterfaceContext, model.GetInterfaceCategory(), model.GetInterfaceType(),
|
||||
model.Interface.Code, model.Interface.Caption, DbUpdateInfo);
|
||||
interfaceObj = InterfaceConsole.GetInterfaceById(interfaceId);
|
||||
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"]));
|
||||
}
|
||||
}
|
||||
|
||||
// Populate item properties.
|
||||
if (model.Interface.Code != null)
|
||||
interfaceObj.Code = model.Interface.Code;
|
||||
if (model.Interface.Caption != null)
|
||||
interfaceObj.Caption = model.Interface.Caption;
|
||||
if (model.Interface.StatusCode != null)
|
||||
interfaceObj.Status = model.GetInterfaceStatus();
|
||||
if (model.Interface.Notes != null)
|
||||
interfaceObj.Notes = model.Interface.Notes;
|
||||
|
||||
// Store item.
|
||||
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"]));
|
||||
}
|
||||
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
|
||||
|
||||
// Construct response.
|
||||
model.PopulateItemConfig(responseData.Config, interfaceObj);
|
||||
PopulateInterfaceResponseItemData(model, responseData.interfaceObj, interfaceObj);
|
||||
responseData.Success = true;
|
||||
}
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.App;
|
||||
using Sarand.BusinessMgr.Web.Portal.Components;
|
||||
using Sarand.BusinessMgr.Web.Portal.Models.Interfaces;
|
||||
|
||||
namespace Sarand.BusinessMgr.Web.Portal.Controllers.Interfaces
|
||||
{
|
||||
//======================================================================
|
||||
public partial class InterfaceController : SbmController_Portal
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public InterfaceController(SbmLocaliser localiser, ILogger<InterfaceController> logger) :
|
||||
base(localiser, logger)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
[Route("Interfaces/Interface")]
|
||||
public IActionResult Index()
|
||||
{
|
||||
if (!ValidUserSession)
|
||||
AutoLoginUser();
|
||||
|
||||
// Redirect to sign-in if not signed-in.
|
||||
if (!ValidUserSession)
|
||||
{
|
||||
ClearKeepLoggedInCookie();
|
||||
return RedirectToAction("", "Security");
|
||||
}
|
||||
|
||||
// Interface page.
|
||||
Model_Interface model = new Model_Interface(Localiser);
|
||||
return View("Views/Interfaces/Interface/Index.cshtml", model);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//======================================================================
|
||||
}
|
||||
+4
-4
@@ -68,7 +68,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Requirements
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.ProductCode}", requirement.ProductCode);
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.Quantity}", $"{requirement.Quantity}");
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.QuantityProd}", $"{requirement.QuantityProd}");
|
||||
data.UnitType = SbmSystem.GetSystemCodes(Sbm.SystemCode.UnitMeasureType).GetCodeForType(Internals.GetUnitOfMeasureType(requirement.UomId));
|
||||
data.UnitType = SbmSystem.GetSystemCodes(Sbm.ApplicationCode.UnitMeasureType).GetCodeForType(Internals.GetUnitOfMeasureType(requirement.UomId));
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.UnitType}", SaReferenceDataConsole.GetReferenceDataCodes(ReferenceDataSystemCode.UnitMeasureType).GetCodeForType(Internals.GetUnitOfMeasureById(requirement.UomId)?.UnitType ?? Internals.GetDefaultUomType()));
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.MaterialSourceCode}", requirement.MaterialSourceCode);
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.PromotionCode}", requirement.PromotionCode);
|
||||
@@ -171,7 +171,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Requirements
|
||||
model.PopulateItemConfig(responseData.Data.CfgItemNew, null, model.GetFilterTransactionType(), SbmTransaction.StatusCat.Pending, Sbm.RequirementType.Unknown);
|
||||
|
||||
// Reference data - requirement types.
|
||||
foreach (TypeCodeDesc requirementType in GetSystemCodes(Sbm.SystemCode.RequirementType))
|
||||
foreach (TypeCodeDesc requirementType in GetSystemCodes(Sbm.ApplicationCode.RequirementType))
|
||||
responseData.Data.RequirementTypes.Add(new AjaxResponse_Data.ItemCodeDesc(requirementType.Code, requirementType.Desc));
|
||||
|
||||
// Tax codes.
|
||||
@@ -182,8 +182,8 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Requirements
|
||||
responseData.Data.taxCodeDefault = Internals.GetDefaultTaxCode();
|
||||
|
||||
// Units of measure.
|
||||
List<TypeCodeDesc> uomCategories = SbmSystem.GetSystemCodes(Sbm.SystemCode.UnitMeasureCategory);
|
||||
List<TypeCodeDesc> uomTypes = SbmSystem.GetSystemCodes(Sbm.SystemCode.UnitMeasureType);
|
||||
List<TypeCodeDesc> uomCategories = SbmSystem.GetSystemCodes(Sbm.ApplicationCode.UnitMeasureCategory);
|
||||
List<TypeCodeDesc> uomTypes = SbmSystem.GetSystemCodes(Sbm.ApplicationCode.UnitMeasureType);
|
||||
responseData.Data.UomCats.AddRange(uomCategories.Select(item => new AjaxResponse_Data.ItemCodeDesc(item.Code, item.Desc)));
|
||||
responseData.Data.UomTypes.AddRange(uomTypes.Select(item => new AjaxResponse_Data.ItemCodeDesc(item.Code, item.Desc)));
|
||||
foreach (SaUnitMeasure uom in Internals.GetUnitsOfMeasure())
|
||||
|
||||
@@ -85,13 +85,13 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Security
|
||||
if (sessionContext == null) return false;
|
||||
|
||||
SbmSessionData_Portal sessionDataForUser = new SbmSessionData_Portal(sessionContext, model.RepositoryContext, null, null, null, null);
|
||||
ISacsDatabase busMgrDatabase = Internals.BusMgrDatabase;
|
||||
if (busMgrDatabase == null) return false;
|
||||
|
||||
using (DisposableCollection<IDisposable> disposables = new DisposableCollection<IDisposable>())
|
||||
{
|
||||
SbmInternals internalsForUser = new SbmInternals(sessionDataForUser);
|
||||
disposables.Add(internalsForUser);
|
||||
ISacsDatabase busMgrDatabase = internalsForUser.BusMgrDatabase;
|
||||
if (busMgrDatabase == null) return false;
|
||||
|
||||
// User's security item.
|
||||
SaSecurityItem securityItemUser = GetSecurityItemForSignin(sessionDataForUser, internalsForUser.SecurityConsole, model);
|
||||
@@ -144,7 +144,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Security
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private SaSecurityItem GetSecurityItemForSignin(ISbmUserContext userContext, SaSecurityConsole securityConsoleForUser, Model_Security model)
|
||||
private static SaSecurityItem GetSecurityItemForSignin(ISbmUserContext userContext, SaSecurityConsole securityConsoleForUser, Model_Security model)
|
||||
{
|
||||
// Retrieve security item by email address.
|
||||
SaSecurityItem securityItemUser = securityConsoleForUser.GetUserByEmail(model.EmailAddress);
|
||||
@@ -161,7 +161,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Security
|
||||
securityItemUser.InvalidLoginCount++;
|
||||
securityItemUser.LastInvalidLoginAt = DateTime.Now;
|
||||
if (!securityConsoleForUser.UpdateSecurityItem(securityItemUser, userContext.DbUpdateInfo))
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to store invalid sign-in attempt against User: {model.EmailAddress}. {AccountMgr.ErrorStateMessage}", true);
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to store invalid sign-in attempt against User: {model.EmailAddress}. {securityConsoleForUser.ErrorStateMessage}", true);
|
||||
SaLogger.Warn($"{SysUtil.Fn} Attempt to sign-in to User {model.EmailAddress} with invalid password. Attempt: {securityItemUser.InvalidLoginCount}.", true);
|
||||
return null;
|
||||
}
|
||||
@@ -170,7 +170,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Security
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private SbmAffiliate GetAffiliateForSignin(SbmAccountMgr accountMgrForUser, Model_Security model, SaSecurityItem securityItemUser)
|
||||
private static SbmAffiliate GetAffiliateForSignin(SbmAccountMgr accountMgrForUser, Model_Security model, SaSecurityItem securityItemUser)
|
||||
{
|
||||
// Identify the contact asociated with the security item.
|
||||
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
|
||||
@@ -198,7 +198,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Security
|
||||
/// <summary>
|
||||
/// Identify the organisation for the user to login to - either last selected (via SysParam) or first in list.
|
||||
/// </summary>
|
||||
private SbmAssociation GetOrganisationAssociationForSignIn(SbmInternals internalsForUser, Model_Security model, ISbmUserOrganisationContext userContext)
|
||||
private static SbmAssociation GetOrganisationAssociationForSignIn(SbmInternals internalsForUser, Model_Security model, ISbmUserOrganisationContext userContext)
|
||||
{
|
||||
// Previously selected organisation is stored in user params (SysParam table).
|
||||
SbmSysParamCache sysParamCache = new SbmSysParamCache(internalsForUser, userContext.UserAffiliateId);
|
||||
|
||||
+1
-1
@@ -159,7 +159,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Transactions
|
||||
model.PopulateItemConfig(responseData.Data.CfgItemNew, null, Sbm.TransactionType.Unknown);
|
||||
|
||||
// Reference data - transaction types.
|
||||
foreach (TypeCodeDesc transactionType in GetSystemCodes(Sbm.SystemCode.TransactionType))
|
||||
foreach (TypeCodeDesc transactionType in GetSystemCodes(Sbm.ApplicationCode.TransactionType))
|
||||
responseData.Data.TransactionTypes.Add(new AjaxResponse_Data.ItemCodeDesc(transactionType.Code, transactionType.Desc));
|
||||
|
||||
// Reference data - statuses.
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Transactions
|
||||
}
|
||||
|
||||
// Interpret transaction type, default to 'Sales Order'.
|
||||
List<TypeCodeDesc> transactionTypes = GetSystemCodes(Sbm.SystemCode.TransactionType);
|
||||
List<TypeCodeDesc> transactionTypes = GetSystemCodes(Sbm.ApplicationCode.TransactionType);
|
||||
Sbm.TransactionType transactionType = EnumUtil.ParseEnum(transactionTypeName, Sbm.TransactionType.SalesOrder);
|
||||
|
||||
// Transaction page.
|
||||
@@ -55,7 +55,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Transactions
|
||||
SaLogger.Warn($"{SysUtil.Fn} Transaction View invoked without Transaction Type specified.");
|
||||
return RedirectToAction("", "");
|
||||
}
|
||||
model.Filter.StatusCat = Internals.GetSystemCodes(Sbm.SystemCode.TransactionStatusCat).GetCodeForType(SbmTransaction.StatusCat.Open);
|
||||
model.Filter.StatusCat = Internals.GetApplicationCodes(Sbm.ApplicationCode.TransactionStatusCat).GetCodeForType(SbmTransaction.StatusCat.Open);
|
||||
model.Paging.PageNo = SessionData_Portal.Profile.Transaction.Filter.PageNo;
|
||||
model.Paging.PageLength = SessionData_Portal.Profile.Transaction.Filter.PageLength;
|
||||
model.PopulateListConfig();
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Commodities
|
||||
}
|
||||
public SaUomType GetCommoditySalesUnitType()
|
||||
{
|
||||
return (SaUomType)Internals.GetSystemCodes(Sbm.SystemCode.UnitMeasureType).GetTypeForCode(Commodity.SaleUnitType);
|
||||
return (SaUomType)Internals.GetApplicationCodes(Sbm.ApplicationCode.UnitMeasureType).GetTypeForCode(Commodity.SaleUnitType);
|
||||
}
|
||||
public SysId GetCommoditySalesUnitId()
|
||||
{
|
||||
|
||||
@@ -50,14 +50,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
||||
}
|
||||
public Sbm.AffiliateType GetFilterContactType()
|
||||
{
|
||||
Sbm.AffiliateType affiliateType = (Sbm.AffiliateType)SbmSystem.GetSystemCodes(Sbm.SystemCode.AffiliateType).GetTypeForCode(Filter.ContactType);
|
||||
Sbm.AffiliateType affiliateType = (Sbm.AffiliateType)SbmSystem.GetSystemCodes(Sbm.ApplicationCode.AffiliateType).GetTypeForCode(Filter.ContactType);
|
||||
if (affiliateType == 0 && !StringUtil.IsBlank(Filter.ContactType) && StringUtil.IsNumeric(Filter.ContactType, true))
|
||||
affiliateType = (Sbm.AffiliateType)StringUtil.ToInt(Filter.ContactType);
|
||||
return affiliateType;
|
||||
}
|
||||
public Sbm.AssociationType GetFilterAssociationTypeExclude()
|
||||
{
|
||||
Sbm.AssociationType associationType = (Sbm.AssociationType)SbmSystem.GetSystemCodes(Sbm.SystemCode.AssociationType).GetTypeForCode(Filter.AssociationTypeExclude);
|
||||
Sbm.AssociationType associationType = (Sbm.AssociationType)SbmSystem.GetSystemCodes(Sbm.ApplicationCode.AssociationType).GetTypeForCode(Filter.AssociationTypeExclude);
|
||||
if (associationType == 0 && !StringUtil.IsBlank(Filter.AssociationTypeExclude) && StringUtil.IsNumeric(Filter.AssociationTypeExclude, true))
|
||||
associationType = (Sbm.AssociationType)StringUtil.ToInt(Filter.AssociationTypeExclude);
|
||||
return associationType;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
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.Bus.Control;
|
||||
using Sarand.BusinessMgr.Web.Portal.Components;
|
||||
|
||||
namespace Sarand.BusinessMgr.Web.Portal.Models.Home
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Sarand.BusinessMgr.Web.Portal.Models.Interfaces
|
||||
{
|
||||
//=======================================================================
|
||||
// Interface model - Configuration.
|
||||
//=======================================================================
|
||||
partial class Model_Interface
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
/// <summary>Prefix for field names.</summary>
|
||||
public const String FieldNamePrefix = "Interface";
|
||||
|
||||
/// <summary>Item fields.</summary>
|
||||
public enum ItemField
|
||||
{
|
||||
// Interface properties.
|
||||
Id,
|
||||
Exists,
|
||||
// Identity.
|
||||
Context,
|
||||
Category,
|
||||
CategoryCode,
|
||||
Type,
|
||||
TypeValue,
|
||||
Code,
|
||||
// Properties.
|
||||
Caption,
|
||||
// Common.
|
||||
Notes,
|
||||
Status,
|
||||
CreatedOn,
|
||||
UpdatedOn,
|
||||
Actions,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Identifier used by form fields to show control specific messages generated by model validation etc.
|
||||
/// <para>- Both page and model should use this method to consistently generate the field name.</para>
|
||||
/// </summary>
|
||||
public static String GetFieldName(ItemField field)
|
||||
{
|
||||
return $"{FieldNamePrefix}{field}";
|
||||
}
|
||||
|
||||
// List configuration.
|
||||
public class ListConfigData
|
||||
{
|
||||
// Actions.
|
||||
public class ActionData
|
||||
{
|
||||
public class AllowData
|
||||
{
|
||||
public bool? Create { get; set; }
|
||||
public bool? Update { get; set; }
|
||||
}
|
||||
public AllowData Allow { get; } = new AllowData();
|
||||
}
|
||||
public ActionData Action { get; } = new ActionData();
|
||||
// List columns.
|
||||
public class ColumnData
|
||||
{
|
||||
// Column name prefix.
|
||||
public String Prefix { get; } = Model_Interface.FieldNamePrefix;
|
||||
// Hide column.
|
||||
public HashSet<string> Hide { get; } = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
||||
// Column labels.
|
||||
public Dictionary<String, String> Label { get; } = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
|
||||
}
|
||||
public ColumnData Column { get; } = new ColumnData();
|
||||
}
|
||||
public ListConfigData ListConfig { get; private set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Populate Interface list configuration data - only required on initial page construction.
|
||||
/// </summary>
|
||||
public void PopulateListConfig()
|
||||
{
|
||||
ListConfig = new ListConfigData();
|
||||
PopulateListConfig(ListConfig);
|
||||
}
|
||||
public void PopulateListConfig(ListConfigData config)
|
||||
{
|
||||
ViewMode pageMode = GetFilterMode();
|
||||
bool modeIsSearch = pageMode == ViewMode.Search;
|
||||
bool modeIsMaintain = pageMode == ViewMode.Maintain;
|
||||
bool userCanCreateInterfaces = SessionData_Portal.SecurityProfile.UserCanCreateItemType(Sbm.ItemType.Interface);
|
||||
bool userCanUpdateInterfaces = SessionData_Portal.SecurityProfile.UserCanUpdateItemType(Sbm.ItemType.Interface);
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Actions.
|
||||
|
||||
if (userCanCreateInterfaces)
|
||||
config.Action.Allow.Create = true;
|
||||
if (userCanUpdateInterfaces)
|
||||
config.Action.Allow.Update = true;
|
||||
|
||||
// List columns.
|
||||
|
||||
if (GetFilterInterfaceCategory() > 0)
|
||||
config.Column.Hide.Add($"{ItemField.Category}");
|
||||
|
||||
// Actions.
|
||||
if (!modeIsMaintain)
|
||||
config.Column.Hide.Add($"{ItemField.Actions}");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item configuration.
|
||||
//-------------------------------------------------------------------
|
||||
// Legacy Interface dialog tabs and panels.
|
||||
// Dialog:
|
||||
// - Category, SerialNumber, DescBrief, Status.
|
||||
// Tab 1 'Properties':
|
||||
// Item - Item info Html panel.
|
||||
// Purchase - price, tax code, on, net price, invoice ref, settlement, payment terms, enhancement, supplier.
|
||||
// Sale - price, tax code, category, net price, sold price, sold on.
|
||||
// Rental - cost, cost unit, price, price unit.
|
||||
// Disposal - method, dispose on.
|
||||
// Notes.
|
||||
// Tab 2 'Processes'.
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
public class ItemConfigData
|
||||
{
|
||||
// Update dialog title.
|
||||
public String Title { get; set; }
|
||||
// Pre-select Interface type.
|
||||
public class TypeData
|
||||
{
|
||||
public TypeData(string code, String desc)
|
||||
{
|
||||
Code = code;
|
||||
Desc = desc;
|
||||
}
|
||||
public String Code { get; set; }
|
||||
public String Desc { get; set; }
|
||||
}
|
||||
public TypeData Type { get; set; }
|
||||
// Field name prefix.
|
||||
public String Prefix { get; } = Model_Interface.FieldNamePrefix;
|
||||
// Control flags.
|
||||
public bool? ManagedByAccounts { get; set; }
|
||||
public bool? LocalPricing { get; set; }
|
||||
// Allowed actions.
|
||||
public class AllowData
|
||||
{
|
||||
public bool? UpdateCode { get; set; }
|
||||
}
|
||||
public AllowData Allow { get; } = new AllowData();
|
||||
// Item fields.
|
||||
public class FieldData
|
||||
{
|
||||
// Field name prefix.
|
||||
public String Prefix { get; } = Model_Interface.FieldNamePrefix;
|
||||
// Hide field.
|
||||
public HashSet<string> Hide { get; } = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
||||
// Read-only field.
|
||||
public HashSet<string> Readonly { get; } = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
||||
// Field labels.
|
||||
public Dictionary<String, String> Label { get; } = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
|
||||
}
|
||||
public FieldData Field { get; } = new FieldData();
|
||||
}
|
||||
/// <summary>
|
||||
/// Populate item configuration for existing vehicle.
|
||||
/// </summary>
|
||||
public void PopulateItemConfig(ItemConfigData config, SaInterface interfaceObj)
|
||||
{
|
||||
PopulateItemConfig(config, interfaceObj.GetItemId(), interfaceObj.Category);
|
||||
}
|
||||
/// <summary>
|
||||
/// Populate item configuration for new or existing vehicle.
|
||||
/// </summary>
|
||||
public void PopulateItemConfig(ItemConfigData config, ItemId interfaceObjId, SaInterfaceCategory interfaceCategory)
|
||||
{
|
||||
// Session configuration.
|
||||
bool userCanCreateInterfaces = SessionData_Portal.SecurityProfile.UserCanCreateItemType(Sbm.ItemType.Interface);
|
||||
bool userCanUpdateInterfaces = SessionData_Portal.SecurityProfile.UserCanUpdateItemType(Sbm.ItemType.Interface);
|
||||
|
||||
// Update dialog title.
|
||||
config.Title = Localiser["caption.interface.update"];
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Identity.
|
||||
|
||||
// Interface category.
|
||||
// ToDo - Interface type readonly if any associated items.
|
||||
if (!userCanUpdateInterfaces || ItemId.IsValid(interfaceObjId))
|
||||
config.Field.Readonly.Add($"{ItemField.Category}");
|
||||
|
||||
// Code.
|
||||
if (!userCanUpdateInterfaces)
|
||||
config.Field.Readonly.Add($"{ItemField.Code}");
|
||||
|
||||
// Caption.
|
||||
if (!userCanUpdateInterfaces)
|
||||
config.Field.Readonly.Add($"{ItemField.Caption}");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Common properties.
|
||||
|
||||
// Status.
|
||||
if (!userCanUpdateInterfaces)
|
||||
config.Field.Readonly.Add($"{ItemField.Status}");
|
||||
|
||||
// Notes.
|
||||
if (!userCanUpdateInterfaces)
|
||||
config.Field.Readonly.Add($"{ItemField.Notes}");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
using Sarand.BusinessMgr.Net.Core.Web.App;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.Components;
|
||||
using Sarand.BusinessMgr.Web.Portal.Components;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Interfaces;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Sarand.BusinessMgr.Web.Portal.Models.Interfaces
|
||||
{
|
||||
//=======================================================================
|
||||
public partial class Model_Interface : SbmModel_Portal
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
public enum ViewMode
|
||||
{
|
||||
Search, Maintain, InterfacesForItem
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public Model_Interface(SbmLocaliser localiser) :
|
||||
base(localiser)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Filter properties.
|
||||
public class FilterData
|
||||
{
|
||||
public String Mode { get; set; }
|
||||
public String CategoryCode { get; set; }
|
||||
public String Type { get; set; }
|
||||
public String Search { get; set; }
|
||||
public String StatusCat { get; set; }
|
||||
}
|
||||
public FilterData Filter { get; } = new FilterData();
|
||||
public ViewMode GetFilterMode()
|
||||
{
|
||||
return EnumUtil.ParseEnum(Filter.Mode, ViewMode.Search);
|
||||
}
|
||||
public SaInterfaceCategory GetFilterInterfaceCategory()
|
||||
{
|
||||
return (SaInterfaceCategory)Internals.InterfaceCategoryCodes.GetTypeForCode(Filter.CategoryCode);
|
||||
}
|
||||
public SaInterfaceCategory GetInterfaceCategory()
|
||||
{
|
||||
return (SaInterfaceCategory)Internals.InterfaceCategoryCodes.GetTypeForCode(Interface.CategoryCode);
|
||||
}
|
||||
public short GetInterfaceType()
|
||||
{
|
||||
return StringUtil.ToShort(Interface.CategoryCode);
|
||||
}
|
||||
public SaInterface.StatusCat GetFilterStatusCat()
|
||||
{
|
||||
return EnumUtil.ParseEnum(Filter.StatusCat, SaInterface.StatusCat.ActiveOnly);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item properties.
|
||||
public class InterfaceData
|
||||
{
|
||||
public String Exists { get; set; }
|
||||
public String Id { get; set; }
|
||||
public String Context { get; set; }
|
||||
public String CategoryCode { get; set; }
|
||||
public String Type { get; set; }
|
||||
public String Code { get; set; }
|
||||
public String Caption { get; set; }
|
||||
public String Notes { get; set; }
|
||||
public String StatusCode { get; set; }
|
||||
}
|
||||
public InterfaceData Interface { get; } = new InterfaceData();
|
||||
public SaStatus GetInterfaceStatus() { return SacsSystem.GetStatusForCode(Interface.StatusCode); }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validation.
|
||||
//-------------------------------------------------------------------
|
||||
// Interface.
|
||||
public bool ValidateInterfaceData(SbmController_Base.AjaxResponse_Data responseData)
|
||||
{
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Interface Category.
|
||||
List<TypeCodeDesc> interfaceCategories = Internals.InterfaceCategoryCodes;
|
||||
if (Interface.CategoryCode != null)
|
||||
{
|
||||
String controlName = "InterfaceCategory";
|
||||
SaInterfaceCategory interfaceCategory = (SaInterfaceCategory)interfaceCategories.GetTypeForCode(Interface.CategoryCode);
|
||||
if (interfaceCategory == SaInterfaceCategory.Unknown)
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
|
||||
}
|
||||
|
||||
// Interface type.
|
||||
if (Interface.Type != null)
|
||||
{
|
||||
String controlName = "InterfaceType";
|
||||
short interfaceType = StringUtil.ToShort(Interface.Type);
|
||||
if (interfaceType <= 0)
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
|
||||
if (interfaceType > 100)
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
|
||||
}
|
||||
|
||||
// Code.
|
||||
if (Interface.Code != null)
|
||||
{
|
||||
String controlName = "InterfaceCode";
|
||||
Interface.Code = Interface.Code.ToUpper();
|
||||
responseData.SetControlValue(controlName, Interface.Code);
|
||||
if (StringUtil.IsBlank(Interface.Code))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(Interface.Code) > GetControlMaxLength(SaInterfaceDbDfn.ColumnIdx.SaInterface_Code))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.maximum.length", GetControlMaxLength(SaInterfaceDbDfn.ColumnIdx.SaInterface_Code)]);
|
||||
}
|
||||
|
||||
// Caption.
|
||||
if (Interface.Caption != null)
|
||||
{
|
||||
String controlName = "InterfaceCaption";
|
||||
responseData.SetControlValue(controlName, Interface.Caption);
|
||||
if (StringUtil.GetLength(Interface.Caption) > GetControlMaxLength(SaInterfaceDbDfn.ColumnIdx.SaInterface_Caption))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.maximum.length", GetControlMaxLength(SaInterfaceDbDfn.ColumnIdx.SaInterface_Caption)]);
|
||||
}
|
||||
|
||||
// Notes.
|
||||
if (Interface.Notes != null)
|
||||
{
|
||||
String controlName = "InterfaceNotes";
|
||||
responseData.SetControlValue(controlName, Interface.Notes);
|
||||
if (StringUtil.GetLength(Interface.Notes) > GetControlMaxLength(SaInterfaceDbDfn.ColumnIdx.SaInterface_Notes))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.maximum.length", GetControlMaxLength(SaInterfaceDbDfn.ColumnIdx.SaInterface_Notes)]);
|
||||
}
|
||||
|
||||
// Interface status.
|
||||
if (Interface.StatusCode != null)
|
||||
{
|
||||
String controlName = "InterfaceStatus";
|
||||
if (StringUtil.IsBlank(Interface.StatusCode))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
|
||||
else if (!SaInterface.ValidStatuses.Contains(GetInterfaceStatus()))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
|
||||
}
|
||||
}
|
||||
|
||||
return !responseData.HasControlErrors();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -77,11 +77,11 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Requirements
|
||||
}
|
||||
public SbmTransaction.StatusCat GetFilterTransactionStatusCat()
|
||||
{
|
||||
return (SbmTransaction.StatusCat)Internals.GetSystemCodes(Sbm.SystemCode.TransactionStatusCat).GetTypeForCode(Filter.TransactionStatusCat);
|
||||
return (SbmTransaction.StatusCat)Internals.GetApplicationCodes(Sbm.ApplicationCode.TransactionStatusCat).GetTypeForCode(Filter.TransactionStatusCat);
|
||||
}
|
||||
public SbmRequirement.StatusCat GetFilterRequirementStatusCat()
|
||||
{
|
||||
return (SbmRequirement.StatusCat)Internals.GetSystemCodes(Sbm.SystemCode.RequirementStatusCat).GetTypeForCode(Filter.StatusCat);
|
||||
return (SbmRequirement.StatusCat)Internals.GetApplicationCodes(Sbm.ApplicationCode.RequirementStatusCat).GetTypeForCode(Filter.StatusCat);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Transactions
|
||||
}
|
||||
public String GetFilterAssociationTypeCode()
|
||||
{
|
||||
List<TypeCodeDesc> associationTypes = Internals.GetSystemCodes(Sbm.SystemCode.AssociationType);
|
||||
List<TypeCodeDesc> associationTypes = Internals.GetApplicationCodes(Sbm.ApplicationCode.AssociationType);
|
||||
return SbmTransaction.GetAssociationTypes(GetFilterTransactionType())
|
||||
.Select(item => associationTypes.GetCodeForType(item))
|
||||
.Where(item => !StringUtil.IsBlank(item))
|
||||
@@ -67,7 +67,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Transactions
|
||||
}
|
||||
public SbmTransaction.StatusCat GetFilterTransactionStatusCat()
|
||||
{
|
||||
return (SbmTransaction.StatusCat)Internals.GetSystemCodes(Sbm.SystemCode.TransactionStatusCat).GetTypeForCode(Filter.StatusCat);
|
||||
return (SbmTransaction.StatusCat)Internals.GetApplicationCodes(Sbm.ApplicationCode.TransactionStatusCat).GetTypeForCode(Filter.StatusCat);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user