예제 #1
0
 public long insObject(
     string sessionGuid_in,
     string ip_forLogPurposes_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_NWS_Attachment attachment_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Name_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Description_in,
     bool selectIdentity_in,
     out string guid_out,
     out int[] errors_out
     )
 {
     object[] results = this.Invoke(
         "insObject",
         new object[] {
         sessionGuid_in,
         ip_forLogPurposes_in,
         attachment_in,
         tx_Name_in,
         tx_Description_in,
         selectIdentity_in
     }
         );
     guid_out   = (string)results[1];
     errors_out = (int[])results[2];
     return((long)results[0]);
 }
예제 #2
0
 public void updObject(
     string sessionGuid_in,
     string ip_forLogPurposes_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_NWS_Attachment attachment_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Name_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Description_in,
     out int[] errors_out
     )
 {
     throw new Exception("your not calling the remoting server, but the client's remoting server implementation");
 }
예제 #3
0
 public void updObject(
     string sessionGuid_in,
     string ip_forLogPurposes_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_NWS_Attachment attachment_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Name_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Description_in,
     out int[] errors_out
     )
 {
     bo_.updObject(
         sessionGuid_in,
         ip_forLogPurposes_in,
         attachment_in,
         tx_Name_in,
         tx_Description_in,
         out errors_out
         );
 }
예제 #4
0
 public void updObject(
     string sessionGuid_in,
     string ip_forLogPurposes_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_NWS_Attachment attachment_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Name_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Description_in,
     out int[] errors_out
     )
 {
     OGen.NTier.Kick.Libraries.BusinessLayer.SBO_NWS_Attachment.updObject(
         sessionGuid_in,
         (Utilities.ResetClientIP)
                                 ? (string)System.Runtime.Remoting.Messaging.CallContext.GetData("ClientIPAddress")
                                 : ip_forLogPurposes_in,
         attachment_in,
         tx_Name_in,
         tx_Description_in,
         out errors_out
         );
 }
예제 #5
0
 public void updObject(
     string sessionGuid_in,
     string ip_forLogPurposes_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_NWS_Attachment attachment_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Name_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Description_in,
     out int[] errors_out
     )
 {
     OGen.NTier.Kick.Libraries.BusinessLayer.SBO_NWS_Attachment.updObject(
         sessionGuid_in,
         (Utilities.ResetClientIP)
                                 ? HttpContext.Current.Request.UserHostAddress
                                 : ip_forLogPurposes_in,
         attachment_in,
         tx_Name_in,
         tx_Description_in,
         out errors_out
         );
 }
예제 #6
0
 public void updObject(
     string sessionGuid_in,
     string ip_forLogPurposes_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_NWS_Attachment attachment_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Name_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Description_in,
     out int[] errors_out
     )
 {
     object[] results = this.Invoke(
         "updObject",
         new object[] {
         sessionGuid_in,
         ip_forLogPurposes_in,
         attachment_in,
         tx_Name_in,
         tx_Description_in
     }
         );
     errors_out = (int[])results[0];
 }
예제 #7
0
 public long insObject(
     string sessionGuid_in,
     string ip_forLogPurposes_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_NWS_Attachment attachment_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Name_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Description_in,
     bool selectIdentity_in,
     out string guid_out,
     out int[] errors_out
     )
 {
     return(bo_.insObject(
                sessionGuid_in,
                ip_forLogPurposes_in,
                attachment_in,
                tx_Name_in,
                tx_Description_in,
                selectIdentity_in,
                out guid_out,
                out errors_out
                ));
 }
예제 #8
0
		/// <summary>
		/// Inserts NWS_Attachment 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_NWS_Attachment NWS_Attachment_in, 
			bool selectIdentity_in
		) {
			return insObject(
				NWS_Attachment_in, 
				selectIdentity_in, 
				null
			);
		}
