This commit is contained in:
@@ -73,7 +73,7 @@ namespace AyaNova.Biz
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
PartAssembly newObject = new PartAssembly();
|
PartAssembly newObject = new PartAssembly();
|
||||||
CopyObject.Copy(dbObject, newObject, "Wiki");
|
CopyObject.Copy(dbObject, newObject, "Wiki,Id");
|
||||||
string newUniqueName = string.Empty;
|
string newUniqueName = string.Empty;
|
||||||
bool NotUnique = true;
|
bool NotUnique = true;
|
||||||
long l = 1;
|
long l = 1;
|
||||||
@@ -85,6 +85,11 @@ namespace AyaNova.Biz
|
|||||||
newObject.Name = newUniqueName;
|
newObject.Name = newUniqueName;
|
||||||
newObject.Id = 0;
|
newObject.Id = 0;
|
||||||
newObject.Concurrency = 0;
|
newObject.Concurrency = 0;
|
||||||
|
foreach (PartAssemblyItem pai in newObject.Items)
|
||||||
|
{
|
||||||
|
pai.Id = 0;
|
||||||
|
pai.Concurrency = 0;
|
||||||
|
}
|
||||||
await ct.PartAssembly.AddAsync(newObject);
|
await ct.PartAssembly.AddAsync(newObject);
|
||||||
await ct.SaveChangesAsync();
|
await ct.SaveChangesAsync();
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
@@ -106,7 +111,7 @@ namespace AyaNova.Biz
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//UPDATE
|
//UPDATE
|
||||||
//
|
//
|
||||||
@@ -152,7 +157,7 @@ namespace AyaNova.Biz
|
|||||||
using (var transaction = await ct.Database.BeginTransactionAsync())
|
using (var transaction = await ct.Database.BeginTransactionAsync())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PartAssembly dbObject = await GetAsync(id, false);
|
PartAssembly dbObject = await GetAsync(id, false);
|
||||||
if (dbObject == null)
|
if (dbObject == null)
|
||||||
{
|
{
|
||||||
@@ -283,7 +288,7 @@ namespace AyaNova.Biz
|
|||||||
var batch = idList.Take(IReportAbleObject.REPORT_DATA_BATCH_SIZE);
|
var batch = idList.Take(IReportAbleObject.REPORT_DATA_BATCH_SIZE);
|
||||||
idList = idList.Skip(IReportAbleObject.REPORT_DATA_BATCH_SIZE).ToArray();
|
idList = idList.Skip(IReportAbleObject.REPORT_DATA_BATCH_SIZE).ToArray();
|
||||||
//query for this batch, comes back in db natural order unfortunately
|
//query for this batch, comes back in db natural order unfortunately
|
||||||
var batchResults = await ct.PartAssembly.AsNoTracking().Include(z=>z.Items).Where(z => batch.Contains(z.Id)).ToArrayAsync();
|
var batchResults = await ct.PartAssembly.AsNoTracking().Include(z => z.Items).Where(z => batch.Contains(z.Id)).ToArrayAsync();
|
||||||
//order the results back into original
|
//order the results back into original
|
||||||
var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
|
var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
|
||||||
foreach (PartAssembly w in orderedList)
|
foreach (PartAssembly w in orderedList)
|
||||||
|
|||||||
Reference in New Issue
Block a user