コード例 #1
0
        public void TestSaving_When_InitialAmount_IsNull()
        {
            Assert.Ignore();
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
                                                               new User())
            {
                CreationDate = TimeProvider.Today,
                InterestRate = 0.13,
                Product      = _savingsProduct
            };

            _savingServices = new SavingServices(null, null, new User {
                Id = 6
            });

            try
            {
                _savingServices.SaveContract(saving, new Person {
                    Id = 6
                });
                saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);
                Assert.Fail("Saving Contract shouldn't pass validation test before save (Initial Amount is Null).");
            }
            catch (OpenCbsSavingException exception)
            {
                Assert.AreEqual(exception.Code, OpenCbsSavingExceptionEnum.EntryFeesIsInvalid);
            }
        }
コード例 #2
0
        public void GetContractCodesForClient()
        {
            const int tiersId = 6;

            _savingManagerMock = new DynamicMock(typeof(SavingManager));
            _savingManagerMock.ExpectAndReturn("SelectClientSavingBookCodes",
                                               new[]
            {
                new KeyValuePair <int, string>(1, "S/BC/2007/SAVIN-1/ELFA-6")
            },
                                               tiersId, 1
                                               );

            var savingService = new SavingServices(
                (SavingManager)_savingManagerMock.MockInstance,
                null,
                new User()
                );
            var savings = savingService.SelectClientSavingBookCodes(tiersId, 1);

            Assert.AreEqual(1, savings.Length);
            var saving = savings[0];

            Assert.AreEqual(1, saving.Key);
            Assert.AreEqual("S/BC/2007/SAVIN-1/ELFA-6", saving.Value);
        }
コード例 #3
0
        public void TestSavingIsValid_TransferAmountIsInvalid()
        {
            Assert.Ignore();
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(), TimeProvider.Today, null)
            {
                Id = 1, InterestRate = 0.13, Product = _savingsProduct
            };
            SavingBookContract savingTarget = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(), TimeProvider.Today, null)
            {
                Id = 2, InterestRate = 0.13, Product = _savingsProduct
            };

            _savingManagerMock = new DynamicMock(typeof(SavingManager));
            _savingServices    = new SavingServices((SavingManager)_savingManagerMock.MockInstance, null, new User {
                Id = 6
            });

            _savingManagerMock.Expect("UpdateAccountsBalance", saving, null);
            _savingManagerMock.Expect("UpdateAccountsBalance", savingTarget, null);

            try
            {
                _savingServices.Transfer(saving, savingTarget, TimeProvider.Today, 99, 0, "transfer", new User(), false);
                Assert.Fail("Saving Contract shouldn't pass validation test before transfer (transfer amount < transfer.min).");
            }
            catch (OpenCbsSavingException exception)
            {
                Assert.AreEqual((int)OpenCbsSavingExceptionEnum.TransferAmountIsInvalid, (int)exception.Code);
            }

            _savingManagerMock.Expect("UpdateAccountsBalance", saving, null);
            _savingManagerMock.Expect("UpdateAccountsBalance", savingTarget, null);

            try
            {
                _savingServices.Transfer(saving, savingTarget, TimeProvider.Today, 301, 0, "transfer", new User(), false);
                Assert.Fail("Saving Contract shouldn't pass validation test before transfer (transfer amount > transfer.max).");
            }
            catch (OpenCbsSavingException exception)
            {
                Assert.AreEqual((int)OpenCbsSavingExceptionEnum.TransferAmountIsInvalid, (int)exception.Code);
            }

            _savingManagerMock.Expect("UpdateAccountsBalance", saving, null);
            _savingManagerMock.Expect("UpdateAccountsBalance", savingTarget, null);

            try
            {
                _savingServices.Transfer(saving, savingTarget, TimeProvider.Today, 200, 0, "transfer", new User(), false);
                Assert.Fail("Saving Contract shouldn't pass validation test before transfer (balance < balance.min).");
            }
            catch (OpenCbsSavingException exception)
            {
                Assert.AreEqual((int)OpenCbsSavingExceptionEnum.BalanceIsInvalid, (int)exception.Code);
            }
        }