예제 #9
0
		/// <summary>
		/// Updates NWS_Attachment 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_NWS_Attachment NWS_Attachment_in, 
			bool forceUpdate_in
		) {
			updObject(
				NWS_Attachment_in, 
				forceUpdate_in, 
				null
			);
		}
예제 #10
0
		public static DataTable getDataTable(
			SO_NWS_Attachment[] serializableObjects_in
		) {
			DataTable _output = new DataTable();
			_output.Locale = System.Globalization.CultureInfo.CurrentCulture;
			DataRow _dr;

			DataColumn _dc_idattachment = new DataColumn("IDAttachment", typeof(long));
			_output.Columns.Add(_dc_idattachment);
			DataColumn _dc_ifcontent = new DataColumn("IFContent", typeof(long));
			_output.Columns.Add(_dc_ifcontent);
			DataColumn _dc_guid = new DataColumn("GUID", typeof(string));
			_output.Columns.Add(_dc_guid);
			DataColumn _dc_order = new DataColumn("Order", typeof(long));
			_output.Columns.Add(_dc_order);
			DataColumn _dc_isimage = new DataColumn("IsImage", typeof(bool));
			_output.Columns.Add(_dc_isimage);
			DataColumn _dc_tx_name = new DataColumn("TX_Name", typeof(long));
			_output.Columns.Add(_dc_tx_name);
			DataColumn _dc_tx_description = new DataColumn("TX_Description", typeof(long));
			_output.Columns.Add(_dc_tx_description);
			DataColumn _dc_filename = new DataColumn("FileName", typeof(string));
			_output.Columns.Add(_dc_filename);

			foreach (SO_NWS_Attachment _serializableObject in serializableObjects_in) {
				_dr = _output.NewRow();

				_dr[_dc_idattachment] = _serializableObject.IDAttachment;
				_dr[_dc_ifcontent] = _serializableObject.IFContent;
				_dr[_dc_guid] = _serializableObject.GUID;
				_dr[_dc_order] = _serializableObject.Order;
				_dr[_dc_isimage] = _serializableObject.IsImage;
				_dr[_dc_tx_name] = _serializableObject.TX_Name;
				_dr[_dc_tx_description] = _serializableObject.TX_Description;
				_dr[_dc_filename] = _serializableObject.FileName;

				_output.Rows.Add(_dr);
			}

			return _output;
		}
예제 #11
0
		/// <summary>
		/// Updates NWS_Attachment 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_NWS_Attachment NWS_Attachment_in, 
			bool forceUpdate_in, 
			DBConnection dbConnection_in
		) {
			if (forceUpdate_in || NWS_Attachment_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("IDAttachment_", DbType.Int64, ParameterDirection.Input, NWS_Attachment_in.IDAttachment, 0), 
					_connection.newDBDataParameter("IFContent_", DbType.Int64, ParameterDirection.Input, NWS_Attachment_in.IFContent, 0), 
					_connection.newDBDataParameter("GUID_", DbType.AnsiString, ParameterDirection.Input, NWS_Attachment_in.GUID, 50), 
					_connection.newDBDataParameter("Order_", DbType.Int64, ParameterDirection.Input, NWS_Attachment_in.Order_isNull ? null : (object)NWS_Attachment_in.Order, 0), 
					_connection.newDBDataParameter("IsImage_", DbType.Boolean, ParameterDirection.Input, NWS_Attachment_in.IsImage, 0), 
					_connection.newDBDataParameter("TX_Name_", DbType.Int64, ParameterDirection.Input, NWS_Attachment_in.TX_Name_isNull ? null : (object)NWS_Attachment_in.TX_Name, 0), 
					_connection.newDBDataParameter("TX_Description_", DbType.Int64, ParameterDirection.Input, NWS_Attachment_in.TX_Description_isNull ? null : (object)NWS_Attachment_in.TX_Description, 0), 
					_connection.newDBDataParameter("FileName_", DbType.AnsiString, ParameterDirection.Input, NWS_Attachment_in.FileName, 255)
				};
				_connection.Execute_SQLFunction(
					"sp0_NWS_Attachment_updObject", 
					_dataparameters
				);
				if (dbConnection_in == null) { _connection.Dispose(); }
				NWS_Attachment_in.HasChanges = false;
			}
		}
