public string GetAccountNumberForNewAccount(ICustomerAccount account)
        {
            int    number = Container.Instances <CustomerAccount>().Count() + 1;
            string padded = "00000000" + number;

            return(padded.Substring(padded.Length - 8));
        }
 public VideoStoreService(
     IStoreRegistration storeRegistration,
     IVideoManagement videoManagement,
     ICustomerAccount customerAccount)
 {
     StoreRegistration = storeRegistration;
     VideoManagement   = videoManagement;
     CustomerAccount   = customerAccount;
 }
예제 #3
0
파일: Nota.cs 프로젝트: kiquenet/B4F
        protected Nota(ICustomerAccount account)
        {
            this.creationDate = DateTime.Now;
            this.printCount = 0;

            this.formatter = ContactsFormatter.CreateContactsFormatter(account);
            this.contactsNAW = this.formatter.ContactsNAW;
            this.secondContactsNAW = this.formatter.SecondContactsNAW;
        }
        public VideoStoreService(
			IStoreRegistration storeRegistration,
			IVideoManagement videoManagement,
			ICustomerAccount customerAccount)
        {
            StoreRegistration = storeRegistration;
            VideoManagement = videoManagement;
            CustomerAccount = customerAccount;
        }
예제 #5
0
        public static DataSet getAccountDetails(ICustomerAccount account)
        {
            AccountDetails details = new AccountDetails(account);
            DataSet ds = DataSetBuilder.CreateDataSetFromBusinessObjectList(
                new AccountDetails[] { details },
                "AccountNumber, VermogensBeheer, TegenRekening, TegenRekeningBank,TegenRekeningTNV, TegenRekeningPlaats,   ModelPortfolio, PLastName, SLastName, PVoorLetters, SVoorLetters, PTussenVoegsels, STussenVoegsels, PGeslacht, SGeslacht, PGeboortedatum, SGeboortedatum, PNationaliteit, SNationaliteit, PBSN, SBSN, PostalAdres1, PostalCode, WoonPlaats, PLegitimatie, SLegitimatie, PLegitimatieNummer, SLegitimatieNummer, PLegitimatieExpiry, SLegitimatieExpiry, PTelefoon, STelefoon, PMobiel, SMobiel, PEmail, SEmail",
                "AccountDetail");

            return ds;
        }
예제 #6
0
 /// <summary>
 /// This method retrieves an accountholder instance via it's database identifier.
 /// </summary>
 /// <param name="session">An instance of the Data Access Library <see cref="T:B4F.TotalGiro.DAL.NHSession">NHSession</see> class</param>
 /// <param name="contact">Contact object</param>
 /// <param name="account">AccountTypeInternal object</param>
 /// <returns>A specific instance of a accountholder class</returns>
 public static IAccountHolder GetAccountHolder(IDalSession session, IContact contact, ICustomerAccount account)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     expressions.Add(Expression.Eq("Contact.Key", contact.Key));
     expressions.Add(Expression.Eq("GiroAccount.Key", account.Key));
     IList collAH = session.GetList(typeof(AccountHolder), expressions);
     if (collAH != null && collAH.Count == 1)
         return (IAccountHolder)collAH[0];
     else
         return null;
 }
예제 #7
0
파일: Report.cs 프로젝트: kiquenet/B4F
        protected Report(ICustomerAccount account, IReportLetter reportLetter, ReportStatuses reportStatus, string reportErrorMessage)
        {
            Account = account;
            ModelPortfolio = account.ModelPortfolio;
            SetContactsNAW(account);

            ReportLetter = reportLetter;
            ReportStatusId = (int)reportStatus;
            ErrorMessage = reportErrorMessage;

            CreationDate = DateTime.Now;
        }
