SSRS integrated into the Web

Source: Internet
Author: User

In a few steps, the first step is to achieve: Ireportservercredentials interface
Step two: Drag into the ReportViewer control
The third step: the report to control the parameters. Specific as described .... The Code section references the following attachments

Using system;using system.collections.generic;using system.linq;using system.web;using System.Web.UI;using System.web.ui.webcontrols;using tajimaoa.ui;using system.data;using Microsoft.reporting.webforms; namespace tajimaoa.ui.bissrsviewer{    Public partial class bissrsviewer:system.web.ui.page    {        protected void Page_Load (object sender, EventArgs e)         {           //string L_reportserverurl = system.web.configuration.webconfigurationmanager.appsettings[" Bireportserverurl "];//get report Service address             if (! IsPostBack)             {                string l_com Panyid = this. request["CompanyID"];                String l_departmentid = this. request["DepartmentID"];                String L_employeeid = this. Request["EmployeeID"];                String l_isgetcurrentuserid = this. request["GetUser"];               //project             & nbsp   String L_projectid = this. request["ProjectID"];//2014-04-18 Add by Weschen project id                string l_proj Ectstate = this. request["Projectstate"];//2014-04-18 Add by Weschen project status                //task                 String l_taskid = this. request["TaskID"];//2014-04-18 Add by Weschen project tasks id                string l_tasks Tate = this. request["Taskstate"];//2014-04-18 Add by Weschen project tasks id                string L_ta Skstponecode = this. request["Taskstponecode"];//2014-04-18 Add by Weschen Project task extension number               &NBSP;&NBSp;                 String l_reportcode = this. request["Reportcode"];                TajimaOA.UI.Areas.BI.Controllers.SSRSReport.SSRSManagerController l_serviceclient = new Areas.BI.Controllers.SSRSReport.SSRSManagerController ();                DataTable L_dt = L_serviceclient.getreportsettingbyreportcode (l_reportcode);           & nbsp     if (L_dt = = NULL | | L_dt. Rows.Count = = 0)                 {             & nbsp  }                else              &NBSP ; {                    string l_reportserverurl = L_dt. rows[0]["ServerURL"]. ToString ();                    string l_rePortfolder = L_dt. rows[0]["Foldercode"]. ToString ();                    string l_report = L_dt. rows[0]["Reportcode"]. ToString ();                     string l_ssrsuser = system.web . configuration.webconfigurationmanager.appsettings["Bissrs-user"];//get credentials User name                     String l_ssrspassword = system.web.configuration.webconfigurationmanager.appsettings[" Bissrs-password "];//get voucher password                     String l_ssrsdomainname = system.web.configuration.webconfigurationmanager.appsettings["Bissrs-domainname"];//get voucher field                      BI_RptViewer.ServerReport.ReportServerCredentials = new Customrep Ortcredentials (L_ssrsuser, L_ssrspassword, L_ssrsdomainname);                and nbsp   BI_RPTVIEWER.SERVERREPORT.REPORTSERVERURL = new Uri (L_reportserverurl.trim ());                    BI_RptViewer.ServerReport.ReportPath = L_reportfolder + l_report;      & nbsp             Bi_rptviewer.showbackbutton = true;            &NB Sp       Bi_rptviewer.showprintbutton = true;                &NBS P    //2014-03-05 Add by weschen Add report parameters                     List <ReportParameter> l_parlist = new list<reportparameter> ();             & nbsp       if (L_isgetcurrentuserid = = "Y")                     {                        ReportParameter L_rptpar_currentuser ID = new reportParameter ();                        L_rptpar_currentuserid.nam E = "Currentuserid";                        the Guid L_currentuser ID = TajimaOA.UI.Common.ComonMethods.GetCurrentUserID ();//Current login user id                        L_RPTPAR_CURRENTUSERID.VALUES.ADD (l_currentuserid.tostring ());                        L_parlist.add (L_rptpar_currentuserid);                   }                   &N Bsp if (!string. IsNullOrEmpty (L_companyid)                     {      &NB Sp                 ReportParameter L_rptpar_companyid = new ReportParameter ();      &nbsp                 L_rptpar_companyid.name = "CompanyID";                        L_RPTPAR_COMPANYID.VALUES.ADD (L_companyid);      & nbsp                 L_parlist.add (L_rptpar_companyid);        &NBS P        }                    if (!string). IsNullOrEmpty (L_departmentid)                     {                        ReportParameter L_rptpar_departmentid = new ReportParameter ();                        L_rptpar_departmentid.name = "Depar Tmentid ";                        l_rptpar_departmentid.values. ADD (L_departmeNtid);                        L_parlist.add (l_rptpar_departmen TID);                   }            &NBS P       if (!string. IsNullOrEmpty (L_employeeid)                     {      &N Bsp                 ReportParameter L_rptpar_employeeid = new ReportParameter ();                        L_rptpar_employeeid.name = "EmployeeID"; &nbs P                       L_RPTPAR_EMPLOYEEID.VALUES.ADD (L_employeeid) ;                        L_parlist.add (L_rptpar_employeeid) &N Bsp                  }                   //-------------------------------------------          &NBSP ;        //2014-04-18 add by Weschen project id                    if (!string. IsNullOrEmpty (L_projectid)                     {      &NB Sp                 ReportParameter L_rptpar_projectid = new ReportParameter ();                        L_rptpar_projectid.name = "ProjectID";                        L_RPTPAR_PROJECTID.VALUES.ADD (L_projectid), & nbsp                       L_parlist.add (l_rptpar_projectid);  &nbs P                }                  //2014-04-18 Add by Weschen project status                     if (!s Tring. IsNullOrEmpty (l_projectstate)                     {                        ReportParameter l_rptpar_projectstate = new ReportParameter ();                        L_rptpar_projectstate.name = "Proje Ctstate ";                        l_rptpar_projectstate.values. ADD (l_projectstate);                        L_parlist.add (L_RP Tpar_projectstate);                   }        &NBS P          //------------------------------------------                &NBsp  //2014-04-18 Add by Weschen project tasks id                    if (!string . IsNullOrEmpty (l_taskid)                     {                        ReportParameter l_rptpar_projecttaskid = new ReportParameter (); &n Bsp                       L_rptpar_projecttaskid.name = "Projecttaskid" ;                        L_RPTPAR_PROJECTTASKID.VALUES.ADD (l_t Askid);                        L_parlist.add (L_RPTPAR_PROJECTT Askid);                   }            &N Bsp      //2014-04-18 Add by Weschen project tasks id                  &NBS P if (!String. IsNullOrEmpty (l_taskstate)                     {      &NB Sp                 ReportParameter l_rptpar_taskstate = new ReportParameter ();                        L_rptpar_taskstate.name = "Taskstate";                        L_RPTPAR_TASKSTATE.VALUES.ADD (l_taskstate), & nbsp                       L_parlist.add (l_rptpar_taskstate);  &nbs P                }                  &N Bsp 2014-04-18 Add by Weschen Project task extension                     if (!string. IsNullOrEmpty (L_taskstponecode)                     {    &NBSP ; &nBsp                 ReportParameter l_rptpar_taskstponecode = new ReportParameter (); &n Bsp                       L_rptpar_taskstponecode.name = "Taskstponecod E ";                        L_RPTPAR_TASKSTPONECODE.VALUES.ADD ( L_taskstponecode);                        L_parlist.add (L_RPTP Ar_taskstponecode);                   }       &NBSP ;             if (L_parlist.count > 0)               &NBS P     {                        Bi_rptviewer.serverrepo Rt. Setparameters (l_parlist);                   }      &NBSP ; &nbsP      }           }       }   }  & nbsp   [serializable]    public class Customreportcredentials:  microsoft.reporting.webforms.ireportservercredentials    {       //local variable for Network credential.        private string _username;        private string _passwo rd;        private string _domainname;        public customreportcredentials (stri Ng UserName, String PassWord, String DomainName)         {            _us Ername = username;            _password = password;            _domainname = domainname;       }        public System.Security.Principal.Window Sidentity impersonationuser        {           get            {                return null; Not use impersonationuser           }       }      & nbsp System.Net.ICredentials networkcredentials        {            GE t            {               //Use Networkcredenti als                return new System.Net.NetworkCredential (_username, _password, _ DomainName);           }       }        Public Boo L Getformscredentials (out System.Net.Cookie Authcookie, out string user, out string password, out string authority)         {           //not formscredentials unless are implEments a custom autentication.            Authcookie = null;        &NBS P   user = password = authority = null;            return false;      &NBS P }   }}



http://www.flybi.net/question/2835

SSRS integrated into the Web

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.