This commit is contained in:
@@ -5,7 +5,7 @@ using Sockeye.Models;
|
||||
|
||||
namespace Sockeye.DataList
|
||||
{
|
||||
internal class PurchaseDataList : DataListProcessingBase
|
||||
internal class PurchaseDataList : DataListProcessingBase, IDataListInternalCriteria
|
||||
{
|
||||
public PurchaseDataList(long translationId)
|
||||
{
|
||||
@@ -14,29 +14,10 @@ namespace Sockeye.DataList
|
||||
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
DefaultColumns = new List<string>() { "PurchaseDate", "PurchaseSalesOrderNumber", "Customer", "Product" };
|
||||
DefaultColumns = new List<string>() { "PurchaseDate", "PurchaseSalesOrderNumber", "Customer", "Product", "PurchaseProcessedDate" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "PurchaseDate", "-" } };
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
/*
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'Purchase', 'Purchase' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseList', 'Purchases' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseSalesOrderNumber', 'Sales order #' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseDate', 'Date' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseExpireDate', 'Expires' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseCancelDate', 'Cancelled' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseCouponCode', 'Coupon' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseNotes', 'Notes' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseRenewNoticeSent', 'Renew notice sent' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseQuantity', 'Quantity' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseVendorData', 'Vendor data' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseProcessedDate', 'Processed' FROM atranslation t where t.baselanguage = 'en'");
|
||||
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, customerid BIGINT NOT NULL REFERENCES acustomer(id) ON DELETE CASCADE, "
|
||||
+ "vendorid BIGINT NOT NULL REFERENCES avendor(id), productid BIGINT NOT NULL REFERENCES aproduct(id), salesordernumber TEXT, "
|
||||
+ "purchasedate TIMESTAMPTZ NOT NULL, expiredate TIMESTAMPTZ, canceldate TIMESTAMPTZ, couponcode text, notes text, "
|
||||
+ "renewnoticesent BOOL NOT NULL DEFAULT false, quantity INTEGER NOT NULL DEFAULT 1, "
|
||||
+ "vendordata TEXT, processeddate TIMESTAMPTZ, "
|
||||
+ "wiki TEXT, tags VARCHAR(255) ARRAY
|
||||
*/
|
||||
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
@@ -135,13 +116,7 @@ id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, customerid BIGINT NOT NULL R
|
||||
SqlValueColumnName = "apurchase.quantity"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "PurchaseVendorData",
|
||||
FieldKey = "PurchaseVendorData",
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlValueColumnName = "apurchase.vendordata"
|
||||
});
|
||||
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
@@ -160,6 +135,30 @@ id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, customerid BIGINT NOT NULL R
|
||||
SqlValueColumnName = "apurchase.tags"
|
||||
});
|
||||
|
||||
//META column
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
FieldKey = "metacustomer",
|
||||
UiFieldDataType = (int)UiFieldDataType.InternalId,
|
||||
SqlIdColumnName = "apurchase.customerid",
|
||||
SqlValueColumnName = "apurchase.customerid",
|
||||
IsMeta = true
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||
{
|
||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||
//ClientCriteria MUST be CustomerId
|
||||
if (string.IsNullOrWhiteSpace(clientCriteria))
|
||||
throw new System.ArgumentNullException("CustomerNoteDataList - ClientCriteria is empty, should be Customer ID");
|
||||
|
||||
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metacustomer" };
|
||||
FilterOption.Items.Add(new DataListColumnFilter() { value = clientCriteria, op = DataListFilterComparisonOperator.Equality });
|
||||
|
||||
ret.Add(FilterOption);
|
||||
return ret;
|
||||
}
|
||||
|
||||
}//eoc
|
||||
|
||||
@@ -20,8 +20,6 @@ namespace Sockeye.Models
|
||||
{
|
||||
SmtpDeliveryActive = true;
|
||||
Id = 1;
|
||||
|
||||
#if (DEBUG)
|
||||
SmtpDeliveryActive = true;
|
||||
SmtpServerAddress = "smtp.fastmail.com";
|
||||
SmtpAccount = "support@onayanova.com";
|
||||
@@ -30,16 +28,7 @@ namespace Sockeye.Models
|
||||
SmtpServerPort = 465;
|
||||
NotifyFromAddress = "support@ayanova.com";
|
||||
SockeyeServerURL = "http://localhost:8080";
|
||||
#else
|
||||
SmtpDeliveryActive = false;
|
||||
SmtpServerAddress = "mail.example.com";
|
||||
SmtpAccount = "notifydeliverfromaccount@example.com";
|
||||
SmtpPassword = "examplepassword";
|
||||
ConnectionSecurity = NotifyMailSecurity.SSLTLS;
|
||||
SmtpServerPort = 587;
|
||||
NotifyFromAddress = "noreply@example.com";
|
||||
SockeyeServerURL = "https://url_to_my_ayanova_app";
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user