예제 #12
0
		private static bool check(
			string sessionGuid_in,
			string ip_forLogPurposes_in, 

			ref SO_NWS_Attachment attachment_ref,

			out Guid sessionGuid_out,
			out Sessionuser sessionUser_out,
			out List<int> errorlist_out
		) {
			#region check...
			if (!SBO_CRD_Authentication.isSessionGuid_valid(
				sessionGuid_in,
				ip_forLogPurposes_in,
				out sessionGuid_out,
				out sessionUser_out,
				out errorlist_out
			)) {
				return false;
			}
			#endregion
			#region check Permissions . . .
			if (
				!sessionUser_out.hasPermission(
					false, 
					PermissionType.News__insert,
					PermissionType.News__update_Approved,
					PermissionType.News__update_Mine_notApproved
				)
			) {
				errorlist_out.Add(ErrorType.news__lack_of_permissions_to_write);
				return false;
			}
			#endregion

			#region //check Attachment ... (nothing to check!)
			#endregion

			return true;
		} 
예제 #13
0
		public static void updObject(
			string sessionGuid_in,
			string ip_forLogPurposes_in, 

			SO_NWS_Attachment attachment_in,
			SO_DIC__TextLanguage[] tx_Name_in,
			SO_DIC__TextLanguage[] tx_Description_in,

			out int[] errors_out
		) {
			Guid _sessionguid;
			Sessionuser _sessionuser;

			#region check...
			List<int> _errorlist;
			if (!check(
				sessionGuid_in,
				ip_forLogPurposes_in,

				ref attachment_in,

				out _sessionguid,
				out _sessionuser,
				out _errorlist
			)) {
				errors_out = _errorlist.ToArray();
				return;
			}
			#endregion

			#region check existence . . .
			SO_NWS_Attachment _attachment;
			if (
				attachment_in.IDAttachment <= 0
				||
				(
					(_attachment = DO_NWS_Attachment.getObject(
						attachment_in.IDAttachment
					)) == null
				)
			) {
				_errorlist.Add(ErrorType.data__not_found);
				errors_out = _errorlist.ToArray();
				return;
			}
			#endregion

			// ToDos: here! should mark Content to be re-Approved!
			// ToDos: here! or not allow if no approve permission

			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 TX_Name . . .
				if ((tx_Name_in != null) && (tx_Name_in.Length != 0)) {
					if (_attachment.TX_Name_isNull) {
						_attachment.TX_Name = SBO_DIC_Dic.insObject(
							_con,
							_sessionuser.IDApplication,
							OGen.NTier.Kick.Libraries.BusinessLayer.Shared.TableFieldSource.NWS_ATTACHMENT__TX_NAME,
							tx_Name_in
						);
					} else {
						SBO_DIC_Dic.updObject(
							_con,
							_attachment.TX_Name,
							tx_Name_in
						);
					}
				}
				#endregion
				#region TX_Description . . .
				if ((tx_Description_in != null) && (tx_Description_in.Length != 0)) {
					if (_attachment.TX_Description_isNull) {
						_attachment.TX_Description = SBO_DIC_Dic.insObject(
							_con,
							_sessionuser.IDApplication,
							OGen.NTier.Kick.Libraries.BusinessLayer.Shared.TableFieldSource.NWS_ATTACHMENT__TX_DESCRIPTION,
							tx_Description_in
						);
					} else {
						SBO_DIC_Dic.updObject(
							_con,
							_attachment.TX_Description,
							tx_Description_in
						);
					}
				}
				#endregion

				//_attachment.??? = attachment_in.???;
				DO_NWS_Attachment.updObject(
					_attachment,
					true,

					_con
				);
				_errorlist.Add(ErrorType.news__attachment__successfully_updated__WARNING);

				#region _con.Transaction.Commit();
				if (
					_con.IsOpen
					&&
					_con.Transaction.InTransaction
				) {
					_con.Transaction.Commit();
				}
				#endregion
			} 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();
		}
