/// <summary> /// Loads from database. /// </summary> /// <param name="database">The database.</param> /// <returns>True if success, else false</returns> public virtual bool LoadFromDatabase(IDatabase database) { DatabaseRecordSet recordSet = new DatabaseRecordSet(database); string sql = @"SELECT json, error, errorcode, response, titleLine, detailsLine, imageName, serverRequestNumber, servertime, sessionid, translationkey, relatedInfo, baseerror, appversion, errorstack FROM requests WHERE requestnr = ?"; recordSet.Query.Prepare(sql); recordSet.Query.Bind(1, this.RequestNr); int ret = recordSet.Execute(); if (ret == 0 && recordSet.GetRowCount() > 0) { this.Loaded = true; DatabaseRow row = recordSet.GetRow(0); this.Json = row.GetColumn(0); this.blockExecution = false; if (!row.IsNull(1)) { string cError = row.GetColumn(1); if (cError == Constants.OFFLINEREQUEST_BLOCKED_TEXT) { this.blockExecution = true; } this.Error = row.GetColumn(1); } this.Code = row.GetColumnInt(2, -1); if (!row.IsNull(3)) { this.Response = row.GetColumn(3); } if (!row.IsNull(4)) { this.titleLine = row.GetColumn(4); } if (!row.IsNull(5)) { this.detailsLine = row.GetColumn(5); } if (!row.IsNull(6)) { this.imageName = row.GetColumn(6); } if (!row.IsNull(7)) { this.ServerRequestNumber = row.GetColumnInt(7); } if (!row.IsNull(8)) { this.ServerDateTime = row.GetColumn(8); } if (!row.IsNull(9)) { this.ServerSessionId = row.GetColumn(9); } if (!row.IsNull(10)) { this.ErrorTranslationKey = row.GetColumn(10); } if (!row.IsNull(11)) { string _relatedInfo = row.GetColumn(11); this.RelatedInfoDictionary = _relatedInfo.JsonDictionaryFromString(); } if (!row.IsNull(12)) { this.BaseErrorCode = row.GetColumnInt(12); } if (!row.IsNull(13)) { this.ApplicationVersion = row.GetColumn(13); } if (!row.IsNull(14)) { this.ErrorStack = row.GetColumn(14); } return(true); } return(false); }