/// <summary> /// Example: Update Loan. For Example will be updating Loan Amount /// </summary> private static void UpdateLoan() { if (_accessToken == null) { Authenticate(); } //Initializing the API Client*/ var loanApiClient = ApiClientProvider.GetApiClient <LoansApi>(_accessToken); //Creating new loan contract for update. We are updating the loan amount. var correctVal = false; double loanAmt = 0; Console.Write("Enter Loan Amount: "); while (!correctVal) { correctVal = double.TryParse(Console.ReadLine(), out loanAmt); if (!correctVal) { Console.Write("Please enter a valid number: "); } } var loan = new LoanContract { BorrowerRequestedLoanAmount = loanAmt }; loanApiClient.UpdateLoan(LoanId, null, null, null, loan); }
/// <summary> /// Example: Update Loan. For Example will be updating Loan Amount /// </summary> private static void UpdateLoan() { if (_accessToken == null) { Authenticate(); } //Initializing the API Client*/ var loanApiClient = ApiClientProvider.GetApiClient <LoansApi>(_accessToken); //Creating new loan contract for update. We are updating the loan amount. var correctVal = false; double loanAmt = 0; Console.Write("Enter Loan Amount: "); while (!correctVal) { correctVal = double.TryParse(Console.ReadLine(), out loanAmt); if (!correctVal) { Console.Write("Please enter a valid number: "); } } var loan = new LoanContract { BorrowerRequestedLoanAmount = loanAmt }; var response = loanApiClient.UpdateLoan(LoanId, null, null, null, loan, "entity"); JsonSerializerSettings serializerSettings = new JsonSerializerSettings { ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor }; LoanContract updatedLoan = JsonConvert.DeserializeObject <LoanContract>(response.ToString(), serializerSettings); }
public IHttpActionResult PutLoanContract(int id, LoanContract loanContract) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != loanContract.LoanContractId) { return(BadRequest()); } db.Entry(loanContract).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!LoanContractExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { LoanContract loanContract = db.LoanContracts.Find(id); db.LoanContracts.Remove(loanContract); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "LoanContractId,LoanNumber,DateAllocated,EmployeeId,CustomerFirstName,CustomerLastName,LoanType,LoanAmount,InterestRate,Periods,MonthlyPayment,FutureValue,InterestAmount,PaymentStartDate")] LoanContract loanContract) { if (ModelState.IsValid) { db.Entry(loanContract).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(loanContract)); }
public IHttpActionResult GetLoanContract(int id) { LoanContract loanContract = db.LoanContracts.Find(id); if (loanContract == null) { return(NotFound()); } return(Ok(loanContract)); }
public ActionResult Edit([Bind(Include = "ID,LoanStatusCode,DateContractStarts,DateContractEnds,InterestRate,LoanAmount,TermsAndCoditions")] LoanContract loanContract) { if (ModelState.IsValid) { db.Entry(loanContract).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.LoanStatusCode = new SelectList(db.LoanStatuses, "LoanStatusCode", "LoanStatusCode", loanContract.LoanStatus); return(View(loanContract)); }
public List <LoanContract> GetLoanContracts() { List <LoanContract> contracts = new List <LoanContract>(); using (SqlConnection scWattsALoan = new SqlConnection(System.Configuration. ConfigurationManager. ConnectionStrings["csWattsALoan"]. ConnectionString)) { SqlCommand cmdLoanContracts = new SqlCommand("SELECT LoanContractID, LoanNumber, DateAllocated, EmployeeID, " + " CustomerFirstName, CustomerLastName, LoanType, " + " LoanAmount, InterestRate, Periods, MonthlyPayment, " + " FutureValue, InterestAmount, PaymentStartDate " + "FROM Management.LoanContracts;", scWattsALoan); scWattsALoan.Open(); cmdLoanContracts.ExecuteNonQuery(); SqlDataAdapter sdaLoanContracts = new SqlDataAdapter(cmdLoanContracts); DataSet dsLoanContracts = new DataSet("loans-contracts"); sdaLoanContracts.Fill(dsLoanContracts); LoanContract contract = null; for (int i = 0; i < dsLoanContracts.Tables[0].Rows.Count; i++) { DataRow drLoanContract = dsLoanContracts.Tables[0].Rows[i]; contract = new LoanContract() { LoanContractID = int.Parse(drLoanContract[0].ToString()), LoanNumber = int.Parse(drLoanContract[1].ToString()), DateAllocated = DateTime.Parse(drLoanContract[2].ToString()), EmployeeID = int.Parse(drLoanContract[3].ToString()), CustomerFirstName = drLoanContract[4].ToString(), CustomerLastName = drLoanContract[5].ToString(), LoanType = drLoanContract[6].ToString(), LoanAmount = decimal.Parse(drLoanContract[7].ToString()), InterestRate = decimal.Parse(drLoanContract[8].ToString()), Periods = int.Parse(drLoanContract[9].ToString()), MonthlyPayment = decimal.Parse(drLoanContract[10].ToString()), FutureValue = decimal.Parse(drLoanContract[11].ToString()), InterestAmount = decimal.Parse(drLoanContract[12].ToString()), PaymentStartDate = DateTime.Parse(drLoanContract[13].ToString()) }; contracts.Add(contract); } } return(contracts); }
public ActionResult Create([Bind(Include = "LoanContractID,LoanNumber,DateAllocated,EmployeeID,CustomerFirstName,CustomerLastName,LoanType,LoanAmount,InterestRate,Periods,MonthlyPayment,FutureValue,InterestAmount,PaymentStartDate")] LoanContract loanContract) { if (ModelState.IsValid) { db.LoanContracts.Add(loanContract); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EmployeeID = new SelectList(db.Employees, "EmployeeID", "Identification", loanContract.EmployeeID); return(View(loanContract)); }
public IHttpActionResult PostLoanContract(LoanContract loanContract) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.LoanContracts.Add(loanContract); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = loanContract.LoanContractId }, loanContract)); }
public IActionResult Edit(LoanContract loanContract) { GetViewBag(); if (loanContract.ExpireDate > loanContract.ContractSignDate) { loanContractService.Edit(loanContract); return(RedirectToAction("Index")); } else { ViewData["EditError"] = "Ngay het han phai lon hon ngay tao hop dong"; return(View()); } }
// GET: LoanContracts/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LoanContract loanContract = db.LoanContracts.Find(id); if (loanContract == null) { return(HttpNotFound()); } return(View(loanContract)); }
public IHttpActionResult DeleteLoanContract(int id) { LoanContract loanContract = db.LoanContracts.Find(id); if (loanContract == null) { return(NotFound()); } db.LoanContracts.Remove(loanContract); db.SaveChanges(); return(Ok(loanContract)); }
public IActionResult Create(LoanContract loanContract) { GetViewBag(); if (loanContract.ExpireDate > loanContract.ContractSignDate) { loanContractService.Create(loanContract); ViewData["CreateSuccuss"] = "Tao moi thanh cong"; return(RedirectToAction("Index")); } else { ViewData["CreateFail"] = "Create Fail"; return(View()); } }
// GET: LoanContracts/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LoanContract loanContract = db.LoanContracts.Find(id); if (loanContract == null) { return(HttpNotFound()); } ViewBag.EmployeeID = new SelectList(db.Employees, "EmployeeID", "Identification", loanContract.EmployeeID); return(View(loanContract)); }
// GET: LoanContract/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LoanContract loanContract = db.LoanContracts.Find(id); if (loanContract == null) { return(HttpNotFound()); } ViewBag.LoanStatusCode = new SelectList(db.LoanStatuses, "LoanStatusCode", "LoanStatusCode", loanContract.LoanStatus); return(View(loanContract)); }
// GET: LoanContracts/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LoanContract loanContract = db.LoanContracts.Find(id); ViewData["DateAllocated"] = loanContract.DateAllocated.Value.ToLongDateString(); ViewData["PaymentStartDate"] = DateTime.Parse(loanContract.PaymentStartDate.ToString()).ToLongDateString(); if (loanContract == null) { return(HttpNotFound()); } return(View(loanContract)); }
/// <summary> /// Example: Create Loan /// Template path can be found in Encompass smart client /// </summary> private static void CreateLoan() { var correctVal = false; Console.Write("Loan Template Path : "); var templatePath = Console.ReadLine(); double loanAmt = 0; Console.Write("Enter Loan Amount : "); while (!correctVal) { correctVal = double.TryParse(Console.ReadLine(), out loanAmt); if (!correctVal) { Console.Write("Please enter a valid number: "); } } //Creating the request object with some sample data var loan = new LoanContract { BorrowerRequestedLoanAmount = loanAmt, Applications = new List <LoanContractApplications>() }; var application = new LoanContractApplications { Borrower = new LoanContractBorrower { FirstName = "John", LastName = "Doe" } }; loan.Applications.Add(application); //Initializing the API Client*/ var loanApiClient = ApiClientProvider.GetApiClient <LoansApi>(_accessToken); //Example: Reading the loan id for the created loan using Location header var resp = loanApiClient.CreateLoanWithHttpInfo("My Pipeline", templatePath, null, "id", loan); Console.WriteLine("Loan Created. New loan id is: {0}", resp.Headers["Location"]); }
// GET: LoanContracts/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LoanContract loanContract = db.LoanContracts.Find(id); ViewData["DateAllocated"] = loanContract.DateAllocated.Value.ToLongDateString(); ViewData["PaymentStartDate"] = DateTime.Parse(loanContract.PaymentStartDate.ToString()).ToLongDateString(); if (loanContract == null) { return(HttpNotFound()); } // var loansContracts = db.Payments.Select(pmt => pmt.PaymentID == loanContract.P); // ViewData["LoansPayments"] = loansContracts; return(View(loanContract)); }
static void Main(string[] args) { // Create the user credentials for the login var credentials = new UserCredential { IdentityType = IdentityType.Lender, InstanceId = ConfigurationManager.AppSettings["InstanceID"], UserName = ConfigurationManager.AppSettings["UserID"], Password = ConfigurationManager.AppSettings["Password"] }; // Generate the access token for the API var accessToken = AccessToken.GetAccessToken(credentials); // Now invoke the Pipeline API to query based on LoanNumber LoanPipelineViewContract view = new LoanPipelineViewContract() { Filter = new LoanPipelineFilterContract() { Terms = new List <LoanPipelineFilterContractTerms>() { new LoanPipelineFilterContractTerms() { CanonicalName = "Loan.LoanNumber", Value = "1801EM000070", MatchType = "exact" } } } }; // Invoke the Pipeline API to get the matching loans var pipelineClient = ApiClientProvider.GetApiClient <LoanPipelineApi>(accessToken); var items = pipelineClient.PipelineRequest(contract: view); // Check the count if (items.Count != 1) { Console.WriteLine("Loan number did not return a unique match"); return; } // Loop over the result set, each of which has a loanGuid attribute string loanGuid = items[0].LoanGuid; // Create the Loan contract to update the new document signing date (Loan.ClosingDocument.DocumentSigningDate) LoanContract loan = new LoanContract() { ClosingDocument = new LoanContractClosingDocument() { DocumentSigningDate = DateTime.Today } }; try { // Create the Loan API client var loanClient = ApiClientProvider.GetApiClient <LoansApi>(accessToken); loanClient.UpdateLoan(loanGuid, loanContract: loan); Console.WriteLine("Loan updated successfully"); } catch (ApiException ex) { Console.WriteLine("Loan update failed with response " + ex.ErrorContent); } // In the debugger, don't close the window right away if (System.Diagnostics.Debugger.IsAttached) { Console.ReadLine(); } }
public void Delete(LoanContract LoanContract) { loanContractRepository.Delete(LoanContract); SaveLoanContract(); }
public void Create(LoanContract LoanContract) { loanContractRepository.Create(LoanContract); SaveLoanContract(); }
public void Edit(LoanContract LoanContract) { loanContractRepository.Edit(LoanContract); SaveLoanContract(); }