示例#1
0
        public void ImportInstallmentRepayment(List <Installment> pInstallments)
        {
            LoanServices   loanServices   = new LoanServices(_user);
            ClientServices clientServices = new ClientServices(_user);

            foreach (var installment in pInstallments)
            {
                int loanId = loanServices.SelectLoanId(installment.ContractCode);
                var loan   = loanServices.SelectLoan(loanId, true, true, true);
                var client = clientServices.FindTiersByContractId(loanId);
                if (installment.RepaymentStatus == 1)
                {
                    if (loan.InstallmentList[installment.InstallmentNumber].IsPending)
                    {
                        loanServices.ConfirmPendingRepayment(loan, client);
                    }
                    else if (!loan.InstallmentList[installment.InstallmentNumber].IsRepaid)
                    {
                        PaymentMethod paymentMethod =
                            ServicesProvider.GetInstance().GetPaymentMethodServices().GetPaymentMethodById(5);
                        loanServices.Repay(loan, client, installment.InstallmentNumber, installment.InstallmentDate,
                                           installment.InstallmentAmount, false,
                                           0, 0, false, 0, true, false, paymentMethod, "", false);
                    }
                }
                else
                {
                    if (loan.InstallmentList[installment.InstallmentNumber].IsPending)
                    {
                        loanServices.CancelPendingInstallments(loan);
                    }
                }
            }
        }
示例#2
0
        public ActionResult Edit([Bind(Include = "Loan, FromLoan")] LoanChange loanChange)
        {
            Db db = new Db(DbServices.ConnectionString);

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

            ViewBag.LoanList     = new SelectList(LoanServices.List(db), "Product", "Name", loanChange.Loan);
            ViewBag.FromLoanList = new SelectList(LoanServices.List(db), "Product", "Name", loanChange.FromLoan);
            return(View(loanChange));
        }
示例#3
0
        public ActionResult Edit([Bind(Include = "Product, LoanDecision, LoanType, LoanGenerationStatus, LoanStatus")] Loan loan)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    LoanServices.Update(CurrentUser.Id, loan, db);
                    TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "UpdateConfirmed");
                    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", loan.LoanDecision);
            ViewBag.LoanGenerationStatusList = new SelectList(LoanGenerationStatusServices.List(db), "Id", "Name", loan.LoanGenerationStatus);
            ViewBag.LoanStatusList           = new SelectList(LoanStatusServices.List(db), "Id", "Name", loan.LoanStatus);
            ViewBag.LoanTypeList             = new SelectList(LoanTypeServices.List(db), "ProductType", "Name", loan.LoanType);
            ViewBag.ProductList = new SelectList(ProductServices.List(db), "Id", "Notes", loan.Product);
            return(View(loan));
        }
示例#4
0
        public ActionResult Create([Bind(Include = "Loan, MainWorkPlace")] IncomingLoan incomingLoan)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    IncomingLoanServices.Insert(CurrentUser.Id, incomingLoan, 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.LoanList          = new SelectList(LoanServices.List(db), "Product", "Name");
            ViewBag.MainWorkPlaceList = new SelectList(MainWorkPlaceServices.List(db), "Id", "Name");
            return(View(incomingLoan));
        }
示例#5
0
        public void ReloadAlertsSync()
        {
            if (!UserSettings.GetLoadAlerts())
            {
                return;
            }

            LoanServices ls = ServicesProvider.GetInstance().GetContractServices();

            ls.ClearAlerts();
            olvAlerts.SetObjects(null);
            lblTitle.Text     = GetString("AlertsLoading");
            tabFilter.Enabled = false;

            List <Alert_v2> alerts = ls.FindAlerts(
                chkLateLoans.Checked,
                chkPendingLoans.Checked,
                chkPostponedLoans.Checked,
                chkOverdraftSavings.Checked,
                chkPendingSavings.Checked,
                chkValidatedLoan.Checked);

            LoadAlerts(alerts);
            tabFilter.Enabled = true;
        }
        public ActionResult Edit([Bind(Include = "Loan, LoanDecision, MainWorkPlace, ApprovedAmount, NetAmount, ProfitAmount")] OutgoingLoan outgoingLoan)
        {
            Db db = new Db(DbServices.ConnectionString);

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

            ViewBag.LoanList          = new SelectList(LoanServices.List(db), "Product", "Name", outgoingLoan.Loan);
            ViewBag.LoanDecisionList  = new SelectList(LoanDecisionServices.List(db), "Id", "CersNumber", outgoingLoan.LoanDecision);
            ViewBag.MainWorkPlaceList = new SelectList(MainWorkPlaceServices.List(db), "Id", "Name", outgoingLoan.MainWorkPlace);
            return(View(outgoingLoan));
        }
