示例#1
0
 /// <summary>
 ///     To start English version of it on Application start
 /// </summary>
 /// <param name="langCode">1 for EN</param>
 public static void Initialize(string langCode)
 {
     Tables = new Dictionary <EntitiesAlias, TableReference>();
     RibbonMenus.GetOrAdd(langCode, new List <RibbonMenu>());
     IdRefLangNames.GetOrAdd(langCode, new ConcurrentDictionary <int, IList <IdRefLangName> >());
     PageInfos.GetOrAdd(langCode, new ConcurrentDictionary <EntitiesAlias, IList <PageInfo> >());
     Operations.GetOrAdd(langCode, new ConcurrentDictionary <LookupEnums, IList <Operation> >());
     DisplayMessages.GetOrAdd(langCode, new ConcurrentDictionary <string, DisplayMessage>());
     ColumnSettings.GetOrAdd(langCode, new ConcurrentDictionary <EntitiesAlias, IList <ViewModels.ColumnSetting> >());
     GridColumnSettings.GetOrAdd(langCode, new ConcurrentDictionary <EntitiesAlias, IList <ViewModels.ColumnSetting> >());
     ValidationRegExpressions.GetOrAdd(langCode, new ConcurrentDictionary <EntitiesAlias, IList <ValidationRegEx> >());
     MasterTables.GetOrAdd(langCode, new ConcurrentDictionary <EntitiesAlias, object>());
     ConditionalOperators.GetOrAdd(langCode, new List <ConditionalOperator>());
     SysSettings.GetOrAdd(langCode, new SysSetting());
     BusinessConfiguration.GetOrAdd(langCode, new BusinessConfiguration());
 }
示例#2
0
        /// <summary>
        ///     To start English version of it on Application start
        /// </summary>
        /// <param name="langCode">1 for EN</param>
        public static void Initialize(string langCode)
        {
            RibbonMenus.GetOrAdd(langCode, new List <RibbonMenu>());
            IdRefLangNames.GetOrAdd(langCode, new ConcurrentDictionary <int, IList <IdRefLangName> >());
            PageInfos.GetOrAdd(langCode, new ConcurrentDictionary <EntitiesAlias, IList <PageInfo> >());
            Operations.GetOrAdd(langCode, new ConcurrentDictionary <LookupEnums, IList <Operation> >());
            DisplayMessages.GetOrAdd(langCode, new ConcurrentDictionary <string, DisplayMessage>());
            ColumnSettings.GetOrAdd(langCode, new ConcurrentDictionary <EntitiesAlias, IList <ColumnSetting> >());
            GridColumnSettings.GetOrAdd(langCode, new ConcurrentDictionary <EntitiesAlias, IList <ColumnSetting> >());
            ValidationRegExpressions.GetOrAdd(langCode, new ConcurrentDictionary <EntitiesAlias, IList <ValidationRegEx> >());
            MasterTables.GetOrAdd(langCode, new ConcurrentDictionary <EntitiesAlias, object>());
            ConditionalOperators.GetOrAdd(langCode, new List <ConditionalOperator>());
            BusinessConfiguration.GetOrAdd(langCode, new BusinessConfiguration());
            List <Task> tasks = new List <Task>();

            tasks.Add(Task.Factory.StartNew(() =>
            {
                GetRibbonMenus(langCode);
                GetTables();
                InitializerOperations(langCode);
                GetSystemSettings(langCode);
            }));

            if (tasks.Count > 0)
            {
                Task.WaitAll(tasks.ToArray());
            }

            #region Nav Cache Commented Code

            ////string username = M4PBusinessContext.ComponentSettings.NavAPIUserName;
            ////string password = M4PBusinessContext.ComponentSettings.NavAPIPassword;
            ////string serviceURL = M4PBusinessContext.ComponentSettings.NavAPIUrl;
            ////NAVOrderItemResponse.GetOrAdd(langCode, new NAVOrderItemResponse());
            ////DimensionValues.GetOrAdd(langCode, new NavSalesOrderDimensionResponse());
            ////GetNavSalesOrderDimensionValues(langCode, username, password, serviceURL);
            ////CachedNavSalesOrder.GetOrAdd(langCode, new NavSalesOrderPostedInvoiceResponse());
            ////GetCachedNavSalesOrderValues(langCode, username, password, serviceURL);
            ////CachedNavPurchaseOrder.GetOrAdd(langCode, new NavPurchaseOrderPostedInvoiceResponse());
            ////GetCachedNavPurchaseOrderValues(langCode, username, password, serviceURL);
            ////CachedNavSalesLine.GetOrAdd(langCode, new NavSalesOrderItemResponse());
            ////GetCachedNavSalesOrderItemValues(langCode, username, password, serviceURL);
            ////CachedNavPurchaseLine.GetOrAdd(langCode, new NavPurchaseOrderItemResponse());
            ////GetCachedNavPurchaseOrderItemValues(langCode, username, password, serviceURL);

            #endregion Nav Cache Commented Code
        }
示例#3
0
        internal static DisplayMessage GetDisplayMessageByCode(string langCode, string messageCode, bool forceUpdate = false)
        {
            if (!DisplayMessages.ContainsKey(langCode))
            {
                DisplayMessages.GetOrAdd(langCode, new ConcurrentDictionary <string, DisplayMessage>());
            }
            if (!DisplayMessages[langCode].ContainsKey(messageCode))
            {
                DisplayMessages[langCode].GetOrAdd(messageCode, _commands.GetDisplayMessageByCode(langCode, messageCode));
            }
            else if (DisplayMessages[langCode][messageCode] == null || forceUpdate)
            {
                DisplayMessages[langCode].AddOrUpdate(messageCode, _commands.GetDisplayMessageByCode(langCode, messageCode));
            }
            var displayMessage = DisplayMessages[langCode][messageCode] ?? new DisplayMessage();

            if (displayMessage.OperationIds.Count != displayMessage.Operations.Count)
            {
                displayMessage.Operations.Clear();
                displayMessage.OperationIds.ForEach(msg => msg.SetOperationToDisplayMessage(langCode, displayMessage));
            }
            return(displayMessage);
        }