public bool Matches(opaqueDataListOptionType that, @operator op)
        {
            if (that != null)
            {
                List <opaqueData> opaqueList = that.opaqueData;
                if (opaqueList != null)
                {
                    if (op.Equals(@operator.equals))
                    {
                        if (opaqueList.Count != opaqueDataList.Count)
                        {
                            return(false);
                        }
                        for (int i = 0; i < opaqueList.Count; i++)
                        {
                            BaseOpaqueData opaque   = new BaseOpaqueData(opaqueList[i]);
                            BaseOpaqueData myOpaque = opaqueDataList[i];
                            if (!OpaqueDataUtil.Equals(opaque, myOpaque))
                            {
                                return(false);
                            }
                        }
                        return(true);
                    }
                    else if (op.Equals(@operator.contains))
                    {
                        if (opaqueList.Count > opaqueDataList.Count)
                        {
                            return(false);
                        }
                        for (int i = 0; i < opaqueList.Count; i++)
                        {
                            BaseOpaqueData opaque = new BaseOpaqueData(opaqueList[i]);
                            bool           found  = false;
                            for (int j = 0; j < opaqueDataList.Count; j++)
                            {
                                BaseOpaqueData myOpaque = opaqueDataList[j];
                                if (OpaqueDataUtil.Equals(opaque, myOpaque))
                                {
                                    found = true;
                                    break;
                                }
                            }
                            if (!found)
                            {
                                return(false);
                            }
                        }
                        return(true);
                    }
                    else
                    {
                        log.Warn("Unsupported expression operator: " + op);
                    }
                }
            }

            return(false);
        }
        public bool Matches(DhcpV6UserClassOption that, @operator op)
        {
            if (that == null)
            {
                return(false);
            }
            if (that.GetCode() != this.GetCode())
            {
                return(false);
            }

            return(base.Matches(that, op));
        }
Beispiel #3
0
 public Condition(Filter parent, XmlNode xml) : base(parent.Fetch, xml)
 {
     Parent    = parent;
     Attribute = xml.Attribute("attribute");
     if (xml.Attribute("operator") is string oper)
     {
         Operator = oper.ToEnum <@operator>();
     }
     ;
     Value_  = xml.Attribute("value");
     ValueOf = xml.Attribute("valueof");
     Values  = Value.List(xml, this);
 }
Beispiel #4
0
        /* (non-Javadoc)
         * @see com.jagornet.dhcpv6.option.DhcpComparableOption#matches(com.jagornet.dhcp.xml.OptionExpression)
         */
        public bool Matches(optionExpression expression)
        {
            if (expression == null)
            {
                return(false);
            }
            if (expression.code != this.GetCode())
            {
                return(false);
            }
            if (ipAddress == null)
            {
                return(false);
            }

            ipAddressOptionType exprOption = (ipAddressOptionType)expression.Item;

            if (exprOption != null)
            {
                String    exprIpAddress = exprOption.ipAddress;
                @operator op            = expression.@operator;
                if (op.Equals(@operator.equals))
                {
                    return(ipAddress.Equals(exprIpAddress));
                }
                else if (op.Equals(@operator.startsWith))
                {
                    return(ipAddress.StartsWith(exprIpAddress));
                }
                else if (op.Equals(@operator.endsWith))
                {
                    return(ipAddress.EndsWith(exprIpAddress));
                }
                else if (op.Equals(@operator.contains))
                {
                    return(ipAddress.Contains(exprIpAddress));
                }
                else if (op.Equals(@operator.regExp))
                {
                    Match m = Regex.Match(ipAddress, exprIpAddress);
                    return(m.Success);
                }
                else
                {
                    log.Warn("Unsupported expression operator: " + op);
                }
            }

            return(false);
        }
        public bool Matches(DhcpV6VendorClassOption that, @operator op)
        {
            if (that == null)
            {
                return(false);
            }
            if (that.GetCode() != this.GetCode())
            {
                return(false);
            }
            if (that.GetEnterpriseNumber() != this.GetEnterpriseNumber())
            {
                return(false);
            }

            return(base.Matches(that, op));
        }
Beispiel #6
0
        private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            string value;

            if (this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == null)
            {
                return;
            }
            else
            {
                value = this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
            }

            DBClassDataContext context = new DBClassDataContext(Globals.ConnectionString);
            int       id;
            @operator operator_item;

            if (int.TryParse((this.dataGridView1.Rows[e.RowIndex].Cells["OperatorId"].Value ?? "").ToString(), out id))
            {
                operator_item = [email protected](n => n.operator_id == id);
            }
            else
            {
                operator_item = new @operator();
                [email protected](operator_item);
            }
            switch (e.ColumnIndex)
            {
            case 1:
                operator_item.operator_name = value;
                break;

            case 2:
                operator_item.operator_comment = value;
                break;
            }
            try
            {
                context.SubmitChanges();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            LoadOperator();
        }