예제 #8
0
            public AccountDetails(ICustomerAccount account)
            {
                this.account = account;
                this.AccountNumber = account.Number;
                if( account.ModelPortfolio != null) this.ModelPortfolio = account.ModelPortfolio.ModelName;
                this.Primary = account.PrimaryAccountHolder.Contact;
                this.VermogensBeheer = account.AccountOwner.CompanyName;
                if (account.CounterAccount != null)
                {
                    this.TegenRekening = account.CounterAccount.Number;
                    this.TegenRekeningBank = account.CounterAccount.BankName;
                    this.TegenRekeningTNV = account.CounterAccount.AccountName;
                    if (account.CounterAccount.BankAddress != null)
                        this.TegenRekeningPlaats = account.CounterAccount.BankAddress.City;
                }

                if (Primary.ContactType == ContactTypeEnum.Person)
                {
                    IContactPerson cPrimary = (IContactPerson) Primary;
                    this.PLastName = cPrimary.CurrentNAW.Name;
                    this.PVoorLetters = cPrimary.FirstName;
                    this.PTussenVoegsels = cPrimary.MiddleName;
                    this.PGeslacht = (cPrimary.Gender == B4F.TotalGiro.StaticData.Gender.Female) ? "Vrouw" : "Man";
                    this.PGeboortedatum = cPrimary.DateOfBirth;
                    if (cPrimary.Nationality != null) this.PNationaliteit = cPrimary.Nationality.Description;
                    this.PBSN = cPrimary.GetBSN;
                    this.PostalAdres1 = cPrimary.CurrentNAW.PostalAddress.AddressLine1;
                    this.PostalCode = cPrimary.CurrentNAW.PostalAddress.PostalCode;
                    this.WoonPlaats = cPrimary.CurrentNAW.PostalAddress.City;
                    if (cPrimary.Identification != null) this.PLegitimatie = cPrimary.Identification.IdentificationType.IdType;
                    if (cPrimary.Identification != null) this.PLegitimatieNummer = cPrimary.Identification.Number;
                    if (cPrimary.Identification != null) this.PLegitimatieExpiry = cPrimary.Identification.ValidityPeriod;

                }

                if (account.EnOfAccountHolder != null)
                {
                    IContactPerson Secondary = (IContactPerson)account.EnOfAccountHolder.Contact;
                    this.SLastName = Secondary.CurrentNAW.Name;
                    this.SVoorLetters = Secondary.FirstName;
                    this.STussenVoegsels = Secondary.MiddleName;
                    this.SGeslacht = (Secondary.Gender == B4F.TotalGiro.StaticData.Gender.Female) ? "Vrouw" : "Man";
                    this.SGeboortedatum = Secondary.DateOfBirth;
                    if (Secondary.Nationality != null) this.SNationaliteit = Secondary.Nationality.Description;
                    this.SBSN = Secondary.GetBSN;
                    if(Secondary.Identification != null)  this.SLegitimatie = Secondary.Identification.IdentificationType.IdType;
                    if (Secondary.Identification != null) this.PLegitimatieNummer = Secondary.Identification.Number;
                    if (Secondary.Identification != null) this.SLegitimatieExpiry = Secondary.Identification.ValidityPeriod;

                }
            }
예제 #9
0
        public DividWepRecord(ICustomerAccount account, IEndTermValue endTermValue )
        {
            this.Account = account;
            this.EndTermRecord = endTermValue;
            this.EndTermRecord.DividWepRecord = this;
            IContact primary = account.PrimaryAccountHolder.Contact;
            bool isPerson = (primary.ContactType == ContactTypeEnum.Person);

            this.recordType = "5";
            this.AccountNumber = massageData(account.Number, 10);
            this.Naam = massageData(primary.CurrentNAW.Name, 49);

            this.Voorletters = massageData(isPerson ? ((IContactPerson)primary).FirstName : "", 5);
            this.Voorvoegsels = massageData(isPerson ? ((IContactPerson)primary).MiddleName : "",8);
            this.Straatnaam = massageData(primary.CurrentNAW.ResidentialAddress.Street, 25);
            this.Huisnummer = massageData(primary.CurrentNAW.ResidentialAddress.HouseNumber,5);
            this.Toevoeging = massageData(primary.CurrentNAW.ResidentialAddress.HouseNumberSuffix,5);
            this.Postcode = massageData(primary.CurrentNAW.ResidentialAddress.PostalCode,6);
            this.Plaatsnaam = massageData(primary.CurrentNAW.ResidentialAddress.City,20);

            if ((isPerson) && (primary.GetBirthFounding != null))
            {
                DateTime dob = primary.GetBirthFounding;
                this.Geboortedag = dob.Day.ToString().PadLeft(2, '0');
                this.Geboortemaand = dob.Month.ToString().PadLeft(2, '0');
                string interim = dob.Year.ToString().PadLeft(4, '0');
                this.Geboorteeeuw = interim.Substring(0, 2);
                this.Geboortejaar = interim.Substring(2, 2);
            }
            else
            {
                this.Geboortedag = this.Geboortemaand = this.Geboorteeeuw = this.Geboortejaar = "00";
            }
            this.Rechtsvormcode = isPerson ? "01" : "02";
            this.GezamenlijkBelang = "01";
            this.SoortFonds = "01";
            this.WepValue = Convert.ToInt32(Math.Truncate(endTermValue.ClosingValue.Quantity));
            this.Soortvalutawep = endTermValue.ClosingValue.Underlying.ToCurrency.ToString();
            this.Soortdivrente = "01";
            this.DivrentebedragValue = Convert.ToInt32(endTermValue.InternalDividend.Quantity);
            this.ValutaDivrentebedrag = endTermValue.InternalDividend.Underlying.ToCurrency.ToString();
            this.Typeobligatie = "00";
            this.Typebronbelasting = "01";
            this.BedragbronbelastingValue = Convert.ToInt32(endTermValue.InternalDividendTax.Quantity);
            this.ValutaBedragbronbelasting = endTermValue.InternalDividendTax.Underlying.ToCurrency.ToString();
            this.Valutajaar = endTermValue.EndTermDate.Year.ToString();
            string bsn = primary.GetBSN;
            this.Sofinummer = isPerson ? bsn : "000000000";
            this.KvKnummer = !isPerson ? bsn : "000000000";
        }