示例#7
0
        public void ImportInstallmentRepayment(List<Installment> pInstallments)
        {
            LoanServices loanServices = new LoanServices(_user);
            ClientServices clientServices = new ClientServices(_user);
            foreach (var installment in pInstallments)
            {
                int loanId = loanServices.SelectLoanId(installment.ContractCode);
                var loan = loanServices.SelectLoan(loanId, true, true, true);
                var client = clientServices.FindTiersByContractId(loanId);
                if (installment.RepaymentStatus == 1)
                {
                    if (loan.InstallmentList[installment.InstallmentNumber].IsPending)
                        loanServices.ConfirmPendingRepayment(loan, client);
                    else if (!loan.InstallmentList[installment.InstallmentNumber].IsRepaid)
                    {
                        PaymentMethod paymentMethod =
                            ServicesProvider.GetInstance().GetPaymentMethodServices().GetPaymentMethodById(5);
                        loanServices.Repay(loan, client, installment.InstallmentNumber, installment.InstallmentDate,
                            installment.InstallmentAmount, false,
                            0, 0, false, 0, true, false, paymentMethod, "", false);
                    }

                }
                else
                {
                    if (loan.InstallmentList[installment.InstallmentNumber].IsPending)
                        loanServices.CancelPendingInstallments(loan);
                }
            }
        }
示例#8
0
        public ActionResult Create()
        {
            Db db = new Db(DbServices.ConnectionString);

            ViewBag.LoanList          = new SelectList(LoanServices.List(db), "Product", "Name");
            ViewBag.MainWorkPlaceList = new SelectList(MainWorkPlaceServices.List(db), "Id", "Name");
            return(View());
        }
        private void OnAlertsLoading(object sender, DoWorkEventArgs e)
        {
            LoanServices    ls     = ServicesProvider.GetInstance().GetContractServices();
            List <Alert_v2> alerts = ls.FindAlerts(chkLateLoans.Checked, chkPendingLoans.Checked,
                                                   chkPostponedLoans.Checked, chkOverdraftSavings.Checked,
                                                   chkPendingSavings.Checked, chkValidatedLoan.Checked);

            LoadAlerts(alerts);
        }
示例#10
0
        public LoadController()
        {
            var accountServices     = new AccountServices();
            var cardServices        = new CardServices();
            var loanServices        = new LoanServices();
            var transactionServices = new TransactionServices();
            var transferServices    = new TransferServices(accountServices, cardServices, loanServices, transactionServices);

            loadServices = new LoadServices(transferServices, accountServices, cardServices, loanServices, transactionServices);
        }
示例#11
0
        private void cmdOk_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Loan objLoan = LoanServices.Get(_strId);
                if (objLoan == null)
                {
                    objLoan = new Loan();
                }

                DateTime objDate;

                if (DateTime.TryParse(txtEndDate.Text, out objDate) == true)
                {
                    objLoan.EndDate = objDate;
                }
                else
                {
                    new MessageBoxYesNo("End Date is not valide", false, true).ShowDialog();
                    txtEndDate.Focus();
                    return;
                }

                if (DateTime.TryParse(txtStartDate.Text, out objDate) == true)
                {
                    objLoan.StartDate = objDate;
                }
                else
                {
                    new MessageBoxYesNo("Start Date is not valide", false, true).ShowDialog();
                    txtStartDate.Focus();
                    return;
                }
                string strFriends;
                if (string.IsNullOrEmpty(cboAlias.Text) == false)
                {
                    strFriends = cboAlias.Text;
                }
                else
                {
                    new MessageBoxYesNo("Please Choose a friend", false, true).ShowDialog();
                    cboAlias.Focus();
                    return;
                }

                objLoan.ItemId = _strId;

                LoanServices.Update(objLoan, strFriends, _selectedItems);
                Close();
            }
            catch (Exception ex)
            {
                CatchException(ex);
            }
        }
