コード例 #1
0
        /// <summary>
        /// Frontend Page: Step 10(Loan Terms Report)
        /// Title: Display Loan Terms Report print page
        /// Designed: Kanishka SHM
        /// User story:
        /// Developed: Kanishka SHM
        /// Date created:
        /// </summary>
        public ReportViewer PrintPage(int loanId)
        {
            //check authentication session is null, if null return
            if (Session["AuthenticatedUser"] == null)
            {
                return(null);
            }
            User userData = (User)Session["AuthenticatedUser"];

            //create reportviwer & set reportviewr properties
            ReportViewer rptViewerLoanTermsPrint = new ReportViewer();

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

            ReportAccess ra = new ReportAccess();

            //Get loan details and set to reportviwer
            List <RptLoanTerms> loanTermsDetails = ra.RptLoanTermsDetails(loanId);

            rptViewerLoanTermsPrint.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", loanTermsDetails));

            List <LoanDetailsRpt> details = ra.GetLoanDetailsRptforCompanySummary(userData.Company_Id, userData.UserId);

            rptViewerLoanTermsPrint.LocalReport.DataSources.Add(new ReportDataSource("DataSet6", details));

            //get curtailment schedule details and set to reportviwer
            CurtailmentAccess  ca           = new CurtailmentAccess();
            List <Curtailment> curtailments = ca.retreiveCurtailmentByLoanId(loanId);

            if (curtailments != null && curtailments.Count > 0)
            {
                for (int i = 0; i < curtailments.Count; i++)
                {
                    curtailments[i].CurtailmentId = i + 1;
                }
            }
            rptViewerLoanTermsPrint.LocalReport.DataSources.Add(new ReportDataSource("DataSet2", curtailments));

            //get fees details and set to reportviwer
            List <RptFeeLoanTerm> loanTermsFeeDetails = ra.RptLoanTermsFeeDetails(loanId);

            rptViewerLoanTermsPrint.LocalReport.DataSources.Add(new ReportDataSource("DataSet3", loanTermsFeeDetails));

            //get reminders details and set to reportviwer
            List <RptEmailReminder> loanTermsEmailReminders = ra.RptLoanTermsEmailReminders(loanId);

            rptViewerLoanTermsPrint.LocalReport.DataSources.Add(new ReportDataSource("DataSet4", loanTermsEmailReminders));

            //get unit types and set  to reportviwer
            IList <Models.UnitType> unitTypes = ra.RptGetUnitTypes(loanId);

            rptViewerLoanTermsPrint.LocalReport.DataSources.Add(new ReportDataSource("DataSet5", unitTypes));

            //return reportviwer
            return(rptViewerLoanTermsPrint);
        }
コード例 #2
0
        /*
         *
         * Frontend page: Curtailment Page
         * Title: Curtailments by selected due date
         * Designed: Nadeeka
         * User story:
         * Developed: Nadeeka
         * Date created: 3/21/2016
         *
         */
        public ActionResult PayCurtailmentForSelectedDueDate(DateTime dueDate)
        {
            CurtailmentScheduleModel curtailmentScheduleModel = new CurtailmentScheduleModel();
            LoanSetupStep1           loanDetails = new LoanSetupStep1();

            loanDetails         = (new LoanSetupAccess()).GetLoanDetailsByLoanCode(Session["loanCode"].ToString()); // take loan details of selected loan
            ViewBag.loanDetails = loanDetails;

            string   f  = dueDate.ToShortDateString();
            DateTime dd = Convert.ToDateTime(f);


            CurtailmentAccess         curtailmentAccess   = new CurtailmentAccess();
            List <CurtailmentShedule> curtailmentSchedule = curtailmentAccess.GetCurtailmentScheduleByDueDate(loanDetails.loanId, dd); // get curtailment list by due date

            ViewBag.DealerEmail = (string)Session["DealerEmail"];                                                                      // pass dealer email to the view
            ViewBag.LoanId      = loanDetails.loanId;                                                                                  // pass loan id to the view

            curtailmentScheduleModel.CurtailmentScheduleInfoModel = new List <CurtailmentShedule>();
            curtailmentScheduleModel.CurtailmentScheduleInfoModel.AddRange(curtailmentSchedule); // bind the list of curtailment to model
            curtailmentScheduleModel.DueDate = dueDate;                                          // bind the due date to model

            // return the partial view page
            return(PartialView(curtailmentScheduleModel));
        }
