当前位置: 首页>>代码示例>>C#>>正文


C# IDalSession类代码示例

本文整理汇总了C#中IDalSession的典型用法代码示例。如果您正苦于以下问题:C# IDalSession类的具体用法?C# IDalSession怎么用?C# IDalSession使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IDalSession类属于命名空间,在下文中一共展示了IDalSession类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AdjustFixedAccountLine

        public static void AdjustFixedAccountLine(IDalSession session, IJournalEntry journalEntry)
        {
            try
            {
                if (journalEntry.Status == JournalEntryStati.New && journalEntry.Journal.FixedGLAccount != null)
                {
                    IJournalEntryLine fixedAccountLine = journalEntry.Lines.FixedAccountLine;
                    Money balance = journalEntry.Balance;

                    if (balance.IsNotZero)
                    {
                        if (fixedAccountLine == null)
                        {
                            fixedAccountLine = new JournalEntryLine();
                            fixedAccountLine.GLAccount = journalEntry.Journal.FixedGLAccount;

                            journalEntry.Lines.AddJournalEntryLine(fixedAccountLine);
                            fixedAccountLine.LineNumber = 0;
                        }

                        fixedAccountLine.Balance = balance.Negate();

                        JournalEntryMapper.Update(session, journalEntry);
                    }
                    else if (fixedAccountLine != null)
                        deleteLine(session, fixedAccountLine);
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException("Could not adjust Fixed-Account Line.", ex);
            }
        }
开发者ID:kiquenet,项目名称:B4F,代码行数:33,代码来源:JournalEntryLinesAdapter.cs

示例2: DiscoverSpParameterSet

		/// <summary>
		/// Resolve at run time the appropriate set of Parameters for a stored procedure
		/// </summary>
		/// <param name="session">An IDalSession object</param>
		/// <param name="spName">the name of the stored procedure</param>
		/// <param name="includeReturnValueParameter">whether or not to include their return value parameter</param>
		/// <returns></returns>
		private IDataParameter[] DiscoverSpParameterSet(IDalSession session, string spName, bool includeReturnValueParameter)
		{
			return InternalDiscoverSpParameterSet(
                session,
                spName, 
                includeReturnValueParameter);	
		}
开发者ID:hejiquan,项目名称:iBATIS_2010,代码行数:14,代码来源:DBHelperParameterCache.cs

示例3: GetFeeRules

        /// <summary>
        /// Retrieves a list of all <b>FeeRule</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>
        /// <returns>A list of all <b>CommRule</b> objects in the system.</returns>
        public static IList<IFeeRule> GetFeeRules(IDalSession session,
            int feeCalcId, int modelId, int accountId, int startPeriod, int endPeriod,
            bool isDefault, bool hasEmployerRelation, bool executionOnly, bool sendByPost)
        {
            Hashtable parameters = new Hashtable();

            IManagementCompany company = LoginMapper.GetCurrentManagmentCompany(session);
            if (!company.IsStichting)
                parameters.Add("companyId", company.Key);
            if (feeCalcId != 0 && (int)feeCalcId != int.MinValue)
                parameters.Add("feeCalcId", feeCalcId);
            if (accountId != 0 && accountId != int.MinValue)
                parameters.Add("accountId", accountId);
            if (modelId != 0 && modelId != int.MinValue)
                parameters.Add("modelId", modelId);
            if (startPeriod != 0)
                parameters.Add("startPeriod", startPeriod);
            if (endPeriod != 0)
                parameters.Add("endPeriod", endPeriod);
            if (isDefault)
                parameters.Add("isDefault", isDefault);
            if (hasEmployerRelation)
                parameters.Add("hasEmployerRelation", hasEmployerRelation);
            if (executionOnly)
                parameters.Add("executionOnly", executionOnly);
            if (sendByPost)
                parameters.Add("sendByPost", sendByPost);

            return session.GetTypedListByNamedQuery<IFeeRule>(
                "B4F.TotalGiro.Fees.FeeRules.GetFeeRules",
                parameters);
        }
开发者ID:kiquenet,项目名称:B4F,代码行数:37,代码来源:FeeRuleMapper.cs

示例4: GetPositions

 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);
 }
