コード例 #1
0
		/// <summary>
		/// Selects NWS_Content values from Database and assigns them to the appropriate DO_NWS_Content property.
		/// </summary>
		/// <param name="IDContent_in">IDContent</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_Content doesn't exists at Database</returns>
		public static SO_NWS_Content getObject(
			long IDContent_in, 
			DBConnection dbConnection_in
		) {
			SO_NWS_Content _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("IDContent_", DbType.Int64, ParameterDirection.InputOutput, IDContent_in, 0), 
				_connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("IFUser__Publisher_", DbType.Int64, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("Publish_date_", DbType.DateTime, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("IFUser__Aproved_", DbType.Int64, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("Aproved_date_", DbType.DateTime, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("Begin_date_", DbType.DateTime, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("End_date_", DbType.DateTime, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("TX_Title_", DbType.Int64, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("TX_Content_", DbType.Int64, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("tx_subtitle_", DbType.Int64, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("tx_summary_", DbType.Int64, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("Newslettersent_date_", DbType.DateTime, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("isNews_notForum_", DbType.Boolean, ParameterDirection.Output, null, 0)
			};
			_connection.Execute_SQLFunction("sp0_NWS_Content_getObject", _dataparameters);
			if (dbConnection_in == null) { _connection.Dispose(); }

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

				if (_dataparameters[0].Value == System.DBNull.Value) {
					_output.IDContent = 0L;
				} else {
					_output.IDContent = (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.IFUser__Publisher = 0L;
				} else {
					_output.IFUser__Publisher = (long)_dataparameters[2].Value;
				}
				if (_dataparameters[3].Value == System.DBNull.Value) {
					_output.Publish_date = new DateTime(1900, 1, 1);
				} else {
					_output.Publish_date = (DateTime)_dataparameters[3].Value;
				}
				if (_dataparameters[4].Value == System.DBNull.Value) {
					_output.IFUser__Aproved_isNull = true;
				} else {
					_output.IFUser__Aproved = (long)_dataparameters[4].Value;
				}
				if (_dataparameters[5].Value == System.DBNull.Value) {
					_output.Aproved_date_isNull = true;
				} else {
					_output.Aproved_date = (DateTime)_dataparameters[5].Value;
				}
				if (_dataparameters[6].Value == System.DBNull.Value) {
					_output.Begin_date_isNull = true;
				} else {
					_output.Begin_date = (DateTime)_dataparameters[6].Value;
				}
				if (_dataparameters[7].Value == System.DBNull.Value) {
					_output.End_date_isNull = true;
				} else {
					_output.End_date = (DateTime)_dataparameters[7].Value;
				}
				if (_dataparameters[8].Value == System.DBNull.Value) {
					_output.TX_Title_isNull = true;
				} else {
					_output.TX_Title = (long)_dataparameters[8].Value;
				}
				if (_dataparameters[9].Value == System.DBNull.Value) {
					_output.TX_Content_isNull = true;
				} else {
					_output.TX_Content = (long)_dataparameters[9].Value;
				}
				if (_dataparameters[10].Value == System.DBNull.Value) {
					_output.tx_subtitle_isNull = true;
				} else {
					_output.tx_subtitle = (long)_dataparameters[10].Value;
				}
				if (_dataparameters[11].Value == System.DBNull.Value) {
					_output.tx_summary_isNull = true;
				} else {
					_output.tx_summary = (long)_dataparameters[11].Value;
				}
				if (_dataparameters[12].Value == System.DBNull.Value) {
					_output.Newslettersent_date_isNull = true;
				} else {
					_output.Newslettersent_date = (DateTime)_dataparameters[12].Value;
				}
				if (_dataparameters[13].Value == System.DBNull.Value) {
					_output.isNews_notForum_isNull = true;
				} else {
					_output.isNews_notForum = (bool)_dataparameters[13].Value;
				}

				_output.haschanges_ = false;
				return _output;
			}

			return null;
		}
コード例 #2
0
		/// <summary>
		/// Updates NWS_Content 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_Content NWS_Content_in, 
			bool forceUpdate_in, 
			DBConnection dbConnection_in
		) {
			if (forceUpdate_in || NWS_Content_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("IDContent_", DbType.Int64, ParameterDirection.Input, NWS_Content_in.IDContent, 0), 
					_connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Input, NWS_Content_in.IFApplication_isNull ? null : (object)NWS_Content_in.IFApplication, 0), 
					_connection.newDBDataParameter("IFUser__Publisher_", DbType.Int64, ParameterDirection.Input, NWS_Content_in.IFUser__Publisher, 0), 
					_connection.newDBDataParameter("Publish_date_", DbType.DateTime, ParameterDirection.Input, NWS_Content_in.Publish_date, 0), 
					_connection.newDBDataParameter("IFUser__Aproved_", DbType.Int64, ParameterDirection.Input, NWS_Content_in.IFUser__Aproved_isNull ? null : (object)NWS_Content_in.IFUser__Aproved, 0), 
					_connection.newDBDataParameter("Aproved_date_", DbType.DateTime, ParameterDirection.Input, NWS_Content_in.Aproved_date_isNull ? null : (object)NWS_Content_in.Aproved_date, 0), 
					_connection.newDBDataParameter("Begin_date_", DbType.DateTime, ParameterDirection.Input, NWS_Content_in.Begin_date_isNull ? null : (object)NWS_Content_in.Begin_date, 0), 
					_connection.newDBDataParameter("End_date_", DbType.DateTime, ParameterDirection.Input, NWS_Content_in.End_date_isNull ? null : (object)NWS_Content_in.End_date, 0), 
					_connection.newDBDataParameter("TX_Title_", DbType.Int64, ParameterDirection.Input, NWS_Content_in.TX_Title_isNull ? null : (object)NWS_Content_in.TX_Title, 0), 
					_connection.newDBDataParameter("TX_Content_", DbType.Int64, ParameterDirection.Input, NWS_Content_in.TX_Content_isNull ? null : (object)NWS_Content_in.TX_Content, 0), 
					_connection.newDBDataParameter("tx_subtitle_", DbType.Int64, ParameterDirection.Input, NWS_Content_in.tx_subtitle_isNull ? null : (object)NWS_Content_in.tx_subtitle, 0), 
					_connection.newDBDataParameter("tx_summary_", DbType.Int64, ParameterDirection.Input, NWS_Content_in.tx_summary_isNull ? null : (object)NWS_Content_in.tx_summary, 0), 
					_connection.newDBDataParameter("Newslettersent_date_", DbType.DateTime, ParameterDirection.Input, NWS_Content_in.Newslettersent_date_isNull ? null : (object)NWS_Content_in.Newslettersent_date, 0), 
					_connection.newDBDataParameter("isNews_notForum_", DbType.Boolean, ParameterDirection.Input, NWS_Content_in.isNews_notForum_isNull ? null : (object)NWS_Content_in.isNews_notForum, 0)
				};
				_connection.Execute_SQLFunction(
					"sp0_NWS_Content_updObject", 
					_dataparameters
				);
				if (dbConnection_in == null) { _connection.Dispose(); }
				NWS_Content_in.haschanges_ = false;
			}
		}
コード例 #3
0
		private static SO_NWS_Content[] getRecord(
			DataTable dataTable_in
		) {
			DataColumn _dc_idcontent = null;
			DataColumn _dc_ifapplication = null;
			DataColumn _dc_ifuser__publisher = null;
			DataColumn _dc_publish_date = null;
			DataColumn _dc_ifuser__aproved = null;
			DataColumn _dc_aproved_date = null;
			DataColumn _dc_begin_date = null;
			DataColumn _dc_end_date = null;
			DataColumn _dc_tx_title = null;
			DataColumn _dc_tx_content = null;
			DataColumn _dc_tx_subtitle = null;
			DataColumn _dc_tx_summary = null;
			DataColumn _dc_newslettersent_date = null;
			DataColumn _dc_isnews_notforum = null;

			SO_NWS_Content[] _output 
				= new SO_NWS_Content[dataTable_in.Rows.Count];
			for (int r = 0; r < dataTable_in.Rows.Count; r++) {
				if (r == 0) {
					_dc_idcontent = dataTable_in.Columns["IDContent"];
					_dc_ifapplication = dataTable_in.Columns["IFApplication"];
					_dc_ifuser__publisher = dataTable_in.Columns["IFUser__Publisher"];
					_dc_publish_date = dataTable_in.Columns["Publish_date"];
					_dc_ifuser__aproved = dataTable_in.Columns["IFUser__Aproved"];
					_dc_aproved_date = dataTable_in.Columns["Aproved_date"];
					_dc_begin_date = dataTable_in.Columns["Begin_date"];
					_dc_end_date = dataTable_in.Columns["End_date"];
					_dc_tx_title = dataTable_in.Columns["TX_Title"];
					_dc_tx_content = dataTable_in.Columns["TX_Content"];
					_dc_tx_subtitle = dataTable_in.Columns["tx_subtitle"];
					_dc_tx_summary = dataTable_in.Columns["tx_summary"];
					_dc_newslettersent_date = dataTable_in.Columns["Newslettersent_date"];
					_dc_isnews_notforum = dataTable_in.Columns["isNews_notForum"];
				}

				_output[r] = new SO_NWS_Content();
				if (dataTable_in.Rows[r][_dc_idcontent] == System.DBNull.Value) {
					_output[r].idcontent_ = 0L;
				} else {
					_output[r].idcontent_ = (long)dataTable_in.Rows[r][_dc_idcontent];
				}
				if (dataTable_in.Rows[r][_dc_ifapplication] == System.DBNull.Value) {
					_output[r].IFApplication_isNull = true;
				} else {
					_output[r].ifapplication_ = (int)dataTable_in.Rows[r][_dc_ifapplication];
				}
				if (dataTable_in.Rows[r][_dc_ifuser__publisher] == System.DBNull.Value) {
					_output[r].ifuser__publisher_ = 0L;
				} else {
					_output[r].ifuser__publisher_ = (long)dataTable_in.Rows[r][_dc_ifuser__publisher];
				}
				if (dataTable_in.Rows[r][_dc_publish_date] == System.DBNull.Value) {
					_output[r].publish_date_ = new DateTime(1900, 1, 1);
				} else {
					_output[r].publish_date_ = (DateTime)dataTable_in.Rows[r][_dc_publish_date];
				}
				if (dataTable_in.Rows[r][_dc_ifuser__aproved] == System.DBNull.Value) {
					_output[r].IFUser__Aproved_isNull = true;
				} else {
					_output[r].ifuser__aproved_ = (long)dataTable_in.Rows[r][_dc_ifuser__aproved];
				}
				if (dataTable_in.Rows[r][_dc_aproved_date] == System.DBNull.Value) {
					_output[r].Aproved_date_isNull = true;
				} else {
					_output[r].aproved_date_ = (DateTime)dataTable_in.Rows[r][_dc_aproved_date];
				}
				if (dataTable_in.Rows[r][_dc_begin_date] == System.DBNull.Value) {
					_output[r].Begin_date_isNull = true;
				} else {
					_output[r].begin_date_ = (DateTime)dataTable_in.Rows[r][_dc_begin_date];
				}
				if (dataTable_in.Rows[r][_dc_end_date] == System.DBNull.Value) {
					_output[r].End_date_isNull = true;
				} else {
					_output[r].end_date_ = (DateTime)dataTable_in.Rows[r][_dc_end_date];
				}
				if (dataTable_in.Rows[r][_dc_tx_title] == System.DBNull.Value) {
					_output[r].TX_Title_isNull = true;
				} else {
					_output[r].tx_title_ = (long)dataTable_in.Rows[r][_dc_tx_title];
				}
				if (dataTable_in.Rows[r][_dc_tx_content] == System.DBNull.Value) {
					_output[r].TX_Content_isNull = true;
				} else {
					_output[r].tx_content_ = (long)dataTable_in.Rows[r][_dc_tx_content];
				}
				if (dataTable_in.Rows[r][_dc_tx_subtitle] == System.DBNull.Value) {
					_output[r].tx_subtitle_isNull = true;
				} else {
					_output[r].tx_subtitle_ = (long)dataTable_in.Rows[r][_dc_tx_subtitle];
				}
				if (dataTable_in.Rows[r][_dc_tx_summary] == System.DBNull.Value) {
					_output[r].tx_summary_isNull = true;
				} else {
					_output[r].tx_summary_ = (long)dataTable_in.Rows[r][_dc_tx_summary];
				}
				if (dataTable_in.Rows[r][_dc_newslettersent_date] == System.DBNull.Value) {
					_output[r].Newslettersent_date_isNull = true;
				} else {
					_output[r].newslettersent_date_ = (DateTime)dataTable_in.Rows[r][_dc_newslettersent_date];
				}
				if (dataTable_in.Rows[r][_dc_isnews_notforum] == System.DBNull.Value) {
					_output[r].isNews_notForum_isNull = true;
				} else {
					_output[r].isnews_notforum_ = (bool)dataTable_in.Rows[r][_dc_isnews_notforum];
				}

				_output[r].haschanges_ = false;
			}

			return _output;
		}
コード例 #4
0
		/// <summary>
		/// Inserts NWS_Content 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_Content NWS_Content_in, 
			bool selectIdentity_in
		) {
			return insObject(
				NWS_Content_in, 
				selectIdentity_in, 
				null
			);
		}
コード例 #5
0
		/// <summary>
		/// Updates NWS_Content 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_Content NWS_Content_in, 
			bool forceUpdate_in
		) {
			updObject(
				NWS_Content_in, 
				forceUpdate_in, 
				null
			);
		}
コード例 #6
0
		public static void updObject_Content(
			#region params...
			string sessionGuid_in,
			string ip_forLogPurposes_in, 

			SO_NWS_Content content_in,
			OGen.NTier.Kick.lib.datalayer.shared.structures.SO_DIC__TextLanguage[] tx_Title_in,
			OGen.NTier.Kick.lib.datalayer.shared.structures.SO_DIC__TextLanguage[] tx_Content_in,
			OGen.NTier.Kick.lib.datalayer.shared.structures.SO_DIC__TextLanguage[] tx_subtitle_in,
			OGen.NTier.Kick.lib.datalayer.shared.structures.SO_DIC__TextLanguage[] tx_summary_in,

			//bool andApprove_in,

			out int[] errors_out
			#endregion
		) {
			updObject(
				sessionGuid_in,
				ip_forLogPurposes_in, 

				true,
				content_in,
				tx_Title_in,
				tx_Content_in,
				tx_subtitle_in,
				tx_summary_in,

				false,
				new long[] { },

				false,
				new long[] { },

				false,
				new long[] { },

				false, 
				new long[] { },

				false,
				new long[] { },

				//andApprove_in,

				out errors_out
			);
		} 
コード例 #7
0
//		#endregion
//		#region public static void updObject(...);
		private static void updObject(
			#region params...
			string sessionGuid_in,
			string ip_forLogPurposes_in, 

			bool updateContent_in,
			SO_NWS_Content content_in,
			OGen.NTier.Kick.lib.datalayer.shared.structures.SO_DIC__TextLanguage[] tx_Title_in,
			OGen.NTier.Kick.lib.datalayer.shared.structures.SO_DIC__TextLanguage[] tx_Content_in,
			OGen.NTier.Kick.lib.datalayer.shared.structures.SO_DIC__TextLanguage[] tx_subtitle_in,
			OGen.NTier.Kick.lib.datalayer.shared.structures.SO_DIC__TextLanguage[] tx_summary_in,

			bool updateTags_in, 
			long[] idTags_in,

			bool updateAuthors_in, 
			long[] idAuthors_in,

			bool updateSources_in, 
			long[] idSources_in,

			bool updateHighlights_in, 
			long[] idHighlights_in, 

			bool updateProfiles_in, 
			long[] idProfiles_in, 

			//bool andApprove_in, 

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

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

				ref content_in,
				tx_Title_in,
				tx_Content_in,
				tx_subtitle_in,
				tx_summary_in, 

				//andApprove_in, 

				out _sessionguid,
				out _sessionuser,
				out _errorlist
			)) {
				errors_out = _errorlist.ToArray();
				return;
			} 
			#endregion
			#region check Existence . . .
			SO_NWS_Content _content;
			if (
				(content_in.IDContent <= 0)
				||
				(
					(
						_content 
							= DO_NWS_Content.getObject(
								content_in.IDContent
							)
					) == null)
			) {
				_errorlist.Add(ErrorType.data__not_found);
				errors_out = _errorlist.ToArray();
				return;
			}
			#endregion

#if !DEBUG
			if (
				(_content.IFUser__Publisher != content_in.IFUser__Publisher)
				&&
				!_sessionuser.hasPermition(PermitionType.Content__update_????????)
			) {
				_errorlist.Add(ErrorType.content__lack_of_permitions_to_write_?????????????);
				errors_out = _errorlist.ToArray();
				return;
			}
#endif

			Exception _exception = null;
			#region DBConnection _con = DO__utils.DBConnection_createInstance(...);
			DBConnection _con = DO__utils.DBConnection_createInstance(
				DO__utils.DBServerType,
				DO__utils.DBConnectionstring,
				DO__utils.DBLogfile
			); 
			#endregion
			try {
				_con.Open();
				_con.Transaction.Begin();


				if (updateContent_in) {
					#region TX_Title . . .
					if ((tx_Title_in != null) && (tx_Title_in.Length != 0)) {
						if (_content.TX_Title_isNull) {
							_content.TX_Title = SBO_DIC_Dic.insObject(
								_con,
								_sessionuser.IDApplication,
								OGen.NTier.Kick.lib.businesslayer.shared.TableFieldSource.NWS_CONTENT__TX_TITLE,
								tx_Title_in
							);
						} else {
							SBO_DIC_Dic.updObject(
								_con,
								_content.TX_Title,
								tx_Title_in
							);
						}
					}
					#endregion
					#region TX_Content . . .
					if ((tx_Content_in != null) && (tx_Content_in.Length != 0)) {
						if (_content.TX_Content_isNull) {
							_content.TX_Content = SBO_DIC_Dic.insObject(
								_con,
								_sessionuser.IDApplication,
								OGen.NTier.Kick.lib.businesslayer.shared.TableFieldSource.NWS_CONTENT__TX_CONTENT,
								tx_Content_in
							);
						} else {
							SBO_DIC_Dic.updObject(
								_con,
								_content.TX_Content,
								tx_Content_in
							);
						}
					}
					#endregion
					#region tx_subtitle . . .
					if ((tx_subtitle_in != null) && (tx_subtitle_in.Length != 0)) {
						if (_content.tx_subtitle_isNull) {
							_content.tx_subtitle = SBO_DIC_Dic.insObject(
								_con,
								_sessionuser.IDApplication,
								OGen.NTier.Kick.lib.businesslayer.shared.TableFieldSource.NWS_CONTENT__TX_SUBTITLE,
								tx_subtitle_in
							);
						} else {
							SBO_DIC_Dic.updObject(
								_con,
								_content.tx_subtitle,
								tx_subtitle_in
							);
						}
					}
					#endregion
					#region tx_summary . . .
					if ((tx_summary_in != null) && (tx_summary_in.Length != 0)) {
						if (_content.tx_summary_isNull) {
							_content.tx_summary = SBO_DIC_Dic.insObject(
								_con,
								_sessionuser.IDApplication,
								OGen.NTier.Kick.lib.businesslayer.shared.TableFieldSource.NWS_CONTENT__TX_SUMMARY,
								tx_summary_in
							);
						} else {
							SBO_DIC_Dic.updObject(
								_con,
								_content.tx_summary,
								tx_summary_in
							);
						}
					}
					#endregion

					// preserve these:
					#region //content_in.IFUser__Aproved = _content.IFUser__Aproved;
					//if (_content.IFUser__Aproved_isNull) {
					//    content_in.IFUser__Aproved_isNull = true;
					//} else {
					//    content_in.IFUser__Aproved = _content.IFUser__Aproved;
					//} 
					#endregion
					#region //content_in.Aproved_date = _content.Aproved_date;
					//if (_content.Aproved_date_isNull) {
					//    content_in.Aproved_date_isNull = true;
					//} else {
					//    content_in.Aproved_date = _content.Aproved_date;
					//} 
					#endregion
					#region //content_in.Begin_date = _content.Begin_date;
					//if (_content.Begin_date_isNull) {
					//    content_in.Begin_date_isNull = true;
					//} else {
					//    content_in.Begin_date = _content.Begin_date;
					//} 
					#endregion
					#region //content_in.End_date = _content.End_date;
					//if (_content.End_date_isNull) {
					//    content_in.End_date_isNull = true;
					//} else {
					//    content_in.End_date = _content.End_date;
					//}
					#endregion

					//content_in.IFApplication = _content.IFApplication;
					//content_in.IFUser__Publisher = _content.IFUser__Publisher;
					//content_in.Publish_date = _content.Publish_date;
					#region //content_in.Newslettersent_date = _content.Newslettersent_date;
					//if (_content.Newslettersent_date_isNull) {
					//    content_in.Newslettersent_date_isNull = true;
					//} else {
					//    content_in.Newslettersent_date = _content.Newslettersent_date;
					//} 
					#endregion
					//content_in.isNews_notForum = true;

					DO_NWS_Content.updObject(
						_content,
						true,

						_con
					);
				}

				if (updateTags_in) DO_NWS_ContentTag.delRecord_byContent(content_in.IDContent, _con);
				if (updateAuthors_in) DO_NWS_ContentAuthor.delRecord_byContent(content_in.IDContent, _con);
				if (updateSources_in) DO_NWS_ContentSource.delRecord_byContent(content_in.IDContent, _con);
				if (updateHighlights_in) DO_NWS_ContentHighlight.delRecord_byContent(content_in.IDContent, _con);
				if (updateProfiles_in) DO_NWS_ContentProfile.delRecord_byContent(content_in.IDContent, _con);
				relate(
					idTags_in,
					idAuthors_in,
					idSources_in,
					idHighlights_in, 
					idProfiles_in, 

					content_in.IDContent,

					_con
				);

				_errorlist.Add(ErrorType.news__successfully_updated__WARNING);
				_con.Transaction.Commit();
			} 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.lib.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();
		}
コード例 #8
0
		public static long insObject(
			#region params...
			string sessionGuid_in,
			string ip_forLogPurposes_in, 

			SO_NWS_Content content_in,
			OGen.NTier.Kick.lib.datalayer.shared.structures.SO_DIC__TextLanguage[] tx_Title_in,
			OGen.NTier.Kick.lib.datalayer.shared.structures.SO_DIC__TextLanguage[] tx_Content_in,
			OGen.NTier.Kick.lib.datalayer.shared.structures.SO_DIC__TextLanguage[] tx_subtitle_in,
			OGen.NTier.Kick.lib.datalayer.shared.structures.SO_DIC__TextLanguage[] tx_summary_in,

			long[] idTags_in,
			long[] idAuthors_in,
			long[] idSources_in,
			long[] idHighlights_in, 
			long[] idProfiles_in, 

			//bool andApprove_in, 

			out int[] errors_out
			#endregion
		) {
			long _output = -1L;

			Guid _sessionguid;
			Sessionuser _sessionuser;

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

				ref content_in,
				tx_Title_in,
				tx_Content_in,
				tx_subtitle_in,
				tx_summary_in, 

				//andApprove_in, 

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

			Exception _exception = null;
			#region DBConnection _con = DO__utils.DBConnection_createInstance(...);
			DBConnection _con = DO__utils.DBConnection_createInstance(
				DO__utils.DBServerType,
				DO__utils.DBConnectionstring,
				DO__utils.DBLogfile
			); 
			#endregion
			try {
				_con.Open();
				_con.Transaction.Begin();

				#region content_in.TX_Title = ...;
				if (
					(tx_Title_in == null)
					||
					(tx_Title_in.Length == 0)
				) {
					content_in.TX_Title_isNull = true;
				} else {
					content_in.TX_Title = SBO_DIC_Dic.insObject(
						_con,

						_sessionuser.IDApplication,
						OGen.NTier.Kick.lib.businesslayer.shared.TableFieldSource.NWS_CONTENT__TX_TITLE,

						tx_Title_in
					);
				}
				#endregion
				#region content_in.TX_Content = ...;
				if (
					(tx_Content_in == null)
					||
					(tx_Content_in.Length == 0)
				) {
					content_in.TX_Content_isNull = true;
				} else {
					content_in.TX_Content = SBO_DIC_Dic.insObject(
						_con,

						_sessionuser.IDApplication,
						OGen.NTier.Kick.lib.businesslayer.shared.TableFieldSource.NWS_CONTENT__TX_CONTENT,

						tx_Content_in
					);
				}
				#endregion
				#region content_in.tx_subtitle = ...;
				if (
					(tx_subtitle_in == null)
					||
					(tx_subtitle_in.Length == 0)
				) {
					content_in.tx_subtitle_isNull = true;
				} else {
					content_in.tx_subtitle = SBO_DIC_Dic.insObject(
						_con,

						_sessionuser.IDApplication,
						OGen.NTier.Kick.lib.businesslayer.shared.TableFieldSource.NWS_CONTENT__TX_SUBTITLE,

						tx_subtitle_in
					);
				}
				#endregion
				#region content_in.tx_summary = ...;
				if (
					(tx_summary_in == null)
					||
					(tx_summary_in.Length == 0)
				) {
					content_in.tx_summary_isNull = true;
				} else {
					content_in.tx_summary = SBO_DIC_Dic.insObject(
						_con,

						_sessionuser.IDApplication,
						OGen.NTier.Kick.lib.businesslayer.shared.TableFieldSource.NWS_CONTENT__TX_SUMMARY,

						tx_summary_in
					);
				}
				#endregion

				content_in.IFUser__Aproved_isNull = true;
				content_in.Aproved_date_isNull = true;
				content_in.Begin_date
					= content_in.End_date
					= datetime_minvalue_;

				content_in.IFApplication = _sessionuser.IDApplication;
				content_in.IFUser__Publisher = _sessionuser.IDUser;
				content_in.Publish_date = DateTime.Now;
				content_in.Newslettersent_date_isNull = true;
				content_in.isNews_notForum = true;

				_output = DO_NWS_Content.insObject(
					content_in,
					true,

					_con
				);
				relate(
					idTags_in,
					idAuthors_in,
					idSources_in,
					idHighlights_in, 
					idProfiles_in, 

					_output,

					_con
				);

				_errorlist.Add(ErrorType.news__successfully_created__WARNING);
				_con.Transaction.Commit();
			} 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.lib.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;
		}
コード例 #9
0
		private static bool check(
			#region params...
			string sessionGuid_in,
			string ip_forLogPurposes_in, 

			ref SO_NWS_Content content_ref,
			OGen.NTier.Kick.lib.datalayer.shared.structures.SO_DIC__TextLanguage[] tx_Title_in,
			OGen.NTier.Kick.lib.datalayer.shared.structures.SO_DIC__TextLanguage[] tx_Content_in,
			OGen.NTier.Kick.lib.datalayer.shared.structures.SO_DIC__TextLanguage[] tx_subtitle_in,
			OGen.NTier.Kick.lib.datalayer.shared.structures.SO_DIC__TextLanguage[] tx_summary_in,

			//bool andApprove_in, 

			out Guid sessionGuid_out,
			out Sessionuser sessionUser_out,
			out List<int> errorlist_out
			#endregion
		) {
			#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 Permitions . . .
			bool _news__insert = sessionUser_out.hasPermition(PermitionType.News__insert);
			bool _news__update_Approved = sessionUser_out.hasPermition(PermitionType.News__update_Approved);
			bool _news__update_Mine_notApproved = sessionUser_out.hasPermition(PermitionType.News__update_Mine_notApproved);
			if (
				!(
					_news__insert
					||
					_news__update_Approved
					||
					_news__update_Mine_notApproved
				)
			) {
				errorlist_out.Add(ErrorType.news__lack_of_permitions_to_write);
				return false;
			}
			#endregion

//			#region check Content ...
#if !DEBUG
			if (
(profile_ref.Name = profile_ref.Name.Trim())
==
""
			) {
errors_out.Add(ErrorType.profile__invalid_name);
				return false;
			}
#endif

			//if (andApprove_in) {
			//    if (
			//        content_ref.Begin_date_isNull
			//        ||
			//        content_ref.End_date_isNull
			//        ||
			//        (content_ref.Begin_date < content_ref.End_date)
			//    ) {
			//        errors_out.Add(ErrorType.news__invalid_date);
			//        return false;
			//    } else if (credentials_out.hasPermition(PermitionType.News__approve)) {
			//        errors_out.Add(ErrorType.news__lack_of_permitions_to_approve);
			//        return false;
			//    } else {
			//        content_ref.IFUser__Aproved = credentials_out.IDUser;
			//        content_ref.Aproved_date = DateTime.Now;
			//        //content_in.Begin_date
			//        //content_in.End_date
			//    }
			//} else {
			//    content_ref.IFUser__Aproved_isNull = true;
			//    content_ref.Aproved_date_isNull = true;
			//    content_ref.Begin_date
			//        = content_ref.End_date
			//        = datetime_minvalue_;
			//}
//			#endregion

			return true;
		} 
コード例 #10
0
		public static DataTable getDataTable(
			SO_NWS_Content[] serializableobjects_in
		) {
			DataTable _output = new DataTable();
			DataRow _dr;

			DataColumn _dc_idcontent = new DataColumn("IDContent", typeof(long));
			_output.Columns.Add(_dc_idcontent);
			DataColumn _dc_ifapplication = new DataColumn("IFApplication", typeof(int));
			_output.Columns.Add(_dc_ifapplication);
			DataColumn _dc_ifuser__publisher = new DataColumn("IFUser__Publisher", typeof(long));
			_output.Columns.Add(_dc_ifuser__publisher);
			DataColumn _dc_publish_date = new DataColumn("Publish_date", typeof(DateTime));
			_output.Columns.Add(_dc_publish_date);
			DataColumn _dc_ifuser__aproved = new DataColumn("IFUser__Aproved", typeof(long));
			_output.Columns.Add(_dc_ifuser__aproved);
			DataColumn _dc_aproved_date = new DataColumn("Aproved_date", typeof(DateTime));
			_output.Columns.Add(_dc_aproved_date);
			DataColumn _dc_begin_date = new DataColumn("Begin_date", typeof(DateTime));
			_output.Columns.Add(_dc_begin_date);
			DataColumn _dc_end_date = new DataColumn("End_date", typeof(DateTime));
			_output.Columns.Add(_dc_end_date);
			DataColumn _dc_tx_title = new DataColumn("TX_Title", typeof(long));
			_output.Columns.Add(_dc_tx_title);
			DataColumn _dc_tx_content = new DataColumn("TX_Content", typeof(long));
			_output.Columns.Add(_dc_tx_content);
			DataColumn _dc_tx_subtitle = new DataColumn("tx_subtitle", typeof(long));
			_output.Columns.Add(_dc_tx_subtitle);
			DataColumn _dc_tx_summary = new DataColumn("tx_summary", typeof(long));
			_output.Columns.Add(_dc_tx_summary);
			DataColumn _dc_newslettersent_date = new DataColumn("Newslettersent_date", typeof(DateTime));
			_output.Columns.Add(_dc_newslettersent_date);
			DataColumn _dc_isnews_notforum = new DataColumn("isNews_notForum", typeof(bool));
			_output.Columns.Add(_dc_isnews_notforum);

			foreach (SO_NWS_Content _serializableobject in serializableobjects_in) {
				_dr = _output.NewRow();

				_dr[_dc_idcontent] = _serializableobject.IDContent;
				_dr[_dc_ifapplication] = _serializableobject.IFApplication;
				_dr[_dc_ifuser__publisher] = _serializableobject.IFUser__Publisher;
				_dr[_dc_publish_date] = _serializableobject.Publish_date;
				_dr[_dc_ifuser__aproved] = _serializableobject.IFUser__Aproved;
				_dr[_dc_aproved_date] = _serializableobject.Aproved_date;
				_dr[_dc_begin_date] = _serializableobject.Begin_date;
				_dr[_dc_end_date] = _serializableobject.End_date;
				_dr[_dc_tx_title] = _serializableobject.TX_Title;
				_dr[_dc_tx_content] = _serializableobject.TX_Content;
				_dr[_dc_tx_subtitle] = _serializableobject.tx_subtitle;
				_dr[_dc_tx_summary] = _serializableobject.tx_summary;
				_dr[_dc_newslettersent_date] = _serializableobject.Newslettersent_date;
				_dr[_dc_isnews_notforum] = _serializableobject.isNews_notForum;

				_output.Rows.Add(_dr);
			}

			return _output;
		}