Example #1
0
        public ActionResult DeleteFromRecycle(string namep, string namecat, string username)
        {
            try
            {
                CustomRoleProvider l = new CustomRoleProvider();
                bool con             = l.IsUserInRole(User.Identity.Name, "User");
                if (!con)
                {
                    return(RedirectToAction("Index", "Home"));
                }

                using (botEntities3 bd = new botEntities3())
                {
                    string  u    = User.Identity.Name;
                    Users   user = bd.Users.Where(x => x.Email == u).First();
                    Token   m    = bd.Token.Where(x => x.UserID == user.Id).First();
                    Recycle res  = bd.Recycle.Where(x => x.NameProduct == namep).Where(x => x.NameCategory == namecat).Where(x => x.TokenId == m.Id).Where(x => x.UserName == username).First();
                    bd.Recycle.Remove(res);
                    bd.SaveChanges();
                }
            }
            catch
            {
            }
            return(RedirectToAction("ShowRecycle", "Admin"));
        }
Example #2
0
        public ServiceBusHostConfiguration(IServiceBusBusConfiguration busConfiguration, IServiceBusTopologyConfiguration topologyConfiguration)
            : base(busConfiguration)
        {
            _busConfiguration      = busConfiguration;
            _topologyConfiguration = topologyConfiguration;

            _hostSettings = new HostSettings();
            _hostTopology = new ServiceBusHostTopology(this, _topologyConfiguration);

            ReceiveTransportRetryPolicy = Retry.CreatePolicy(x =>
            {
                x.Ignore <MessagingEntityNotFoundException>();
                x.Ignore <MessagingEntityAlreadyExistsException>();
                x.Ignore <MessageNotFoundException>();
                x.Ignore <MessageSizeExceededException>();

                x.Ignore <UnauthorizedException>();

                x.Handle <ServerBusyException>(exception => exception.IsTransient);
                x.Handle <TimeoutException>();

                x.Interval(5, TimeSpan.FromSeconds(10));
            });

            _connectionContext = new Recycle <IConnectionContextSupervisor>(() => new ConnectionContextSupervisor(this, topologyConfiguration));
        }
Example #3
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #4
0
        public RecycleControl(Flowsheet flowsheet, Point location, Recycle recycle)
            : base(flowsheet, location, recycle)
        {
            //InitializeComponent();

            DisableMenus();
        }
        public RabbitMqHostConfiguration(IRabbitMqBusConfiguration busConfiguration, IRabbitMqTopologyConfiguration topologyConfiguration)
            : base(busConfiguration)
        {
            _busConfiguration = busConfiguration;
            _hostSettings     = new ConfigurationHostSettings
            {
                Host        = "localhost",
                VirtualHost = "/",
                Port        = 5672,
                Username    = "******",
                Password    = "******"
            };

            var messageNameFormatter = new RabbitMqMessageNameFormatter();

            _hostTopology = new RabbitMqHostTopology(this, messageNameFormatter, _hostSettings.HostAddress, topologyConfiguration);

            ReceiveTransportRetryPolicy = Retry.CreatePolicy(x =>
            {
                x.Handle <ConnectionException>();
                x.Handle <MessageNotConfirmedException>(exception => exception.Message.Contains("CONNECTION_FORCED"));

                x.Ignore <AuthenticationFailureException>();

                x.Exponential(1000, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(3));
            });

            _connectionContext = new Recycle <IConnectionContextSupervisor>(() => new ConnectionContextSupervisor(this, topologyConfiguration));
        }
Example #6
0
        public ActionResult DeleteConfirmed(int id)
        {
            Recycle recycle = db.Recycles.Find(id);

            db.Recycles.Remove(recycle);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
    private void RecycleHandler()
    {
        Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, Recycle.transform);
        Recycle.AddInteractionPunch();
        if (!_lightsOn || _isSolved)
        {
            return;
        }
        if (Barempty)
        {
            Module.HandleStrike();
            Strike = true;
            Debug.LogFormat("[Waste Management #{0}] Strike given, reset the module", _moduleId);
            Init();
        }
        switch (Stage)
        {
        case 1:
            PaperRecycle = Input;
            Audio.PlaySoundAtTransform("PaperAdd", Recycle.transform);
            break;

        case 2:
            PlasticRecycle = Input;
            Audio.PlaySoundAtTransform("PlasticAdd", Recycle.transform);
            break;

        case 3:
            MetalRecycle = Input;
            Audio.PlaySoundAtTransform("MetalAdd", Recycle.transform);
            break;

        default:
        {
            LeftoverRecycle = Input;
            int random = UnityEngine.Random.Range(0, 3);
            // ReSharper disable once SwitchStatementMissingSomeCases
            switch (random)
            {
            case 0:
                Audio.PlaySoundAtTransform("PaperAdd", Recycle.transform);
                break;

            case 1:
                Audio.PlaySoundAtTransform("PlasticAdd", Recycle.transform);
                break;

            case 2:
                Audio.PlaySoundAtTransform("MetalAdd", Recycle.transform);
                break;
            }

            break;
        }
        }
        Input = 0;
    }