开发者ID:kiquenet,项目名称:B4F,代码行数:7,代码来源:FundPositionMapper.cs

示例5: GetAccountsIdsWithUnprintedNotas

        //public static IList GetUnprintedNotas(IDalSession session)
        //{
        //    List<ICriterion> expressions = new List<ICriterion>();
        //    expressions.Add(Expression.Eq("PrintCount", 0));
        //    return session.GetList(typeof(Nota), expressions);
        //}
        //        public static List<IManagementCompany> GetMgmtCompaniesWithUnprintedNotas(IDalSession session,
        //                                                                                  NotaReturnClass returnClass, int[] managementCompanyIds)
        //        {
        //            string hql = string.Format(@"FROM ManagementCompany M WHERE M IN
        //                                            (SELECT A.AccountOwner FROM CustomerAccount A WHERE A IN
        //                                                (SELECT N.UnderlyingTx.AccountA FROM {0} N WHERE N.PrintCount = 0))",
        //                                       getType(returnClass).Name);
        //            if (managementCompanyIds != null && managementCompanyIds.Length > 0)
        //            {
        //                string idList = "";
        //                for (int i = 0; i < managementCompanyIds.Length; i++)
        //                    idList += (i > 0 ? ", " : "") + managementCompanyIds[i].ToString();
        //                hql += string.Format(" AND M IN ({0})", idList);
        //            }
        //            return NHSession.ToList<IManagementCompany>(session.GetListByHQL(hql, new Hashtable()));
        //        }
        public static int[] GetAccountsIdsWithUnprintedNotas(IDalSession session, int managementCompanyId, NotaReturnClass returnClass)
        {
            Hashtable parameters = new Hashtable();
            parameters.Add("ManagementCompanyId", managementCompanyId);
            string underlyingAccObj = "";
            switch (returnClass)
            {
                case NotaReturnClass.NotaTransaction:
                case NotaReturnClass.NotaTransfer:
                case NotaReturnClass.NotaInstrumentConversion:
                    underlyingAccObj = "UnderlyingTx.AccountA";
                    break;
                default:
                    underlyingAccObj = "UnderlyingBooking.Account";
                    break;
            }

            ArrayList accountIds = (ArrayList)session.GetListByHQL(
                string.Format(@"SELECT A.Key FROM CustomerAccount A
                                WHERE A.Key IN (SELECT N.{0}.Key FROM {1} N WHERE N.PrintCount = 0)
                                AND A.AccountOwner.Key = :ManagementCompanyId
                                ORDER BY A.Number",
                                underlyingAccObj,
                                getType(returnClass).Name),
                                parameters);
            return (int[])accountIds.ToArray(typeof(int));
        }
开发者ID:kiquenet,项目名称:B4F,代码行数:49,代码来源:NotaMapper.cs

示例6: GetPositions

 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);
 }
开发者ID:kiquenet,项目名称:B4F,代码行数:7,代码来源:CashPositionMapper.cs

示例7: GetExtCustodianPositions

 /// <summary>
 /// Gets the Positions for the ExtCustodian for the specified date
 /// </summary>
 /// <param name="session">Data session object</param>
 /// <param name="custodian">The specified ExtCustodians</param>
 /// <param name="balanceDate">The specified date</param>
 /// <returns>A list ExtCustodian Positions</returns>
 public static IList GetExtCustodianPositions(IDalSession session, ExtCustodian custodian, DateTime balanceDate)
 {
     List<NHibernate.Criterion.ICriterion> expressions = new List<NHibernate.Criterion.ICriterion>();
     expressions.Add(NHibernate.Criterion.Expression.Eq("Custodian.Key", custodian.Key));
     expressions.Add(NHibernate.Criterion.Expression.Eq("BalanceDate", balanceDate));
     return session.GetList(typeof(ExtPosition), expressions);
 }
开发者ID:kiquenet,项目名称:B4F,代码行数:14,代码来源:ExtCustodianMapper.cs

示例8: GetGLLookupRecords

 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);
 }
开发者ID:kiquenet,项目名称:B4F,代码行数:7,代码来源:GlLookupRecordMapper.cs

