public void updateJob(NbtAuth auth, string jobKey, bool success, string errorMsg) { NbtPublicClient NbtClient = _getClient(auth); UpdateJobEventArgs e = new UpdateJobEventArgs(); CswNbtLabelJobUpdateRequest Request = new CswNbtLabelJobUpdateRequest(); Request.JobKey = jobKey; Request.Succeeded = success; Request.ErrorMessage = errorMsg; CswNbtLabelJobUpdateResponse Ret; using (OperationContextScope Scope = new OperationContextScope(NbtClient.InnerChannel)) { WebOperationContext.Current.OutgoingRequest.Headers.Add("X-NBT-SessionId", auth.sessionId); Ret = NbtClient.LpcUpdateJob(Request); } if (Ret.Authentication.AuthenticationStatus == "NonExistentSession") { //the old session has timed out, and we need to authenticate again CswNbtWebServiceSessionCswNbtAuthReturn authAttempt = _Authenticate(auth, e, NbtClient); if (authAttempt.Authentication.AuthenticationStatus == "Authenticated") { updateJob(auth, jobKey, success, errorMsg); } } else if (Ret.Authentication.AuthenticationStatus == "Authenticated") { if (Ret.Status.Success) { e.Succeeded = true; } else { e.Message = "Error updating job: "; if (Ret.Status.Errors.Length > 0) { e.Message += Ret.Status.Errors[0].Message; } } if (OnUpdateJob != null) { OnUpdateJob(e); } } } // updateJob()
public CswNbtLabelJobUpdateResponse LpcUpdateJob(CswNbtLabelJobUpdateRequest Request) { //delegate has to be static because you can't create an instance yet: you don't have resources until the delegate is actually called CswNbtLabelJobUpdateResponse Ret = new CswNbtLabelJobUpdateResponse(); var SvcDriver = new CswWebSvcDriver <CswNbtLabelJobUpdateResponse, CswNbtLabelJobUpdateRequest>( CswWebSvcResourceInitializer: new CswWebSvcResourceInitializerNbt(_Context, null), ReturnObj: Ret, WebSvcMethodPtr: CswNbtWebServicePrintLabels.updateLabelJob, ParamObj: Request ); SvcDriver.run(); return(Ret); }