示例#12
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);
        }
示例#13
0
        public bool SetInstallmentAsPending(Installment installment, PaymentMethod pPaymentMethod)
        {
            ClientServices clientServices = new ClientServices(_user);
            LoanServices   loanServices   = new LoanServices(_user);

            var client = clientServices.FindTiers(installment.ClientId, OpenCBS.Enums.OClientTypes.Person);
            var loan   = loanServices.SelectLoan(installment.ContractId, true, true, true);

            loanServices.Repay(loan, client, installment.InstallmentNumber, installment.InstallmentDate, installment.InstallmentAmount,
                               false, 0, 0, false, 0, true, false, pPaymentMethod, "", true);

            return(true);
        }
示例#14
0
        public bool SetInstallmentAsPending(Installment installment, OPaymentMethods pPaymentMethod)
        {
            ClientServices clientServices = new ClientServices(_user);
            LoanServices loanServices = new LoanServices(_user);

            var client = clientServices.FindTiers(installment.ClientId, Octopus.Enums.OClientTypes.Person);
            var loan = loanServices.SelectLoan(installment.ContractId, true, true, true);

            loanServices.Repay(loan, client, installment.InstallmentNumber, installment.InstallmentDate, installment.InstallmentAmount,
                false, 0, 0, false, 0, true, pPaymentMethod, "", true);

            return true;
        }
示例#15
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)
            {
            }
        }
示例#16
0
        // GET: Loan/Delete/5
        public ActionResult Delete(Nullable <int> id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Db   db   = new Db(DbServices.ConnectionString);
            Loan loan = LoanServices.Get(id.Value, db);

            if (loan == null)
            {
                return(HttpNotFound());
            }
            return(View(loan));
        }
        private void mniSetBack_Click(object sender, RoutedEventArgs e)
        {
            Cursor = Cursors.Wait;

            ThumbItem thumbitem = MainStack.SelectedItem as ThumbItem;

            if (thumbitem != null)
            {
                int intResults = LoanServices.SetBackLoan(new Collection <string> {
                    thumbitem.Id
                });
                RoutedEventArgs args = new RoutedEventArgs(SaveEvent);
                RaiseEvent(args);
                new MessageBoxYesNo(intResults.ToString(CultureInfo.InvariantCulture) + " item are back from loan", false, false).ShowDialog();
            }
            Cursor = null;
        }
        public void ReloadAlerts(bool clear)
        {
            if (!UserSettings.GetLoadAlerts())
            {
                return;
            }

            LoanServices ls = ServicesProvider.GetInstance().GetContractServices();

            if (clear)
            {
                ls.ClearAlerts();
            }
            olvAlerts.SetObjects(null);
            lblTitle.Text     = GetString("AlertsLoading");
            tabFilter.Enabled = false;
            bwAlerts.RunWorkerAsync();
        }
示例#19
0
        // GET: LoanChange/Edit/5
        public ActionResult Edit(Nullable <int> loan)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (loan == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LoanChange loanChange = LoanChangeServices.Get(loan.Value, db);

            if (loanChange == null)
            {
                return(HttpNotFound());
            }

            ViewBag.LoanList     = new SelectList(LoanServices.List(db), "Product", "Name", loanChange.Loan);
            ViewBag.FromLoanList = new SelectList(LoanServices.List(db), "Product", "Name", loanChange.FromLoan);
            return(View(loanChange));
        }
示例#20
0
        // GET: IncomingLoan/Edit/5
        public ActionResult Edit(Nullable <int> loan)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (loan == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            IncomingLoan incomingLoan = IncomingLoanServices.Get(loan.Value, db);

            if (incomingLoan == null)
            {
                return(HttpNotFound());
            }

            ViewBag.LoanList          = new SelectList(LoanServices.List(db), "Product", "Name", incomingLoan.Loan);
            ViewBag.MainWorkPlaceList = new SelectList(MainWorkPlaceServices.List(db), "Id", "Name", incomingLoan.MainWorkPlace);
            return(View(incomingLoan));
        }
