using Sarand.Core.Base; using Sarand.Core.Bus; using Sarand.Core.Dbas.Base; using Sarand.Core.Interfaces; using Sarand.Core.ItemOptions; using Sarand.Core.Procs; using Sarand.OperationsMgr.App.Consoles; using Sarand.OperationsMgr.Core.App; using Sarand.OperationsMgr.Win.Consoles; using Sarand.OperationsMgr.Win.Interfaces; using Sarand.Win.Dbas.Base; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Sarand.OperationsMgr.Web.Consoles { //======================================================================= public class OpnInterfaceConsole_Web : OpnInterfaceConsole_Dbas { //------------------------------------------------------------------- // Data members. //private List dataItemTypes = OpnSystem.GetCodesOfType(Opn.SystemCode.DataItemType); //------------------------------------------------------------------- // Construction. public OpnInterfaceConsole_Web (OpnSessionContext sessionContext, SacsDatabase database) : base(null) { Database = database; } //------------------------------------------------------------------- // Properties. internal Opn.Instance Instance { get { return SessionContext.Instance; } } internal SacsDatabase Database { get; } //------------------------------------------------------------------- // Method to display Interface management form. protected override MaintainInterfacesFunction MaintainInterfacesFn { get { return null; } } //--------------------------------------------------------------- // Interface item option definitions. public override List GetInterfaceItemOptionDfns (SaInterfaceCategory interfaceCategory, short interfaceType) { return OpnProcessConsole.GetInterfaceItemOptionDfns(interfaceCategory, interfaceType); } public override List GetInterfaceItemOptionDfns (SysId interfaceId) { SaInterface interfaceObj = GetInterfaceById(interfaceId); if (interfaceObj != null) return OpnProcessConsole.GetInterfaceItemOptionDfns(interfaceObj.Category, interfaceObj.Type); return new List(); } //------------------------------------------------------------------- // I n t e r f a c e A c c e s s C o n t r o l //------------------------------------------------------------------- //--------------------------------------------------------------- // P r o c e s s i n g O p t i o n s //--------------------------------------------------------------- private List GetProcessingOptions (SaInterface interfaceObj) { if (interfaceObj != null && SysId.IsValid(interfaceObj.Id)) { switch (interfaceObj.Category) { case SaInterfaceCategory.System: return GetProcessingOptions_System(interfaceObj); } } return new List(); } private List GetProcessingOptions_System (SaInterface interfaceObj) { if (interfaceObj.Category != SaInterfaceCategory.System) throw new NotSupportedException("Invalid interface category: " + interfaceObj.Category.ToString() + ". Expected: System"); List optionGroups = null; //switch ((Opn.InterfaceType)interfaceObj.Type) //{ //} return optionGroups ?? new List(); } //--------------------------------------------------------------- // P r o c e s s I n t e r f a c e //--------------------------------------------------------------- /// /// Interface can only be 'processed' if it defines processing options. /// /// /// public override bool CanProcessInterface (SaInterface interfaceObj) { return (GetProcessingOptions(interfaceObj).Count > 0); } /// /// Popup form to select options for processing interface. /// /// /// public override bool ProcessInterface (SaInterface interfaceObj, DbUpdateInfo dbUpdateInfo) { return false; } private OpnInterfaceProcess ConfigureProcess (SaInterface interfaceObj, SacsProcess.GroupData processGroup, DbUpdateInfo dbUpdateInfo) { switch (interfaceObj.Category) { case SaInterfaceCategory.System: return ConfigureProcess_System(interfaceObj, processGroup, dbUpdateInfo); } return null; } private OpnInterfaceProcess ConfigureProcess_System (SaInterface interfaceObj, SacsProcess.GroupData processGroup, DbUpdateInfo dbUpdateInfo) { if (interfaceObj.Category != SaInterfaceCategory.System) throw new NotSupportedException("Invalid interface category: " + interfaceObj.Category.ToString() + ". Expected: System"); //switch ((Opn.InterfaceType)interfaceObj.Type) //{ //} return null; } public override bool AreMultipleInterfaceInstancesAllowed (string context, SaInterfaceCategory interfaceCategory, short interfaceType) { throw new NotImplementedException(); } public override bool AreMultipleActiveInterfacesAllowed (string context, SaInterfaceCategory interfaceCategory) { throw new NotImplementedException(); } //------------------------------------------------------------------- } //======================================================================= }