コード例 #1
0
 private IResourceBuilder BuildEditBase(EmployeeEntity employeeEntity) =>
 BuildPageBase().Link(RelTypes.Breadcrumb, employeeEntity.FullName, GeneralInfoUri(new UpdateEmployeeGeneralInfoQuery(employeeEntity.EmployeeId)))
 .Link(RelTypes.Action, "+ new employee", AddUri())
 .Link(Url.AppLink(RelTypes.Action, "+ new client", nameof(ClientController.Add), nameof(ClientController), new CreateClientQuery(employeeEntity.EmployeeId)))
 .Link(RelTypes.Tab, "General Info", GeneralInfoUri(new UpdateEmployeeGeneralInfoQuery(employeeEntity.EmployeeId)))
 .Link(RelTypes.Tab, "Addresses", AddressesUri(new SearchEmployeeAddressQuery(employeeEntity.EmployeeId)))
 .Link(RelTypes.Tab, "Emails", EmailsUri(new SearchEmployeeEmailQuery(employeeEntity.EmployeeId)))
 .Link(RelTypes.Tab, "Phones", PhonesUri(new SearchEmployeePhoneQuery(employeeEntity.EmployeeId)))
 .Link(RelTypes.Tab, "IM", ImsUri(new SearchEmployeeImQuery(employeeEntity.EmployeeId)));
コード例 #2
0
        private IResourceBuilder BuildFormBase(ClientEntity clientEntity)
        {
            _builder.Link(Url.AppLink(RelTypes.Breadcrumb, "Clients", nameof(Index), nameof(ClientController)))
            .Link(Url.AppLink(RelTypes.Nav, "Employees", nameof(EmployeeController.Index), nameof(EmployeeController)))
            .Link(Url.AppLink(RelTypes.Nav, "Clients", nameof(ClientController.Index), nameof(ClientController)))
            .Property(nameof(ClientCommandBase.Name), "Name", clientEntity.Name)
            .Property(nameof(ClientCommandBase.ClientNo), "Client No", clientEntity.ClientNo)
            .Property(nameof(ClientCommandBase.OrganizationNo), "Organization No", clientEntity.OrganizationNo);

            BuildClientOwnerSelect(_builder.Embedded(RelTypes.Select), clientEntity.ClientOwner);

            return(_builder);
        }
コード例 #3
0
        private IFormVm BuildEditForm(ClientEntity clientEntity)
        {
            BuildFormBase(clientEntity).Link(Url.AppLink(RelTypes.Breadcrumb, clientEntity.Name, nameof(Edit), nameof(ClientController), new UpdateClientQuery(clientEntity.ClientId)))
            .Link(Url.AppLink(RelTypes.Self, clientEntity.Name, nameof(Edit), nameof(ClientController), new UpdateClientQuery(clientEntity.ClientId)))
            .Link(Url.AppLink(RelTypes.Action, "+ new client", nameof(ClientController.Add), nameof(ClientController)));

            _builder.Link(Url.AppLink(RelTypes.Tab, "General Info", nameof(Edit), nameof(ClientController), new UpdateClientQuery(clientEntity.ClientId)))
            .Link(Url.AppLink(RelTypes.Tab, "Addresses", nameof(Index), nameof(ClientController)))
            .Link(Url.AppLink(RelTypes.Tab, "Emails", nameof(Index), nameof(ClientController)))
            .Link(Url.AppLink(RelTypes.Tab, "Phones", nameof(Index), nameof(ClientController)))
            .Link(Url.AppLink(RelTypes.Tab, "IM", nameof(Index), nameof(ClientController)));

            return(_builder.Build()
                   .ToFormVm());
        }
コード例 #4
0
        private IResourceBuilder BuildClientOwnerSelect(IResourceBuilder builder, EmployeeEntity employeeEntity)
        {
            if (employeeEntity != null)
            {
                builder.Property(nameof(ClientCommandBase.ClientOwnerId), "Client Owner", employeeEntity.EmployeeId, employeeEntity.LongName)
                .Link(Url.AppLink(RelTypes.Action, "Clear", nameof(ClientOwnerClear), nameof(ClientController)));
            }
            else
            {
                builder.Property(nameof(ClientCommandBase.ClientOwnerId), "Client Owner", null);
            }

            builder.Embedded(RelTypes.Search)
            .Property(nameof(SearchClientOwnerQuery.ClientOwnerNamePart), "", "")
            .Link(Url.AppLink(RelTypes.Self, "Search", nameof(ClientOwnerSearch), nameof(ClientController)));

            return(_builder);
        }
コード例 #5
0
        public async Task <IActionResult> ClientOwnerSearch(SearchClientOwnerQuery query)
        {
            var builder = _builder.Property(nameof(ClientCommandBase.ClientOwnerId), "Client Owner", null)
                          .Link(Url.AppLink(RelTypes.Action, "Clear", nameof(ClientOwnerClear), nameof(ClientController)))
                          .Embedded(RelTypes.Search)
                          .Property(nameof(SearchClientOwnerQuery.ClientOwnerNamePart), "", query.ClientOwnerNamePart)
                          .Link(Url.AppLink(RelTypes.Self, "Search", nameof(ClientOwnerSearch), nameof(ClientController)));

            var employees = await _clientService.HandleAsync(query);

            foreach (var employee in employees.Result)
            {
                builder.Link(Url.AppLink(RelTypes.Action, employee.LongName, nameof(ClientOwnerSelect), nameof(ClientController), new SelectClientOwnerQuery(employee.EmployeeId)));
            }

            var vm = new SelectVm(_builder.Build());

            return(PartialView("SelectPartialView", vm));
        }
