Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "lcyhjx"

Hi

Please see following scenario: I have an application service, in the business logic, need to do some business rule validation. If validation failed, then I throw an AbpException as following” throw new Abp.AbpException("Available balance is not enough.");

But when I invoked the service, I get following response:

{
   "success": false,
   "result": null,
   "error":    {
      "code": 0,
      "message": "An internal error occured during your request!",
      "details": null,
      "validationErrors": null
   },
   "unAuthorizedRequest": false
}

You can see the error message is a common message ‘An internal error occured during your request!’, but the message I want is ‘Available balance is not enough’. The common error message is fine for unexpected exception, but for the business error, I need to get specific business error message in front-end application. Do you have any suggestion?

BTW, there is spelling error: An internal error occured during your request! An internal error occurred during your request!

Hi,

I define a entiy named Order, and define a service In application layer called orderService. In orderService, there are two operations. GetAll() and CreateNewOrder();

The GetAll() operation works fine, the mainly code is

var orders= _orderRepository.GetAll().ToList();

but the CreateNewOrder does not work, I debug it, the following statement has been executed.

var newOrder = _orderRepository.Insert(order);

But nothing happened, the new order is not inserted in to DB, no exception.

I am sure something is wrong in my coding, but no exception when execute Repository.Insert statement, so it is hardly for me to know what’s the issue.

Do you have any suggestion?

Hi In AuthorizationProvider, we can initialize permissions,

public class BOMAuthorizationProvider : AuthorizationProvider
    {
        public override void SetPermissions(IPermissionDefinitionContext context)
        {
            //TODO: Localize (Change FixedLocalizableString to LocalizableString)

            context.CreatePermission("CanCreateQuestions", new FixedLocalizableString("Can create questions"));
            context.CreatePermission("CanDeleteQuestions", new FixedLocalizableString("Can delete questions"));
            context.CreatePermission("CanDeleteAnswers", new FixedLocalizableString("Can delete answers"));
            //context.CreatePermission("CanAnswerToQuestions", new FixedLocalizableString("Can answer to questions"), isGrantedByDefault: true);
            context.CreatePermission("CanAnswerToQuestions", new FixedLocalizableString("Can answer to questions"));

        }
    }

My question is how to implement localization for permissions which will be displayed on GUI. For example, in localization xml file, define a localization string as below

<text name="Permission_Create_Question" value="Can create questions" />

in another localization xml file, define a localization string as below

<text name="Permission_Create_Question" value="新增提问" />

what change should I do to implement it? Thanks!

Hi,

I use the sample module zero. And I make some changes for entity mode, but i do not execute add-migration and update-database command. So normally, if i invoke a service with DB operation, an exception will be thrown. But in this scenario, when I invoke UserManager.LoginAsync, no exception, no result, just break down, and user do not know what happened.

Hi,

Abp framework is great. But in few scenarios, I would like to execute sql directly. Is there a way to execute sql directly in Abp framework?

Hi, I download module zero, and there is example for using modal dialog to create question. But now, I would like to pass parameter to modal dialog, I use resolve to pass parameter, so I make following change: In index.js

vm.showEditRoleDialog = function (roleId) {
                var modalInstance = $modal.open({
                    templateUrl: abp.appPath + 'App/Main/views/roles/editDialog.cshtml',                   
                    controller: 'app.views.roles.editDialog as vm',
                    resolve:
                        {
                           id: function () { return angular.copy(roleId); }
                        },
                    size: 'md'
                });
            };

And then in modalDialog.js

(function () {
    var controllerId = 'app.views.roles.editDialog';
    angular.module('app').controller(controllerId, [
        'abp.services.app.role', '$modalInstance',
        function (roleService, $modalInstance,id) {
            var vm = this;
            vm.id = id;
            vm.role = null;
        }
    ]);
})();

But the value of parameter id is not passed, could you please give me some suggestion?

I get module zero, and run it. Then the address of question/getquestion web api is, <a class="postlink" href="http://localhost:6242/api/serivces/app/question/getquestion">http://localhost:6242/api/serivces/app/ ... etquestion</a>

If I invoke this web api in another application, such as a console application, a win form application or a mobility application, it return

<Response xmlns="http://localhost/API/SERVICES/app/question/getquestion"> <error> <code>0</code> <details null="true"/> <message>No user logged in!</message> <validationErrors null="true"/> </error> <result null="true"/> <success>false</success> <unAuthorizedRequest>true</unAuthorizedRequest> </Response>

I know I miss the authentication data in the request, but what authentication should I pass? I assume I need to invoke a user/login web api to get the authentication data, and then pass it in question/getquestion web api. Could you please give me some suggestion? Thanks so much.

Hi, I get the Module Zero project, it works fine. Thanks. But I found that the instance of IAuthenticationManager is created in web layer. Since the WEB API may not only used by Web Application, may also use by other clients, such as mobile application. So I would like to move AuthenticationManager from web layer to Web API/Application layer. In normal way, I can get instance of IAuthenticationManager in Web API layer as following: private IAuthenticationManager Authentication { get { return System.Web.Http. ApiController.Request.GetOwinContext().Authentication; } } But in Abp Framework, the Web Api is built dynamic, I do not know how to get the instance of IAuthenticationManager in Applciation layer with Abp framework, could you please give me some advice?

Thanks Asp.Net Boilerplate first. I create a sample project from <a class="postlink" href="http://www.aspnetboilerplate.com">http://www.aspnetboilerplate.com</a> by using AngulatJS and Entity Framework, then I would like to change the navrbar with sub-menu as following: • Order • Report • Administration o User management (this is a sub-menu under Administration menu) So I make following changes in Navigation Provider class

context.Manager.MainMenu
                .AddItem(
                    new MenuItemDefinition(
                        "Order",
                        new LocalizableString("Order", BOMConsts.LocalizationSourceName),
                        url: "#/",
                        icon: "fa fa-tasks"
                        )
                )
                .AddItem(
                    new MenuItemDefinition(
                        "Report",
                        new LocalizableString("Report", BOMConsts.LocalizationSourceName),
                        url: "#/Report",
                        icon: "fa fa-bar-chart"
                        )
                )
                .AddItem(
                new MenuItemDefinition(
                    "Administration",
                    new LocalizableString("Administration", BOMConsts.LocalizationSourceName),
                    icon: "fa fa-cogs"
                    ).AddItem(
                        new MenuItemDefinition(
                            "UserManagement",
                            new LocalizableString("UserManagement", BOMConsts.LocalizationSourceName),
                           // url: "/Administration/Users",
                            icon: "fa fa-users"
                            )
                    )
                );

But when I run the project, the sub-menu 'User Management' does not display. Could you please let me know what am I missing? It is better to give me a sample code if it is possible, thanks.

Hi,

I create a sample SimpleTaskSystem project which using angualjs and entityframework. When I run it, If found, there are many SginalR http requests sent out? I didn't see any introduction about SignalR used in asp.net boilerplate in the articles. So, I would like to know, what the SignalR used for in the sample project? If I would like to use SignalR to push service notification to client by using asp.net boilerplate, Is there a sample I can follow?

Showing 11 to 20 of 20 entries