This commit is contained in:
2018-08-30 22:59:41 +00:00
parent 1d2ba080c9
commit 1222fe9c2c
2 changed files with 37 additions and 34 deletions

View File

@@ -446,6 +446,7 @@ namespace AyaNova.Biz
{ {
await ct.SaveChangesAsync(); await ct.SaveChangesAsync();
var mapItem = new ImportAyaNova7MapItem(V7Id, AyaType.User, o.Id); var mapItem = new ImportAyaNova7MapItem(V7Id, AyaType.User, o.Id);
importMap.Add(mapItem);
} }
} }
@@ -462,77 +463,78 @@ namespace AyaNova.Biz
break; break;
case "GZTW.AyaNova.BLL.User-locale": 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 //handle locale entries for users now that we have the locales created
var V7Locale = j["DefaultLanguage"].Value<string>(); var V7Locale = j["DefaultLanguage"].Value<string>();
//Get the RAVEN locale name and id instead //Get new locale name
var NewLocaleName = string.Empty;
switch (V7Locale) switch (V7Locale)
{ {
case "Français": case "Français":
NewLocaleName = "fr";
break; break;
case "Español": case "Español":
NewLocaleName = "es";
break; break;
case "Deutsch": case "Deutsch":
NewLocaleName = "de";
break; break;
case "English": case "English":
NewLocaleName = "en";
break; break;
default: default:
{ {
//It's a custom locale, translate it from v7 original format to imported name format //It's a custom locale, translate it from v7 original format to imported name format
//make lower and replace spaces with dashes //make lower and replace spaces with dashes
V7Locale = V7Locale.ToLowerInvariant().Replace(" ", "-"); NewLocaleName = V7Locale.ToLowerInvariant().Replace(" ", "-");
//ensure each character is a valid path character //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; 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);
ct.SaveChanges();
//"Español",??
//Find the matching ID number for this locale
// LocaleBiz.LocaleExistsStatic
} }
break; break;
case "GZTW.AyaNova.BLL.User-scheduleableusergrouptags": case "GZTW.AyaNova.BLL.User-scheduleableusergrouptags":
{ {
//handle tag entries for users now that we have the SUG tags created //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": case "GZTW.AyaNova.BLL.User-client":
{ {
//handle setting client id for user client login //handle setting client id for user client login
throw new System.NotImplementedException(); //throw new System.NotImplementedException();
} }
//break; break;
case "GZTW.AyaNova.BLL.User-headoffice": case "GZTW.AyaNova.BLL.User-headoffice":
{ {
//handle setting ho id for user headoffice login //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 //just to hide compiler warning for now

View File

@@ -8,12 +8,13 @@ namespace AyaNova.Models
/// </summary> /// </summary>
public partial class ImportAyaNova7MapItem public partial class ImportAyaNova7MapItem
{ {
public AyaTypeId NewObject { get; set; } public AyaTypeId NewObjectAyaTypeId { get; set; }
public Guid V7ObjectId { get; set; } public Guid V7ObjectId { get; set; }
public ImportAyaNova7MapItem(Guid v7Guid, AyaType ayaType, long newId){ public ImportAyaNova7MapItem(Guid v7Guid, AyaType ayaType, long newId)
NewObject=new AyaTypeId(ayaType,newId); {
V7ObjectId=v7Guid; NewObjectAyaTypeId = new AyaTypeId(ayaType, newId);
V7ObjectId = v7Guid;
} }
} }