Files
2020-03-06 16:07:06 +00:00

57 lines
1.9 KiB
C#

using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.Extensions.Logging;
using Sarand.Core.App;
using Sarand.Core.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using static Sarand.OperationsMgr.Web.App.SaOperationsMgrWebApp;
namespace Sarand.OperationsMgr.Web.Models
{
//=======================================================================
public class Model_Home_Index : Model_Base
{
//-------------------------------------------------------------------
// Data members.
private List<SelectListItem> instances = null;
//-------------------------------------------------------------------
// Form properties.
public ushort InstanceIdx { get; set; } = 0;
public String UserCode { get; set; }
public String UserPwrd { get; set; }
public String SessionExpired { get; set; }
//-------------------------------------------------------------------
// I n s t a n c e s
//-------------------------------------------------------------------
public IEnumerable<SelectListItem> Instances
{
get
{
if (SacsSystem.DebugMode) Logger.Trace(GetType().Name + ".GetInstances()");
if (instances == null)
{
// Populate list of instances.
instances = new List<SelectListItem>();
foreach (ushort sessionContextConfigIndex in App.GetSessionContextIndices())
{
SessionContextConfig sessionContextConfig = App.GetSessionContextConfig(sessionContextConfigIndex);
if (sessionContextConfig != null)
{
instances.Add(new SelectListItem() { Value = sessionContextConfig.SessionContext.Index.ToString(), Text = sessionContextConfig.Caption });
}
}
Logger.Debug(GetType().Name + ".Instances Populated instances: " + instances.Count);
}
return instances;
}
}
//-------------------------------------------------------------------
}
//=======================================================================
}