Beispiel #1
0
        public void StopIfexistsInsideForall()
        {
            DataMisMatchedException exception = new DataMisMatchedException();

            exception.ErrorCause   = "Invalid Statement in forall.";
            exception.ErrorMessage = "Can not use ifexists inside forall.";
            exception.RowIndex     = CalcETreeParser.Counter;
            DataTypeMisMatchList.Add(exception);
        }
Beispiel #2
0
        public void InvalidOrAnd()
        {
            DataMisMatchedException exception = new DataMisMatchedException();

            exception.ErrorCause = "Invalid OR and And combination";
            exception.ErrorCause = "Cannot use OR and And combination in condition expressions.";
            exception.RowIndex   = CalcETreeParser.Counter;
            DataTypeMisMatchList.Add(exception);
        }
Beispiel #3
0
        /**
         *
         * @param lookupType
         * @param lookUpName
         * @param paramType
         * @param paramsDataTypes
         */


        public string checkType(string arg1, string arg2, string operatorText)
        {
            if ((!string.IsNullOrEmpty(arg1) && arg1.ToLower() == "entityinfo") || (!string.IsNullOrEmpty(arg2) && arg2.ToLower() == "entityinfo"))
            {
                return("");
            }

            arg1 = (!string.IsNullOrEmpty(arg1) && arg1.ToLower() == "datetime") ? "date" : arg1;
            arg2 = (!string.IsNullOrEmpty(arg1) && arg1.ToLower() == "datetime") ? "date" : arg2;

            if (arg2 == "any")
            {
                return("");
            }
            if (operatorText == PricerConstants.GT || operatorText == PricerConstants.GE || operatorText == PricerConstants.LE || operatorText == PricerConstants.LT || operatorText == PricerConstants.DIV || operatorText == PricerConstants.MUL || operatorText == PricerConstants.SUB || operatorText == PricerConstants.ADD)
            {
                if (arg1.ToUpper() == "STRING" || arg2.ToUpper() == "STRING" || arg1.ToUpper() == "BOOLEAN" || arg2.ToUpper() == "BOOLEAN")
                {
                    DataMisMatchedException exception = new DataMisMatchedException();
                    exception.ErrorCause = "Invalid datatype at step number " + CalcETreeParser.Counter;
                    if (arg1.ToUpper() == "STRING" || arg2.ToUpper() == "STRING")
                    {
                        exception.ErrorMessage = " text  for " + operatorText;
                    }
                    else if (arg1.ToUpper() == "BOOLEAN" || arg2.ToUpper() == "BOOLEAN")
                    {
                        exception.ErrorMessage = " boolean  for " + operatorText;
                    }
                    exception.RowIndex = CalcETreeParser.Counter;
                    DataTypeMisMatchList.Add(exception);
                    //throw exception;
                }
            }
            else if (operatorText == PricerConstants.ADD || operatorText == PricerConstants.SUB || operatorText == PricerConstants.MUL || operatorText == PricerConstants.DIV)
            {
                if (arg1.ToUpper() == "DATE" || arg2.ToUpper() == "DATE" || arg1.ToUpper() == "DATETIME" || arg2.ToUpper() == "DATETIME")
                {
                    DataMisMatchedException exception = new DataMisMatchedException();
                    exception.ErrorCause   = "Invalid datatype at step number " + CalcETreeParser.Counter;
                    exception.ErrorMessage = "datetime for " + operatorText;
                    exception.RowIndex     = CalcETreeParser.Counter;
                    DataTypeMisMatchList.Add(exception);
                    //throw exception;
                }
            }
            if (!string.IsNullOrEmpty(arg1) && !string.IsNullOrEmpty(arg2))
            {
                if (arg1.ToUpper() == arg2.ToUpper())
                {
                    arg1 = arg2;
                }
                else
                {
                    if (arg2 == null)
                    {
                        DataMisMatchedException exception = new DataMisMatchedException();
                        exception.ErrorCause   = "Data mismatch at step number " + CalcETreeParser.Counter;
                        exception.ErrorMessage = "Found " + arg2 + " expecting " + arg1;
                        exception.RowIndex     = CalcETreeParser.Counter;
                        DataTypeMisMatchList.Add(exception);
                        //throw exception;
                    }
                    else
                    {
                        DataMisMatchedException exception = new DataMisMatchedException();
                        exception.ErrorCause   = "Data mismatch at step number " + CalcETreeParser.Counter;
                        exception.ErrorMessage = "Found " + arg2 + " expecting " + arg1;
                        exception.RowIndex     = CalcETreeParser.Counter;
                        DataTypeMisMatchList.Add(exception);
                        //throw exception;
                    }
                }
            }

            return("");
        }