Example #8
0
 public void SetRecycleBin(Recycle RecBin, int WidthOut, int HeightOut)
 {
     RecycleBin = RecBin;
     WidOut     = WidthOut;
     kx         = (float)pOut.Width / WidOut;
     HeiOut     = HeightOut;
     ky         = (float)pOut.Height / HeiOut;
     k          = kx <= ky ? kx : ky;
 }
Example #9
0
 public Pedersen()
 {
     _parameters = new Parameters();
     _recycle    = new Recycle(_parameters);
     _usd        = new Economy(_parameters, _recycle);
     _objective  = new ObjectiveFunction(_usd, _recycle, _parameters);
     _pedersen   = new Calibrator(_objective, _parameters);
     _cascade    = new Cascade(_usd, _parameters);
     _glasserman = new Simulator(_usd, _parameters);
 }
        public SqsQueueReceiveEndpointContext(IAmazonSqsHostConfiguration hostConfiguration, IAmazonSqsReceiveEndpointConfiguration configuration,
                                              BrokerTopology brokerTopology)
            : base(hostConfiguration, configuration)
        {
            _hostConfiguration = hostConfiguration;
            _configuration     = configuration;
            BrokerTopology     = brokerTopology;

            _clientContext = new Recycle <IClientContextSupervisor>(() => new ClientContextSupervisor(_hostConfiguration.ConnectionContextSupervisor));
        }
        public ActiveMqConsumerReceiveEndpointContext(IActiveMqHostConfiguration hostConfiguration, IActiveMqReceiveEndpointConfiguration configuration,
                                                      BrokerTopology brokerTopology, ReceiveSettings settings)
            : base(hostConfiguration, configuration)
        {
            _hostConfiguration = hostConfiguration;
            _settings          = settings;
            BrokerTopology     = brokerTopology;

            _sessionContext = new Recycle <ISessionContextSupervisor>(() => new SessionContextSupervisor(hostConfiguration.ConnectionContextSupervisor));
        }
        public ActiveMqHostConfiguration(IActiveMqBusConfiguration busConfiguration, IActiveMqTopologyConfiguration topologyConfiguration)
            : base(busConfiguration)
        {
            _busConfiguration = busConfiguration;

            _hostSettings = new ConfigurationHostSettings(new Uri("activemq://localhost"));
            _hostTopology = new ActiveMqHostTopology(this, topologyConfiguration);

            _connectionContext = new Recycle <IConnectionContextSupervisor>(() => new ConnectionContextSupervisor(this, topologyConfiguration));
        }
        public SqsQueueReceiveEndpointContext(IAmazonSqsHostConfiguration hostConfiguration, IAmazonSqsReceiveEndpointConfiguration configuration,
                                              BrokerTopology brokerTopology, ReceiveSettings settings)
            : base(hostConfiguration, configuration)
        {
            _hostConfiguration = hostConfiguration;
            _settings          = settings;
            BrokerTopology     = brokerTopology;

            _clientContext = new Recycle <IClientContextSupervisor>(() => hostConfiguration.ConnectionContextSupervisor.CreateClientContextSupervisor());
        }
 public EventHubFactoryConfigurator()
 {
     _endpointObservers           = new ReceiveEndpointObservable();
     _endpoints                   = new List <IEventHubReceiveEndpointSpecification>();
     _hostSettings                = new HostSettings();
     _storageSettings             = new StorageSettings();
     _producerSpecification       = new EventHubProducerSpecification(this, _hostSettings);
     _connectionContextSupervisor = new Recycle <IConnectionContextSupervisor>(() =>
                                                                               new ConnectionContextSupervisor(_hostSettings, _storageSettings, _producerSpecification.ConfigureOptions));
 }
