コード例 #1
0
        public ActionResult Create([Bind(Include = "id,date_out,num_copy,amount_paid,due,date_returned,penalty_charge,dvd_id,member_id,loan_status_id")] loan loan, dvd dvd)
        {
            if (ModelState.IsValid)
            {
                db.loan.Add(loan);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.dvd_id         = new SelectList(db.dvd, "id", "title", loan.dvd_id);
            ViewBag.member_id      = new SelectList(db.member, "id", "first_name", loan.member_id);
            ViewBag.loan_status_id = new SelectList(db.loan_status, "id", "loan_status", loan.loan_status_id);

            /*
             * db.Entry(dvd).State = EntityState.Modified;
             * var dv = db.dvd.Find(loan.dvd_id);
             * var result=dv.stock - loan.num_copy;
             * dvd dvd = new dvd()
             * {
             *
             * };
             */

            //db.SaveChanges();
            return(View(loan));
        }
コード例 #2
0
        //get monthly due
        public double getMonthlyDue(int id)
        {
            try
            {
                loan   l          = wvac.loans.Find(id);
                double balance    = Convert.ToDouble(l.Balance);
                double monthlyDue = Convert.ToDouble(l.MonthlyDue);
                double due;


                //pay the remaining balance in the last payment
                if ((balance - monthlyDue) < monthlyDue)
                {
                    due = Convert.ToDouble(l.Balance);
                }
                else
                {
                    due = Convert.ToDouble(l.MonthlyDue);
                }


                return(due);
            }
            catch
            {
                return(0);
            }
        }
コード例 #3
0
        public string Post([FromBody] LoanApprover loanApprover)
        {
            loanApprover.newApplication.status           = "success";
            hle.Entry(loanApprover.newApplication).State = System.Data.Entity.EntityState.Modified;
            hle.SaveChanges();

            loan       newLoan    = new loan();
            loanDetail newloandet = new loanDetail();

            newloandet = hle.loanDetails.ToList().Find(item => item.appId == loanApprover.newApplication.appId);

            newLoan.adminId        = loanApprover.adminId;
            newLoan.remarks        = loanApprover.remarks;
            newLoan.loanId         = loanApprover.newApplication.appId;
            newLoan.status         = "current";
            newLoan.loanDateStart  = System.DateTime.Now;
            newLoan.amountApproved = newloandet.loanAsked;
            newLoan.noOfEmiTotal   = hle.loanDetails.ToList().Find(item => item.appId == newLoan.loanId).tenure * 12;
            newLoan.noOfEmiLeft    = newLoan.noOfEmiTotal;

            hle.loans.Add(newLoan);
            hle.SaveChanges();


            return("loan has been approved");
        }
コード例 #4
0
 private void setLoanDetails(loan _loan)
 {
     CustomerLabel.Content     = LetterHandller.UppercaseFirst(_loan.customer.FIRST_NAME) + " " + LetterHandller.UppercaseFirst(_loan.customer.LAST_NAME);
     CustomerCodeLabel.Content = _loan.customer.FullCustomerCode;
     LoanIDTextBox.Text        = _loan.LOAN_ID;
     EmployeeLabel.Content     = LetterHandller.UppercaseFirst(_loan.employee.FULLNAME);
 }
コード例 #5
0
 private void clearData()
 {
     _selectedCustomer = null;
     _selectedEmployee = null;
     _selectedLoanType = null;
     _selectedLoan     = null;
 }
コード例 #6
0
        private async void LoanSaveButton_Click(object sender, RoutedEventArgs e)
        {
            loan _loan = getLoanData();

            if (_viewmode.Equals(Mode.NEW))
            {
                if (LoanService.InsertLoan(_loan) == 1)
                {
                    await MainWindow.Instance.ShowMessageAsync(Messages.TTL_MSG, "Loan Added Success!", MessageDialogStyle.Affirmative);

                    //SendConfirmationSMS();
                    clearLoanIssuePage();
                    MultiSearch.Instance.ClearSearchResult();
                }
                else
                {
                    await MainWindow.Instance.ShowMessageAsync(Messages.TTL_MSG, "Please check Deatails", MessageDialogStyle.Affirmative);
                }
            }
            if (_viewmode.Equals(Mode.EDIT))
            {
                _loan.ID = Session.SelectedLoan.ID;

                if (LoanService.UpdateLoan(_loan) == 1)
                {
                    await MainWindow.Instance.ShowMessageAsync(Messages.TTL_MSG, "Loan Edit Success!", MessageDialogStyle.Affirmative);

                    //SendConfirmationSMS();
                }
                else
                {
                    await MainWindow.Instance.ShowMessageAsync(Messages.TTL_MSG, "Please check Deatails", MessageDialogStyle.Affirmative);
                }
            }
        }
コード例 #7
0
        // POST: odata/loans
        public IHttpActionResult Post(loan loan)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.loans.Add(loan);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (loanExists(loan.LoanNum))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(Created(loan));
        }