예제 #10
0
        // Constructor
        protected ContactsFormatter(ICustomerAccount account)
        {
            this.account = account;

            try
            {
                IContact firstContact = Account.AccountHolders.PrimaryAccountHolder.Contact;
                IContactPerson secondContact = RetrieveSecondContact(firstContact);

                this.contactsNAW = firstContact.CurrentNAW;
                if (secondContact != null)
                    this.secondContactsNAW = secondContact.CurrentNAW;
            }
            catch (NullReferenceException)
            {
                throw new ApplicationException(
                    string.Format("Could not retrieve account holder information for account {0} - {1}.",
                                  account.Key, account.DisplayNumberWithName));
            }
        }
예제 #11
0
        public FinancialDataView(ICustomerAccount account, bool allowMissingExpectedReturn, bool initializeAccountData)
        {
            if (account == null)
                throw new ArgumentNullException("account.");

            this.account = account;
            this.model = Account.ModelPortfolio;

            AllowMissingExpectedReturn = allowMissingExpectedReturn;

            if (initializeAccountData)
            {
                RetrieveFinancialTargetData();
                RetrievePositionData();

                if (account.ModelPortfolio == null)
                    throw new ArgumentException("Account does not have a Model Portfolio.");

                RetrieveModelData();
            }
        }
예제 #12
0
        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;
        }
예제 #13
0
 public ContactsFormatterDelegate(ICustomerAccount account)
     : base(account)
 {
 }
예제 #14
0
파일: ReportEOY.cs 프로젝트: kiquenet/B4F
 public ReportEOY(ICustomerAccount account, IReportLetter reportLetter, ReportStatuses reportStatus, string reportErrorMessage)
     : base(account, reportLetter, reportStatus, reportErrorMessage)
 {
 }
예제 #15
0
 public ContactsFormatterDelegate(ICustomerAccount account, IContactsNAW contactsNAW, IContactsNAW secondContactsNAW)
     : base(account, contactsNAW, secondContactsNAW)
 {
 }
예제 #16
0
 protected override bool IsAccountOwned(ICustomerAccount account)
 {
     return CurrentCustomerContact.ActiveAccounts.Any(a => a.Key == account.Key);
 }
