This commit is contained in:
56
server/PickList/ProductPickList.cs
Normal file
56
server/PickList/ProductPickList.cs
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Sockeye.Biz;
|
||||||
|
namespace Sockeye.PickList
|
||||||
|
{
|
||||||
|
internal class ProductPickList : AyaPickList
|
||||||
|
{
|
||||||
|
public ProductPickList()
|
||||||
|
{
|
||||||
|
|
||||||
|
DefaultListAType = SockType.Product;
|
||||||
|
SQLFrom = "from aproduct";
|
||||||
|
AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select;
|
||||||
|
dynamic dTemplate = new JArray();
|
||||||
|
|
||||||
|
dynamic cm = new JObject();
|
||||||
|
cm.fld = "productname";
|
||||||
|
dTemplate.Add(cm);
|
||||||
|
|
||||||
|
cm = new JObject();
|
||||||
|
cm.fld = "producttags";
|
||||||
|
dTemplate.Add(cm);
|
||||||
|
|
||||||
|
base.DefaultTemplate = dTemplate.ToString(Newtonsoft.Json.Formatting.None);
|
||||||
|
|
||||||
|
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
|
||||||
|
ColumnDefinitions = new List<AyaPickListFieldDefinition>();
|
||||||
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
||||||
|
{
|
||||||
|
TKey = "Active",
|
||||||
|
FieldKey = "productactive",
|
||||||
|
ColumnDataType = UiFieldDataType.Bool,
|
||||||
|
SqlValueColumnName = "aproduct.active",
|
||||||
|
IsActiveColumn = true
|
||||||
|
});
|
||||||
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
||||||
|
{
|
||||||
|
TKey = "Name",
|
||||||
|
FieldKey = "productname",
|
||||||
|
ColumnDataType = UiFieldDataType.Text,
|
||||||
|
SqlIdColumnName = "aproduct.id",
|
||||||
|
SqlValueColumnName = "aproduct.name",
|
||||||
|
IsRowId = true
|
||||||
|
});
|
||||||
|
|
||||||
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
||||||
|
{
|
||||||
|
TKey = "Tags",
|
||||||
|
FieldKey = "producttags",
|
||||||
|
ColumnDataType = UiFieldDataType.Tags,
|
||||||
|
SqlValueColumnName = "aproduct.tags"
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}//eoc
|
||||||
|
}//eons
|
||||||
56
server/PickList/VendorPickList.cs
Normal file
56
server/PickList/VendorPickList.cs
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Sockeye.Biz;
|
||||||
|
namespace Sockeye.PickList
|
||||||
|
{
|
||||||
|
internal class VendorPickList : AyaPickList
|
||||||
|
{
|
||||||
|
public VendorPickList()
|
||||||
|
{
|
||||||
|
|
||||||
|
DefaultListAType = SockType.Vendor;
|
||||||
|
SQLFrom = "from avendor";
|
||||||
|
AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select;
|
||||||
|
dynamic dTemplate = new JArray();
|
||||||
|
|
||||||
|
dynamic cm = new JObject();
|
||||||
|
cm.fld = "vendorname";
|
||||||
|
dTemplate.Add(cm);
|
||||||
|
|
||||||
|
cm = new JObject();
|
||||||
|
cm.fld = "vendortags";
|
||||||
|
dTemplate.Add(cm);
|
||||||
|
|
||||||
|
base.DefaultTemplate = dTemplate.ToString(Newtonsoft.Json.Formatting.None);
|
||||||
|
|
||||||
|
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
|
||||||
|
ColumnDefinitions = new List<AyaPickListFieldDefinition>();
|
||||||
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
||||||
|
{
|
||||||
|
TKey = "Active",
|
||||||
|
FieldKey = "vendoractive",
|
||||||
|
ColumnDataType = UiFieldDataType.Bool,
|
||||||
|
SqlValueColumnName = "avendor.active",
|
||||||
|
IsActiveColumn = true
|
||||||
|
});
|
||||||
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
||||||
|
{
|
||||||
|
TKey = "Name",
|
||||||
|
FieldKey = "vendorname",
|
||||||
|
ColumnDataType = UiFieldDataType.Text,
|
||||||
|
SqlIdColumnName = "avendor.id",
|
||||||
|
SqlValueColumnName = "avendor.name",
|
||||||
|
IsRowId = true
|
||||||
|
});
|
||||||
|
|
||||||
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
||||||
|
{
|
||||||
|
TKey = "Tags",
|
||||||
|
FieldKey = "vendortags",
|
||||||
|
ColumnDataType = UiFieldDataType.Tags,
|
||||||
|
SqlValueColumnName = "avendor.tags"
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}//eoc
|
||||||
|
}//eons
|
||||||
@@ -225,8 +225,7 @@ namespace Sockeye.Biz
|
|||||||
private async Task ValidateCanDeleteAsync(License inObj)
|
private async Task ValidateCanDeleteAsync(License inObj)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (await ct.SubscriptionServer.AnyAsync(m => m.LicenseId == inObj.Id))
|
await Task.CompletedTask;
|
||||||
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("SubscriptionServer"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ namespace Sockeye.Models
|
|||||||
public string OperatingSystem { get; set; }
|
public string OperatingSystem { get; set; }
|
||||||
public string CustomerSubDomain { get; set; }
|
public string CustomerSubDomain { get; set; }
|
||||||
public long? CustomerId { get; set; }
|
public long? CustomerId { get; set; }
|
||||||
public long? LicenseId { get; set; }
|
|
||||||
public string Wiki { get; set; }
|
public string Wiki { get; set; }
|
||||||
public List<string> Tags { get; set; }
|
public List<string> Tags { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -889,7 +889,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
|||||||
await ExecQueryAsync("CREATE TABLE asubscriptionserver (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, active BOOL NOT NULL DEFAULT true, created TIMESTAMPTZ NOT NULL, "
|
await ExecQueryAsync("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, lastupdated TIMESTAMPTZ, subscriptionexpire TIMESTAMPTZ NOT NULL, "
|
+ "name TEXT NOT NULL, notes TEXT, datacenter TEXT NOT NULL, timezone TEXT NOT NULL, lastupdated TIMESTAMPTZ, subscriptionexpire TIMESTAMPTZ NOT NULL, "
|
||||||
+ "trial BOOL NOT NULL DEFAULT true, trialexpire TIMESTAMPTZ, trialcontact TEXT, trialemail TEXT, trialcompany TEXT, operatingsystem TEXT, customersubdomain TEXT, "
|
+ "trial BOOL NOT NULL DEFAULT true, trialexpire TIMESTAMPTZ, trialcontact TEXT, trialemail TEXT, trialcompany TEXT, operatingsystem TEXT, customersubdomain TEXT, "
|
||||||
+ "wiki TEXT, tags VARCHAR(255) ARRAY, licenseid BIGINT REFERENCES alicense(id), customerid BIGINT REFERENCES acustomer(id) )");
|
+ "wiki TEXT, tags VARCHAR(255) ARRAY, customerid BIGINT REFERENCES acustomer(id) )");
|
||||||
|
|
||||||
|
|
||||||
await ExecQueryAsync("CREATE TABLE aproduct (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL, active BOOL NOT NULL DEFAULT true, "
|
await ExecQueryAsync("CREATE TABLE aproduct (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL, active BOOL NOT NULL DEFAULT true, "
|
||||||
|
|||||||
Reference in New Issue
Block a user