本文整理汇总了C#中OpenCBS.CoreDomain.Accounting.PaymentMethod类的典型用法代码示例。如果您正苦于以下问题:C# PaymentMethod类的具体用法?C# PaymentMethod怎么用?C# PaymentMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PaymentMethod类属于OpenCBS.CoreDomain.Accounting命名空间,在下文中一共展示了PaymentMethod类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Reschedule_Annuity_ChangeInterestRate_PartiallyPaid_Overpaid
public void Reschedule_Annuity_ChangeInterestRate_PartiallyPaid_Overpaid()
{
Loan loan = _GetLoan(_GetAnnuityProduct_RoundingTypeBegin(), 10000, 0.04m, 6, new DateTime(2010, 1, 15));
loan.Repay(1, new DateTime(2010, 2, 12), 1906, false, true);
loan.Repay(2, new DateTime(2010, 3, 12), 1908, false, true);
PaymentMethod paymentMethod = new PaymentMethod(1, "Cash", "", false);
loan.Repay(3, new DateTime(2010, 4, 5), 1500, false, 0, 0, true, 200, true, false, false, paymentMethod);
Assert.AreEqual(loan.GetInstallment(0).IsRepaid, true);
Assert.AreEqual(loan.GetInstallment(1).IsRepaid, true);
Assert.AreEqual(loan.GetInstallment(2).IsPartiallyRepaid, true);
ReschedulingOptions ro = new ReschedulingOptions
{
InterestRate = 0.03m,
NewInstallments = 0,
RepaymentDateOffset = 0,
ChargeInterestDuringShift = true
};
loan.Reschedule(ro);
_AssertInstallment(loan, 2, "2010-04-15", 169, 2643, 6926, 1300, 169);
_AssertInstallment(loan, 3, "2010-05-17", 128, 1386, 4283, 0, 31);
_AssertInstallment(loan, 4, "2010-06-15", 87, 1427, 2897, 0, 0);
_AssertInstallment(loan, 5, "2010-07-15", 44, 1470, 1470, 0, 0);
}
示例2: DeletePaymentMethodFromBranach
public void DeletePaymentMethodFromBranach(PaymentMethod paymentMethod)
{
const string q =
@"UPDATE LinkBranchesPaymentMethods SET deleted = 1
WHERE id = @link_id";
using (SqlConnection conn = GetConnection())
using (OpenCbsCommand c = new OpenCbsCommand(q, conn))
{
c.AddParam("@link_id", paymentMethod.LinkId);
c.ExecuteNonQuery();
}
}
示例3: AddPaymentMethodToBranch
public void AddPaymentMethodToBranch(PaymentMethod paymentMethod)
{
const string q =
@"INSERT INTO LinkBranchesPaymentMethods (branch_id, payment_method_id, account_id)
VALUES (@branch_id, @payment_method_id, @account_id)";
using (SqlConnection conn = GetConnection())
using (OpenCbsCommand c = new OpenCbsCommand(q, conn))
{
c.AddParam("@branch_id", paymentMethod.Branch.Id);
c.AddParam("@payment_method_id", paymentMethod.Id);
c.AddParam("@account_id", paymentMethod.Account.Id);
c.ExecuteNonQuery();
}
}
示例4: Initialize
private void Initialize(PaymentMethod paymentMethod)
{
_isNew = paymentMethod == null;
_paymentMethod = paymentMethod;
List<PaymentMethod> methods = ServicesProvider.GetInstance().GetPaymentMethodServices().GetAllPaymentMethods();
cmbPaymentMethod.Items.Clear();
cmbPaymentMethod.ValueMember = "Id";
cmbPaymentMethod.DisplayMember = "Name";
cmbPaymentMethod.DataSource = methods;
if (_paymentMethod != null && _paymentMethod.Name != null)
cmbPaymentMethod.SelectedValue = _paymentMethod.Id;
cmbAccount.Items.Clear();
cmbAccount.ValueMember = "Number";
cmbAccount.DisplayMember = "";
cmbAccount.DataSource = ServicesProvider.GetInstance().GetChartOfAccountsServices().FindAllAccounts().OrderBy(item => item.Number).ToList();
if (_paymentMethod != null && _paymentMethod.Account != null)
cmbAccount.SelectedValue = _paymentMethod.Account.Number;
}
示例5: AddLoanDisbursmentEvent
public void AddLoanDisbursmentEvent()
{
EventManager eventManager = (EventManager)container["EventManager"];
LoanDisbursmentEvent loanDisbursmentEvent = new LoanDisbursmentEvent
{
Id = 10,
User = new User { Id = 1 },
Date = new DateTime(2006, 7, 21),
Amount = 100,
};
loanDisbursmentEvent.Commissions = new List<LoanEntryFeeEvent>();
LoanEntryFeeEvent commission = new LoanEntryFeeEvent();
commission.Fee = 10;
loanDisbursmentEvent.Commissions.Add(commission);
PaymentMethod method = new PaymentMethod(1, "Savings", "Savings method", false);
loanDisbursmentEvent.PaymentMethod = method;
eventManager.AddLoanEvent(loanDisbursmentEvent, 1);
Assert.AreNotEqual(0, loanDisbursmentEvent.Id);
}
示例6: Withdraw
public override List<SavingEvent> Withdraw(OCurrency pAmount, DateTime pDate, string pDescription, User pUser, bool pIsDesactivateFees, Teller teller, PaymentMethod paymentMethod)
{
List<SavingEvent> events = new List<SavingEvent>();
int? tellerId = null;
if (teller != null && teller.Id != 0) tellerId = teller.Id;
SavingWithdrawEvent withdrawEvent = new SavingWithdrawEvent
{
Amount = pAmount,
Date = pDate,
Description = pDescription,
User = pUser,
Cancelable = true,
Fee = 0m,
TellerId = tellerId,
ProductType = typeof(SavingsBookProduct),
SavingsMethod = OSavingsMethods.Cash
};
Events.Add(withdrawEvent);
events.Add(withdrawEvent);
if (Status != OSavingsStatus.Closed && !pIsDesactivateFees)
withdrawEvent.Fee = Product.WithdrawFeesType == OSavingsFeesType.Flat ? FlatWithdrawFees : pAmount * RateWithdrawFees.Value;
return events;
}
示例7: Deposit
public override List<SavingEvent> Deposit(OCurrency pAmount, DateTime pDate, string pDescription, User pUser,
bool pIsDesactivateFees, bool isPending, OSavingsMethods savingsMethod, PaymentMethod paymentMethod, int? pendingEventId, Teller teller)
{
List<SavingEvent> events = new List<SavingEvent>();
int? tellerId = null;
if (teller != null && teller.Id != 0) tellerId = teller.Id;
SavingEvent savingEvent;
if (isPending)
{
savingEvent = new SavingPendingDepositEvent();
}
else
{
savingEvent = new SavingDepositEvent();
}
savingEvent.Amount = pAmount;
savingEvent.Date = pDate;
savingEvent.Description = pDescription;
savingEvent.User = pUser;
savingEvent.Cancelable = true;
savingEvent.IsPending = isPending;
savingEvent.SavingsMethod = savingsMethod;
savingEvent.PaymentsMethod = paymentMethod;
savingEvent.PendingEventId = pendingEventId;
savingEvent.TellerId = tellerId;
savingEvent.ProductType = typeof(SavingsBookProduct);
Events.Add(savingEvent);
events.Add(savingEvent);
if (Status != OSavingsStatus.Closed && !pIsDesactivateFees)
savingEvent.Fee = savingsMethod == OSavingsMethods.Cheque ? ChequeDepositFees : DepositFees;
return events;
}
示例8: SetInstallmentAsPending
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;
}
示例9: RepayLoanBeforeDisburse
public void RepayLoanBeforeDisburse()
{
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ALLOWSMULTIPLELOANS, false);
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.INCREMENTALDURINGDAYOFF, false);
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Cash);
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, 0);
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.INTERESTS_ALSO_CREDITED_IN_FL, 1);
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.DONOTSKIPWEEKENDSININSTALLMENTSDATE, 0);
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.BAD_LOAN_DAYS, "180");
ProvisionTable _provisionningTable = ProvisionTable.GetInstance(new User() { Id = 1 });
_provisionningTable.ProvisioningRates = new List<ProvisioningRate>();
_provisionningTable.Add(new ProvisioningRate { Number = 1, NbOfDaysMin = 0, NbOfDaysMax = 0, ProvisioningValue = 0.02, ProvisioningInterest = 0.02, ProvisioningPenalty = 0.02 });
_provisionningTable.Add(new ProvisioningRate { Number = 2, NbOfDaysMin = 1, NbOfDaysMax = 30, ProvisioningValue = 0.1, ProvisioningInterest = 0.1, ProvisioningPenalty = 0.1 });
_provisionningTable.Add(new ProvisioningRate { Number = 3, NbOfDaysMin = 31, NbOfDaysMax = 60, ProvisioningValue = 0.25, ProvisioningInterest = 0.25, ProvisioningPenalty = 0.25 });
_provisionningTable.Add(new ProvisioningRate { Number = 4, NbOfDaysMin = 61, NbOfDaysMax = 90, ProvisioningValue = 0.5, ProvisioningInterest= 0.5, ProvisioningPenalty= 0.5 });
_provisionningTable.Add(new ProvisioningRate { Number = 5, NbOfDaysMin = 91, NbOfDaysMax = 180, ProvisioningValue = 0.75, ProvisioningInterest = 0.75, ProvisioningPenalty = 0.75 });
_provisionningTable.Add(new ProvisioningRate { Number = 6, NbOfDaysMin = 181, NbOfDaysMax = 365, ProvisioningValue = 1, ProvisioningInterest = 1, ProvisioningPenalty= 1 });
_provisionningTable.Add(new ProvisioningRate { Number = 7, NbOfDaysMin = 366, NbOfDaysMax = 99999, ProvisioningValue = 1, ProvisioningInterest= 1, ProvisioningPenalty= 1 });
Teller.CurrentTeller = null;
AddDataForTestingTransaction dataHelper = new AddDataForTestingTransaction();
int _creditId = dataHelper.AddGenericCreditContractIntoDatabase();
IClient _client = new Group { Id = 5 };
LoanManager _loanManager = new LoanManager(new User() { Id = 1 });
Loan _loan = _loanManager.SelectLoan(_creditId, true, true, true);
_loan.CreditCommiteeDate = _loan.StartDate;
FundingLine f = _loan.FundingLine;
f.Currency.Id = _loan.Product.Currency.Id;
FundingLineServices fundingLineServices = new FundingLineServices(new User() { Id = 1 });
var ev = new FundingLineEvent
{
Code = "KAO",
Type = OFundingLineEventTypes.Entry,
CreationDate = new DateTime(2008, 1, 10),
EndDate = DateTime.Now.AddDays(1),
Amount = 1000,
FundingLine = f,
Movement = OBookingDirections.Credit,
IsDeleted = false
};
fundingLineServices.AddFundingLineEvent(ev, null);
f.AddEvent(ev);
LoanServices loanServices = new LoanServices(new User() { Id = 1 });
PaymentMethod method = new PaymentMethod(1, "Savings", "Savings method", false);
_loan = loanServices.Disburse(_loan, new DateTime(2005, 10, 10), true, false, method);
Assert.AreEqual(_loan.Disbursed, true);
PaymentMethod paymentMethod = new PaymentMethod(1, "Cash", "", false);
loanServices.Repay(_loan, _client, 1, new DateTime(2005, 1, 5), 100, true, 0, 0, false, 5, false, false, paymentMethod, null, false);
}
示例10: GetPaymentMethodFromReader
private PaymentMethod GetPaymentMethodFromReader(OpenCbsReader r)
{
//Do not change this calling of constructor by Object initializer
PaymentMethod pm = new PaymentMethod(
r.GetInt("id"),
r.GetString("name"),
r.GetString("description"),
r.GetBool("pending")
);
pm.Account = _accountManager.Select(r.GetInt("account_id"));
return pm;
}
示例11: SelectPaymentMethodOfBranch
public List<PaymentMethod> SelectPaymentMethodOfBranch(int branchId)
{
string q = @"SELECT [lbpm].[payment_method_id],
[lbpm].[id],
[pm].[name],
[pm].[description],
[pm].[pending],
[lbpm].[branch_id],
[lbpm].[date],
[lbpm].[account_id]
FROM PaymentMethods pm
INNER JOIN LinkBranchesPaymentMethods lbpm ON lbpm.payment_method_id = pm.id
WHERE [lbpm].[branch_id] = @id AND [lbpm].[deleted] = 0";
List<PaymentMethod> paymentMethods = new List<PaymentMethod>();
using (SqlConnection conn = GetConnection())
using (OpenCbsCommand c = new OpenCbsCommand(q, conn))
{
c.AddParam("@id", branchId);
using (OpenCbsReader r = c.ExecuteReader())
{
if (r.Empty) return paymentMethods;
while (r.Read())
{
PaymentMethod paymentMethod = new PaymentMethod
{
Id = r.GetInt("payment_method_id"),
Name = r.GetString("name"),
Description = r.GetString("description"),
IsPending = r.GetBool("pending"),
LinkId = r.GetInt("id"),
Branch = _branchManager.Select(r.GetInt("branch_id")),
Date = r.GetDateTime("date"),
Account = _accountManager.Select(r.GetInt("account_id"))
};
paymentMethods.Add(paymentMethod);
}
}
}
return paymentMethods;
}
示例12: TestCalculatePendingRepayment
public void TestCalculatePendingRepayment()
{
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.Flat,
ChargeInterestWithinGracePeriod = true,
KeepExpectedInstallment = false,
Currency = new Currency { Id = 1 }
};
Loan myContract = new Loan(package, 1000, 0.03m, 6, 2, new DateTime(2006, 1, 1), new User(),
ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""),
ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
PaymentMethod paymentMethod = new PaymentMethod(2, "Voucher", "", true);
RepaymentEvent pEvent = myContract.Repay(1, new DateTime(2006, 6, 1), 30, true, 0, 0, false, 0, true, false, true,
paymentMethod);
Assert.IsTrue(myContract.GetInstallment(0).IsRepaid);
Assert.AreEqual(pEvent.Code, "PBLR");
Assert.IsTrue(myContract.GetInstallment(0).IsPending);
myContract.ConfirmPendingRepayment();
Assert.IsFalse(myContract.GetInstallment(0).IsPending);
}
示例13: ShowNewContract
public KeyValuePair<Loan, RepaymentEvent> ShowNewContract(Loan pContract,
int installmentNumber,
DateTime date,
OCurrency amount,
bool disableFees,
OCurrency manualFeesAmount,
OCurrency manualCommissionAmount,
bool disableInterests,
OCurrency manualInterests,
bool pKeepExpectedInstallment,
bool doProportionPayment,
PaymentMethod pPaymentMethod,
bool pPending,
bool isTotalRepayment)
{
if (!pContract.UseCents)
{
if (amount != Decimal.Ceiling(amount.Value))
{
throw new OpenCbsRepayException(OpenCbsRepayExceptionsEnum.DecimalAmount);
}
}
else if (amount < 0)
throw new OpenCbsRepayException(OpenCbsRepayExceptionsEnum.NegativeAmount);
Loan fakeContract = pContract.Copy();
OCurrency expectedMaxAmount = fakeContract.CalculateMaximumAmountAuthorizedToRepay(installmentNumber, date,
disableFees,
manualFeesAmount,
manualCommissionAmount,
disableInterests,
manualInterests,
pKeepExpectedInstallment);
expectedMaxAmount = fakeContract.UseCents
? Math.Round(expectedMaxAmount.Value, 2, MidpointRounding.AwayFromZero)
: expectedMaxAmount;
if (!disableFees && !isTotalRepayment)
{
if (AmountComparer.Compare(amount, expectedMaxAmount) > 0)
throw new OpenCbsRepayException(OpenCbsRepayExceptionsEnum.AmountGreaterThanTotalRemainingAmount);
}
else
{
if (isTotalRepayment)
amount = expectedMaxAmount;
}
RepaymentEvent e = fakeContract.Repay(installmentNumber, date, amount, disableFees, manualFeesAmount,
manualCommissionAmount, disableInterests, manualInterests,
pKeepExpectedInstallment, doProportionPayment, pPaymentMethod, null,
pPending);
return new KeyValuePair<Loan, RepaymentEvent>(fakeContract, e);
}
示例14: Repay
public Loan Repay(Loan curentLoan,
IClient client,
int installmentNumber,
DateTime payDate,
OCurrency amount,
bool disableFees,
OCurrency manualFeesAmount,
OCurrency manualCommission,
bool disableInterests,
OCurrency manualInterestsAmount,
bool keepExpectedInstallment,
bool proportionPayment,
PaymentMethod paymentMethod,
string comment,
bool isPending)
{
if (payDate.Date < curentLoan.StartDate.Date)
{
throw new OpenCbsRepayException(OpenCbsRepayExceptionsEnum.RepaymentBeforeDisburse);
}
if (curentLoan.Events.GetRepaymentEvents().Any(r => !r.Deleted && r.Date > payDate))
{
throw new OpenCbsRepayException(OpenCbsRepayExceptionsEnum.RepaymentBeforeLastEventDate);
}
CheckOperationDate(payDate);
Loan savedContract = curentLoan.Copy();
using (SqlConnection conn = _loanManager.GetConnection())
using (SqlTransaction sqlTransaction = conn.BeginTransaction())
{
try
{
//Repay
// Accrued Interest Event generation
if (ApplicationSettings.GetInstance(_user.Md5).AccountingProcesses == OAccountingProcesses.Accrual)
{
DateTime dateTime = payDate;
AccruedInterestEvent e = savedContract.GetAccruedInterestEvent(dateTime);
if (e != null)
{
if (Teller.CurrentTeller != null && Teller.CurrentTeller.Id != 0)
e.TellerId = Teller.CurrentTeller.Id;
ServicesProvider.GetInstance().GetContractServices().AddAccruedInterestEvent(savedContract,
e,
sqlTransaction);
}
}
RepaymentEvent repayEvent = savedContract.Repay(installmentNumber, payDate, amount, disableFees,
manualFeesAmount, manualCommission,
disableInterests, manualInterestsAmount,
keepExpectedInstallment, proportionPayment,
paymentMethod, comment,
isPending);
savedContract.EscapedMember = curentLoan.EscapedMember;
repayEvent.User = _user;
//the code below should be moved into event generation proccess
if (Teller.CurrentTeller != null && Teller.CurrentTeller.Id != 0)
repayEvent.TellerId = Teller.CurrentTeller.Id;
if (!isPending)
{
FundingLineEvent repayFlFundingLineEvent = new FundingLineEvent
{
Code =
String.Concat("RE_", curentLoan.Code,
"_INS_", installmentNumber),
Type = OFundingLineEventTypes.Repay,
Amount =
ApplicationSettings.GetInstance(
_user != null
? _user.Md5
: "")
.InterestsCreditedInFL
? amount
: repayEvent.Principal,
Movement = OBookingDirections.Credit,
CreationDate = TimeProvider.Now,
FundingLine = curentLoan.FundingLine,
AttachTo = repayEvent
};
//the code below should be moved into event generation proccess
if (Teller.CurrentTeller != null && Teller.CurrentTeller.Id != 0)
repayFlFundingLineEvent.TellerId = Teller.CurrentTeller.Id;
//this line is to prevent errors from popping up when client makes a repayment of
//everything but the principal
if (repayFlFundingLineEvent.Amount > 0
|| ApplicationSettings.GetInstance(_user != null ? _user.Md5 : "").InterestsCreditedInFL)
curentLoan.FundingLine.AddEvent(
new FundingLineServices(_user).AddFundingLineEvent(repayFlFundingLineEvent,
sqlTransaction));
}
foreach (RepaymentEvent loanEvent in savedContract.Events.GetLoanRepaymentEvents())
//.........这里部分代码省略.........
示例15: comboBoxPaymentMethod_SelectedIndexChanged
private void comboBoxPaymentMethod_SelectedIndexChanged(object sender, EventArgs e)
{
_paymentMethod = cmbPaymentMethod.SelectedItem as PaymentMethod;
if (_paymentMethod != null)
checkBoxPending.Visible = _paymentMethod.IsPending;
DisplayInstallmentsAndEvent();
}