187 lines
9.8 KiB
C#
187 lines
9.8 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Sockeye.Biz;
|
|
using Sockeye.Models;
|
|
|
|
namespace Sockeye.DataList
|
|
{
|
|
internal class SubscriptionServerDataList : DataListProcessingBase
|
|
{
|
|
public SubscriptionServerDataList(long translationId)
|
|
{
|
|
DefaultListAType = SockType.SubscriptionServer;
|
|
SQLFrom = @"FROM asubscriptionserver LEFT JOIN acustomer ON (asubscriptionserver.customerid = acustomer.id)";
|
|
|
|
var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
|
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
|
DefaultColumns = new List<string>() { "SubServerSubExpire", "SubServerName", "Customer", "SubServerTrial", "SubServerDatacenter", "Active" };
|
|
DefaultSortBy = new Dictionary<string, string>() { { "SubServerSubExpire", "+" } };
|
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
|
/*
|
|
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubscriptionServer', 'Subscription server' FROM atranslation t where t.baselanguage = 'en'");
|
|
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubscriptionServerList', 'Subscription servers' FROM atranslation t where t.baselanguage = 'en'");
|
|
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubServerName', 'Name' FROM atranslation t where t.baselanguage = 'en'");
|
|
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubServerNotes', 'Notes' FROM atranslation t where t.baselanguage = 'en'");
|
|
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubServerDatacenter', 'Data center' FROM atranslation t where t.baselanguage = 'en'");
|
|
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubServerTimeZone', 'Time zone' FROM atranslation t where t.baselanguage = 'en'");
|
|
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubServerLastUpdated', 'Last updated' FROM atranslation t where t.baselanguage = 'en'");
|
|
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubServerSubExpire', 'Subscription expires' FROM atranslation t where t.baselanguage = 'en'");
|
|
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubServerTrialContact', 'Trial contact' FROM atranslation t where t.baselanguage = 'en'");
|
|
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubServerTrialEmail', 'TrialEmail' FROM atranslation t where t.baselanguage = 'en'");
|
|
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubServerTrial', 'Trial' FROM atranslation t where t.baselanguage = 'en'");
|
|
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubServerTrialCompany', 'Trial company' FROM atranslation t where t.baselanguage = 'en'");
|
|
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubServerOperatingSystem', 'OS' FROM atranslation t where t.baselanguage = 'en'");
|
|
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubServerCustomerDomain', 'Customer subdomain' FROM atranslation t where t.baselanguage = 'en'");
|
|
"CREATE TABLE asubscriptionserver (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, active BOOL NOT NULL DEFAULT true, created TIMESTAMPTZ NOT NULL, "
|
|
+ "name TEXT NOT NULL, notes TEXT, datacenter TEXT NOT NULL, timezone TEXT NOT NULL, dbid TEXT, lastupdated TIMESTAMPTZ, subscriptionexpire TIMESTAMPTZ NOT NULL, "
|
|
+ "trial BOOL NOT NULL DEFAULT true, trialcontact TEXT, trialemail TEXT, trialcompany TEXT, operatingsystem TEXT, customersubdomain TEXT, "
|
|
+ "wiki TEXT, tags VARCHAR(255) ARRAY, customerid BIGINT REFERENCES acustomer(id) )"
|
|
*/
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "SubServerName",
|
|
FieldKey = "SubServerName",
|
|
SockType = (int)SockType.SubscriptionServer,
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlIdColumnName = "asubscriptionserver.id",
|
|
SqlValueColumnName = "asubscriptionserver.name",
|
|
IsRowId = true
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "Active",
|
|
FieldKey = "Active",
|
|
UiFieldDataType = (int)UiFieldDataType.Bool,
|
|
SqlValueColumnName = "asubscriptionserver.active"
|
|
});
|
|
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "Created",
|
|
FieldKey = "Created",
|
|
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
|
SqlValueColumnName = "asubscriptionserver.created"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "SubServerNotes",
|
|
FieldKey = "SubServerNotes",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "asubscriptionserver.notes"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "SubServerDatacenter",
|
|
FieldKey = "SubServerDatacenter",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "asubscriptionserver.datacenter"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "SubServerTimeZone",
|
|
FieldKey = "SubServerTimeZone",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "asubscriptionserver.timezone"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "DatabaseID",
|
|
FieldKey = "DatabaseID",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "asubscriptionserver.dbid"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "SubServerLastUpdated",
|
|
FieldKey = "SubServerLastUpdated",
|
|
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
|
SqlValueColumnName = "asubscriptionserver.lastupdated"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "SubServerSubExpire",
|
|
FieldKey = "SubServerSubExpire",
|
|
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
|
SqlValueColumnName = "asubscriptionserver.subscriptionexpire"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "SubServerTrial",
|
|
FieldKey = "SubServerTrial",
|
|
UiFieldDataType = (int)UiFieldDataType.Bool,
|
|
SqlValueColumnName = "asubscriptionserver.trial"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "SubServerTrialContact",
|
|
FieldKey = "SubServerTrialContact",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "asubscriptionserver.trialcontact"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "SubServerTrialEmail",
|
|
FieldKey = "SubServerTrialEmail",
|
|
UiFieldDataType = (int)UiFieldDataType.EmailAddress,
|
|
SqlValueColumnName = "asubscriptionserver.trialemail"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "SubServerTrialCompany",
|
|
FieldKey = "SubServerTrialCompany",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "asubscriptionserver.trialcompany"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "SubServerOperatingSystem",
|
|
FieldKey = "SubServerOperatingSystem",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "asubscriptionserver.operatingsystem"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "SubServerCustomerDomain",
|
|
FieldKey = "SubServerCustomerDomain",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "asubscriptionserver.customersubdomain"
|
|
});
|
|
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "Customer",
|
|
FieldKey = "Customer",
|
|
SockType = (int)SockType.Customer,
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlIdColumnName = "asubscriptionserver.customerid",
|
|
SqlValueColumnName = "acustomer.name"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "Tags",
|
|
FieldKey = "subscriptionservertags",
|
|
UiFieldDataType = (int)UiFieldDataType.Tags,
|
|
SqlValueColumnName = "asubscriptionserver.tags"
|
|
});
|
|
|
|
}
|
|
|
|
}//eoc
|
|
}//eons |