serenity-is / Serenity

Business Apps Made Simple with Asp.Net Core MVC / TypeScript
https://serenity.is
MIT License
2.59k stars 794 forks source link

How to add a new page using sergen.exe by a new page I mean a new entry under modules #2107

Closed fernandocordero closed 7 years ago

fernandocordero commented 7 years ago

Guys,

Sorry if this sounds stupid, am a new to Serenity and i need to know what is the right process to create a new new file class and .TS file under modules. Haven't found an straight forward tutorial on how after your project is create you can add a new page. Any help would be really appreciate it

mreid2005 commented 7 years ago

Are you asking how to generate a "new" page from a table after you have run sergen? for ex: after you get started initially you use sergen to generate pages for your project, and you have 3 initial tables? and your pages are created in..

/modules/myProject/table1 /modules/myProject/table2 /modules/myProject/table3

and you have created a new table (or didn't include one initially), and want to generate it's pages? if this is the case. Simply launch sergen again. select the datasource, if it is empty or not pointing at the right datasource for the table you want to generate pages from then, highlight only the table or tables you want to generate pages for. Do not select any tables you already have generated pages for. click close sergen rebuild project, and voila your pages will appear.

Let me know if I didn't fully understand the question.

wirble commented 7 years ago

If the table already generated you can create a different form based on the the class/table previously generated by following... https://github.com/volkanceylan/Serenity/wiki/Create-another-form-of-the-same-Sergen-generated-table

Useful for creating different forms on same table.

fernandocordero commented 7 years ago

Wirble,

How can I use my own controllers in Serenity? Am trying to use Ajax.ActionLink to be able to my own controller but of course the route is set for the index method of the Page.cs. Is there a way to do this?

Fernando Cordero 407-286-9095


From: wirble notifications@github.com Sent: Friday, March 31, 2017 5:45 PM To: volkanceylan/Serenity Cc: fernandocordero; Author Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107)

If the table already generated you can create a different form based on the the class/table previously generated by following... https://github.com/volkanceylan/Serenity/wiki/Create-another-form-of-the-same-Sergen-generated-table

[https://avatars0.githubusercontent.com/u/752470?v=3&s=400]https://github.com/volkanceylan/Serenity/wiki/Create-another-form-of-the-same-Sergen-generated-table

Create another form of the same Sergen generated table ...https://github.com/volkanceylan/Serenity/wiki/Create-another-form-of-the-same-Sergen-generated-table github.com This allows you to create a different form from the main form, allowing you to create a form with more or less fields from your main form. In cases where certain ...

Useful for creating different forms on same table.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/volkanceylan/Serenity/issues/2107#issuecomment-290837888, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZiSOagCskxp6eALNvyKbJDY9bX4YCp5ks5rrXPjgaJpZM4Mtb_r.

wirble commented 7 years ago

Look at the dashboard example, it uses it's own controller and view in there...why would you need to use your own controller?

On Mon, Apr 3, 2017 at 10:31 AM, fernandocordero notifications@github.com wrote:

Wirble,

How can I use my own controllers in Serenity? Am trying to use Ajax.ActionLink to be able to my own controller but of course the route is set for the index method of the Page.cs. Is there a way to do this?

Fernando Cordero 407-286-9095 <(407)%20286-9095>


From: wirble notifications@github.com Sent: Friday, March 31, 2017 5:45 PM To: volkanceylan/Serenity Cc: fernandocordero; Author Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107)

If the table already generated you can create a different form based on the the class/table previously generated by following... https://github.com/volkanceylan/Serenity/wiki/Create-another-form-of-the- same-Sergen-generated-table

[https://avatars0.githubusercontent.com/u/752470?v=3&s=400]https:// github.com/volkanceylan/Serenity/wiki/Create-another- form-of-the-same-Sergen-generated-table

Create another form of the same Sergen generated table ...< https://github.com/volkanceylan/Serenity/wiki/Create-another-form-of-the- same-Sergen-generated-table> github.com This allows you to create a different form from the main form, allowing you to create a form with more or less fields from your main form. In cases where certain ...

Useful for creating different forms on same table.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ volkanceylan/Serenity/issues/2107#issuecomment-290837888, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ AZiSOagCskxp6eALNvyKbJDY9bX4YCp5ks5rrXPjgaJpZM4Mtb_r.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/volkanceylan/Serenity/issues/2107#issuecomment-291214710, or mute the thread https://github.com/notifications/unsubscribe-auth/AH1Pxh0mg9FkI92KjeP0aOzt3adsFa7mks5rsSzigaJpZM4Mtb_r .

fernandocordero commented 7 years ago

Well, I need to show some remote reports from SSRS using ReportViewerForMvc so I'd like to pass some parameter for the report selection mainly.

Fernando Cordero 407-286-9095


From: wirble notifications@github.com Sent: Monday, April 3, 2017 1:56 PM To: volkanceylan/Serenity Cc: fernandocordero; Author Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107)

Look at the dashboard example, it uses it's own controller and view in there...why would you need to use your own controller?

On Mon, Apr 3, 2017 at 10:31 AM, fernandocordero notifications@github.com wrote:

Wirble,

How can I use my own controllers in Serenity? Am trying to use Ajax.ActionLink to be able to my own controller but of course the route is set for the index method of the Page.cs. Is there a way to do this?

Fernando Cordero 407-286-9095 <(407)%20286-9095>


From: wirble notifications@github.com Sent: Friday, March 31, 2017 5:45 PM To: volkanceylan/Serenity Cc: fernandocordero; Author Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107)

If the table already generated you can create a different form based on the the class/table previously generated by following... https://github.com/volkanceylan/Serenity/wiki/Create-another-form-of-the- same-Sergen-generated-table

