Posted on 03/09/2018 13:28:47
My code goes below:
User groupAdminUser = new User();
groupAdminUser = User.GetUserByUserName("admin" + custNo);
groupAdminUser.Company = userGroup.CompanyName.Trim();
groupAdminUser.Name = userGroup.CompanyName.Trim();
groupAdminUser.CustomerNumber = userGroup.CustomerNumber;
groupAdminUser.Address = userGroup.Address;
groupAdminUser.Zip = userGroup.ZipCode;
groupAdminUser.City = userGroup.City;
groupAdminUser.Country = userGroup.Country;
groupAdminUser.Phone = userGroup.Telephone;
groupAdminUser.Email = custMail;
groupAdminUser.VatRegNumber = custVAT;
groupAdminUser.UserName = "admin" + custNo;
groupAdminUser.CustomFieldValues.First(x => x.CustomField.SystemName == "AccessUser_EnvironmentCode").Value = custEnvCode;
groupAdminUser.CustomFieldValues.First(x => x.CustomField.SystemName == "AccessUser_FreightAmount").Value = custFreightAmount;
groupAdminUser.CustomFieldValues.First(x => x.CustomField.SystemName == "AccessUser_FreightLimit").Value = custFreightLimit;
groupAdminUser.IsGeolocationCustom = true;
groupAdminUser.AddToGroup(custGroupID);
groupAdminUser.Save();
I just experienced a "thread aborted" or timeout, when I did this previously.
/Kurt