public DictionaryResponse GetDictionaryEntries(ClientAuthStruct auth, int type, int state) { DictionaryResponse response = new DictionaryResponse(); ClientInterface.DictionaryResponse responseProxy = client.GetDictionaryEntries(GetAuthData(auth), type, state); response.ErrorCode = responseProxy.ErrorCode; response.ErrorDescription = responseProxy.ErrorDescription; if (responseProxy.DictionaryTable != null && responseProxy.DictionaryTable.Length > 0) { response.DictionaryTable = new DictionaryEntry[responseProxy.DictionaryTable.Length]; for (int i = 0; i < responseProxy.DictionaryTable.Length; i++) { response.DictionaryTable[i] = new DictionaryEntry(); response.DictionaryTable[i].Active = responseProxy.DictionaryTable[i].Active; response.DictionaryTable[i].Assembly = responseProxy.DictionaryTable[i].Assembly; response.DictionaryTable[i].Config = responseProxy.DictionaryTable[i].Config; response.DictionaryTable[i].Guid = responseProxy.DictionaryTable[i].Guid; response.DictionaryTable[i].Name = responseProxy.DictionaryTable[i].Name; response.DictionaryTable[i].Type = (MWRCommonTypes.Enum.ObjectType)(int)responseProxy.DictionaryTable[i].Type; response.DictionaryTable[i].TypeOf = responseProxy.DictionaryTable[i].TypeOf; } } return response; }
protected DictionaryResponse GetDictionaries(ClientRequestHandler handler, object[] arguments) { DictionaryResponse response = new DictionaryResponse(); response.DictionaryTable = handler.GetDictionaryEntries((int)arguments[0], (int)arguments[1]); response.ErrorCode = 0; return response; }
protected DictionaryResponse CommonResponse(ServerInterface.DictionaryResponse servResponse) { DictionaryResponse response = new DictionaryResponse(); if (servResponse.ErrorCode == 0) { response.DictionaryTable = new MWRCommonTypes.DictionaryEntry[servResponse.DictionaryTable.Length]; for (int i = 0; i < servResponse.DictionaryTable.Length; i++) { MWRCommonTypes.DictionaryEntry entry = new MWRCommonTypes.DictionaryEntry(); entry.Active = servResponse.DictionaryTable[i].Active; entry.Assembly = servResponse.DictionaryTable[i].Assembly; entry.Config = servResponse.DictionaryTable[i].Config; entry.Guid = servResponse.DictionaryTable[i].Guid; entry.Name = servResponse.DictionaryTable[i].Name; entry.Type = (MWRCommonTypes.Enum.ObjectType)(int)servResponse.DictionaryTable[i].Type; entry.TypeOf = servResponse.DictionaryTable[i].TypeOf; response.DictionaryTable[i] = entry; } } response.ErrorCode = servResponse.ErrorCode; response.ErrorDescription = servResponse.ErrorDescription; return response; }
protected DictionaryResponse GetDictionaryList(GetDictionaryListDelegate method, ServerAuthStruct auth) { DictionaryResponse response = new DictionaryResponse(); ServerRequestHandler handler = new ServerRequestHandler(); try { if (!handler.Authorize(auth)) { response.ErrorCode = (int)ResponseCode.AuthorizationFailed; LoggerHelper.Log(LogCategories.ServerRequest, LogEventID.AuthorizationFailed, System.Diagnostics.TraceEventType.Error, string.Format("Błąd autoryzacji - maszyna {0}", auth.MachineGuid)); return response; } List<MWRCommonTypes.DictionaryEntry> list = method.Invoke(); if (list.Count == 0) { response.ErrorCode = (int)ResponseCode.RequestedObjectNotFound; LoggerHelper.Log(LogCategories.ServerRequest, LogEventID.BusinessError, System.Diagnostics.TraceEventType.Warning, "Nie odnaleziono żadnych obiektów słownikowych."); return response; } response.DictionaryTable = list.ToArray(); response.ErrorCode = (int)ResponseCode.OK; LoggerHelper.Log(LogCategories.ServerRequest, LogEventID.OK, System.Diagnostics.TraceEventType.Information, "Lista słownikowa pobrana pomyślnie."); return response; } catch (Exception exc) { response.ErrorCode = (int)ResponseCode.ProxyServerError; response.ErrorDescription = exc.ToString(); LoggerHelper.Log(LogCategories.ServerRequest, LogEventID.InternalError, System.Diagnostics.TraceEventType.Error, "Wystąpił błąd podczas pobierania listy słownikowej - " + exc.ToString()); } finally { handler.Dispose(); } return response; }