예제 #17
0
        // Makes a dataset with multiple datatables for all reports
        private static DataSet getQuarterReportDataSet(IDalSession session, bool portfolioDevelopment, bool portfolioOverview, bool transactionOverview,
            bool moneyMutations, ICustomerAccount account, DateTime beginDate, DateTime endDate)
        {
            int months = Util.DateDiff(DateInterval.Month, beginDate, endDate) + 1;
            DateTime[] monthDates = new DateTime[months];
            IInstrumentsCategories defaultInstrumentCategory = null;

            //Makes a datearray for 1 year for header graph
            for (int i = 0; i < months; i++)
            {
                monthDates[i] = Util.GetLastDayOfMonth(beginDate.AddMonths(i));
            }

            IList<IValuation> valuationsEndDate = ValuationMapper.GetValuations(session, account.Key, new DateTime[] { endDate });

            DataSet ds = new DataSet();
            ds.Tables.Add(getHeaderTable(account));

            // Model at the end of the period
            IModelHistory histModel = AccountMapper.GetHistoricalModel(session, account, endDate);
            DataTable dtModel = new IModelHistory[] { histModel }
                .Select(c => new
                {
                    ModelPortfolio_ModelName =
                        c.ModelPortfolio.ModelName
                })
                .ToDataTable("Model");
            ds.Tables.Add(dtModel);

            // Used for Plot Graph -> Portfolio Development
            DataTable dtTotalPortfolioValues = ValuationMapper.GetValuationsTotalPortfolio(session, account.Key, monthDates)
                .Select(c => new
                {
                    c.Date,
                    TotalValue_Quantity =
                        c.TotalValue.Quantity
                })
                .ToDataTable("TotalPortfolioValues");
            ds.Tables.Add(dtTotalPortfolioValues);

            // Used for Pie Chart -> Portfolio Asset Breakup
            PortfolioBreakUp breakUp = new PortfolioBreakUp(valuationsEndDate, endDate);
            PortfolioBreakUpDetail[] breakUpDetails = new PortfolioBreakUpDetail[breakUp.BreakUpDetails.Count];
            breakUp.BreakUpDetails.CopyTo(breakUpDetails, 0);
            DataTable dtPortfolioAssetClassBreakUp = breakUpDetails
                .Select(c => new
                {
                    AssetClass_AssetName =
                        c.AssetClass.AssetName,
                    BreakUpValue_Quantity =
                        c.BreakUpValue.Quantity,
                    c.BreakUpPercentage
                })
                .ToDataTable("PortfolioAssetClassBreakUp");
            ds.Tables.Add(dtPortfolioAssetClassBreakUp);

            if (portfolioDevelopment)
            {
                PortfolioDevelopment portfolioDev = ValuationMapper.GetPortfolioDevelopment(session, account, beginDate, endDate, histModel.ModelPortfolioKey);
                DataTable dtPortfolioDev = new PortfolioDevelopment[] { portfolioDev }
                    .Select(c => new
                    {
                        TotalValueBegin_Quantity =
                            c.TotalValueBegin.Quantity,
                        TotalValueEnd_Quantity =
                            c.TotalValueEnd.Quantity,
                        TotalValueDifference_Quantity =
                            c.TotalValueDifference.Quantity,
                        c.InvestmentReturnPercentage,
                        RealisedAmount_Quantity =
                            c.RealisedAmount.Quantity,
                        UnRealisedAmount_Quantity =
                            c.UnRealisedAmount.Quantity,
                        UnRealisedAmountPreviousPeriod_Quantity =
                            c.UnRealisedAmountPreviousPeriod.Quantity,
                        Withdrawals_Quantity =
                            c.Withdrawals.Quantity,
                        Deposits_Quantity =
                            c.Deposits.Quantity,
                        c.BenchMarkPerformance,
                        c.BenchMarkValue,
                        c.IBoxxTarget,
                        c.MSCIWorldTarget,
                        c.CompositeTarget
                    })
                    .ToDataTable("PortfolioDevelopment");
                ds.Tables.Add(dtPortfolioDev);

                PortfolioDevelopmentCash[] portCash = new PortfolioDevelopmentCash[portfolioDev.CashMovements.Count];
                portfolioDev.CashMovements.CopyTo(portCash, 0);
                DataTable dtPortfolioCashDev = portCash
                    .Select(c => new
                    {
                        c.ValuationCashTypeDescription,
                        Amount_Quantity =
                            c.Amount.Quantity,
                        c.IsIncome
                    })
                    .ToDataTable("PortfolioCashDevelopment");
                ds.Tables.Add(dtPortfolioCashDev);
            }

            if (portfolioOverview)
            {
                // get the default InstrumentCategory
                getDefaultInstrumentCategory(session, ref defaultInstrumentCategory);
                ValuationMutation.defaultInstrumentCategory = defaultInstrumentCategory;

                DataTable dtPortfolioOverview = ValuationMapper.GetValuationsPortfolioOverview(valuationsEndDate)
                    .Select(c => new
                    {
                        Instrument_IsCash =
                            c.Instrument.IsCash,
                        ValuationMutation_Position_AssetClass_Key =
                            c.AssetClass.Key,
                        ValuationMutation_Position_AssetClass_AssetName =
                            c.AssetClass.AssetName,
                        c.DisplayInstrumentsCategory,
                        Instrument_Name =
                            c.Instrument.Name,
                        CurrencyNominal_Symbol =
                            c.CurrencyNominal.Symbol,
                        CurrencyNominal_BaseCurrency_Symbol =
                            c.CurrencyNominal.BaseCurrency.Symbol,
                        Size_Quantity =
                            c.Size.Quantity,
                        CostPrice_DisplayQuantity =
                            c.CostPrice.DisplayQuantity,
                        BookValue_Quantity =
                            c.BookValue.Quantity,
                        MarketPrice_DisplayQuantity =
                            c.MarketPrice.DisplayQuantity,
                        BaseMarketValue_Quantity =
                            c.BaseMarketValue.Quantity,
                        UnRealisedAmountToDate_Quantity =
                            c.UnRealisedAmountToDate.Quantity
                    })
                    .ToDataTable("PortfolioOverview");
                ds.Tables.Add(dtPortfolioOverview);
                ValuationMutation.defaultInstrumentCategory = null;

                // get historical exrates
                ArrayList currencyList = new ArrayList();
                foreach (IValuation valuation in valuationsEndDate)
                {
                    if (!currencyList.Contains(valuation.CostPrice.Underlying))
                        currencyList.Add(valuation.CostPrice.Underlying);
                }
                ICurrency[] currencies = new ICurrency[currencyList.Count];
                currencyList.CopyTo(currencies, 0);
                DataTable dtHistoricalExchangeRates = HistoricalExRateMapper.GetHistoricalExRates(session, currencies, endDate)
                    .Select(c => new
                    {
                        Currency_Symbol =
                            c.Currency.Symbol,
                        c.Rate
                    })
                    .ToDataTable("HistoricalExchangeRates");
                ds.Tables.Add(dtHistoricalExchangeRates);
            }

            if (transactionOverview)
            {
                DataTable dtTransactionOverview = ValuationMapper.GetSecurityValuationMutations(session, account.Key, beginDate, endDate)
                    .Select(c => new
                    {
                        Position_AssetClass_Key =
                            c.Position.AssetClass.Key,
                        Position_AssetClass_AssetName =
                            c.Position.AssetClass.AssetName,
                        Instrument_Name =
                            c.Instrument.Name,
                        SizeChange_Quantity =
                            c.SizeChange.Quantity,
                        c.Date,
                        BookChange_Quantity =
                            c.BookChange.Quantity,
                        TotalBaseTradeAmount_Quantity =
                            c.TotalBaseTradeAmount.Quantity,
                        BaseRealisedAmount_Quantity =
                            c.BaseRealisedAmount.Quantity,
                        BaseCommission_Quantity =
                            c.BaseCommission.Quantity
                    })
                    .ToDataTable("TransactionOverview");
                ds.Tables.Add(dtTransactionOverview);
            }

            if (moneyMutations)
            {
                // cache the TransactionType descriptions
                ValuationMutation.defaultInstrumentCategory = defaultInstrumentCategory;

                //    AccountMapper.GetCashPositionTransactions(session, account, beginDate, endDate, false),
                //    "TransactionTypeID, ParentTransaction.TransactionTypeDescription, Description, TransactionDate, Amount.Quantity, Amount.Underlying.ToCurrency.AltSymbol, SideValue, " +
                //    "SizeQuantity, TradedInstrument.Name, PriceQuantity, PriceCurrency.AltSymbol, CommissionQuantity, CommissionCurrency.AltSymbol, ServiceChargeQuantity, ServiceChargeCurrency.AltSymbol, " +
                //    "ForeignCashMoneyOrderValueQuantity, ForeignCashMoneyOrderBaseValueQuantity, ForeignCashMoneyOrderCurrency.AltSymbol, ForeignCashMoneyOrderExRate, CashGeneratingInstrument.Name, TaxQuantity, FullDescription",
                List<ICashMutationView> lines = AccountMapper.GetCashPositionTransactions(session, account, beginDate, endDate, false);
                DataTable dtMoneyMutations = lines.Select(c => new
                {
                    Key =
                        c.Key,
                    c.Account.Number,
                    CashMutationViewTypeID =
                        (int)c.CashMutationViewType,
                    c.TypeID,
                    c.TypeDescription,
                    Description =
                        c.FullDescription,
                    c.TransactionDate,
                    BaseAmount =
                        c.Amount.BaseAmount.Quantity
                })
                .ToDataTable("MoneyMutations");
                ds.Tables.Add(dtMoneyMutations);

                // Get Cash Position startdate -1 (day before) & end date
                ICurrency baseCur = account.AccountOwner.StichtingDetails.BaseCurrency;
                IList moneyPositionStartAndEndDate = ValuationMapper.GetValuations(session, account.Key, baseCur.Key, new DateTime[] { beginDate.AddDays(-1), endDate }, true);

                DataTable dtMoneyPositionStartAndEndDate = new DataTable("MoneyPositionStartAndEndDate");
                dtMoneyPositionStartAndEndDate.Columns.Add("Date", typeof(DateTime));
                dtMoneyPositionStartAndEndDate.Columns.Add("Size_Quantity", typeof(decimal));
                decimal valStartDate = 0M;
                decimal valEndDate = 0M;
                foreach (IValuation val in moneyPositionStartAndEndDate)
                {
                    if (val.Date.Equals(beginDate.AddDays(-1)))
                        valStartDate = val.Size.Quantity;
                    else if (val.Date.Equals(endDate))
                        valEndDate = val.Size.Quantity;
                }
                Util.AddNewRowToDataTableWhenRecordNotExists(dtMoneyPositionStartAndEndDate, beginDate.AddDays(-1), valStartDate);
                Util.AddNewRowToDataTableWhenRecordNotExists(dtMoneyPositionStartAndEndDate, endDate, valEndDate);
                ds.Tables.Add(dtMoneyPositionStartAndEndDate);
            }

            return ds;
        }
