Base solution for your next web application

Activities of "julian"

That worked! Thanks!

Fixed it! It was as you said, a naming problem. Thanks!

But as usual another error raises from the ashes: I added more entitites to my project and the first couple of entities I migrated one at a time but realised you could migrate all at the same time. So I deleted the tables that I had migrated directly in the SQL Server Object Explorer aswell as the migration code, and then I ran the Add Migration command when every entity was included... Success!

But when I run the Update-Database the following error appears:

Error Number:15248,State:1,Class:11 Either the parameter @objname is ambiguous or the claimed @objtype (OBJECT) is wrong.

I have tried to rename the entities to ensure the uniqueness and I also tried with deleting the migration code and Add it again. Still the same problem...

Note: Inbetween these actions I added a column to dbo.AbpUser directly with the SQL Server Object Explorer. But when I realized that could be the problem I immediately deleted it.

Is it problematic to work that directly with the database or is it prefered to use other means?

Sorry for the inconvenience / Julian

Woops, here it is.

namespace Expertspel.Sessions.GetBetTypesAppService
{
    public class BetTypesAppService : IBetTypeAppService
    {
        private readonly IRepository<BetType> _bettypeRepository;

        public BetTypesAppService(IRepository<BetType> bettypeRepository)
        {
            _bettypeRepository = bettypeRepository;
        }

        public ListResultOutput<BetTypeListDto> GetBetTypes(GetBetTypesInput input)
        {
            var bettypes = _bettypeRepository
                .GetAll()
                .WhereIf(
                    input.Filter.Count()!=0,
                    p => p.BetTypeCode.Contains(input.Filter) ||
                            p.BetTypeName.Contains(input.Filter) 
                )
                .OrderBy(p => p.BetTypeCode)
                .ThenBy(p => p.BetTypeName)
                .ToList();

            return new ListResultOutput<BetTypeListDto>(bettypes.MapTo<List<BetTypeListDto>>());
        }
    }
}

Followingg error pops up in my browser error handler:

Error: [$injector:unpr] http://errors.angularjs.org/1.4.0/$injector/unpr?p0=abp.services.app.betTypeProvider%20%3C-%20abp.services.app.betType%20%3C-%20tenant.views.bet.index

Hi!

I'm having difficulties with the get-method in AngularJs. I have followed the step-by-step guide, but when I apply the instructions on my own project the results does'nt show and I have no idea what is wrong.

So I'm going all in with showing my stuff here:

My Application structure: i. Application ii. Sessions iii. GetBetTypesAppService iiii. BetTypesAppService.cs iiii. IBetTypeAppService.cs iiii. Dto iiiii. GetBetTypeListDto.cs iiiii. GetBetTypesInput.cs iiiii. GetBetTypesOutput.cs

So in my latest try to get it to work I placed all the classes and interfaces that is needed in an own map. FYI, I haven't changed a thing in any other file in Application so that's why I'm not showing any of them below.

BetTypesAppService.cs:

namespace Expertspel.Sessions
{
    [AbpAuthorize]
    class SessionAppService : ExpertspelAppServiceBase, ISessionAppService
    {
        [DisableAuditing]
        public async Task<GetCurrentLoginInformationsOutput> GetCurrentLoginInformations()
        {
            var output = new GetCurrentLoginInformationsOutput
            {
                User = (await GetCurrentUserAsync()).MapTo<UserLoginInfoDto>()
            };

            if (AbpSession.TenantId.HasValue)
            {
                output.Tenant = (await GetCurrentTenantAsync()).MapTo<TenantLoginInfoDto>();
            }

            return output;
        }

    }
}

IBetTypeAppService.cs:

namespace Expertspel.Sessions
{
    public interface ISessionAppService : IApplicationService
    {
        Task<GetCurrentLoginInformationsOutput> GetCurrentLoginInformations();
    }
}

BetTypeListDto.cs:

namespace Expertspel.Sessions.GetBetTypesAppService.Dto
{
    [AutoMapFrom(typeof(BetType))]
    public class BetTypeListDto : FullAuditedEntityDto
    {
        public string BetTypeCode { get; set; }

        public string BetTypeName { get; set; }
    }
}

GetBetTypesInput.cs:

namespace Expertspel.Sessions.GetBetTypesAppService.Dto
{
	public class GetBetTypesInput : IInputDto
	{
        public string Filter { get; set; }
	}
    
}

GetBetTypesOutput.cs is empty, the step by step guide did'nt involve it so neither did I.

Index.cshtml:

