This commit is contained in:
2018-10-11 17:14:15 +00:00
parent 7e366f7718
commit 2bd5831a38
9 changed files with 46 additions and 35 deletions

View File

@@ -375,20 +375,21 @@ namespace AyaNova.Biz
#region ProcessKeywords into Database
public static void ProcessNewObjectKeywords(AyContext ct, long localeId, long objectID, AyaType objectType, string name, params string[] text)
public static void ProcessNewObjectKeywords(long localeId, long objectID, AyaType objectType, string name, params string[] text)
{
ProcessKeywords(ct, localeId, objectID, objectType, true, name, text);
ProcessKeywords(localeId, objectID, objectType, true, name, text);
}
public static void ProcessUpdatedObjectKeywords(AyContext ct, long localeId, long objectID, AyaType objectType, string name, params string[] text)
public static void ProcessUpdatedObjectKeywords(long localeId, long objectID, AyaType objectType, string name, params string[] text)
{
ProcessKeywords(ct, localeId, objectID, objectType, false, name, text);
ProcessKeywords(localeId, objectID, objectType, false, name, text);
}
public static void ProcessDeletedObjectKeywords(AyContext ct, long objectID, AyaType objectType)
public static void ProcessDeletedObjectKeywords(long objectID, AyaType objectType)
{
//Be careful in future, if you put ToString at the end of each object in the string interpolation
//npgsql driver will assume it's a string and put quotes around it triggering an error that a string can't be compared to an int
AyContext ct = ServiceProviderProvider.DBContext;
ct.Database.ExecuteSqlCommand($"delete from asearchkey where objectid={objectID} and objecttype={(int)objectType}");
}
@@ -397,9 +398,10 @@ namespace AyaNova.Biz
/// Process the keywords into the dictionary
/// NOTE: NAME parameter is in ADDITION to the NAME also being on of the strings passed in text parameter
/// </summary>
private static void ProcessKeywords(AyContext ct, long localeId, long objectID, AyaType objectType, bool newRecord, string name, params string[] text)
private static void ProcessKeywords(long localeId, long objectID, AyaType objectType, bool newRecord, string name, params string[] text)
{
AyContext ct = ServiceProviderProvider.DBContext;
#if (DEBUG)
if (objectType == AyaType.TagMap || objectType == AyaType.JobOperations || objectType == AyaType.Locale)
{
@@ -411,7 +413,7 @@ namespace AyaNova.Biz
//IF NOT NEW, DELETE ALL EXISTING ENTRIES FOR OBJECT TYPE AND ID
if (!newRecord)
{
ProcessDeletedObjectKeywords(ct, objectID, objectType);
ProcessDeletedObjectKeywords(objectID, objectType);
}
//BREAK STRING ARRAY INTO KEYWORD LIST