This commit is contained in:
@@ -18,7 +18,7 @@ namespace AyaNova.Biz
|
||||
|
||||
internal class UserBiz : BizObject, IJobObject, IImportAyaNova7Object
|
||||
{
|
||||
|
||||
|
||||
public bool SeedOrImportRelaxedRulesMode { get; set; }
|
||||
|
||||
internal UserBiz(AyContext dbcontext, long currentUserId, long userLocaleId, AuthorizationRoles userRoles)
|
||||
@@ -61,6 +61,7 @@ namespace AyaNova.Biz
|
||||
//do stuff with User
|
||||
User outObj = inObj;
|
||||
outObj.OwnerId = UserId;
|
||||
outObj.Tags = TagUtil.NormalizeTags(outObj.Tags);
|
||||
//Seeder sets user options in advance so no need to create them here in that case
|
||||
if (outObj.UserOptions == null)
|
||||
outObj.UserOptions = new UserOptions(UserId);
|
||||
@@ -73,9 +74,12 @@ namespace AyaNova.Biz
|
||||
|
||||
//Log event
|
||||
EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
|
||||
|
||||
|
||||
//SEARCH INDEXING
|
||||
Search.ProcessNewObjectKeywords( UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.EmployeeNumber, outObj.Notes, outObj.Name);
|
||||
//Search.ProcessNewObjectKeywords( UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.EmployeeNumber, outObj.Notes, outObj.Name);
|
||||
var SearchParams = new Search.SearchIndexProcessObjectParameters(UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.Tags);
|
||||
SearchParams.AddWord(outObj.Notes).AddWord(outObj.Name).AddWord(outObj.EmployeeNumber);
|
||||
Search.ProcessNewObjectKeywords(SearchParams);
|
||||
|
||||
return outObj;
|
||||
|
||||
@@ -98,6 +102,7 @@ namespace AyaNova.Biz
|
||||
//do stuff with User
|
||||
User outObj = inObj;
|
||||
outObj.OwnerId = UserId;
|
||||
outObj.Tags = TagUtil.NormalizeTags(outObj.Tags);
|
||||
//Seeder sets user options in advance so no need to create them here in that case
|
||||
if (outObj.UserOptions == null)
|
||||
outObj.UserOptions = new UserOptions(UserId);
|
||||
@@ -110,9 +115,12 @@ namespace AyaNova.Biz
|
||||
|
||||
//Log event
|
||||
EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), TempContext);
|
||||
|
||||
|
||||
//SEARCH INDEXING
|
||||
Search.ProcessNewObjectKeywords(UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.EmployeeNumber, outObj.Notes, outObj.Name);
|
||||
// Search.ProcessNewObjectKeywords(UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.EmployeeNumber, outObj.Notes, outObj.Name);
|
||||
var SearchParams = new Search.SearchIndexProcessObjectParameters(UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.Tags);
|
||||
SearchParams.AddWord(outObj.Notes).AddWord(outObj.Name).AddWord(outObj.EmployeeNumber);
|
||||
Search.ProcessNewObjectKeywords(SearchParams);
|
||||
|
||||
return outObj;
|
||||
|
||||
@@ -130,7 +138,7 @@ namespace AyaNova.Biz
|
||||
if (ret != null)
|
||||
{
|
||||
//Log
|
||||
EventLogProcessor.LogEventToDatabase(new Event(UserId, fetchId, BizType, AyaEvent.Retrieved), ct);
|
||||
EventLogProcessor.LogEventToDatabase(new Event(UserId, fetchId, BizType, AyaEvent.Retrieved), ct);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -220,16 +228,17 @@ namespace AyaNova.Biz
|
||||
//put
|
||||
internal bool Put(User dbObj, User inObj)
|
||||
{
|
||||
//preserve the owner ID if none was specified
|
||||
//preserve the owner ID if none was specified
|
||||
if (inObj.OwnerId == 0)
|
||||
inObj.OwnerId = dbObj.OwnerId;
|
||||
|
||||
|
||||
//Get a snapshot of the original db value object before changes
|
||||
User SnapshotObj = new User();
|
||||
CopyObject.Copy(dbObj, SnapshotObj);
|
||||
|
||||
//Update the db object with the PUT object values
|
||||
CopyObject.Copy(inObj, dbObj, "Id, Salt");
|
||||
dbObj.Tags = TagUtil.NormalizeTags(dbObj.Tags);
|
||||
|
||||
//Is the user updating the password?
|
||||
if (!string.IsNullOrWhiteSpace(inObj.Password) && SnapshotObj.Password != inObj.Password)
|
||||
@@ -255,9 +264,12 @@ namespace AyaNova.Biz
|
||||
|
||||
|
||||
//Log modification
|
||||
EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
|
||||
EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
|
||||
//Update keywords
|
||||
Search.ProcessUpdatedObjectKeywords( UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.EmployeeNumber, dbObj.Notes, dbObj.Name);
|
||||
// Search.ProcessUpdatedObjectKeywords(UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.EmployeeNumber, dbObj.Notes, dbObj.Name);
|
||||
var SearchParams = new Search.SearchIndexProcessObjectParameters(UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.Tags);
|
||||
SearchParams.AddWord(dbObj.Notes).AddWord(dbObj.Name).AddWord(dbObj.EmployeeNumber);
|
||||
Search.ProcessNewObjectKeywords(SearchParams);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -274,6 +286,7 @@ namespace AyaNova.Biz
|
||||
|
||||
//Do the patching
|
||||
objectPatch.ApplyTo(dbObj);
|
||||
dbObj.Tags = TagUtil.NormalizeTags(dbObj.Tags);
|
||||
|
||||
//Is the user patching the password?
|
||||
if (!string.IsNullOrWhiteSpace(dbObj.Password) && dbObj.Password != snapshotObj.Password)
|
||||
@@ -289,9 +302,12 @@ namespace AyaNova.Biz
|
||||
|
||||
//Log modification
|
||||
EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
|
||||
|
||||
|
||||
//Update keywords
|
||||
Search.ProcessUpdatedObjectKeywords( UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.EmployeeNumber, dbObj.Notes, dbObj.Name);
|
||||
// Search.ProcessUpdatedObjectKeywords(UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.EmployeeNumber, dbObj.Notes, dbObj.Name);
|
||||
var SearchParams = new Search.SearchIndexProcessObjectParameters(UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.Tags);
|
||||
SearchParams.AddWord(dbObj.Notes).AddWord(dbObj.Name).AddWord(dbObj.EmployeeNumber);
|
||||
Search.ProcessNewObjectKeywords(SearchParams);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user