92 lines
2.4 KiB
C#
92 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
|
|
namespace bsmd.database
|
|
{
|
|
public class PortArea : DatabaseEntity
|
|
{
|
|
|
|
public PortArea()
|
|
{
|
|
this.tablename = "[dbo].[PortArea]";
|
|
}
|
|
|
|
#region Properties
|
|
|
|
[MaxLength(10)]
|
|
[ENI2Validation]
|
|
public string Country { get; set; }
|
|
|
|
[MaxLength(5)]
|
|
[ENI2Validation]
|
|
public string Locode { get; set; }
|
|
|
|
[MaxLength(255)]
|
|
[ENI2Validation]
|
|
public string Port { get; set; }
|
|
|
|
[MaxLength(10)]
|
|
[ENI2Validation]
|
|
public string Code { get; set; }
|
|
|
|
[MaxLength(255)]
|
|
[ENI2Validation]
|
|
public string Name { get; set; }
|
|
|
|
#endregion
|
|
|
|
#region abstract method implementation
|
|
public override List<DatabaseEntity> LoadList(IDataReader reader)
|
|
{
|
|
List<DatabaseEntity> result = new List<DatabaseEntity>();
|
|
while (reader.Read())
|
|
{
|
|
PortArea portArea = new PortArea();
|
|
portArea.id = reader.GetGuid(0);
|
|
if (!reader.IsDBNull(1)) portArea.Country = reader.GetString(1);
|
|
if (!reader.IsDBNull(2)) portArea.Locode = reader.GetString(2);
|
|
if (!reader.IsDBNull(3)) portArea.Port = reader.GetString(3);
|
|
if (!reader.IsDBNull(4)) portArea.Code = reader.GetString(4);
|
|
if (!reader.IsDBNull(5)) portArea.Name = reader.GetString(5);
|
|
result.Add(portArea);
|
|
}
|
|
reader.Close();
|
|
return result;
|
|
}
|
|
|
|
public override void PrepareLoadCommand(IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
|
|
{
|
|
string query = string.Format("SELECT Id, Country, Locode, Port, Code, Name FROM {0} ", this.Tablename);
|
|
|
|
switch (filter)
|
|
{
|
|
|
|
case Message.LoadFilter.ALL:
|
|
default:
|
|
break;
|
|
}
|
|
|
|
cmd.CommandText = query;
|
|
}
|
|
|
|
public override void PrepareSave(IDbCommand cmd)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region override
|
|
|
|
public override string ToString()
|
|
{
|
|
return this.Name;
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
}
|