/// <summary> /// Updates NWS_Author 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_Author NWS_Author_in, bool forceUpdate_in, DBConnection dbConnection_in ) { if (forceUpdate_in || NWS_Author_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("IDAuthor_", DbType.Int64, ParameterDirection.Input, NWS_Author_in.IDAuthor, 0), _connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Input, NWS_Author_in.IFApplication_isNull ? null : (object)NWS_Author_in.IFApplication, 0), _connection.newDBDataParameter("Name_", DbType.AnsiString, ParameterDirection.Input, NWS_Author_in.Name, 255), _connection.newDBDataParameter("IFUser__Approved_", DbType.Int64, ParameterDirection.Input, NWS_Author_in.IFUser__Approved_isNull ? null : (object)NWS_Author_in.IFUser__Approved, 0), _connection.newDBDataParameter("Approved_date_", DbType.DateTime, ParameterDirection.Input, NWS_Author_in.Approved_date_isNull ? null : (object)NWS_Author_in.Approved_date, 0) }; _connection.Execute_SQLFunction( "sp0_NWS_Author_updObject", _dataparameters ); if (dbConnection_in == null) { _connection.Dispose(); } NWS_Author_in.HasChanges = false; } }
/// <summary> /// Selects NWS_Author values from Database and assigns them to the appropriate DO_NWS_Author property. /// </summary> /// <param name="IDAuthor_in">IDAuthor</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_Author doesn't exists at Database</returns> public static SO_NWS_Author getObject( long IDAuthor_in, DBConnection dbConnection_in ) { SO_NWS_Author _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("IDAuthor_", DbType.Int64, ParameterDirection.InputOutput, IDAuthor_in, 0), _connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("Name_", DbType.AnsiString, ParameterDirection.Output, null, 255), _connection.newDBDataParameter("IFUser__Approved_", DbType.Int64, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("Approved_date_", DbType.DateTime, ParameterDirection.Output, null, 0) }; _connection.Execute_SQLFunction("sp0_NWS_Author_getObject", _dataparameters); if (dbConnection_in == null) { _connection.Dispose(); } if (_dataparameters[0].Value != DBNull.Value) { _output = new SO_NWS_Author(); if (_dataparameters[0].Value == System.DBNull.Value) { _output.IDAuthor = 0L; } else { _output.IDAuthor = (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.Name = string.Empty; } else { _output.Name = (string)_dataparameters[2].Value; } if (_dataparameters[3].Value == System.DBNull.Value) { _output.IFUser__Approved_isNull = true; } else { _output.IFUser__Approved = (long)_dataparameters[3].Value; } if (_dataparameters[4].Value == System.DBNull.Value) { _output.Approved_date_isNull = true; } else { _output.Approved_date = (DateTime)_dataparameters[4].Value; } _output.haschanges_ = false; return _output; } return null; }
public void BTN_Save_Click(object sender, EventArgs e) { int[] _errors; SO_NWS_Author _author; if ( #region ((_author = ...) != null) (this.IDAuthor > 0) && ( (_author = BusinessInstances.NWS_Author.InstanceClient.getObject( Utilities.User.SessionGuid, Utilities.ClientIPAddress, this.IDAuthor, out _errors )) != null ) && !this.Master__base.Error_add(_errors) #endregion ) { _author.Name = this.TXT_Name.Text; BusinessInstances.NWS_Author.InstanceClient.updObject( Utilities.User.SessionGuid, Utilities.ClientIPAddress, _author, out _errors ); } else { _author = new SO_NWS_Author(); _author.Name = this.TXT_Name.Text; _author.Approved_date_isNull = true; _author.IFUser__Approved_isNull = true; //_author.IFApplication = Utilities.IDApplication; BusinessInstances.NWS_Author.InstanceClient.insObject( Utilities.User.SessionGuid, Utilities.ClientIPAddress, _author, false, out _errors ); } if (!this.Master__base.Error_add(_errors)) { Response.Redirect( "NWS-NewsAuthor-list.aspx", true ); } }
public static long insObject( string sessionGuid_in, string ip_forLogPurposes_in, SO_NWS_Author author_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 author_in, out _sessionguid, out _sessionuser, out _errorlist )) { errors_out = _errorlist.ToArray(); return(_output); } #endregion if (_sessionuser.hasPermission(PermissionType.Author__approve)) { author_in.Approved_date = DateTime.Now; author_in.IFUser__Approved = _sessionuser.IDUser; } else { author_in.Approved_date_isNull = true; author_in.IFUser__Approved_isNull = true; } author_in.IFApplication = _sessionuser.IDApplication; _output = DO_NWS_Author.insObject( author_in, selectIdentity_in, null ); _errorlist.Add(ErrorType.author__successfully_created__WARNING); errors_out = _errorlist.ToArray(); return(_output); }
/// <summary> /// Updates NWS_Author 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_Author NWS_Author_in, bool forceUpdate_in ) { updObject( NWS_Author_in, forceUpdate_in, null ); }
/// <summary> /// Inserts NWS_Author 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_Author NWS_Author_in, bool selectIdentity_in ) { return(insObject( NWS_Author_in, selectIdentity_in, null )); }
public static SO_NWS_Author getObject( string sessionGuid_in, string ip_forLogPurposes_in, long idAuthor_in, out int[] errors_out ) { SO_NWS_Author _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.Author__select ) ) { _errorlist.Add(ErrorType.author__lack_of_permissions_to_read); errors_out = _errorlist.ToArray(); return(_output); } #endregion _output = DO_NWS_Author.getObject( idAuthor_in, null ); errors_out = _errorlist.ToArray(); return(_output); }
/// <summary> /// Inserts NWS_Author 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_Author NWS_Author_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("IDAuthor_", DbType.Int64, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Input, NWS_Author_in.IFApplication_isNull ? null : (object)NWS_Author_in.IFApplication, 0), _connection.newDBDataParameter("Name_", DbType.AnsiString, ParameterDirection.Input, NWS_Author_in.Name, 255), _connection.newDBDataParameter("IFUser__Approved_", DbType.Int64, ParameterDirection.Input, NWS_Author_in.IFUser__Approved_isNull ? null : (object)NWS_Author_in.IFUser__Approved, 0), _connection.newDBDataParameter("Approved_date_", DbType.DateTime, ParameterDirection.Input, NWS_Author_in.Approved_date_isNull ? null : (object)NWS_Author_in.Approved_date, 0), _connection.newDBDataParameter("SelectIdentity_", DbType.Boolean, ParameterDirection.Input, selectIdentity_in, 1) }; _connection.Execute_SQLFunction( "sp0_NWS_Author_insObject", _dataparameters ); if (dbConnection_in == null) { _connection.Dispose(); } NWS_Author_in.IDAuthor = (long)_dataparameters[0].Value; NWS_Author_in.HasChanges = false; return(NWS_Author_in.IDAuthor); }
private static SO_NWS_Author[] getRecord( DataTable dataTable_in ) { DataColumn _dc_idauthor = null; DataColumn _dc_ifapplication = null; DataColumn _dc_name = null; DataColumn _dc_ifuser__approved = null; DataColumn _dc_approved_date = null; SO_NWS_Author[] _output = new SO_NWS_Author[dataTable_in.Rows.Count]; for (int r = 0; r < dataTable_in.Rows.Count; r++) { if (r == 0) { _dc_idauthor = dataTable_in.Columns["IDAuthor"]; _dc_ifapplication = dataTable_in.Columns["IFApplication"]; _dc_name = dataTable_in.Columns["Name"]; _dc_ifuser__approved = dataTable_in.Columns["IFUser__Approved"]; _dc_approved_date = dataTable_in.Columns["Approved_date"]; } _output[r] = new SO_NWS_Author(); if (dataTable_in.Rows[r][_dc_idauthor] == System.DBNull.Value) { _output[r].idauthor_ = 0L; } else { _output[r].idauthor_ = (long)dataTable_in.Rows[r][_dc_idauthor]; } 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_name] == System.DBNull.Value) { _output[r].name_ = string.Empty; } else { _output[r].name_ = (string)dataTable_in.Rows[r][_dc_name]; } if (dataTable_in.Rows[r][_dc_ifuser__approved] == System.DBNull.Value) { _output[r].IFUser__Approved_isNull = true; } else { _output[r].ifuser__approved_ = (long)dataTable_in.Rows[r][_dc_ifuser__approved]; } if (dataTable_in.Rows[r][_dc_approved_date] == System.DBNull.Value) { _output[r].Approved_date_isNull = true; } else { _output[r].approved_date_ = (DateTime)dataTable_in.Rows[r][_dc_approved_date]; } _output[r].haschanges_ = false; } return _output; }
public static void updObject( string sessionGuid_in, string ip_forLogPurposes_in, SO_NWS_Author author_in, out int[] errors_out ) { Guid _sessionguid; Sessionuser _sessionuser; #region check... List <int> _errorlist; if (!check( sessionGuid_in, ip_forLogPurposes_in, ref author_in, out _sessionguid, out _sessionuser, out _errorlist )) { errors_out = _errorlist.ToArray(); return; } #endregion #region check existence... SO_NWS_Author _author; if ( author_in.IDAuthor <= 0 || ( (_author = DO_NWS_Author.getObject( author_in.IDAuthor )) == null ) ) { _errorlist.Add(ErrorType.data__not_found); errors_out = _errorlist.ToArray(); return; } #endregion if ( _author.IFUser__Approved_isNull || _author.Approved_date_isNull ) { if (_sessionuser.hasPermission(PermissionType.Author__approve)) { author_in.Approved_date = DateTime.Now; author_in.IFUser__Approved = _sessionuser.IDUser; } else { author_in.Approved_date_isNull = true; author_in.IFUser__Approved_isNull = true; } } else { author_in.Approved_date = _author.Approved_date; author_in.IFUser__Approved = _author.IFUser__Approved; } author_in.IFApplication = _author.IFApplication; DO_NWS_Author.updObject( author_in, true, null ); _errorlist.Add(ErrorType.author__successfully_updated__WARNING); errors_out = _errorlist.ToArray(); }
/// <summary> /// Updates NWS_Author 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_Author NWS_Author_in, bool forceUpdate_in, DBConnection dbConnection_in ) { if (forceUpdate_in || NWS_Author_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("IDAuthor_", DbType.Int64, ParameterDirection.Input, NWS_Author_in.IDAuthor, 0), _connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Input, NWS_Author_in.IFApplication_isNull ? null : (object)NWS_Author_in.IFApplication, 0), _connection.newDBDataParameter("Name_", DbType.AnsiString, ParameterDirection.Input, NWS_Author_in.Name, 255), _connection.newDBDataParameter("IFUser__Approved_", DbType.Int64, ParameterDirection.Input, NWS_Author_in.IFUser__Approved_isNull ? null : (object)NWS_Author_in.IFUser__Approved, 0), _connection.newDBDataParameter("Approved_date_", DbType.DateTime, ParameterDirection.Input, NWS_Author_in.Approved_date_isNull ? null : (object)NWS_Author_in.Approved_date, 0) }; _connection.Execute_SQLFunction( "sp0_NWS_Author_updObject", _dataparameters ); if (dbConnection_in == null) { _connection.Dispose(); } NWS_Author_in.haschanges_ = false; } }
/// <summary> /// Inserts NWS_Author 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_Author NWS_Author_in, bool selectIdentity_in ) { return insObject( NWS_Author_in, selectIdentity_in, null ); }
/// <summary> /// Inserts NWS_Author 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_Author NWS_Author_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("IDAuthor_", DbType.Int64, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Input, NWS_Author_in.IFApplication_isNull ? null : (object)NWS_Author_in.IFApplication, 0), _connection.newDBDataParameter("Name_", DbType.AnsiString, ParameterDirection.Input, NWS_Author_in.Name, 255), _connection.newDBDataParameter("IFUser__Approved_", DbType.Int64, ParameterDirection.Input, NWS_Author_in.IFUser__Approved_isNull ? null : (object)NWS_Author_in.IFUser__Approved, 0), _connection.newDBDataParameter("Approved_date_", DbType.DateTime, ParameterDirection.Input, NWS_Author_in.Approved_date_isNull ? null : (object)NWS_Author_in.Approved_date, 0), _connection.newDBDataParameter("SelectIdentity_", DbType.Boolean, ParameterDirection.Input, selectIdentity_in, 1) }; _connection.Execute_SQLFunction( "sp0_NWS_Author_insObject", _dataparameters ); if (dbConnection_in == null) { _connection.Dispose(); } NWS_Author_in.IDAuthor = (long)_dataparameters[0].Value;NWS_Author_in.haschanges_ = false; return NWS_Author_in.IDAuthor; }
private static SO_NWS_Author[] getRecord( DataTable dataTable_in ) { DataColumn _dc_idauthor = null; DataColumn _dc_ifapplication = null; DataColumn _dc_name = null; DataColumn _dc_ifuser__approved = null; DataColumn _dc_approved_date = null; SO_NWS_Author[] _output = new SO_NWS_Author[dataTable_in.Rows.Count]; for (int r = 0; r < dataTable_in.Rows.Count; r++) { if (r == 0) { _dc_idauthor = dataTable_in.Columns["IDAuthor"]; _dc_ifapplication = dataTable_in.Columns["IFApplication"]; _dc_name = dataTable_in.Columns["Name"]; _dc_ifuser__approved = dataTable_in.Columns["IFUser__Approved"]; _dc_approved_date = dataTable_in.Columns["Approved_date"]; } _output[r] = new SO_NWS_Author(); if (dataTable_in.Rows[r][_dc_idauthor] == System.DBNull.Value) { _output[r].IDAuthor = 0L; } else { _output[r].IDAuthor = (long)dataTable_in.Rows[r][_dc_idauthor]; } 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_name] == System.DBNull.Value) { _output[r].Name = string.Empty; } else { _output[r].Name = (string)dataTable_in.Rows[r][_dc_name]; } if (dataTable_in.Rows[r][_dc_ifuser__approved] == System.DBNull.Value) { _output[r].IFUser__Approved_isNull = true; } else { _output[r].IFUser__Approved = (long)dataTable_in.Rows[r][_dc_ifuser__approved]; } if (dataTable_in.Rows[r][_dc_approved_date] == System.DBNull.Value) { _output[r].Approved_date_isNull = true; } else { _output[r].Approved_date = (DateTime)dataTable_in.Rows[r][_dc_approved_date]; } _output[r].HasChanges = false; } return(_output); }
/// <summary> /// Selects NWS_Author values from Database and assigns them to the appropriate DO_NWS_Author property. /// </summary> /// <param name="IDAuthor_in">IDAuthor</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_Author doesn't exists at Database</returns> public static SO_NWS_Author getObject( long IDAuthor_in, DBConnection dbConnection_in ) { SO_NWS_Author _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("IDAuthor_", DbType.Int64, ParameterDirection.InputOutput, IDAuthor_in, 0), _connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("Name_", DbType.AnsiString, ParameterDirection.Output, null, 255), _connection.newDBDataParameter("IFUser__Approved_", DbType.Int64, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("Approved_date_", DbType.DateTime, ParameterDirection.Output, null, 0) }; _connection.Execute_SQLFunction("sp0_NWS_Author_getObject", _dataparameters); if (dbConnection_in == null) { _connection.Dispose(); } if (_dataparameters[0].Value != DBNull.Value) { _output = new SO_NWS_Author(); if (_dataparameters[0].Value == System.DBNull.Value) { _output.IDAuthor = 0L; } else { _output.IDAuthor = (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.Name = string.Empty; } else { _output.Name = (string)_dataparameters[2].Value; } if (_dataparameters[3].Value == System.DBNull.Value) { _output.IFUser__Approved_isNull = true; } else { _output.IFUser__Approved = (long)_dataparameters[3].Value; } if (_dataparameters[4].Value == System.DBNull.Value) { _output.Approved_date_isNull = true; } else { _output.Approved_date = (DateTime)_dataparameters[4].Value; } _output.HasChanges = false; return(_output); } return(null); }
private static bool check( string sessionGuid_in, string ip_forLogPurposes_in, ref SO_NWS_Author author_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.Author__insert, PermissionType.Author__update ) ) { errorlist_out.Add(ErrorType.author__lack_of_permissions_to_write); return(false); } if ( !sessionUser_out.hasPermission(PermissionType.Author__approve) && ( !author_ref.Approved_date_isNull || !author_ref.IFUser__Approved_isNull ) ) { errorlist_out.Add(ErrorType.author__lack_of_permissions_to_approve); return(false); } #endregion #region check Author... if ( (author_ref.Name = author_ref.Name.Trim()).Length == 0 ) { errorlist_out.Add(ErrorType.author__invalid_name); return(false); } #endregion return(true); }
public static long insObject( string sessionGuid_in, string ip_forLogPurposes_in, SO_NWS_Author author_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 author_in, out _sessionguid, out _sessionuser, out _errorlist )) { errors_out = _errorlist.ToArray(); return _output; } #endregion if (_sessionuser.hasPermition(PermitionType.Author__approve)) { author_in.Approved_date = DateTime.Now; author_in.IFUser__Approved = _sessionuser.IDUser; } else { author_in.Approved_date_isNull = true; author_in.IFUser__Approved_isNull = true; } author_in.IFApplication = _sessionuser.IDApplication; _output = DO_NWS_Author.insObject( author_in, selectIdentity_in, null ); _errorlist.Add(ErrorType.author__successfully_created__WARNING); errors_out = _errorlist.ToArray(); return _output; }
public static void updObject( string sessionGuid_in, string ip_forLogPurposes_in, SO_NWS_Author author_in, out int[] errors_out ) { Guid _sessionguid; Sessionuser _sessionuser; #region check... List<int> _errorlist; if (!check( sessionGuid_in, ip_forLogPurposes_in, ref author_in, out _sessionguid, out _sessionuser, out _errorlist )) { errors_out = _errorlist.ToArray(); return; } #endregion #region check existence... SO_NWS_Author _author; if ( author_in.IDAuthor <= 0 || ( (_author = DO_NWS_Author.getObject( author_in.IDAuthor )) == null ) ) { _errorlist.Add(ErrorType.data__not_found); errors_out = _errorlist.ToArray(); return; } #endregion if ( _author.IFUser__Approved_isNull || _author.Approved_date_isNull ) { if (_sessionuser.hasPermition(PermitionType.Author__approve)) { author_in.Approved_date = DateTime.Now; author_in.IFUser__Approved = _sessionuser.IDUser; } else { author_in.Approved_date_isNull = true; author_in.IFUser__Approved_isNull = true; } } else { author_in.Approved_date = _author.Approved_date; author_in.IFUser__Approved = _author.IFUser__Approved; } author_in.IFApplication = _author.IFApplication; DO_NWS_Author.updObject( author_in, true, null ); _errorlist.Add(ErrorType.author__successfully_updated__WARNING); errors_out = _errorlist.ToArray(); }
private static bool check( string sessionGuid_in, string ip_forLogPurposes_in, ref SO_NWS_Author author_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 Permitions... if ( !sessionUser_out.hasPermition( false, PermitionType.Author__insert, PermitionType.Author__update ) ) { errorlist_out.Add(ErrorType.author__lack_of_permitions_to_write); return false; } if ( !sessionUser_out.hasPermition(PermitionType.Author__approve) && ( !author_ref.Approved_date_isNull || !author_ref.IFUser__Approved_isNull ) ) { errorlist_out.Add(ErrorType.author__lack_of_permitions_to_approve); return false; } #endregion #region check Author... if ( (author_ref.Name = author_ref.Name.Trim()) == "" ) { errorlist_out.Add(ErrorType.author__invalid_name); return false; } #endregion return true; }