示例#1
0
 public CrmRuleValue FindRuleValue(DateTime saleTime, CrmVipCard vipCard, CrmArticle article, int payTypeId, CrmBankCardPayment bankCard, out CrmBankCardCodeScope bankCardCodeScope)
 {
     bankCardCodeScope = null;
     if (WithinPeriodOfTime(saleTime) && (saleTime.CompareTo(BeginTime) > 0) && (saleTime.CompareTo(EndTime) < 0) && (BeginTime.CompareTo(DateTime.MinValue) > 0) && (EndTime.CompareTo(DateTime.MinValue) > 0))
     {
         if (ArticleIds != null)
         {
             int inx = SeekUtils.IndexOfAscendingIntArray(ArticleIds, article.ArticleId);
             if (inx >= 0)
             {
                 return(ArticleRuleValues[inx]);
             }
         }
         if (Items != null)
         {
             foreach (CrmRuleBillItem ruleItem in Items)
             {
                 if (ruleItem.Match(article, vipCard, saleTime, payTypeId, bankCard, out bankCardCodeScope))
                 {
                     return(ruleItem.RuleValue);
                 }
             }
         }
     }
     return(null);
 }
示例#2
0
 public CrmRuleValue FindRuleValue(DateTime saleTime, CrmVipCard vipCard, CrmArticle article, int payType, CrmBankCardPayment bankCard, out CrmBankCardCodeScope bankCardCodeScope)
 {
     bankCardCodeScope = null;
     if ((saleTime.CompareTo(BeginTime) > 0) && (saleTime.CompareTo(EndTime) < 0) && (SubBillList != null))
     {
         foreach (CrmRuleSubBill subBill in SubBillList)
         {
             CrmRuleValue ruleValue = subBill.FindRuleValue(saleTime, vipCard, article, payType, bankCard, out bankCardCodeScope);
             if (ruleValue != null)
             {
                 //ruleValue.RuleBill = this;
                 return(ruleValue);
             }
         }
     }
     return(null);
 }
示例#3
0
        public bool Match(CrmArticle article, CrmVipCard vipCard, DateTime saleDate, int payTypeId, CrmBankCardPayment bankCard, out CrmBankCardCodeScope bankCardCodeScope)
        {
            bankCardCodeScope = null;
            bool ok = ((!ExistDept) || (SeekUtils.IndexOfLikeStringArray(DeptCodes, article.DeptCode) >= 0)) &&
                      ((!ExistCategory) || (SeekUtils.IndexOfLikeStringArray(CategoryCodes, article.CategoryCode) >= 0)) &&
                      ((!ExistContract) || (SeekUtils.IndexOfAscendingIntArray(ContractIds, article.ContractId) >= 0)) &&
                      ((!ExistBrand) || (SeekUtils.IndexOfAscendingIntArray(BrandIds, article.BrandId) >= 0)) &&
                      ((!ExistArticle) || (SeekUtils.IndexOfAscendingIntArray(ArticleIds, article.ArticleId) >= 0)) &&
                      ((!ExistPayType) || ((payTypeId > 0) && (SeekUtils.IndexOfAscendingIntArray(PayTypes, payTypeId) >= 0)));

            if (ok && ExistBank)
            {
                ok = false;
                if (bankCard != null)
                {
                    foreach (CrmBankCardCodeScope scope in bankCard.BankCardCodeScopeList)
                    {
                        if ((scope.BankId > 0) && (SeekUtils.IndexOfAscendingIntArray(BankIds, scope.BankId) >= 0))
                        {
                            bankCardCodeScope = scope;
                            ok = true;
                            break;
                        }
                    }
                }
            }
            if (ok && ExistBankCard && (bankCard != null))
            {
                ok = false;
                if (bankCard != null)
                {
                    foreach (CrmBankCardCodeScope scope in bankCard.BankCardCodeScopeList)
                    {
                        if ((scope.ScopeId > 0) && (SeekUtils.IndexOfAscendingIntArray(BankCardCodeScopeIds, scope.ScopeId) >= 0))
                        {
                            bankCardCodeScope = scope;
                            ok = true;
                            break;
                        }
                    }
                }
            }

            if (ok && ExistVipGroup)
            {
                ok = false;
                if (VipGroups != null)
                {
                    foreach (CrmVipGroup vipGroup in VipGroups)
                    {
                        if (vipGroup.Match(vipCard, saleDate))
                        {
                            ok = true;
                            break;
                        }
                    }
                }
            }
            return(ok);
        }