This commit is contained in:
@@ -192,6 +192,15 @@ namespace AyaNova.PlugIn.V8
|
||||
return Map[id];
|
||||
}
|
||||
|
||||
private enum RavenUserType : int
|
||||
{
|
||||
Service = 1,
|
||||
NotService = 2,
|
||||
Customer = 3,
|
||||
HeadOffice = 4,
|
||||
ServiceContractor = 5
|
||||
}
|
||||
|
||||
private Dictionary<Guid, string> TagMap = new Dictionary<Guid, string>();
|
||||
private Dictionary<string, long> LocaleMap = new Dictionary<string, long>();
|
||||
|
||||
@@ -727,7 +736,61 @@ namespace AyaNova.PlugIn.V8
|
||||
//contact created
|
||||
if (!string.IsNullOrWhiteSpace(c.Contact))
|
||||
{
|
||||
todo
|
||||
//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();
|
||||
|
||||
|
||||
|
||||
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 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;
|
||||
|
||||
|
||||
if (LocaleMap.ContainsKey(c.DefaultLanguage))
|
||||
d.translationId = LocaleMap[c.DefaultLanguage];
|
||||
else
|
||||
d.translationId = 1;
|
||||
|
||||
await util.PutAsync("user-option/" + RavenContactId.ToString(), d.ToString());
|
||||
|
||||
|
||||
|
||||
//----------------------------------
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user