This commit is contained in:
122
server/DataList/LicenseDataList.cs
Normal file
122
server/DataList/LicenseDataList.cs
Normal file
@@ -0,0 +1,122 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Sockeye.Biz;
|
||||
using Sockeye.Models;
|
||||
|
||||
namespace Sockeye.DataList
|
||||
{
|
||||
internal class LicenseDataList : DataListProcessingBase
|
||||
{
|
||||
public LicenseDataList(long translationId)
|
||||
{
|
||||
DefaultListAType = SockType.License;
|
||||
SQLFrom = @"FROM alicense LEFT JOIN acustomer ON (alicense.customerid = acustomer.id)";
|
||||
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
DefaultColumns = new List<string>() { "licenseid", "licensecreated", "licensecustomer", "licenseregto", "licensemaintexpire", "licenseexpire" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "licenseid", "-" } };
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
/*
|
||||
"License": "License",
|
||||
"LicenseCompanyName": "Company name",
|
||||
"LicenseContactName": "Contact name",
|
||||
"LicensedOptions": "Licensed options",
|
||||
"LicenseEmail": "Email address",
|
||||
"LicenseEmailVerficationHint": "(Address will be verified)",
|
||||
"LicenseExpiration": "License expiration date",
|
||||
"LicenseSerial": "License serial number",
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseList', 'Licenses' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseRegTo', 'Registered to' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseKey', 'License key' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseFetchCode', 'Fetch code' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseFetchEmail', 'Fetch email' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseFetchedOn', 'Fetched date' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseDBID', 'DBID' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseMaintenanceExpire', 'Maintenance expire to' FROM atranslation t where t.baselanguage = 'en'");
|
||||
"CREATE TABLE alicense (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created TIMESTAMPTZ NOT NULL, "
|
||||
+ "customerid BIGINT NOT NULL REFERENCES acustomer(id), regto TEXT NOT NULL, key TEXT NOT NULL, fetchcode TEXT, fetchemail TEXT, "
|
||||
+ "fetchedon TIMESTAMPTZ, dbid TEXT, licenseexpire TIMESTAMPTZ, maintenanceexpire TIMESTAMPTZ NOT NULL, "
|
||||
+ "wiki TEXT, tags VARCHAR(255) ARRAY )");
|
||||
*/
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "LicenseSerial",
|
||||
FieldKey = "licenseid",
|
||||
SockType = (int)SockType.License,
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlIdColumnName = "alicense.id",
|
||||
SqlValueColumnName = "alicense.id",
|
||||
IsRowId = true
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "Created",
|
||||
FieldKey = "licensecreated",
|
||||
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
||||
SqlValueColumnName = "alicense.created"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "Customer",
|
||||
FieldKey = "licensecustomer",
|
||||
SockType = (int)SockType.Customer,
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlIdColumnName = "alicense.customerid",
|
||||
SqlValueColumnName = "acustomer.name"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "Tags",
|
||||
FieldKey = "licensetags",
|
||||
UiFieldDataType = (int)UiFieldDataType.Tags,
|
||||
SqlValueColumnName = "alicense.tags"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "LicenseRegTo",
|
||||
FieldKey = "licenseregto",
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlValueColumnName = "alicense.regto"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "LicenseMaintenanceExpire",
|
||||
FieldKey = "licensemaintexpire",
|
||||
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
||||
SqlValueColumnName = "alicense.maintenanceexpire"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "LicenseExpiration",
|
||||
FieldKey = "licenseexpire",
|
||||
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
||||
SqlValueColumnName = "alicense.licenseexpire"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "LicenseFetchedOn",
|
||||
FieldKey = "LicenseFetchedOn",
|
||||
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
||||
SqlValueColumnName = "alicense.fetchedon"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "DatabaseID",
|
||||
FieldKey = "DatabaseID",
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlValueColumnName = "alicense.dbid"
|
||||
});
|
||||
}
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
@@ -875,7 +875,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
LogUpdateMessage(log);
|
||||
|
||||
await ExecQueryAsync("CREATE TABLE alicense (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created TIMESTAMPTZ NOT NULL, "
|
||||
+ "customerid BIGINT NOT NULL REFERENCES acustomer(id), regto TEXT NOT NULL, key TEXT NOT NULL, fetchcode TEXT, fetchemail TEXT, "
|
||||
+ "customerid BIGINT NOT NULL REFERENCES acustomer(id), regto TEXT NOT NULL, key TEXT NOT NULL, fetchcode TEXT, fetchemail TEXT, "
|
||||
+ "fetchedon TIMESTAMPTZ, dbid TEXT, licenseexpire TIMESTAMPTZ, maintenanceexpire TIMESTAMPTZ NOT NULL, "
|
||||
+ "wiki TEXT, tags VARCHAR(255) ARRAY )");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user