コード例 #8
0
        public Application SaveLoanConfiguration(LoanConfig loan, string applicationId, string customerId, string officerId)
        {
            var applicationInfo = new Application();

            var loanConfig = new loan()
            {
                //a generate loan number function  must be called generated based
                fbonumbr         = customerId,
                appnumber        = applicationId,//must be autogenerated
                officerid        = loan.OfficerId,
                app_type         = "NL",
                appldate         = DateTime.Parse(loan.LoansAppldate),
                branchid         = loan.LoansBranchid,
                fladescr         = loan.LoansFladescr,
                flaesins         = Convert.ToDecimal(loan.LoansFlaesins),
                flafxins         = Convert.ToDecimal(loan.LoansFlafxins),
                flagptmt         = Convert.ToDecimal(loan.LoansFlagptmt),
                flagpval         = Convert.ToDecimal(loan.LoansFlagpval),
                flaicmet         = Convert.ToDecimal(loan.LoansFlaicmet),
                flaicrat         = Convert.ToDecimal(loan.LoansFlaicrat),
                flainsud         = DateTime.Parse(loan.LoansFlainsud),
                flainsup         = Convert.ToDecimal(loan.LoansFlainsup),
                flalocat         = loan.LoansFlalocat,
                flalpmet         = Convert.ToDecimal(loan.LoansFlalpmet),
                flaltype         = Convert.ToDecimal(loan.LoansFlaltype),
                flaptype         = Convert.ToDecimal(loan.LoansFlaptype),
                flarpmet         = loan.LoansFlarpmet,
                flasecto         = loan.LoansFlasecto,
                flasubsc         = loan.LoansFlasubsc,
                flatloan         = Convert.ToDecimal(loan.LoansFlatloan),
                flatermm         = Convert.ToDecimal(loan.LoansFlattermm),
                flacurncy        = loan.LoansFlacurrncy,
                inquirydate      = DateTime.Parse(loan.LoansInquirydate),
                repay_cycle      = loan.LoansRepayCycle,
                year_length      = Convert.ToDecimal(loan.LoansYearLength),
                refinanceamt     = Convert.ToDecimal(loan.LoansRefinanceamt),
                consolidateamt   = Convert.ToDecimal(loan.LoansConsolidateamt),
                consol_newamtreq = Convert.ToDecimal(loan.LoansConsolNewamtreq),
            };

            using (var dpac = new DPACEntities())
            {
                try
                {
                    dpac.loans.Add(loanConfig);
                    if (dpac.SaveChanges() > 0)
                    {
                        applicationInfo.ApplicationSuccess = true;
                        applicationInfo.ApplicationId      = applicationId;
                    }
                }
                catch (DbEntityValidationException e)
                {
                    applicationInfo.ApplicationSuccess = false;
                    applicationInfo.ErrorMessage       = e.Message;
                }
            }

            return(applicationInfo);
        }
コード例 #9
0
        public IHttpActionResult Putloan(int id, loan loan)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != loan.loancode)
            {
                return(BadRequest());
            }

            db.Entry(loan).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!loanExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #10
