예제 #1
0
        public ActionResult Create([Bind(Include = "Product, LoanDecision, LoanType, LoanGenerationStatus, LoanStatus")] Loan loan)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    LoanServices.Insert(CurrentUser.Id, loan, db);
                    TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed");
                    return(RedirectToAction("Index"));
                }
                catch (CfException cfex)
                {
                    TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage;
                }
                catch (Exception ex)
                {
                    TempData["Failure"] = ex.Message;
                }
            }

            ViewBag.LoanDecisionList         = new SelectList(LoanDecisionServices.List(db), "Id", "CersNumber");
            ViewBag.LoanGenerationStatusList = new SelectList(LoanGenerationStatusServices.List(db), "Id", "Name");
            ViewBag.LoanStatusList           = new SelectList(LoanStatusServices.List(db), "Id", "Name");
            ViewBag.LoanTypeList             = new SelectList(LoanTypeServices.List(db), "ProductType", "Name");
            ViewBag.ProductList = new SelectList(ProductServices.List(db), "Id", "Notes");
            return(View(loan));
        }
예제 #2
0
        ///<summary>
        /// Move Loan To Employee Method
        ///</summary>
        public void MoveLoanToEmployee(int userId, int LoanId, int EmployeeId, LoanDecision loanDecision)
        {
            try
            {
                Db db = new Db(DbServices.ConnectionString);

                // 0- Create Loan Decision
                LoanDecision decision = LoanDecisionServices.Insert(userId, loanDecision, db);

                // 1- Change the Status Of Old Loan to be Move To Employee
                Loan loan = LoanServices.Get(LoanId, db);
                loan.LoanStatus = (int)LoanStatusEnum.MoveToEmployee;
                LoanServices.Update(userId, loan, db);
                // 2- Process the Installments



                // 3- Create New Product + Refundable Product

                LoanRequest req = new LoanRequest()
                {
                    //Request=
                };
                Loan NewLoan = new Loan()
                {
                    LoanDecision         = decision.Id,
                    Product              = loan.Product,
                    LoanGenerationStatus = (int)LoanGenerationStatusEnum.IncommingFromOtherSubscriber,
                    LoanStatus           = (int)LoanStatusEnum.Unfinished,
                    LoanType             = loan.LoanType
                };

                LoanServices.Insert(userId, NewLoan);


                // 2- Add Loan and Generate Installment


                //db.LoanGenerate(model.Requests[i].RequestId, decision.Id, (int)LoanGenerationStatusEnum.LoanRequest);


                // 4- Generate Installment for the new Loan

                //
            }
            catch (Exception ex)
            {
            }
        }