コード例 #6
0
        public async Task <IActionResult> Index(SearchEmployeeQuery query)
        {
            _builder.Link(RelTypes.Nav, "Employees", SearchUri(query))
            .Link(Url.AppLink(RelTypes.Nav, "Client", "index", "client"))
            .Link(RelTypes.Breadcrumb, "Employees", SearchUri(query))
            .Link(RelTypes.Action, "+ new employee", AddUri())
            .Link(RelTypes.Self, "Employees", SearchUri(query))
            .Link(RelTypes.Search, "Search", SearchUri(new SearchEmployeeQuery(nameof(SearchEmployeeQuery.EmployeeNo))));

            var queryExecutionResult = await _employeeService.HandleAsync(query);

            if (queryExecutionResult.HasError == false)
            {
                if (queryExecutionResult.Result.PageNo > queryExecutionResult.Result.FirstPageNo)
                {
                    _builder.Link(RelTypes.First, "First", SearchUri(new SearchEmployeeQuery(query.EmployeeNo, queryExecutionResult.Result.FirstPageNo)))
                    .Link(RelTypes.Prev, "Previous", SearchUri(new SearchEmployeeQuery(query.EmployeeNo, queryExecutionResult.Result.PageNo - 1)));
                }

                if (queryExecutionResult.Result.PageNo < queryExecutionResult.Result.LastPageNo)
                {
                    _builder.Link(RelTypes.Next, "Next", SearchUri(new SearchEmployeeQuery(query.EmployeeNo, queryExecutionResult.Result.PageNo + 1)))
                    .Link(RelTypes.Last, "Last", SearchUri(new SearchEmployeeQuery(query.EmployeeNo, queryExecutionResult.Result.LastPageNo)));
                }

                foreach (var employee in queryExecutionResult.Result)
                {
                    _builder.Embedded(RelTypes.Row)
                    .Property("name", "Name", employee.FullName)
                    .Property(nameof(employee.EmployeeNo), "Employee No", employee.EmployeeNo)
                    .Property(nameof(employee.Created), "Created", employee.Created)
                    .Link(RelTypes.Self, employee.FullName, GeneralInfoUri(new UpdateEmployeeGeneralInfoQuery(employee.EmployeeId)))
                    .Link(Url.AppLink(RelTypes.Nav, "+ new client", nameof(ClientController.Add), nameof(ClientController), new CreateClientQuery(employee.EmployeeId)));
                }
            }

            var vm = _builder.Build()
                     .ToGridVm();

            return(View(vm));
        }
コード例 #7
0
        public async Task <IActionResult> Index(SearchClientQuery query)
        {
            _builder.Link(Url.AppLink(RelTypes.Breadcrumb, "Clients", nameof(Index), nameof(ClientController)))
            .Link(Url.AppLink(RelTypes.Nav, "Employees", nameof(EmployeeController.Index), nameof(EmployeeController)))
            .Link(Url.AppLink(RelTypes.Nav, "Clients", nameof(ClientController.Index), nameof(ClientController)))
            .Link(Url.AppLink(RelTypes.Action, "+ new client", nameof(ClientController.Add), nameof(ClientController)))
            .Link(Url.AppLink(RelTypes.Self, "Clients", nameof(Index), nameof(ClientController)));

            var commandExecutionResult = await _clientService.HandleAsync(query);

            if (commandExecutionResult.HasError == false)
            {
                if (commandExecutionResult.Result.PageNo > commandExecutionResult.Result.FirstPageNo)
                {
                    _builder.Link(Url.AppLink(RelTypes.First, "First", nameof(Index), nameof(ClientController), new SearchClientQuery(query.ClientNo, commandExecutionResult.Result.FirstPageNo)))
                    .Link(Url.AppLink(RelTypes.Prev, "Previous", nameof(Index), nameof(ClientController), new SearchClientQuery(query.ClientNo, commandExecutionResult.Result.PageNo - 1)));
                }

                if (commandExecutionResult.Result.PageNo < commandExecutionResult.Result.LastPageNo)
                {
                    _builder.Link(Url.AppLink(RelTypes.Next, "Next", nameof(Index), nameof(ClientController), new SearchClientQuery(query.ClientNo, commandExecutionResult.Result.PageNo + 1)))
                    .Link(Url.AppLink(RelTypes.Last, "Last", nameof(Index), nameof(ClientController), new SearchClientQuery(query.ClientNo, commandExecutionResult.Result.LastPageNo)));
                }

                foreach (var client in commandExecutionResult.Result)
                {
                    _builder.Embedded(RelTypes.Row)
                    .Property(nameof(client.Name), "Name", client.Name)
                    .Property(nameof(client.ClientNo), "Client No", client.ClientNo)
                    .Property(nameof(client.Created), "Created", client.Created)
                    .Link(Url.AppLink(RelTypes.Self, "Name", nameof(Edit), nameof(ClientController), new UpdateClientQuery(client.ClientId)));
                }
            }

            var vm = _builder.Build()
                     .ToGridVm();

            return(View("GridView", vm));
        }
コード例 #8
0
 private IResourceBuilder BuildPageBase() =>
 _builder.Link(RelTypes.Nav, "Employees", SearchUri(null))
 .Link(Url.AppLink(RelTypes.Nav, "Client", nameof(ClientController.Index), nameof(ClientController)))
 .Link(RelTypes.Breadcrumb, "Employees", SearchUri(null));
コード例 #9
0
 private IFormVm BuildAddForm(ClientEntity clientEntity) =>
 BuildFormBase(clientEntity).Link(Url.AppLink(RelTypes.Breadcrumb, "New Client", nameof(Add), nameof(ClientController)))
 .Link(Url.AppLink(RelTypes.Self, "New Client", nameof(Add), nameof(ClientController)))
 .Build()
 .ToFormVm();