Пример #1
0
 public Notification(NotificationLevel level, IllegalType type, string message, string statement)
 {
     this.notificationLevel     = level;
     this.notificationType      = type;
     this.notificationMessage   = message;
     this.notificationStatement = statement;
 }
 //public static string GetDepartment(string oldvalue)
 //{
 //    string value = ConfigManage.dbConfig.Department.Where(p => p.Split('|')[0] == oldvalue).FirstOrDefault();
 //    if (string.IsNullOrEmpty(value))
 //    {
 //        return oldvalue;
 //    }
 //    return value;
 //    //if (string.IsNullOrEmpty(oldId))
 //    //    return "420100000000";
 //    //switch (oldId)
 //    //{
 //    //    case "420107000000": return "d3501e59145f4c0a9fb2517a370b5410";
 //    //    case "420108000000": return "9d2540ba8bae4b2fb840ae51e8112766";
 //    //    case "420111000000": return "4a64330e91094c229d472f9353a13682";
 //    //    case "420112000000": return "4d74d519a0b64ecfb151df5c2244f5e0";
 //    //    case "420114000000": return "edbc63955f2043b4857e4e6eb7b0c828";
 //    //    case "420105005700": return "fa8f0a01a27746dbb89db1837354f1e0";
 //    //    case "420115000000": return "09e38c9e88924b50a6dffce23f7ead80";
 //    //    case "420116000000": return "00aa0edcec344a05be58d02069443eca";
 //    //    case "420117000000": return "0119efdbfcf7420aa69cdbf73c7f92ca";
 //    //    case "420118000000": return "b2ee108afd37418b8e1933047891a619";
 //    //    case "420119000000": return "80666e3ffde0415b8f5eb54cfe02b1b2";
 //    //    case "420128000000": return "939566b7b65548cf888f6e37c04f99f0";
 //    //    case "420129000000": return "bf4c7efae72a460eb12bb1bfef6346fb";
 //    //    case "420130000010": return "99cd81bfef2f4f88aea4f0e0f98508d5";
 //    //    case "420132000000": return "5ef648a73c504f71a781179f7330d268";
 //    //    case "420140000000": return "a84f79196e8c4ebd9dc8907c5816e94b";
 //    //    case "420102000000": return "0ee7e92dfd234d84aa21852280bca19a";
 //    //    case "420103000000": return "5ab17acd6a734d7b9c9c7fbb01f522c6";
 //    //    case "420105000000": return "164c6f9dfd5d4afdae06c65a7de641fe";
 //    //    case "420104000000": return "bdcf94408a0542339c88fb96578b87c2";
 //    //    case "420106000000": return "cfbec31cc65947a5b690fc09a886460d";
 //    //    case "420100000000": return "420100000000";
 //    //    default: return oldId;
 //    //}
 //}
 //public static string GetPlateType(string oldvalue)
 //{
 //    string value = ConfigManage.dbConfig.PlateType.Where(p => p.Split('|')[0] == oldvalue).FirstOrDefault();
 //    if (string.IsNullOrEmpty(value))
 //    {
 //        return oldvalue;
 //    }
 //    return value;
 //}
 //public static string GetPlateColor(string oldvalue)
 //{
 //    string value = ConfigManage.dbConfig.PlateColor.Where(p => p.Split('|')[0] == oldvalue).FirstOrDefault();
 //    if (string.IsNullOrEmpty(value))
 //    {
 //        return oldvalue;
 //    }
 //    return value;
 //    //if (string.IsNullOrEmpty(oldvalue))
 //    //    return "9";
 //    //switch (oldvalue)
 //    //{
 //    //    case "420100000000000128": return "2";
 //    //    case "420100000000000129": return "3";
 //    //    case "26": return "0";
 //    //    case "27": return "1";
 //    //    case "28": return "2";
 //    //    case "29": return "3";
 //    //    case "30": return "9";
 //    //    case "420100000000000125": return "0";
 //    //    case "420100000000000127": return "1";
 //    //    default: return oldvalue;
 //    //}
 //}
 public static string GetIllegalCode(string LegalizeIllegalTypeNo, string illegaltypeid)
 {
     IllegalType type = typeList.Where(p => p.IllegalCode == LegalizeIllegalTypeNo).FirstOrDefault();
     if (type == null)
         return illegaltypeid;
     return type.IllegalTypeNo;
 }
        private Expression ReturnIllegal(Expression expr, Expression ignoredExpression, IllegalType illegalType)
        {
            IsIllegal = true;

            if (strict)
            {
                throw Error.UnsupportedFilterExpression(expr, ignoredExpression, illegalType);
            }

            //if expr is null, the WHOLE THING was illegal (e.g. prop1 == prop1), so just forget it
            if (expr != null && ignoredExpression != null && illegalType != IllegalType.OrDifferentProperty)
            {
                illegalIgnoredExpressions.Add(ignoredExpression);
            }

            //If expr is null, that indicates we don't have a PropertyExpression (because we've got an AndAlso BinaryExpression
            //inside a Select(). In which case, just return the original ignoredExpression
            return(expr ?? ignoredExpression);
        }
Пример #4
0
        internal static Exception UnsupportedFilterExpression(Expression expr, Expression ignoredExpression, IllegalType illegalType)
        {
            var exprProperties        = ExpressionSearcher.Search <PropertyExpression>(expr).Cast <PropertyExpression>().ToList();
            var ignoredExprProperties = ExpressionSearcher.Search <PropertyExpression>(ignoredExpression).Cast <PropertyExpression>().ToList();

            switch (illegalType)
            {
            //We don't reach this case because we always throw based on having multiple PropertyExpressions before
            //we can actually determine both expressions were the same
            case IllegalType.LeftRightSameProperty:
                if (ignoredExprProperties.Count == 0)
                {
                    return(new NotSupportedException(string.Format(unsupportedFilterExpression_LeftRightZero, Clean(ignoredExpression))));
                }

                return(new NotSupportedException(string.Format(
                                                     unsupportedFilterExpression_LeftRightSame,
                                                     ignoredExprProperties.First().PropertyInfo.Name,
                                                     Clean(ignoredExpression),
                                                     ignoredExpression.GetType()
                                                     )));

            case IllegalType.NotSingleProperty:
                return(new NotSupportedException(string.Format(
                                                     unsupportedFilterExpression_NoProperty,
                                                     Clean(ignoredExpression)
                                                     )));

            case IllegalType.AndSameProperty:
                return(new NotSupportedException(string.Format(unsupportedFilterExpression_AndSame, exprProperties.Single().PropertyInfo.Name)));

            case IllegalType.OrDifferentProperty:
                return(new NotSupportedException(string.Format(
                                                     unsupportedFilterExpression_OrMultiple,
                                                     exprProperties.Single().PropertyInfo.Name,
                                                     ignoredExprProperties.Single().PropertyInfo.Name
                                                     )));

            case IllegalType.ExclusiveOr:
                return(new NotSupportedException(string.Format(
                                                     unsupportedFilterExpression_ExclusiveOr,
                                                     exprProperties.Single().PropertyInfo.Name
                                                     )));
            }

            throw new NotImplementedException($"Don't know how to handle illegal type '{illegalType}'");
        }
Пример #5
0
 public void Add(NotificationLevel level, IllegalType type, string message, string statement)
 {
     notificationList.Add(new Notification(level, type, message, statement));
 }