Beispiel #1
0
	public bool HaveCondition(ConditionBase _condition)
	{
		foreach (ArkQuest quest in dicQuests.Values)
		{
			if (quest.NowQuestProgressState == QuestProgressState.QUEST_PROGRESS_IN)
			{
				QuestData questData = quest.GetQuestData();

				int conCount = questData.Condition.GetconditionCount(_condition);

				if (conCount > 0)
					return true;
			}
		}

		return false;
	}
Beispiel #2
0
 /// <inheritdoc />
 public AutomationElement FindAt(TreeScope treeScope, int index, ConditionBase condition)
 {
     return(FrameworkAutomationElement.FindAt(treeScope, index, condition));
 }
Beispiel #3
0
        public static AutomationElement Get(this AutomationElement element, ConditionBase condition)
        {
            var foundElement = element.FindFirstDescendant(condition);

            return(foundElement);
        }
Beispiel #4
0
 /// <summary>
 /// Finds the first descendant with the condition.
 /// </summary>
 /// <param name="condition">The condition.</param>
 /// <returns>The found element or null if no element was found.</returns>
 public AutomationElement FindFirstDescendant(ConditionBase condition)
 {
     return(FindFirst(TreeScope.Descendants, condition));
 }
Beispiel #5
0
 /// <summary>
 /// Finds the child at the given position with the condition.
 /// </summary>
 /// <param name="index">The index of the child to find.</param>
 /// <param name="condition">The condition.</param>
 /// <returns>The found element or null if no element was found.</returns>
 public AutomationElement FindChildAt(int index, ConditionBase condition = null)
 {
     return(FindAt(TreeScope.Children, index, condition ?? TrueCondition.Default));
 }
		public EnumConditionTO(ConditionBase.Type type) : base(type) {}
Beispiel #7
0
        private static string GetQuery(SchemaInfo[] schema, ConditionBase condition)
        {
            var sb     = new StringBuilder();
            var groups = schema.GroupBy(s => s.RootContentId).ToArray();
            var n      = 1;

            foreach (var group in groups)
            {
                var contentId    = group.Key;
                var needGrouping = false;

                var aliaces = group
                              .Where(s => s.RefContentId == null)
                              .Select(s => new { Alias = s.Alias + "." + s.Field, Type = s.DataType, TypeId = s.AttributeTypeId })
                              .Distinct()
                              .ToArray();

                var where = condition
                            .Clone()
                            .Where <FieldCondition>(c => aliaces.Any(a => a.Alias == c.GetCurrentExpression() && a.Type == c.Type))
                            .Where <ComparitionCondition>(c => c.Conditions.Length > 1)
                            .Where <ComparitionCondition>(c => ComparitionPredicate(c, e => aliaces.First(a => e == a.Alias).TypeId))
                            .Where <NotCondition>(c => c.Conditions.Length > 0)
                            .Select <LogicalCondition>(c => c.Conditions.Length == 1 ? c.Conditions[0] : c)
                            .Update <FieldCondition>(c => c.CastToString = aliaces.Any(a => a.Alias == c.GetCurrentExpression() && new[] { 9, 10 }.Contains(a.TypeId)))
                            .GetCurrentExpression();

                sb.AppendLine("SELECT");
                sb.AppendLine("\troot.CONTENT_ITEM_ID [Id],");
                sb.AppendFormat("\t{0} [ContentId]", contentId);
                sb.AppendLine();
                sb.AppendLine("FROM");
                sb.AppendFormat("\tCONTENT_{0}_UNITED root", contentId);
                sb.AppendLine();

                foreach (var s in group.Where(s => s.RefContentId != null))
                {
                    if (s.LinkId != null)
                    {
                        needGrouping = true;
                        sb.AppendFormat(LinkJoinTemplate, s.Alias, s.Field);
                        sb.AppendLine();
                        sb.AppendFormat(MtMJoinTemplate, s.RefContentId, s.Alias, s.Field);
                    }
                    else if (s.BackwardField != null)
                    {
                        needGrouping = s.AttributeTypeId != 2;
                        sb.AppendFormat(MoOJoinTemplate, s.RefContentId, s.Alias, s.Field, s.BackwardField);
                    }
                    else
                    {
                        sb.AppendFormat(OtMJoinTemplate, s.RefContentId, s.Alias, s.Field);
                    }

                    sb.AppendLine();
                }

                sb.AppendLine("WHERE root.ARCHIVE = 0 and");
                sb.Append("\t");
                sb.AppendLine(where);

                if (needGrouping)
                {
                    sb.AppendLine("GROUP BY");
                    sb.AppendLine("\troot.CONTENT_ITEM_ID");
                }

                if (n < groups.Length)
                {
                    sb.AppendLine();
                    sb.AppendLine("UNION");
                    sb.AppendLine();
                }

                n++;
            }

            return(sb.ToString());
        }
