/// <summary> /// Selects APP_Application values from Database and assigns them to the appropriate DO_APP_Application property. /// </summary> /// <param name="IDApplication_in">IDApplication</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 APP_Application doesn't exists at Database</returns> public static SO_APP_Application getObject( int IDApplication_in, DBConnection dbConnection_in ) { SO_APP_Application _output = null; DBConnection _connection = (dbConnection_in == null) ? DO__utils.DBConnection_createInstance( DO__utils.DBServerType, DO__utils.DBConnectionstring, DO__utils.DBLogfile ) : dbConnection_in; IDbDataParameter[] _dataparameters = new IDbDataParameter[] { _connection.newDBDataParameter("IDApplication_", DbType.Int32, ParameterDirection.InputOutput, IDApplication_in, 0), _connection.newDBDataParameter("Name_", DbType.AnsiString, ParameterDirection.Output, null, 20) }; _connection.Execute_SQLFunction("sp0_APP_Application_getObject", _dataparameters); if (dbConnection_in == null) { _connection.Dispose(); } if (_dataparameters[0].Value != DBNull.Value) { _output = new SO_APP_Application(); if (_dataparameters[0].Value == System.DBNull.Value) { _output.IDApplication = 0; } else { _output.IDApplication = (int)_dataparameters[0].Value; } if (_dataparameters[1].Value == System.DBNull.Value) { _output.Name = string.Empty; } else { _output.Name = (string)_dataparameters[1].Value; } _output.haschanges_ = false; return _output; } return null; }
public static DataTable getDataTable( SO_APP_Application[] serializableobjects_in ) { DataTable _output = new DataTable(); DataRow _dr; DataColumn _dc_idapplication = new DataColumn("IDApplication", typeof(int)); _output.Columns.Add(_dc_idapplication); DataColumn _dc_name = new DataColumn("Name", typeof(string)); _output.Columns.Add(_dc_name); foreach (SO_APP_Application _serializableobject in serializableobjects_in) { _dr = _output.NewRow(); _dr[_dc_idapplication] = _serializableobject.IDApplication; _dr[_dc_name] = _serializableobject.Name; _output.Rows.Add(_dr); } return _output; }
private static SO_APP_Application[] getRecord( DataTable dataTable_in ) { DataColumn _dc_idapplication = null; DataColumn _dc_name = null; SO_APP_Application[] _output = new SO_APP_Application[dataTable_in.Rows.Count]; for (int r = 0; r < dataTable_in.Rows.Count; r++) { if (r == 0) { _dc_idapplication = dataTable_in.Columns["IDApplication"]; _dc_name = dataTable_in.Columns["Name"]; } _output[r] = new SO_APP_Application(); if (dataTable_in.Rows[r][_dc_idapplication] == System.DBNull.Value) { _output[r].idapplication_ = 0; } else { _output[r].idapplication_ = (int)dataTable_in.Rows[r][_dc_idapplication]; } if (dataTable_in.Rows[r][_dc_name] == System.DBNull.Value) { _output[r].name_ = string.Empty; } else { _output[r].name_ = (string)dataTable_in.Rows[r][_dc_name]; } _output[r].haschanges_ = false; } return _output; }
/// <summary> /// Updates APP_Application 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_APP_Application APP_Application_in, bool forceUpdate_in, DBConnection dbConnection_in ) { if (forceUpdate_in || APP_Application_in.haschanges_) { DBConnection _connection = (dbConnection_in == null) ? DO__utils.DBConnection_createInstance( DO__utils.DBServerType, DO__utils.DBConnectionstring, DO__utils.DBLogfile ) : dbConnection_in; IDbDataParameter[] _dataparameters = new IDbDataParameter[] { _connection.newDBDataParameter("IDApplication_", DbType.Int32, ParameterDirection.Input, APP_Application_in.IDApplication, 0), _connection.newDBDataParameter("Name_", DbType.AnsiString, ParameterDirection.Input, APP_Application_in.Name, 20) }; _connection.Execute_SQLFunction( "sp0_APP_Application_updObject", _dataparameters ); if (dbConnection_in == null) { _connection.Dispose(); } APP_Application_in.haschanges_ = false; } }
/// <summary> /// Updates APP_Application 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_APP_Application APP_Application_in, bool forceUpdate_in ) { updObject( APP_Application_in, forceUpdate_in, null ); }
/// <summary> /// Inserts APP_Application 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 int insObject( SO_APP_Application APP_Application_in, bool selectIdentity_in, DBConnection dbConnection_in ) { DBConnection _connection = (dbConnection_in == null) ? DO__utils.DBConnection_createInstance( DO__utils.DBServerType, DO__utils.DBConnectionstring, DO__utils.DBLogfile ) : dbConnection_in; IDbDataParameter[] _dataparameters = new IDbDataParameter[] { _connection.newDBDataParameter("IDApplication_", DbType.Int32, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("Name_", DbType.AnsiString, ParameterDirection.Input, APP_Application_in.Name, 20), _connection.newDBDataParameter("SelectIdentity_", DbType.Boolean, ParameterDirection.Input, selectIdentity_in, 1) }; _connection.Execute_SQLFunction( "sp0_APP_Application_insObject", _dataparameters ); if (dbConnection_in == null) { _connection.Dispose(); } APP_Application_in.IDApplication = (int)_dataparameters[0].Value;APP_Application_in.haschanges_ = false; return APP_Application_in.IDApplication; }
/// <summary> /// Inserts APP_Application 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 int insObject( SO_APP_Application APP_Application_in, bool selectIdentity_in ) { return insObject( APP_Application_in, selectIdentity_in, null ); }