84 lines
2.0 KiB
C#
84 lines
2.0 KiB
C#
using System.Collections.Generic;
|
|
|
|
using BS.Shared.DataContracts;
|
|
|
|
namespace BeWo.Office.TableModels
|
|
{
|
|
public class OrganisationTableModel : AbstractTableModel
|
|
{
|
|
public List<OrganisationDC> Organisations { get; set; }
|
|
private int currentIndex = -1;
|
|
|
|
public override int Count
|
|
{
|
|
get
|
|
{
|
|
return Organisations.Count;
|
|
}
|
|
}
|
|
|
|
public OrganisationDC GetCurrentOrganisation()
|
|
{
|
|
if (Organisations != null)
|
|
if (currentIndex >= 0 && currentIndex < Organisations.Count)
|
|
return Organisations[currentIndex];
|
|
|
|
return null;
|
|
}
|
|
|
|
public override bool DataAvailable
|
|
{
|
|
get { return Organisations != null && currentIndex >= 0 && currentIndex < Organisations.Count; }
|
|
}
|
|
|
|
public override object GetPropertyValue(string propertyName)
|
|
{
|
|
var value = string.Empty;
|
|
|
|
var organisation = GetCurrentOrganisation();
|
|
|
|
switch (propertyName.ToLower())
|
|
{
|
|
|
|
}
|
|
|
|
return value;
|
|
}
|
|
|
|
public override void MoveFirst()
|
|
{
|
|
currentIndex = 0;
|
|
}
|
|
|
|
public override void MoveLast()
|
|
{
|
|
currentIndex = Organisations != null ? Organisations.Count - 1 : -1;
|
|
}
|
|
|
|
public override void MoveNext()
|
|
{
|
|
currentIndex++;
|
|
}
|
|
|
|
public override void MovePrevious()
|
|
{
|
|
currentIndex--;
|
|
}
|
|
|
|
protected override string[] CreateFieldNames()
|
|
{
|
|
return CreateDefaultFieldNames().ToArray();
|
|
}
|
|
|
|
private static List<string> CreateDefaultFieldNames()
|
|
{
|
|
var fieldnames = new List<string>
|
|
{
|
|
""
|
|
};
|
|
|
|
return fieldnames;
|
|
}
|
|
}
|
|
}
|