示例#21
0
 public ActionResult DeleteConfirmed(int product)
 {
     try
     {
         Db db = new Db(DbServices.ConnectionString);
         LoanServices.Delete(CurrentUser.Id, product, db);
         TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "DeleteConfirmed");
         // return RedirectToAction("Index");
     }
     catch (CfException cfex)
     {
         TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage;
     }
     catch (Exception ex)
     {
         TempData["Failure"] = ex.Message;
     }
     // return View(loan);
     return(RedirectToAction("Index"));
 }
示例#22
0
        // GET: Loan/Edit/5
        public ActionResult Edit(Nullable <int> product)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (product == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Loan loan = LoanServices.Get(product.Value, db);

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

            ViewBag.LoanDecisionList         = new SelectList(LoanDecisionServices.List(db), "Id", "CersNumber", loan.LoanDecision);
            ViewBag.LoanGenerationStatusList = new SelectList(LoanGenerationStatusServices.List(db), "Id", "Name", loan.LoanGenerationStatus);
            ViewBag.LoanStatusList           = new SelectList(LoanStatusServices.List(db), "Id", "Name", loan.LoanStatus);
            ViewBag.LoanTypeList             = new SelectList(LoanTypeServices.List(db), "ProductType", "Name", loan.LoanType);
            ViewBag.ProductList = new SelectList(ProductServices.List(db), "Id", "Notes", loan.Product);
            return(View(loan));
        }
示例#23
0
        public LoanTo(ThumbItem thumbitem)
        {
            InitializeComponent();

            if (thumbitem == null)
            {
                return;
            }

            _strId         = thumbitem.Id;
            _selectedItems = thumbitem.EType;

            cboAlias.ItemsSource       = FriendServices.Gets();
            cboAlias.DisplayMemberPath = "Alias";
            imgTitle.Source            = Util.CreateSmallImage(thumbitem.Cover);
            lblTitle.Text = thumbitem.Name;

            Loan objLoan = LoanServices.Get(_strId);

            if (objLoan != null)
            {
                txtEndDate.Text = objLoan.EndDate.ToShortDateString();

                //Fix since 2.7.12.0
                if (objLoan.Friend != null)
                {
                    cboAlias.Text = objLoan.Friend.Alias;
                }

                txtStartDate.Text = objLoan.StartDate.ToShortDateString();
            }
            else
            {
                txtStartDate.Text = DateTime.Now.ToShortDateString();
                txtEndDate.Text   = DateTime.Now.AddDays(10).ToShortDateString();
            }
        }
示例#24
0
 public void ImportInstallmentRepayment(List<Installment> pInstallments)
 {
     LoanServices loanServices = new LoanServices(_user);
     ClientServices clientServices = new ClientServices(_user);
     foreach (var installment in pInstallments)
     {
         int loanId = loanServices.SelectLoanID(installment.ContractCode);
         var loan = loanServices.SelectLoan(loanId, true, true, true);
         var client = clientServices.FindTiersByContractId(loanId);
         if (installment.RepaymentStatus == 1)
         {
             if (loan.InstallmentList[installment.InstallmentNumber].IsPending)
                 loanServices.ConfirmPendingRepayment(loan, client);
             else if (!loan.InstallmentList[installment.InstallmentNumber].IsRepaid)
                 loanServices.Repay(loan, client, installment.InstallmentNumber, installment.InstallmentDate, installment.InstallmentAmount, false,
                     0, 0, false, 0, true, Octopus.Enums.OPaymentMethods.WireTransfer, "", false);
         }
         else
         {
             if (loan.InstallmentList[installment.InstallmentNumber].IsPending)
                 loanServices.CancelPendingInstallments(loan);
         }
     }
 }
 public LoanController()
 {
     loanServices = new LoanServices();
 }
示例#26
0
 internal Helper(AccountServices accountServices, CardServices cardServices, LoanServices loanServices)
 {
     this.accountServices = accountServices;
     this.cardServices    = cardServices;
     this.loanServices    = loanServices;
 }