Ejemplo n.º 1
0
//		#region internal static void delObject(...);
        internal static void delObject(
            DBConnection dbConnection_in,

            long idText_in

            //) {
            //    delObject(
            //        dbConnection_in,

            //        idText_in,

            //        -1
            //    );
            //}

            //public static void delObject(
            //    DBConnection dbConnection_in,

            //    long idText_in,

            //    int sourceTableField_ref_in
            )
        {
            DO_DIC_TextLanguage.delRecord_byText(
                idText_in,

                dbConnection_in
                );
            DO_DIC_Text.delObject(
                idText_in,

                dbConnection_in
                );
        }
Ejemplo n.º 2
0
        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();
        }