示例9: CheckHistoricalExRate

 /// <summary>
 /// Check whether the rate is within the range
 /// </summary>
 /// <param name="session"></param>
 /// <param name="checkRate"></param>
 /// <returns></returns>
 public static bool CheckHistoricalExRate(IDalSession session, IHistoricalExRate checkRate, out string errMessage)
 {
     bool success = true;
     errMessage = "";
     if (checkRate != null)
     {
         IList<IHistoricalExRate> previousRates = GetHistoricalExRates(session,
             checkRate.Currency, checkRate.RateDate.AddDays(-5),
             checkRate.RateDate.AddDays(-1));
         if (previousRates != null && previousRates.Count > 0)
         {
             decimal prevRate = previousRates.OrderByDescending(x => x.RateDate).FirstOrDefault().Rate;
             if (prevRate != 0M)
             {
                 decimal diff = Math.Abs((prevRate - checkRate.Rate) / prevRate);
                 if (diff > 0.05M)
                 {
                     errMessage = string.Format("The new Exchange Rate is {0}% different from the previous Exchange Rate.", (diff * 100).ToString("0.0"));
                     success = false;
                 }
             }
         }
     }
     return success;
 }
开发者ID:kiquenet,项目名称:B4F,代码行数:31,代码来源:HistoricalExRateMapper.cs

示例10: GetAverageHoldings

        public static IList GetAverageHoldings(IDalSession session, IAccountTypeInternal account, DateTime startDate, DateTime endDate, ValuationTypesFilterOptions filterOption)
        {
            Hashtable parameters = new Hashtable(1);
            parameters.Add("account", account);
            parameters.Add("startDate", startDate);
            parameters.Add("endDate", endDate);
            string instrumentFilter = "";

            switch (filterOption)
            {
                case ValuationTypesFilterOptions.Security:
                    instrumentFilter = "and I.Key in (select S.Key from TradeableInstrument S) ";
                    break;
                case ValuationTypesFilterOptions.Monetary:
                    instrumentFilter = "and I.Key in (select C.Key from Currency C) ";
                    break;
            }

            string hql = string.Format(@"from AverageHolding A
                left join fetch A.Instrument I
                where A.Account = :account
                and (A.BeginDate between :startDate
                and :endDate ) {0}
                order by I.Key, A.BeginDate", instrumentFilter);
            return session.GetListByHQL(hql, parameters);
        }
开发者ID:kiquenet,项目名称:B4F,代码行数:26,代码来源:AverageHoldingMapper.cs

示例11: GetCounterAccounts

        /// <summary>
        /// This method retrieves a list of counter account instances that meet the passed in arguments. 
        /// When an argument is ommitted it is not used to filter the counter accounts
        /// </summary>
        /// <param name="session">An instance of the Data Access Library <see cref="T:B4F.TotalGiro.DAL.NHSession">NHSession</see> class</param>
        /// <param name="assetManager">The asset manager the customer belongs to</param>
        /// <param name="counterAccountNumber">Number of the counter account</param>
        /// <param name="counterAccountName">Name of the counter account</param>
        /// <param name="contactName">The name of the contact</param>
        /// <param name="accountNumber">The account's number of the account</param>
        /// <param name="showActive">Show for active contacts</param>
        /// <param name="showInactive">Show for inactive contacts</param>
        /// <param name="isPublic">Show public contacts</param>
        /// <returns>A list of counter account instances</returns>
        public static IList<ICounterAccount> GetCounterAccounts(IDalSession session, IAssetManager assetManager,
            string counterAccountNumber, string counterAccountName, 
            string contactName, string accountNumber, bool showActive, 
            bool showInactive, bool isPublic)
        {
            Hashtable parameters = new Hashtable();

            if (assetManager != null)
                parameters.Add("managementCompanyId", assetManager.Key);
            if (counterAccountNumber != null && counterAccountNumber.Length > 0)
                parameters.Add("counterAccountNumber", Util.PrepareNamedParameterWithWildcard(counterAccountNumber, MatchModes.Anywhere));
            if (counterAccountName != null && counterAccountName.Length > 0)
                parameters.Add("counterAccountName", Util.PrepareNamedParameterWithWildcard(counterAccountName, MatchModes.Anywhere));
            if (contactName != null && contactName.Length > 0)
                parameters.Add("contactName", Util.PrepareNamedParameterWithWildcard(contactName, MatchModes.Anywhere));
            parameters.Add("isPublic", isPublic);
            if (showActive && !showInactive)
                parameters.Add("isActive", true);
            if (!showActive && showInactive)
                parameters.Add("isActive", false);

            if (accountNumber != null && accountNumber.Length > 0)
                parameters.Add("accountNumber", Util.PrepareNamedParameterWithWildcard(accountNumber, MatchModes.Anywhere));

            return session.GetTypedListByNamedQuery<ICounterAccount>(
                "B4F.TotalGiro.Accounts.CounterAccount.GetCounterAccounts",
                parameters);
        }
开发者ID:kiquenet,项目名称:B4F,代码行数:42,代码来源:CounterAccountMapper.cs

示例12: CheckHistoricalPrice

        /// <summary>
        /// Check whether the price is within the range
        /// </summary>
        /// <param name="session"></param>
        /// <param name="checkPrice"></param>
        /// <returns></returns>
        public static bool CheckHistoricalPrice(IDalSession session, IHistoricalPrice checkPrice, out string errMessage)
        {
            bool success = true;
            errMessage = "";
            if (checkPrice != null)
            {
                IList<IHistoricalPrice> previousPrices = GetHistoricalPrices(session,
                    checkPrice.Instrument.Key, checkPrice.Date.AddDays(-5),
                    checkPrice.Date.AddDays(-1));
                if (previousPrices != null && previousPrices.Count > 0)
                {
                    Price prevPrice = previousPrices.OrderByDescending(x => x.Date).FirstOrDefault().Price;
                    if (prevPrice == null) prevPrice = checkPrice.Instrument.Get(e => e.CurrentPrice).Get(e => e.Price);

                    if (prevPrice != null)
                    {
                        decimal diff = Math.Abs((prevPrice.Quantity - checkPrice.Price.Quantity) / prevPrice.Quantity);
                        if (diff > 0.05M)
                        {
                            errMessage = string.Format("The new Price is {0}% different from the previous price.", (diff * 100).ToString("0.0"));
                            success = false;
                        }
                    }
                }
            }
            return success;
        }
开发者ID:kiquenet,项目名称:B4F,代码行数:33,代码来源:HistoricalPriceMapper.cs

示例13: GetClientBalanceGLAccounts

 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;
 }