Example #15
0
 public EventHubTransportContext(IEventHubHostConfiguration hostConfiguration, ISendPipe sendPipe,
                                 IHostConfiguration configuration, Uri endpointAddress, IMessageSerializer messageSerializer)
     : base(configuration)
 {
     _configuration             = configuration;
     SendPipe                   = sendPipe;
     EndpointAddress            = new EventHubEndpointAddress(HostAddress, endpointAddress);
     _producerContextSupervisor =
         new Recycle <IProducerContextSupervisor>(() =>
                                                  new ProducerContextSupervisor(hostConfiguration.ConnectionContextSupervisor, EndpointAddress.EventHubName, messageSerializer));
 }
        public ServiceBusHostConfiguration(IServiceBusBusConfiguration busConfiguration, IServiceBusTopologyConfiguration topologyConfiguration)
            : base(busConfiguration)
        {
            _busConfiguration      = busConfiguration;
            _topologyConfiguration = topologyConfiguration;

            _hostSettings = new HostSettings();
            _hostTopology = new ServiceBusHostTopology(this, _topologyConfiguration);

            _connectionContext = new Recycle <IConnectionContextSupervisor>(() => new ConnectionContextSupervisor(this, topologyConfiguration));
        }
        public RabbitMqQueueReceiveEndpointContext(IRabbitMqHostConfiguration hostConfiguration, IRabbitMqReceiveEndpointConfiguration configuration,
                                                   BrokerTopology brokerTopology, ReceiveSettings settings)
            : base(hostConfiguration, configuration)
        {
            _hostConfiguration = hostConfiguration;
            _settings          = settings;

            ExclusiveConsumer = configuration.Settings.ExclusiveConsumer;
            BrokerTopology    = brokerTopology;

            _modelContext = new Recycle <IModelContextSupervisor>(() => new ModelContextSupervisor(hostConfiguration.ConnectionContextSupervisor));
        }
Example #18
0
 public ActionResult Edit([Bind(Include = "Id,Units,DateStamp,SchoolClassId,RecycleTypeId")] Recycle recycle)
 {
     if (ModelState.IsValid)
     {
         db.Entry(recycle).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.RecycleTypeId = new SelectList(db.RecycleTypes, "Id", "Name", recycle.RecycleTypeId);
     ViewBag.SchoolClassId = new SelectList(db.SchoolClasses, "Id", "Name", recycle.SchoolClassId);
     return(View(recycle));
 }
        public ServiceBusEntityReceiveEndpointContext(IServiceBusHostConfiguration hostConfiguration, IServiceBusEntityEndpointConfiguration configuration,
                                                      BrokerTopology brokerTopology, Func <IClientContextSupervisor> supervisorFactory)
            : base(hostConfiguration, configuration)
        {
            _hostConfiguration = hostConfiguration;

            BrokerTopology = brokerTopology;

            GetOrAddPayload(() => _hostConfiguration.HostTopology);

            _clientContext = new Recycle <IClientContextSupervisor>(supervisorFactory);
        }
        public InMemoryHostConfiguration(IInMemoryBusConfiguration busConfiguration, Uri baseAddress, IInMemoryTopologyConfiguration topologyConfiguration)
            : base(busConfiguration)
        {
            _busConfiguration = busConfiguration;

            _hostAddress  = baseAddress ?? new Uri("loopback://localhost/");
            _hostTopology = new InMemoryHostTopology(this, topologyConfiguration);

            TransportConcurrencyLimit = Math.Min(Environment.ProcessorCount, 4);

            _transportProvider = new Recycle <IInMemoryTransportProvider>(() => new InMemoryTransportProvider(this, topologyConfiguration));
        }
Example #21
0
        public async Task <IActionResult> Create([Bind("ID,Name,Type,PhoneNo,Website,Location,ImageUrl,FileName")] Recycle recycle, List <IFormFile> files)
        {
            if (ModelState.IsValid)
            {
                //get temporary filepath
                var filepath = Path.GetTempFileName();

                foreach (var FormFile in files)
                {
                    //check the file
                    if (FormFile.Length <= 0)
                    {
                        TempData["message"] = "Please upload an image file";
                    }

                    //If file is valid proceed to transfer data
                    {
                        //Get the information of the container
                        CloudBlobContainer container = GetCloudBlobContainer();
                        //create the container if not exist in the storage
                        ViewBag.Success           = container.CreateIfNotExistsAsync().Result;
                        ViewBag.BlobContainerName = container.Name; //get the container name

                        //Give a name for the blob
                        CloudBlockBlob blob = container.GetBlockBlobReference(Path.GetFileName(FormFile.FileName));
                        try
                        {
                            using (var stream = FormFile.OpenReadStream())
                            {
                                await blob.UploadFromStreamAsync(stream);
                            }
                        }
                        catch (Exception ex)
                        {
                            TempData["message"] = ex.ToString();
                        }

                        //get uri of the uploaded blob and save in database
                        var blobUrl = blob.Uri.AbsoluteUri;
                        recycle.ImageUrl = blobUrl.ToString();
                        recycle.FileName = FormFile.FileName.ToString();
                        _context.Add(recycle);
                        await _context.SaveChangesAsync();

                        return(RedirectToAction(nameof(Index)));
                    }
                }
                TempData["createmessage"] = "Please upload an image for your clothes";
                return(RedirectToAction(nameof(Create)));
            }
            return(View(recycle));
        }
 public EventHubReceiveEndpointContext(IEventHubHostConfiguration hostConfiguration, IBusInstance busInstance,
                                       IReceiveEndpointConfiguration endpointConfiguration,
                                       ReceiveSettings receiveSettings, Func <IStorageSettings, BlobContainerClient> blobContainerClientFactory,
                                       Func <IHostSettings, BlobContainerClient, EventProcessorClient> clientFactory,
                                       Func <PartitionClosingEventArgs, Task> partitionClosingHandler,
                                       Func <PartitionInitializingEventArgs, Task> partitionInitializingHandler)
     : base(busInstance.HostConfiguration, endpointConfiguration)
 {
     _busInstance       = busInstance;
     _contextSupervisor = new Recycle <IProcessorContextSupervisor>(() =>
                                                                    new ProcessorContextSupervisor(hostConfiguration.ConnectionContextSupervisor, busInstance.HostConfiguration, receiveSettings,
                                                                                                   blobContainerClientFactory, clientFactory, partitionClosingHandler, partitionInitializingHandler));
 }
Example #23
0
        public float calculateReducedRecycle(float rcQty, String itemName)
        {
            float carbonValue = 0;
            var   tempRecycle = db.Recycles.Where(c => c.Name == itemName.Trim()).FirstOrDefault();

            if (tempRecycle != null)
            {
                Recycle recycle = tempRecycle;
                carbonValue = rcQty * recycle.Footprint_Differences;
            }

            return(carbonValue);
        }
Example #24
0
        public KafkaFactoryConfigurator(ClientConfig clientConfig)
        {
            _clientConfig      = clientConfig;
            _topics            = new List <IKafkaConsumerSpecification>();
            _producers         = new List <IKafkaProducerSpecification>();
            _endpointObservers = new ReceiveEndpointObservable();
            _sendObservers     = new SendObservable();

            SetHeadersDeserializer(DictionaryHeadersSerialize.Deserializer);
            SetHeadersSerializer(DictionaryHeadersSerialize.Serializer);

            _clientSupervisor = new Recycle <IClientContextSupervisor>(() => new ClientContextSupervisor(_clientConfig, _producers));
        }
Example #25
0
    public void addRecycle()
    {
        Recycle recycling = new Recycle();

        if (inventoryFull.Count < 1)
        {
            inventoryFull.Add(recycling);
        }
        else
        {
            player.GetComponent <scr_playerMovement>().invFull = true;
        }
    }
Example #26
0
        public RecycleControl(Flowsheet flowsheet, Point location, Recycle recycle) :
            base(flowsheet, location, recycle)
        {
            InitializeComponent();

            this.Size = new System.Drawing.Size(UI.UNIT_OP_CTRL_H, UI.UNIT_OP_CTRL_H);
            UI.SetStatusColor(this, this.Recycle.SolveState);
            this.UpdateBackImage();

            this.menuItemEdit.Enabled = false;
            this.menuItemEdit.Visible = false;
            this.IsShownInEditor      = false;
        }
Example #27
0
        public float calculateTotalRecycle(float rcQty, String itemName)
        {
            float carbonValue = 0;
            var   tempRecycle = db.Recycles.Where(c => c.Name == itemName.Trim()).FirstOrDefault();

            if (tempRecycle != null)
            {
                Recycle recycle = tempRecycle;
                carbonValue = rcQty * recycle.Carbon_Footprint_Primary;
            }

            return(carbonValue);
        }
Example #28
0
        // GET: Recycles/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Recycle recycle = db.Recycles.Find(id);

            if (recycle == null)
            {
                return(HttpNotFound());
            }
            return(View(recycle));
        }