コード例 #3
0
        public ActionResult loadGrid()
        {
            string loanCode;

            try
            {
                loanCode = Session["loanCode"].ToString();
            }
            catch (Exception)
            {
                //filterContext.Controller.TempData.Add("UserLogin", "Login");
                return(RedirectToAction("UserLogin", "Login", new { lbl = "Due to inactivity your session has timed out, please log in again." }));
            }

            LoanSetupStep1 loanDetails = new LoanSetupStep1();

            loanDetails = (new LoanSetupAccess()).GetLoanDetailsByLoanCode(loanCode);



            BranchAccess ba = new BranchAccess();

            ViewBag.ComType     = userData.CompanyType;
            ViewBag.loanId      = loanDetails.loanId;
            ViewBag.loanDetails = loanDetails;

            UnitPayOffViewModel unitPayOffViewModel = new UnitPayOffViewModel();
            CurtailmentAccess   payoff = new CurtailmentAccess();

            unitPayOffViewModel.UnitPayOffList = new List <UnitPayOffModel>();
            unitPayOffViewModel.PayDate        = DateTime.Now;

            unitPayOffViewModel.UnitPayOffList = payoff.GetUnitPayOffList(loanDetails.loanId);

            decimal advanceFee = 0;

            advanceFee = payoff.AdvanceForPayOffUnits(loanDetails.loanId);

            //int advanceFeeAtPayoff = payoff.CheckAdvanceFeeAtPayOff(loanDetails.loanId);

            //if (advanceFeeAtPayoff == 1) {
            //    foreach (var unit in unitPayOffViewModel.UnitPayOffList) {
            //        unit.IsAdvancePaid = false;
            //    }
            //}
            ViewBag.AdvanceFee = advanceFee;

            var unitPayOffList = unitPayOffViewModel.UnitPayOffList;

            Session["payoffList"] = unitPayOffList;
            ViewBag.payOffList    = unitPayOffList;

            TitleAccess ta    = new TitleAccess();
            Title       title = ta.getTitleDetails(loanDetails.loanId);

            Session["PayOffUnitloanId"] = loanDetails.loanId;

            if (title != null)
            {
                bool isTitleTrack = title.IsTitleTrack;
                if (isTitleTrack)
                {
                    ViewBag.IsTitleTrack = "Yes";
                }
            }

            return(PartialView(unitPayOffViewModel));
        }