예제 #18
0
        // Makes a dataset for Fiscal Year Overview
        private static DataSet getFiscalYearReportDataSet(IDalSession session, ICustomerAccount account, DateTime beginDate, DateTime endDate)
        {
            DateTime[] monthDates = EndTermValueMapper.GetEndDates(EndTermType.FullYear, endDate.Year);

            DataSet ds = new DataSet();
            ds.Tables.Add(getHeaderTable(account));

            // Begin and End Values
            DataRow drMinTotalPortfolioValues;
            IList portfolioEndValues = EndTermValueMapper.GetEndValues(session, account, EndTermType.FullYear, endDate.Year, true);

            DataTable dtTotalPortfolioValues = new DataTable("TotalPortfolioValues");
            dtTotalPortfolioValues.Columns.Add("Date", typeof(DateTime));
            dtTotalPortfolioValues.Columns.Add("TotalValue_Quantity", typeof(Decimal));
            dtTotalPortfolioValues.Columns.Add("GreenValue_Quantity", typeof(Decimal));
            dtTotalPortfolioValues.Columns.Add("CultureValue_Quantity", typeof(Decimal));

            drMinTotalPortfolioValues = dtTotalPortfolioValues.NewRow();
            drMinTotalPortfolioValues["Date"] = monthDates[0];
            drMinTotalPortfolioValues["TotalValue_Quantity"] = ((IEndTermValue)portfolioEndValues[0]).ClosingValue.Quantity;
            drMinTotalPortfolioValues["GreenValue_Quantity"] = ((IEndTermValue)portfolioEndValues[0]).GreenFundValue.Quantity;
            drMinTotalPortfolioValues["CultureValue_Quantity"] = ((IEndTermValue)portfolioEndValues[0]).CultureFundValue.Quantity;
            dtTotalPortfolioValues.Rows.Add(drMinTotalPortfolioValues);

            //Check if the minimum value is present. If not add a zero value
            drMinTotalPortfolioValues = dtTotalPortfolioValues.NewRow();
            drMinTotalPortfolioValues["Date"] = monthDates[1];
            drMinTotalPortfolioValues["TotalValue_Quantity"] = ((IEndTermValue)portfolioEndValues[1]).ClosingValue.Quantity;
            drMinTotalPortfolioValues["GreenValue_Quantity"] = ((IEndTermValue)portfolioEndValues[1]).GreenFundValue.Quantity;
            drMinTotalPortfolioValues["CultureValue_Quantity"] = ((IEndTermValue)portfolioEndValues[1]).CultureFundValue.Quantity;
            dtTotalPortfolioValues.Rows.Add(drMinTotalPortfolioValues);

            ds.Tables.Add(dtTotalPortfolioValues);

            // CashDividend Transacties
            //            DataTable dtCashDivTransactions = DataSetBuilder.CreateDataTableFromBusinessObjectList(
            //                ObsoleteTransactionMapper.GetTransactions(session, ObsoleteTransactionReturnClass.CashDividend, account, beginDate, endDate, false),
            //                @"TransactionDate, CashGeneratingInstrument.Name, CashGeneratingInstrument.Country.Iso2,
            //                    Units.Quantity, DividendDetails.UnitPrice.Quantity, ValueSize.UnderlyingShortName, ValueSize.Quantity, TaxQuantity, ExchangeRate, TotalBaseAmountQuantity, ValueSizeQuantity",
            //            "CashDivTransactions");

            DataTable dtCashDivTransactions = GeneralOperationsBookingMapper.GetBookings(
                session, GeneralOperationsBookingReturnClass.CashDividend, account.Key, beginDate, endDate, false)
                .Cast<ICashDividend>()
                .Select(c => new
                {
                    TransactionDate =
                        c.GeneralOpsJournalEntry.TransactionDate,
                    CashGeneratingInstrument_Name =
                        c.DividendDetails.Instrument.Name,
                    CashGeneratingInstrument_Country_Iso2 =
                        c.DividendDetails.Instrument.Country.Iso2,
                    Units_Quantity =
                        c.UnitsInPossession.Quantity,
                    DividendDetails_UnitPrice_Quantity =
                        c.DividendDetails.UnitPrice.Quantity,
                    ValueSize_UnderlyingShortName =
                        c.NettAmount.UnderlyingShortName,
                    ValueSize_Quantity =
                        c.NettAmount.Quantity,
                    TaxQuantity =
                        c.TaxAmount.Quantity,
                    ExchangeRate =
                        c.GeneralOpsJournalEntry.ExchangeRate,
                    TotalBaseAmountQuantity =
                        c.Components.TotalBaseAmount.Quantity,
                    ValueSizeQuantity =
                        c.NettAmount.Quantity
                })
                .ToDataTable("CashDivTransactions");

            ds.Tables.Add(dtCashDivTransactions);

            return ds;
        }
        public async Task <IActionResult> SaveCustomerAccount([FromBody] CustomerAccountModel model)
        {
            ICustomerAccount customerAccount = await customerAccountService.Create(model);

            return(Created(Url.Action(nameof(GetCustomerAccount), ControllerContext.ActionDescriptor.ControllerName, new { id = customerAccount.Id }), customerAccount));
        }
