XSDファイル形式


一、クリスタルレポートはこのファイルを直接データソースとして使用することができる
 
 
    targetNamespace="http://tempuri.org/XMLSchema.xsd"    elementFormDefault="qualified"    xmlns="http://tempuri.org/XMLSchema.xsd"    xmlns:mstns="http://tempuri.org/XMLSchema.xsd"    xmlns:xs="http://www.w3.org/2001/XMLSchema">
                                                                                                                                                                                                                                                                                                                                                     
             
 
二、バックグラウンドaspx呼び出しコード
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
using System.Data;
using HOHCSCRM.Data;
using HOHCSCRM.Data.ORM;
using HOHCSCRM.Data.EDM;
using HOHCSCRM.BUL;
using HOHCSCRM.WebApp.Common;
using HOHCSCRM.WebApp.Common.DataExtensions;
using GlacierCLI.Extensions;

namespace HOHCSCRM.WebApp.Pages.Report.CrystalReport
{
    public partial class ShowReport : System.Web.UI.Page
    {
        ReportDocument rptDocument = new ReportDocument();
        private void Page_UnLoad(object sender, EventArgs e)
        {
            rptDocument.Dispose();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string ReportType = Request["ReportType"].ToString();
            string SelectIds = Request["SelectIds"] == null ? string.Empty : Request["SelectIds"].ToString();
            string reportPath = string.Empty;
            int PrintID = 0;
            ReportDonationFilter filter = new ReportDonationFilter();
            DataTable table = null;


            switch (ReportType)
            {
                case "Diners":
                    filter.ReportType = "Diners";
                    filter.SelectIds = SelectIds;
                    table = ReportSRV.BankProfile(filter);
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        table.Rows[i]["CreditCardNo"] = CommonMethod.GetCreditCardFormat(int.Parse(table.Rows[i]["PaymentMethodID"].ToString()), table.Rows[i]["CreditCardNo"].ToString());
                    }

                    reportPath = Server.MapPath("~/Pages/Report/CrystalReport/Diners.rpt");
                    rptDocument.Load(reportPath);
                    rptDocument.SetDataSource(table);
                    rptView.ReportSource = rptDocument;
                    break;

                case "DonationCheque":
                    #region           
                    bool IsCopy = Request["IsCopy"].ToString() == "1" ? true : false;
                    PrintID = int.Parse(Request["PrintID"].ToString());
                    string ReceiptDate = Request["ReceiptDate"].ToString();
                    List profileDonaton = ReportSRV.GetDonationChequeList(SelectIds, IsCopy, ReceiptDate);

                    var donationCheque = profileDonaton.Select(t =>
                    {
                        return new
                        {
                            t.ID,
                            t.ProfileID,
                            ProfileNo = t.GetProfileProfileNo(),
                            ProfileNameCN = (t.Status == 3 ? t.ReceiptNameCN : GetProfileName(t.ReceiptOtherName, t.ProfileID, true)),
                            ProfileNameEN = (t.Status == 3 ? t.ReceiptNameEN : GetProfileName(t.ReceiptOtherName, t.ProfileID, false)),
                            Address = t.GetProfileAddress(),
                            DonationNo = "(" + t.DonationNo + ")",
                            t.ReceiptNo,
                            ReceiptDate = t.ReceiptDate.ToDateString(),
                            ThankyouLetter = string.IsNullOrWhiteSpace(t.GetThankyouLetterNameCN()) ? "" : "(" + t.GetThankyouLetterNameCN() + ")",
                            Information = (t.Status == 3 ? t.ReceiptAddress : GetAddress(t.ProfileID, "", t.ReceiptOtherName, "1")),
                            t.DonationAmount
                        };
                    });
                    reportPath = Server.MapPath("~/Pages/Report/CrystalReport/DonationCheque.rpt");
                    rptDocument.Load(reportPath);
                    rptDocument.SetDataSource(donationCheque);
                    if (!Page.IsPostBack)
                    {
                        foreach (var item in profileDonaton)
                        {
                            DataActionLogORM ActionLog = new DataActionLogORM();
                            ActionLog.ObjectID = AppORMType.ProfileDonation;
                            ActionLog.DataItemID = item.ID;
                            ActionLog.ActionBy = HttpContextUtility.GetCurrentLoginUserID();
                            ActionLog.ActionDescription = "    ";
                            ActionLog.Remarks = (IsCopy ? "          (   )" : "          (  )");
                            CommonSRV.CreateActionLog(ActionLog);
                        }
                    }

                    List profileDonatonDetails = ReportSRV.GetDonationChequeDetailsList(SelectIds);
                    var DonationChequeDetails = profileDonatonDetails.Select(t =>
                    {
                        return new
                        {
                            t.ProfileDonationID,
                            DonationDate = t.DonationDate,
                            Event = t.EventNameCN,
                            ServiceNature = t.ServiceNatureNameCN,
                            DonationItem = t.DonationItemNameCN,
                            PaymentMethod = t.GetPaymentNatureNameCN(),
                            DonationAmount = t.Amount
                        };
                    });

                    //  
                    IsCopy = !IsCopy;
                    (rptDocument.ReportDefinition.ReportObjects["DetailsCopy"] as PictureObject).ObjectFormat.EnableSuppress = IsCopy;
                    ReportDocument rtpDetails = (rptDocument.ReportDefinition.ReportObjects["ChequeDetails"] as SubreportObject).OpenSubreport((rptDocument.ReportDefinition.ReportObjects["ChequeDetails"] as SubreportObject).SubreportName);
                    rtpDetails.SetDataSource(DonationChequeDetails);
                    //   
                    ReportDocument PageTwp = (rptDocument.ReportDefinition.ReportObjects["PageTwp"] as SubreportObject).OpenSubreport((rptDocument.ReportDefinition.ReportObjects["PageTwp"] as SubreportObject).SubreportName);
                    (PageTwp.ReportDefinition.ReportObjects["txt_Content"] as TextObject).ObjectFormat.HorizontalAlignment = CrystalDecisions.Shared.Alignment.Justified;

                    //rptDocument.Refresh();
                    rptView.ReportSource = rptDocument;
                    rptDocument.SetParameterValue("PrivacyText", "dd");
                    break;
                    #endregion
            }


        }
    }
}