コード例 #4
0
        public string PayCurtailments(SelectedCurtailmentList selectedCurtailmentList, string needSend, string dealerEmail, string dueDate)
        {
            // if session expired -- return null
            if (Session["loanCode"] == null || Session["loanCode"].ToString() == "")
            {
                return(null);
            }

            var    loanCode = Session["loanCode"].ToString(); // take loan code from session
            string paidDate = "";

            var loanDetails = (new LoanSetupAccess()).GetLoanDetailsByLoanCode(loanCode); // take loan details of the loan code

            CurtailmentAccess curtailmentAccess = new CurtailmentAccess();
            string            returnValue       = curtailmentAccess.updateCurtailmets(selectedCurtailmentList, loanDetails.loanId, dealerEmail); // update curtailment details as paid


            // if curtailment successfully updated
            if (returnValue != null)
            {
                // saving for reporting purpose
                decimal totalpaid = 0.00M;
                List <CurtailmentShedule> selectedCurtailmentSchedules = selectedCurtailmentList.SelectedCurtailmentSchedules;
                foreach (var items in selectedCurtailmentSchedules)
                {
                    items.PaidDate = items.PayDate.ToString("MM/dd/yyyy");
                    totalpaid     += items.CurtAmount;
                    paidDate       = items.PaidDate;
                }

                foreach (var items in selectedCurtailmentSchedules)
                {
                    items.TotalAmountPaid = totalpaid;
                }

                Session["CurtUnitDuringSession"] = selectedCurtailmentSchedules;
                if (needSend == "Yes")
                {
                    ReportViewer rptViewerCurtailmentReceiptDuringSession = new ReportViewer();
                    rptViewerCurtailmentReceiptDuringSession.ProcessingMode = ProcessingMode.Local;
                    rptViewerCurtailmentReceiptDuringSession.Reset();
                    rptViewerCurtailmentReceiptDuringSession.LocalReport.EnableExternalImages = true;
                    rptViewerCurtailmentReceiptDuringSession.LocalReport.ReportPath           = Server.MapPath("~/Reports/RptCurtailmentDuringSession.rdlc");

                    ReportAccess          ra      = new ReportAccess();
                    List <LoanDetailsRpt> details = ra.TopHeaderDetails(loanDetails.loanId, userData.UserId);

                    foreach (var dates in details)
                    {
                        dates.ReportDate = DateTime.Now.ToString("MM/dd/yyyy");
                    }

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

                    if (selectedCurtailmentSchedules != null && selectedCurtailmentSchedules.Count > 0)
                    {
                        try
                        {
                            rptViewerCurtailmentReceiptDuringSession.LocalReport.DataSources.Add(new ReportDataSource("DataSet2", selectedCurtailmentSchedules));

                            Warning[] warnings;
                            string[]  streamids;
                            string    mimeType;
                            string    encoding;
                            string    filenameExtension;

                            //create pdf file
                            byte[] bytes = rptViewerCurtailmentReceiptDuringSession.LocalReport.Render(
                                "PDF", null, out mimeType, out encoding, out filenameExtension,
                                out streamids, out warnings);

                            if (dealerEmail != "")
                            {
                                string mailSubject = "Curtailment Paid Receipt - Loan " + loanDetails.loanNumber;
                                string mailBody    =
                                    "Curtailments for Loan " + loanDetails.loanNumber + " which were due on or before " + dueDate + " have been paid on " + paidDate + ". " +
                                    "Please view the attached PDF file for full curtailment payment details. " +
                                    Environment.NewLine + Environment.NewLine +
                                    "Thank you," +
                                    Environment.NewLine +
                                    "Dealer Floor Plan Software Team";

                                Thread thread = new Thread(delegate()
                                {
                                    Email email = new Email(dealerEmail);
                                    email.SendMailWithAttachment(mailSubject, mailBody, bytes);
                                });

                                thread.IsBackground = true;
                                thread.Start();
                            }
                        }
                        catch (Exception e)
                        {
                            throw e;
                        }
                    }
                }

                //insert to log
                string[] arrList = new string[selectedCurtailmentList.SelectedCurtailmentSchedules.Count];
                int      i       = 0;
                // add all paid curtailment details to array
                foreach (var x in selectedCurtailmentList.SelectedCurtailmentSchedules)
                {
                    if (!string.IsNullOrEmpty(x.UnitId))
                    {
                        arrList[i] = "Pay Curtailment(s) for unit(s): " + x.IDNumber + " ,Curtailment No: " + x.CurtNumber + " ,Curtailment Amount:" + x.CurtAmount + " ,Paid Date:" + x.PayDate;
                        i++;
                    }
                }

                // join the array with comma seperated
                string units = string.Join(",", arrList);
                Log    log   = new Log(userData.UserId, userData.Company_Id, userData.BranchId, loanDetails.loanId, "Pay Curtailments", units, DateTime.Now);
                // insert into log
                int islog = (new LogAccess()).InsertLog(log);
            }
            // return the value
            return(returnValue);
        }