Example #1
0
        public static int GetAD_Language_ID()
        {
            string    sLang    = GetLoginLanguage(Env.GetCtx()).GetAD_Language();
            MLanguage language = MLanguage.Get(Env.GetCtx(), sLang, null);

            return(language.GetAD_Language_ID());
        }
Example #2
0
        }       //	prepare

        /// <summary>
        ///Perform Process.
        /// </summary>
        /// <returns>Message (clear text)</returns>
        /// <exception cref="Exception">if not successful</exception>
        override protected String DoIt()
        {
            //IDbTransaction trx = ExecuteQuery.GerServerTransaction();
            //_language = MLanguage.Get(GetCtx(), _AD_Language_ID, trx.ToString());
            _language = MLanguage.Get(GetCtx(), _AD_Language_ID, Get_TrxName());
            log.Info("Mode=" + _MaintenanceMode + ", ID=" + _AD_Language_ID + " - " + _language);

            if (_language.IsBaseLanguage())
            {
                throw new Exception("Base Language has no Translations");
            }
            int deleteNo = 0;
            int insertNo = 0;

            //	Delete the recods of the _trl table
            if (MAINTENANCEMODE_Delete.Equals(_MaintenanceMode) ||
                MAINTENANCEMODE_ReCreate.Equals(_MaintenanceMode))
            {
                deleteNo = _language.Maintain(false);
            }
            //	Add the records from the _trl
            if (MAINTENANCEMODE_Add.Equals(_MaintenanceMode) ||
                MAINTENANCEMODE_ReCreate.Equals(_MaintenanceMode))
            {
                if (_language.IsActive() && _language.IsSystemLanguage())
                {
                    insertNo = _language.Maintain(true);
                }
                else
                {
                    //MessageBox.Show("Set System Language");
                    throw new Exception("Language not active System Language");
                }
            }
            //	Delete complete the records from _trl table
            if (MAINTENANCEMODE_Delete.Equals(_MaintenanceMode))
            {
                if (_language.IsSystemLanguage())
                {
                    _language.SetIsSystemLanguage(false);
                    _language.Save();
                }
            }
            //MessageBox.Show("Inserted Records:" + insertNo + "\n Deleted Records:" + deleteNo);
            return("@Deleted@=" + deleteNo + " - @Inserted@=" + insertNo);
        }