示例#1
0
		public static long insObject(
			string sessionGuid_in,
			string ip_forLogPurposes_in, 

			SO_NWS_Highlight highlight_in, 
			bool selectIdentity_in, 

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

			Guid _sessionguid;
			Sessionuser _sessionuser;

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

				ref highlight_in,

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

			if (_sessionuser.hasPermission(PermissionType.Highlight__approve)) {
				highlight_in.Approved_date = DateTime.Now;
				highlight_in.IFUser__Approved = _sessionuser.IDUser;
			} else {
				highlight_in.Approved_date_isNull = true;
				highlight_in.IFUser__Approved_isNull = true;
			}
			highlight_in.IFApplication = _sessionuser.IDApplication;
			_output = DO_NWS_Highlight.insObject(
				highlight_in,
				selectIdentity_in,

				null
			);
			_errorlist.Add(ErrorType.highlight__successfully_created__WARNING);

			errors_out = _errorlist.ToArray();
			return _output;
		} 
示例#2
0
		public static SO_NWS_Highlight getObject(
			string sessionGuid_in,
			string ip_forLogPurposes_in, 

			long idHighlight_in,

			out int[] errors_out
		) {
			SO_NWS_Highlight _output = null;
			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 _output;
			}
			#endregion
			#region check Permissions...
			if (
				!_sessionuser.hasPermission(
					PermissionType.Highlight__select
				)
			) {
				_errorlist.Add(ErrorType.highlight__lack_of_permissions_to_read);
				errors_out = _errorlist.ToArray();
				return _output;
			}
			#endregion

			_output = DO_NWS_Highlight.getObject(
				idHighlight_in,

				null
			);

			errors_out = _errorlist.ToArray();
			return _output;
		}
示例#3
0
		public static void delObject(
			string sessionGuid_in,
			string ip_forLogPurposes_in, 

			long idHighlight_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.Highlight__delete
				)
			) {
				_errorlist.Add(ErrorType.highlight__lack_of_permissions_to_delete);
				errors_out = _errorlist.ToArray();
				return;
			}
			#endregion
			#region check existence...
			SO_NWS_Highlight _highlight;
			if (
				idHighlight_in <= 0
				||
				(
					(_highlight = DO_NWS_Highlight.getObject(
						idHighlight_in
					)) == null
				)
			) {
				_errorlist.Add(ErrorType.data__not_found);
				errors_out = _errorlist.ToArray();
				return;
			}
			#endregion
			#region check Permissions... (more)
			if (
				// is approved
				(
					!_highlight.IFUser__Approved_isNull
					||
					!_highlight.Approved_date_isNull
				)
				&&
				// and no permission to approve
				!_sessionuser.hasPermission(
					PermissionType.Highlight__approve
				)
			) {
				_errorlist.Add(ErrorType.highlight__lack_of_permissions_to_delete_approved);
				errors_out = _errorlist.ToArray();
				return;
			}
			#endregion
			#region check References...
			if (
				(DO_NWS_ContentHighlight.getCount_inRecord_byHighlight(
					idHighlight_in
				) > 0)
				||
				(DO_NWS_Highlight.getCount_inRecord_byParent(
					idHighlight_in
				) > 0)
			) {
				_errorlist.Add(ErrorType.data__constraint_violation);
				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_NWS_Highlight.delObject(
					idHighlight_in,

					_con
				);

				_errorlist.Add(ErrorType.highlight__successfully_deleted__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();
		}
示例#4
0
		public static void updObject_Approve(
			string sessionGuid_in,
			string ip_forLogPurposes_in, 

			long idHighlight_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.Highlight__approve
				)
			) {
				_errorlist.Add(ErrorType.highlight__lack_of_permissions_to_approve);
				errors_out = _errorlist.ToArray();
				return;
			}
			#endregion
			#region check existence . . .
			SO_NWS_Highlight _highlight;
			if (
				idHighlight_in <= 0
				||
				(
					(_highlight = DO_NWS_Highlight.getObject(
						idHighlight_in
					)) == null
				)
			) {
				_errorlist.Add(ErrorType.data__not_found);
				errors_out = _errorlist.ToArray();
				return;
			}
			#endregion

			_highlight.Approved_date = DateTime.Now;
			_highlight.IFUser__Approved = _sessionuser.IDUser;
			DO_NWS_Highlight.updObject(
				_highlight,
				true,

				null
			);
			_errorlist.Add(ErrorType.highlight__successfully_approved__WARNING);

			errors_out = _errorlist.ToArray();
		}
示例#5
0
		public static void updObject(
			string sessionGuid_in,
			string ip_forLogPurposes_in, 

			SO_NWS_Highlight highlight_in,

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

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

				ref highlight_in,

				out _sessionguid,
				out _sessionuser,
				out _errorlist
			)) {
				errors_out = _errorlist.ToArray();
				return;
			}
			#endregion
			#region check existence . . .
			SO_NWS_Highlight _highlight;
			if (
				highlight_in.IDHighlight <= 0
				||
				(
					(_highlight = DO_NWS_Highlight.getObject(
						highlight_in.IDHighlight
					)) == null
				)
			) {
				_errorlist.Add(ErrorType.data__not_found);
				errors_out = _errorlist.ToArray();
				return;
			}
			#endregion

			if (
				_highlight.IFUser__Approved_isNull
				||
				_highlight.Approved_date_isNull
			) {
				if (_sessionuser.hasPermission(PermissionType.Highlight__approve)) {
					highlight_in.Approved_date = DateTime.Now;
					highlight_in.IFUser__Approved = _sessionuser.IDUser;
				} else {
					highlight_in.Approved_date_isNull = true;
					highlight_in.IFUser__Approved_isNull = true;
				}
			} else {
				highlight_in.Approved_date = _highlight.Approved_date;
				highlight_in.IFUser__Approved = _highlight.IFUser__Approved;
			}

			highlight_in.IFApplication = _highlight.IFApplication;
			DO_NWS_Highlight.updObject(
				highlight_in,
				true,

				null
			);
			_errorlist.Add(ErrorType.highlight__successfully_updated__WARNING);

			errors_out = _errorlist.ToArray();
		}