예제 #14
0
		public static long insObject(
			string sessionGuid_in,
			string ip_forLogPurposes_in, 

			SO_NWS_Attachment attachment_in,
			SO_DIC__TextLanguage[] tx_Name_in,
			SO_DIC__TextLanguage[] tx_Description_in,

			bool selectIdentity_in, 

			out string guid_out, 

			out int[] errors_out
		) {
			guid_out = "";
			long _output = -1L;

			Guid _sessionguid;
			Sessionuser _sessionuser;

			#region check...
			List<int> _errorlist;
			if (!check(
				sessionGuid_in,
				ip_forLogPurposes_in, 

				ref attachment_in, 

				out _sessionguid,
				out _sessionuser,
				out _errorlist
			)) {
				errors_out = _errorlist.ToArray();
				return _output;
			} 
			#endregion
			#region check Existence . . .
			if (
				(attachment_in.IFContent <= 0)
				||
				!DO_NWS_Content.isObject(attachment_in.IFContent)
			) {
				_errorlist.Add(ErrorType.data__not_found);
				errors_out = _errorlist.ToArray();
				return _output;
			}
			#endregion

			// ToDos: here! should mark Content to be re-Approved!
			// ToDos: here! or not allow if no approve permission

			attachment_in.GUID
				= guid_out
				= Guid.NewGuid().ToString("N");
			attachment_in.Order = DateTime.Now.Ticks;

			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 (
				//    (
				//        (tx_Name_in != null) 
				//        && 
				//        (tx_Name_in.Length != 0)) 
				//    ||
				//    (
				//        (tx_Description_in != null) 
				//        && 
				//        (tx_Description_in.Length != 0)
				//    )
				//) {
				_con.Open();
				_con.Transaction.Begin();
				//}

				#region content_in.TX_Name = ...;
				if (
					(tx_Name_in == null)
					||
					(tx_Name_in.Length == 0)
				) {
					attachment_in.TX_Name_isNull = true;
				} else {
					attachment_in.TX_Name = SBO_DIC_Dic.insObject(
						_con,

						_sessionuser.IDApplication,
						OGen.NTier.Kick.Libraries.BusinessLayer.Shared.TableFieldSource.NWS_ATTACHMENT__TX_NAME,

						tx_Name_in
					);
				}
				#endregion
				#region content_in.TX_Description = ...;
				if (
					(tx_Description_in == null)
					||
					(tx_Description_in.Length == 0)
				) {
					attachment_in.TX_Description_isNull = true;
				} else {
					attachment_in.TX_Description = SBO_DIC_Dic.insObject(
						_con,

						_sessionuser.IDApplication,
						OGen.NTier.Kick.Libraries.BusinessLayer.Shared.TableFieldSource.NWS_ATTACHMENT__TX_DESCRIPTION,

						tx_Description_in
					);
				}
				#endregion

				_output = DO_NWS_Attachment.insObject(
					attachment_in,
					selectIdentity_in,

					_con
				);
				_errorlist.Add(ErrorType.news__attachment__successfully_created__WARNING);

				#region _con.Transaction.Commit();
				if (
					_con.IsOpen
					&&
					_con.Transaction.InTransaction
				) {
					_con.Transaction.Commit();
				}
				#endregion
			} 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();
			return _output;
		} 