Beispiel #8
0
 internal Expr_(ConditionBase <T1, T2> condition, bool isNot, ISqlExpression expr)
 {
     _condition = condition;
     _isNot     = isNot;
     _expr      = expr;
 }
Beispiel #9
0
 internal Not_(ConditionBase <T1, T2> condition)
 {
     _condition = condition;
 }
Beispiel #10
0
        private static AutomationElement WaitUntilFirstFound(AutomationElement parent, FlaUI.Core.Definitions.TreeScope treeScope, ConditionBase condition)
        {
            int delayMSeconds = 200;
            AutomationElement futureHandle = null;

            while (futureHandle is null)
            {
                futureHandle = parent.FindFirst(treeScope, condition);

                if (!(futureHandle is null))
                {
                    break;
                }
                Task.Delay(delayMSeconds).Wait();
            }
            return(futureHandle);
        }
Beispiel #11
0
        private static AutomationElement[] WaitUntilAtLeastNFound(AutomationElement parent, FlaUI.Core.Definitions.TreeScope treeScope, ConditionBase condition, int nr)
        {
            int delayMSeconds = 200;

            AutomationElement[] elements = { };

            while (elements.Length < nr)
            {
                elements = parent.FindAll(treeScope, condition);

                if (elements.Length >= nr)
                {
                    break;
                }
                Task.Delay(delayMSeconds).Wait();
            }
            return(elements);
        }
 /// <summary>
 /// Finds the element with the given index with the given condition.
 /// </summary>
 /// <param name="treeScope">The scope to search.</param>
 /// <param name="index">The index of the element to return (0-based).</param>
 /// <param name="condition">The condition to use.</param>
 /// <returns>The found element or null if no element was found.</returns>
 public abstract AutomationElement FindIndexed(TreeScope treeScope, int index, ConditionBase condition);
 /// <summary>
 /// Finds the first matching element in the specified order.
 /// </summary>
 /// <param name="treeScope">A combination of values specifying the scope of the search.</param>
 /// <param name="condition">A condition that represents the criteria to match.</param>
 /// <param name="traversalOptions">Value specifying the tree navigation order.</param>
 /// <param name="root">An element with which to begin the search.</param>
 /// <returns>The found element or null if no element was found.</returns>
 public abstract AutomationElement FindFirstWithOptions(TreeScope treeScope, ConditionBase condition, TreeTraversalOptions traversalOptions, AutomationElement root);
        /// <summary>
        /// 检查商品是否满足,返回输出的符合条件的订单商品列表
        /// </summary>
        /// <param name="soInfo">订单信息</param>
        /// <param name="condition">活动的商品条件</param>
        /// <returns>符合条件的订单商品列表</returns>
        protected virtual List <SOItemInfo> CheckProductConditionAndGetActivityItemList(SOInfo soInfo, CondProduct condition)
        {
            //如果条件是整站
            ConditionBase <List <SOItemInfo> > condWhole = new ConditionBase <List <SOItemInfo> >();

            if (condition.Whole != null && condition.Whole.Data.HasValue && condition.Whole.Data.Value)
            {
                condWhole.AndOrTypeRelation = AndOrType.Or;
                condWhole.Data = new List <SOItemInfo>();
                foreach (SOItemInfo item in soInfo.Items)
                {
                    condWhole.Data.Add(item);
                }
            }

            //如果条件只限定商家
            int merchantId = 1;

            if (soInfo.BaseInfo.Merchant != null && soInfo.BaseInfo.Merchant.MerchantID.HasValue)
            {
                merchantId = soInfo.BaseInfo.Merchant.MerchantID.Value;
            }
            ConditionBase <List <SOItemInfo> > condOnlyVendor = new ConditionBase <List <SOItemInfo> >();

            if (condition.CondBrand == null && condition.CondBrandC3 == null && condition.CondC3 == null && condition.CondItem == null &&
                condition.CondVendor != null && condition.CondVendor.Find(v => v.VendorSysNo == merchantId) != null)
            {
                condOnlyVendor.AndOrTypeRelation = AndOrType.Or;
                condOnlyVendor.Data = new List <SOItemInfo>();
                foreach (SOItemInfo item in soInfo.Items)
                {
                    condOnlyVendor.Data.Add(item);
                }
            }


            //如果品牌方面有限制
            ConditionBase <List <SOItemInfo> > condOnlyBrand = new ConditionBase <List <SOItemInfo> >();

            if (condition.CondBrand != null && condition.CondBrand.Data != null && condition.CondBrand.Data.Count > 0)
            {
                condOnlyBrand.AndOrTypeRelation = condition.CondBrand.AndOrTypeRelation.Value;
                condOnlyBrand.Data = new List <SOItemInfo>();
                foreach (SOItemInfo item in soInfo.Items)
                {
                    if (condition.CondBrand.Data.Contains(item.BrandSysNo.Value))
                    {
                        condOnlyBrand.Data.Add(item);
                    }
                }
            }

            //如果类别方面有限制
            ConditionBase <List <SOItemInfo> > condOnlyC3 = new ConditionBase <List <SOItemInfo> >();

            if (condition.CondC3 != null && condition.CondC3.Data != null && condition.CondC3.Data.Count > 0)
            {
                condOnlyC3.AndOrTypeRelation = condition.CondC3.AndOrTypeRelation.Value;
                condOnlyC3.Data = new List <SOItemInfo>();
                foreach (SOItemInfo item in soInfo.Items)
                {
                    if (condition.CondC3.Data.Contains(item.C3SysNo.Value))
                    {
                        condOnlyC3.Data.Add(item);
                    }
                }
            }
            //如果品牌、类别同时限制
            ConditionBase <List <SOItemInfo> > condBrandC3 = new ConditionBase <List <SOItemInfo> >();

            if (condition.CondBrandC3 != null && condition.CondBrandC3.Data != null && condition.CondBrandC3.Data.Count > 0)
            {
                condBrandC3.AndOrTypeRelation = condition.CondBrandC3.AndOrTypeRelation.Value;
                condBrandC3.Data = new List <SOItemInfo>();
                foreach (SOItemInfo item in soInfo.Items)
                {
                    foreach (int[] arry in condition.CondBrandC3.Data)
                    {
                        if (arry.Length != 2)
                        {
                            continue;
                        }
                        int brandno = arry[0];
                        int c3no    = arry[1];
                        if (item.BrandSysNo.Value == brandno && item.C3SysNo.Value == c3no)
                        {
                            condBrandC3.Data.Add(item);
                        }
                    }
                }
            }

            //如果存在指定商品条件
            ConditionBase <List <SOItemInfo> > condProduct = new ConditionBase <List <SOItemInfo> >();

            if (condition.CondItem != null && condition.CondItem.Data != null && condition.CondItem.Data.Count > 0)
            {
                condProduct.AndOrTypeRelation = condition.CondItem.AndOrTypeRelation.Value;
                condProduct.Data = new List <SOItemInfo>();
                foreach (SOItemInfo item in soInfo.Items)
                {
                    if (condition.CondItem.Data.Contains(item.ProductSysNo.Value))
                    {
                        condProduct.Data.Add(item);
                    }
                }
            }

            /**************************构造树************************/
            List <ConditionBase <List <SOItemInfo> > > totalList = new List <ConditionBase <List <SOItemInfo> > >();

            if (condWhole.Data != null)
            {
                totalList.Add(condWhole);
            }
            if (condOnlyBrand.Data != null)
            {
                totalList.Add(condOnlyBrand);
            }
            if (condOnlyC3.Data != null)
            {
                totalList.Add(condOnlyC3);
            }
            if (condBrandC3.Data != null)
            {
                totalList.Add(condBrandC3);
            }
            if (condProduct.Data != null)
            {
                totalList.Add(condProduct);
            }
            if (condOnlyVendor.Data != null)
            {
                totalList.Add(condOnlyVendor);
            }
            ConditionBase <List <SOItemInfo> > totalCondition = new ConditionBase <List <SOItemInfo> >();

            BuildTree(ref totalCondition, totalList);

            List <SOItemInfo> canPromotionSOItemList = new List <SOItemInfo>();

            ParseTree(totalCondition, ref canPromotionSOItemList);



            //排除非主商品的商品,如赠品,附件等等
            RemoveNotSaleMasterProduct(canPromotionSOItemList);

            return(canPromotionSOItemList);
        }