예제 #20
0
 private static ContactTypeEnum getContactType(ICustomerAccount account)
 {
     try
     {
         return account.AccountHolders.PrimaryAccountHolder.Contact.ContactType;
     }
     catch (NullReferenceException)
     {
         throw new ApplicationException(
             string.Format("Could not retrieve primary contact for account {0} - {1}.", account.Key, account.DisplayNumberWithName));
     }
 }
예제 #21
0
 /// <summary>
 /// Static method used by Notas when printed. It uses the (one or two) ContactsNAWs stored on the Nota at creation time.
 /// </summary>
 public static ContactsFormatter CreateContactsFormatter(ICustomerAccount account, IContactsNAW contactsNAW, IContactsNAW secondContactsNAW)
 {
     switch (getContactType(contactsNAW))
     {
         case ContactTypeEnum.Company:
             return new ContactsFormatterCompany(account, contactsNAW, secondContactsNAW);
         case ContactTypeEnum.Delegate:
             return new ContactsFormatterDelegate(account, contactsNAW, secondContactsNAW);
         default:
             return new ContactsFormatterPerson(account, contactsNAW, secondContactsNAW);
     }
 }
예제 #22
0
 public ContactsFormatterPerson(ICustomerAccount account)
     : base(account)
 {
 }
예제 #23
0
 protected override bool IsAccountOwned(ICustomerAccount account)
 {
     return account.RemisierEmployee != null &&
            account.RemisierEmployee.Remisier != null &&
            account.RemisierEmployee.Remisier.Key == CurrentRemisier.Key;
 }