[https://avatars0.githubusercontent.com/u/752470?v=3&s=400]https:// github.com/volkanceylan/Serenity/wiki/Create-another- form-of-the-same-Sergen-generated-table

Create another form of the same Sergen generated table ...< https://github.com/volkanceylan/Serenity/wiki/Create-another-form-of-the- same-Sergen-generated-table> github.com This allows you to create a different form from the main form, allowing you to create a form with more or less fields from your main form. In cases where certain ...

Useful for creating different forms on same table.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ volkanceylan/Serenity/issues/2107#issuecomment-290837888, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ AZiSOagCskxp6eALNvyKbJDY9bX4YCp5ks5rrXPjgaJpZM4Mtb_r.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/volkanceylan/Serenity/issues/2107#issuecomment-291214710, or mute the thread https://github.com/notifications/unsubscribe-auth/AH1Pxh0mg9FkI92KjeP0aOzt3adsFa7mks5rsSzigaJpZM4Mtb_r .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/volkanceylan/Serenity/issues/2107#issuecomment-291221757, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZiSOQoQe-TFPnMFfbnic7nqhI3K8IRzks5rsTK3gaJpZM4Mtb_r.

fernandocordero commented 7 years ago

Volkan,

I certainly think you've made a fantastic job with the template, it makes so much easier to do things so the developer can focus on the business rules! Am writing you because I need your advise on how to implement the best approach as far as to have auditing capabilities on the project for which we use Serenity. In our case, we just need to monitor not all the tables in our database (we use SQL Server) mainly for forensic analysis and find patterns that can help us to improve our system, If you can point me into the right direction on how we should handle this and still be Serenity compliant I would really appreciate it.

Thanks in advance,

Fernando Cordero 407-286-9095


From: Volkan Ceylan notifications@github.com Sent: Wednesday, April 19, 2017 5:00 AM To: volkanceylan/Serenity Cc: fernandocordero; Author Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107)

Closed #2107https://github.com/volkanceylan/Serenity/issues/2107.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/volkanceylan/Serenity/issues/2107#event-1048152067, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZiSOdWlZXr6VUDF7TeFA61W0_jQcTKkks5rxc01gaJpZM4Mtb_r.

mrajalko commented 7 years ago

hi @fernandocordero ,

you can have a look at issue #874 for maintaining audit log in a single table. i found it useful for my purpose.

fernandocordero commented 7 years ago

Thanks!

Fernando Cordero 407-286-9095


From: mrajalko notifications@github.com Sent: Saturday, April 22, 2017 9:19:58 AM To: volkanceylan/Serenity Cc: fernandocordero; Mention Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107)

hi @fernandocorderohttps://github.com/fernandocordero ,

you can have a look at issue #874https://github.com/volkanceylan/Serenity/issues/874 for maintaining audit log in a single table. i found it useful for my purpose.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/volkanceylan/Serenity/issues/2107#issuecomment-296372786, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZiSOeU-8F9uk1vwQevPfqBlUvCUh_Mdks5ryf5-gaJpZM4Mtb_r.

gfo2007 commented 5 years ago

@fernandocordero please were you able to implement SSRS? I need to add that to my project and so far, I have been scratching my head. Let me know if you have and kindly post the code to help me please

fernandocordero commented 5 years ago

Yes I have, let me send you how to do it.


From: gfo2007 notifications@github.com Sent: Thursday, October 4, 2018 9:31 AM To: volkanceylan/Serenity Cc: fernandocordero; Mention Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107)

@fernandocorderohttps://github.com/fernandocordero please were you able to implement SSRS? I need to add that to my project and so far, I have been scratching my head. Let me know if you have and kindly post the code to help me please

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/volkanceylan/Serenity/issues/2107#issuecomment-427019264, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZiSOdB-3P3uIztL38FRbJGui3Y2tNOGks5uhg2hgaJpZM4Mtb_r.

bt101 commented 5 years ago

@fernandocordero is it possible to post it? Otherwise, can you send it my way as well? Thanks!

fernandocordero commented 5 years ago

Let me send you what I have, zip file.


From: bt101 notifications@github.com Sent: Saturday, October 6, 2018 4:21 PM To: volkanceylan/Serenity Cc: fernandocordero; Mention Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107)

@fernandocorderohttps://github.com/fernandocordero is it possible to post it? Otherwise, can you send it my way as well? Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/volkanceylan/Serenity/issues/2107#issuecomment-427603495, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZiSOVYtWUn2ZGjUngOlDq-7YZZtild1ks5uiRDEgaJpZM4Mtb_r.

fernandocordero commented 5 years ago

Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107) [https://cid-36945b376c9efe4b.users.storage.live.com/users/0x36945b376c9efe4b/myprofile/expressionprofile/profilephoto:UserTileStatic,UserTileSmall/MeControlMediumUserTile?ck=1&ex=24&fofoff=1]     Fernando Cordero Wed 10/10/2018, 6:24 AM You  Here you go:

1) Make a class as below, call it SSRSReportServerCredentials.cs

using Microsoft.Reporting.WebForms; using System; using System.Configuration; using System.Net; using System.Security.Principal;

namespace CostTracker.Reports {

[Serializable]
public sealed class SSRSReportServerCredentials : IReportServerCredentials
{
    public WindowsIdentity ImpersonationUser
    {
        get
        {
            // Use the default Windows user.  Credentials will be
            // provided by the NetworkCredentials property.
            return null;
        }
    }

