This commit is contained in:
2020-12-29 00:05:34 +00:00
parent 079d832db0
commit 0eb6c4206d
2 changed files with 185 additions and 126 deletions

View File

@@ -328,6 +328,8 @@ namespace AyaNova.PlugIn.V8
//Must be after all root objects due to followups
await ExportScheduleMarkers(progress);
await ExportRates(progress);
//NOTE: when get to PRIORITY, or WORKORDER STATUS be sure to add color code as per already done in USER export
if (progress.KeepGoing)
@@ -1823,6 +1825,61 @@ namespace AyaNova.PlugIn.V8
}
#endregion Vendors
#region Rates
private async System.Threading.Tasks.Task ExportRates(ProgressForm progress)
{
ResetUniqueNames();
if (!progress.KeepGoing) return;
progress.Op("Start Rates export");
progress.SubOp("");
var ObjectTypeName = "Rate";
//Step 2: export the objects
Rates pl = Rates.GetItems(false);
progress.Append("Exporting " + pl.Count.ToString() + " " + ObjectTypeName + "s");
foreach (Rate i in pl)
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
dynamic d = new JObject();
d.name = GetUniqueName(i.Name);
if (IsDuplicateMapItem(i.ID, i.Name, progress)) continue;
progress.Op(ObjectTypeName + " " + d.name);
d.active = i.Active;
d.notes = i.Description;
d.accountNumber = i.AccountNumber;
Tagit(i.RegionID, tags);
Tagit(i.ClientGroupID, tags);
SetTags(d, tags);
string route = "service-rate";
util.AyaType ravenType = util.AyaType.ServiceRate;
if (i.RateType == RateTypes.Travel)
{
route = "travel-rate";
ravenType = util.AyaType.TravelRate;
}
var rMainObject = await util.PostAsync(route, d.ToString());
long RavenId = util.IdFromResponse(rMainObject);
AddMap(i.ID, RavenId);
//-----
//Event log fixup
await util.EventLog(ravenType, RavenId, SafeGetUserMap(i.Creator), SafeGetUserMap(i.Modifier), i.Created, i.Modified);
}
}
#endregion Rates
#region Memos
private async System.Threading.Tasks.Task ExportMemos(ProgressForm progress)
{

View File

@@ -376,9 +376,9 @@ namespace AyaNova.PlugIn.V8
public static bool DateIsPast(object o, bool neverEmpty = false) { return DateIsPast(o.ToString(), neverEmpty); }
public static bool DateIsPast(string s, bool neverEmpty = false)
{
if (string.IsNullOrWhiteSpace(s))
if (string.IsNullOrWhiteSpace(s))
return false;//no date so not past
DateTime result = new DateTime();
if (DateTime.TryParse(s, out result))
@@ -456,138 +456,140 @@ namespace AyaNova.PlugIn.V8
}
}
public enum AyaType : int
{
//COREBIZOBJECT attribute must be set on objects that are:
//Attachable objects can have attachments,
//wikiable objects can have a wiki
//reviewable objects can have a review which is basically the same as a Reminder but with an object attached (was follow up schedmarker in v7)
//PIckList-able (has picklist template)
//Pretty much everything that represents some kind of real world object is wikiable or attachable as long as it has an ID and a type
//exceptions would be utility type objects like datalistview, formcustom etc that are not
public enum AyaType : int
{
//COREBIZOBJECT attribute must be set on objects that are:
//Attachable objects can have attachments,
//wikiable objects can have a wiki
//reviewable objects can have a review which is basically the same as a Reminder but with an object attached (was follow up schedmarker in v7)
//PIckList-able (has picklist template)
//Pretty much everything that represents some kind of real world object is wikiable or attachable as long as it has an ID and a type
//exceptions would be utility type objects like datalistview, formcustom etc that are not
//NOTE: NEW CORE OBJECTS - All areas of server AND CLIENT code that require adding any new core objects have been tagged with the following comment:
//CoreBizObject add here
//Search for that IN SERVER AND CLIENT CODE and you will see all areas that need coding for the new object
//NOTE: NEW CORE OBJECTS - All areas of server AND CLIENT code that require adding any new core objects have been tagged with the following comment:
//CoreBizObject add here
//Search for that IN SERVER AND CLIENT CODE and you will see all areas that need coding for the new object
//***IMPORTANT: Also need to add translations for any new biz objects added that don't match exactly the name here in the key
//because enumlist gets it that way, i.e. "Global" would be the expected key
//***IMPORTANT: Also need to add translations for any new biz objects added that don't match exactly the name here in the key
//because enumlist gets it that way, i.e. "Global" would be the expected key
NoType = 0,
Global = 1,
//corebizobject
Widget = 2,
//corebizobject
User = 3,
ServerState = 4,
License = 5,
LogFile = 6,
PickListTemplate = 7,
//corebizobject
Customer = 8,
ServerJob = 9,
//corebizobject
Contract = 10,
TrialSeeder = 11,
ServerMetrics = 12,
Translation = 13,
UserOptions = 14,
//corebizobject
HeadOffice = 15,
//corebizobject
LoanUnit = 16,
FileAttachment = 17,
DataListView = 18,
FormCustom = 19,
//corebizobject
Part = 20,
//corebizobject
PM = 21,
//corebizobject
PMItem = 22,
//corebizobject
PMTemplate = 23,
//corebizobject
PMTemplateItem = 24,
//corebizobject
Project = 25,
//corebizobject
PurchaseOrder = 26,
//corebizobject
Quote = 27,
//corebizobject
QuoteItem = 28,
//corebizobject
QuoteTemplate = 29,
//corebizobject
QuoteTemplateItem = 30,
//corebizobject
Unit = 31,
//corebizobject
UnitModel = 32,
//corebizobject
Vendor = 33,
//--- WorkOrder
//corebizobject
WorkOrder = 34,
//corebizobject
WorkOrderItem = 35,
//corebizobject
WorkOrderItemExpense = 36,
//corebizobject
WorkOrderItemLabor = 37,
//corebizobject
WorkOrderItemLoan = 38,
//corebizobject
WorkOrderItemPart = 39,
//corebizobject
WorkOrderItemPartRequest = 40,
//corebizobject
WorkOrderItemScheduledUser = 41,
//corebizobject
WorkOrderItemTask = 42,
//corebizobject
WorkOrderItemTravel = 43,
//corebizobject
WorkOrderItemUnit = 44,
//---
//corebizobject
WorkOrderTemplate = 45,
//corebizobject
WorkOrderTemplateItem = 46,
GlobalOps = 47,//really only used for rights, not an object type of any kind
BizMetrics = 48,//deprecate? Not used for anything as of nov 2020
Backup = 49,
Notification = 50,
NotifySubscription = 51,
//corebizobject
Reminder = 52,
UnitMeterReading = 53,
CustomerServiceRequest = 54,
ServiceBank = 55,
OpsNotificationSettings = 56,
Report = 57,
DashboardView = 58,
//corebizobject
CustomerNote = 59,
//corebizobject
Memo = 60,
//corebizobject
Review = 61
NoType = 0,
Global = 1,
//corebizobject
Widget = 2,
//corebizobject
User = 3,
ServerState = 4,
License = 5,
LogFile = 6,
PickListTemplate = 7,
//corebizobject
Customer = 8,
ServerJob = 9,
//corebizobject
Contract = 10,
TrialSeeder = 11,
ServerMetrics = 12,
Translation = 13,
UserOptions = 14,
//corebizobject
HeadOffice = 15,
//corebizobject
LoanUnit = 16,
FileAttachment = 17,
DataListView = 18,
FormCustom = 19,
//corebizobject
Part = 20,
//corebizobject
PM = 21,
//corebizobject
PMItem = 22,
//corebizobject
PMTemplate = 23,
//corebizobject
PMTemplateItem = 24,
//corebizobject
Project = 25,
//corebizobject
PurchaseOrder = 26,
//corebizobject
Quote = 27,
//corebizobject
QuoteItem = 28,
//corebizobject
QuoteTemplate = 29,
//corebizobject
QuoteTemplateItem = 30,
//corebizobject
Unit = 31,
//corebizobject
UnitModel = 32,
//corebizobject
Vendor = 33,
//--- WorkOrder
//corebizobject
WorkOrder = 34,
//corebizobject
WorkOrderItem = 35,
//corebizobject
WorkOrderItemExpense = 36,
//corebizobject
WorkOrderItemLabor = 37,
//corebizobject
WorkOrderItemLoan = 38,
//corebizobject
WorkOrderItemPart = 39,
//corebizobject
WorkOrderItemPartRequest = 40,
//corebizobject
WorkOrderItemScheduledUser = 41,
//corebizobject
WorkOrderItemTask = 42,
//corebizobject
WorkOrderItemTravel = 43,
//corebizobject
WorkOrderItemUnit = 44,
//---
//corebizobject
WorkOrderTemplate = 45,
//corebizobject
WorkOrderTemplateItem = 46,
GlobalOps = 47,//really only used for rights, not an object type of any kind
BizMetrics = 48,//deprecate? Not used for anything as of nov 2020
Backup = 49,
Notification = 50,
NotifySubscription = 51,
//corebizobject
Reminder = 52,
UnitMeterReading = 53,
CustomerServiceRequest = 54,
ServiceBank = 55,
OpsNotificationSettings = 56,
Report = 57,
DashboardView = 58,
//corebizobject
CustomerNote = 59,
//corebizobject
Memo = 60,
//corebizobject
Review = 61,
ServiceRate = 62,
TravelRate = 63
//NOTE: New objects added here need to also be added to the following classes:
//AyaNova.Biz.BizObjectExistsInDatabase
//AyaNova.Biz.BizObjectFactory
//AyaNova.Biz.BizRoles
//AyaNova.Biz.BizObjectNameFetcherDIRECT
//and in the CLIENT in ayatype.js
//and their model needs to have the ICoreBizObjectModel interface
//NOTE: New objects added here need to also be added to the following classes:
//AyaNova.Biz.BizObjectExistsInDatabase
//AyaNova.Biz.BizObjectFactory
//AyaNova.Biz.BizRoles
//AyaNova.Biz.BizObjectNameFetcherDIRECT
//and in the CLIENT in ayatype.js
//and their model needs to have the ICoreBizObjectModel interface
//and need TRANSLATION KEYS because any type could show in the event log at the client end
//and need TRANSLATION KEYS because any type could show in the event log at the client end
}
}