Пример #1
7
        public static IType InferType(Type type, IMetadataContainer container)
        {
            Type genericTypeDefinition = type.GetGenericArguments().Any() ? type.GetGenericTypeDefinition() : type;

            if (typeof(IFunction<,>).IsAssignableFrom(genericTypeDefinition))
            {
                Type left = type.GetGenericArguments()[0];
                Type right = type.GetGenericArguments()[1];
                return new Types.ArrowType(InferType(left, container), InferType(right, container));
            }
            else if (typeof(Either<,>).IsAssignableFrom(genericTypeDefinition))
            {
                Type left = type.GetGenericArguments()[0];
                Type right = type.GetGenericArguments()[1];
                return new Types.SumType(InferType(left, container), InferType(right, container));
            }
            else if (typeof(Tuple<,>).IsAssignableFrom(genericTypeDefinition))
            {
                Type left = type.GetGenericArguments()[0];
                Type right = type.GetGenericArguments()[1];
                return new Types.ProductType(InferType(left, container), InferType(right, container));
            }
            else if (type.IsGenericParameter)
            {
                return new Types.TypeParameter(type.Name);
            }
            else
            {
                container.ResolveType(type.Name);
                var genericParameters = type.GetGenericArguments().Select(t => InferType(t, container)).ToArray();
                return new Types.TypeSynonym(type.Name, genericParameters);
            }
        }
