This commit is contained in:
2020-12-15 20:46:06 +00:00
parent 02bf076a19
commit a118282fbb
7 changed files with 372 additions and 283 deletions

View File

@@ -41,6 +41,7 @@
this.btnTest = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.lblPreRelease = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
@@ -167,6 +168,16 @@
this.lblPreRelease.Text = "Pre-release 7.6-Alpha";
this.lblPreRelease.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(28, 278);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(181, 16);
this.label3.TabIndex = 38;
this.label3.Text = "AyaNova 8 SuperUser login:";
//
// Auth
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -174,6 +185,7 @@
this.AutoSize = true;
this.ClientSize = new System.Drawing.Size(614, 545);
this.ControlBox = false;
this.Controls.Add(this.label3);
this.Controls.Add(this.lblPreRelease);
this.Controls.Add(this.label2);
this.Controls.Add(this.btnTest);
@@ -213,5 +225,6 @@
private System.Windows.Forms.Button btnTest;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label lblPreRelease;
private System.Windows.Forms.Label label3;
}
}

View File

@@ -42,7 +42,7 @@ namespace AyaNova.PlugIn.V8
var res = await util.AuthenticateAsync(edUserName.Text,edPassword.Text);
if (!res)
{
MessageBox.Show("Login failed");
MessageBox.Show("AyaNova 8 SuperUser account login failed");
return;
}

View File

@@ -35,7 +35,7 @@ namespace AyaNova.PlugIn.V8
public string PluginVersion
{
get { return "7.6.1-alpha.95"; }
get { return "7.6.1-alpha.96"; }
}
public string About
@@ -317,6 +317,8 @@ namespace AyaNova.PlugIn.V8
await ExportUnitModels(progress);
await ExportVendors(progress);
await ExportExternalUsers(progress);//needs vendors, clients and headoffices already exported so needs to be here late
await ExportMemos(progress);
await ExportServiceWorkorders(progress);
//todo: these are now invalid and awaiting RAVEN end implementation
//after which can copy mostly from service workorder block
@@ -1849,6 +1851,58 @@ namespace AyaNova.PlugIn.V8
}
#endregion Vendors
#region Memos
private async System.Threading.Tasks.Task ExportMemos(ProgressForm progress)
{
if (!progress.KeepGoing) return;
progress.Op("Start Memos export");
progress.SubOp("");
var ObjectTypeName = "Memo";
//Step 2: export the objects
MemoList pl = MemoList.GetListForSingleItem(PluginID);
progress.Append("Exporting " + pl.Count.ToString() + " " + ObjectTypeName + "s");
foreach (MemoList.MemoListInfo i in pl)
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
dynamic d = new JObject();
d.name = i.LT_Memo_Label_Subject.Display;
d.notes = i.LT_Memo_Label_Message;
//d.customFields = "{}";
//d.tags = "[]";
d.viewed = i.LT_Memo_Label_Viewed;
d.replied = i.LT_Memo_Label_Replied;
d.fromId = SafeGetUserMap(i.LT_Memo_Label_FromID.Value);
d.sent = i.LT_Memo_Label_Sent;
progress.Op(ObjectTypeName + " " + i.ID.ToString());
var rMainObject = await util.PostAsync("memo", d.ToString());
long RavenId = util.IdFromResponse(rMainObject);
//-----
d = rMainObject.ObjectResponse["data"];
//-----
//Event log fixup
await util.EventLog(util.AyaType.Project, RavenId, SafeGetUserMap(i.LT_Memo_Label_FromID.Value), SafeGetUserMap(i.LT_Memo_Label_FromID.Value), i.LT_Memo_Label_Sent.ToString(), i.LT_Memo_Label_Sent.ToString());
}
}
#endregion Memos
#region Service Workorders
private async System.Threading.Tasks.Task ExportServiceWorkorders(ProgressForm progress)
{

View File

@@ -110,7 +110,16 @@ namespace AyaNova.PlugIn.V8
if (a.HttpResponse.IsSuccessStatusCode)
{
JWT = a.ObjectResponse["data"]["token"].Value<string>();
JWT=a.ObjectResponse["data"]["token"].Value<string>();
//Must be *the* SuperUser to continue:
a = await GetAsync("user/amsu");
var IsSuperUser = a.ObjectResponse["data"].Value<bool>();
if (!IsSuperUser) {
JWT = string.Empty;
return false;
}
return true;
}