public static void updObject_Approve( string sessionGuid_in, string ip_forLogPurposes_in, long idAuthor_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.Author__approve ) ) { _errorlist.Add(ErrorType.author__lack_of_permissions_to_approve); errors_out = _errorlist.ToArray(); return; } #endregion #region check existence... SO_NWS_Author _author; if ( idAuthor_in <= 0 || ( (_author = DO_NWS_Author.getObject( idAuthor_in )) == null ) ) { _errorlist.Add(ErrorType.data__not_found); errors_out = _errorlist.ToArray(); return; } #endregion _author.Approved_date = DateTime.Now; _author.IFUser__Approved = _sessionuser.IDUser; DO_NWS_Author.updObject( _author, true, null ); _errorlist.Add(ErrorType.author__successfully_approved__WARNING); errors_out = _errorlist.ToArray(); }
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(); }