/// <summary> /// Set a new status from current Callback. On successfull change, service sent a signal to the client /// </summary> /// <param name="paramNewStatus"></param> public void SetStatus(Operador operatorToChange, AvailabiltyStatus paramNewStatus) { lock (syncObject) { try { // gets client from the service Client clientToChange = getClientByOperator(operatorToChange); // Set the status on operator finded clientToChange.Operator.Status = paramNewStatus; // Sent a confirmation signal to the client CurrentCallback.ServiceChangeStatusRequest(paramNewStatus); // if the callback related to operator has change, update client CheckAndUpdateCallbackOperator(clientToChange, CurrentCallback); // Check if the backoffice is logged in and send refresh status if (connectedBackoffice != null) { SentRefreshForConnectedBackoffice(); } // For debug purposses, sent a console message to inform Log.Info(_operatorClassName, string.Format("{0} has changed status to {1}.", operatorToChange, paramNewStatus)); } catch (Exception ex) { Log.Error("Service", "error setting status: " + ex.Message); // If the callback is no related with any operator, forces disconnection CurrentCallback.Mensaje("There is an error getting operator, please contact the administrator. The service connection has been ended."); // Force the client's desconnection from de the service CurrentCallback.ForceDisconnect(); } } }
/// <summary> /// Sent a batch of asuntos on wich service controls /// </summary> /// <param name="prmOperatorBackoffice"></param> /// <param name="lstA"></param> public void SentBatchOfAsuntosToOperator(Operador prmOperatorBackoffice, List <Entidades.Asunto> lstA) { // Validates if the petition sender is already logged on system if (!CheckCallingBackofficeIsAlreadyLogged(prmOperatorBackoffice)) { throw new Exception(Error.BACKOFFICE_SENDER_IS_NOT_CORRECTLY_LOGGED); } // Validates if the list is correctly loaded if (SQL.Asunto.Validate(lstA)) { // Adds the list to pending of distribution AddPending(lstA); // Sent Callback response confirming add succesful CurrentCallback.UpdateOnAsuntosWithoutAssignation(); } else { String conflictedAsuntos = SQL.Asunto.GetDuplicatedConflictedAsuntoNumbers(lstA); CurrentCallback.Mensaje(string.Format("No se ha podido enviar los asuntos en lote debido a que existen conflictos con los siguientes asuntos: {0}. Tienen el mismo número y operador", conflictedAsuntos)); } }
/// <summary> /// Process a request from Backoffice and put delivery of them in a qeue /// </summary> /// <param name="prmAsunto"></param> public void SentAsuntoToOperator(Operador prmOperatorBackoffice, Asunto prmAsunto) { try { // Check if the operator who sents the asunto is a backoffice operator logged if (!CheckCallingBackofficeIsAlreadyLogged(prmOperatorBackoffice)) { throw new Exception(Error.BACKOFFICE_SENDER_IS_NOT_CORRECTLY_LOGGED); } // Validates asunto if correct loaded if (SQL.Asunto.Validate(prmAsunto)) { // Adds a asunto to deliver AddPending(prmAsunto); } else { // Sent a reject sent message CurrentCallback.Mensaje(string.Format("El asunto {0} para el operador {1} no puede ser agregada a la lista de distribución. Es posible que el operador no sea valido o probablemente el asunto ya esta cargado.")); } } catch (Exception ex) { Log.Error("SentAsuntoToOperator", ex.Message); } }
protected override TestResponse ExecuteInternal(TestRequest request) { CurrentCallback.Callback(new TestCallback(request.Test)); return(new TestResponse(request.Test)); }