예제 #1
0
 public static List<IFundPosition> GetPositions(IDalSession session, int accountId, PositionsView view)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     expressions.Add(Expression.Eq("Account.Key", accountId));
     addPositionsViewCriterion(expressions, view);
     return session.GetTypedList<FundPosition, IFundPosition>(expressions);
 }
예제 #2
0
 public static IGLLookupRecords GetGLLookupRecords(IDalSession session, BookingComponentParentTypes bookingComponentParentType)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     expressions.Add(Expression.Eq("BookingComponentParentType", bookingComponentParentType));
     IList<IGLLookupRecord> gLLookupRecords = session.GetTypedList<IGLLookupRecord>();
     return new GLLookupRecords(gLLookupRecords);
 }
예제 #3
0
 public static IList<IGLAccount> GetClientBalanceGLAccounts(IDalSession session)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     expressions.Add(Expression.Eq("IsClientOpenBalance", true));
     IList<IGLAccount> list = session.GetTypedList<GLAccount, IGLAccount>(expressions);
     return list;
 }
예제 #4
0
 public static List<ICashPosition> GetPositions(IDalSession session, IAccountTypeInternal account, PositionsView view)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     expressions.Add(Expression.Eq("Account.Key", account.Key));
     addPositionsViewCriterion(expressions, view);
     return session.GetTypedList<CashPosition, ICashPosition>(expressions);
 }
예제 #5
0
 public static IList<IAccountFamily> GetAccountFamilies(IDalSession session, IAssetManager assetManager)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     if (!assetManager.IsStichting)
         expressions.Add(Expression.Eq("AssetManager.Key", assetManager.Key));
     return session.GetTypedList<AccountFamily,IAccountFamily>(expressions);
 }
예제 #6
0
 public static List<IFundPosition> GetPositions(IDalSession session, IInstrument instrument, PositionsView view)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     expressions.Add(Expression.Eq("Size.Underlying.Key", instrument.Key));
     addPositionsViewCriterion(expressions, view);
     LoginMapper.GetSecurityInfo(session, expressions, SecurityInfoOptions.NoFilter);
     return session.GetTypedList<FundPosition, IFundPosition>(expressions);
 }
예제 #7
0
 public static IList<IJournal> GetJournals(IDalSession session, JournalTypes journalType)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     List<Order> orderings = new List<Order>();
     expressions.Add(Expression.Eq("JournalType", journalType));
     orderings.Add(Order.Asc("JournalNumber"));
     return session.GetTypedList<Journal, IJournal>(expressions, orderings);
 }
예제 #8
0
 /// <summary>
 /// Retrieves a list of all <b>CommRule</b> objects in the system.
 /// </summary>
 /// <param name="session">An instance of the Data Access Library (see class <see cref="B4F.TotalGiro.DAL.NHSession">NHSession</see>).</param>
 /// <param name="company">The company that owns these rules.</param>
 /// <returns>A list of all <b>CommRule</b> objects in the system.</returns>
 public static IList<ICommRule> GetCommissionRules(IDalSession session)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     IManagementCompany company = LoginMapper.GetCurrentManagmentCompany(session);
     if (!company.IsStichting)
         expressions.Add(Expression.Eq("AssetManager.Key", company.Key));
     return session.GetTypedList<CommRule, ICommRule>(expressions);
 }
예제 #9
0
파일: LoginMapper.cs 프로젝트: kiquenet/B4F
        public static List<IInternalEmployeeLogin> GetEmployees(IDalSession session, ActivityReturnFilter activityFilter)
        {
            List<ICriterion> expressions = new List<ICriterion>();

            if (activityFilter != ActivityReturnFilter.All)
                expressions.Add(Expression.Eq("IsActive", activityFilter == ActivityReturnFilter.Active));

            return session.GetTypedList<InternalEmployeeLogin, IInternalEmployeeLogin>(expressions);
        }
예제 #10
0
 public static ICashPosition GetPosition(IDalSession session, int accountId, int currencyId)
 {
     return session.GetTypedList<CashPosition, ICashPosition>(new List<ICriterion>()
                                                              {
                                                                  Expression.Eq("Account.Key", accountId),
                                                                  Expression.Eq("PositionCurrency.Key", currencyId)
                                                              })
                   .FirstOrDefault();
 }