0
        public ActionResult DeleteConfirmed(byte id)
        {
            loan loan = db.loan.Find(id);

            db.loan.Remove(loan);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #11
0
 public ActionResult Edit([Bind(Include = "Loan_Id,Customer_Id,Amount,Duration,StartDate,MonthlyInstallment,Month")] loan loan)
 {
     if (ModelState.IsValid)
     {
         db.Entry(loan).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(loan));
 }
コード例 #12
0
        public IHttpActionResult Getloan(int id)
        {
            loan loan = db.loan.Find(id);

            if (loan == null)
            {
                return(NotFound());
            }

            return(Ok(loan));
        }
コード例 #13
0
        internal static Decimal totalToPayByLoanID(loan loan)
        {
            List <payment> payments = db.payments.Where(pay => pay.FK_LOAN_ID == loan.ID).ToList();

            TimeSpan difference = loan.END_DATE.Value.Date - loan.START_DATE.Value.Date;
            decimal  days       = Convert.ToDecimal(difference.TotalDays);

            decimal d = Convert.ToDecimal(loan.INSTALLMENT) * days;

            return(d);
        }
コード例 #14
0
        public ActionResult Create([Bind(Include = "Loan_Id,Customer_Id,Amount,Duration,StartDate,MonthlyInstallment,Month")] loan loan)
        {
            if (ModelState.IsValid)
            {
                db.loans.Add(loan);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(loan));
        }
コード例 #15
0
 public static void LogOutSelectedLoan()
 {
     if (LoanPage.Instance != null)
     {
         LoanPage.Instance.SelectedLoan.Content = "No Loan Selected";
         LoanPage.Instance.SelectedLoanLogOutButton.Visibility = Visibility.Hidden;
         LoanPage.Instance.ContentFrame.Content = QuickSearchPageLoan.Instance;
         QuickSearchPageLoan.Instance.RefreshPage();
         LoanPage.ViewMode = Mode.LIST;
     }
     SelectedLoan = null;
 }
コード例 #16
0
 //get balance
 public double getBalance(int id)
 {
     try
     {
         loan l = wvac.loans.Find(id);
         return(Convert.ToDouble(l.Balance));
     }
     catch
     {
         return(0);
     }
 }
コード例 #17
0
        private static void OnTimedEvent(Object source, ElapsedEventArgs e, int id)
        {
            ILoanServices MyService = new LoanServices();
            loan          loan      = MyService.GetById(id);

            MyService.PayBackLoan(loan);

            Console.WriteLine("The Elapsed event was raised at {0:HH:mm:ss.fff}",
                              e.SignalTime);
            Console.WriteLine("Rest amount: " + loan.RestAmount);
            Console.WriteLine("Balance: " + loan.account.AccountBalance);
        }
コード例 #18
0
 //get schedDate
 public DateTime getSchedDate(int id)
 {
     try
     {
         loan l = wvac.loans.Find(id);
         return(Convert.ToDateTime(l.SchedDate));
     }
     catch (Exception ex)
     {
         return(DateTime.MinValue);
     }
 }
コード例 #19
0
 public ActionResult Edit([Bind(Include = "loancode,loanmem,loanmoney,loandate,loanmonth,loancar,loaninterest")] loan loan)
 {
     if (ModelState.IsValid)
     {
         db.Entry(loan).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.loancar = new SelectList(db.car, "carcode", "carbrand", loan.loancar);
     ViewBag.loanmem = new SelectList(db.member, "memidcard", "memname", loan.loanmem);
     return(View(loan));
 }
コード例 #20
0
 private async void LoginByLoanID(loan _loan)
 {
     if (_loan != null)
     {
         loan selected = LoanList.Single(ln => ln.ID == _loan.ID);
         Session.SelectedLoan = selected;
     }
     else
     {
         await MainWindow.Instance.ShowMessageAsync(Messages.TTL_MSG, Messages.MSG_SELECT_LOAN, MessageDialogStyle.Affirmative);
     }
 }
コード例 #21
0
        public IHttpActionResult Postloan(loan loan)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.loan.Add(loan);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = loan.loancode }, loan));
        }