예제 #15
0
		private static SO_NWS_Attachment[] getRecord(
			DataTable dataTable_in
		) {
			DataColumn _dc_idattachment = null;
			DataColumn _dc_ifcontent = null;
			DataColumn _dc_guid = null;
			DataColumn _dc_order = null;
			DataColumn _dc_isimage = null;
			DataColumn _dc_tx_name = null;
			DataColumn _dc_tx_description = null;
			DataColumn _dc_filename = null;

			SO_NWS_Attachment[] _output 
				= new SO_NWS_Attachment[dataTable_in.Rows.Count];
			for (int r = 0; r < dataTable_in.Rows.Count; r++) {
				if (r == 0) {
					_dc_idattachment = dataTable_in.Columns["IDAttachment"];
					_dc_ifcontent = dataTable_in.Columns["IFContent"];
					_dc_guid = dataTable_in.Columns["GUID"];
					_dc_order = dataTable_in.Columns["Order"];
					_dc_isimage = dataTable_in.Columns["IsImage"];
					_dc_tx_name = dataTable_in.Columns["TX_Name"];
					_dc_tx_description = dataTable_in.Columns["TX_Description"];
					_dc_filename = dataTable_in.Columns["FileName"];
				}

				_output[r] = new SO_NWS_Attachment();
				if (dataTable_in.Rows[r][_dc_idattachment] == System.DBNull.Value) {
					_output[r].IDAttachment = 0L;
				} else {
					_output[r].IDAttachment = (long)dataTable_in.Rows[r][_dc_idattachment];
				}
				if (dataTable_in.Rows[r][_dc_ifcontent] == System.DBNull.Value) {
					_output[r].IFContent = 0L;
				} else {
					_output[r].IFContent = (long)dataTable_in.Rows[r][_dc_ifcontent];
				}
				if (dataTable_in.Rows[r][_dc_guid] == System.DBNull.Value) {
					_output[r].GUID = string.Empty;
				} else {
					_output[r].GUID = (string)dataTable_in.Rows[r][_dc_guid];
				}
				if (dataTable_in.Rows[r][_dc_order] == System.DBNull.Value) {
					_output[r].Order_isNull = true;
				} else {
					_output[r].Order = (long)dataTable_in.Rows[r][_dc_order];
				}
				if (dataTable_in.Rows[r][_dc_isimage] == System.DBNull.Value) {
					_output[r].IsImage = false;
				} else {
					_output[r].IsImage = (bool)dataTable_in.Rows[r][_dc_isimage];
				}
				if (dataTable_in.Rows[r][_dc_tx_name] == System.DBNull.Value) {
					_output[r].TX_Name_isNull = true;
				} else {
					_output[r].TX_Name = (long)dataTable_in.Rows[r][_dc_tx_name];
				}
				if (dataTable_in.Rows[r][_dc_tx_description] == System.DBNull.Value) {
					_output[r].TX_Description_isNull = true;
				} else {
					_output[r].TX_Description = (long)dataTable_in.Rows[r][_dc_tx_description];
				}
				if (dataTable_in.Rows[r][_dc_filename] == System.DBNull.Value) {
					_output[r].FileName = string.Empty;
				} else {
					_output[r].FileName = (string)dataTable_in.Rows[r][_dc_filename];
				}

				_output[r].HasChanges = false;
			}

			return _output;
		}