コード例 #4
0
        public void Test_SimulateCloseAccount()
        {
            Assert.Ignore();
            _savingServices = new SavingServices(null, null, new User {
                Id = 6
            });

            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
                                                               new User {
                Id = 6
            }, new DateTime(2009, 01, 01), _savingsProduct, null)
            {
                InterestRate = 0.15, ManagementFees = 0, AgioFees = 0
            };

            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            Assert.AreEqual(_savingServices.SimulateCloseAccount(saving, new DateTime(2009, 02, 15), new User(), false, Teller.CurrentTeller).GetBalance(), 5650);
        }
コード例 #5
0
        public void TestSaving_When_Product_IsNull()
        {
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(), TimeProvider.Today, null)
            {
                InterestRate = 0.15
            };

            _savingServices = new SavingServices(null, null, new User {
                Id = 6
            });

            try
            {
                _savingServices.SaveContract(saving, new Person {
                    Id = 6
                });
                Assert.Fail("Saving Contract shouldn't pass validation test before save (Product is Null).");
            }
            catch (OpenCbsSavingException exception)
            {
                Assert.AreEqual(exception.Code, OpenCbsSavingExceptionEnum.ProductIsInvalid);
            }
        }
コード例 #6
0
        private void BSaveClick(object sender, EventArgs e)
        {
            nudAmount_ValueChanged(sender, e);
            bool pending = cbxPending.Visible && cbxPending.Checked;

            try
            {
                _date = new DateTime(dtpDate.Value.Year, dtpDate.Value.Month, dtpDate.Value.Day, TimeProvider.Now.Hour,
                                     TimeProvider.Now.Minute, TimeProvider.Now.Second);

                SavingServices savingServices = ServicesProvider.GetInstance().GetSavingServices();

                if (_date.Date < TimeProvider.Today.Date)
                {
                    savingServices.PerformBackDateOperations(_date);
                }
                else if (_date.Date > TimeProvider.Today.Date)
                {
                    savingServices.PerformFutureDateOperations(_date);
                }

                if (_saving.HasPendingEvents())
                {
                    if (!savingServices.AllowOperationsDuringPendingDeposit())
                    {
                        return;
                    }
                }

                if ((_flatFees.HasValue && updAmountFees.Value != _flatFees) || (_rateFees.HasValue && updAmountFees.Value != (decimal)(_rateFees * 100)))
                {
                    if (!savingServices.AllowSettingSavingsOperationsFeesManually())
                    {
                        return;
                    }
                }

                switch (_bookingDirection)
                {
                case OSavingsOperation.Credit:
                {
                    var paymentMethod = (PaymentMethod)cbSavingsMethod.SelectedItem;

                    OSavingsMethods savingsMethod = (OSavingsMethods)Enum.Parse(typeof(OSavingsMethods), paymentMethod.Name);
                    if (_saving is SavingBookContract)
                    {
                        if (savingsMethod == OSavingsMethods.Cheque)
                        {
                            ((SavingBookContract)_saving).ChequeDepositFees = updAmountFees.Value;
                        }
                        else
                        {
                            ((SavingBookContract)_saving).DepositFees = updAmountFees.Value;
                        }
                    }

                    savingServices.Deposit(_saving, _date, _amount, _description, User.CurrentUser, pending,
                                           savingsMethod, paymentMethod, null, Teller.CurrentTeller, _chequeNumberTextBox.Text);
                    _saving.Status = OSavingsStatus.Active;
                    savingServices.UpdateStatus(_saving);
                    break;
                }

                case OSavingsOperation.Debit:
                {
                    var paymentMethod = (PaymentMethod)cbSavingsMethod.SelectedItem;
                    if (_saving is SavingBookContract)
                    {
                        if (_flatFees.HasValue)
                        {
                            ((SavingBookContract)_saving).FlatWithdrawFees = updAmountFees.Value;
                        }
                        else
                        {
                            ((SavingBookContract)_saving).RateWithdrawFees = (double)(updAmountFees.Value / 100);
                        }
                    }

                    savingServices.Withdraw(_saving, _date, _amount, _description, User.CurrentUser,
                                            Teller.CurrentTeller, paymentMethod, _chequeNumberTextBox.Text);
                    break;
                }

                case OSavingsOperation.Transfer:
                {
                    if (_saving is SavingBookContract)
                    {
                        if (_flatFees.HasValue)
                        {
                            ((SavingBookContract)_saving).FlatTransferFees = updAmountFees.Value;
                        }
                        else
                        {
                            ((SavingBookContract)_saving).RateTransferFees = (double)(updAmountFees.Value / 100);
                        }
                    }
                    decimal fee = nudTotalAmount.Value - nudAmount.Value;
                    savingServices.Transfer(_saving, _savingTarget, _date, _amount, fee, _description,
                                            User.CurrentUser, false);
                    break;
                }

                case OSavingsOperation.SpecialOperation:
                {
                    OSavingsMethods savingsMethod =
                        (OSavingsMethods)
                        Enum.Parse(typeof(OSavingsMethods), cbSavingsMethod.SelectedValue.ToString());
                    if (cbBookings.SelectedItem != null)
                    {
                        Booking booking = (Booking)cbBookings.SelectedItem;
                        booking.Branch = _saving.Branch;
                        savingServices.SpecialOperation(_saving, _date, _amount, _description, User.CurrentUser,
                                                        savingsMethod, rbxCredit.Checked, booking);
                        break;
                    }
                    throw new OpenCbsSavingException(OpenCbsSavingExceptionEnum.TransactionInvalid);
                }
                }

                Close();
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
        }
コード例 #7
0
        public void TestSavingIsValid_InterestRate()
        {
            Assert.Ignore();
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User {
                Id = 6
            },
                                                               TimeProvider.Today, _savingsProduct, null)
            {
                FlatWithdrawFees = 3, FlatTransferFees = 3, DepositFees = 5, CloseFees = 6, ManagementFees = 7
            };
            Client client = new Person {
                Id = 6, LastName = "El Fanidi"
            };

            _savingManagerMock      = new DynamicMock(typeof(SavingManager));
            _savingEventManagerMock = new DynamicMock(typeof(SavingEventManager));

            _savingManagerMock.ExpectAndReturn("GetNumberOfSavings", 1, 6);
            _savingManagerMock.ExpectAndReturn("Add", 1, saving, client, null);

            _savingServices = new SavingServices((SavingManager)_savingManagerMock.MockInstance, (SavingEventManager)_savingEventManagerMock.MockInstance,
                                                 new User {
                Id = 6
            });

            //Test InterestRate is valid (between min/max)
            saving.InterestRate = 0.11;
            try
            {
                _savingServices.SaveContract(saving, client);
            }
            catch (OpenCbsSavingException exception)
            {
                Assert.AreEqual((int)OpenCbsSavingExceptionEnum.AgioFeesIsInvalid, (int)exception.Code);
            }

            try
            {
                _savingManagerMock.ExpectAndReturn("GetNumberOfSavings", 2, 6);
                _savingManagerMock.ExpectAndReturn("Add", 2, saving, client, null);
                saving.InterestRate = 0.12;
                _savingServices.SaveContract(saving, client);

                _savingManagerMock.ExpectAndReturn("GetNumberOfSavings", 3, 6);
                _savingManagerMock.ExpectAndReturn("Add", 3, saving, client, null);
                saving.InterestRate = 0.13;
                _savingServices.SaveContract(saving, client);

                _savingManagerMock.ExpectAndReturn("GetNumberOfSavings", 4, 6);
                _savingManagerMock.ExpectAndReturn("Add", 4, saving, client, null);
                saving.InterestRate = 0.16;
                _savingServices.SaveContract(saving, client);

                _savingManagerMock.ExpectAndReturn("GetNumberOfSavings", 5, 6);
                _savingManagerMock.ExpectAndReturn("Add", 5, saving, client, null);
                saving.InterestRate = 0.19;
                _savingServices.SaveContract(saving, client);

                _savingManagerMock.ExpectAndReturn("GetNumberOfSavings", 6, 6);
                _savingManagerMock.ExpectAndReturn("Add", 6, saving, client, null);
                saving.InterestRate = 0.20;
                _savingServices.SaveContract(saving, client);

                _savingManagerMock.ExpectAndReturn("GetNumberOfSavings", 7, 6);
                _savingManagerMock.ExpectAndReturn("Add", 7, saving, client, null);
                saving.InterestRate = 0.21;
            }
            catch (OpenCbsSavingException exception)
            {
                Assert.Fail(exception.Code.ToString());
            }
            try
            {
                _savingManagerMock.ExpectAndReturn("GetNumberOfSavings", 8, 6);
                _savingManagerMock.ExpectAndReturn("Add", 8, saving, client, null);
                _savingServices.SaveContract(saving, client);
            }
            catch (OpenCbsSavingException exception)
            {
                Assert.AreEqual((int)OpenCbsSavingExceptionEnum.InterestRateIsInvalid, (int)exception.Code);
            }

            //Test InterestRate is valid (equals to required value)
            //Create a product with min/max InterestRate
            _savingsProduct.InterestRate    = 0.15;
            _savingsProduct.InterestRateMin = null;
            _savingsProduct.InterestRateMax = null;

            saving.InterestRate = 0.14;
            try
            {
                _savingManagerMock.ExpectAndReturn("GetNumberOfSavings", 9, 6);
                _savingManagerMock.ExpectAndReturn("Add", 9, saving, client, null);
                _savingServices.SaveContract(saving, client);
            }
            catch (OpenCbsSavingException exception)
            {
                Assert.AreEqual((int)OpenCbsSavingExceptionEnum.InterestRateIsInvalid, (int)exception.Code);
            }


            _savingManagerMock.ExpectAndReturn("GetNumberOfSavings", 10, 6);
            _savingManagerMock.ExpectAndReturn("Add", 10, saving, client, null);
            saving.InterestRate = 0.15;
            _savingServices.SaveContract(saving, client);

            saving.InterestRate = 0.16;
            try
            {
                _savingManagerMock.ExpectAndReturn("GetNumberOfSavings", 11, 6);
                _savingManagerMock.ExpectAndReturn("Add", 11, saving, client, null);
                _savingServices.SaveContract(saving, client);
            }
            catch (OpenCbsSavingException exception)
            {
                Assert.AreEqual((int)OpenCbsSavingExceptionEnum.InterestRateIsInvalid, (int)exception.Code);
            }
        }