<div ng-controller="tenant.views.bet.index as vm">
    <div class="row margin-bottom-5">
        <div class="col-xs-6">
            <div class="page-head">
                <div class="page-title">
                    <h1>
                        <span>@L("Bet")</span>
                    </h1>
                </div>
            </div>
        </div>
        <div class="col-xs-6 text-right">
            <button class="btn btn-primary blue" @*ng-click="vm.doIt1()"*@><i class="fa fa-plus"></i> ACTION_ONE</button>
            <button class="btn btn-primary blue" @*ng-click="vm.doIt2()"*@><i class="fa fa-plus"></i> ACTION_TWO</button>
        </div>
    </div>
    <div class="portlet light">
        <div class="portlet-body">
            <h3>@L("AllBetTypes")</h3>

            <div class="list-group">
                <a href="javascript:;" class="list-group-item" ng-repeat="betType in vm.bettypes">
                    <h4 class="list-group-item-heading">
                        BetTypeCode: 
                        {{betType.BetTypeCode}}
                    </h4>
                    <p class="list-group-item-text">
                        BetTypeName: 
                        {{betType.BetTypeName}}
                    </p> 
                </a>
            </div>

        </div>
    </div>
</div>

Index.js:

<div ng-controller="tenant.views.bet.index as vm">
    <div class="row margin-bottom-5">
        <div class="col-xs-6">
            <div class="page-head">
                <div class="page-title">
                    <h1>
                        <span>@L("Bet")</span>
                    </h1>
                </div>
            </div>
        </div>
        <div class="col-xs-6 text-right">
            <button class="btn btn-primary blue" @*ng-click="vm.doIt1()"*@><i class="fa fa-plus"></i> ACTION_ONE</button>
            <button class="btn btn-primary blue" @*ng-click="vm.doIt2()"*@><i class="fa fa-plus"></i> ACTION_TWO</button>
        </div>
    </div>
    <div class="portlet light">
        <div class="portlet-body">
            <h3>@L("AllBetTypes")</h3>

            <div class="list-group">
                <a href="javascript:;" class="list-group-item" ng-repeat="betType in vm.bettypes">
                    <h4 class="list-group-item-heading">
                        BetTypeCode: 
                        {{betType.BetTypeCode}}
                    </h4>
                    <p class="list-group-item-text">
                        BetTypeName: 
                        {{betType.BetTypeName}}
                    </p> 
                </a>
            </div>

        </div>
    </div>
</div>

Any Idea what could be the problem?

1: Here I get the following errors:

Error: [$injector:unpr] <a class="postlink" href="http://errors.angularjs.org/1.4.0/$injector/unpr?p0=abp.services.app.tenantBetTypeProvider%20%3C-%20abp.services.app.tenantBetType%20%3C-%20tenant.views.bet.index">http://errors.angularjs.org/1.4.0/$inje ... .bet.index</a> at Error (native) at <a class="postlink" href="http://localhost:6234/Scripts/angular.min.js:6:416">http://localhost:6234/Scripts/angular.min.js:6:416</a> at <a class="postlink" href="http://localhost:6234/Scripts/angular.min.js:40:204">http://localhost:6234/Scripts/angular.min.js:40:204</a> at Object.d [as get] (<a class="postlink" href="http://localhost:6234/Scripts/angular.min.js:38:175">http://localhost:6234/Scripts/angular.min.js:38:175</a>) at <a class="postlink" href="http://localhost:6234/Scripts/angular.min.js:40:278">http://localhost:6234/Scripts/angular.min.js:40:278</a> at d (<a class="postlink" href="http://localhost:6234/Scripts/angular.min.js:38:175">http://localhost:6234/Scripts/angular.min.js:38:175</a>) at Object.e [as invoke] (<a class="postlink" href="http://localhost:6234/Scripts/angular.min.js:38:445">http://localhost:6234/Scripts/angular.min.js:38:445</a>) at We.$get.Q.instance (<a class="postlink" href="http://localhost:6234/Scripts/angular.min.js:79:299">http://localhost:6234/Scripts/angular.min.js:79:299</a>) at M (<a class="postlink" href="http://localhost:6234/Scripts/angular.min.js:60:483">http://localhost:6234/Scripts/angular.min.js:60:483</a>) at g (<a class="postlink" href="http://localhost:6234/Scripts/angular.min.js:54:300">http://localhost:6234/Scripts/angular.min.js:54:300</a>) <div ui-view="" class="fade-in-up ng-scope">

2: Couldnt find any getBetType or anything like that in the Network tab.

3: Couldnt even find a log file...

BetTypeAppService:

class BetTypeAppService : ExpertspelServiceBase, IBetTypeAppService
    {
        private readonly IRepository<BetType> _betTypeRepository;

    public BetTypeAppService(IRepository<BetType> personRepository)
    {
        _betTypeRepository = personRepository;
    }

    public ListResultOutput<BetTypeListDto> GetBetTypes(GetBetTypeInput input)
    {
        var betType = _betTypeRepository
            .GetAll()
            .WhereIf(
                !(input.Filter==null),
                p => p.BetTypeCode.Contains(input.Filter) ||
                        p.BetTypeName.Contains(input.Filter)
            )
            .OrderBy(p => p.BetTypeCode)
            .ThenBy(p => p.BetTypeName)
            .ToList();

        return new ListResultOutput<BetTypeListDto>(betType.MapTo<List<BetTypeListDto>>());
    }

    }

And the get class

class GetBetTypeInput:IInputDto
    {
        public string Filter { get; set; }
    }

    [AutoMapFrom(typeof(BetType))]
    public class BetTypeListDto : FullAuditedEntityDto
    {
        public string BetTypeCode { get; set; }

        public string BetTypeName { get; set; }
    }

The interface for BetTypeAppService:

interface IBetTypeAppService : IApplicationService
    {
        ListResultOutput<BetTypeListDto> GetBetTypes(GetBetTypeInput input);
    }

And finally the AppServiceBase class:

public abstract class ExpertspelAppServiceBase : ApplicationService
    {
        public TenantManager TenantManager { get; set; }

        public UserManager UserManager { get; set; }

        protected ExpertspelAppServiceBase()
        {
            LocalizationSourceName = ExpertspelConsts.LocalizationSourceName;
        }

        protected virtual Task<User> GetCurrentUserAsync()
        {
            var user = UserManager.FindByIdAsync(AbpSession.GetUserId());
            if (user == null)
            {
                throw new ApplicationException("There is no current user!");
            }

            return user;
        }

        protected virtual User GetCurrentUser()
        {
            var user = UserManager.FindById(AbpSession.GetUserId());
            if (user == null)
            {
                throw new ApplicationException("There is no current user!");
            }

            return user;
        }

        protected virtual Task<Tenant> GetCurrentTenantAsync()
        {
            return TenantManager.GetByIdAsync(AbpSession.GetTenantId());
        }

        protected virtual Tenant GetCurrentTenant()
        {
            return TenantManager.GetById(AbpSession.GetTenantId());
        }

        protected virtual void CheckErrors(IdentityResult identityResult)
        {
            identityResult.CheckErrors(LocalizationManager);
        }
    }

Okey so when i read the summary in the base class I may have found out what I have done wrong, should I insert the getBetType method in the base class too?

Hi!

I'm having difficulties with the get-method in AngularJs. I have followed the step-by-step guide, wich has been very good, but when I apply the instructions on my own project the results does'nt show and I have no idea what is wrong.

This is my js code:

(function () { appModule.controller('tenant.views.bet.index', [ '$scope', 'abp.services.app.tenantBetType', function ($scope, tenantBetTypeService) { var vm = this;

        $scope.$on('$viewContentLoaded', function () {
            Metronic.initAjax();
        });//this part doesnt exist in the tutorial but it does in the other views in my project so I just assumed it should be                 //there.

        vm.getBetTypes = [];

        tenantBetTypeService.getBetTypes({}).success(function (result) {
            vm.betTypes = result.items;
        });


        //...
    }
]);

And here is my cshtml code:

<div ng-controller="tenant.views.bet.index as vm"> <div class="row margin-bottom-5"> <div class="col-xs-6"> <div class="page-head"> <div class="page-title"> <h1> <span>@L("Bet")</span> </h1> </div> </div> </div> <div class="col-xs-6 text-right"> <button class="btn btn-primary blue" @ng-click="vm.doIt1()"@><i class="fa fa-plus"></i> ACTION_ONE</button> <button class="btn btn-primary blue" @ng-click="vm.doIt2()"@><i class="fa fa-plus"></i> ACTION_TWO</button> </div> </div> <div class="portlet light"> <div class="portlet-body"> <h3>@L("AllBetTypes")</h3>

        &lt;div class=&quot;list-group&quot;&gt;
            &lt;a href=&quot;javascript:;&quot; class=&quot;list-group-item&quot; ng-repeat=&quot;betType in vm.betTypes&quot;&gt;
                &lt;h4 class=&quot;list-group-item-heading&quot;&gt;
                    {{betType.BetTypeCode}} {{betType.BetTypeName}}  //the attributes i want to call
                &lt;/h4&gt;
            &lt;/a&gt;
        &lt;/div&gt;

    &lt;/div&gt;
&lt;/div&gt;

</div>

Answer

Hi!

Regarding the Azure deployment, did you guys deploy it from visual studio or from some other platform?

Solved! Yes, I marked it as embedded but used the wrong key, I used sv-SE instead of just sv...

My bad! Thanks anyway!

/Julian

Showing 1 to 10 of 11 entries