Beispiel #15
0
	protected ConditionBase( ConditionBase _conditon)	{ }
Beispiel #16
0
 /// <summary>
 /// Finds the first element which is in the given treescope and matches the condition
 /// </summary>
 public AutomationElement FindFirst(TreeScope treeScope, ConditionBase condition)
 {
     return(FindFirst(treeScope, condition, Retry.DefaultRetryFor));
 }
		public ConditionBaseTO(ConditionBase.Type type) {

			this.type = (byte)type;

		}
        public override AutomationElement[] FindAll(TreeScope treeScope, ConditionBase condition)
        {
            var nativeFoundElements = NativeElement.FindAll((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition));

            return(AutomationElementConverter.NativeArrayToManaged(Automation, nativeFoundElements));
        }
		public FloatConditionTO(ConditionBase.Type type) : base(type) {}
        public override AutomationElement FindFirst(TreeScope treeScope, ConditionBase condition)
        {
            var nativeFoundElement = NativeElement.FindFirst((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition));

            return(AutomationElementConverter.NativeToManaged(Automation, nativeFoundElement));
        }
Beispiel #21
0
 /// <inheritdoc />
 public AutomationElement FindFirst(TreeScope treeScope, ConditionBase condition)
 {
     return(FrameworkAutomationElement.FindFirst(treeScope, condition));
 }