Пример #2
0
        /// <summary>
        /// Initializes the filter.
        /// </summary>
        /// <param name="targetType">Type of the target.</param>
        /// <param name="metadataContainer">The metadata container.</param>
        /// <param name="serviceLocator">The serviceLocator.</param>
        public virtual void Initialize(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator)
        {
            _target = metadataContainer;

            if (_method != null)
            {
                return;
            }

            var methodInfo = targetType.GetMethod(_methodName,
                                                  BindingFlags.Public | BindingFlags.Instance |
                                                  BindingFlags.Static)
                             ?? targetType.GetMethod("get_" + _methodName,
                                                     BindingFlags.Public | BindingFlags.Instance |
                                                     BindingFlags.Static);

            if (methodInfo == null)
            {
                throw new Exception(
                          string.Format("Method or property '{0}' could not be found on '{1}'.", _methodName, targetType.FullName)
                          );
            }

            _method = serviceLocator.GetInstance <IMethodFactory>().CreateFrom(methodInfo);
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FilterManager"/> class.
        /// </summary>
        /// <param name="targetType">Type of the target.</param>
        /// <param name="metadataContainer">The metadata container.</param>
        /// <param name="serviceLocator">The serviceLocator.</param>
        public FilterManager(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator)
        {
            _targetType        = targetType;
            _metadataContainer = metadataContainer;
            _serviceLocator    = serviceLocator;

            var filters = metadataContainer.GetMatchingMetadata <IFilter>()
                          .OrderByDescending(x => x.Priority);

            filters.OfType <IInitializable>()
            .Apply(x => x.Initialize(targetType, metadataContainer, serviceLocator));

            _handlerAware = filters.OfType <IHandlerAware>().ToArray();

            _preExecute = filters.OfType <IPreProcessor>().ToArray();

            _triggerEffects =
                (from filter in _preExecute
                 where filter.AffectsTriggers
                 select filter).ToArray();

            _postExecute = filters.OfType <IPostProcessor>().ToArray();

            _rescues = filters.OfType <IRescue>().ToArray();
        }
Пример #4
0
 /// <summary>
 /// Initializes the filter.
 /// </summary>
 /// <param name="targetType">Type of the target.</param>
 /// <param name="metadataContainer">The metadata container.</param>
 /// <param name="serviceLocator">The serviceLocator.</param>
 public void Initialize(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator)
 {
     if (_method == null)
     {
         _method = serviceLocator.GetInstance <IMethodFactory>().CreateFrom(_methodName.AsMethodInfo(targetType));
     }
 }
Пример #5
0
        /// <summary>
        /// Dump the initial items provided.
        /// Overridden in ParallelConsoleLogger.
        /// </summary>
        internal virtual void OutputItems(string itemType, ArrayList itemTypeList)
        {
            WriteItemType(itemType);

            foreach (var item in itemTypeList)
            {
                string itemSpec = item switch
                {
                    ITaskItem taskItem => taskItem.ItemSpec,
                    IItem iitem => iitem.EvaluatedInclude,
                    { } misc => Convert.ToString(misc),
                    null => "null"
                };

                WriteItemSpec(itemSpec);

                var metadata = item switch
                {
                    IMetadataContainer metadataContainer => metadataContainer.EnumerateMetadata(),
                    IItem <ProjectMetadata> iitem => iitem.Metadata?.Select(m => new KeyValuePair <string, string>(m.Name, m.EvaluatedValue)),
                    _ => null
                };

                if (metadata != null)
                {
                    foreach (var metadatum in metadata)
                    {
                        WriteMetadata(metadatum.Key, metadatum.Value);
                    }
                }
            }

            resetColor();
        }
Пример #6
0
        /// <summary>
        /// Initializes the filter.
        /// </summary>
        /// <param name="targetType">Type of the target.</param>
        /// <param name="metadataContainer">The metadata container.</param>
        /// <param name="serviceLocator">The service locator.</param>
        public virtual void Initialize(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator)
        {
            if (!Callback.IsNullOrEmpty())
            {
                var methodInfo = targetType.GetMethod(Callback,
                                                      BindingFlags.Public | BindingFlags.Instance |
                                                      BindingFlags.Static);

                if (methodInfo == null)
                {
                    throw new Exception(string.Format("Method '{0}' could not be found on '{1}'.", Callback,
                                                      targetType.FullName));
                }

                _callback = serviceLocator.GetInstance <IMethodFactory>().CreateFrom(methodInfo);
            }
            if (!Before.IsNullOrEmpty())
            {
                var methodInfo = targetType.GetMethod(Before,
                                                      BindingFlags.Public | BindingFlags.Instance |
                                                      BindingFlags.Static);

                if (methodInfo == null)
                {
                    throw new Exception(string.Format("Method '{0}' could not be found on '{1}'.", Before,
                                                      targetType.FullName));
                }

                BeforeMethod = serviceLocator.GetInstance <IMethodFactory>().CreateFrom(methodInfo);
            }
        }
Пример #7
0
        public static IType InferFunctorFromFiniteType(MethodInfo cataMethod, string variableName, IMetadataContainer container)
        {
            var algebraType = cataMethod.GetParameters()[0].ParameterType;
            var fCarrierType = algebraType.GetGenericArguments()[0];

            return InferFunctor(fCarrierType, variableName, Constants.CataMethodGenericParameterName, container);
        }
Пример #8
0
        /// <summary>
        /// Gets the view from metadata.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="container">The container.</param>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        public static T GetView <T>(this IMetadataContainer container, object context)
        {
            var viewMetadata = container.GetMetadata <ViewMetadata>();

            return(viewMetadata == null
                       ? default(T)
                       : viewMetadata.GetView <T>(context));
        }
Пример #9
0
        public static IType InferFunctorFromInfiniteType(MethodInfo applyMethod, string variableName, IMetadataContainer container)
        {
            var functionType = applyMethod.GetParameters()[0];
            var functionTypeApplyMethod = functionType.ParameterType.GetMethod(Constants.ApplyMethodName);
            var generator = functionTypeApplyMethod.GetParameters()[1];
            var fCarrierType = generator.ParameterType.GetGenericArguments()[1];

            return InferFunctor(fCarrierType, variableName, Constants.ApplyMethodGenericParameterName, container);
        }
Пример #10
0
 public UserStatusCardViewModel(IUserProfileContainer userProfileContainer, IMetadataContainer metadataContainer)
 {
     _userProfileContainer = userProfileContainer;
     _metadataContainer    = metadataContainer;
     this.WhenActivated((d) =>
     {
         _userProfileContainer.Changes.DistinctUntilChanged(new UserStateStatusEqualityComparer()).SubscribeOn(RxApp.TaskpoolScheduler).ObserveOn(RxApp.MainThreadScheduler).Subscribe(HandleProfileModelChanged).DisposeWith(d);
     });
 }
Пример #11
0
 public PurityCompiler(ModuleBuilder module, TypeBuilder dataClass, IMetadataContainer container,
     IRuntimeContainer runtimeContainer)
 {
     this.module = module;
     this.dataClass = dataClass;
     this.container = container;
     this.runtimeContainer = runtimeContainer;
     this.typeChecker = new TypeChecker(container);
     this.moduleImporter = new ModuleImporter(container, runtimeContainer);
 }
Пример #12
0
 public void Merge(IMetadataContainer metadata)
 {
     foreach (var kv in metadata)
     {
         if (!ContainsKey(kv.Key))
         {
             Add(kv.Key, kv.Value);
         }
     }
 }
 public HealthStatusAdviceViewModel(IUserProfileContainer userProfileContainer, IMetadataContainer metadataContainer)
 {
     _userProfileContainer = userProfileContainer;
     _metadataContainer    = metadataContainer;
     MoreInfoCommand       = ReactiveUI.ReactiveCommand.CreateFromTask(ShowMoreInfoAsync);
     this.WhenActivated((d) =>
     {
         _userProfileContainer.Changes.DistinctUntilChanged(new UserStateStatusEqualityComparer()).SubscribeOn(RxApp.TaskpoolScheduler).ObserveOn(RxApp.MainThreadScheduler).Subscribe(HandleProfileModelChanged).DisposeWith(d);
     });
 }
Пример #14
0
        /// <summary>
        /// Stores the view in metadata.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="view">The view.</param>
        /// <param name="context">The context.</param>
        /// <param name="useWeakReference">Indicates whether the view should be referenced weakly.</param>
        public static void SetView(this IMetadataContainer container, object view, object context, bool useWeakReference)
        {
            var viewMetadata = container.GetMetadata <ViewMetadata>();

            if (viewMetadata == null)
            {
                viewMetadata = new ViewMetadata();
                container.AddMetadata(viewMetadata);
            }

            viewMetadata.SetView(view, context, useWeakReference);
        }
Пример #15
0
 public AuthenticationInfoService(
     IUserProfileContainer userProfileContainer,
     IAccountContainer accountContainer,
     ISessionContainer sessionContainer,
     IMetadataContainer metadataContainer,
     ILoggerFactory loggerFactory)
 {
     _userProfileContainer = userProfileContainer;
     _accountContainer     = accountContainer;
     _sessionContainer     = sessionContainer;
     _metadataContainer    = metadataContainer;
     _logger = loggerFactory.CreateLogger <AuthenticationInfoService>();
 }
Пример #16
0
        private static void UpdateContainerFromAttributes(IMetadataContainer target, [CanBeNull] MemberInfo mi)
        {
            if (mi == null)
            {
                return;
            }
            var atts = mi.GetCustomAttributes(false).OfType <UmlAddMetaAttribute>();

            foreach (var attribute in atts)
            {
                target.Metadata[attribute.Name] = attribute.ValueString;
            }
        }
Пример #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FilterManager"/> class.
        /// </summary>
        /// <param name="serviceLocator">The service locator.</param>
        /// <param name="preExecute">The pre execute.</param>
        /// <param name="triggerEffects">The trigger effects.</param>
        /// <param name="postExecute">The post execute.</param>
        /// <param name="instanceAwareFilters">The instance aware.</param>
        /// <param name="rescues">The rescues</param>
        /// <param name="targetType">The target type.</param>
        /// <param name="metadataContainer">The metadatacontainer.</param>
        private FilterManager(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator,
                              IEnumerable <IPreProcessor> preExecute, IEnumerable <IPreProcessor> triggerEffects,
                              IEnumerable <IPostProcessor> postExecute, IEnumerable <IHandlerAware> instanceAwareFilters, IEnumerable <IRescue> rescues)
        {
            _targetType        = targetType;
            _metadataContainer = metadataContainer;
            _serviceLocator    = serviceLocator;

            _preExecute     = preExecute.ToArray();
            _triggerEffects = triggerEffects.ToArray();
            _postExecute    = postExecute.ToArray();
            _handlerAware   = instanceAwareFilters.ToArray();
            _rescues        = rescues.ToArray();
        }
Пример #18
0
        /// <summary>
        /// Initializes the filter.
        /// </summary>
        /// <param name="targetType">Type of the target.</param>
        /// <param name="metadataContainer">The metadata container.</param>
        /// <param name="serviceLocator">The service locator.</param>
        public virtual void Initialize(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator)
        {
            if(string.IsNullOrEmpty(Callback)) return;

            var methodInfo = targetType.GetMethod(Callback,
                                                  BindingFlags.Public | BindingFlags.Instance |
                                                  BindingFlags.Static);

            if(methodInfo == null)
                throw new Exception(string.Format("Method '{0}' could not be found on '{1}'.", Callback,
                                                  targetType.FullName));

            _callback = serviceLocator.GetInstance<IMethodFactory>().CreateFrom(methodInfo);
        }
        public MedicalChangeStatusViewModel(
            INavigationService navigationService,
            IMedicalChangeStatusService medicalChangeStatusService,
            IMedicalCodeSharingRoute medicalCodeSharingRoute,
            IErrorHandler errorHandler,
            IMetadataContainer metadataContainer)
        {
            _navigationService          = navigationService;
            _medicalChangeStatusService = medicalChangeStatusService;
            _medicalCodeSharingRoute    = medicalCodeSharingRoute;
            _errorHandler      = errorHandler;
            _metadataContainer = metadataContainer;

            InitStatusCommand = ReactiveCommand.CreateFromTask(HandleApplyStatusCommandAsync);
        }
Пример #20
0
 public MetadataService(
     IMetadataContainer metadataContainer,
     IUserProfileContainer userProfileContainer,
     IPlatformClient platformClient,
     IErrorResponseHandler serviceErrorHandler,
     IConnectivityService connectivityService,
     ILoggerFactory loggerFactory)
 {
     _metadataContainer    = metadataContainer;
     _userProfileContainer = userProfileContainer;
     _platformClient       = platformClient;
     _serviceErrorHandler  = serviceErrorHandler;
     _connectivityService  = connectivityService;
     _logger = loggerFactory.CreateLogger <UserService>();
 }
 public UserStatusChangeService(
     IPlatformClient platformClient,
     ILoggerFactory loggerFactory,
     IConnectivityService connectivityService,
     IMeetingsService meetingsService,
     IUserStatusChangeServiceErrorHandler serviceErrorHandler,
     IUserProfileContainer userProfileContainer,
     IMetadataContainer metadataContainer)
 {
     _platformClient = platformClient;
     _connectivityService = connectivityService;
     _meetingsService = meetingsService;
     _logger = loggerFactory.CreateLogger<UserStatusChangeService>();
     _serviceErrorHandler = serviceErrorHandler;
     _userProfileContainer = userProfileContainer;
     _metadataContainer = metadataContainer;
 }
Пример #22
0
        public static Dictionary <string, string> GetAllMetadata(this IMetadataContainer container)
        {
            var count = container.GetMetadataCount();

            if (count < 0)
            {
                throw new ArgumentException("Metadata container does not support iteration");
            }
            var output = new Dictionary <string, string>();

            for (var i = 0; i < count; i++)
            {
                string key = container.GetKeyByIndex(i);
                output[key] = container.GetMetadata(key);
            }
            return(output);
        }
Пример #23
0
        public static string TryGetStringMetadata(this IMetadataContainer container, string key)
        {
            if (container == null)
            {
                return(null);
            }
            if (!container.Metadata.TryGetValue(key, out var x))
            {
                return(null);
            }
            switch (x)
            {
            case string s: return(s);

            case null: return(null);
            }

            return(x.ToString());
        }
Пример #24
0
        /// <summary>
        /// Initializes the filter.
        /// </summary>
        /// <param name="targetType">Type of the target.</param>
        /// <param name="metadataContainer">The metadata container.</param>
        /// <param name="serviceLocator">The serviceLocator.</param>
        public virtual void Initialize(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator)
        {
            _target = metadataContainer;

            if(_method != null)
                return;

            var methodInfo = targetType.GetMethod(_methodName,
                                                  BindingFlags.Public | BindingFlags.Instance |
                                                  BindingFlags.Static)
                             ?? targetType.GetMethod("get_" + _methodName,
                                                     BindingFlags.Public | BindingFlags.Instance |
                                                     BindingFlags.Static);

            if (methodInfo == null)
                throw new Exception(
                    string.Format("Method or property '{0}' could not be found on '{1}'.", _methodName, targetType.FullName)
                    );

            _method = serviceLocator.GetInstance<IMethodFactory>().CreateFrom(methodInfo);
        }
Пример #25
0
        public static void Compile(string name, TypeBuilder dataClass, ConstructorInfo ctor, IType type, 
            string[] typeParameters, IMetadataContainer container, IRuntimeContainer runtimeContainer)
        {
            var method = dataClass.DefineMethod(name,
                 MethodAttributes.Public | MethodAttributes.Static, null, Type.EmptyTypes);

            if (typeParameters.Any())
            {
                method.DefineGenericParameters(typeParameters.ToArray());
            }

            var converter = new TypeConverter(runtimeContainer, method.GetGenericArguments());
            var converted = converter.Convert(type);
            method.SetReturnType(converted);

            var body = method.GetILGenerator();

            if (typeParameters.Any())
            {
                body.Emit(OpCodes.Newobj, TypeBuilder.GetConstructor(ctor.DeclaringType.MakeGenericType(method.GetGenericArguments()), ctor));
            }
            else
            {
                body.Emit(OpCodes.Newobj, ctor);
            }

            body.Emit(OpCodes.Ret);

            runtimeContainer.Add(name, method);

            var dataDecl = new DataDeclaration(type, null);
            dataDecl.TypeParameters = typeParameters;
            container.Add(name, dataDecl);

            RemoveFirstParameter(name, dataClass, method, new IType[0], type, typeParameters, runtimeContainer);
        }
Пример #26
0
        public static void Compile(string name, TypeBuilder dataClass, ITypedExpression typedExpression,
            DataDeclaration data, IMetadataContainer container, IRuntimeContainer runtimeContainer)
        {
            var method = dataClass.DefineMethod(name,
                MethodAttributes.Public | MethodAttributes.Static, null, Type.EmptyTypes);

            if (data.TypeParameters.Any())
            {
                method.DefineGenericParameters(data.TypeParameters.ToArray());
            }

            var converter = new TypeConverter(runtimeContainer, method.GetGenericArguments());
            var converted = converter.Convert(data.Type);
            method.SetReturnType(converted);

            var body = method.GetILGenerator();
            typedExpression.AcceptVisitor(new DataCompiler(body, method.GetGenericArguments(), runtimeContainer));
            body.Emit(OpCodes.Ret);

            container.Add(name, data);
            runtimeContainer.Add(name, method);

            RemoveFirstParameter(name, dataClass, method, new IType[0], data.Type, data.TypeParameters, runtimeContainer);
        }
Пример #27
0
 public void Initialize(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator)
 {
 }
Пример #28
0
 /// <summary>
 /// Initializes the filter.
 /// </summary>
 /// <param name="targetType">Type of the target.</param>
 /// <param name="metadataContainer">The metadata container.</param>
 /// <param name="serviceLocator">The serviceLocator.</param>
 public void Initialize(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator)
 {
     if (_method == null)
         _method = serviceLocator.GetInstance<IMethodFactory>().CreateFrom(_methodName.AsMethodInfo(targetType));
 }
Пример #29
0
 public AbstractionElimination(IMetadataContainer container)
 {
     this.container = container;
 }
Пример #30
0
 public ModuleImporter(IMetadataContainer container, IRuntimeContainer runtimeContainer)
 {
     this.container = container;
     this.runtimeContainer = runtimeContainer;
 }
Пример #31
0
 /// <summary>
 /// Initializes the filter.
 /// </summary>
 /// <param name="targetType">Type of the target.</param>
 /// <param name="metadataContainer">The metadata container.</param>
 /// <param name="serviceLocator">The serviceLocator.</param>
 public void Initialize(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator)
 {
     _target = metadataContainer;
     _methodFactory = serviceLocator.GetInstance<IMethodFactory>();
 }
Пример #32
0
        public static List<FunctionEntity> CreateViewEntity(DependencyObjectCollection collFunc,ServiceComponent service) {
            var group = collFunc.GroupBy(c => new { FUNCTION_INFO_NAME = c["FUNCTION_INFO_NAME"].ToStringExtension(),
                                                    FUNCTION_INFO_DISPLAY_NAME = c["FUNCTION_INFO_DISPLAY_NAME"].ToStringExtension(),
                                                    FUNCTION_INFO_CLASS = c["FUNCTION_INFO_CLASS"].ToStringExtension(),
                                                    FUNCTION_INFO_CLASS_NAME = c["FUNCTION_INFO_CLASS_NAME"].ToStringExtension(),
                                                    FUNCTION_EXPLAIN = c["FUNCTION_EXPLAIN"].ToStringExtension()
            });
            List<FunctionEntity> list = new List<FunctionEntity>();
            IQueryProjectContainer srv = service.GetService<IQueryProjectContainer>("TFL");
            IMetadataContainer mc = service.GetService<IMetadataContainer>();
            Regex regNum = new Regex("^[0-9]");  //参数不能以数字开头的校验

            foreach (var item in group) {
                FunctionEntity entity = new FunctionEntity() { Name = item.Key.FUNCTION_INFO_NAME, DisplayName = item.Key.FUNCTION_INFO_DISPLAY_NAME, Description = item.Key.FUNCTION_EXPLAIN, Category = item.Key.FUNCTION_INFO_CLASS_NAME };
                foreach (var sub in item) {
                    if (Maths.IsEmpty(sub["FUNCTION_INFO_D_ID"]))  //没有参数
                        continue;
                    if(regNum.IsMatch(sub["PARAMETER_CODE"].ToStringExtension()))  //参数不能以数字开头
                        continue;

                    ParaEntity para = new ParaEntity();
                    para.Name = sub["PARAMETER_CODE"].ToStringExtension();
                    para.DisplayName = sub["PARAMETER_NAME"].ToStringExtension();
                    para.OffSet = sub["PLACEHOLDER"].ToStringExtension();
                    int index = para.Name.IndexOf(".");
                    if (index > -1) {
                        para.PropertyName = para.Name.Replace('.', '_');  //带上表明前缀 以防止有相同的属性名参数但是表明不一样(a.Status,b.Status),导致后续跟进参数注册属性会报错,不能注册相同的参数
                    } else {   //可能存在查询单一表情况,不带别名的
                        para.PropertyName = para.Name;
                    }
                    para.SecondPropertyName = para.PropertyName + "2";

                    para.ControlType = (ControlTypeEnum)sub["CONTROL_TYPE"].ToInt32();  //控件类型 1.录入框  2.开窗 3.下拉框 4.日期框
                    para.ParaTypeFlag = (ParaTypeEnum)sub["PARAMETER_VALUE_TYPE"].ToInt32(); //参数值类型 1.String 2.Integer 3.Double 4.Boolean 5.Date 6.DateTime
                    if (Maths.IsNotEmpty(sub["ORGANIZATION_TYPE"].ToStringExtension())) {
                        para.OrgType = (OrgnizationType)(Enum.Parse(typeof(OrgnizationType), sub["ORGANIZATION_TYPE"].ToStringExtension()));  //组织类型 1.公司 2.销售域 3.采购域 4.服务域  5.工厂 6.部门 7.工作中心
                    } else {
                        para.OrgType = OrgnizationType.Empty;
                    }
                    para.QueryTypeKey = sub["WINDOW_TYPEKEY"].ToStringExtension();  //开窗typekey

                    OperParaProName(0, para, sub, mc, srv);
                    int count = GetTheSameCount(entity, para.PropertyName);
                    if (count > 0) {
                        OperParaProName(count, para, sub, mc, srv);
                    }

                    para.ConditionName = "Condition_" + para.PropertyName;
                    para.Conditions = sub["CONDITIONS"].ToStringExtension();
                    if ((para.ControlType == ControlTypeEnum.SelectControl && para.OrgType == OrgnizationType.COMPANY)) {//组织类型为公司的开窗参数才需要添加当前条件项
                        if (Maths.IsNotEmpty(para.Conditions)) {
                            para.Conditions = para.Conditions.Insert(0, "Current;");
                        } else {
                            para.Conditions = "Current";
                        }
                    }
                    if ((para.ParaTypeFlag == ParaTypeEnum.String && para.ControlType == ControlTypeEnum.Input)) {//录入框类的string类型,要添加引用单元格条件项
                        if (Maths.IsNotEmpty(para.Conditions)) {
                            para.Conditions += ";ExcelCell";
                        } else {
                            para.Conditions = "ExcelCell";
                        }
                    }
                    string[] conditions = para.Conditions.Split(';');
                    if (conditions.Length > 0 && Maths.IsNotEmpty(conditions[0])) {
                        para.Operator = GetConditionCompareEnumValue(conditions[0]);
                    }

                    ParaEntity tmpP = entity.ParaList.FirstOrDefault(c => c.PropertyName == para.PropertyName);
                    if (tmpP == null) {  //不能有相同的参数
                        entity.ParaList.Add(para);
                    }

                }

                list.Add(entity);
            }

            return list;
        }
Пример #33
0
        private static void OperParaProName(int existCount, ParaEntity para, DependencyObject sub, IMetadataContainer mc, IQueryProjectContainer srv) {
            string name = para.Name;
            string extendFix = string.Empty;
            if (existCount > 0) {
                extendFix = "X" + (existCount + 1);  //后续以X+流水
                name = name + extendFix;
            }
            int index = name.IndexOf(".");
            if (index > -1) {
                para.PropertyName = name.Replace('.', '_');  //带上表明前缀 以防止有相同的属性名参数但是表明不一样(a.Status,b.Status),导致后续跟进参数注册属性会报错,不能注册相同的参数
            } else {   //可能存在查询单一表情况,不带别名的
                para.PropertyName = name;
            }
            para.SecondPropertyName = para.PropertyName + "2";
            if (para.ControlType == ControlTypeEnum.PickList) {
                para.PickListTypeName = sub["CONTROL_CODE"].ToStringExtension();
                if (para.PickListTypeName != string.Empty) {
                    var pick = mc.GetPickListTypeElement(para.PickListTypeName);
                    if (pick != null) {
                        //para.Tip = pick.DisplayName; //20170829 mark by shenbao for P001-170829002
                        LocalizableString localStr = new LocalizableString(pick.DisplayName); //20170829 add by shenbao for P001-170829002
                        para.Tip = localStr[System.Globalization.CultureInfo.CurrentUICulture.ThreeLetterWindowsLanguageName]; //20170829 add by shenbao for P001-170829002
                    }
                }
            } else if (para.ControlType == ControlTypeEnum.SelectControl) {
                para.QueryProjectId = sub["CONTROL_CODE"].ToStringExtension();
                QueryProject qp = srv.QueryProjects.FirstOrDefault(c => c.Id == para.QueryProjectId) as QueryProject;
                string idColumn = string.Empty;
                if (qp != null) {
                    idColumn = qp.ContextDataColumn;
                    para.Tip = qp.DisplayName;
                } else {
                    idColumn = "KEY_FIELD_ID";  //理论上永远不会走到这里,除非FINCTION_INFO没有配置开窗编号,或者这个编号是错误的
                }
                para.TargetEntityPirmaryKeyID = idColumn;
                if (index >= 0) {
                    para.PropertyName = name.Substring(0, index) + "_" + idColumn + extendFix;  //如果是开窗类型,则需要重新设置PropertyName,为ID字段
                } else {
                    para.PropertyName = idColumn + extendFix;
                }
                para.SecondPropertyName = para.PropertyName + "2";

            }
        }
Пример #34
0
 public void Initialize(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator)
 {
     _methodName.AsMethodInfo(targetType).SaftyInvoke(m => _prepareMethod = serviceLocator.GetInstance<IMethodFactory>().CreateFrom(m));
     _callback.AsMethodInfo(targetType).SaftyInvoke(m => _callbackMethod = serviceLocator.GetInstance<IMethodFactory>().CreateFrom(m));
 }
Пример #35
0
 public void Initialize(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator)
 {
     _methodName.AsMethodInfo(targetType).SaftyInvoke(m => _prepareMethod = serviceLocator.GetInstance <IMethodFactory>().CreateFrom(m));
     _callback.AsMethodInfo(targetType).SaftyInvoke(m => _callbackMethod  = serviceLocator.GetInstance <IMethodFactory>().CreateFrom(m));
 }
 void IInitializable.Initialize(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator)
 {
     _runningActionPresenter = serviceLocator.GetInstance<IRunningActionsRegistry>();
 }
Пример #37
0
 public TypeChecker(IMetadataContainer container)
 {
     this.container = container;
 }
Пример #38
0
 public void Initialize(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator)
 {
 }
Пример #39
0
 /// <summary>
 /// Initializes the filter.
 /// </summary>
 /// <param name="targetType">Type of the target.</param>
 /// <param name="metadataContainer">The metadata container.</param>
 /// <param name="serviceLocator">The serviceLocator.</param>
 public override void Initialize(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator)
 {
     base.Initialize(targetType, metadataContainer, serviceLocator);
     _methodFactory = serviceLocator.GetInstance<IMethodFactory>();
 }
Пример #40
0
 public Evaluator(ModuleBuilder module, IMetadataContainer container, IRuntimeContainer runtimeContainer)
 {
     this.module = module;
     this.container = container;
     this.runtimeContainer = runtimeContainer;
 }
Пример #41
0
 /// <summary>
 /// Initializes the filter.
 /// </summary>
 /// <param name="targetType">Type of the target.</param>
 /// <param name="metadataContainer">The metadata container.</param>
 /// <param name="serviceLocator">The serviceLocator.</param>
 public void Initialize(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator)
 {
     _target        = metadataContainer;
     _methodFactory = serviceLocator.GetInstance <IMethodFactory>();
 }
Пример #42
0
 /// <summary>
 /// Initializes the filter.
 /// </summary>
 /// <param name="targetType">Type of the target.</param>
 /// <param name="metadataContainer">The metadata container.</param>
 /// <param name="serviceLocator">The serviceLocator.</param>
 public override void Initialize(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator)
 {
     base.Initialize(targetType, metadataContainer, serviceLocator);
     _methodFactory = serviceLocator.GetInstance <IMethodFactory>();
 }