Example #29
0
 // Delete file to RecycleBin, i.e. ensure file is recoverable after delete, if user desires such.
 public static void DeleteToRecycleBin(string filename)
 {
     try
     {
         if (File.Exists(filename))
         {
             Recycle.DeleteFileOperation(filename);
         }
     }
     catch (Exception ex)
     {
         Logging.Warn(ex, "There was a problem deleting file {0} to the Recycle Bin.", filename);
     }
 }
Example #30
0
        public KafkaReceiveEndpointContext(IBusInstance busInstance, IReceiveEndpointConfiguration endpointConfiguration,
                                           IKafkaHostConfiguration hostConfiguration,
                                           ReceiveSettings receiveSettings,
                                           IHeadersDeserializer headersDeserializer,
                                           Func <ConsumerBuilder <TKey, TValue> > consumerBuilderFactory)
            : base(busInstance.HostConfiguration, endpointConfiguration)
        {
            _busInstance = busInstance;
            _settings    = receiveSettings;

            _consumerContext = new Recycle <IConsumerContextSupervisor <TKey, TValue> >(() =>
                                                                                        new ConsumerContextSupervisor <TKey, TValue>(hostConfiguration.ClientContextSupervisor, _settings, busInstance.HostConfiguration,
                                                                                                                                     headersDeserializer, consumerBuilderFactory));
        }