Beispiel #22
0
 //Constructor
 //-------------------------------------------------------------
 public BevCondition_Itf(ConditionBase conbase)
 {
     m_Con = conbase;
 }
Beispiel #23
0
 /// <summary>
 /// Finds all descendants with the condition.
 /// </summary>
 /// <param name="condition">The condition.</param>
 /// <returns>The found elements or an empty list if no elements were found.</returns>
 public AutomationElement[] FindAllDescendants(ConditionBase condition)
 {
     return(FindAll(TreeScope.Descendants, condition));
 }
Beispiel #24
0
 public ISHAutomationElement[] FindAllChildren(ConditionBase condition, bool waitUntilExists = true)
 {
     return(FindAllChildren(condition, TimeSpan.FromSeconds(20), waitUntilExists));
 }
Beispiel #25
0
 /// <inheritdoc />
 public AutomationElement FindFirstWithOptions(TreeScope treeScope, ConditionBase condition,
                                               TreeTraversalOptions traversalOptions, AutomationElement root)
 {
     return(FrameworkAutomationElement.FindFirstWithOptions(treeScope, condition, traversalOptions, root));
 }
Beispiel #26
0
 public abstract AutomationElement[] FindAll(TreeScope treeScope, ConditionBase condition);
Beispiel #27
0
 public static T Get <T>(this AutomationElement element, ConditionBase condition) where T : AutomationElement
 {
     return(Get(element, condition).As <T>());
 }
Beispiel #28
0
 public abstract AutomationElement FindFirst(TreeScope treeScope, ConditionBase condition);
 /// <inheritdoc />
 public override AutomationElement FindFirstWithOptions(TreeScope treeScope, ConditionBase condition,
                                                        TreeTraversalOptions traversalOptions, AutomationElement root)
 {
     throw new NotSupportedByFrameworkException();
 }
Beispiel #30
0
 private SearchCriteria(ConditionBase condition)
 {
     _conditions.Add(condition);
 }
Beispiel #31
0
 public TaskBase(String name, ConditionBase condition, UpdateDataDelegate returnFuc)
 {
     this.Name = name;
     this._UpdateDataDelegate = returnFuc;
     this.Condition = condition;
     this.Time = DateTime.Now;
 }
Beispiel #32
0
 /// <summary>
 /// Creates a new instance of a <see cref="NotCondition"/> which negates the given condition.
 /// </summary>
 /// <param name="condition">The condition that should be negated.</param>
 public NotCondition(ConditionBase condition)
 {
     Condition = condition;
 }
Beispiel #33
0
	public bool CheckAccept( ConditionBase _condition)
	{
		if( _condition.GetType() != GetType())
			return true;

		if( _condition.CommonValue >= MinLevel && _condition.CommonValue <= MaxLevel)
			return true;

		return false;
	}
Beispiel #34
0
 /// <inheritdoc />
 public AutomationElement[] FindAll(TreeScope treeScope, ConditionBase condition)
 {
     return(FrameworkAutomationElement.FindAll(treeScope, condition));
 }
		public LongConditionTO(ConditionBase.Type type) : base(type) {}
Beispiel #36
0
 /// <summary>
 /// Finds the first child with the condition.
 /// </summary>
 /// <param name="condition">The condition.</param>
 /// <returns>The found element or null if no element was found.</returns>
 public AutomationElement FindFirstChild(ConditionBase condition)
 {
     return(FindFirst(TreeScope.Children, condition));
 }
		public IntConditionTO(ConditionBase.Type type) : base(type) {}
Beispiel #38
0
 /// <summary>
 /// Finds all children with the condition.
 /// </summary>
 /// <param name="condition">The condition.</param>
 /// <returns>The found elements or an empty list if no elements were found.</returns>
 public AutomationElement[] FindAllChildren(ConditionBase condition)
 {
     return(FindAll(TreeScope.Children, condition));
 }
		public DoubleConditionTO(ConditionBase.Type type) : base(type) {}
Beispiel #40
0
 public ConditionAnd(ConditionBase leftNode, ConditionBase rightNode)
 {
     LeftNode  = leftNode;
     RightNode = rightNode;
 }