/// <summary> /// Selects DIC_Text values from Database and assigns them to the appropriate DO_DIC_Text property. /// </summary> /// <param name="IDText_in">IDText</param> /// <param name="dbConnection_in">Database connection, making the use of Database Transactions possible on a sequence of operations across the same or multiple DataObjects</param> /// <returns>null if DIC_Text doesn't exists at Database</returns> public static SO_DIC_Text getObject( long IDText_in, DBConnection dbConnection_in ) { SO_DIC_Text _output = null; DBConnection _connection = (dbConnection_in == null) ? DO__Utilities.DBConnection_createInstance( DO__Utilities.DBServerType, DO__Utilities.DBConnectionstring, DO__Utilities.DBLogfile ) : dbConnection_in; IDbDataParameter[] _dataparameters = new IDbDataParameter[] { _connection.newDBDataParameter("IDText_", DbType.Int64, ParameterDirection.InputOutput, IDText_in, 0), _connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("SourceTableField_ref_", DbType.Int32, ParameterDirection.Output, null, 0) }; _connection.Execute_SQLFunction("sp0_DIC_Text_getObject", _dataparameters); if (dbConnection_in == null) { _connection.Dispose(); } if (_dataparameters[0].Value != DBNull.Value) { _output = new SO_DIC_Text(); if (_dataparameters[0].Value == System.DBNull.Value) { _output.IDText = 0L; } else { _output.IDText = (long)_dataparameters[0].Value; } if (_dataparameters[1].Value == System.DBNull.Value) { _output.IFApplication_isNull = true; } else { _output.IFApplication = (int)_dataparameters[1].Value; } if (_dataparameters[2].Value == System.DBNull.Value) { _output.SourceTableField_ref_isNull = true; } else { _output.SourceTableField_ref = (int)_dataparameters[2].Value; } _output.HasChanges = false; return _output; } return null; }
internal static long insObject( DBConnection dbConnection_in, int idApplication_in, int sourceTableField_ref_in, params OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] textLanguage_in ) { if (textLanguage_in.Length == 0) return -1L; #region SO_DIC_Text _text = ...; SO_DIC_Text _text = new SO_DIC_Text( -1, idApplication_in, sourceTableField_ref_in ); if (idApplication_in <= 0) { _text.IFApplication_isNull = true; } if (sourceTableField_ref_in <= 0) { _text.SourceTableField_ref_isNull = true; } #endregion long _idtext = DO_DIC_Text.insObject( _text, true, dbConnection_in ); updObject( dbConnection_in, _idtext, textLanguage_in ); return _idtext; }
public static void insLanguage( string sessionGuid_in, string ip_forLogPurposes_in, SO_DIC__TextLanguage[] languageName_in, SO_DIC__TextLanguage[] existingLanguagesInNewLanguage_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__insert)) { _errorlist.Add(ErrorType.language__lack_of_permissions_to_write); 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(); #region long _idtext = DO_DIC_Text.insObject(...); #region SO_DIC_Text _text = ...; SO_DIC_Text _text = new SO_DIC_Text( -1L, -1, -1 ); _text.IFApplication_isNull = true; _text.SourceTableField_ref_isNull = true; #endregion long _idtext = DO_DIC_Text.insObject( _text, true, _con ); #endregion #region int _idlanguage = DO_DIC_Language.insObject(...); int _idlanguage = DO_DIC_Language.insObject( new SO_DIC_Language( -1, _idtext ), true, _con ); #endregion for (int i = 0; i < languageName_in.Length; i++) { updObject( _con, _idtext, (languageName_in[i].IFLanguage > 0) // name of the new language on existing languages ? languageName_in[i] // name of the new language (on new language) : new SO_DIC__TextLanguage( _idlanguage, languageName_in[i].Text ) ); } SO_DIC_TextLanguage _textlanguage; for (int i = 0; i < existingLanguagesInNewLanguage_in.Length; i++) { _textlanguage = new SO_DIC_TextLanguage(); _textlanguage.IFText = DO_DIC_Language.getObject( existingLanguagesInNewLanguage_in[i].IFLanguage ).TX_Name; _textlanguage.IFLanguage = _idlanguage; if (existingLanguagesInNewLanguage_in[i].Text.Length > 8000) { _textlanguage.Text__large = existingLanguagesInNewLanguage_in[i].Text; _textlanguage.Text__small_isNull = true; } else { _textlanguage.Text__large_isNull = true; _textlanguage.Text__small = existingLanguagesInNewLanguage_in[i].Text; } DO_DIC_TextLanguage.setObject( _textlanguage, true, _con ); } #region _con.Transaction.Commit(); if (_con.Transaction.InTransaction) { _con.Transaction.Commit(); } #endregion _errorlist.Add(ErrorType.language__successfully_created__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 DataTable getDataTable( SO_DIC_Text[] serializableObjects_in ) { DataTable _output = new DataTable(); _output.Locale = System.Globalization.CultureInfo.CurrentCulture; DataRow _dr; DataColumn _dc_idtext = new DataColumn("IDText", typeof(long)); _output.Columns.Add(_dc_idtext); DataColumn _dc_ifapplication = new DataColumn("IFApplication", typeof(int)); _output.Columns.Add(_dc_ifapplication); DataColumn _dc_sourcetablefield_ref = new DataColumn("SourceTableField_ref", typeof(int)); _output.Columns.Add(_dc_sourcetablefield_ref); foreach (SO_DIC_Text _serializableObject in serializableObjects_in) { _dr = _output.NewRow(); _dr[_dc_idtext] = _serializableObject.IDText; _dr[_dc_ifapplication] = _serializableObject.IFApplication; _dr[_dc_sourcetablefield_ref] = _serializableObject.SourceTableField_ref; _output.Rows.Add(_dr); } return _output; }
/// <summary> /// Updates DIC_Text values on Database. /// </summary> /// <param name="forceUpdate_in">assign with True if you wish to force an Update (even if no changes have been made since last time getObject method was run) and False if not</param> /// <param name="dbConnection_in">Database connection, making the use of Database Transactions possible on a sequence of operations across the same or multiple DataObjects</param> public static void updObject( SO_DIC_Text DIC_Text_in, bool forceUpdate_in, DBConnection dbConnection_in ) { if (forceUpdate_in || DIC_Text_in.HasChanges) { DBConnection _connection = (dbConnection_in == null) ? DO__Utilities.DBConnection_createInstance( DO__Utilities.DBServerType, DO__Utilities.DBConnectionstring, DO__Utilities.DBLogfile ) : dbConnection_in; IDbDataParameter[] _dataparameters = new IDbDataParameter[] { _connection.newDBDataParameter("IDText_", DbType.Int64, ParameterDirection.Input, DIC_Text_in.IDText, 0), _connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Input, DIC_Text_in.IFApplication_isNull ? null : (object)DIC_Text_in.IFApplication, 0), _connection.newDBDataParameter("SourceTableField_ref_", DbType.Int32, ParameterDirection.Input, DIC_Text_in.SourceTableField_ref_isNull ? null : (object)DIC_Text_in.SourceTableField_ref, 0) }; _connection.Execute_SQLFunction( "sp0_DIC_Text_updObject", _dataparameters ); if (dbConnection_in == null) { _connection.Dispose(); } DIC_Text_in.HasChanges = false; } }
/// <summary> /// Updates DIC_Text values on Database. /// </summary> /// <param name="forceUpdate_in">assign with True if you wish to force an Update (even if no changes have been made since last time getObject method was run) and False if not</param> public static void updObject( SO_DIC_Text DIC_Text_in, bool forceUpdate_in ) { updObject( DIC_Text_in, forceUpdate_in, null ); }
/// <summary> /// Inserts DIC_Text values into Database. /// </summary> /// <param name="selectIdentity_in">assign with True if you wish to retrieve insertion sequence/identity seed and with False if not</param> /// <param name="dbConnection_in">Database connection, making the use of Database Transactions possible on a sequence of operations across the same or multiple DataObjects</param> /// <returns>insertion sequence/identity seed</returns> public static long insObject( SO_DIC_Text DIC_Text_in, bool selectIdentity_in, DBConnection dbConnection_in ) { DBConnection _connection = (dbConnection_in == null) ? DO__Utilities.DBConnection_createInstance( DO__Utilities.DBServerType, DO__Utilities.DBConnectionstring, DO__Utilities.DBLogfile ) : dbConnection_in; IDbDataParameter[] _dataparameters = new IDbDataParameter[] { _connection.newDBDataParameter("IDText_", DbType.Int64, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Input, DIC_Text_in.IFApplication_isNull ? null : (object)DIC_Text_in.IFApplication, 0), _connection.newDBDataParameter("SourceTableField_ref_", DbType.Int32, ParameterDirection.Input, DIC_Text_in.SourceTableField_ref_isNull ? null : (object)DIC_Text_in.SourceTableField_ref, 0), _connection.newDBDataParameter("SelectIdentity_", DbType.Boolean, ParameterDirection.Input, selectIdentity_in, 1) }; _connection.Execute_SQLFunction( "sp0_DIC_Text_insObject", _dataparameters ); if (dbConnection_in == null) { _connection.Dispose(); } DIC_Text_in.IDText = (long)_dataparameters[0].Value;DIC_Text_in.HasChanges = false; return DIC_Text_in.IDText; }
/// <summary> /// Inserts DIC_Text values into Database. /// </summary> /// <param name="selectIdentity_in">assign with True if you wish to retrieve insertion sequence/identity seed and with False if not</param> /// <returns>insertion sequence/identity seed</returns> public static long insObject( SO_DIC_Text DIC_Text_in, bool selectIdentity_in ) { return insObject( DIC_Text_in, selectIdentity_in, null ); }