This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -53,7 +53,7 @@
|
|||||||
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
||||||
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
||||||
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
||||||
"AYANOVA_SERVER_TEST_MODE": "true",
|
"AYANOVA_SERVER_TEST_MODE": "false",
|
||||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
||||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
||||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
||||||
|
|||||||
@@ -11,11 +11,26 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
string ret;
|
||||||
|
|
||||||
cmd.CommandText = $"select PUBLIC.AYGETNAME({id}, {(int)ayaType}) as m";
|
cmd.CommandText = $"select PUBLIC.AYGETNAME({id}, {(int)ayaType}) as m";
|
||||||
// cmd.CommandText = $"SELECT m.{COLUMN} FROM {TABLE} AS m WHERE m.id = {id} LIMIT 1";
|
|
||||||
using (var dr = cmd.ExecuteReader())
|
using (var dr = cmd.ExecuteReader())
|
||||||
return dr.Read() ? dr.GetString(0) : "-";
|
{
|
||||||
|
if (dr.Read())
|
||||||
|
{
|
||||||
|
if (dr.IsDBNull(0))
|
||||||
|
ret = $"?? type:{ayaType},id:{id}";
|
||||||
|
else
|
||||||
|
ret = dr.GetString(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = "-";
|
||||||
|
}
|
||||||
|
//return dr.Read() ? dr.GetString(0) : "-";
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -67,16 +67,7 @@ namespace AyaNova.Biz
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
PurchaseOrder newObject = new PurchaseOrder();
|
PurchaseOrder newObject = new PurchaseOrder();
|
||||||
CopyObject.Copy(dbObject, newObject, "Wiki");
|
CopyObject.Copy(dbObject, newObject, "Wiki,Serial");
|
||||||
string newUniqueName = string.Empty;
|
|
||||||
bool NotUnique = true;
|
|
||||||
long l = 1;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
|
||||||
NotUnique = await ct.PurchaseOrder.AnyAsync(z => z.Name == newUniqueName);
|
|
||||||
} while (NotUnique);
|
|
||||||
newObject.Name = newUniqueName;
|
|
||||||
newObject.Id = 0;
|
newObject.Id = 0;
|
||||||
newObject.Concurrency = 0;
|
newObject.Concurrency = 0;
|
||||||
await ct.PurchaseOrder.AddAsync(newObject);
|
await ct.PurchaseOrder.AddAsync(newObject);
|
||||||
@@ -159,7 +150,7 @@ namespace AyaNova.Biz
|
|||||||
return false;
|
return false;
|
||||||
ct.PurchaseOrder.Remove(dbObject);
|
ct.PurchaseOrder.Remove(dbObject);
|
||||||
await ct.SaveChangesAsync();
|
await ct.SaveChangesAsync();
|
||||||
await EventLogProcessor.DeleteObjectLogAsync(UserId, BizType, dbObject.Id, dbObject.Name, ct);
|
await EventLogProcessor.DeleteObjectLogAsync(UserId, BizType, dbObject.Id, dbObject.Serial.ToString(), ct);
|
||||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct);
|
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct);
|
||||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||||
@@ -202,7 +193,7 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
if (obj != null)
|
if (obj != null)
|
||||||
searchParams.AddText(obj.Notes)
|
searchParams.AddText(obj.Notes)
|
||||||
.AddText(obj.Name)
|
.AddText(obj.Serial)
|
||||||
.AddText(obj.Wiki)
|
.AddText(obj.Wiki)
|
||||||
.AddText(obj.Tags)
|
.AddText(obj.Tags)
|
||||||
.AddCustomFields(obj.CustomFields);
|
.AddCustomFields(obj.CustomFields);
|
||||||
@@ -219,20 +210,6 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
bool isNew = currentObj == null;
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
//Name required
|
|
||||||
if (string.IsNullOrWhiteSpace(proposedObj.Name))
|
|
||||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
|
|
||||||
|
|
||||||
|
|
||||||
//If name is otherwise OK, check that name is unique
|
|
||||||
if (!PropertyHasErrors("Name"))
|
|
||||||
{
|
|
||||||
//Use Any command is efficient way to check existance, it doesn't return the record, just a true or false
|
|
||||||
if (await ct.PurchaseOrder.AnyAsync(z => z.Name == proposedObj.Name && z.Id != proposedObj.Id))
|
|
||||||
{
|
|
||||||
AddError(ApiErrorCode.VALIDATION_NOT_UNIQUE, "Name");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Any form customizations to validate?
|
//Any form customizations to validate?
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ namespace AyaNova.Models
|
|||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
public uint Concurrency { get; set; }
|
public uint Concurrency { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string Name { get; set; }
|
public long Serial { get; set; }
|
||||||
public bool Active { get; set; }
|
public bool Active { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public string Wiki { get; set; }
|
public string Wiki { get; set; }
|
||||||
|
|||||||
@@ -62,15 +62,15 @@ todo: Consider adding latitude / longitude to wo, quote, pm objects
|
|||||||
public List<WorkOrderItem> Items { get; set; }
|
public List<WorkOrderItem> Items { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[NotMapped, JsonIgnore]
|
// [NotMapped, JsonIgnore]
|
||||||
public string Name
|
// public string Name
|
||||||
{
|
// {
|
||||||
//Used by notification processor
|
// //Used by notification processor
|
||||||
get
|
// get
|
||||||
{
|
// {
|
||||||
return this.Serial.ToString();
|
// return this.Serial.ToString();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
[NotMapped, JsonIgnore]
|
[NotMapped, JsonIgnore]
|
||||||
public AyaType AyaType { get => AyaType.WorkOrder; }
|
public AyaType AyaType { get => AyaType.WorkOrder; }
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace AyaNova.Util
|
|||||||
private const int DESIRED_SCHEMA_LEVEL = 15;
|
private const int DESIRED_SCHEMA_LEVEL = 15;
|
||||||
|
|
||||||
internal const long EXPECTED_COLUMN_COUNT = 620;
|
internal const long EXPECTED_COLUMN_COUNT = 620;
|
||||||
internal const long EXPECTED_INDEX_COUNT = 175;
|
internal const long EXPECTED_INDEX_COUNT = 174;
|
||||||
|
|
||||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
||||||
|
|
||||||
@@ -385,7 +385,7 @@ BEGIN
|
|||||||
when 56 then return 'LT:OpsNotificationSettings';
|
when 56 then return 'LT:OpsNotificationSettings';
|
||||||
when 57 then aytable = 'areport';
|
when 57 then aytable = 'areport';
|
||||||
when 58 then return 'LT:DashBoardView';
|
when 58 then return 'LT:DashBoardView';
|
||||||
when 59 then aytable = 'acustomernote';
|
when 59 then aytable = 'acustomernote'; aynamecolumn = 'notedate';
|
||||||
when 60 then aytable = 'amemo';
|
when 60 then aytable = 'amemo';
|
||||||
when 61 then aytable = 'areview';
|
when 61 then aytable = 'areview';
|
||||||
when 62 then aytable = 'aservicerate';
|
when 62 then aytable = 'aservicerate';
|
||||||
@@ -700,9 +700,9 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
|||||||
|
|
||||||
//PURCHASEORDER
|
//PURCHASEORDER
|
||||||
//Note don't forget to update name fetcher stored procedure when change this to serial from name
|
//Note don't forget to update name fetcher stored procedure when change this to serial from name
|
||||||
await ExecQueryAsync("CREATE TABLE apurchaseorder (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
|
await ExecQueryAsync("CREATE TABLE apurchaseorder (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, serial bigint generated by default as identity not null, active bool, " +
|
||||||
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
|
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
|
||||||
await ExecQueryAsync("CREATE UNIQUE INDEX apurchaseorder_name_id_idx ON apurchaseorder (id, name);");
|
await ExecQueryAsync("CREATE UNIQUE INDEX apurchaseorder_serial_id_idx ON apurchaseorder (id, serial);");
|
||||||
await ExecQueryAsync("CREATE INDEX apurchaseorder_tags ON apurchaseorder using GIN(tags)");
|
await ExecQueryAsync("CREATE INDEX apurchaseorder_tags ON apurchaseorder using GIN(tags)");
|
||||||
|
|
||||||
//VENDOR
|
//VENDOR
|
||||||
|
|||||||
Reference in New Issue
Block a user