コード例 #22
0
 public ActionResult Edit([Bind(Include = "id,date_out,num_copy,amount_paid,due,date_returned,penalty_charge,dvd_id,member_id,loan_status_id")] loan loan)
 {
     if (ModelState.IsValid)
     {
         db.Entry(loan).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.dvd_id         = new SelectList(db.dvd, "id", "title", loan.dvd_id);
     ViewBag.member_id      = new SelectList(db.member, "id", "first_name", loan.member_id);
     ViewBag.loan_status_id = new SelectList(db.loan_status, "id", "loan_status", loan.loan_status_id);
     return(View(loan));
 }
コード例 #23
0
        // GET: loans/Details/5
        public ActionResult Details(byte?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            loan loan = db.loan.Find(id);

            if (loan == null)
            {
                return(HttpNotFound());
            }
            return(View(loan));
        }
コード例 #24
0
        public IHttpActionResult Deleteloan(int id)
        {
            loan loan = db.loan.Find(id);

            if (loan == null)
            {
                return(NotFound());
            }

            db.loan.Remove(loan);
            db.SaveChanges();

            return(Ok(loan));
        }
コード例 #25
0
        // DELETE: odata/loans(5)
        public IHttpActionResult Delete([FromODataUri] int key)
        {
            loan loan = db.loans.Find(key);

            if (loan == null)
            {
                return(NotFound());
            }

            db.loans.Remove(loan);
            db.SaveChanges();

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #26
0
        public void updateLoan(int id, double payment)
        {
            loan     l = wvac.loans.Find(id);
            DateTime s;

            l.Balance   = l.Balance - payment;
            s           = l.SchedDate.Value;
            l.SchedDate = s.AddMonths(1);

            if (l.Balance == 0)
            {
                l.Status    = "FULLY PAID";
                l.SchedDate = null;
            }
            wvac.SaveChanges();
        }
コード例 #27
0
        internal static PagingCollection <payment> PaymentListByLoanID(loan loan, int page)
        {
            PagingCollection <payment> pager = new PagingCollection <payment>();
            int pagesize = pager.PageSize;
            int offset   = pager.PageSize * (page - 1);

            List <payment> payments = db.payments.Where(pay => pay.FK_LOAN_ID == loan.ID).ToList();

            payments = payments.OrderByDescending(pay => pay.DATE_TIME).ToList();

            pager.Collection  = payments.Skip(offset).Take(pagesize).ToList();
            pager.TotalCount  = payments.Count();
            pager.CurrentPage = page;

            return(pager);
        }
コード例 #28
0
        private async void LoanDetailsButton_Click(object sender, RoutedEventArgs e)
        {
            Button     button = (Button)sender;
            StackPanel sp     = (StackPanel)button.Content;
            Label      lbl    = sp.Children.OfType <Label>().FirstOrDefault();

            if (lbl.Content.ToString() != "")
            {
                loan selected = LoanList.Single(c => c.ID == lbl.Content.ToString());
                Session.SelectedLoan = selected;
            }
            else
            {
                await MainWindow.Instance.ShowMessageAsync(Messages.TTL_MSG, Messages.MSG_SELECT_LOAN, MessageDialogStyle.Affirmative);
            }
        }
コード例 #29
0
        // GET: loans/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            loan loan = db.loan.Find(id);

            if (loan == null)
            {
                return(HttpNotFound());
            }
            ViewBag.loancar = new SelectList(db.car, "carcode", "carbrand", loan.loancar);
            ViewBag.loanmem = new SelectList(db.member, "memidcard", "memname", loan.loanmem);
            return(View(loan));
        }
コード例 #30
0
        // GET: loans/Edit/5
        public ActionResult Edit(byte?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            loan loan = db.loan.Find(id);

            if (loan == null)
            {
                return(HttpNotFound());
            }
            ViewBag.dvd_id         = new SelectList(db.dvd, "id", "title", loan.dvd_id);
            ViewBag.member_id      = new SelectList(db.member, "id", "first_name", loan.member_id);
            ViewBag.loan_status_id = new SelectList(db.loan_status, "id", "loan_status1", loan.loan_status_id);
            return(View(loan));
        }