public static void AsignTranslatedAppendix(this AppendixHelpEntity appendix, CultureInfoEntity fromCulture) { var fromAppendix = Database.Query <AppendixHelpEntity>().SingleEx(n => n.UniqueName == appendix.UniqueName && n.Culture == fromCulture); HashSet <string> toTranslate = new HashSet <string>(); if (!appendix.Title.HasText() && fromAppendix.Title.HasText()) { toTranslate.Add(fromAppendix.Title); } if (!appendix.Description.HasText() && fromAppendix.Description.HasText()) { toTranslate.Add(fromAppendix.Description); } Dictionary <string, string> dic = Translate(toTranslate, fromAppendix.Culture.Name, appendix.Culture.Name); if (!appendix.Title.HasText() && fromAppendix.Title.HasText()) { appendix.Title = dic.GetOrThrow(fromAppendix.Title); } if (!appendix.Description.HasText() && fromAppendix.Description.HasText()) { appendix.Description = dic.GetOrThrow(fromAppendix.Description); } appendix.Execute(AppendixHelpOperation.Save); }
} //CreateSystemUser public static void CreateCultureInfo() { using (Transaction tr = new Transaction()) { var en = new CultureInfoEntity(CultureInfo.GetCultureInfo("en")).Save(); var es = new CultureInfoEntity(CultureInfo.GetCultureInfo("es")).Save(); new ApplicationConfigurationEntity { Environment = "Development", DatabaseName = "Southwind", AuthTokens = new AuthTokenConfigurationEmbedded { }, WebAuthn = new WebAuthnConfigurationEmbedded { ServerName = "Southwind" }, //Auth Email = new EmailConfigurationEmbedded { SendEmails = true, DefaultCulture = en, UrlLeft = "http://localhost/Southwind" }, EmailSender = new EmailSenderConfigurationEntity { Name = "localhost", SMTP = new SmtpEmbedded { Network = new SmtpNetworkDeliveryEmbedded { Host = "localhost" } } }, //Email Sms = new SMSConfigurationEmbedded { DefaultCulture = en, }, //Sms Workflow = new WorkflowConfigurationEmbedded { }, //Workflow Translation = new TranslationConfigurationEmbedded { AzureCognitiveServicesAPIKey = null, DeepLAPIKey = null, }, Folders = new FoldersConfigurationEmbedded { PredictorModelFolder = @"c:/Southwind/PredictorModels", ExceptionsFolder = @"c:/Southwind/Exceptions", OperationLogFolder = @"c:/Southwind/OperationLog", ViewLogFolder = @"c:/Southwind/ViewLog", EmailMessageFolder = @"c:/Southwind/EmailMessage", } }.Save(); tr.Commit(); } }
internal static void LoadBasics() { var en = new CultureInfoEntity(CultureInfo.GetCultureInfo("en")).Save(); var es = new CultureInfoEntity(CultureInfo.GetCultureInfo("es")).Save(); new ApplicationConfigurationEntity { Environment = "Test", DatabaseName = "AtTest_Test", Email = new EmailConfigurationEmbedded { SendEmails = false, DefaultCulture = en, UrlLeft = "http://localhost/AtTest", }, AuthTokens = new AuthTokenConfigurationEmbedded { }, //Auth EmailSender = new EmailSenderConfigurationEntity { Name = "localhost", SMTP = new SmtpEmbedded { Network = new SmtpNetworkDeliveryEmbedded { Host = "localhost" } } }, //Email Folders = new FoldersConfigurationEmbedded { PredictorModelFolder = @"c:/AtTest/PredictorModels" } }.Save(); }
} //CreateSystemUser public static void CreateCultureInfo() { using (Transaction tr = new Transaction()) { var en = new CultureInfoEntity(CultureInfo.GetCultureInfo("en")).Save(); var es = new CultureInfoEntity(CultureInfo.GetCultureInfo("es")).Save(); new ApplicationConfigurationEntity { Environment = "Development", Email = new EmailConfigurationEntity { SendEmails = true, DefaultCulture = en, UrlLeft = "http://localhost/Southwind" }, SmtpConfiguration = new SmtpConfigurationEntity { Name = "localhost", Network = new SmtpNetworkDeliveryEntity { Host = "localhost" } }, //Email Sms = new SMSConfigurationEntity { DefaultCulture = en, } //Sms }.Save(); tr.Commit(); } }
public static MainWindowProxy OpenAndLogin(string userName, string password) { AutomationElement loginElement = FindOpenWindow("Welcome to Southwind"); Process process = null; if (loginElement == null) { process = Process.Start(@"D:\Signum\Southwind\Southwind.Windows\bin\Debug\Southwind.Windows.exe"); process.WaitForInputIdle(); loginElement = AutomationElement.RootElement.WaitChild(a => a.Current.ProcessId == process.Id && a.Current.ClassName == "Login", 5000); } var result = new MainWindowProxy(LoginWindowProxy.LoginAndContinue(loginElement, userName, password)); if (process != null) { result.Disposed += () => process.Kill(); } CultureInfoEntity culture = AuthLogic.RetrieveUser(userName).CultureInfo; Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = culture?.ToCultureInfo() ?? new CultureInfo("en-US"); return(result); }
public static CultureInfo ToCultureInfo(this CultureInfoEntity ci) { if (ci == null) { return(null); } return(EntityToCultureInfo.Value.TryGetC(ci)); }
internal static void LoadBasics() { var en = new CultureInfoEntity(CultureInfo.GetCultureInfo("en")).Save(); var es = new CultureInfoEntity(CultureInfo.GetCultureInfo("es")).Save(); new ApplicationConfigurationEntity { Environment = "Test", DatabaseName = "RG2", Email = new EmailConfigurationEmbedded { SendEmails = false, DefaultCulture = en, UrlLeft = "http://localhost/RG2", }, AuthTokens = new AuthTokenConfigurationEmbedded { }, WebAuthn = new WebAuthnConfigurationEmbedded { ServerName = "RG2" }, //Auth EmailSender = new EmailSenderConfigurationEntity { Name = "localhost", SMTP = new SmtpEmbedded { Network = new SmtpNetworkDeliveryEmbedded { Host = "localhost" } } }, //Email Workflow = new WorkflowConfigurationEmbedded { }, //Workflow Translation = new TranslationConfigurationEmbedded { AzureCognitiveServicesAPIKey = null, DeepLAPIKey = null, }, Folders = new FoldersConfigurationEmbedded { ExceptionsFolder = @"c:/RG2/Exceptions", OperationLogFolder = @"c:/RG2/OperationLog", ViewLogFolder = @"c:/RG2/ViewLog", EmailMessageFolder = @"c:/RG2/EmailMessage", } }.Save(); }
public static T SaveTranslation <T>(this T entity, CultureInfoEntity ci, Expression <Func <T, string> > propertyRoute, string translatedText) where T : Entity { entity.Save(); if (translatedText.HasText()) { new TranslatedInstanceEntity { PropertyRoute = PropertyRoute.Construct(propertyRoute).ToPropertyRouteEntity(), Culture = ci, TranslatedText = translatedText, OriginalText = GetPropertyRouteAccesor(propertyRoute)(entity), Instance = entity.ToLite(), } }
} //CreateSystemUser public static void CreateCultureInfo() { using (Transaction tr = new Transaction()) { var en = new CultureInfoEntity(CultureInfo.GetCultureInfo("en")).Save(); var es = new CultureInfoEntity(CultureInfo.GetCultureInfo("es")).Save(); new ApplicationConfigurationEntity { Environment = "Development", DatabaseName = "Southwind", AuthTokens = new AuthTokenConfigurationEmbedded { }, //Auth Email = new EmailConfigurationEmbedded { SendEmails = true, DefaultCulture = en, UrlLeft = "http://localhost/Southwind" }, EmailSender = new EmailSenderConfigurationEntity { Name = "localhost", SMTP = new SmtpEmbedded { Network = new SmtpNetworkDeliveryEmbedded { Host = "localhost" } } }, //Email Sms = new SMSConfigurationEmbedded { DefaultCulture = en, }, //Sms Workflow = new WorkflowConfigurationEmbedded { }, //Workflow Folders = new FoldersConfigurationEmbedded { PredictorModelFolder = @"c:/Southwind/PredictorModels" } }.Save(); tr.Commit(); } }
public static void AssignTranslatedFullEntity(this EntityHelpEntity entity, CultureInfoEntity fromCulture) { var fromEntity = Database.Query <EntityHelpEntity>().SingleOrDefaultEx(e => e.Type == entity.Type && e.Culture == fromCulture); if (fromEntity != null) { AssignTranslatedEntity(entity, fromEntity); } var queries = HelpLogic.TypeToQuery.Value.TryGetC(entity.Type.ToType()).EmptyIfNull().Select(QueryLogic.GetQueryEntity).ToList(); foreach (var q in queries) { var fromQuery = Database.Query <QueryHelpEntity>().SingleOrDefaultEx(e => e.Query == q && e.Culture == fromCulture); if (fromQuery != null) { var query = Database.Query <QueryHelpEntity>().SingleOrDefaultEx(e => e.Query == q && e.Culture == entity.Culture) ?? new QueryHelpEntity { Culture = entity.Culture, Query = q }; AsignTranslatedQuery(query, fromQuery); } } var operations = OperationLogic.GetAllOperationInfos(entity.Type.ToType()).Select(o => o.OperationSymbol).ToList(); foreach (var oper in operations) { var fromOper = Database.Query <OperationHelpEntity>().SingleOrDefaultEx(e => e.Operation == oper && e.Culture == fromCulture); if (fromOper != null) { var operation = Database.Query <OperationHelpEntity>().SingleOrDefaultEx(e => e.Operation == oper && e.Culture == entity.Culture) ?? new OperationHelpEntity { Culture = entity.Culture, Operation = oper }; AsignTranslatedOperation(operation, fromOper); } } }
internal static void LoadBasics() { var en = new CultureInfoEntity(CultureInfo.GetCultureInfo("en")).Save(); var es = new CultureInfoEntity(CultureInfo.GetCultureInfo("es")).Save(); new ApplicationConfigurationEntity { Environment = "Test", DatabaseName = "Southwind_Test", Email = new EmailConfigurationEmbedded { SendEmails = false, DefaultCulture = en, UrlLeft = "http://localhost/Southwind", }, AuthTokens = new AuthTokenConfigurationEmbedded { }, //Auth SmtpConfiguration = new SmtpConfigurationEntity { Name = "localhost", Network = new SmtpNetworkDeliveryEmbedded { Host = "localhost" } }, //Email Sms = new SMSConfigurationEmbedded { DefaultCulture = en, }, //Sms Workflow = new WorkflowConfigurationEmbedded { }, //Workflow Folders = new FoldersConfigurationEmbedded { PredictorModelFolder = @"c:/Southwind/PredictorModels" } }.Save(); }
public SMSTemplateMessageEmbedded(CultureInfoEntity culture) { this.CultureInfo = culture; }
public EmailMasterTemplateMessageEmbedded(CultureInfoEntity culture) { this.CultureInfo = culture; }
public static CultureInfo ToCultureInfo(this CultureInfoEntity ci) { return(EntityToCultureInfo.Value.GetOrThrow(ci)); }
internal static void LoadBasics() { var en = new CultureInfoEntity(CultureInfo.GetCultureInfo("en")).Save(); var es = new CultureInfoEntity(CultureInfo.GetCultureInfo("es")).Save(); }
} //CreateSystemUser public static void CreateCulturesAndConfiguration() { using (Transaction tr = new Transaction()) { new CultureInfoEntity(CultureInfo.GetCultureInfo("en")).Save(); var enGB = new CultureInfoEntity(CultureInfo.GetCultureInfo("en-GB")).Save(); new CultureInfoEntity(CultureInfo.GetCultureInfo("es")).Save(); new CultureInfoEntity(CultureInfo.GetCultureInfo("es-ES")).Save(); new CultureInfoEntity(CultureInfo.GetCultureInfo("de")).Save(); new CultureInfoEntity(CultureInfo.GetCultureInfo("de-DE")).Save(); var localPrefix = Starter.AzureStorageConnectionString.HasText() ? "" : @"c:/SouthwindFiles/"; var standardUser = Database.Query <RoleEntity>().Single(a => a.Name == "Standard User").ToLite(); new ApplicationConfigurationEntity { Environment = "Development", DatabaseName = Connector.Current.DatabaseName(), AuthTokens = new AuthTokenConfigurationEmbedded { }, //Auth Email = new EmailConfigurationEmbedded { SendEmails = true, DefaultCulture = enGB, UrlLeft = "http://localhost/Southwind" }, EmailSender = new EmailSenderConfigurationEntity { Name = "localhost", SMTP = new SmtpEmbedded { Network = new SmtpNetworkDeliveryEmbedded { Host = "localhost" } } }, //Email Sms = new SMSConfigurationEmbedded { DefaultCulture = enGB, }, //Sms Workflow = new WorkflowConfigurationEmbedded { }, //Workflow Folders = new FoldersConfigurationEmbedded { PredictorModelFolder = localPrefix + @"predictor-models", CachedQueryFolder = localPrefix + @"cached-query", ExceptionsFolder = localPrefix + @"exceptions", OperationLogFolder = localPrefix + @"operation-logs", ViewLogFolder = localPrefix + @"view-logs", EmailMessageFolder = localPrefix + @"email-messages", }, Translation = new TranslationConfigurationEmbedded { AzureCognitiveServicesAPIKey = null, DeepLAPIKey = null, }, ActiveDirectory = new ActiveDirectoryConfigurationEmbedded { Azure_ApplicationID = null, Azure_DirectoryID = null, Azure_ClientSecret = null, LoginWithActiveDirectoryRegistry = false, LoginWithWindowsAuthenticator = false, LoginWithAzureAD = false, AllowMatchUsersBySimpleUserName = true, AutoCreateUsers = true, AutoUpdateUsers = true, DefaultRole = standardUser, }, //ActiveDirectory }.Save(); tr.Commit(); } }
} //CreateSystemUser public static void CreateCulturesAndConfiguration() { using (Transaction tr = new Transaction()) { new CultureInfoEntity(CultureInfo.GetCultureInfo("en")).Save(); var enGB = new CultureInfoEntity(CultureInfo.GetCultureInfo("en-GB")).Save(); new CultureInfoEntity(CultureInfo.GetCultureInfo("es")).Save(); new CultureInfoEntity(CultureInfo.GetCultureInfo("es-ES")).Save(); new CultureInfoEntity(CultureInfo.GetCultureInfo("de")).Save(); new CultureInfoEntity(CultureInfo.GetCultureInfo("de-DE")).Save(); var localPrefix = Starter.AzureStorageConnectionString.HasText() ? "" : @"c:/SouthwindFiles/"; new ApplicationConfigurationEntity { Environment = "Development", DatabaseName = "Southwind", AuthTokens = new AuthTokenConfigurationEmbedded { }, WebAuthn = new WebAuthnConfigurationEmbedded { ServerName = "Southwind" }, //Auth Email = new EmailConfigurationEmbedded { SendEmails = true, DefaultCulture = enGB, UrlLeft = "http://localhost/Southwind" }, EmailSender = new EmailSenderConfigurationEntity { Name = "localhost", SMTP = new SmtpEmbedded { Network = new SmtpNetworkDeliveryEmbedded { Host = "localhost" } } }, //Email Sms = new SMSConfigurationEmbedded { DefaultCulture = enGB, }, //Sms Workflow = new WorkflowConfigurationEmbedded { }, //Workflow Translation = new TranslationConfigurationEmbedded { AzureCognitiveServicesAPIKey = null, DeepLAPIKey = null, }, Folders = new FoldersConfigurationEmbedded { PredictorModelFolder = localPrefix + @"predictor-models", ExceptionsFolder = localPrefix + @"exceptions", OperationLogFolder = localPrefix + @"operation-logs", ViewLogFolder = localPrefix + @"view-logs", EmailMessageFolder = localPrefix + @"email-messages", } }.Save(); tr.Commit(); } }
public static void AsignTranslatedNamespace(this NamespaceHelpEntity @namespace, CultureInfoEntity fromCulture) { var fromNamespace = Database.Query <NamespaceHelpEntity>().SingleEx(n => n.Name == @namespace.Name && n.Culture == fromCulture); HashSet <string> toTranslate = new HashSet <string>(); if ([email protected]() && fromNamespace.Description.HasText()) { toTranslate.Add(fromNamespace.Description); } Dictionary <string, string> dic = Translate(toTranslate, fromNamespace.Culture.Name, @namespace.Culture.Name); if ([email protected]() && fromNamespace.Description.HasText()) { @namespace.Description = dic.GetOrThrow(fromNamespace.Description); } @namespace.Execute(NamespaceHelpOperation.Save); }