我该如何拨打以下电话?

kor*_*wan -2 c# methods

    public class MyReportRenderer
    {

        private rs2005.ReportingService2005 rs;
        private rs2005Execution.ReportExecutionService rsExec;
        //string casenumberKey;

        public void RenderTest()
        {
            string HistoryID = null;
            string deviceInfo = null;
            string encoding = String.Empty;
            string mimeType = String.Empty;
            string extension = String.Empty;
            rs2005Execution.Warning[] warnings = null;
            string[] streamIDs = null;

            rs = new rs2005.ReportingService2005();
            rsExec = new rs2005Execution.ReportExecutionService();
            rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
            rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials;
            rs.Url = "http://216.40.232.82/ReportServer_DEVELOPMENT/ReportService2005.asmx";
            rsExec.Url = "http://216.40.232.82/ReportServer_DEVELOPMENT/ReportExecution2005.asmx";


            //// pass parameters

            try
            {
                // Get if any parameters needed.



                // Load the selected report.

                rsExec.LoadReport("/LawDept/LawDeptTIC", HistoryID);

                // Prepare report parameter.

                // Set the parameters for the report needed.

                rs2005Execution.ParameterValue[] parameters = new rs2005Execution.ParameterValue[3];
                parameters[0] = new rs2005Execution.ParameterValue();
                parameters[0].Name = "CaseNumberKey";
                parameters[0].Value = "000002";
                //parameters[1] = new rs2005Execution.ParameterValue();
                //parameters[1].Name = "ReportMonth";
                //parameters[1].Value = "6"; // June
                //parameters[2] = new rs2005Execution.ParameterValue();
                //parameters[2].Name = "ReportYear";
                //parameters[2].Value = "2004";
                rsExec.SetExecutionParameters(parameters, "en-us");

                // get pdf of report 
                Byte[] results = rsExec.Render("PDF", deviceInfo,
                out extension, out encoding,
                out mimeType, out warnings, out streamIDs);

                MailMessage message = new MailMessage("george.greiner@gmail.com", "george.greiner@gmail.com", "Hello", "This is a test");
                SmtpClient emailClient = new SmtpClient("localhost");
                message.Attachments.Add(new Attachment(new MemoryStream(results), String.Format("{0}_DocumentSavingsReport.pdf", "ReportName")));
                emailClient.Send(message);
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

当我需要执行时,我会打电话给这个吗?

tru*_*ity 7

(new MyReportRenderer()).RenderTest();
Run Code Online (Sandbox Code Playgroud)