コード例 #8
0
        public void TestSaving_RateTransferFees()
        {
            Assert.Ignore();
            _savingsProduct.TransferFeesType    = OSavingsFeesType.Rate;
            _savingsProduct.RateTransferFeesMin = 0.01;
            _savingsProduct.RateTransferFeesMax = 0.05;

            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User {
                Id = 6
            },
                                                               TimeProvider.Today, _savingsProduct, null)
            {
                FlatWithdrawFees = 3, InterestRate = 0.15, DepositFees = 5,
                CloseFees        = 6, ManagementFees = 7, AgioFees = 10
            };
            Client client = new Person {
                Id = 6, LastName = "El Fanidi"
            };

            _savingManagerMock      = new DynamicMock(typeof(SavingManager));
            _savingEventManagerMock = new DynamicMock(typeof(SavingEventManager));

            _savingManagerMock.ExpectAndReturn("GetNumberOfSavings", 1, 6);
            _savingManagerMock.ExpectAndReturn("Add", 1, saving, client, null);

            _savingServices = new SavingServices((SavingManager)_savingManagerMock.MockInstance, (SavingEventManager)_savingEventManagerMock.MockInstance, new User {
                Id = 6
            });

            try
            {
                _savingServices.SaveContract(saving, client);
            }
            catch (OpenCbsSavingException exception)
            {
                Assert.AreEqual((int)OpenCbsSavingExceptionEnum.TransferFeesIsInvalid, (int)exception.Code);
            }

            saving.RateTransferFees = 0;

            try
            {
                _savingServices.SaveContract(saving, client);
            }
            catch (OpenCbsSavingException exception)
            {
                Assert.AreEqual((int)OpenCbsSavingExceptionEnum.TransferFeesIsInvalid, (int)exception.Code);
            }

            saving.RateTransferFees = 0.06;

            try
            {
                _savingServices.SaveContract(saving, client);
            }
            catch (OpenCbsSavingException exception)
            {
                Assert.AreEqual((int)OpenCbsSavingExceptionEnum.TransferFeesIsInvalid, (int)exception.Code);
            }

            saving.RateTransferFees = 0.03;
            Assert.AreEqual(1, _savingServices.SaveContract(saving, client));

            saving.Product.RateTransferFees    = 0.02;
            saving.Product.RateTransferFeesMin = null;
            saving.Product.RateTransferFeesMax = null;

            _savingManagerMock.ExpectAndReturn("GetNumberOfSavings", 2, 6);
            _savingManagerMock.ExpectAndReturn("Add", 2, saving, client, null);

            saving.RateTransferFees = null;

            try
            {
                _savingServices.SaveContract(saving, client);
            }
            catch (OpenCbsSavingException exception)
            {
                Assert.AreEqual((int)OpenCbsSavingExceptionEnum.TransferFeesIsInvalid, (int)exception.Code);
            }

            saving.RateTransferFees = 0.01;

            try
            {
                _savingServices.SaveContract(saving, client);
            }
            catch (OpenCbsSavingException exception)
            {
                Assert.AreEqual((int)OpenCbsSavingExceptionEnum.TransferFeesIsInvalid, (int)exception.Code);
            }

            saving.RateTransferFees = 0.03;

            try
            {
                _savingServices.SaveContract(saving, client);
            }
            catch (OpenCbsSavingException exception)
            {
                Assert.AreEqual((int)OpenCbsSavingExceptionEnum.TransferFeesIsInvalid, (int)exception.Code);
            }

            saving.RateTransferFees = 0.02;
            Assert.AreEqual(2, _savingServices.SaveContract(saving, client));
        }
