示例#1
0
 public bool ShowLoanRepaymentShedule(string app, LoanRepaymentScheduleModel loanrepaymentshedulemodel, string sFilePDF)
 {
     bRet = false;
     if ("pdf".Equals(app))
     {
         try
         {
             LoanRepaymentSchedulePDFBuilder lrspdfbuilder = new LoanRepaymentSchedulePDFBuilder(loanrepaymentshedulemodel, sFilePDF);
             lrspdfbuilder.GetshedulePDF();
             return(true);
         }
         catch (Exception ex)
         {
             Utils.ShowError(ex);
             return(false);
         }
     }
     else //application is excel
     {
         try
         {
             LoanRepaymentScheduleExcelBuilder lrsebuilder = new LoanRepaymentScheduleExcelBuilder(loanrepaymentshedulemodel, sFilePDF);
             lrsebuilder.GetExcel();
             return(true);
         }
         catch (Exception ex)
         {
             Utils.ShowError(ex);
             return(false);
         }
     }
 }
        public LoanRepaymentSchedulePDFBuilder(LoanRepaymentScheduleModel loanrepaymentshedulemodel, string FileName)
        {
            if (loanrepaymentshedulemodel == null)
            {
                throw new ArgumentNullException("LoanRepaymentScheduleModel is null");
            }
            _ViewModel = loanrepaymentshedulemodel;

            sFilePDF = FileName;
        }
 private void Build()
 {
     try
     {
         _ViewModel                   = new LoanRepaymentScheduleModel();
         _ViewModel.PeriodDate        = new DateTime(_year, _period, 1);
         _ViewModel.employername      = _employer.Name;
         _ViewModel.PrintedOn         = DateTime.Today;
         _ViewModel.employeraddress   = _employer.Address1.Trim() + ", " + _employer.Address2.Trim();
         _ViewModel.CompanyLogo       = fileLogo;
         _ViewModel.CompanySlogan     = slogan;
         _ViewModel.employertelephone = _employer.Telephone;
         _ViewModel.loanslist         = this.Getloansrepayments();
     }
     catch (Exception ex)
     {
         Utils.ShowError(ex);
     }
 }
 //constructor
 public LoanRepaymentScheduleExcelBuilder(LoanRepaymentScheduleModel loanrepaymentshedulemodel, string FileName)
 {
     _loanrepaymentshedulemodel = loanrepaymentshedulemodel;
     sFileExcel = FileName;
 }