This commit is contained in:
@@ -446,6 +446,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
await ct.SaveChangesAsync();
|
||||
var mapItem = new ImportAyaNova7MapItem(V7Id, AyaType.User, o.Id);
|
||||
importMap.Add(mapItem);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -462,77 +463,78 @@ namespace AyaNova.Biz
|
||||
break;
|
||||
case "GZTW.AyaNova.BLL.User-locale":
|
||||
{
|
||||
//get the userId
|
||||
var V7Id = new Guid(j["ID"].Value<string>());
|
||||
var MapItem = importMap.Where(m => m.V7ObjectId == V7Id).FirstOrDefault();
|
||||
if (MapItem == null)
|
||||
{
|
||||
throw new System.Exception("UserBiz::ImportV7Async-locale - FATAL ERROR, IMPORT FROM V7 CANNOT CONTINUE USER NOT FOUND IN IMPORTMAP");
|
||||
}
|
||||
var NewId = MapItem.NewObjectAyaTypeId.ObjectId;
|
||||
User u = ct.User.Where(m => m.Id == NewId).FirstOrDefault();
|
||||
if (u == null)
|
||||
{
|
||||
throw new System.Exception("UserBiz::ImportV7Async-locale - FATAL ERROR, IMPORT FROM V7 CANNOT CONTINUE USER NOT FOUND IN DATABASE");
|
||||
}
|
||||
|
||||
//handle locale entries for users now that we have the locales created
|
||||
var V7Locale = j["DefaultLanguage"].Value<string>();
|
||||
|
||||
//Get the RAVEN locale name and id instead
|
||||
//Get new locale name
|
||||
var NewLocaleName = string.Empty;
|
||||
switch (V7Locale)
|
||||
{
|
||||
case "Français":
|
||||
NewLocaleName = "fr";
|
||||
break;
|
||||
case "Español":
|
||||
NewLocaleName = "es";
|
||||
break;
|
||||
case "Deutsch":
|
||||
NewLocaleName = "de";
|
||||
break;
|
||||
case "English":
|
||||
NewLocaleName = "en";
|
||||
break;
|
||||
default:
|
||||
{
|
||||
//It's a custom locale, translate it from v7 original format to imported name format
|
||||
//make lower and replace spaces with dashes
|
||||
V7Locale = V7Locale.ToLowerInvariant().Replace(" ", "-");
|
||||
NewLocaleName = V7Locale.ToLowerInvariant().Replace(" ", "-");
|
||||
|
||||
//ensure each character is a valid path character
|
||||
foreach (char c in System.IO.Path.GetInvalidFileNameChars())
|
||||
foreach (char c in System.IO.Path.GetInvalidFileNameChars())//is this kosher on linux? Original code was windows
|
||||
{
|
||||
V7Locale = V7Locale.Replace(c, '_');
|
||||
NewLocaleName = NewLocaleName.Replace(c, '_');
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
// if (!LocaleExists("en"))
|
||||
// {
|
||||
// throw new System.Exception($"E1015: stock locale English (en) not found in database!");
|
||||
// }
|
||||
// if (!LocaleExists("es"))
|
||||
// {
|
||||
// throw new System.Exception($"E1015: stock locale Spanish (es) not found in database!");
|
||||
// }
|
||||
// if (!LocaleExists("de"))
|
||||
// {
|
||||
// throw new System.Exception($"E1015: stock locale German (de) not found in database!");
|
||||
// }
|
||||
// if (!LocaleExists("fr"))
|
||||
|
||||
u.LocaleId = LocaleBiz.LocaleNameToIdStatic(NewLocaleName, ct);
|
||||
|
||||
|
||||
//"Español",??
|
||||
//Find the matching ID number for this locale
|
||||
// LocaleBiz.LocaleExistsStatic
|
||||
|
||||
ct.SaveChanges();
|
||||
|
||||
}
|
||||
break;
|
||||
case "GZTW.AyaNova.BLL.User-scheduleableusergrouptags":
|
||||
{
|
||||
//handle tag entries for users now that we have the SUG tags created
|
||||
throw new System.NotImplementedException();
|
||||
// throw new System.NotImplementedException();
|
||||
}
|
||||
//break;
|
||||
break;
|
||||
case "GZTW.AyaNova.BLL.User-client":
|
||||
{
|
||||
//handle setting client id for user client login
|
||||
throw new System.NotImplementedException();
|
||||
//throw new System.NotImplementedException();
|
||||
}
|
||||
//break;
|
||||
break;
|
||||
case "GZTW.AyaNova.BLL.User-headoffice":
|
||||
{
|
||||
//handle setting ho id for user headoffice login
|
||||
throw new System.NotImplementedException();
|
||||
//throw new System.NotImplementedException();
|
||||
}
|
||||
//break;
|
||||
break;
|
||||
}
|
||||
|
||||
//just to hide compiler warning for now
|
||||
|
||||
@@ -8,11 +8,12 @@ namespace AyaNova.Models
|
||||
/// </summary>
|
||||
public partial class ImportAyaNova7MapItem
|
||||
{
|
||||
public AyaTypeId NewObject { get; set; }
|
||||
public AyaTypeId NewObjectAyaTypeId { get; set; }
|
||||
public Guid V7ObjectId { get; set; }
|
||||
|
||||
public ImportAyaNova7MapItem(Guid v7Guid, AyaType ayaType, long newId){
|
||||
NewObject=new AyaTypeId(ayaType,newId);
|
||||
public ImportAyaNova7MapItem(Guid v7Guid, AyaType ayaType, long newId)
|
||||
{
|
||||
NewObjectAyaTypeId = new AyaTypeId(ayaType, newId);
|
||||
V7ObjectId = v7Guid;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user