예제 #16
0
		/// <summary>
		/// Inserts NWS_Attachment 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_NWS_Attachment NWS_Attachment_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("IDAttachment_", DbType.Int64, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("IFContent_", DbType.Int64, ParameterDirection.Input, NWS_Attachment_in.IFContent, 0), 
				_connection.newDBDataParameter("GUID_", DbType.AnsiString, ParameterDirection.Input, NWS_Attachment_in.GUID, 50), 
				_connection.newDBDataParameter("Order_", DbType.Int64, ParameterDirection.Input, NWS_Attachment_in.Order_isNull ? null : (object)NWS_Attachment_in.Order, 0), 
				_connection.newDBDataParameter("IsImage_", DbType.Boolean, ParameterDirection.Input, NWS_Attachment_in.IsImage, 0), 
				_connection.newDBDataParameter("TX_Name_", DbType.Int64, ParameterDirection.Input, NWS_Attachment_in.TX_Name_isNull ? null : (object)NWS_Attachment_in.TX_Name, 0), 
				_connection.newDBDataParameter("TX_Description_", DbType.Int64, ParameterDirection.Input, NWS_Attachment_in.TX_Description_isNull ? null : (object)NWS_Attachment_in.TX_Description, 0), 
				_connection.newDBDataParameter("FileName_", DbType.AnsiString, ParameterDirection.Input, NWS_Attachment_in.FileName, 255), 

				_connection.newDBDataParameter("SelectIdentity_", DbType.Boolean, ParameterDirection.Input, selectIdentity_in, 1)
			};
			_connection.Execute_SQLFunction(
				"sp0_NWS_Attachment_insObject", 
				_dataparameters
			);
			if (dbConnection_in == null) { _connection.Dispose(); }

			NWS_Attachment_in.IDAttachment = (long)_dataparameters[0].Value;NWS_Attachment_in.HasChanges = false;
			

			return NWS_Attachment_in.IDAttachment;
		}
예제 #17
0
		/// <summary>
		/// Selects NWS_Attachment values from Database and assigns them to the appropriate DO_NWS_Attachment property.
		/// </summary>
		/// <param name="IDAttachment_in">IDAttachment</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 NWS_Attachment doesn't exists at Database</returns>
		public static SO_NWS_Attachment getObject(
			long IDAttachment_in, 
			DBConnection dbConnection_in
		) {
			SO_NWS_Attachment _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("IDAttachment_", DbType.Int64, ParameterDirection.InputOutput, IDAttachment_in, 0), 
				_connection.newDBDataParameter("IFContent_", DbType.Int64, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("GUID_", DbType.AnsiString, ParameterDirection.Output, null, 50), 
				_connection.newDBDataParameter("Order_", DbType.Int64, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("IsImage_", DbType.Boolean, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("TX_Name_", DbType.Int64, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("TX_Description_", DbType.Int64, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("FileName_", DbType.AnsiString, ParameterDirection.Output, null, 255)
			};
			_connection.Execute_SQLFunction("sp0_NWS_Attachment_getObject", _dataparameters);
			if (dbConnection_in == null) { _connection.Dispose(); }

			if (_dataparameters[0].Value != DBNull.Value) {
				_output = new SO_NWS_Attachment();

				if (_dataparameters[0].Value == System.DBNull.Value) {
					_output.IDAttachment = 0L;
				} else {
					_output.IDAttachment = (long)_dataparameters[0].Value;
				}
				if (_dataparameters[1].Value == System.DBNull.Value) {
					_output.IFContent = 0L;
				} else {
					_output.IFContent = (long)_dataparameters[1].Value;
				}
				if (_dataparameters[2].Value == System.DBNull.Value) {
					_output.GUID = string.Empty;
				} else {
					_output.GUID = (string)_dataparameters[2].Value;
				}
				if (_dataparameters[3].Value == System.DBNull.Value) {
					_output.Order_isNull = true;
				} else {
					_output.Order = (long)_dataparameters[3].Value;
				}
				if (_dataparameters[4].Value == System.DBNull.Value) {
					_output.IsImage = false;
				} else {
					_output.IsImage = (bool)_dataparameters[4].Value;
				}
				if (_dataparameters[5].Value == System.DBNull.Value) {
					_output.TX_Name_isNull = true;
				} else {
					_output.TX_Name = (long)_dataparameters[5].Value;
				}
				if (_dataparameters[6].Value == System.DBNull.Value) {
					_output.TX_Description_isNull = true;
				} else {
					_output.TX_Description = (long)_dataparameters[6].Value;
				}
				if (_dataparameters[7].Value == System.DBNull.Value) {
					_output.FileName = string.Empty;
				} else {
					_output.FileName = (string)_dataparameters[7].Value;
				}

				_output.HasChanges = false;
				return _output;
			}

			return null;
		}