    public ICredentials NetworkCredentials
    {
        get
        {
            // Read the user information from the Web.config file.
            // By reading the information on demand instead of
            // storing it, the credentials will not be stored in
            // session, reducing the vulnerable surface area to the
            // Web.config file, which can be secured with an ACL.

            // User name
            string userName =
                ConfigurationManager.AppSettings
                    ["SSRSUserID"];

            //if (string.IsNullOrEmpty(userName))
            //    throw new Exception(
            //        "Missing user name from web.config file");

            // Password
            string password =
                ConfigurationManager.AppSettings
                    ["SSRSPwd"];

            //if (string.IsNullOrEmpty(password))
            //    throw new Exception(
            //        "Missing password from web.config file");

            // Domain
            //string domain =
            //    ConfigurationManager.AppSettings
            //        ["SSRSDomain"];

            //if (string.IsNullOrEmpty(domain))
            //    throw new Exception(
            //        "Missing domain from web.config file");

            return new NetworkCredential(userName, password);
        }
    }

    public bool GetFormsCredentials(out Cookie authCookie,
                out string userName, out string password,
                out string authority)
    {
        authCookie = null;
        userName = null;
        password = null;
        authority = null;

        // Not using form credentials
        return false;
    }
}

}

2) Make another class for the Report Viewer Controller, call it ReportViewerControl.cs

using Microsoft.Reporting.WebForms; using System; using System.Web.UI.WebControls;

namespace CostTracker.Reports { public static class ReportViewerControl { public static ReportViewer GetReportViewerControl(string reportPath) { ReportViewer reportViewer = new ReportViewer(); reportViewer.ServerReport.ReportPath = reportPath; reportViewer.ProcessingMode = ProcessingMode.Remote; reportViewer.SizeToReportContent = false; reportViewer.AsyncRendering = true; reportViewer.Width = Unit.Percentage(100); reportViewer.Height = Unit.Percentage(100); reportViewer.ShowBackButton = true; reportViewer.ShowPrintButton = true; reportViewer.ServerReport.ReportServerUrl = new Uri("http://YOUR_SSRS_REPORT_SERVER"); reportViewer.ServerReport.ReportServerCredentials = new SSRSReportServerCredentials(); return reportViewer; } } }

3) Now you can have report menu page like, for example call this one BudgetReportIndex.cshtml:

[cid:4ce5da48-405a-47ea-ae2b-c00cee033655]

Now, to properly redirect to the right report make a final class, call it BudgetReportPage.cs

[cid:8b305fe7-6920-4bcb-9ff0-ba1b1a005685]

If you notice, this class uses a partial called _ReportView.cshtml, this represents the iframe to display report and uses the Microsoft report Viewer

[cid:e1b2de7c-a461-454d-9328-97f68bb8397a]

Which you need to reference

[cid:5588a74d-2cf0-45b9-a31c-daf09615963e]

Hope this points you into the right direction brother, happy coding.


From: Fernando Cordero fernandocordero@hotmail.com Sent: Thursday, October 4, 2018 12:34 PM To: volkanceylan/Serenity Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107)

Yes I have, let me send you how to do it.


From: gfo2007 notifications@github.com Sent: Thursday, October 4, 2018 9:31 AM To: volkanceylan/Serenity Cc: fernandocordero; Mention Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107)

@fernandocorderohttps://github.com/fernandocordero please were you able to implement SSRS? I need to add that to my project and so far, I have been scratching my head. Let me know if you have and kindly post the code to help me please

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/volkanceylan/Serenity/issues/2107#issuecomment-427019264, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZiSOdB-3P3uIztL38FRbJGui3Y2tNOGks5uhg2hgaJpZM4Mtb_r.


From: bt101 notifications@github.com Sent: Saturday, October 6, 2018 4:21 PM To: volkanceylan/Serenity Cc: fernandocordero; Mention Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107)

@fernandocorderohttps://github.com/fernandocordero is it possible to post it? Otherwise, can you send it my way as well? Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/volkanceylan/Serenity/issues/2107#issuecomment-427603495, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZiSOVYtWUn2ZGjUngOlDq-7YZZtild1ks5uiRDEgaJpZM4Mtb_r.

bt101 commented 5 years ago

@fernandocordero

Thank you! Were the following references originally screen shots? [cid:4ce5da48-405a-47ea-ae2b-c00cee033655] [cid:8b305fe7-6920-4bcb-9ff0-ba1b1a005685] cid:e1b2de7c-a461-454d-9328-97f68bb8397a] [cid:5588a74d-2cf0-45b9-a31c-daf09615963e]

If so, they didn't seem to come through.

Thanks!

fernandocordero commented 5 years ago

yes what is your email so i can send you the pics


From: bt101 notifications@github.com Sent: Wednesday, October 10, 2018 11:36 AM To: volkanceylan/Serenity Cc: fernandocordero; Mention Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107)

Thank you! Were the following references originally screen shots? [cid:4ce5da48-405a-47ea-ae2b-c00cee033655] [cid:8b305fe7-6920-4bcb-9ff0-ba1b1a005685] cid:e1b2de7c-a461-454d-9328-97f68bb8397a] [cid:5588a74d-2cf0-45b9-a31c-daf09615963e]

If so, they didn't seem to come through.

Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/volkanceylan/Serenity/issues/2107#issuecomment-428621051, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZiSOcbTG4NPOebLrCZGmDGCpy-5nxEkks5ujhQIgaJpZM4Mtb_r.

bt101 commented 5 years ago

@fernandocordero I got it working over the weekend thanks to your help. Thank you!

fernandocordero commented 5 years ago

Hey!!! great man happy to help. I think if we stop been selfish and share the info, the programming world would be a better place. Good luck my friend


