This commit is contained in:
@@ -384,7 +384,8 @@ namespace AyaNova.PlugIn.V8
|
||||
await ExportScheduleMarkers(progress);
|
||||
|
||||
//must be after all clients, ho, units and workorders
|
||||
await ExportServiceBank(progress);
|
||||
//await ExportServiceBank(progress);//deprecated for v8 (so far)
|
||||
|
||||
await ExportClientServiceRequests(progress);
|
||||
|
||||
|
||||
@@ -2260,8 +2261,41 @@ namespace AyaNova.PlugIn.V8
|
||||
#endregion Memos
|
||||
|
||||
|
||||
//await (progress);//item and workorder both as split in v8
|
||||
//await ExportWorkOrderItemPriorities(progress);
|
||||
#region WorkOrderItemPriorities
|
||||
private async System.Threading.Tasks.Task ExportWorkOrderItemPriorities(ProgressForm progress)
|
||||
{
|
||||
if (!progress.KeepGoing) return;
|
||||
progress.Op("Start WorkOrderItem Priority export");
|
||||
progress.SubOp("");
|
||||
var ObjectTypeName = "WorkorderItem Priority";
|
||||
progress.Append("Exporting all "+ ObjectTypeName + " objects");
|
||||
List<string> tags = new List<string>();
|
||||
AddImportTag(tags);
|
||||
Priorities w = Priorities.GetItems();
|
||||
ResetUniqueNames();
|
||||
foreach (Priority s in w)
|
||||
{
|
||||
if (!progress.KeepGoing) return;
|
||||
dynamic d = new JObject();
|
||||
d.name = GetUniqueName(s.Name);
|
||||
progress.Op(ObjectTypeName + " " + d.name);
|
||||
d.active = s.Active;
|
||||
d.color = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(s.Color));
|
||||
SetTags(d, tags);
|
||||
var rMainObject = await util.PostAsync("work-order-item-priority", d.ToString());
|
||||
long RavenId = util.IdFromResponse(rMainObject);
|
||||
Addv7v8IdMap(s.ID, RavenId);
|
||||
await util.EventLog(util.AyaType.WorkOrderItemPriority, RavenId, SafeGetUserMap(s.Creator), SafeGetUserMap(s.Modifier), s.Created, s.Modified);
|
||||
}
|
||||
|
||||
|
||||
//------
|
||||
|
||||
|
||||
}
|
||||
#endregion workorder priorities
|
||||
|
||||
|
||||
#region WorkorderStatus
|
||||
private async System.Threading.Tasks.Task ExportWorkorderStatus(ProgressForm progress)
|
||||
{
|
||||
@@ -2752,85 +2786,85 @@ namespace AyaNova.PlugIn.V8
|
||||
#endregion ScheduleMarkers
|
||||
|
||||
#region ServiceBank
|
||||
private async System.Threading.Tasks.Task ExportServiceBank(ProgressForm progress)
|
||||
{
|
||||
if (BankedObjects.Count == 0) return;
|
||||
ResetUniqueNames();
|
||||
if (!progress.KeepGoing) return;
|
||||
progress.Op("Start Service Bank export");
|
||||
progress.SubOp("");
|
||||
var ObjectTypeName = "ServiceBank";
|
||||
progress.Append("Exporting service bank records for " + BankedObjects.Count.ToString() + " banked objects");
|
||||
foreach (var bo in BankedObjects)
|
||||
{
|
||||
ServiceBankListRI pl = ServiceBankListRI.GetList(bo.Key, -1);
|
||||
progress.Append("Exporting " + pl.Count.ToString() + " service bank records for object id " + bo.Key.ToString() + " type: " + bo.Value.ToString());
|
||||
//private async System.Threading.Tasks.Task ExportServiceBank(ProgressForm progress)
|
||||
//{
|
||||
// if (BankedObjects.Count == 0) return;
|
||||
// ResetUniqueNames();
|
||||
// if (!progress.KeepGoing) return;
|
||||
// progress.Op("Start Service Bank export");
|
||||
// progress.SubOp("");
|
||||
// var ObjectTypeName = "ServiceBank";
|
||||
// progress.Append("Exporting service bank records for " + BankedObjects.Count.ToString() + " banked objects");
|
||||
// foreach (var bo in BankedObjects)
|
||||
// {
|
||||
// ServiceBankListRI pl = ServiceBankListRI.GetList(bo.Key, -1);
|
||||
// progress.Append("Exporting " + pl.Count.ToString() + " service bank records for object id " + bo.Key.ToString() + " type: " + bo.Value.ToString());
|
||||
|
||||
//foreach (ServiceBankListRI.ServiceBankListRIInfo i in pl)
|
||||
//for (int x = 0; x < pl.Count; x++)
|
||||
//list is backwards order most recent first
|
||||
bool FirstEntry = true;
|
||||
for (int x = pl.Count - 1; x > -1; x--)
|
||||
{
|
||||
// //foreach (ServiceBankListRI.ServiceBankListRIInfo i in pl)
|
||||
// //for (int x = 0; x < pl.Count; x++)
|
||||
// //list is backwards order most recent first
|
||||
// bool FirstEntry = true;
|
||||
// for (int x = pl.Count - 1; x > -1; x--)
|
||||
// {
|
||||
|
||||
if (!progress.KeepGoing) return;
|
||||
ServiceBankListRI.ServiceBankListRIInfo i = pl[x];
|
||||
// if (!progress.KeepGoing) return;
|
||||
// ServiceBankListRI.ServiceBankListRIInfo i = pl[x];
|
||||
|
||||
dynamic d = new JObject();
|
||||
d.name = i.LT_ServiceBank_Label_Description;
|
||||
progress.Op(ObjectTypeName + " " + d.name);
|
||||
d.entryDate = util.DateToV8(i.LT_ServiceBank_Label_Created);
|
||||
//Guid empty is valid, particularly if it's an adjustment for a deleted workorder or something
|
||||
if (i.LT_ServiceBank_Label_SourceRootObjectType.Value == Guid.Empty)
|
||||
{
|
||||
d.sourceId = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!V7ToV8IdMap.ContainsKey(i.LT_ServiceBank_Label_SourceRootObjectType.Value))
|
||||
{
|
||||
d.name = i.LT_ServiceBank_Label_Description + " v7-import: source object missing object id " + i.LT_ServiceBank_Label_SourceRootObjectType.Value.ToString() + " type: " + i.LT_ServiceBank_Label_SourceRootObjectType.RootObjectType.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
d.sourceId = Getv7v8IdMap(i.LT_ServiceBank_Label_SourceRootObjectType.Value, "Service bank record's source object id");
|
||||
}
|
||||
}
|
||||
//
|
||||
d.sourceType = util.RootObjectToAyaType(i.LT_ServiceBank_Label_SourceRootObjectType.RootObjectType);
|
||||
// dynamic d = new JObject();
|
||||
// d.name = i.LT_ServiceBank_Label_Description;
|
||||
// progress.Op(ObjectTypeName + " " + d.name);
|
||||
// d.entryDate = util.DateToV8(i.LT_ServiceBank_Label_Created);
|
||||
// //Guid empty is valid, particularly if it's an adjustment for a deleted workorder or something
|
||||
// if (i.LT_ServiceBank_Label_SourceRootObjectType.Value == Guid.Empty)
|
||||
// {
|
||||
// d.sourceId = 0;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (!V7ToV8IdMap.ContainsKey(i.LT_ServiceBank_Label_SourceRootObjectType.Value))
|
||||
// {
|
||||
// d.name = i.LT_ServiceBank_Label_Description + " v7-import: source object missing object id " + i.LT_ServiceBank_Label_SourceRootObjectType.Value.ToString() + " type: " + i.LT_ServiceBank_Label_SourceRootObjectType.RootObjectType.ToString();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// d.sourceId = Getv7v8IdMap(i.LT_ServiceBank_Label_SourceRootObjectType.Value, "Service bank record's source object id");
|
||||
// }
|
||||
// }
|
||||
// //
|
||||
// d.sourceType = util.RootObjectToAyaType(i.LT_ServiceBank_Label_SourceRootObjectType.RootObjectType);
|
||||
|
||||
d.objectId = Getv7v8IdMap(bo.Key, "Service bank record's root object id");
|
||||
d.objectType = util.RootObjectToAyaType(bo.Value);
|
||||
d.incidents = i.LT_ServiceBank_Label_Incidents;
|
||||
d.incidentsBalance = i.LT_ServiceBank_Label_IncidentsBalance;
|
||||
d.currency = i.LT_ServiceBank_Label_Currency;
|
||||
d.currencyBalance = i.LT_ServiceBank_Label_CurrencyBalance;
|
||||
d.hours = i.LT_ServiceBank_Label_Hours;
|
||||
d.hoursBalance = i.LT_ServiceBank_Label_HoursBalance;
|
||||
//Last values
|
||||
if (!FirstEntry)
|
||||
{
|
||||
ServiceBankListRI.ServiceBankListRIInfo iLast = pl[x + 1];
|
||||
d.lastEntryDate = util.DateToV8(iLast.LT_ServiceBank_Label_Created);
|
||||
d.lastIncidentsBalance = iLast.LT_ServiceBank_Label_IncidentsBalance;
|
||||
d.lastCurrencyBalance = iLast.LT_ServiceBank_Label_CurrencyBalance;
|
||||
d.lastHoursBalance = iLast.LT_ServiceBank_Label_HoursBalance;
|
||||
}
|
||||
// d.objectId = Getv7v8IdMap(bo.Key, "Service bank record's root object id");
|
||||
// d.objectType = util.RootObjectToAyaType(bo.Value);
|
||||
// d.incidents = i.LT_ServiceBank_Label_Incidents;
|
||||
// d.incidentsBalance = i.LT_ServiceBank_Label_IncidentsBalance;
|
||||
// d.currency = i.LT_ServiceBank_Label_Currency;
|
||||
// d.currencyBalance = i.LT_ServiceBank_Label_CurrencyBalance;
|
||||
// d.hours = i.LT_ServiceBank_Label_Hours;
|
||||
// d.hoursBalance = i.LT_ServiceBank_Label_HoursBalance;
|
||||
// //Last values
|
||||
// if (!FirstEntry)
|
||||
// {
|
||||
// ServiceBankListRI.ServiceBankListRIInfo iLast = pl[x + 1];
|
||||
// d.lastEntryDate = util.DateToV8(iLast.LT_ServiceBank_Label_Created);
|
||||
// d.lastIncidentsBalance = iLast.LT_ServiceBank_Label_IncidentsBalance;
|
||||
// d.lastCurrencyBalance = iLast.LT_ServiceBank_Label_CurrencyBalance;
|
||||
// d.lastHoursBalance = iLast.LT_ServiceBank_Label_HoursBalance;
|
||||
// }
|
||||
|
||||
var rMainObject = await util.PostAsync("service-bank/migrate", d.ToString());
|
||||
long RavenId = util.IdFromResponse(rMainObject);
|
||||
// Addv7v8IdMap(i.ID, RavenId);
|
||||
// var rMainObject = await util.PostAsync("service-bank/migrate", d.ToString());
|
||||
// long RavenId = util.IdFromResponse(rMainObject);
|
||||
// // Addv7v8IdMap(i.ID, RavenId);
|
||||
|
||||
|
||||
//-----
|
||||
// //-----
|
||||
|
||||
//Event log fixup
|
||||
ServiceBank sb = ServiceBank.GetItem(i.LT_ServiceBank_Label_ID);
|
||||
await util.EventLog(util.AyaType.ServiceBank, RavenId, SafeGetUserMap(sb.Creator), SafeGetUserMap(sb.Creator), sb.Created, sb.Created);
|
||||
FirstEntry = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// //Event log fixup
|
||||
// ServiceBank sb = ServiceBank.GetItem(i.LT_ServiceBank_Label_ID);
|
||||
// await util.EventLog(util.AyaType.ServiceBank, RavenId, SafeGetUserMap(sb.Creator), SafeGetUserMap(sb.Creator), sb.Created, sb.Created);
|
||||
// FirstEntry = false;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
#endregion ServiceBank
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user