From 1c361fa66ded3ce9cb390a2417ef852046fad1ae Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 25 Nov 2020 21:44:14 +0000 Subject: [PATCH] --- source/Plugins/AyaNova.Plugin.V8/V8.cs | 61 ++++++++++---------------- 1 file changed, 22 insertions(+), 39 deletions(-) diff --git a/source/Plugins/AyaNova.Plugin.V8/V8.cs b/source/Plugins/AyaNova.Plugin.V8/V8.cs index 66f67d2..e20f407 100644 --- a/source/Plugins/AyaNova.Plugin.V8/V8.cs +++ b/source/Plugins/AyaNova.Plugin.V8/V8.cs @@ -739,54 +739,37 @@ namespace AyaNova.PlugIn.V8 //create user here //-------------------------------- - d = new JObject(); - d.name = GetUniqueName(c.Contact); - - progress.Op("Contact " + d.name); - d.userType=RavenUserType.Customer; - d.customerId=RavenId; - d.active = false;//all imported users are inactive to start - d.roles = 0;//todo: try to determine role from v7 member of group? or is that even possible? - d.login = util.RandomString(); - d.password = util.RandomString(); + d = new JObject(); + d.name = GetUniqueName(c.Contact); - + progress.Op("Contact " + d.name); + d.userType = RavenUserType.Customer; + d.customerId = RavenId; + d.active = false;//all imported users are inactive to start + d.roles = 0;//todo: try to determine role from v7 member of group? or is that even possible? + d.login = util.RandomString(); + d.password = util.RandomString(); - var rMainObject = await util.PostAsync("user", d.ToString()); - long RavenContactId = util.IdFromResponse(rMainObject); - - //USER OPTIONS - /* - [Required] - public long TranslationId { get; set; } - //------------- - //[EmailAddress] - public string EmailAddress { get; set; } - // [Phone] - public string Phone1 { get; set; } - //[Phone] - public string Phone2 { get; set; } - //in v7 this was pager address so not attributing it with Phone as not sure what would be in that field - public string Phone3 { get; set; } - */ + var rContact = await util.PostAsync("user", d.ToString()); + long RavenContactId = util.IdFromResponse(rContact); + + + //USER OPTIONS var rOptions = await util.GetAsync("user-option/" + RavenContactId.ToString()); d = rOptions.ObjectResponse["data"]; - d.phone1 = c.Phone1; - d.phone2 = c.Phone2; - d.phone3 = c.Phone3; - - d.emailAddress = c.Email; + d.phone1 = c.Phone1; + d.phone2 = c.Phone2; + d.phone3 = c.Phone3; - - if (LocaleMap.ContainsKey(c.DefaultLanguage)) - d.translationId = LocaleMap[c.DefaultLanguage]; - else - d.translationId = 1; + d.emailAddress = c.Email; + + + // d.translationId = 1; await util.PutAsync("user-option/" + RavenContactId.ToString(), d.ToString()); - + //----------------------------------