From: bt101 notifications@github.com Sent: Tuesday, October 16, 2018 9:26 PM To: volkanceylan/Serenity Cc: fernandocordero; Mention Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107)

@fernandocorderohttps://github.com/fernandocordero I got it working over the weekend thanks to your help. Thank you!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/volkanceylan/Serenity/issues/2107#issuecomment-430456728, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZiSOfxWX_v_xIvp7lscDGUqORyGrWEMks5uloc7gaJpZM4Mtb_r.

heveoneron commented 5 years ago

Hai @fernandocordero , I have same problem like @bt101, may i have the pics for reference ? because i have deadline in this week for reporting, Please Help, Thank's

bt101 commented 5 years ago

Hi @heveoneron, Were you able to figure it out? Here is the message originally from @fernandocordero:

Here you go:

1) Make a class as below, call it SSRSReportServerCredentials.cs

using Microsoft.Reporting.WebForms; using System; using System.Configuration; using System.Net; using System.Security.Principal;

namespace CostTracker.Reports {

[Serializable]
public sealed class SSRSReportServerCredentials : IReportServerCredentials
{
    public WindowsIdentity ImpersonationUser
    {
        get
        {
            // Use the default Windows user.  Credentials will be
            // provided by the NetworkCredentials property.
            return null;
        }
    }

    public ICredentials NetworkCredentials
    {
        get
        {
            // Read the user information from the Web.config file.  
            // By reading the information on demand instead of 
            // storing it, the credentials will not be stored in 
            // session, reducing the vulnerable surface area to the
            // Web.config file, which can be secured with an ACL.

            // User name
            string userName =
                ConfigurationManager.AppSettings
                    ["SSRSUserID"];

            //if (string.IsNullOrEmpty(userName))
            //    throw new Exception(
            //        "Missing user name from web.config file");

            // Password
            string password =
                ConfigurationManager.AppSettings
                    ["SSRSPwd"];

            //if (string.IsNullOrEmpty(password))
            //    throw new Exception(
            //        "Missing password from web.config file");

            // Domain
            //string domain =
            //    ConfigurationManager.AppSettings
            //        ["SSRSDomain"];

            //if (string.IsNullOrEmpty(domain))
            //    throw new Exception(
            //        "Missing domain from web.config file");

            return new NetworkCredential(userName, password);
        }
    }

    public bool GetFormsCredentials(out Cookie authCookie,
                out string userName, out string password,
                out string authority)
    {
        authCookie = null;
        userName = null;
        password = null;
        authority = null;

        // Not using form credentials
        return false;
    }
}

}

2) Make another class for the Report Viewer Controller, call it ReportViewerControl.cs

using Microsoft.Reporting.WebForms; using System; using System.Web.UI.WebControls;

namespace CostTracker.Reports { public static class ReportViewerControl { public static ReportViewer GetReportViewerControl(string reportPath) { ReportViewer reportViewer = new ReportViewer(); reportViewer.ServerReport.ReportPath = reportPath; reportViewer.ProcessingMode = ProcessingMode.Remote; reportViewer.SizeToReportContent = false; reportViewer.AsyncRendering = true; reportViewer.Width = Unit.Percentage(100); reportViewer.Height = Unit.Percentage(100); reportViewer.ShowBackButton = true; reportViewer.ShowPrintButton = true; reportViewer.ServerReport.ReportServerUrl = new Uri("http://YOUR_SSRS_REPORT_SERVER"); reportViewer.ServerReport.ReportServerCredentials = new SSRSReportServerCredentials(); return reportViewer; } } }

3) Now you can have report menu page like, for example call this one BudgetReportIndex.cshtml:

screenshot1

Now, to properly redirect to the right report make a final class, call it BudgetReportPage.cs

screenshot2

If you notice, this class uses a partial called _ReportView.cshtml, this represents the iframe to display report and uses the Microsoft report Viewer

screenshot3

Which you need to reference

screenshot4

Hope this points you into the right direction brother, happy coding.

heveoneron commented 5 years ago

Thank's for the code, but i have question about what is [Domain Name ] in credential ?

On Wed, 27 Feb 2019 02:01 bt101, notifications@github.com wrote:

Hi @heveoneron https://github.com/heveoneron, Were you able to figure it out? Here is the message originally from @fernandocordero https://github.com/fernandocordero:

Here you go:

  1. Make a class as below, call it SSRSReportServerCredentials.cs

using Microsoft.Reporting.WebForms; using System; using System.Configuration; using System.Net; using System.Security.Principal;