예제 #11
0
파일: ModelMapper.cs 프로젝트: kiquenet/B4F
 /// <summary>
 /// Get model by ID
 /// </summary>
 /// <param name="session">Data access object</param>
 /// <param name="id">Identifier</param>
 /// <returns>Model object</returns>
 public static IPortfolioModel GetModel(IDalSession session, int id)
 {
     IPortfolioModel model = null;
     List<ICriterion> expressions = new List<ICriterion>();
     expressions.Add(Expression.Eq("Key", id));
     List<IPortfolioModel> list = session.GetTypedList<PortfolioModel, IPortfolioModel>(expressions);
     if (list != null && list.Count > 0)
         model = list[0];
     return model;
 }
예제 #12
0
 public static WithdrawalRuleRegularity GetWithdrawalRuleRegularity(IDalSession session, Regularities id)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     expressions.Add(Expression.Eq("key", (int)id));
     IList<WithdrawalRuleRegularity> rules = session.GetTypedList<WithdrawalRuleRegularity>(expressions);
     if (rules != null && rules.Count == 1)
         return rules[0];
     else
         return null;
 }
예제 #13
0
 public static IDocument GetDocument(IDalSession session, int documentId)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     expressions.Add(Expression.Eq("Key", documentId));
     List<IDocument> documents = session.GetTypedList<Document, IDocument>(expressions);
     if (documents != null && documents.Count > 0)
         return documents[0];
     else
         return null;
 }
예제 #14
0
파일: ModelMapper.cs 프로젝트: kiquenet/B4F
 public static IModelBase GetModelBase(IDalSession session, int id)
 {
     IModelBase model = null;
     List<ICriterion> expressions = new List<ICriterion>();
     expressions.Add(Expression.Eq("Key", id));
     List<IModelBase> list = session.GetTypedList<ModelBase, IModelBase>(expressions);
     if (list != null && list.Count > 0)
         model = list[0];
     return model;
 }
예제 #15
0
 public static ICounterAccount GetCounterAccount(IDalSession session, string tegenRekening)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     expressions.Add(Expression.Eq("Number", tegenRekening));
     IList<ICounterAccount> list = session.GetTypedList<ICounterAccount>(expressions);
     if (list != null && list.Count == 1)
         return list[0];
     else
         return null;
 }
예제 #16
0
 /// <summary>
 /// This method retrieves an CounterAccount 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="id">The unique identifier</param>
 /// <returns>A specific instance of a accountholder class</returns>
 public static ICounterAccount GetCounterAccount(IDalSession session, int id)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     expressions.Add(Expression.Eq("Key", id));
     IList<ICounterAccount> list = session.GetTypedList<ICounterAccount>(expressions);
     if (list != null && list.Count == 1)
         return list[0];
     else
         return null;
 }
예제 #17
0
 /// <summary>
 /// Get lifecycle by ID
 /// </summary>
 /// <param name="session">Data access object</param>
 /// <param name="id">Identifier</param>
 /// <returns>Lifecycle object</returns>
 public static ILifecycle GetLifecycle(IDalSession session, int id)
 {
     ILifecycle lifecycle = null;
     List<ICriterion> expressions = new List<ICriterion>();
     expressions.Add(Expression.Eq("Key", id));
     List<ILifecycle> list = session.GetTypedList<Lifecycle, ILifecycle>(expressions);
     if (list != null && list.Count > 0)
         lifecycle = list[0];
     return lifecycle;
 }
예제 #18
0
 public static IPositionTransfer getTransfer(IDalSession session, int transferID)
 {
     IPositionTransfer transfer = null;
     List<ICriterion> expressions = new List<ICriterion>();
     expressions.Add(Expression.Eq("Key", transferID));
     IList<IPositionTransfer> list = session.GetTypedList<PositionTransfer, IPositionTransfer>(expressions);
     if (list != null && list.Count == 1)
         transfer = list[0];
     return transfer;
 }