开发者ID:kiquenet,项目名称:B4F,代码行数:7,代码来源:GLAccountMapper.cs

示例14: GetImportedBankBalance

        public static IImportedBankBalance GetImportedBankBalance(IDalSession session, IJournal bankJournal, DateTime bookBalanceDate)
        {
            Hashtable parameters = new Hashtable();
            parameters.Add("BankJournalKey", bankJournal.Key);
            parameters.Add("BookBalanceDate", bookBalanceDate);

            string hql = @"from ImportedBankBalance I
                            where I.BankJournal.Key = :BankJournalKey
                            and I.BookBalanceDate = :BookBalanceDate";

            IList result = session.GetListByHQL(hql, parameters);
            if (result != null && result.Count == 1)
                return (ImportedBankBalance)result[0];
            else
                return null;

            //List<ICriterion> expressions = new List<ICriterion>();
            //expressions.Add(Expression.Eq("BankJournal.Key", bankJournal.Key));
            //expressions.Add(Expression.Eq("BookBalanceDate", bookBalanceDate));
            //IList result = session.GetList(typeof(ImportedBankBalance), expressions);
            //if (result != null && result.Count == 1)
            //    return (IImportedBankBalance)result[0];
            //else
            //    return null;
        }
开发者ID:kiquenet,项目名称:B4F,代码行数:25,代码来源:ImportedBankBalanceMapper.cs

示例15: GetAccountFamilies

 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);
 }
开发者ID:kiquenet,项目名称:B4F,代码行数:7,代码来源:AccountFamilyMapper.cs


注:本文中的IDalSession类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。