예제 #24
0
파일: Report.cs 프로젝트: kiquenet/B4F
 public static IReport CreateReport(ICustomerAccount account, IReportLetter reportLetter,
                                    ReportStatuses reportStatus, string reportErrorMessage)
 {
     if (reportLetter.ReportLetterTypeId == (int)ReportLetterTypes.EOY)
         return new ReportEOY(account, reportLetter, reportStatus, reportErrorMessage);
     else
         return new ReportQuarter(account, reportLetter, reportStatus, reportErrorMessage);
 }
예제 #25
0
 public FinancialDataView(ICustomerAccount account, bool allowMissingExpectedReturn)
     : this(account, allowMissingExpectedReturn, true)
 {
 }
예제 #26
0
파일: FeeFactory.cs 프로젝트: kiquenet/B4F
        ///// <summary>
        ///// The method used to calculate the fees
        ///// </summary>
        ///// <param name="managementPeriod">The management Period for which the fee is calculated.</param>
        ///// <param name="startDatePeriod">Starting Date of the Period.</param>
        ///// <param name="endDatePeriod">End Date of the Period.</param>
        ///// <param name="units">The units involved for this management fee.</param>
        ///// <returns>The MgtFee value.</returns>
        //public MgtFee CalculateMgtFee(IManagementPeriod managementPeriod, DateTime startDatePeriod, DateTime endDatePeriod, IList<IManagementPeriodUnit> units, out decimal taxPercentage)
        //{
        //    //int startPeriod;
        //    //int endPeriod;
        //    taxPercentage = 0M;
        //    MgtFee result = new MgtFee(startDatePeriod, endDatePeriod);
        //    if (startDatePeriod.Year != endDatePeriod.Year)
        //        throw new ApplicationException("The year of the start date and end date for the management fee should equal");
        //    if (units != null && units.Count > 0)
        //    {
        //        // check the number of units
        //        int expectedUnitCount = Util.DateDiff(DateInterval.Month, startDatePeriod, endDatePeriod) + 1;
        //        if (expectedUnitCount != units.Count)
        //            throw new ApplicationException(string.Format("The number of units {0} does not equal the number of expected units {1}.", units.Count, expectedUnitCount));
        //        // check if all have the same management period
        //        var mps = from a in units
        //                 group a by a.ManagementPeriod into g
        //                 select g.Key;
        //        if (mps.Count() != 1)
        //            throw new ApplicationException("Not all units belong to the same management period.");
        //        if (mps.First().Key != managementPeriod.Key)
        //            throw new ApplicationException("The management period is not ok.");
        //        if (Util.GetPeriodFromDate(managementPeriod.StartDate) == Util.GetPeriodFromDate(startDatePeriod) && managementPeriod.StartDate.Day != startDatePeriod.Day)
        //            throw new ApplicationException(string.Format("The start date of the management period ({0}) does not equal the presented start date ({1}).", managementPeriod.StartDate.ToString("yyyy-MM-dd"), startDatePeriod.ToString("yyyy-MM-dd")));
        //        if (managementPeriod.EndDate.HasValue)
        //        {
        //            if (endDatePeriod > managementPeriod.EndDate)
        //                throw new ApplicationException(string.Format("The end date of the management period ({0}) does not equal the presented end date ({1}).", managementPeriod.EndDate.Value.ToString("yyyy-MM-dd"), endDatePeriod.ToString("yyyy-MM-dd")));
        //            else if (Util.GetPeriodFromDate(managementPeriod.EndDate.Value) == Util.GetPeriodFromDate(endDatePeriod) && managementPeriod.EndDate.Value.Day != endDatePeriod.Day)
        //                throw new ApplicationException(string.Format("The end date of the management period ({0}) does not equal the presented end date ({1}).", managementPeriod.EndDate.Value.ToString("yyyy-MM-dd"), endDatePeriod.ToString("yyyy-MM-dd")));
        //        }
        //        foreach (IManagementPeriodUnit unit in units)
        //        {
        //            if (unit.Transaction != null)
        //                throw new ApplicationException(string.Format("The unit {0} is already used for a management fee transaction.", unit.Key.ToString()));
        //            if (!(unit.Success && unit.FeesCalculated == FeesCalculatedStates.Yes))
        //                throw new ApplicationException(string.Format("The unit {0} is not correct for the management fee transaction.", unit.Key.ToString()));
        //            result.AddFee(unit.AverageHoldingFeeItems);
        //            result.AddFee(unit.FeeItems);
        //        }
        //        // set tax
        //        taxPercentage = getHistoricalTaxRate(endDatePeriod).StandardRate;
        //        foreach (MgtFeeBreakupLine line in result.BreakupLines)
        //        {
        //            if (line.MgtFeeType.UseTax)
        //                line.SetBTW(taxPercentage);
        //        }
        //        return result;
        //    }
        //    return null;
        //}
        private bool getPeriodsInQuarter(ICustomerAccount account, DateTime startDatePeriod, DateTime endDatePeriod, out int startPeriod, out int endPeriod)
        {
            startPeriod = 0;
            endPeriod = 0;
            bool retVal = false;

            if (account.ManagementStartDate < endDatePeriod && (Util.IsNullDate(account.ManagementEndDate) || !(account.ManagementEndDate < startDatePeriod)))
            {
                if (account.ManagementStartDate <= startDatePeriod)
                    startPeriod = Util.GetPeriodFromDate(startDatePeriod);
                else
                    startPeriod = Util.GetPeriodFromDate(account.ManagementStartDate);

                if (Util.IsNullDate(account.ManagementEndDate) || account.ManagementEndDate >= endDatePeriod)
                    endPeriod = Util.GetPeriodFromDate(endDatePeriod);
                else
                    endPeriod = Util.GetPeriodFromDate(account.ManagementEndDate);

                retVal = true;
            }
            else
                throw new ApplicationException(string.Format("The selected period falls out of the management scope of account {0}", account.DisplayNumberWithName));

            return retVal;
        }