예제 #19
0
        public static IList<MoneyTransferOrder> GetMoneyTransferOrders(IDalSession session, int[] orderIDs, bool unSentOnly)
        {
            List<ICriterion> expressions = new List<ICriterion>();
            expressions.Add(Expression.In("Key", orderIDs));
            IList<MoneyTransferOrder> orders = session.GetTypedList<MoneyTransferOrder>(expressions);

            if (unSentOnly)
                return orders.Where(o => o.IsSendable).ToList();
            else
                return orders;
        }
예제 #20
0
        public static IGLAccount GetGLAccount(IDalSession session, int glAccountId)
        {
            IGLAccount glAccount = null;

            List<ICriterion> expressions = new List<ICriterion>();
            expressions.Add(Expression.Eq("Key", glAccountId));
            IList<IGLAccount> list = session.GetTypedList<GLAccount, IGLAccount>(expressions);
            if (list != null && list.Count == 1)
                glAccount = list[0];

            return glAccount;
        }
예제 #21
0
        /// <summary>
        /// Retrieves a list of the <b>CommCalc</b> objects in the system with name calcname.
        /// </summary>
        /// <param name="session">An instance of the Data Access Library (see class <see cref="B4F.TotalGiro.DAL.NHSession">NHSession</see>).</param>
        /// <returns>A list of all <b>CommCalc</b> objects in the system.</returns>
        public static IList<CommCalc> GetCommissionCalculations(IDalSession session, string calcname)
        {
            List<ICriterion> expressions = new List<ICriterion>();
            if (calcname != null && calcname.Length > 0)
                expressions.Add(Expression.Like("Name", calcname, MatchMode.Anywhere));

            IManagementCompany company = LoginMapper.GetCurrentManagmentCompany(session);
            if (!company.IsStichting)
                expressions.Add(Expression.Eq("AssetManager.Key", company.Key));

            return session.GetTypedList<CommCalc>(expressions);
        }
예제 #22
0
        public static IList<IModelPerformance> GetModelBenchmarkPerformances(IDalSession session, int modelID, int quarter, int yyyy)
        {
            List<ICriterion> expressions = new List<ICriterion>();
            List<Order> orderings = new List<Order>();
            expressions.Add(Expression.Eq("ModelPortfolio.Key", modelID));

            if (quarter > 0)
                expressions.Add(Expression.Eq("Quarter", quarter));
            if (yyyy > 0)
                expressions.Add(Expression.Eq("PerformanceYear", yyyy));

            return session.GetTypedList<ModelPerformance, IModelPerformance>(expressions);
        }
예제 #23
0
        public static IReportLetter GetLatestReportLetter(IDalSession session, int managementCompanyId,
                                                          ReportLetterTypes reportLetterType, int reportLetterYear)
        {
            List<ICriterion> expressions = new List<ICriterion>();
            List<Order> orderings = new List<Order>();
            expressions.Add(Expression.Eq("ManagementCompany.Key", managementCompanyId));
            expressions.Add(Expression.Eq("ReportLetterTypeId", (int)reportLetterType));
            expressions.Add(Expression.Eq("ReportLetterYear", reportLetterYear));
            orderings.Add(Order.Desc("CreationDate"));

            List<IReportLetter> reportLetters = session.GetTypedList<ReportLetter, IReportLetter>(expressions, orderings, null, null);
            return (reportLetters.Count > 0 ? reportLetters[0] : null);
        }
예제 #24
0
파일: ModelMapper.cs 프로젝트: kiquenet/B4F
        /// <summary>
        /// Get all system models
        /// </summary>
        /// <param name="session">Data access object</param>
        /// <param name="includePublic">Include Public Models</param>
        /// <param name="activityFilter">Active Filter</param>
        /// <returns>Collection of models</returns>
        public static List<IPortfolioModel> GetModels(IDalSession session, bool includePublic, ActivityReturnFilter activityFilter)
        {
            List<ICriterion> expressions = new List<ICriterion>();
            List<Order> orderings = new List<Order>();
            orderings.Add(Order.Asc("ModelName"));

            addAssetManagerCriterion(expressions, getForcedAssetManagerId(session, null), includePublic);

            if (activityFilter != ActivityReturnFilter.All)
                expressions.Add(Expression.Eq("IsActive", (activityFilter == ActivityReturnFilter.Active ? true : false)));

            return session.GetTypedList<PortfolioModel, IPortfolioModel>(expressions, orderings, null, null);
        }
