Beispiel #1
0
 public ProxyServer.BusinessLayer.GroupTaskResponse GetTasks(ProxyServer.BusinessLayer.ServerAuthStruct auth)
 {
     GroupTaskResponse grResp = new GroupTaskResponse();
     ServerInterface.GroupTaskResponse locRes = soapClient.GetTasks(GetAuth(auth));
     grResp.ErrorCode = locRes.ErrorCode;
     grResp.ErrorDescription = locRes.ErrorDescription;
     if (grResp.ErrorCode != 0)
     {
         return grResp;
     }
     grResp.Tasks = new MWRCommonTypes.TaskStruct[locRes.Tasks.Length];
     for (int i = 0; i < locRes.Tasks.Length; i++)
     {
         grResp.Tasks[i] = new MWRCommonTypes.TaskStruct();
         grResp.Tasks[i].DateChecked = locRes.Tasks[i].DateChecked;
         grResp.Tasks[i].DateCompleted = locRes.Tasks[i].DateCompleted;
         grResp.Tasks[i].DateRegistered = locRes.Tasks[i].DateRegistered;
         grResp.Tasks[i].DateSended = locRes.Tasks[i].DateSended;
         grResp.Tasks[i].Guid = locRes.Tasks[i].Guid;
         grResp.Tasks[i].ID = locRes.Tasks[i].ID;
         grResp.Tasks[i].Machine = locRes.Tasks[i].Machine;
         grResp.Tasks[i].State = locRes.Tasks[i].State;
         grResp.Tasks[i].XmlRequest = locRes.Tasks[i].XmlRequest;
         grResp.Tasks[i].XmlResponse = locRes.Tasks[i].XmlResponse;
     }
     return grResp;
 }
        public GroupTaskResponse GetTasks(ServerAuthStruct auth)
        {
            GroupTaskResponse response = new GroupTaskResponse();
            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;
                }

                TaskStruct[] taski = handler.GetTasks(auth.MachineGuid);
                if (taski == null)
                {
                    response.ErrorCode = (int)ResponseCode.RequestedObjectNotFound;
                    LoggerHelper.Log(LogCategories.ServerRequest, LogEventID.OK, System.Diagnostics.TraceEventType.Information, "GetTasks - brak tasków do wykonania");
                    return response;
                }

                response.Tasks = taski;
                response.ErrorCode = (int)ResponseCode.OK;
                LoggerHelper.Log(LogCategories.ServerRequest, LogEventID.OK, System.Diagnostics.TraceEventType.Information, string.Format("GetTasks - pobrano {0} tasków do wykonania", taski.Length.ToString()));
                return response;
            }
            catch (Exception exc)
            {
                response.ErrorCode = (int)ResponseCode.ProxyServerError;
                response.ErrorDescription = exc.ToString();
                return response;
            }
            finally
            {
                handler.Dispose();
            }
        }
 protected GroupTaskResponse GetTasks(ClientRequestHandler handler, object[] arguments)
 {
     GroupTaskResponse response = new GroupTaskResponse();
     response.Tasks = handler.GetTasks((string)arguments[0], (DateTime)arguments[1], (DateTime)arguments[2], (int [])arguments[3], (string)arguments[4], (int)arguments[5], (int)arguments[6], out response.TotalCount);
     response.ErrorCode = 0;
     return response;
 }
Beispiel #4
0
        public GroupTaskResponse GetTasks(ClientAuthStruct auth, DateTime dateFrom, DateTime dateTo, int[] states, string guid, int startIndex, int rowsCount)
        {
            GroupTaskResponse response = new GroupTaskResponse();
            ClientInterface.ArrayOfInt arrayStates = new MWRClientLib.ClientInterface.ArrayOfInt();
            arrayStates.AddRange(states);
            ClientInterface.GroupTaskResponse proxyResp = client.GetTasks(GetAuthData(auth), dateFrom, dateTo, arrayStates, guid, startIndex, rowsCount);
            response.ErrorCode = proxyResp.ErrorCode;
            response.ErrorDescription = proxyResp.ErrorDescription;
            if (proxyResp.Tasks != null && proxyResp.Tasks.Length > 0)
            {
                response.Tasks = new TaskStruct[proxyResp.Tasks.Length];

                for (int i = 0; i < response.Tasks.Length; i++)
                {
                    response.Tasks[i] = new TaskStruct();
                    response.Tasks[i].Active = proxyResp.Tasks[i].Active;
                    response.Tasks[i].DateChecked = proxyResp.Tasks[i].DateChecked;
                    response.Tasks[i].DateCompleted = proxyResp.Tasks[i].DateCompleted;
                    response.Tasks[i].DateRegistered = proxyResp.Tasks[i].DateRegistered;
                    response.Tasks[i].DateSended = proxyResp.Tasks[i].DateSended;
                    response.Tasks[i].DateToExecute = proxyResp.Tasks[i].DateToExecute;
                    response.Tasks[i].Guid = proxyResp.Tasks[i].Guid;
                    response.Tasks[i].ID = proxyResp.Tasks[i].ID;
                    response.Tasks[i].Machine = proxyResp.Tasks[i].Machine;
                    response.Tasks[i].Name = proxyResp.Tasks[i].Name;
                    response.Tasks[i].State = proxyResp.Tasks[i].State;
                    response.Tasks[i].User = proxyResp.Tasks[i].User;
                    response.Tasks[i].XmlRequest = proxyResp.Tasks[i].XmlRequest;
                    response.Tasks[i].XmlResponse = proxyResp.Tasks[i].XmlResponse;
                          response.Tasks[i].ErrorDetails = proxyResp.Tasks[i].ErrorDetails;
                }
            }
                response.TotalCount = proxyResp.TotalCount;
            return response;
        }