コード例 #1
0
ファイル: FeeFactory.cs プロジェクト: kiquenet/B4F
 public bool IsInstanceTypeActivated(FeeFactoryInstanceTypes instanceType)
 {
     bool activated = false;
     switch (instanceType)
     {
         case FeeFactoryInstanceTypes.Commission:
             activated = commRuleFinder != null;
             break;
         case FeeFactoryInstanceTypes.Fee:
             activated = (feeRuleFinder != null && taxRates != null);
             break;
         case FeeFactoryInstanceTypes.All:
             activated = (commRuleFinder != null && feeRuleFinder != null && taxRates != null);
             break;
     }
     return activated;
 }
コード例 #2
0
ファイル: FeeFactory.cs プロジェクト: kiquenet/B4F
        public void InitiateInstance(IDalSession session, FeeFactoryInstanceTypes instanceType, bool keepSession)
        {
            bool getCom = false;
            bool getFee = false;
            switch (instanceType)
            {
                case FeeFactoryInstanceTypes.Commission:
                    getCom = true;
                    break;
                case FeeFactoryInstanceTypes.Fee:
                    getFee = true;
                    break;
                case FeeFactoryInstanceTypes.All:
                    getCom = true;
                    getFee = true;
                    break;
            }

            if (getCom) getCommRuleFinder(session);
            if (getFee)
            {
                getFeeRuleFinder(session);
                taxRates = HistoricalTaxRateMapper.GetHistoricalTaxRates(session);
            }
            if (keepSession)
                FeeFactory.session = session;
        }
コード例 #3
0
ファイル: FeeFactory.cs プロジェクト: kiquenet/B4F
 public void InitiateInstance(IDalSession session, FeeFactoryInstanceTypes instanceType)
 {
     InitiateInstance(session, instanceType, false);
 }
コード例 #4
0
ファイル: FeeFactory.cs プロジェクト: kiquenet/B4F
        /// <summary>
        /// Static method that gets an instance of this class. Used whenever an order is created 
        /// (orders need <b>FeeFactory</b> objects passed into their constructors to be able to calculate their fees).
        /// </summary>
        /// <param name="session">A <b>DAL</b> session.</param>
        /// <param name="instanceType">What kind of instance</param>
        /// <param name="keepSession">Holds the session object in this instance</param>
        /// <returns>A FeeFactory instance.</returns>
        public static FeeFactory GetInstance(IDalSession session, FeeFactoryInstanceTypes instanceType, bool keepSession)
        {
            bool success = false;
            bool useTaxData = false;
            switch (instanceType)
            {
                case FeeFactoryInstanceTypes.Commission:
                    success = feeFactory.getCommRuleFinder(session) != null;
                    break;
                case FeeFactoryInstanceTypes.Fee:
                    success = feeFactory.getFeeRuleFinder(session) != null;
                    useTaxData = true;
                    break;
                case FeeFactoryInstanceTypes.All:
                    if (feeFactory.getCommRuleFinder(session) != null)
                        success = feeFactory.getFeeRuleFinder(session) != null;
                    useTaxData = true;
                    break;
            }
            if (success && useTaxData && feeFactory.taxRates == null)
                feeFactory.taxRates = HistoricalTaxRateMapper.GetHistoricalTaxRates(session);

            if (success)
            {
                if (keepSession)
                    FeeFactory.session = session;
                return feeFactory;
            }
            else
                return null;
        }
コード例 #5
0
ファイル: FeeFactory.cs プロジェクト: kiquenet/B4F
 /// <summary>
 /// Static method that gets an instance of this class. Used whenever an order is created 
 /// (orders need <b>FeeFactory</b> objects passed into their constructors to be able to calculate their fees).
 /// </summary>
 /// <param name="session">A <b>DAL</b> session.</param>
 /// <param name="instanceType">What kind of instance</param>
 /// <returns>A FeeFactory instance.</returns>
 public static FeeFactory GetInstance(IDalSession session, FeeFactoryInstanceTypes instanceType)
 {
     return GetInstance(session, instanceType, false);
 }
コード例 #6
0
ファイル: InstructionEngine.cs プロジェクト: kiquenet/B4F
 /// <summary>
 /// An instance of the <see cref="T:B4F.TotalGiro.Fees.FeeFactory">FeeFactory</see> class
 /// </summary>
 /// <param name="instanceType"></param>
 /// <returns></returns>
 protected IFeeFactory getFeeFactory(FeeFactoryInstanceTypes instanceType)
 {
     if (this.feeFactory == null || (this.feeFactory != null && !this.feeFactory.IsInstanceTypeActivated(instanceType)))
     {
         IDalSession session = NHSessionFactory.CreateSession();
         if (this.feeFactory == null)
             this.feeFactory = FeeFactory.GetInstance(session, instanceType, true);
         else
             this.feeFactory.InitiateInstance(session, instanceType, true);
     }
     return this.feeFactory;
 }