예제 #25
0
        public static IGLAccount GetDepositGLAccount(IDalSession session)
        {
            IGLAccount glAccount = null;

            List<ICriterion> expressions = new List<ICriterion>();
            expressions.Add(Expression.Eq("IsDefaultDeposit", true));
            IList<IGLAccount> list = session.GetTypedList<GLAccount, IGLAccount>(expressions);
            if (list != null && list.Count == 1)
                glAccount = list[0];
            else
                throw new ApplicationException("Lookup of Default Deposit GL Account produced either no account or more than one.");

            return glAccount;
        }
예제 #26
0
 public static IList<IWithdrawalRule> GetWithdrawalRules(IDalSession session, int accountID, ActivityReturnFilter activityFilter)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     IAccountTypeCustomer acc = (IAccountTypeCustomer)AccountMapper.GetAccount(session, accountID);
     if (acc != null)
     {
         expressions.Add(Expression.Eq("Account.Key", acc.Key));
         if (activityFilter != ActivityReturnFilter.All)
             expressions.Add(Expression.Eq("IsActive", (activityFilter == ActivityReturnFilter.Active ? true : false)));
         return session.GetTypedList<WithdrawalRule, IWithdrawalRule>(expressions);
     }
     else
         return null;
 }
예제 #27
0
        /// <summary>
        /// Gets historical tax rate by date
        /// </summary>
        /// <param name="session">Data access object</param>
        /// <param name="date">Date</param>
        /// <returns>Historical exchange object</returns>
        public static IHistoricalTaxRate GetHistoricalTaxRate(IDalSession session, DateTime date)
        {
            List<HistoricalTaxRate> list;
            IHistoricalTaxRate rate = null;

            List<ICriterion> expressions = new List<ICriterion>();
            expressions.Add(Expression.Ge("StartDate", date));
            expressions.Add(Expression.Or(Expression.IsNull("EndDate"), Expression.Le("EndDate", date)));
            list = session.GetTypedList<HistoricalTaxRate>(expressions);
            if (list != null && list.Count > 0)
            {
                rate = list[0];
            }
            return rate;
        }
예제 #28
0
        public static IGLAccount GetSettlementDifferenceGLAccount(IDalSession session, ICurrency currency, ITradeableInstrument instrument)
        {
            IGLAccount glAccount = null;
            if (instrument.SettlementDifferenceAccount != null)
                glAccount = instrument.SettlementDifferenceAccount;
            else
            {
                List<ICriterion> expressions = new List<ICriterion>();
                expressions.Add(Expression.Eq("IsSettlementDifference", true));
                IList<IGLAccount> list = session.GetTypedList<GLAccount, IGLAccount>(expressions);
                if (list != null)
                {
                    if (list.Count == 1)
                        glAccount = list[0];
                    else if (list.Count > 1)
                        glAccount = list.Where(x => x.DefaultCurrency.Equals(currency)).FirstOrDefault();
                }
            }

            if (glAccount == null)
                throw new ApplicationException("Lookup of Settlement Difference GL Account produced no account.");
            else
                return glAccount;
        }
예제 #29
0
 public static IList<IDividWepFile> GetDividWepFiles(IDalSession session)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     return session.GetTypedList<IDividWepFile>(expressions);
 }
예제 #30
0
 /// <summary>
 /// Gets historical tax rate by date
 /// </summary>
 /// <param name="session">Data access object</param>
 /// <returns>Historical exchange object</returns>
 public static IList<IHistoricalTaxRate> GetHistoricalTaxRates(IDalSession session)
 {
     List<HistoricalTaxRate> list = session.GetTypedList<HistoricalTaxRate>();
     return list.Select(a => (IHistoricalTaxRate)a).ToList();
 }