Ejemplo n.º 1
0
        public ActionResult AddResource(AddResource model)
        {
            if (model != null)
            {
                ResourceGroup res = new ResourceGroup
                {
                    AuthorId = _userService.GetIdByAspId(User.Identity.GetUserId()),
                    Date     = DateTime.Now,
                    GroupId  = model.GroupId,
                    Comments = model.Comments
                };
                var file = _conferService.ConvertFile(model.Resource);
                res.Resource = file;
                res.Id       = Guid.NewGuid();
                _groupService.AddResource(res);
            }
            GroupIdParam id = new GroupIdParam
            {
                GroupId = model.GroupId
            };

            var param = model.GroupId.ToString();

            return(RedirectToAction("GetListResource", new { param = id }));
        }
Ejemplo n.º 2
0
 private Nothing OnAddResource(AddResource request, ICommandCallerInfo callerinfo)
 {
     if (stockpileDepository.Data.canAcceptResources)
     {
         health.AddCurrentHealthDelta(request.quantity);
     }
     return(new Nothing());
 }
        public async Task add_resource_endpoint_should_return_http_status_code_created()
        {
            var command = new AddResource(Guid.NewGuid(), new [] { "tag" });

            var response = await Act(command);

            response.ShouldNotBeNull();
            response.StatusCode.ShouldBe(HttpStatusCode.Created);
        }
Ejemplo n.º 4
0
        private HttpContent GetHttpContent(AddResource command)
        {
            var json        = JsonConvert.SerializeObject(command);
            var buffer      = System.Text.Encoding.UTF8.GetBytes(json);
            var byteContent = new ByteArrayContent(buffer);

            byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");

            return(byteContent);
        }
Ejemplo n.º 5
0
        private void buttonShowResourcesEdit_Click(object sender, RoutedEventArgs e)
        {
            Resource r = (Resource)ResourcesTable.SelectedValue;

            if (r != null)
            {
                AddResource window = new AddResource(r);
                showNewWindow(window);
            }
        }
        public async Task add_resource_endpoint_should_return_location_header_with_correct_resource_id()
        {
            var command = new AddResource(Guid.NewGuid(), new [] { "tag" });

            var response = await Act(command);

            var locationHeader = response.Headers.FirstOrDefault(h => h.Key == "Location").Value.First();

            locationHeader.ShouldNotBeNull();
            locationHeader.ShouldBe($"resources/{command.ResourceId}");
        }
        public async Task add_resource_endpoint_should_add_document_with_given_id_to_database()
        {
            var command = new AddResource(Guid.NewGuid(), new [] { "tag" });

            await Act(command);

            var document = await _mongoDbFixture.GetAsync(command.ResourceId);

            document.ShouldNotBeNull();
            document.Id.ShouldBe(command.ResourceId);
            document.Tags.ShouldBe(command.Tags);
        }
Ejemplo n.º 8
0
        public async Task AddResource_Endpoint_Should_Add_Resource_With_Given_Id_To_Database()
        {
            var command = new AddResource(new Guid(ResourceId));

            var tcs = await _rabbitMqFixture.SubscribeAndGetAsync <ResourceAdded, ResourceDocument>(_mongoDbFixture.GetAsync,
                                                                                                    command.ResourceId);

            await Act(command);

            var document = await tcs.Task;

            document.ShouldNotBeNull();
            document.Id.ShouldBe(command.ResourceId);
        }
Ejemplo n.º 9
0
    // Use this for initialization
    void Awake()
    {
        ResourceValueUI = gameObject.GetComponent <Text>();
        animator        = gameObject.GetComponent <Animator>();
        addResource     = animator.GetBehaviour <AddResource>();
        animator.SetBool("IsStart", false);
        _resourceByCycle        = HingeConfig._AddResourceByCycle;
        _cycle                  = HingeConfig._AddResourceCycle;
        addResource.resource    = _resourceByCycle;
        ResourceValueUI.text    = "Resource +" + _resourceByCycle;
        ResourceValueUI.enabled = false;
        float ProductingSpeed = 1 / _cycle;

        animator.SetFloat("ProductingSpeed", ProductingSpeed);
    }
Ejemplo n.º 10
0
        public void ResouceAdd2()
        {
            TaskElement("Idle>10 Minutes").WaitUntil(); TaskElement("Idle>10 Minutes").Clicks();

            AddResource.Clicks();

            ResourceType.WaitUntil();

            ResourceType.SelectDropdown("eMOSUser");

            SelectResource("Barger").WaitUntil();

            SelectResource("Barger").Clicks();

            ResourceAdded.Clicks(); WaitforIt(Properties.InactivePhase);
        }
        public async Task add_resource_command_should_add_document_with_given_id_to_database()
        {
            var command = new AddResource(Guid.NewGuid(), new[] { "tag" });

            var tcs = _rabbitMqFixture
                      .SubscribeAndGet <ResourceAdded, ResourceDocument>(Exchange,
                                                                         _mongoDbFixture.GetAsync, command.ResourceId);

            await Act(command);

            var document = await tcs.Task;

            document.ShouldNotBeNull();
            document.Id.ShouldBe(command.ResourceId);
            document.Tags.ShouldBe(command.Tags);
        }
Ejemplo n.º 12
0
        public void ResourceAdd4()

        {
            TaskElementUnplanned("Idle").WaitUntil(); TaskElementUnplanned("Idle").Clicks();

            AddResource.Clicks();

            ResourceType.WaitUntil();

            ResourceType.SelectDropdown("eMOSUser");

            SelectResource("Baker").WaitUntil();

            SelectResource("Baker").Clicks();

            ResourceAdded.Clicks();
        }
Ejemplo n.º 13
0
        public void AddMultipleResource()

        {
            TaskElement("Total Tasks Completed").WaitUntil(); TaskElement("Total Tasks Completed").Clicks();

            AddResource.Clicks();

            ResourceType.WaitUntil();

            ResourceType.SelectDropdown("eMOSUser");

            SelectResource("Wondez").WaitUntil();

            SelectResource("Wondez").Clicks();

            SelectResource("Arroyo").Clicks();

            SelectResource("Sandra").Clicks();

            ResourceAdded.Clicks();
        }
Ejemplo n.º 14
0
        public void AddSameResource()

        {
            TaskElement("Non-Working GPS").WaitUntil(); TaskElement("Non-Working GPS").Clicks();

            AddResource.WaitUntil();

            AddResource.Clicks();

            ResourceType.WaitUntil();

            ResourceType.SelectDropdown("eMOSUser");

            SelectResource("Arroyo").WaitUntil();

            SelectResource("Arroyo").Clicks();

            SelectResource("Sandra").Clicks();

            ResourceAdded.Clicks();
        }
 private Task <HttpResponseMessage> Act(AddResource command)
 => _httpClient.PostAsync("resources", GetContent(command));
Ejemplo n.º 16
0
        private void AddResource_Executed(object sender, RoutedEventArgs e)
        {
            AddResource addResource = new AddResource();

            showNewWindow(addResource);
        }
Ejemplo n.º 17
0
 Task Act(AddResource command)
 => _rabbitMqFixture.PublishAsync(command);
 private Task Act(AddResource command) => _rabbitMqFixture.PublishAsync(command, Exchange);
Ejemplo n.º 19
0
        private void buttonShowResourcesAdd_Click(object sender, RoutedEventArgs e)
        {
            AddResource addResource = new AddResource();

            showNewWindow(addResource);
        }