/// <summary> /// Initializes a new instance of the <see cref="T:B4F.TotalGiro.Accounts.Instructions.ClientDepartureInstruction">ClientDepartureInstruction</see> class. /// </summary> /// <param name="account">The account the withdrawal will belong to</param> /// <param name="executionDate">The date the instruction should execute</param> /// <param name="doNotChargeCommission">The instruction is without any charges</param> /// <param name="counterAccount">counter Account</param> /// <param name="transferDescription">transfer Description</param> public ClientDepartureInstruction(IAccountTypeCustomer account, DateTime executionDate, bool doNotChargeCommission, ICounterAccount counterAccount, string transferDescription) : base(account, executionDate, OrderActionTypes.Departure, doNotChargeCommission, null) { this.CounterAccount = counterAccount; this.TransferDescription = transferDescription; this.status = ClientDepartureInstructionStati.New; }
/// <summary> /// Initializes a new instance of the <see cref="T:B4F.TotalGiro.Accounts.Instructions.CashWithdrawalInstruction">CashWithdrawalInstruction</see> class. /// </summary> /// <param name="account">The account the withdrawal will belong to</param> /// <param name="executionDate">The day from which the instruction should be taken into account</param> /// <param name="withdrawalDate">The day that the money should be withdrawn</param> /// <param name="amount">The relevant amount</param> /// <param name="counterAccount">The account the money should go to</param> /// <param name="rule">The rule that is responsible for this periodic instruction</param> /// <param name="doNotChargeCommission">The instruction is without any charges</param> internal CashWithdrawalInstruction(IAccountTypeCustomer account, DateTime executionDate, DateTime withdrawalDate, Money amount, ICounterAccount counterAccount, IWithdrawalRule rule, string transferDescription, bool doNotChargeCommission) : base(account, executionDate, doNotChargeCommission) { this.Account = account; this.WithdrawalDate = withdrawalDate; this.Amount = amount; this.CounterAccount = counterAccount; this.Rule = rule; this.TransferDescription = transferDescription; this.status = CashWithdrawalInstructionStati.New; if (rule != null) this.IsPeriodic = true; }
public WithdrawalRule(Money amount, WithdrawalRuleRegularity regularity, DateTime firstDateWithdrawal, ICounterAccount counterAccount) { if (amount == null || amount.IsZero) throw new ApplicationException("Amount is mandatory."); if (Util.IsNullDate(firstDateWithdrawal)) throw new ApplicationException("First Withdrawal Date is mandatory."); if (regularity == null) throw new ApplicationException("Regularity is mandatory."); if (firstDateWithdrawal < DateTime.Today) throw new ApplicationException("First Withdrawal Date can not be in the past."); this.Amount = amount; this.Regularity = regularity; this.FirstDateWithdrawal = firstDateWithdrawal; this.CounterAccount = counterAccount; this.IsActive = true; this.CreatedBy = B4F.TotalGiro.Security.SecurityManager.CurrentUser; }
public MoneyTransferOrder(IEffectenGiro stichtingDetails, Money amount, ICustomerAccount transfereeAccount, ICounterAccount transfereeCounterAccount, string transferDescription1, string transferDescription2, string transferDescription3, string transferDescription4, DateTime processDate, string narBenef1, string narBenef2, string narBenef3, string narBenef4, IndicationOfCosts costIndication) { this.CreatedBy = B4F.TotalGiro.Security.SecurityManager.CurrentUser; this.TransferorJournal = stichtingDetails.DefaultWithdrawJournal; this.NarDebet1 = stichtingDetails.StichtingName; this.NarDebet2 = stichtingDetails.ResidentialAddress.AddressLine1; this.NarDebet3 = stichtingDetails.ResidentialAddress.AddressLine2; this.NarDebet4 = stichtingDetails.ResidentialAddress.Country.CountryName; this.ProcessDate = processDate; if (amount != null) this.Amount = amount.Abs(); this.TransfereeAccount = transfereeAccount; this.TransfereeCounterAccount = transfereeCounterAccount; this.NarBenef1 = narBenef1; this.NarBenef2 = narBenef2; this.NarBenef3 = narBenef3; this.NarBenef4 = narBenef4; this.TransferDescription1 = transferDescription1; this.TransferDescription2 = transferDescription2; this.TransferDescription3 = transferDescription3; this.TransferDescription4 = transferDescription4; this.CostIndication = costIndication; }
public static DataSet GetCounterAccounts(int companyID) { DataSet ds = null; IDalSession session = NHSessionFactory.CreateSession(); IContactCompany company = (IContactCompany)ContactMapper.GetContact(session, companyID); if (company != null) { ICounterAccountCollection collAccounts = company.CounterAccounts; ICounterAccount[] listAccounts = new ICounterAccount[collAccounts.Count]; collAccounts.CopyTo(listAccounts, 0); ds = DataSetBuilder.CreateDataSetFromBusinessObjectList( listAccounts, "Key, Number, AccountName, BankName, IsPublic"); } session.Close(); return ds; }
public bool Edit(DateTime withdrawalDate, DateTime executionDate, Money amount, ICounterAccount counterAccount, string transferDescription, bool doNotChargeCommission) { if (!IsEditable) throw new ApplicationException("This instruction is not editable"); this.WithdrawalDate = withdrawalDate; this.ExecutionDate = executionDate; if (this.Rule == null) this.Amount = amount; this.CounterAccount = counterAccount; this.TransferDescription = transferDescription; this.DoNotChargeCommission = doNotChargeCommission; Money portValue = Account.TotalAll + Account.ActiveWithdrawalInstructions.TotalAmount; if (portValue == null || portValue.IsLessThanZero) throw new ApplicationException("The total amount of withdrawals exceeds the totalportfolio value."); return true; }
public static void Update(IDalSession session, ICounterAccount obj) { session.Update(obj); }
public static void Insert(IDalSession session, ICounterAccount obj) { session.Insert(obj); }
/// <summary> /// This is the method where a new withdrawal instruction is created for the account. /// </summary> /// <param name="executionDate">The day from which the instruction should be taken into account</param> /// <param name="withdrawalDate">The day that the money should be there</param> /// <param name="withdrawalAmount">The relevant amount</param> /// <param name="counterAccount">The account the money should go to</param> /// <param name="rule">The rule that is responsible for this periodic instruction</param> /// <param name="doNotChargeCommission">The instruction is without any charges</param> /// <returns>A new <see cref="T:B4F.TotalGiro.Accounts.Instructions.Instruction">instruction</see></returns> public ICashWithdrawalInstruction CreateWithdrawalInstruction(DateTime executionDate, DateTime withdrawalDate, Money withdrawalAmount, ICounterAccount counterAccount, IWithdrawalRule rule, string transferDescription, bool doNotChargeCommission) { if (withdrawalAmount == null || withdrawalAmount.IsGreaterThanZero) throw new ApplicationException("The withdrawal amount is mandatory and can not be positive"); if (counterAccount == null && this.CounterAccount == null) throw new ApplicationException("There should be at least a counter account on the rule or on the account."); ICashWithdrawalInstruction instruct = new CashWithdrawalInstruction(this, executionDate, withdrawalDate, withdrawalAmount, counterAccount, rule, transferDescription, doNotChargeCommission); if (instruct != null && instruct.Validate()) { AccountInstructions.Add(instruct); ActiveAccountInstructions.Add(instruct); } return instruct; }
/// <summary> /// This is the method where a new withdrawal instruction is created for the account. /// </summary> /// <param name="executionDate">The day from which the instruction should be taken into account</param> /// <param name="counterAccount">The account the money should go to</param> /// <param name="transferDescription">The transfer Description on the final Money transfer order</param> /// <param name="doNotChargeCommission">The instruction is without any charges</param> /// <returns>A new <see cref="T:B4F.TotalGiro.Accounts.Instructions.ClientDepartureInstruction">instruction</see></returns> public IClientDepartureInstruction CreateDepartureInstruction(DateTime executionDate, ICounterAccount counterAccount, string transferDescription, bool doNotChargeCommission) { IClientDepartureInstruction instruct = new ClientDepartureInstruction(this, executionDate, doNotChargeCommission, counterAccount, transferDescription); if (instruct != null) { AccountInstructions.Add(instruct); ActiveAccountInstructions.Add(instruct); } return instruct; }
private string getDescriptionLine(IClientDepartureInstruction instruction, int line, ICounterAccount counterAccount) { string transferDescription = getDescriptionLine(instruction.TransferDescription, line); switch (line) { case 1: return string.Format("{0} eind afrekening", instruction.Account.Number); case 2: if (!string.IsNullOrEmpty(transferDescription)) return transferDescription; else return "Liquidatie portfolio"; case 3: if (!string.IsNullOrEmpty(transferDescription)) return transferDescription; else return string.Format("Voor {0}", instruction.Account.ShortName); case 4: if (!string.IsNullOrEmpty(transferDescription)) return transferDescription; else { if (counterAccount.IsPublic) return "Transfer naar derden"; else return "Transfer naar eigen rekening"; } } return ""; }
private string getDescriptionLine(ICashWithdrawalInstruction instruction, int line, ICounterAccount counterAccount) { string transferDescription = getDescriptionLine(instruction.TransferDescription, line); switch (line) { case 1: return string.Format("{0} onttrekking", instruction.Account.Number); case 2: if (!string.IsNullOrEmpty(transferDescription)) return transferDescription; else return string.Format("{0} {1} {2}", (instruction.Rule != null ? instruction.Rule.Regularity.Description : "Eenmalig"), instruction.Amount.Underlying.ToCurrency.Symbol, instruction.Amount.Abs().Quantity.ToString()); case 3: if (!string.IsNullOrEmpty(transferDescription)) return transferDescription; else return string.Format("Voor {0}", instruction.Account.ShortName); case 4: if (!string.IsNullOrEmpty(transferDescription)) return transferDescription; else { if (counterAccount.IsPublic) return "Transfer naar derden"; else return "Transfer naar eigen rekening"; } } return ""; }
protected void fillFromInstruction(IInstruction instruction, ICounterAccount counterAccount, Money amount) { this.CreatedBy = B4F.TotalGiro.Security.SecurityManager.CurrentUser; ICustomerAccount transfereeAccount = (ICustomerAccount)instruction.Account; if (transfereeAccount == null) throw new ApplicationException(err_def + "the account is mandatory"); string errMessage = err_def + string.Format("Could not create money transfer order for account {0}: ", transfereeAccount.DisplayNumberWithName); IEffectenGiro stichtingDetails = transfereeAccount.AccountOwner.StichtingDetails; if (stichtingDetails == null) throw new ApplicationException(errMessage + "the stichting details are mandatory"); this.TransferorJournal = stichtingDetails.DefaultWithdrawJournal; this.NarDebet1 = stichtingDetails.StichtingName; this.NarDebet2 = stichtingDetails.ResidentialAddress.AddressLine1; this.NarDebet3 = stichtingDetails.ResidentialAddress.AddressLine2; this.NarDebet4 = stichtingDetails.ResidentialAddress.Country.CountryName; this.ProcessDate = DateTime.Today; this.Amount = amount; this.TransfereeAccount = transfereeAccount; this.TransfereeCounterAccount = counterAccount; this.NarBenef1 = getMaxLengthString(counterAccount.AccountName, 35); this.BenefBankAcctNr = counterAccount.Number; Address address = null; if (counterAccount.BeneficiaryAddress != null && !counterAccount.BankAddress.IsEmpty) address = counterAccount.BeneficiaryAddress; else if (transfereeAccount.PrimaryAccountHolder != null && transfereeAccount.PrimaryAccountHolder.Contact != null && transfereeAccount.PrimaryAccountHolder.Contact.CurrentNAW != null) { IContactsNAW contactsNaw = transfereeAccount.PrimaryAccountHolder.Contact.CurrentNAW; if (contactsNaw.ResidentialAddress != null && !contactsNaw.ResidentialAddress.IsEmpty) address = contactsNaw.ResidentialAddress; else address = contactsNaw.PostalAddress; } if (address != null && !address.IsEmpty) { this.NarBenef2 = getAddressLine(address, 1); this.NarBenef3 = getAddressLine(address, 2); this.NarBenef4 = getAddressLine(address, 3); } }