namespace CostTracker.Reports {

[Serializable] public sealed class SSRSReportServerCredentials : IReportServerCredentials { public WindowsIdentity ImpersonationUser { get { // Use the default Windows user. Credentials will be // provided by the NetworkCredentials property. return null; } }

public ICredentials NetworkCredentials
{
    get
    {
        // Read the user information from the Web.config file.
        // By reading the information on demand instead of
        // storing it, the credentials will not be stored in
        // session, reducing the vulnerable surface area to the
        // Web.config file, which can be secured with an ACL.

        // User name
        string userName =
            ConfigurationManager.AppSettings
                ["SSRSUserID"];

        //if (string.IsNullOrEmpty(userName))
        //    throw new Exception(
        //        "Missing user name from web.config file");

        // Password
        string password =
            ConfigurationManager.AppSettings
                ["SSRSPwd"];

        //if (string.IsNullOrEmpty(password))
        //    throw new Exception(
        //        "Missing password from web.config file");

        // Domain
        //string domain =
        //    ConfigurationManager.AppSettings
        //        ["SSRSDomain"];

        //if (string.IsNullOrEmpty(domain))
        //    throw new Exception(
        //        "Missing domain from web.config file");

        return new NetworkCredential(userName, password);
    }
}

public bool GetFormsCredentials(out Cookie authCookie,
            out string userName, out string password,
            out string authority)
{
    authCookie = null;
    userName = null;
    password = null;
    authority = null;

    // Not using form credentials
    return false;
}

}

}

  1. Make another class for the Report Viewer Controller, call it ReportViewerControl.cs

using Microsoft.Reporting.WebForms; using System; using System.Web.UI.WebControls;

namespace CostTracker.Reports { public static class ReportViewerControl { public static ReportViewer GetReportViewerControl(string reportPath) { ReportViewer reportViewer = new ReportViewer(); reportViewer.ServerReport.ReportPath = reportPath; reportViewer.ProcessingMode = ProcessingMode.Remote; reportViewer.SizeToReportContent = false; reportViewer.AsyncRendering = true; reportViewer.Width = Unit.Percentage(100); reportViewer.Height = Unit.Percentage(100); reportViewer.ShowBackButton = true; reportViewer.ShowPrintButton = true; reportViewer.ServerReport.ReportServerUrl = new Uri(" http://YOUR_SSRS_REPORT_SERVER"); reportViewer.ServerReport.ReportServerCredentials = new SSRSReportServerCredentials(); return reportViewer; } } }

  1. Now you can have report menu page like, for example call this one BudgetReportIndex.cshtml:

<< Screenshot1 >>

Now, to properly redirect to the right report make a final class, call it BudgetReportPage.cs

<< Screenshot2 >>

If you notice, this class uses a partial called _ReportView.cshtml, this represents the iframe to display report and uses the Microsoft report Viewer

<< Screenshot3 >>

Which you need to reference

<< Screenshot4 >>

Hope this points you into the right direction brother, happy coding. [image: screenshot1] https://user-images.githubusercontent.com/30605815/53438907-de788f80-39ce-11e9-9e43-14ee57daee0a.png [image: screenshot2] https://user-images.githubusercontent.com/30605815/53438908-de788f80-39ce-11e9-8b9f-cc1aee7cb089.png [image: screenshot3] https://user-images.githubusercontent.com/30605815/53438905-de788f80-39ce-11e9-99df-c35968e423fe.png [image: screenshot4] https://user-images.githubusercontent.com/30605815/53438906-de788f80-39ce-11e9-90ca-b8d9bae50161.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/volkanceylan/Serenity/issues/2107#issuecomment-467567970, or mute the thread https://github.com/notifications/unsubscribe-auth/AYxlIyBXToH3-k27EcNEVN7Az_n_GKAYks5vRYSNgaJpZM4Mtb_r .

fernandocordero commented 5 years ago

Domain Name is simply the DNS of your SSRS server. e.g. https://mySSRSWebSite.com/


From: MhafizY notifications@github.com Sent: Tuesday, February 26, 2019 6:39 PM To: volkanceylan/Serenity Cc: fernandocordero; Mention Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107)

Thank's for the code, but i have question about what is [Domain Name ] in credential ?

On Wed, 27 Feb 2019 02:01 bt101, notifications@github.com wrote:

Hi @heveoneron https://github.com/heveoneron, Were you able to figure it out? Here is the message originally from @fernandocordero https://github.com/fernandocordero:

Here you go:

  1. Make a class as below, call it SSRSReportServerCredentials.cs

using Microsoft.Reporting.WebForms; using System; using System.Configuration; using System.Net; using System.Security.Principal;

namespace CostTracker.Reports {

[Serializable] public sealed class SSRSReportServerCredentials : IReportServerCredentials { public WindowsIdentity ImpersonationUser { get { // Use the default Windows user. Credentials will be // provided by the NetworkCredentials property. return null; } }

public ICredentials NetworkCredentials { get { // Read the user information from the Web.config file. // By reading the information on demand instead of // storing it, the credentials will not be stored in // session, reducing the vulnerable surface area to the // Web.config file, which can be secured with an ACL.

// User name string userName = ConfigurationManager.AppSettings ["SSRSUserID"];

//if (string.IsNullOrEmpty(userName)) // throw new Exception( // "Missing user name from web.config file");

// Password string password = ConfigurationManager.AppSettings ["SSRSPwd"];

//if (string.IsNullOrEmpty(password)) // throw new Exception( // "Missing password from web.config file");

// Domain //string domain = // ConfigurationManager.AppSettings // ["SSRSDomain"];

//if (string.IsNullOrEmpty(domain)) // throw new Exception( // "Missing domain from web.config file");

return new NetworkCredential(userName, password); } }

public bool GetFormsCredentials(out Cookie authCookie, out string userName, out string password, out string authority) { authCookie = null; userName = null; password = null; authority = null;

// Not using form credentials return false; } }

}

  1. Make another class for the Report Viewer Controller, call it ReportViewerControl.cs

using Microsoft.Reporting.WebForms; using System; using System.Web.UI.WebControls;

namespace CostTracker.Reports { public static class ReportViewerControl { public static ReportViewer GetReportViewerControl(string reportPath) { ReportViewer reportViewer = new ReportViewer(); reportViewer.ServerReport.ReportPath = reportPath; reportViewer.ProcessingMode = ProcessingMode.Remote; reportViewer.SizeToReportContent = false; reportViewer.AsyncRendering = true; reportViewer.Width = Unit.Percentage(100); reportViewer.Height = Unit.Percentage(100); reportViewer.ShowBackButton = true; reportViewer.ShowPrintButton = true; reportViewer.ServerReport.ReportServerUrl = new Uri(" http://YOUR_SSRS_REPORT_SERVER"); reportViewer.ServerReport.ReportServerCredentials = new SSRSReportServerCredentials(); return reportViewer; } } }

  1. Now you can have report menu page like, for example call this one BudgetReportIndex.cshtml:

<< Screenshot1 >>

Now, to properly redirect to the right report make a final class, call it BudgetReportPage.cs

<< Screenshot2 >>

If you notice, this class uses a partial called _ReportView.cshtml, this represents the iframe to display report and uses the Microsoft report Viewer

<< Screenshot3 >>

Which you need to reference

<< Screenshot4 >>

Hope this points you into the right direction brother, happy coding. [image: screenshot1] https://user-images.githubusercontent.com/30605815/53438907-de788f80-39ce-11e9-9e43-14ee57daee0a.png [image: screenshot2] https://user-images.githubusercontent.com/30605815/53438908-de788f80-39ce-11e9-8b9f-cc1aee7cb089.png [image: screenshot3] https://user-images.githubusercontent.com/30605815/53438905-de788f80-39ce-11e9-99df-c35968e423fe.png [image: screenshot4] https://user-images.githubusercontent.com/30605815/53438906-de788f80-39ce-11e9-90ca-b8d9bae50161.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/volkanceylan/Serenity/issues/2107#issuecomment-467567970, or mute the thread https://github.com/notifications/unsubscribe-auth/AYxlIyBXToH3-k27EcNEVN7Az_n_GKAYks5vRYSNgaJpZM4Mtb_r .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/volkanceylan/Serenity/issues/2107#issuecomment-467660939, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZiSOSwoEhE1s0mTxxfgam0ABg1YZZTWks5vRcW2gaJpZM4Mtb_r.

heveoneron commented 5 years ago

Oh Okay, Thank You Very Much :D, @fernandocordero and @bt101

Pada tanggal Rab, 27 Feb 2019 pukul 06.51 fernandocordero < notifications@github.com> menulis:

Domain Name is simply the DNS of your SSRS server. e.g. https://mySSRSWebSite.com/


From: MhafizY notifications@github.com Sent: Tuesday, February 26, 2019 6:39 PM To: volkanceylan/Serenity Cc: fernandocordero; Mention Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107)

Thank's for the code, but i have question about what is [Domain Name ] in credential ?

On Wed, 27 Feb 2019 02:01 bt101, notifications@github.com wrote:

Hi @heveoneron https://github.com/heveoneron, Were you able to figure it out? Here is the message originally from @fernandocordero https://github.com/fernandocordero:

Here you go:

  1. Make a class as below, call it SSRSReportServerCredentials.cs

using Microsoft.Reporting.WebForms; using System; using System.Configuration; using System.Net; using System.Security.Principal;

namespace CostTracker.Reports {

[Serializable] public sealed class SSRSReportServerCredentials : IReportServerCredentials { public WindowsIdentity ImpersonationUser { get { // Use the default Windows user. Credentials will be // provided by the NetworkCredentials property. return null; } }

public ICredentials NetworkCredentials { get { // Read the user information from the Web.config file. // By reading the information on demand instead of // storing it, the credentials will not be stored in // session, reducing the vulnerable surface area to the // Web.config file, which can be secured with an ACL.

// User name string userName = ConfigurationManager.AppSettings ["SSRSUserID"];

//if (string.IsNullOrEmpty(userName)) // throw new Exception( // "Missing user name from web.config file");

// Password string password = ConfigurationManager.AppSettings ["SSRSPwd"];

//if (string.IsNullOrEmpty(password)) // throw new Exception( // "Missing password from web.config file");

// Domain //string domain = // ConfigurationManager.AppSettings // ["SSRSDomain"];

//if (string.IsNullOrEmpty(domain)) // throw new Exception( // "Missing domain from web.config file");

return new NetworkCredential(userName, password); } }

public bool GetFormsCredentials(out Cookie authCookie, out string userName, out string password, out string authority) { authCookie = null; userName = null; password = null; authority = null;

// Not using form credentials return false; } }

}

  1. Make another class for the Report Viewer Controller, call it ReportViewerControl.cs

using Microsoft.Reporting.WebForms; using System; using System.Web.UI.WebControls;

namespace CostTracker.Reports { public static class ReportViewerControl { public static ReportViewer GetReportViewerControl(string reportPath) { ReportViewer reportViewer = new ReportViewer(); reportViewer.ServerReport.ReportPath = reportPath; reportViewer.ProcessingMode = ProcessingMode.Remote; reportViewer.SizeToReportContent = false; reportViewer.AsyncRendering = true; reportViewer.Width = Unit.Percentage(100); reportViewer.Height = Unit.Percentage(100); reportViewer.ShowBackButton = true; reportViewer.ShowPrintButton = true; reportViewer.ServerReport.ReportServerUrl = new Uri(" http://YOUR_SSRS_REPORT_SERVER"); reportViewer.ServerReport.ReportServerCredentials = new SSRSReportServerCredentials(); return reportViewer; } } }

  1. Now you can have report menu page like, for example call this one BudgetReportIndex.cshtml:

<< Screenshot1 >>

Now, to properly redirect to the right report make a final class, call it BudgetReportPage.cs

<< Screenshot2 >>

If you notice, this class uses a partial called _ReportView.cshtml, this represents the iframe to display report and uses the Microsoft report Viewer

<< Screenshot3 >>

Which you need to reference

<< Screenshot4 >>

Hope this points you into the right direction brother, happy coding. [image: screenshot1] < https://user-images.githubusercontent.com/30605815/53438907-de788f80-39ce-11e9-9e43-14ee57daee0a.png

[image: screenshot2] < https://user-images.githubusercontent.com/30605815/53438908-de788f80-39ce-11e9-8b9f-cc1aee7cb089.png

[image: screenshot3] < https://user-images.githubusercontent.com/30605815/53438905-de788f80-39ce-11e9-99df-c35968e423fe.png

[image: screenshot4] < https://user-images.githubusercontent.com/30605815/53438906-de788f80-39ce-11e9-90ca-b8d9bae50161.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub < https://github.com/volkanceylan/Serenity/issues/2107#issuecomment-467567970 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AYxlIyBXToH3-k27EcNEVN7Az_n_GKAYks5vRYSNgaJpZM4Mtb_r

.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub< https://github.com/volkanceylan/Serenity/issues/2107#issuecomment-467660939>, or mute the thread< https://github.com/notifications/unsubscribe-auth/AZiSOSwoEhE1s0mTxxfgam0ABg1YZZTWks5vRcW2gaJpZM4Mtb_r

.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/volkanceylan/Serenity/issues/2107#issuecomment-467663835, or mute the thread https://github.com/notifications/unsubscribe-auth/AYxlI1ewNU6qAs2WGC_Kg8-xF5_53rwvks5vRciUgaJpZM4Mtb_r .

Shraddha996 commented 5 years ago

Hey @fernandocordero @bt101 Am also implementing the SSRS report in serenity and your code is quite impressive. Thanks a lot for that Here's my question As you know if we wanted to show any form in a particular module after running the project then we simply go to that module's navigation file and add this one line code [assembly: NavigationLink(1003, "Accounts/Print Invoice", typeof(MyPages.PrintInvoiceController), icon: "fa-files-o")] Now I want to add my report link in this file and am trying to join through the ReportViewerControl.cs as a controller I don't know whether this is right or not But right now am clueless

And also it would be great if you share the zip file of your code

Thank you so much, shraddha

fernandocordero commented 5 years ago

No problem, happy to help. Let me put together an email with some code...


From: Shraddha996 notifications@github.com Sent: Wednesday, April 3, 2019 4:30 AM To: volkanceylan/Serenity Cc: fernandocordero; Mention Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107)

Hey @fernandocorderohttps://github.com/fernandocordero Am also implementing the SSRS report in serenity and your code is quite impressive. Thanks a lot for that Here's my question As you know if we wanted to show any form in a particular module after running the project then we simply go to that module's navigation file and add this one line code [assembly: NavigationLink(1003, "Accounts/Print Invoice", typeof(MyPages.PrintInvoiceController), icon: "fa-files-o")] Now I want to add my report link in this file and am trying to join through the ReportViewerControl.cs as a controller I don't know whether this is right or not But right now am clueless

And also it would be great if you share the zip file of your code

Thank you so much, shraddha

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/volkanceylan/Serenity/issues/2107#issuecomment-479392380, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZiSORxIangld-uGBk9NhOPKlULhjXPbks5vdGa8gaJpZM4Mtb_r.

Shraddha996 commented 5 years ago

@fernandocordero Thanks in advance!

fernandocordero commented 5 years ago

I'll send it today just busy at work!


From: Shraddha996 notifications@github.com Sent: Thursday, April 4, 2019 1:03 AM To: volkanceylan/Serenity Cc: fernandocordero; Mention Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107)

@fernandocorderohttps://github.com/fernandocordero Thanks in advance!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/volkanceylan/Serenity/issues/2107#issuecomment-479750914, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZiSOXhFShQIKrbO-ikdZFNNlTcQn0P4ks5vdYeMgaJpZM4Mtb_r.

Shraddha996 commented 5 years ago

@fernandocordero Sorry for disturbing you again and again but I have a deadline tomorrow. Please send me zip file

fernandocordero commented 5 years ago

OK here are the steps:

1) Create a report viewer control class: ReportViewerControl.cs

using Microsoft.Reporting.WebForms; using System;​ using System.Web.UI.WebControls;​ ​ namespace YourNamespace.Reports​ {​ public static class ReportViewerControl​ {​ public static ReportViewer GetReportViewerControl(string reportPath)​ {​ ReportViewer reportViewer = new ReportViewer();​ reportViewer.ServerReport.ReportPath = reportPath;​ reportViewer.ProcessingMode = ProcessingMode.Remote;​ reportViewer.SizeToReportContent = false;​ reportViewer.AsyncRendering = true;​ reportViewer.Width = Unit.Percentage(100);​ reportViewer.Height = Unit.Percentage(100);​ reportViewer.ShowBackButton = true;​ reportViewer.ShowPrintButton = true;​ reportViewer.ServerReport.ReportServerUrl = new Uri("http://rs2k1201.discountasp.net/ReportServer");​ reportViewer.ServerReport.ReportServerCredentials = new SSRSReportServerCredentials();​ return reportViewer;​ }​ }​ }

2) Create a partial view for the report control (_ReportView.cshtml)

<!DOCTYPE html>

​ ​ @{Html.RenderPartial(MVC.Views.Shared._LayoutHead);}​ @ViewBag.Title - CostTracker​ ​ ​ @using ReportViewerForMvc​ @if (ViewBag.ReportViewer != null)​ {​ @Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)​ ​ }​ ​ ​ ​

4) SSRS ReportServerCredentials.cs: keep in mind the Server, User and passwords are kept in the configuration file of the application.

using Microsoft.Reporting.WebForms; using System;​ using System.Configuration;​ using System.Net;​ using System.Security.Principal;​ ​ ​ namespace YourNamespace.Reports​ {​ ​ [Serializable]​ public sealed class SSRSReportServerCredentials : IReportServerCredentials​ {​ public WindowsIdentity ImpersonationUser​ {​ get​ {​ // Use the default Windows user. Credentials will be​ // provided by the NetworkCredentials property.​ return null;​ }​ }​ ​ public ICredentials NetworkCredentials​ {​ get​ {​ // Read the user information from the Web.config file. ​ // By reading the information on demand instead of ​ // storing it, the credentials will not be stored in ​ // session, reducing the vulnerable surface area to the​ // Web.config file, which can be secured with an ACL.​ ​ // User name​ string userName =​ ConfigurationManager.AppSettings​ ["SSRSUserID"];​ ​ //if (string.IsNullOrEmpty(userName))​ // throw new Exception(​ // "Missing user name from web.config file");​ ​ // Password​ string password =​ ConfigurationManager.AppSettings​ ["SSRSPwd"];​ ​ //if (string.IsNullOrEmpty(password))​ // throw new Exception(​ // "Missing password from web.config file");​ ​ // Domain​ //string domain =​ // ConfigurationManager.AppSettings​ // ["SSRSDomain"];​ ​ //if (string.IsNullOrEmpty(domain))​ // throw new Exception(​ // "Missing domain from web.config file");​ ​ return new NetworkCredential(userName, password);​ }​ }​ ​ ​ public bool GetFormsCredentials(out Cookie authCookie,​ out string userName, out string password,​ out string authority)​ {​ authCookie = null;​ userName = null;​ password = null;​ authority = null;​ ​ // Not using form credentials​ return false;​ }​ }​ }​

3) You probably need to set a Navigation page in Serenity (Optional ReportsNavigation.cs)

using Serenity.Navigation; ​ [assembly: NavigationMenu(9000, "Reports")]​ [assembly: NavigationLink(9100, "Reports/Group1", typeof(CostTracker.Web.Reports.Pages.Group1Controller), icon: "icon-docs")]​ [assembly: NavigationLink(9200, "Reports/Group2", typeof(CostTracker.Web.Reports.Pages.Group2Controller), icon: "icon-docs")]​ [assembly: NavigationLink(9300, "Reports/Group3", typeof(CostTracker.Web.Reports.Pages.Group3Controller), icon: "icon-docs")]​

Replace Group1,2, …..N with your group reports if you want to use it.

4) Create each view and class for each group reports

e.g. ~/Modules/Reports/Group1

You need to objects: One view to see the report menu and an class

View : Group1ReportsIndex.cshtml (inside each group folder)

@{​ ViewData["Title"] = "Group1 Reports";​ }​ ​

Invoicing Reports

​ ​ ​ ​ ​
​ Class: Group1ReportsPage.cs namespace YourNamespace.Web.Reports.Pages {​ using CostTracker.Reports;​ using Microsoft.Reporting.WebForms;​ using Serenity.Web;​ using System.Web.Mvc;​ ​ [RoutePrefix("Reports/InvoicingReports"), Route("{action=index}")]​ [PageAuthorize("?")]​ public class InvoicingReportsController : Controller​ {​ public ActionResult Index()​ {​ return View("~/Modules/Reports/Group1ReportsGroup1ReportsIndex.cshtml");​ }​ ​ // Courier Report​ public ActionResult rptInvoicingCourier()​ {​ ReportViewer rptViewer = ReportViewerControl.GetReportViewerControl("/YourWebsiteRootFolder/Reports/Invoice Reports/Courier Report");​ ViewBag.ReportViewer = rptViewer;​ ViewBag.Title = "Courier Report";​ return PartialView("~/Modules/Reports/_ReportView.cshtml");​ }​ ​ ​ }​ } These image should give you a good idea of the folder structure: [cid:dbba5869-e9aa-4207-a90a-5be5bbaec4f0] Inside reports folder [cid:3f53b4c6-85a6-467e-b42a-ce720a16fc47] And lastly, inside each of the reports folder [cid:43ca9491-265e-439e-9add-ab1aefbd11ef] Hope this helps! ________________________________ From: Shraddha996 Sent: Monday, April 8, 2019 1:47 AM To: volkanceylan/Serenity Cc: fernandocordero; Mention Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107) @fernandocordero Sorry for disturbing you again and again but I have a deadline tomorrow. Please send me zip file — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Shraddha996 commented 5 years ago

@fernandocordero Thanks for sharing code I just completed one step by creating a class file ReportViewerControl.cs but its showing error on each line Maybe am missing something very basic but I couldn't find a way to fix this as am new to Reports Capture13

And also am unable to see the images you attached of the folder structure

fernandocordero commented 5 years ago

It's because thathe Get function has not yet be created. Let me see if i sent you it's definition or not.


From: Shraddha996 notifications@github.com Sent: Tuesday, April 9, 2019 7:36 AM To: volkanceylan/Serenity Cc: fernandocordero; Mention Subject: Re: [volkanceylan/Serenity] How to add a new page using sergen.exe by a new page I mean a new entry under modules (#2107)

@fernandocorderohttps://github.com/fernandocordero Thanks for sharing code I just completed one step by creating a class file ReportViewerControl.cs but its showing error on each line Maybe am missing something very basic but I couldn't find a way to fix this as am new to Reports [Capture13]https://user-images.githubusercontent.com/39983941/55797243-8b275000-5ae9-11e9-933e-ac88dc8f603d.PNG

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/volkanceylan/Serenity/issues/2107#issuecomment-481214848, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZiSOT0K6X5hA4Kcj6Dneof9UOu0flZtks5vfHszgaJpZM4Mtb_r.

Shraddha996 commented 5 years ago

@fernandocordero okay!