Add project files.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.App
|
||||
{
|
||||
//======================================================================
|
||||
public static class OpnAppConsole
|
||||
{
|
||||
private static readonly String ClassName = "OpnAppConsole";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A p p l i c a t i o n V i e w s
|
||||
//-------------------------------------------------------------------
|
||||
public static bool IsViewApplicable(OpnUserContext userContext, Opn.View view)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A p p l i c a t i o n M e n u
|
||||
//-------------------------------------------------------------------
|
||||
public static bool IsMenuOptionApplicable(OpnUserContext userContext, Opn.MenuOption menuOption)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//======================================================================
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using Sarand.Core.Base;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.App
|
||||
{
|
||||
//=======================================================================
|
||||
public class OpnCommand : SacsCommand
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public OpnCommand(ExecuteFn executeFn, CanExecuteFn canExecuteFn = null) :
|
||||
base(executeFn, canExecuteFn)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using Sarand.Core.CodeTypes;
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using Sarand.Core.Interfaces;
|
||||
using Sarand.Core.ItemOptions;
|
||||
using Sarand.Core.ReferenceData;
|
||||
using Sarand.Core.Security;
|
||||
using Sarand.Core.UpdateLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.App
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class OpnConsoleHelper
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Protected construction - use derived objects.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Database.
|
||||
public abstract ISacsDatabase GetDatabase (OpnSessionContext sessionContext);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create local consoles.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve Global Consoles by session context.
|
||||
public abstract SaSecurityConsole GetSecurityConsole (OpnSessionContext sessionContext);
|
||||
public abstract SaCodeTypeConsole GetCodeTypeConsole (OpnSessionContext sessionContext);
|
||||
public abstract SaReferenceDataConsole GetReferenceDataConsole (OpnSessionContext sessionContext);
|
||||
public abstract SaItemOptionConsole GetItemOptionConsole (OpnSessionContext sessionContext);
|
||||
public abstract SaInterfaceConsole GetInterfaceConsole (OpnSessionContext sessionContext);
|
||||
public abstract SaUpdateLogConsole GetUpdateLogConsole (OpnSessionContext sessionContext);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
using Sarand.Core.Base;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.App
|
||||
{
|
||||
//=======================================================================
|
||||
public static class Opn
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
public static String Version { get; }
|
||||
public static String ApplicationCaption { get; } = "Sarand OperationsMgr";
|
||||
// Option values.
|
||||
public static String ValueYes { get; } = "YES";
|
||||
public static String ValueNo { get; } = "NO";
|
||||
public static List<CodeDesc> ValueYesNo { get; } = new List<CodeDesc>() { new CodeDesc(ValueYes, "Yes"), new CodeDesc(ValueNo, "No") };
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Configuration console.
|
||||
public enum ConfigConsole
|
||||
{
|
||||
Generic,
|
||||
Sarand
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Application caption type.
|
||||
public enum CaptionType
|
||||
{
|
||||
Text,
|
||||
Html
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Application menu sections of the main navigation.
|
||||
/// </summary>
|
||||
public enum MenuSection
|
||||
{
|
||||
Unknown = 0,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Application menu navigation options.
|
||||
/// </summary>
|
||||
public enum MenuOption
|
||||
{
|
||||
Unknown = 0,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Application Views can be displayed by the applications
|
||||
/// </summary>
|
||||
public enum View
|
||||
{
|
||||
Unknown = -1,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Instance.
|
||||
/// </summary>
|
||||
public enum Instance
|
||||
{
|
||||
Unknown = 0,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// SecurityRight.
|
||||
/// </summary>
|
||||
public enum SecurityRight
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.App
|
||||
{
|
||||
//=======================================================================
|
||||
public static class OpnGlobals
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// System.
|
||||
public static OpnSystem System { get; set; } = null;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Console Helper.
|
||||
public static OpnConsoleHelper ConsoleHelper { get; set; } = null;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Application.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Database.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security console.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Code Type console.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Reference Data console.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item Option console.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Interface console.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update Log console.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Clear globals.
|
||||
public static void clear ()
|
||||
{
|
||||
System = null;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using Sarand.Core.Base;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.App
|
||||
{
|
||||
//=======================================================================
|
||||
public class OpnInternals : SacsDisposable
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public OpnInternals (OpnUserContext userContext)
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Session properties.
|
||||
public OpnUserContext UserContext { get; }
|
||||
public OpnSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Managers.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Consoles.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using Sarand.Core.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.App
|
||||
{
|
||||
//=======================================================================
|
||||
public static class OpnResourceConsole
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
public enum TextResource
|
||||
{
|
||||
SaBaseCss,
|
||||
SaBaseJs,
|
||||
OpnBaseCss,
|
||||
OpnBaseJs,
|
||||
JQueryJs,
|
||||
JQueryUiCss,
|
||||
JQueryUiJs,
|
||||
}
|
||||
public enum ImageResource
|
||||
{
|
||||
arrow_down_black_16_png,
|
||||
arrow_down_black_24_png,
|
||||
arrow_up_black_16_png,
|
||||
arrow_up_black_24_png,
|
||||
star_amber_16_png,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public static String GetTextResource (TextResource textResource)
|
||||
{
|
||||
switch (textResource)
|
||||
{
|
||||
case TextResource.SaBaseCss:
|
||||
return SacsResourceConsole.GetTextResource(SacsResourceConsole.TextResource.SaBaseCss);
|
||||
case TextResource.SaBaseJs:
|
||||
return SacsResourceConsole.GetTextResource(SacsResourceConsole.TextResource.SaBaseJs);
|
||||
//case TextResource.OpnBaseCss:
|
||||
// return SacsResourceConsole.GetTextResource(SacsResourceConsole.TextResource.SaBaseCss) + Properties.Resources.opn_base_css;
|
||||
//case TextResource.OpnBaseJs:
|
||||
// return SacsResourceConsole.GetTextResource(SacsResourceConsole.TextResource.SaBaseJs) + Properties.Resources.opn_base_js;
|
||||
case TextResource.JQueryJs:
|
||||
return SacsResourceConsole.GetTextResource(SacsResourceConsole.TextResource.JQueryJs);
|
||||
case TextResource.JQueryUiCss:
|
||||
return SacsResourceConsole.GetTextResource(SacsResourceConsole.TextResource.JQueryUiCss);
|
||||
case TextResource.JQueryUiJs:
|
||||
return SacsResourceConsole.GetTextResource(SacsResourceConsole.TextResource.JQueryUiJs);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Security;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.App
|
||||
{
|
||||
//=======================================================================
|
||||
public class OpnSecurityProfile : SaErrorStateItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static readonly String userNameUnknown = "Unknown";
|
||||
private bool includeHostSecurityProfile = false;
|
||||
private SaSecurityProfile userSecurityProfile;
|
||||
private SaSecurityProfile hostSecurityProfile;
|
||||
private readonly List<TypeCodeDesc> securityRights = new List<TypeCodeDesc>();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public OpnSecurityProfile (OpnUserContext userContext, bool includeHostSecurityProfile)
|
||||
{
|
||||
this.UserContext = userContext;
|
||||
this.includeHostSecurityProfile = includeHostSecurityProfile;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public OpnUserContext UserContext { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Refresh profile.
|
||||
public void RefreshProfile (SaSecurityConsole securityConsole, SysId userId, List<TypeCodeDesc> securityRights)
|
||||
{
|
||||
}
|
||||
protected void RefreshProfile (SaSecurityConsole securityConsole, SaSecurityProfile hostSecurityProfile)
|
||||
{
|
||||
}
|
||||
private void ClearProfile ()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// User.
|
||||
public SysId UserId { get; protected set; } = new SysId();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security rights.
|
||||
private bool UserHasSecurityRight (Opn.SecurityRight securityRight, SysId dataItemId = null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.App
|
||||
{
|
||||
//=======================================================================
|
||||
public class OpnSessionContext
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected OpnSessionContext (ushort index)
|
||||
{
|
||||
Index = index;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public ushort Index { get; }
|
||||
public Opn.Instance Instance { get; protected set; }
|
||||
public String InstanceCode { get { return OpnSystem.GetInstanceCode(Instance); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Comparison.
|
||||
public bool Equals (OpnSessionContext sessionContext)
|
||||
{
|
||||
if (sessionContext.Index != Index) return false;
|
||||
if (sessionContext.Instance != Instance) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.App
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class OpnSessionProfile
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Protected Construction - use derived objects.
|
||||
protected OpnSessionProfile (OpnSessionContext sessionContext)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// O w n e r O r g a n i s a t i o n
|
||||
//-------------------------------------------------------------------
|
||||
public abstract bool SetSelectedOwner (SysId affiliateId);
|
||||
protected void RefreshOwnerOrganisation(SysId affiliateIdOrganisation)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// U s e r S e s s i o n
|
||||
//-------------------------------------------------------------------
|
||||
public bool StartUserSession (SysId userId, List<TypeCodeDesc> securityRights)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public void ClearUserSession ()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Save the user's session parameters.
|
||||
public bool SaveSessionProfile ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// D a t a b a s e
|
||||
//-------------------------------------------------------------------
|
||||
// Database Update
|
||||
public DbUpdateInfo DbUpdateInfo;
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.CodeTypes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.App
|
||||
{
|
||||
//=======================================================================
|
||||
// O P N S y s t e m - C o d e T y p e s
|
||||
//=======================================================================
|
||||
public abstract partial class OpnSystem : SacsSystem
|
||||
{
|
||||
//===================================================================
|
||||
// A p p l i c a t i o n C o d e T y p e s
|
||||
//===================================================================
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// R e g i s t e r C o d e T y p e s
|
||||
//-------------------------------------------------------------------
|
||||
public static void RegisterCodeTypes (SaCodeTypeConsole codeTypeConsole, Opn.Instance instance)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using Sarand.Core.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.App
|
||||
{
|
||||
//=======================================================================
|
||||
// O P N S y s t e m - S t a t i c s
|
||||
//=======================================================================
|
||||
public abstract partial class OpnSystem : SacsSystem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// OPN System - Static initialisation.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Code type lists.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Static initialisation.
|
||||
static OpnSystem ()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.App
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract partial class OpnSystem : SacsSystem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Extended logging options.
|
||||
public enum ExtendedLogginOption
|
||||
{
|
||||
SecurityProfile,
|
||||
DbQueryExecution,
|
||||
Printing,
|
||||
}
|
||||
public static readonly String ExtendedLogging_SecurityProfile = "SecurityProfile";
|
||||
public static readonly String ExtendedLogging_DbQueryExecution = "DbQueryExecution";
|
||||
public static readonly String ExtendedLogging_Printing = "Printing";
|
||||
private List<String> extendedLoggingOptions;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction - use derived objects.
|
||||
protected OpnSystem (PropertySet properties)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Application definitions.
|
||||
public static String GetCopyrightNotice (bool html = false)
|
||||
{
|
||||
return (html ? "© " : "(c) ") + "2002- " + DateTime.Today.Year + " Sarand Ltd";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// S y s t e m C o d e s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// System code utilities.
|
||||
public static Opn.Instance GetInstanceForCode (String instanceCode)
|
||||
{
|
||||
return Opn.Instance.Unknown;
|
||||
}
|
||||
public static String GetInstanceCode (Opn.Instance instance)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public static String GetInstanceDesc (Opn.Instance instance)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// D a t a M a n a g e r s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A p p l i c a t i o n P r o p e r t i e s
|
||||
//-------------------------------------------------------------------
|
||||
public bool IsExtendedLogging (ExtendedLogginOption extendedLoggingOption)
|
||||
{
|
||||
if (extendedLoggingOptions == null) return false;
|
||||
if (extendedLoggingOption == ExtendedLogginOption.SecurityProfile)
|
||||
return extendedLoggingOptions.ContainsCI(ExtendedLogging_SecurityProfile);
|
||||
if (extendedLoggingOption == ExtendedLogginOption.DbQueryExecution)
|
||||
return extendedLoggingOptions.ContainsCI(ExtendedLogging_DbQueryExecution);
|
||||
if (extendedLoggingOption == ExtendedLogginOption.Printing)
|
||||
return extendedLoggingOptions.ContainsCI(ExtendedLogging_Printing);
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.App
|
||||
{
|
||||
//=======================================================================
|
||||
public class OpnUserContext
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public OpnSessionContext SessionContext { get; protected set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security profile.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation configuration.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Modify properties - internal only.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.Data
|
||||
{
|
||||
//=======================================================================
|
||||
public static class OpnWindwosServiceCrypter
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// R e q u e s t D a t a
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Encrypt request data</summary>
|
||||
public static String EncryptRequestData (String value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
/// <summary>Decrypt request data</summary>
|
||||
public static String DecryptRequestData (String value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// R e s p o n s e D a t a
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Encrypt response data</summary>
|
||||
public static String EncryptResponseData (String value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
/// <summary>Decrypt response data</summary>
|
||||
public static String DecryptResponseData (String value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using Sarand.Core.UpdateLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.UpdateLog
|
||||
{
|
||||
//=======================================================================
|
||||
public class OpnUpdateLogItemMonitor : SaUpdateLogItemMonitor
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Configuration.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Config config;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected OpnUpdateLogItemMonitor (Config config) : base(config)
|
||||
{
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Internal utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using Sarand.Core.Tasks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.WebService
|
||||
{
|
||||
//=======================================================================
|
||||
// Operations Web Service Client
|
||||
// Make requests to OperationsMgr Web Service hosted by Windows Service application.
|
||||
//-----------------------------------------------------------------------
|
||||
// Threading:
|
||||
// Ref. https://blog.xamarin.com/getting-started-with-async-await/
|
||||
//=======================================================================
|
||||
public class OpnWebServiceClient
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
public class RequestData : SacsTaskData
|
||||
{
|
||||
/// <summary>
|
||||
/// Web Service Request data.
|
||||
/// <para>Cancellation token can optionally be supplied if available higher up the chain.</para>
|
||||
/// </summary>
|
||||
public RequestData (OpnWebServiceInstanceDefinition instanceDefinition, CancellationToken? cancellationToken) :
|
||||
base(cancellationToken)
|
||||
{
|
||||
InstanceDefintion = instanceDefinition;
|
||||
}
|
||||
public OpnWebServiceInstanceDefinition InstanceDefintion { get; }
|
||||
public String Data { get; set; } = "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public OpnWebServiceClient ()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// I s A l i v e
|
||||
//-------------------------------------------------------------------
|
||||
public async Task<bool> RequestIsAlive (OpnWebServiceInstanceDefinition instanceDefinition)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// I t e m C o u n t R e q u e s t
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Q u e r y L i s t R e q u e s t
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// I t e m L i s t R e q u e s t
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// I t e m D a t a R e q u e s t
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// E x t r a c t I t e m
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// S t o r e I t e m R e q u e s t
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// W e b S e r v i c e R e q u e s t
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.WebService
|
||||
{
|
||||
//=======================================================================
|
||||
public static class OpnWebServiceDfn
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Web Service XML element names.
|
||||
public class ElementNameData
|
||||
{
|
||||
}
|
||||
public static ElementNameData ElementName { get; } = new ElementNameData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Web Service XML attribute names.
|
||||
public class AttributeNameData
|
||||
{
|
||||
}
|
||||
public static AttributeNameData AttributeName { get; } = new AttributeNameData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public static String IsAliveResponse { get; } = "Hello";
|
||||
public static String StatusSuccess { get; } = "OK";
|
||||
public static String StatusFatal { get; } = "Fatal";
|
||||
public static String StatusError { get; } = "Error";
|
||||
public static String StatusWarning { get; } = "Warning";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.WebService
|
||||
{
|
||||
//=======================================================================
|
||||
public class OpnWebServiceInstanceDefinition
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public OpnWebServiceInstanceDefinition (String caption, String url)
|
||||
{
|
||||
Caption = caption;
|
||||
URL = url;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public String Caption { get; }
|
||||
public String URL { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.WebService
|
||||
{
|
||||
//=======================================================================
|
||||
public class OpnWebServiceItemData
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Dictionary<String, String> values = new Dictionary<String, String>();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public OpnWebServiceItemData (String itemType)
|
||||
{
|
||||
ItemType = itemType;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public String ItemType { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public void AddValue (String name, String value)
|
||||
{
|
||||
values[name] = value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Value exists.
|
||||
public bool HasValue<T> (T name)
|
||||
{
|
||||
return HasValue(name.ToString());
|
||||
}
|
||||
public bool HasValue (string name)
|
||||
{
|
||||
return values.ContainsKey(name);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// String value.
|
||||
public String GetValue<T> (T name)
|
||||
{
|
||||
return GetValue(name.ToString());
|
||||
}
|
||||
public String GetValue (string name)
|
||||
{
|
||||
return values.GetValue(name, "");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// SysId value.
|
||||
public SysId GetIdValue<T> (T name)
|
||||
{
|
||||
return GetIdValue(name.ToString());
|
||||
}
|
||||
public SysId GetIdValue (string name)
|
||||
{
|
||||
return new SysId(StringUtil.ToInt(GetValue(name)));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Bool value.
|
||||
public bool GetBoolValue<T> (T name)
|
||||
{
|
||||
return GetBoolValue(name.ToString());
|
||||
}
|
||||
public bool GetBoolValue (string name)
|
||||
{
|
||||
return StringUtil.ToBool(GetValue(name));
|
||||
}
|
||||
// Int value.
|
||||
public int GetIntValue<T> (T name)
|
||||
{
|
||||
return GetIntValue(name.ToString());
|
||||
}
|
||||
public int GetIntValue (string name)
|
||||
{
|
||||
return StringUtil.ToInt(GetValue(name));
|
||||
}
|
||||
// Decimal value.
|
||||
public decimal GetDecimalValue<T> (T name)
|
||||
{
|
||||
return GetDecimalValue(name.ToString());
|
||||
}
|
||||
public decimal GetDecimalValue (string name)
|
||||
{
|
||||
return StringUtil.ToDecimal(GetValue(name));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Date value.
|
||||
public DateTime GetDateValue<T> (T name)
|
||||
{
|
||||
return GetDateValue(name.ToString());
|
||||
}
|
||||
public DateTime GetDateValue (string name)
|
||||
{
|
||||
return DateUtil.ParseXmlDate(GetValue(name));
|
||||
}
|
||||
// DateTime value.
|
||||
public DateTime GetDateTimeValue<T> (T name)
|
||||
{
|
||||
return GetDateTimeValue(name.ToString());
|
||||
}
|
||||
public DateTime GetDateTimeValue (string name)
|
||||
{
|
||||
return DateUtil.ParseXmlDateTime(GetValue(name));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using Sarand.Core.Base;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.WebService
|
||||
{
|
||||
//=======================================================================
|
||||
public class OpnWebServiceMessage
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public OpnWebServiceMessage (string context, String code, String message, SaMessageLevel level = SaMessageLevel.Info)
|
||||
{
|
||||
Level = level;
|
||||
Context = context;
|
||||
Code = code;
|
||||
Message = message;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SaMessageLevel Level { get; }
|
||||
public string Context { get; }
|
||||
public string Code { get; }
|
||||
public string Message { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
public static class OpnWebServiceMessageList
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.WebService
|
||||
{
|
||||
//=======================================================================
|
||||
public class OpnWebServiceRequest
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
public enum RequestType
|
||||
{
|
||||
Unknown,
|
||||
IsAlive,
|
||||
/// <summary>Item count</summary>
|
||||
Count,
|
||||
/// <summary>Query list - specific columns, compressed (csv etc) response data</summary>
|
||||
QueryList,
|
||||
/// <summary>Item list - full xml for each item with optional associated items.</summary>
|
||||
ItemList,
|
||||
/// <summary>Single Item with optional associated items.</summary>
|
||||
Item,
|
||||
/// <summary>Validate item properties without update.</summary>
|
||||
Validate,
|
||||
/// <summary>Validate properties and store (insert/update) item.</summary>
|
||||
Store,
|
||||
/// <summary>Delete item.</summary>
|
||||
Delete,
|
||||
}
|
||||
public enum DataType
|
||||
{
|
||||
Unknown,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Sort column identified by column name with ascending flag.
|
||||
/// </summary>
|
||||
public class SortColumnData
|
||||
{
|
||||
public SortColumnData (String columnName, bool ascending)
|
||||
{
|
||||
ColumnName = columnName;
|
||||
Ascending = ascending;
|
||||
}
|
||||
public String ColumnName { get; }
|
||||
public bool Ascending { get; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Configuration.
|
||||
public class Config
|
||||
{
|
||||
public bool SoapEnvelope { get; set; }
|
||||
public String SoapPrefix { get; set; }
|
||||
public DataType DataType { get; set; }
|
||||
public RequestType RequestType { get; set; }
|
||||
public class ContextProperties
|
||||
{
|
||||
public bool Commit { get; set; }
|
||||
public bool Debug { get; set; }
|
||||
}
|
||||
public ContextProperties Context { get; } = new ContextProperties();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Config config;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public OpnWebServiceRequest (Config config)
|
||||
{
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Dictionary<String, String> Filters { get; } = new Dictionary<string, string>();
|
||||
public List<String> Columns { get; } = new List<String>();
|
||||
public List<String> SortColumns { get; } = new List<String>();
|
||||
public XElement ItemElement { get; set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// D a t a G e n e r a t i o n
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using Sarand.Core.Net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.OperationsMgr.Core.WebService
|
||||
{
|
||||
//=======================================================================
|
||||
public class OpnWebServiceResponse
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Configuration.
|
||||
public class Config
|
||||
{
|
||||
public DateTime RequestStarted { get; set; } = DateTime.Now;
|
||||
public DateTime RequestCompleted { get; set; }
|
||||
public SacsHttpResponseData HttpResponseData { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
protected readonly Config config;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public OpnWebServiceResponse (Config config)
|
||||
{
|
||||
}
|
||||
public OpnWebServiceResponse (OpnWebServiceResponse serviceResponse)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user