Ejemplo n.º 1
0
        public bool CheckResultWithBracket(DataRow row)
        {
            try
            {
                //12-17-2007@Scott
                BoolStack stack = new BoolStack();

                foreach (DBCondition condition in this)
                {
                    bool bResult = condition.CheckResult(row);

                    BoolResult br = new BoolResult(bResult, condition.Bracket, condition.FollowedOperand);

                    if (condition.Bracket == Bracket.End)
                    {
                        BoolStack Bstack = new BoolStack();

                        FilterOperands oper = br.Operands;

                        Bstack.Push(br);

                        br = stack.Pop() as BoolResult;

                        while (br.Bracket != Bracket.Start)
                        {
                            Bstack.Push(br);

                            if (stack.Count == 0)
                            {
                                System.Windows.Forms.MessageBox.Show("Bad Bracket Count!");

                                return(false);
                            }

                            br = stack.Pop() as BoolResult;
                        }
                        Bstack.Push(br);

                        br = Bstack.GetResultWithoutBracket();

                        br.Bracket = Bracket.NONE;

                        br.Operands = oper;
                    }

                    stack.Push(br);
                }

                stack = stack.Reverse();

                BoolResult result = stack.GetResultWithoutBracket();

                return(result.Result);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Check filter result error. Message:" + ex.Message);

                return(false);
            }
        }
Ejemplo n.º 2
0
 public void CopyTo(BoolResult result)
 {
     result._Bracket  = this._Bracket;
     result._Result   = this._Result;
     result._Operands = this._Operands;
 }