コード例 #9
0
        public void TestSavingIsValid_InitialAmountCorrect()
        {
//            Assert.Ignore();
            SavingBookContract saving = new SavingBookContract(
                ApplicationSettings.GetInstance(""),

                new User {
                Id = 6
            },
                TimeProvider.Today,
                _savingsProduct,
                null)
            {
                InterestRate     = 0.13,
                FlatWithdrawFees = 3,
                FlatTransferFees = 3,
                DepositFees      = 5,
                CloseFees        = 6,
                ManagementFees   = 7,
                AgioFees         = 6
            };
            Client client = new Person {
                Id = 6, LastName = "El Fanidi", Branch = new Branch()
            };

            _savingManagerMock      = new DynamicMock(typeof(SavingManager));
            _savingEventManagerMock = new DynamicMock(typeof(SavingEventManager));

            DynamicMock connectionMock  = new DynamicMock(typeof(SqlConnection));
            DynamicMock transactionMock = new DynamicMock(typeof(SqlTransaction));

            connectionMock.SetReturnValue("BeginTransaction", transactionMock.MockInstance);

            _savingManagerMock.SetReturnValue("GetConnection", connectionMock.MockInstance);

            _savingManagerMock.ExpectAndReturn("GetNumberOfSavings", 1, 6);
            _savingManagerMock.ExpectAndReturn("Add", 1, saving, client, transactionMock.MockInstance);

            _savingServices = new SavingServices(
                (SavingManager)_savingManagerMock.MockInstance,
                (SavingEventManager)_savingEventManagerMock.MockInstance,
                new User {
                Id = 6
            }
                );

            try
            {
                Assert.GreaterOrEqual(_savingServices.SaveContract(saving, client), 0);

                saving = new SavingBookContract(
                    ApplicationSettings.GetInstance(""),

                    new User {
                    Id = 6
                },
                    TimeProvider.Today,
                    _savingsProduct,
                    null)
                {
                    InterestRate     = 0.13,
                    FlatWithdrawFees = 3,
                    FlatTransferFees = 3,
                    DepositFees      = 5,
                    CloseFees        = 6,
                    ManagementFees   = 7,
                    AgioFees         = 6
                };

                _savingManagerMock.ExpectAndReturn("GetNumberOfSavings", 2, 6);
                _savingManagerMock.ExpectAndReturn("Add", 2, saving, client, transactionMock.MockInstance);

                Assert.GreaterOrEqual(_savingServices.SaveContract(saving, client), 0);
            }
            catch (OpenCbsSavingException exception)
            {
                Assert.Fail(exception.Code.ToString());
            }
        }
