public RemoteRequest(ulong sender, RemoteRequestType type) { Sender = sender; RequestType = type; }
public RemoteMessanger(RemoteProcessType processType, UploadStationInfo authParam, RemoteRequestType requestType = RemoteRequestType.Registration, Method method = Method.POST) { try { if (authParam == null || authParam.StationInfoId < 1 || string.IsNullOrEmpty(authParam.APIAccessKey)) { throw new ApplicationException("Empty / Invalid Remote Server Authentication Parameters"); } var servAdd = authParam.HostServerAddress; if (string.IsNullOrEmpty(servAdd) || servAdd.Length < 5) { throw new ApplicationException("Remote Server Address Not Configured"); } _client = new RestClient(servAdd); switch (requestType) { case RemoteRequestType.Registration: _request = new RestRequest("bioEnroll/DataKiosk/" + processType, method) { JsonSerializer = new JsonSerializer(), RequestFormat = DataFormat.Json }; break; case RemoteRequestType.Report: _request = new RestRequest("Messaging/LRServiceCloud/" + processType, method) { JsonSerializer = new JsonSerializer(), RequestFormat = DataFormat.Json }; break; } _request.AddHeader("content-type", "application/json"); _request.AddHeader("APIAccessKey", string.Format("{0}", authParam.APIAccessKey)); _request.AddHeader("StationName", string.Format("{0}", authParam.StationName)); _request.AddHeader("StationId", string.Format("{0}", authParam.StationKey)); _request.AddHeader("EnrollerRegId", string.Format("{0}", authParam.EnrollerRegId)); _request.AddHeader("ApiVersion", string.Format("{0}", 1)); // _request.Timeout = 180000; } catch (Exception ex) { throw new ApplicationException("Remote Server Address Not Configured"); } }