Beispiel #7
0
        public bool Matches(v4VendorClassOption that, @operator op)
        {
            if (that == null)
            {
                return(false);
            }
            if (that.code != this.GetCode())
            {
                return(false);
            }
            if (that.opaqueData == null)
            {
                return(false);
            }

            return(OpaqueDataUtil.Matches(opaqueData, that.opaqueData, op));
        }
Beispiel #8
0
        public bool Matches(v6ClientIdOption that, @operator op)
        {
            if (that == null)
            {
                return(false);
            }
            if (that.code != this.code)
            {
                return(false);
            }
            if (that.opaqueData == null)
            {
                return(false);
            }

            return(OpaqueDataUtil.Matches(opaqueData, that.opaqueData, op));
        }
Beispiel #9
0
        /**
         * Matches.
         *
         * @param expression the expression
         * @param myOpaque the my opaque
         *
         * @return true, if successful
         */
        public static bool Matches(optionExpression expression, BaseOpaqueData myOpaque)
        {
            if (expression == null)
            {
                return(false);
            }

            opaqueData data = (opaqueData)expression.Item;

            if (data == null)
            {
                return(false);
            }

            @operator op = expression.@operator;

            return(Matches(myOpaque, data, op));
        }
Beispiel #10
0
        /* (non-Javadoc)
         * @see com.jagornet.dhcpv6.option.DhcpComparableOption#matches(com.jagornet.dhcp.xml.OptionExpression)
         */
        public bool Matches(optionExpression expression)
        {
            if (expression == null)
            {
                return(false);
            }
            if (expression.code != this.GetCode())
            {
                return(false);
            }
            if (unsignedByteList == null)
            {
                return(false);
            }

            unsignedByteListOptionType exprOption = (unsignedByteListOptionType)expression.Item;

            if (exprOption != null)
            {
                List <short> exprUbytes = exprOption.unsignedByte;
                @operator    op         = expression.@operator;
                if (op.Equals(@operator.equals))
                {
                    return(unsignedByteList.Equals(exprUbytes));
                }
                else if (op.Equals(@operator.contains))
                {
                    foreach (var item in exprUbytes)
                    {
                        if (!unsignedByteList.Contains(item))
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
                else
                {
                    log.Warn("Unsupported expression operator: " + op);
                }
            }

            return(false);
        }
Beispiel #11
0
        static void Main1(string[] args)
        {
            CustomerSalesService client = new CustomerSalesService();


            UsernameToken textToken = new UsernameToken("AppCardifWsDirectSales",
                                                        "Cardfif@WsDirectSales",
                                                        PasswordOption.SendNone);

            //UsernameToken textToken = new UsernameToken(null);
            //textToken.

            try {
                //client.RequestSoapContext.Security.Tokens.Add(textToken);
                //client.RequestSoapContext.Security.
                //client.RequestSoapContext.Security.Timestamp.TtlInSeconds = 60;

                @operator oper = new @operator();
                oper.operatorName = "José da Silva";
                loginDTO loginOper = new loginDTO();
                loginOper.username = "******";
                loginOper.password = "******";
                oper.login         = loginOper;

                identityDTO iden = new identityDTO();
                iden.documentType  = document.CPF;
                iden.documentValue = "27890664001";
                customer cust = new customer();
                cust.identity = iden;

                retrieveCustomerSalesRequest request = new retrieveCustomerSalesRequest();
                request.@operator = oper;
                request.customer  = cust;

                retrieveCustomerSalesResponse response = (retrieveCustomerSalesResponse)client.retrieveCustomerSales(request);

                Console.WriteLine("Response = " + response);
            } catch (Exception ex) {
                Console.WriteLine("Exception to call service : " + ex);
            }
        }
Beispiel #12
0
        public string Put()
        {
            if (Config.IsMulti)
            {
                db = new DbBranch();
            }
            else
            {
                db = new DB();
            }

            //更新数据,方法一
            try
            {
                @operator user = JsonConvert.DeserializeObject <@operator>(Request["data"]);
                db.Entry(user).State = System.Data.Entity.EntityState.Modified;
                if (db.SaveChanges() > 0)
                {
                    return(RetMsg.Success(user));
                }
                return(RetMsg.UpdateFailed);
            }
            catch (Exception ex)
            {
                ex = ex.InnerException ?? ex;
                LogHelper.Error(ex);
                return(RetMsg.Error(ex.Message));
            }
            //更新数据,方法二
            //var query1 = (from q in context.Users
            //              where q.UserName == "Jone"
            //              select q).SingleOrDefault();

            ////判断query1是否为空,若不为空,则修改UserEmail。
            //if (query1 != null)
            //{
            //    query1.UserEmail = "*****@*****.**";
            //    context.SubmitChanges();
            //}
        }
        public bool Matches(optionExpression expression)
        {
            if (expression == null)
            {
                return(false);
            }
            if (expression.code != this.code)
            {
                return(false);
            }

            unsignedShortOptionType exprOption = (unsignedShortOptionType)expression.Item;

            if (exprOption != null)
            {
                int       exprUshort = exprOption.unsignedShort;
                @operator op         = expression.@operator;
                if (op.Equals(@operator.equals))
                {
                    return(unsignedShort == exprUshort);
                }
                else if (op.Equals(@operator.lessThan))
                {
                    return(unsignedShort < exprUshort);
                }
                else if (op.Equals(@operator.lessThanOrEqual))
                {
                    return(unsignedShort <= exprUshort);
                }
                else if (op.Equals(@operator.greaterThan))
                {
                    return(unsignedShort > exprUshort);
                }
                else if (op.Equals(@operator.greaterThanOrEqual))
                {
                    return(unsignedShort >= exprUshort);
                }
                else
                {
                    log.Warn("Unsupported expression operator: " + op);
                }
            }

            // then see if we have an opaque option
            opaqueDataOptionType opaqueOption = (opaqueDataOptionType)expression.Item;

            if (opaqueOption != null)
            {
                opaqueData opaque = opaqueOption.opaqueData;
                if (opaque != null)
                {
                    string ascii = opaque.asciiValue;
                    if (ascii != null)
                    {
                        try
                        {
                            // need an Integer to handle unsigned short
                            if (unsignedShort == int.Parse(ascii))
                            {
                                return(true);
                            }
                        }
                        catch (Exception ex)
                        {
                            log.Error("Invalid unsigned short ASCII value for OpaqueData: " + ascii);
                        }
                    }
                    else
                    {
                        byte[] hex = opaque.hexValue;
                        if ((hex != null) &&
                            (hex.Length >= 1) && (hex.Length <= 2))
                        {
                            int hexUnsignedShort = Convert.ToInt32(Util.ToHexString(hex), 16);
                            if (unsignedShort == hexUnsignedShort)
                            {
                                return(true);
                            }
                        }
                    }
                }
            }
            return(false);
        }
Beispiel #14
0
 public static bool Matches(BaseOpaqueData myOpaque, opaqueData that, @operator op)
 {
     if (that != null)
     {
         string expAscii = that.asciiValue;
         string myAscii  = myOpaque.GetAscii();
         if ((expAscii != null) && (myAscii != null))
         {
             if (op.Equals(@operator.equals))
             {
                 return(myAscii.equalsIgnoreCase(expAscii));
             }
             else if (op.Equals(@operator.startsWith))
             {
                 return(myAscii.startsWith(expAscii));
             }
             else if (op.Equals(@operator.contains))
             {
                 return(myAscii.@operator(expAscii));
             }
             else if (op.Equals(@operator.endsWith))
             {
                 return(myAscii.endsWith(expAscii));
             }
             else if (op.Equals(@operator.regExp))
             {
                 return(myAscii.matches(expAscii));
             }
             else
             {
                 log.error("Unsupported expression operator: " + op);
                 return(false);
             }
         }
         else if ((expAscii == null) && (myAscii == null))
         {
             byte[] expHex = that.getHexValue();
             byte[] myHex  = myOpaque.getHex();
             if ((expHex != null) && (myHex != null))
             {
                 if (op.equals(Operator.EQUALS))
                 {
                     return(Arrays.equals(myHex, expHex));
                 }
                 else if (op.equals(Operator.STARTS_WITH))
                 {
                     if (myHex.length >= expHex.length)
                     {
                         for (int i = 0; i < expHex.length; i++)
                         {
                             if (myHex[i] != expHex[i])
                             {
                                 return(false);
                             }
                         }
                         return(true);    // if we get here, it matches
                     }
                     else
                     {
                         return(false);   // exp length too long
                     }
                 }
                 else if (op.equals(Operator.CONTAINS))
                 {
                     if (myHex.length >= expHex.length)
                     {
                         int j = 0;
                         for (int i = 0; i < myHex.length; i++)
                         {
                             if (myHex[i] == expHex[j])
                             {
                                 // found a potential match
                                 j++;
                                 boolean matches = true;
                                 for (int ii = i + 1; ii < myHex.length; ii++)
                                 {
                                     if (myHex[ii] != expHex[j++])
                                     {
                                         matches = false;
                                         break;
                                     }
                                 }
                                 if (matches)
                                 {
                                     return(true);
                                 }
                                 j = 0;    // reset to start of exp
                             }
                         }
                         return(false);    // if we get here, it didn't match
                     }
                     else
                     {
                         return(false);   // exp length too long
                     }
                 }
                 else if (op.equals(Operator.ENDS_WITH))
                 {
                     if (myHex.length >= expHex.length)
                     {
                         for (int i = myHex.length - 1;
                              i >= myHex.length - expHex.length;
                              i--)
                         {
                             if (myHex[i] != expHex[i])
                             {
                                 return(false);
                             }
                         }
                         return(true);    // if we get here, it matches
                     }
                     else
                     {
                         return(false);   // exp length too long
                     }
                 }
                 else if (op.equals(Operator.REG_EXP))
                 {
                     log.error("Regular expression operator not valid for hex opaque opaqueData");
                     return(false);
                 }
                 else
                 {
                     log.error("Unsupported expression operator: " + op);
                     return(false);
                 }
             }
         }
     }
     return(false);
 }
        //public void decodeLengthAndData(ByteBuffer buf)
        //{
        //    int len = Util.getUnsignedShort(buf);
        //    if (len > 0)
        //    {
        //        decode(buf, len);
        //    }
        //}

        // for expression matching
        public bool Matches(opaqueData that, @operator op)
        {
            //if (that != null)
            //{
            //    String expAscii = that.getAsciiValue();
            //    String myAscii = getAscii();
            //    if ((expAscii != null) && (myAscii != null))
            //    {
            //        if (op.equals(Operator.EQUALS))
            //        {
            //            return myAscii.equalsIgnoreCase(expAscii);
            //        }
            //        else if (op.equals(Operator.STARTS_WITH))
            //        {
            //            return myAscii.startsWith(expAscii);
            //        }
            //        else if (op.equals(Operator.CONTAINS))
            //        {
            //            return myAscii.contains(expAscii);
            //        }
            //        else if (op.equals(Operator.ENDS_WITH))
            //        {
            //            return myAscii.endsWith(expAscii);
            //        }
            //        else if (op.equals(Operator.REG_EXP))
            //        {
            //            return myAscii.matches(expAscii);
            //        }
            //        else
            //        {
            //            log.error("Unsupported expression operator: " + op);
            //            return false;
            //        }
            //    }
            //    else if ((expAscii == null) && (myAscii == null))
            //    {
            //        byte[] expHex = that.getHexValue();
            //        byte[] myHex = getHex();
            //        if ((expHex != null) && (myHex != null))
            //        {
            //            if (op.equals(Operator.EQUALS))
            //            {
            //                return Arrays.equals(myHex, expHex);
            //            }
            //            else if (op.equals(Operator.STARTS_WITH))
            //            {
            //                if (myHex.length >= expHex.length)
            //                {
            //                    for (int i = 0; i < expHex.length; i++)
            //                    {
            //                        if (myHex[i] != expHex[i])
            //                        {
            //                            return false;
            //                        }
            //                    }
            //                    return true;    // if we get here, it matches
            //                }
            //                else
            //                {
            //                    return false;   // exp length too long
            //                }
            //            }
            //            else if (op.equals(Operator.CONTAINS))
            //            {
            //                if (myHex.length >= expHex.length)
            //                {
            //                    int j = 0;
            //                    for (int i = 0; i < myHex.length; i++)
            //                    {
            //                        if (myHex[i] == expHex[j])
            //                        {
            //                            // found a potential match
            //                            j++;
            //                            boolean matches = true;
            //                            for (int ii = i + 1; ii < myHex.length; ii++)
            //                            {
            //                                if (myHex[ii] != expHex[j++])
            //                                {
            //                                    matches = false;
            //                                    break;
            //                                }
            //                            }
            //                            if (matches)
            //                            {
            //                                return true;
            //                            }
            //                            j = 0;    // reset to start of exp
            //                        }
            //                    }
            //                    return false;    // if we get here, it didn't match
            //                }
            //                else
            //                {
            //                    return false;   // exp length too long
            //                }
            //            }
            //            else if (op.equals(Operator.ENDS_WITH))
            //            {
            //                if (myHex.length >= expHex.length)
            //                {
            //                    for (int i = myHex.length - 1;
            //                         i >= myHex.length - expHex.length;
            //                         i--)
            //                    {
            //                        if (myHex[i] != expHex[i])
            //                        {
            //                            return false;
            //                        }
            //                    }
            //                    return true;    // if we get here, it matches
            //                }
            //                else
            //                {
            //                    return false;   // exp length too long
            //                }
            //            }
            //            else if (op.equals(Operator.REG_EXP))
            //            {
            //                log.Error("Regular expression operator not valid for hex opaque opaqueData");
            //                return false;
            //            }
            //            else
            //            {
            //                log.Error("Unsupported expression operator: " + op);
            //                return false;
            //            }
            //        }
            //    }
            //}
            return(false);
        }
Beispiel #16
0
 var(@operator, constant, variables) = sparqlExpression;
        private static ConditionOperator ConvertToConditionOperator(@operator @operator)
        {
            switch (@operator)
            {
            case @operator.eq:
                return(ConditionOperator.Equal);

            case @operator.neq:
            case @operator.ne:
                return(ConditionOperator.NotEqual);

            case @operator.gt:
                return(ConditionOperator.GreaterThan);

            case @operator.ge:
                return(ConditionOperator.GreaterEqual);

            case @operator.le:
                return(ConditionOperator.LessEqual);

            case @operator.lt:
                return(ConditionOperator.LessThan);

            case @operator.like:
                return(ConditionOperator.Like);

            case @operator.notlike:
                return(ConditionOperator.NotLike);

            case @operator.@in:
                return(ConditionOperator.In);

            case @operator.notin:
                return(ConditionOperator.NotIn);

            case @operator.between:
                return(ConditionOperator.Between);

            case @operator.notbetween:
                return(ConditionOperator.NotBetween);

            case @operator.@null:
                return(ConditionOperator.Null);

            case @operator.notnull:
                return(ConditionOperator.NotNull);

            case @operator.yesterday:
                return(ConditionOperator.Yesterday);

            case @operator.today:
                return(ConditionOperator.Today);

            case @operator.tomorrow:
                return(ConditionOperator.Tomorrow);

            case @operator.lastsevendays:
                return(ConditionOperator.Last7Days);

            case @operator.nextsevendays:
                return(ConditionOperator.Next7Days);

            case @operator.lastweek:
                return(ConditionOperator.LastWeek);

            case @operator.thisweek:
                return(ConditionOperator.ThisWeek);

            case @operator.nextweek:
                return(ConditionOperator.NextWeek);

            case @operator.lastmonth:
                return(ConditionOperator.LastMonth);

            case @operator.thismonth:
                return(ConditionOperator.ThisMonth);

            case @operator.nextmonth:
                return(ConditionOperator.NextMonth);

            case @operator.on:
                return(ConditionOperator.On);

            case @operator.onorbefore:
                return(ConditionOperator.OnOrBefore);

            case @operator.onorafter:
                return(ConditionOperator.OnOrAfter);

            case @operator.lastyear:
                return(ConditionOperator.LastYear);

            case @operator.thisyear:
                return(ConditionOperator.ThisYear);

            case @operator.nextyear:
                return(ConditionOperator.NextYear);

            case @operator.lastxhours:
                return(ConditionOperator.LastXHours);

            case @operator.nextxhours:
                return(ConditionOperator.NextXHours);

            case @operator.lastxdays:
                return(ConditionOperator.LastXDays);

            case @operator.nextxdays:
                return(ConditionOperator.NextXDays);

            case @operator.lastxweeks:
                return(ConditionOperator.LastXWeeks);

            case @operator.nextxweeks:
                return(ConditionOperator.NextXWeeks);

            case @operator.lastxmonths:
                return(ConditionOperator.LastXMonths);

            case @operator.nextxmonths:
                return(ConditionOperator.NextXMonths);

            case @operator.olderthanxmonths:
                return(ConditionOperator.OlderThanXMonths);

            case @operator.olderthanxyears:
                return(ConditionOperator.OlderThanXYears);

            case @operator.olderthanxweeks:
                return(ConditionOperator.OlderThanXWeeks);

            case @operator.olderthanxdays:
                return(ConditionOperator.OlderThanXDays);

            case @operator.olderthanxhours:
                return(ConditionOperator.OlderThanXHours);

            case @operator.olderthanxminutes:
                return(ConditionOperator.OlderThanXMinutes);

            case @operator.lastxyears:
                return(ConditionOperator.LastXYears);

            case @operator.nextxyears:
                return(ConditionOperator.NextXYears);

            case @operator.equserid:
                return(ConditionOperator.EqualUserId);

            case @operator.neuserid:
                return(ConditionOperator.NotEqualUserId);

            case @operator.equserteams:
                return(ConditionOperator.EqualUserTeams);

            case @operator.equseroruserteams:
                return(ConditionOperator.EqualUserOrUserTeams);

            case @operator.equseroruserhierarchy:
                return(ConditionOperator.EqualUserOrUserHierarchy);

            case @operator.equseroruserhierarchyandteams:
                return(ConditionOperator.EqualUserOrUserHierarchyAndTeams);

            case @operator.eqbusinessid:
                return(ConditionOperator.EqualBusinessId);

            case @operator.nebusinessid:
                return(ConditionOperator.NotEqualBusinessId);

            case @operator.equserlanguage:
                return(ConditionOperator.EqualUserLanguage);

            case @operator.thisfiscalyear:
                return(ConditionOperator.ThisFiscalYear);

            case @operator.thisfiscalperiod:
                return(ConditionOperator.ThisFiscalPeriod);

            case @operator.nextfiscalyear:
                return(ConditionOperator.NextFiscalYear);

            case @operator.nextfiscalperiod:
                return(ConditionOperator.NextFiscalPeriod);

            case @operator.lastfiscalyear:
                return(ConditionOperator.LastFiscalYear);

            case @operator.lastfiscalperiod:
                return(ConditionOperator.LastFiscalPeriod);

            case @operator.lastxfiscalyears:
                return(ConditionOperator.LastXFiscalYears);

            case @operator.lastxfiscalperiods:
                return(ConditionOperator.LastXFiscalPeriods);

            case @operator.nextxfiscalyears:
                return(ConditionOperator.NextXFiscalYears);

            case @operator.nextxfiscalperiods:
                return(ConditionOperator.NextXFiscalPeriods);

            case @operator.infiscalyear:
                return(ConditionOperator.InFiscalYear);

            case @operator.infiscalperiod:
                return(ConditionOperator.InFiscalPeriod);

            case @operator.infiscalperiodandyear:
                return(ConditionOperator.InFiscalPeriodAndYear);

            case @operator.inorbeforefiscalperiodandyear:
                return(ConditionOperator.InOrBeforeFiscalPeriodAndYear);

            case @operator.inorafterfiscalperiodandyear:
                return(ConditionOperator.InOrAfterFiscalPeriodAndYear);

            case @operator.beginswith:
                return(ConditionOperator.BeginsWith);

            case @operator.notbeginwith:
                return(ConditionOperator.DoesNotBeginWith);

            case @operator.endswith:
                return(ConditionOperator.EndsWith);

            case @operator.notendwith:
                return(ConditionOperator.DoesNotEndWith);

            case @operator.under:
                return(ConditionOperator.Under);

            case @operator.eqorunder:
                return(ConditionOperator.UnderOrEqual);

            case @operator.notunder:
                return(ConditionOperator.NotUnder);

            case @operator.above:
                return(ConditionOperator.Above);

            case @operator.eqorabove:
                return(ConditionOperator.AboveOrEqual);

            case @operator.containvalues:
                return(ConditionOperator.ContainValues);

            case @operator.notcontainvalues:
                return(ConditionOperator.DoesNotContainValues);

            default:
                break;
            }

            return(ConditionOperator.Equal);
        }
Beispiel #18
0
            public BinOp(expr left, @operator op, expr right, [Optional]int? lineno)
                : this() {
                _left = left;
                _op = op;
                _right = right;

                if (lineno != null)
                    this.lineno = lineno.Value;
            }
Beispiel #19
0
 public AugAssign(expr target, @operator op, expr value,
     [Optional]int? lineno, [Optional]int? col_offset)
     : this()
 {
     _target = target;
     _op = op;
     _value = value;
     _lineno = lineno;
     _col_offset = col_offset;
 }
Beispiel #20
0
        private static ConditionOperator Convert(@operator op)
        {
            switch (op)
            {
            case @operator.eq:
                return(ConditionOperator.Equal);

            case @operator.neq:
            case @operator.ne:
                return(ConditionOperator.NotEqual);

            case @operator.gt:
                return(ConditionOperator.GreaterThan);

            case @operator.ge:
                return(ConditionOperator.GreaterEqual);

            case @operator.le:
                return(ConditionOperator.LessEqual);

            case @operator.lt:
                return(ConditionOperator.LessThan);

            case @operator.like:
                return(ConditionOperator.Like);

            case @operator.notlike:
                return(ConditionOperator.NotLike);

            case @operator.@in:
                return(ConditionOperator.In);

            case @operator.notin:
                return(ConditionOperator.NotIn);

            case @operator.between:
                return(ConditionOperator.Between);

            case @operator.notbetween:
                return(ConditionOperator.NotBetween);

            case @operator.@null:
                return(ConditionOperator.Null);

            case @operator.notnull:
                return(ConditionOperator.NotNull);

            case @operator.yesterday:
                return(ConditionOperator.Yesterday);

            case @operator.today:
                return(ConditionOperator.Today);

            case @operator.tomorrow:
                return(ConditionOperator.Tomorrow);

            case @operator.lastsevendays:
                return(ConditionOperator.Last7Days);

            case @operator.nextsevendays:
                return(ConditionOperator.Next7Days);

            case @operator.lastweek:
                return(ConditionOperator.LastWeek);

            case @operator.thisweek:
                return(ConditionOperator.ThisWeek);

            case @operator.nextweek:
                return(ConditionOperator.NextWeek);

            case @operator.lastmonth:
                return(ConditionOperator.LastMonth);

            case @operator.thismonth:
                return(ConditionOperator.ThisMonth);

            case @operator.nextmonth:
                return(ConditionOperator.NextMonth);

            case @operator.@on:
                return(ConditionOperator.On);

            case @operator.onorbefore:
                return(ConditionOperator.OnOrBefore);

            case @operator.onorafter:
                return(ConditionOperator.OnOrAfter);

            case @operator.lastyear:
                return(ConditionOperator.LastYear);

            case @operator.thisyear:
                return(ConditionOperator.ThisYear);

            case @operator.nextyear:
                return(ConditionOperator.NextYear);

            case @operator.lastxhours:
                return(ConditionOperator.LastXHours);

            case @operator.nextxhours:
                return(ConditionOperator.NextXHours);

            case @operator.lastxdays:
                return(ConditionOperator.LastXDays);

            case @operator.nextxdays:
                return(ConditionOperator.NextXDays);

            case @operator.lastxweeks:
                return(ConditionOperator.LastXWeeks);

            case @operator.nextxweeks:
                return(ConditionOperator.NextXWeeks);

            case @operator.lastxmonths:
                return(ConditionOperator.LastXMonths);

            case @operator.nextxmonths:
                return(ConditionOperator.NextXMonths);

            case @operator.olderthanxmonths:
                return(ConditionOperator.OlderThanXMonths);

            case @operator.lastxyears:
                return(ConditionOperator.LastXYears);

            case @operator.nextxyears:
                return(ConditionOperator.NextXYears);

            case @operator.equserid:
                return(ConditionOperator.EqualUserId);

            case @operator.neuserid:
                return(ConditionOperator.NotEqualUserId);

            case @operator.equserteams:
                return(ConditionOperator.EqualUserTeams);

            case @operator.eqbusinessid:
                return(ConditionOperator.EqualBusinessId);

            case @operator.nebusinessid:
                return(ConditionOperator.NotEqualBusinessId);

            case @operator.equserlanguage:
                return(ConditionOperator.EqualUserLanguage);

            case @operator.thisfiscalyear:
                return(ConditionOperator.ThisFiscalYear);

            case @operator.thisfiscalperiod:
                return(ConditionOperator.ThisFiscalPeriod);

            case @operator.nextfiscalyear:
                return(ConditionOperator.NextFiscalYear);

            case @operator.nextfiscalperiod:
                return(ConditionOperator.NextFiscalPeriod);

            case @operator.lastfiscalyear:
                return(ConditionOperator.LastFiscalYear);

            case @operator.lastfiscalperiod:
                return(ConditionOperator.LastFiscalPeriod);

            case @operator.lastxfiscalyears:
                return(ConditionOperator.LastXFiscalYears);

            case @operator.lastxfiscalperiods:
                return(ConditionOperator.LastXFiscalPeriods);

            case @operator.nextxfiscalyears:
                return(ConditionOperator.NextXFiscalYears);

            case @operator.nextxfiscalperiods:
                return(ConditionOperator.NextXFiscalPeriods);

            case @operator.infiscalyear:
                return(ConditionOperator.InFiscalYear);

            case @operator.infiscalperiod:
                return(ConditionOperator.InFiscalPeriod);

            case @operator.infiscalperiodandyear:
                return(ConditionOperator.InFiscalPeriodAndYear);

            case @operator.inorbeforefiscalperiodandyear:
                return(ConditionOperator.InOrBeforeFiscalPeriodAndYear);

            case @operator.inorafterfiscalperiodandyear:
                return(ConditionOperator.InOrAfterFiscalPeriodAndYear);

            case @operator.beginswith:
                return(ConditionOperator.BeginsWith);

            case @operator.notbeginwith:
                return(ConditionOperator.DoesNotBeginWith);

            case @operator.endswith:
                return(ConditionOperator.EndsWith);

            case @operator.notendwith:
                return(ConditionOperator.DoesNotEndWith);

            default:
                throw new NotImplementedException(op.ToString());
            }
        }
Beispiel #21
0
 public Task <int> saveOPERATOR(@operator op)
 {
     return(connection.InsertAsync(op));
 }
Beispiel #22
0
 public BinOp(expr left, @operator op, expr right, [Optional]int? lineno, [Optional]int? col_offset)
     : this()
 {
     _left = left;
     _op = op;
     _right = right;
     _lineno = lineno;
     _col_offset = col_offset;
 }
Beispiel #23
0
 public Task <int> updateOPERATOR(@operator op)
 {
     return(connection.UpdateAsync(op));
 }
Beispiel #24
0
 internal AugAssign(AugmentedAssignStatement stmt)
     : this() {
     _target = Convert(stmt.Left, Store.Instance);
     _value = Convert(stmt.Right);
     _op = (@operator)Convert(stmt.Operator);
 }
Beispiel #25
0
 public Task <int> deleteOPERATOR(@operator op)
 {
     return(connection.DeleteAsync(op));
 }
Beispiel #26
0
 internal BinOp(BinaryExpression expr, @operator op)
     : this() {
     _left = Convert(expr.Left);
     _right = Convert(expr.Right);
     _op = op;
 }
 public static bool Matches(BaseOpaqueData myOpaque, opaqueData that, @operator op)
 {
     if (that != null)
     {
         string expAscii = that.asciiValue;
         string myAscii  = myOpaque.GetAscii();
         if ((expAscii != null) && (myAscii != null))
         {
             if (op.Equals(@operator.equals))
             {
                 return(myAscii.ToUpper() == expAscii.ToUpper());
             }
             else if (op.Equals(@operator.startsWith))
             {
                 return(myAscii.StartsWith(expAscii));
             }
             else if (op.Equals(@operator.contains))
             {
                 return(myAscii.Contains(expAscii));
             }
             else if (op.Equals(@operator.endsWith))
             {
                 return(myAscii.EndsWith(expAscii));
             }
             else if (op.Equals(@operator.regExp))
             {
                 Match m = Regex.Match(myAscii, expAscii);
                 return(m.Success);
             }
             else
             {
                 log.Error("Unsupported expression operator: " + op);
                 return(false);
             }
         }
         else if ((expAscii == null) && (myAscii == null))
         {
             byte[] expHex = that.hexValue;
             byte[] myHex  = myOpaque.GetHex();
             if ((expHex != null) && (myHex != null))
             {
                 if (op.Equals(@operator.equals))
                 {
                     return(Array.Equals(myHex, expHex));
                 }
                 else if (op.Equals(@operator.startsWith))
                 {
                     if (myHex.Length >= expHex.Length)
                     {
                         for (int i = 0; i < expHex.Length; i++)
                         {
                             if (myHex[i] != expHex[i])
                             {
                                 return(false);
                             }
                         }
                         return(true);    // if we get here, it matches
                     }
                     else
                     {
                         return(false);   // exp length too long
                     }
                 }
                 else if (op.Equals(@operator.contains))
                 {
                     if (myHex.Length >= expHex.Length)
                     {
                         int j = 0;
                         for (int i = 0; i < myHex.Length; i++)
                         {
                             if (myHex[i] == expHex[j])
                             {
                                 // found a potential match
                                 j++;
                                 bool matches = true;
                                 for (int ii = i + 1; ii < myHex.Length; ii++)
                                 {
                                     if (myHex[ii] != expHex[j++])
                                     {
                                         matches = false;
                                         break;
                                     }
                                 }
                                 if (matches)
                                 {
                                     return(true);
                                 }
                                 j = 0;    // reset to start of exp
                             }
                         }
                         return(false);    // if we get here, it didn't match
                     }
                     else
                     {
                         return(false);   // exp length too long
                     }
                 }
                 else if (op.Equals(@operator.endsWith))
                 {
                     if (myHex.Length >= expHex.Length)
                     {
                         for (int i = myHex.Length - 1;
                              i >= myHex.Length - expHex.Length;
                              i--)
                         {
                             if (myHex[i] != expHex[i])
                             {
                                 return(false);
                             }
                         }
                         return(true);    // if we get here, it matches
                     }
                     else
                     {
                         return(false);   // exp length too long
                     }
                 }
                 else if (op.Equals(@operator.regExp))
                 {
                     log.Error("Regular expression operator not valid for hex opaque opaqueData");
                     return(false);
                 }
                 else
                 {
                     log.Error("Unsupported expression operator: " + op);
                     return(false);
                 }
             }
         }
     }
     return(false);
 }