コード例 #10
0
        static void Main(string[] args)
        {
            QueuedSMSServices     _queuedSMSService     = ServiceProvider.GetQueuedSMSServices();
            UserServices          _userService          = ServiceProvider.GetUserServices();
            ClientServices        _clientService        = ServiceProvider.GetClientServices();
            SavingServices        _savingService        = ServiceProvider.GetSavingServices();
            PaymentMethodServices _paymentMethodService = ServiceProvider.GetPaymentMethodServices();

            var generalSettingsService = ServicesProvider.GetInstance().GetApplicationSettingsServices();

            generalSettingsService.FillGeneralDatabaseParameter();

            Console.WriteLine("Executing sms charges job");

            var queuedsms = _queuedSMSService.GetUncharged();

            Console.WriteLine("");
            Console.WriteLine("-------------------------------------");
            Console.WriteLine("Charging SMS");
            Console.WriteLine("Uncharged sms count: " + queuedsms.Count);

            decimal smsCharge = Convert.ToDecimal(ApplicationSettings.GetInstance("").GetSpecificParameter(OGeneralSettings.SMS_CHARGE));

            var adminUser     = _userService.Find(1);
            var paymentMethod = _paymentMethodService.GetPaymentMethodByName("Cash");

            foreach (QueuedSMS qe in queuedsms)
            {
                try
                {
                    if (qe.ContractId.HasValue && qe.Charged.HasValue && !qe.Charged.Value)
                    {
                        SavingBookContract _saving = _savingService.GetSaving(qe.ContractId.Value);

                        //Get all sms for same saving book contract
                        var smsGroup = _queuedSMSService.FindByContractId(_saving.Id);

                        string description = "";

                        string formatedAccountNumber = "******" + _saving.Code.Substring(_saving.Code.Length - 4);

                        OCurrency SMSCharges = smsGroup.Count * smsCharge;

                        if (smsGroup.Count > 0)
                        {
                            string   desc  = "SMS charges of {0:.00} for {1:dd.MM.yyyy} - {2:dd.MM.yyyy} : {3}";
                            object[] items = new object[] { SMSCharges.GetFormatedValue(true), smsGroup.First().CreatedOnUtc, smsGroup.Last().CreatedOnUtc, formatedAccountNumber };
                            description = string.Format(desc, items);
                        }
                        if (smsGroup.Count == 0)
                        {
                            string   desc  = "SMS charges of {0:.00} for {1:dd.MM.yyyy} : {3}";
                            object[] items = new object[] { SMSCharges.GetFormatedValue(true), smsGroup.First().CreatedOnUtc, formatedAccountNumber };
                            description = string.Format(desc, items);
                            smsGroup.First().Charged = true;
                        }
                        _savingService.Withdraw(_saving, DateTime.Now, SMSCharges, true, description, "", adminUser,
                                                Teller.CurrentTeller, paymentMethod);

                        qe.Charged = true;
                        foreach (var sms in smsGroup)
                        {
                            sms.Charged = true;
                            queuedsms.Where(s => s.Id == sms.Id).First().Charged = true;
                            _queuedSMSService.Update(sms);
                        }

                        //Send sms charge notification
                        Person person = _clientService.FindPersonById(qe.RecipientId.Value);
                        if (person != null)
                        {
                            if (person.SMSDelivery.HasValue && person.SMSDelivery.Value)
                            {
                                string mfbName = Convert.ToString(ServicesProvider.GetInstance().GetGeneralSettings().GetSpecificParameter(OGeneralSettings.MFI_NAME));
                                //var message = messageTemplate.Body;
                                var messageReplaced = mfbName + " " + description;// Tokenizer.Replace(message, tokens, false);

                                var sms = new QueuedSMS()
                                {
                                    From         = Convert.ToString(ServicesProvider.GetInstance().GetGeneralSettings().GetSpecificParameter(OGeneralSettings.SMS_FROM_NUMBER)),
                                    Recipient    = person.PersonalPhone,
                                    RecipientId  = person.Id,
                                    ContractId   = _saving != null ? _saving.Id : 0,
                                    Charged      = true,
                                    Message      = messageReplaced,
                                    SentTries    = 0,
                                    CreatedOnUtc = DateTime.UtcNow,
                                };

                                _queuedSMSService.Add(sms);
                            }
                        }
                    }
                }
                catch (Exception exc)
                {
                    Console.WriteLine(string.Format("Error charging sms: {0}", exc.Message), exc);
                }
                finally
                {
                }
            }
        }