public static void setSupportedLanguages( string sessionGuid_in, string ip_forLogPurposes_in, int[] idLanguages_in, out int[] errors_out ) { List <int> _errorlist; Guid _sessionguid; Sessionuser _sessionuser; #region check... if (!SBO_CRD_Authentication.isSessionGuid_valid( sessionGuid_in, ip_forLogPurposes_in, out _sessionguid, out _sessionuser, out _errorlist, out errors_out )) { //// no need! //errors_out = _errors.ToArray(); return; } #endregion #region check permissions... if (!_sessionuser.hasPermission(PermissionType.Language__set_supported)) { _errorlist.Add(ErrorType.language__lack_of_permissions_to_set); errors_out = _errorlist.ToArray(); return; } #endregion Exception _exception = null; #region DBConnection _con = DO__Utilities.DBConnection_createInstance(...); DBConnection _con = DO__Utilities.DBConnection_createInstance( DO__Utilities.DBServerType, DO__Utilities.DBConnectionstring, DO__Utilities.DBLogfile ); #endregion try { if ( (idLanguages_in != null) && (idLanguages_in.Length > 0) ) { _con.Open(); _con.Transaction.Begin(); } DO_DIC_LanguageApplication.delRecord_byApplication( _sessionuser.IDApplication, _con ); if ( (idLanguages_in != null) && (idLanguages_in.Length > 0) ) { for (int i = 0; i < idLanguages_in.Length; i++) { DO_DIC_LanguageApplication.setObject( new SO_DIC_LanguageApplication( idLanguages_in[i], _sessionuser.IDApplication ), true, _con ); } } #region _con.Transaction.Commit(); if (_con.Transaction.InTransaction) { _con.Transaction.Commit(); } #endregion _errorlist.Add(ErrorType.language__successfully_set__WARNING); } catch (Exception _ex) { #region _con.Transaction.Rollback(); if ( _con.IsOpen && _con.Transaction.InTransaction ) { _con.Transaction.Rollback(); } #endregion _exception = _ex; } finally { #region _con.Transaction.Terminate(); _con.Close(); _con.Dispose(); if (_con.IsOpen) { if (_con.Transaction.InTransaction) { _con.Transaction.Terminate(); } _con.Close(); } _con.Dispose(); #endregion } if (_exception != null) { #region SBO_LOG_Log.log(ErrorType.data); OGen.NTier.Kick.Libraries.BusinessLayer.SBO_LOG_Log.log( _sessionuser, LogType.error, ErrorType.data, -1L, _sessionuser.IDApplication, "{0}", new string[] { _exception.Message } ); #endregion _errorlist.Add(ErrorType.data); } errors_out = _errorlist.ToArray(); }
public static void delLanguage( string sessionGuid_in, string ip_forLogPurposes_in, int idLanguage_in, out int[] errors_out ) { List <int> _errorlist; Guid _sessionguid; Sessionuser _sessionuser; #region check... if (!SBO_CRD_Authentication.isSessionGuid_valid( sessionGuid_in, ip_forLogPurposes_in, out _sessionguid, out _sessionuser, out _errorlist, out errors_out )) { //// no need! //errors_out = _errors.ToArray(); return; } #endregion #region check permissions... if (!_sessionuser.hasPermission(PermissionType.Language__delete)) { _errorlist.Add(ErrorType.language__lack_of_permissions_to_delete); errors_out = _errorlist.ToArray(); return; } #endregion #region check existence... SO_DIC_Language _language = ...; SO_DIC_Language _language = DO_DIC_Language.getObject(idLanguage_in); if (_language == null) { _errorlist.Add(ErrorType.data__not_found); errors_out = _errorlist.ToArray(); return; } #endregion Exception _exception = null; #region DBConnection _con = DO__Utilities.DBConnection_createInstance(...); DBConnection _con = DO__Utilities.DBConnection_createInstance( DO__Utilities.DBServerType, DO__Utilities.DBConnectionstring, DO__Utilities.DBLogfile ); #endregion try { _con.Open(); _con.Transaction.Begin(); DO_DIC_LanguageApplication.delRecord_byLanguage( idLanguage_in, _con ); DO_DIC_TextLanguage.delRecord_byText( _language.TX_Name, _con ); // ONLY language name translations (short), NOT all translations (all) DO_DIC_TextLanguage.delRecord_byLanguage_short( idLanguage_in, _con ); DO_DIC_Language.delObject( idLanguage_in, _con ); DO_DIC_Text.delObject( _language.TX_Name, _con ); #region _con.Transaction.Commit(); if (_con.Transaction.InTransaction) { _con.Transaction.Commit(); } #endregion _errorlist.Add(ErrorType.language__successfully_deleted__WARNING); } catch (Exception _ex) { #region _con.Transaction.Rollback(); if ( _con.IsOpen && _con.Transaction.InTransaction ) { _con.Transaction.Rollback(); } #endregion _exception = _ex; } finally { #region _con.Transaction.Terminate(); _con.Close(); _con.Dispose(); if (_con.IsOpen) { if (_con.Transaction.InTransaction) { _con.Transaction.Terminate(); } _con.Close(); } _con.Dispose(); #endregion } if (_exception != null) { #region SBO_LOG_Log.log(ErrorType.data); OGen.NTier.Kick.Libraries.BusinessLayer.SBO_LOG_Log.log( _sessionuser, LogType.error, ErrorType.data, -1L, _sessionuser.IDApplication, "{0}", new string[] { _exception.Message } ); #endregion _errorlist.Add(ErrorType.data); } errors_out = _errorlist.ToArray(); }