Beispiel #1
0
 /// <summary>
 /// Valida si es el administrador de consola
 /// </summary>
 /// <param name="oper"></param>
 private bool isConsoleAdmin(Entidades.Operador oper)
 {
     if (consoleAdmin.UserName == oper.UserName && consoleAdmin.Password == oper.Password)
     {
         return(true);
     }
     return(false);
 }
 /// <summary>
 /// Sent to proxy service a request for distribute a batch of asuntos
 /// </summary>
 /// <param name="prmBackofficeSender"></param>
 /// <param name="prmListOfAsunto"></param>
 public async Task SentBatchAsuntoToOperators(Entidades.Operador prmBackofficeSender, List<Entidades.Asunto> prmListOfAsunto)
 {
     try {
         await HandleProxy();
         proxy.SentBatchOfAsuntosToOperator(prmBackofficeSender, prmListOfAsunto.ToArray());
     } catch (Exception ex) {
         throw ex;
     }
 }
Beispiel #3
0
 private async Task sentDisconnectToCurrentBackoffice(Client prevClient, Entidades.Operador paramNewBackoffice)
 {
     Log.Info("MainService", string.Format("backoffice {0} has been forcedly disconnected by {1}", connectedBackoffice.Operator, paramNewBackoffice.UserName));
     await Task.Run(() =>
     {
         // Sent to previous backoffice a message and force disconnection
         prevClient.Callback.Mensaje(string.Format("the operator {0} has been connected to the service. Your connection has been forcedly terminated.", paramNewBackoffice.UserName));
         prevClient.Callback.ForceDisconnect();
     }).TimeoutAfter(Config.BACKOFFICE_TIMEOUT);
 }
 /// <summary>
 /// Sent to the service an asunto to deliver
 /// </summary>
 /// <param name="prmBackofficeSender">Backoffice who sends asunto</param>
 /// <param name="prmAsuntoToSent">Asunto to send</param>
 public async Task SentAsuntoToOperator(Entidades.Operador prmBackofficeSender, Entidades.Asunto prmAsuntoToSent)
 {
     try {
         // Manage status of the proxy
         await HandleProxy();
         proxy.SentAsuntoToOperator(prmBackofficeSender, prmAsuntoToSent);
     }
     catch (Exception ex) {
         Except.Throw(ex);
     }
 }
 /// <summary>
 /// Sent a request to service for changing current status on the service
 /// </summary>
 /// <param name="pOperator"></param>
 /// <param name="newStatus"></param>
 /// <returns></returns>
 public async Task ChangeCurrentStatus(Entidades.Operador prmOper, AvailabiltyStatus newStatus)
 {
     try {
         // Checks if the proxy is ready
         await prepareProxy();
         // Sent to the service petition to change te current status
         proxy.SetStatus(prmOper, newStatus);
     }
     catch (Exception ex) {
         throw ex;
     }
 }
        /// <summary>
        /// Sents a disconnect petition to service
        /// </summary>
        /// <param name="paramOperatorToDisconnect">Operator to disconnect</param>
        public async Task DisconnectOperator(Entidades.Operador paramOperatorToDisconnect)
        {
            // Stop checking service
            stopCheckStatusOfConnectionWithService();
            try {
                await prepareProxy();
                // Run disconnection on the service
                await Task.Run(() => { proxy.Disconnect(paramOperatorToDisconnect); }).TimeoutAfter(5000);

            }
            catch (Exception ex) {
                throw ex;
            }
        }
 /// <summary>
 /// Conexión hacia el servicio
 /// </summary>
 /// <returns></returns>
 public async Task<Entidades.Operador> ConnectBackoffice(Entidades.Operador pOperator, Entidades.Service.Interface.IServicioCallback paramCallback)
 {
     // Aguardamos que el proxy este disponible
     await prepareProxy();
     // Almacenamos la respuesta del servicio en una variable que deberia venir completa
     Entidades.Operador backofficeOper = proxy.ConnectBackoffice(pOperator);
     if (backofficeOper != null) {
         // Sets callback for the client
         callbackInteraction = paramCallback;
         // Starts task to check for service activity status
         startCheckStatusOfConnectionWithService();
         // Set up local variables
         operatorLogged = pOperator;
         isBackoffice = true;
         // Devolvemos el operador con todos sus datos cargados                
         return backofficeOper;
     }
     else {
         throw new Exception("El usuario o contraseña no son validos, o no se disponen de permisos de backoffice.");
     }
 }
 /// <summary>
 /// Sent a request petition to the service for connection
 /// </summary>
 /// <param name="paramOperator"></param>
 /// <param name="paramCallback"></param>
 /// <returns></returns>
 public async Task<bool> ConnectOperator(Entidades.Operador paramOperator, Entidades.Service.Interface.IServicioCallback paramCallback)
 {
     try {
         await prepareProxy();
         // When connection is established we need check if the operator credentials are valid
         if (proxy.Conectar(paramOperator)) {
             // when connection has been acepted, the callback is saved to memory
             callbackInteraction = paramCallback;
             // Setup variable for operator logged
             operatorLogged = paramOperator;
             // Starts service checking activity
             startCheckStatusOfConnectionWithService();
             return true;
         }
         throw new Exception("Las credenciales locales no se condicen con las credenciales de servicio. Consulte al administrador.");
     }
     catch (TimeoutException) {
         throw new Exception("El servicio no responde. Se ha agotado el tiempo de espera para la conexión. Contacte al administrador.");
     }
     catch (Exception ex) {
         throw ex;
     }
 }
Beispiel #9
0
 /// <summary>
 /// Procesa una desconexión forzada del servicio de un cliente especifico
 /// </summary>
 /// <param name="operToDisconnect"></param>
 public void ForceToDisconnectFromService(Entidades.Operador operToDisconnect)
 {
     // Forzamos la desconexión del cliente mandando una operación de Callback
     getCallback(operToDisconnect).ForceDisconnect();
 }
Beispiel #10
0
 private void EstablecerNombreUser()
 {
     Entidades.Operador entOperLogged = App.Current.Properties["user"] as Entidades.Operador;
     txtUsuarioLogueado.Text = entOperLogged.Nombre + " " + entOperLogged.Apellido;
 }
 public bool Equals(Operador operatorToCompare)
 {
     return(UserName.ToLower() == operatorToCompare.UserName.ToLower());
 }
 public OperBackoffice(Entidades.Operador paramOperator)
 {
     Operator = paramOperator;
 }