// GET: Loans/Create public ActionResult Create() { ViewBag.Error = Request.Cookies["Error"] != null ? Request.Cookies["Error"].Value : null; ViewBag.Success = Request.Cookies["Success"] != null ? Request.Cookies["Success"].Value : null; HttpCookie cookie = new HttpCookie("Error"); cookie["Error"] = null; cookie["Success"] = null; Response.Cookies.Add(cookie); AddLoan loan = new AddLoan { Albums = db.Albums.ToList(), Members = db.Members.ToList() }; return(View(loan)); }
public void AddLoan() { const int userID = 357; const int oldLoanID = 7152; LoanRepository loanRep = ObjectFactory.GetInstance<LoanRepository>(); Loan oldLoan = loanRep.Get(oldLoanID); if (oldLoan == null) return; DateTime now = DateTime.UtcNow; // oldLoan.Date; NL_Model model = new NL_Model(oldLoan.Customer.Id) { UserID = userID, Loan = new NL_Loans() { OldLoanID = oldLoan.Id, Refnum = oldLoan.RefNumber }, FundTransfer = new NL_FundTransfers() { Amount = oldLoan.LoanAmount, FundTransferStatusID = (int)NLFundTransferStatuses.Pending, // (int)NLPacnetTransactionStatuses.Done, LoanTransactionMethodID = (int)NLLoanTransactionMethods.Pacnet, TransferTime = now, PacnetTransactions = new List<NL_PacnetTransactions>() } }; model.Loan.Histories.Add(new NL_LoanHistory() { EventTime = now, AgreementModel = JsonConvert.SerializeObject(oldLoan.AgreementModel) }); model.Loan.LastHistory().Agreements.Add(new NL_LoanAgreements() { LoanAgreementTemplateID = 2065, //(int)NLLoanAgreementTemplateTypes.PreContractAgreement, FilePath = "2016/2/21/PAD64J14012/Guaranty Agreement_Deka_Dance_1394_21-02-2016_10-18-25.pdf", // "preContract/cc/dd" + oldLoan.RefNumber + ".pdf" }); model.Loan.LastHistory().Agreements.Add(new NL_LoanAgreements() { LoanAgreementTemplateID = 2067, //(int)NLLoanAgreementTemplateTypes.GuarantyAgreement, FilePath = "2016/2/21/PAD64J14012/Private Company Loan Agreement_Deka_Dance_1394_21-02-2016_10-18-25.pdf", //"guarantyAgreement/aa/bb" + oldLoan.RefNumber + ".pdf" }); AddLoan strategy = new AddLoan(model); strategy.Context.UserID = model.UserID; try { strategy.Execute(); m_oLog.Debug(strategy.Error); m_oLog.Debug(strategy.LoanID); Console.WriteLine("LoanID: {0}, Error: {1}", strategy.LoanID, strategy.Error); } catch (Exception ex) { Console.WriteLine(ex); } }