/// <summary>
        /// Frontend Page: Report page(Individual curtailment summary report)
        /// Title: Display Individual curtailment summary report
        /// Designed: Piyumi Perera
        /// User story: DFP 488
        /// Developed: Piyumi Perera
        /// Date created: 7/5/2016
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int loanId = 0;
                string idNumber = "";
                //if session is not null and assign it.
                if (Request.QueryString["loanId"] != "")
                    loanId = Convert.ToInt32(Request.QueryString["loanId"]);

                if (Request.QueryString["idNumber"] != "" && Request.QueryString["idNumber"] != null)
                    idNumber = Request.QueryString["idNumber"];

                ReportAccess ra = new ReportAccess();
                //Get all curtailment summary details
                List<RptIndividualCurtailmentSummary> indiCurtailment = ra.GetIndividualCurtailmentSummarRptDetails(loanId, idNumber);

                if (indiCurtailment.Count > 0)
                {
                    //call RenderReport function to show report on report viwer
                    RenderReport(loanId, idNumber, indiCurtailment);
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowFrame", "ShowDive();", true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "HideFrame", "HideDive();", true);
                }
            }
        }
        public ReportViewer PrintPage(int loanId, string idNumber)
        {
            //Check authentication session is null then return
            if (Session["AuthenticatedUser"] == null) return null;
            User userData = (User)Session["AuthenticatedUser"];

            ReportViewer rptViewerIndividualCurtailmentSummaryPrint = new ReportViewer();

            rptViewerIndividualCurtailmentSummaryPrint.ProcessingMode = ProcessingMode.Local;
            rptViewerIndividualCurtailmentSummaryPrint.Reset();
            rptViewerIndividualCurtailmentSummaryPrint.LocalReport.EnableExternalImages = true;
            rptViewerIndividualCurtailmentSummaryPrint.LocalReport.ReportPath = Server.MapPath("~/Reports/RptIndividualCurtailmentSummary.rdlc");
            rptViewerIndividualCurtailmentSummaryPrint.ZoomMode = ZoomMode.PageWidth;

            ReportAccess ra = new ReportAccess();
            List<LoanDetailsRpt> details = ra.TopHeaderDetails(loanId, userData.UserId);
            foreach (var dates in details)
            {

                dates.ReportDate = DateTime.Now.ToString("MM/dd/yyyy");
            }

            rptViewerIndividualCurtailmentSummaryPrint.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", details));

            //Get all curtailment summary details
            List<RptIndividualCurtailmentSummary> indiCurtailment = ra.GetIndividualCurtailmentSummarRptDetails(loanId, idNumber);
            rptViewerIndividualCurtailmentSummaryPrint.LocalReport.DataSources.Add(new ReportDataSource("DataSet2", indiCurtailment));

            return rptViewerIndividualCurtailmentSummaryPrint;
        }