예제 #27
0
 protected override bool IsAccountOwned(ICustomerAccount account)
 {
     return CurrentManagementCompany.IsStichting;
 }
예제 #28
0
        private static DataTable getHeaderTable(ICustomerAccount account)
        {
            account.Formatter.AssertAddressIsComplete();

            return new ICustomerAccount[] { account }
                .Select(a => new
                {
                    a.Number,
                    a.ModelPortfolioName,
                    BaseCurrency_Symbol =
                        a.BaseCurrency.Symbol,
                    BaseCurrency_AltSymbol =
                        a.BaseCurrency.AltSymbol,
                    ContactAddress_DearSirForm =
                        a.Formatter.DearSirForm,
                    ContactAddress_AddressFirstLine =
                        a.Formatter.AddressFirstLine,
                    ContactAddress_AddressSecondLine =
                        a.Formatter.AddressSecondLine,
                    ContactAddress_ContactStreet =
                        a.Formatter.Address.StreetAddressLine,
                    ContactAddress_ContactCity =
                        a.Formatter.Address.CityAddressLine
                })
                .ToDataTable("Header");
        }
예제 #29
0
 protected override bool IsAccountOwned(ICustomerAccount account)
 {
     return account.AccountOwner.Key == CurrentAssetManager.Key;
 }
예제 #30
0
 public string GetAccountNumberForNewAccount(ICustomerAccount account)
 {
     return(nextNumber);
 }
예제 #31
0
파일: Report.cs 프로젝트: kiquenet/B4F
 public void SetContactsNAW(ICustomerAccount account)
 {
     ContactsFormatter formatter = ContactsFormatter.CreateContactsFormatter(account);
     ContactsNAW = formatter.ContactsNAW;
     SecondContactsNAW = formatter.SecondContactsNAW;
 }
예제 #32
0
 public ContactsFormatterCompany(ICustomerAccount account)
     : base(account)
 {
 }
예제 #33
0
 public ContactsFormatterCompany(ICustomerAccount account, IContactsNAW contactsNAW, IContactsNAW secondContactsNAW)
     : base(account, contactsNAW, secondContactsNAW)
 {
 }
예제 #34
0
 // Constructor
 protected ContactsFormatter(ICustomerAccount account, IContactsNAW contactsNAW, IContactsNAW secondContactsNAW)
 {
     this.account = account;
     this.contactsNAW = contactsNAW;
     this.secondContactsNAW = secondContactsNAW;
 }
        public async Task <IActionResult> GetCustomerAccount(int id)
        {
            ICustomerAccount customerAccountInfo = await customerAccountService.Get(id);

            return(Ok(customerAccountInfo));
        }