Serenity: Stacked in passing lookup value to stored procedure using serenity

Created on 26 Nov 2018  路  7Comments  路  Source: serenity-is/Serenity

Hi;

I have wrritten the following code in xxEndpoint.cs to run a stored procedure.

         public int Runprocedure(IDbConnection connection)
    {
        connection.Execute("UpdateNumbers",
           param: new
           {
               ProductId = ProductId
           }, commandType: CommandType.StoredProcedure);
        return 0;
    }

Now I am calling it fro xxDialog.ts. I have written the following but don't know how pass the lookup value to the stored procedure.

     Q.serviceRequest(ProductService.baseUrl + '/Runprocedure');

Most helpful comment

Compile first, then T4,
then in xxDialog.ts

ProductService.Runprocedure(
                        {
                            Parametr1: this.form.ProductId.value,
                            Parametr2: this.form.Statement.value
                        },
                        response =>{});

All 7 comments

Compile first, then T4,
then in xxDialog.ts

ProductService.Runprocedure(
                        {
                            Parametr1: this.form.ProductId.value,
                            Parametr2: this.form.Statement.value
                        },
                        response =>{});

@Zahar661
Thank you

hi there - I have been searching through the wiki but can't get to a solution on this so any help would be greatly appreciated, I am trying to pass the Id of a record on a dialog through to a stored procedure (MySQL) but after many attempts and variations on the above and other SP related posts I am now unable to get even close to to a result.

Like the above issue #4098 I am not expecting a result returned back to the user, just trigger a bunch of code on the server.

My difficulty relates to passing the parameter from the dialog to the endpoint, with the above example "Parameter1:" and "Parameter2:" not making much sense to me in relation to the parameter "ProductId = ProductId" in the endpoint, see one of my many interpretations below in the screenshots

[Dialog onClick]
image

[Endpoint] - the project will not rebuild with this error
image

[Endpoint] - if the parameter is hard coded, the below warning message is returned
image

[Error when the button is clicked on hard-coded parameter]
image

@chrisomeara Hi!
EndPoint add request
image
image

in Dialog onClick
image

[Error when the button is clicked on hard-coded parameter]

I won't help here. I do not use stored procedure

[Error when the button is clicked on hard-coded parameter]

I won't help here. I do not use stored procedure
thanks @Zahar661 - very fast response and all the tools to lead me to the answer!

[Endpoint] - note I got the call to the SP working without the number of args error via a SQL execution - I suspect a MySQL thing
image

[ServiceRequest] - added that to the existing XYZmodel.cs from the bulk action request demo example!
image

[Dialog] - a little more work here for me on refreshing the dialog and grid
image

image
image
image
image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dudeman972 picture dudeman972  路  3Comments

ga5tan picture ga5tan  路  3Comments

moostafaa picture moostafaa  路  3Comments

john20xdoe picture john20xdoe  路  3Comments

stixoffire picture stixoffire  路  3Comments