Exemple #1
0
 internal CMProxyInfo(RegistrationRequest request, CMProxy owner)
 {
     _ingredients = new Dictionary <string, Ingredient>(Ingredient.GetAllExistingIngredientsInstances());
     Mac          = request.mac;
     UniqueName   = request.un;
     _owner       = owner;
     SetupAvaiabilityAndOffsets(request.stp);
 }
Exemple #2
0
        internal EmailSender(CMProxy owner)
        {
            _owner     = owner;
            _signature = DefaultSignature(_owner.Info.UniqueName);
            var appconfig = (AppConfig)AppDomain.CurrentDomain.UnityContainer().Resolve <AbstractAppConfig>();

            _user                 = appconfig.EmailSenderUser;
            _password             = appconfig.EmailSenderPassword;
            _host                 = appconfig.EmailSenderHost;
            _port                 = appconfig.EmailSenderPort;
            _enableSsl            = appconfig.EmailSenderEnableSsl;
            _useDefaulCredentials = appconfig.EmailSenderUseDefaultCredentials;
            _timeoutMs            = appconfig.EmailSenderTimeoutMs;
        }
Exemple #3
0
        internal Waitress(CMProxy owner)
        {
            var appconfig = (AppConfig)AppDomain.CurrentDomain.UnityContainer().Resolve <AbstractAppConfig>();

            _owner  = owner;
            _status = WaitressStatusEnum.NoOrder;
            _minimumSecondsBetweenOrders = appconfig.MinimumSecondsBetweenOrders;
            _queueCapacity         = appconfig.WaitressCapacity;
            _lastFinishedOrderTime = DateTime.UtcNow.Subtract(new TimeSpan(0, 1, 0));

            _emailSender     = new EmailSender(_owner);
            _custResponseFac = new CustomerResponseFactory();
            _queue           = new Queue <Order>();

            lock (__waitresses)
                __waitresses.Add(owner.Info.Mac, this);
        }
Exemple #4
0
 public RegistrationResponse HandleRegistration(RegistrationRequest request)
 {
     lock (_proxies)
     {
         if (_proxies.ContainsKey(request.mac))
         {
             Dashboard.Sgt.LogAsync($"Registration request for mac <<{request.mac}>> REJECTED (already registered).");
             return(_ardResponseFac.InvalidRequest <RegistrationResponse>(ErrorEnum.MacAlreadyRegistered));
         }
         else
         {
             while (_proxies.Any(kv => kv.Value.Info.UniqueName == request.un))
             {
                 request.un = request.un.GenerateNameVersion();
             }
             var proxy = new CMProxy(request);
             _proxies.Add(request.mac, proxy);
             Dashboard.Sgt.LogAsync($"New Coffee Machine! Name: {request.un}.");
             return(_ardResponseFac.RegistrationOK(CommandEnum.Enable));
         }
     }
 }