• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Definitions.IProcessDefinition类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Cebos.Veyron.Library.Process.Publisher.Definitions.IProcessDefinition的典型用法代码示例。如果您正苦于以下问题:C# IProcessDefinition类的具体用法?C# IProcessDefinition怎么用?C# IProcessDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IProcessDefinition类属于Cebos.Veyron.Library.Process.Publisher.Definitions命名空间,在下文中一共展示了IProcessDefinition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AddMetricsClassFetchMethods

        /// <summary>
        /// Adds the metrics class fetch methods.
        /// </summary>
        /// <param name="assemblyCode">The assembly code.</param>
        /// <param name="process">The process.</param>
        protected override void AddMetricsClassFetchMethods(StringBuilder assemblyCode, IProcessDefinition process)
        {

        }
开发者ID:mparsin,项目名称:Elements,代码行数:9,代码来源:ServerAssemblyGenerator.cs


示例2: generateLoadSecurityProperties

        /// <summary>
        /// Generates the load security properties.
        /// </summary>
        /// <param name="process">The process.</param>
        /// <returns>System.String.</returns>
        private string generateLoadSecurityProperties(IProcessDefinition process)
        {
            var list = new List<string>
                           {
                               string.Format(
                                   @"
            if (!CanReadProperty(""{0}""))
                accessDeniedList.Add(""{0}"");", Constants.DerivedProcessDisplayNameColumnName)
                           };

            foreach (var field in process.RootTable.FieldList.Where(x => !x.IsHidden && x.IncludeInList && x.ColumnType != ColumnTypes.MultiReference))
            {
                if (field.ColumnName == Constants.IdColumnName || field.ColumnName == Constants.CurrentStateColumnName || field.ColumnName == Constants.DerivedProcessColumnName)
                    continue;

                var prop = string.Format(@"
            if (!CanReadProperty(""{0}""))
                accessDeniedList.Add(""{0}"");", field.ColumnName);

                list.Add(prop);
            }

            foreach (var field in process.RootTable.FieldList.Where(f => !f.IsHidden && f.IncludeInList && f.ColumnType == ColumnTypes.MultiReference))
                list.Add(string.Format(
                    @"
            if (!CanReadProperty(""{0}""))
                accessDeniedList.Add(""{0}"");
            ", field.ColumnName));

            if (process.HasBaseClass)
                list.Add(string.Format(@"
            BaseInfo.SetInheritanceContext(this);
            var baseAccessDeniedList = BaseInfo.CalculateAccessDeniedList(reader);
            foreach (var s in baseAccessDeniedList)
                accessDeniedList.Add(s);
"));

            return string.Join(Environment.NewLine, list);
        }
开发者ID:mparsin,项目名称:Elements,代码行数:44,代码来源:ServerAssemblyGenerator.cs


示例3: AddUrlCallDefinition

        /// <summary>
        /// Adds the URL call definition.
        /// </summary>
        /// <param name="assemblyCode">
        /// The assembly code.
        /// </param>
        /// <param name="process">
        /// The process.
        /// </param>
        /// <param name="callDefinition">
        /// The call definition.
        /// </param>
        /// <param name="variableCollection">
        /// The variable collection.
        /// </param>
        /// <returns>
        /// The <see cref="VariableInfo"/>.
        /// </returns>
        private VariableInfo AddUrlCallDefinition(
            StringBuilder assemblyCode,
            IProcessDefinition process,
            IntegrationServiceCallDefinition callDefinition,
            VariableCollection variableCollection)
        {
            var callSettings = (IntegrationServiceUrlCallDefinition)callDefinition.CallSettings;
            var variableInfo = variableCollection.NewVariable();
            var variableName = variableInfo.Name;

            assemblyCode.AppendFormat(
                @"
            var {0} = new Cebos.Veyron.SharedTypes.Integration.UrlCallDefinition();
            {0}.Name = {1};
            {0}.CallLocation = Cebos.Veyron.SharedTypes.UrlServiceCallLocation.{2};
            {0}.HttpMethod = Cebos.Veyron.SharedTypes.UrlServiceCallMethod.{3};
            {0}.Guid = System.Guid.Parse({4});
            {0}.ProcessDisplayName = {5};",
                variableName,
                callDefinition.Name.ToLiteral(),
                callSettings.CallLocation,
                callSettings.HttpMethod,
                callDefinition.Guid.ToString().ToLiteral(),
                process.DisplayName.ToLiteral());

            if (!string.IsNullOrEmpty(callSettings.AddressExpression))
            {
                var script = ExpressionService.PrepareScriptFromXml(callSettings.AddressExpression);
                assemblyCode.AppendFormat(@"
            {0}.AddressExpression = item => Cebos.Veyron.SharedTypes.SafeTypeConverter.Convert<string>({1});", variableName, script);
            }

            foreach (var parameterDefinition in callSettings.Parameters)
            {
                var parameterVariable = AddUrlCallParameterDefinition(assemblyCode, parameterDefinition, variableCollection);
                assemblyCode.AppendFormat(@"
            {0}.ParameterDefinitions.Add({1});
", variableName, parameterVariable.Name);
            }

            foreach (var rule in callDefinition.Rules)
            {
                assemblyCode.AppendFormat(@"
            {0}.Rules.Add({1}Metadata.RuleManager.GetRule(new System.Guid(""{2}"")));
", variableName, process.Name, rule.Guid);
            }

            return variableInfo;
        }
开发者ID:mparsin,项目名称:Elements,代码行数:67,代码来源:ServerAssemblyGenerator.cs


示例4: AddMethodDefinition

        private void AddMethodDefinition(StringBuilder assemblyCode, IProcessDefinition process, IntegrationServiceMethodDefinition method)
        {
            assemblyCode.AppendFormat(@"
        private static Cebos.Veyron.SharedTypes.Integration.IntegrationServiceMethodDefinition Get{0}Definition()
        {{
            var methodDefinition = new Cebos.Veyron.SharedTypes.Integration.IntegrationServiceMethodDefinition();
            methodDefinition.ProcessName = {1};
", method.Name, process.Name.ToLiteral());

            var parameterExpressionScripts = ExpressionService.PrepareScriptForMultipleDestinations(method.ParametersMapping, null);
            var variableCollection = new VariableCollection();

            foreach (var fieldMapping in method.DestinationFields)
            {
                var mappingVariable = AddFieldMapping(assemblyCode, fieldMapping, parameterExpressionScripts, variableCollection);
                assemblyCode.AppendFormat(@"
            methodDefinition.ParameterMappings.Add({0});
", mappingVariable.Name);
            }

            if (!string.IsNullOrEmpty(method.ResultType))
            {
                assemblyCode.AppendFormat(@"
            methodDefinition.ResultType = typeof(@{0});
", method.ResultType);
            }

            if (method.ResultMapping != null)
            {
                var resultExpressionScripts = ExpressionService.PrepareScriptForMultipleDestinations(method.ResultMappingExpression, null);
                var mappingVariable = AddFieldMapping(assemblyCode, method.ResultMapping, resultExpressionScripts, variableCollection);
                assemblyCode.AppendFormat(@"
            methodDefinition.ResultMapping = {0};
", mappingVariable.Name);
            }

            assemblyCode.AppendFormat(@"

            return methodDefinition;
        }}
");
        }
开发者ID:mparsin,项目名称:Elements,代码行数:42,代码来源:ServerAssemblyGenerator.cs


示例5: GetSoapExtensionAttribute

 private string GetSoapExtensionAttribute(IProcessDefinition process, IntegrationServiceDefinition service)
 {
     return string.Format(
         "[Cebos.Veyron.SharedTypes.Integration.LogIntegrationEventExtensionAttribute({0}, {1})]",
         process.DisplayName.ToLiteral(),
         service.ServiceName.ToLiteral());
 }
开发者ID:mparsin,项目名称:Elements,代码行数:7,代码来源:ServerAssemblyGenerator.cs


示例6: GenerateProcessDataTrigger

        /// <summary>
        /// Generates the process data trigger.
        /// </summary>
        /// <param name="assemblyCode">
        /// The assembly code.
        /// </param>
        /// <param name="process">
        /// The process.
        /// </param>
        /// <param name="trigger">
        /// The trigger.
        /// </param>
        /// <param name="variableIndex">
        /// The variable index.
        /// </param>
        private void GenerateProcessDataTrigger(StringBuilder assemblyCode, IProcessDefinition process, DataTriggerDefinition trigger, ref int variableIndex)
        {

            assemblyCode.AppendLine(@"
                fields = new System.Collections.Generic.List<Cebos.Veyron.SharedTypes.DataTriggerFieldMapping>();
");

            if (!string.IsNullOrWhiteSpace(trigger.ModificationMapping))
            {
                var expressionScripts = ExpressionService.PrepareScriptForMultipleDestinations(trigger.ModificationMapping, new object());

                foreach (var fieldMapping in trigger.FieldMappings)
                {
                    var variableName = AddDataTriggerFieldMapping(assemblyCode, fieldMapping, expressionScripts, ref variableIndex);
                    assemblyCode.AppendFormat(@"
                fields.Add({0});", variableName);
                }
            }

            assemblyCode.AppendLine(@"
                listFields = new System.Collections.Generic.List<Cebos.Veyron.SharedTypes.DataTriggerListFieldMapping>();
");
            foreach (var fieldMapping in trigger.ListFieldMappings.Where(IsValid))
            {
                assemblyCode.AppendLine(@"
                subfields = new System.Collections.Generic.List<Cebos.Veyron.SharedTypes.DataTriggerFieldMapping>();");

                if (!string.IsNullOrEmpty(fieldMapping.ModificationMapping))
                {
                    var expressionScripts = ExpressionService.PrepareScriptForMultipleDestinations(fieldMapping.ModificationMapping, new object());

                    foreach (var childMapping in fieldMapping.FieldMappings)
                    {
                        var variableName = AddDataTriggerFieldMapping(assemblyCode, childMapping, expressionScripts, ref variableIndex);
                        assemblyCode.AppendFormat(@"
                subfields.Add({0});", variableName);
                    }
                }

                if (IsLinkOrUnlink(fieldMapping.ModificationType))
                {
                    var sourceDataProcessName = fieldMapping.SourceDataProcessName;
                    var sourceDataFilterDefinition = fieldMapping.SourceDataFilterDefinition;

                    if (!string.IsNullOrEmpty(sourceDataFilterDefinition) && sourceDataProcessName == process.Name)
                    {
                        sourceDataFilterDefinition = TranslateFilterDefinition(sourceDataFilterDefinition, process);
                    }

                    assemblyCode.AppendFormat(
                        @"
                listFields.Add(new Cebos.Veyron.SharedTypes.DataTriggerListFieldMapping({0}, {1}, {2}, Cebos.Veyron.SharedTypes.DataTriggerModificationType.{3}, subfields));",
                        sourceDataProcessName.ToLiteral(),
                        sourceDataFilterDefinition.ToLiteral(),
                        fieldMapping.DestinationFieldSystemName.ToLiteral(),
                        fieldMapping.ModificationType);
                }
                else
                {
                    assemblyCode.AppendLine(@"
                dataSources = new System.Collections.Generic.List<Cebos.Veyron.SharedTypes.DataTriggers.FieldMappingDataSourceDefinition>();");

                    foreach (var dataSource in fieldMapping.DataSources)
                    {
                        assemblyCode.AppendFormat(
                            @"
                dataSources.Add(new Cebos.Veyron.SharedTypes.DataTriggers.FieldMappingDataSourceDefinition({0}, {1}, {2}, {3}, {4}, {5}));",
                            dataSource.Name.ToLiteral(),
                            process.Name.ToLiteral(),
                            dataSource.PropertyPath.ToLiteral(),
                            dataSource.IncludeNewItems.ToLiteral(),
                            dataSource.IncludeOldItems.ToLiteral(),
                            dataSource.IncludeRemovedItems.ToLiteral());
                    }

                    assemblyCode.AppendFormat(
                        @"
                listFields.Add(new Cebos.Veyron.SharedTypes.DataTriggerListFieldMapping(dataSources, {0}, Cebos.Veyron.SharedTypes.DataTriggerModificationType.{1}, subfields));",
                        fieldMapping.DestinationFieldSystemName.ToLiteral(),
                        fieldMapping.ModificationType);
                }
            }

            assemblyCode.AppendLine(@"
                rules = new System.Collections.Generic.List<Cebos.Veyron.SharedTypes.IActionRule>();
//.........这里部分代码省略.........
开发者ID:mparsin,项目名称:Elements,代码行数:101,代码来源:ServerAssemblyGenerator.cs


示例7: AddIntegrationClasses

        /// <summary>
        /// Adds the integration classes.
        /// </summary>
        /// <param name="assemblyCode">The assembly code.</param>
        /// <param name="process">The process.</param>
        protected override void AddIntegrationClasses(StringBuilder assemblyCode, IProcessDefinition process)
        {
            foreach (var service in process.IntegrationServices)
            {
                AddIntegrationServiceClass(assemblyCode, process, service);
            }

            AddIntegrationServiceCallsManagerClass(assemblyCode, process);
        }
开发者ID:mparsin,项目名称:Elements,代码行数:14,代码来源:ServerAssemblyGenerator.cs


示例8: GenerateLoadProperties

        /// <summary>
        /// Generates the load properties.
        /// </summary>
        /// <param name="process">The process.</param>
        /// <returns>System.String.</returns>
        protected virtual string GenerateLoadProperties(IProcessDefinition process)
        {
            var result = new StringBuilder();

            if (process.HasBaseClass)
            {
                result.AppendFormat(@"BaseInfo.SetInheritanceContext(this);
BaseInfo.ReadData(reader, columns);");
            }

            return result.ToString();



            #region Commented

            //var list = new List<string>
            //               {
            //                   string.Format("\t\t\tLoadProperty({0}Property, reader.GetDBValue<int>(\"{0}\", 0));", Constants.IdColumnName),
            //                   string.Format("\t\t\tLoadProperty({0}Property, reader.GetDBValue<string>(\"{0}\", string.Empty));", Constants.DerivedProcessColumnName)
            //               };

            //if (process.HasBaseClass)
            //    list.Add(string.Format("\t\t\tLoadProperty({0}Property, reader.GetDBValue<int>(\"{0}\", 0));", Constants.BaseIdColumnName));

            //if (process.IsStateEnabled)
            //    list.Add(string.Format("\t\t\tLoadProperty({0}Property, reader.GetDBValue<string>(\"{0}\", string.Empty));", Constants.CurrentStateColumnName));

            //if (process.IsVersioningEnabled)
            //{
            //    var field = process.RootTable.FieldList.FirstOrDefault(x => x.ColumnName.Equals(Constants.VersionNumber));
            //    if (field != null && field.IncludeInList)
            //        list.Add(string.Format("\t\t\tif (reader.HasColumn(\"{0}\")) LoadProperty({0}Property, reader.GetDBValue(\"{0}\", string.Empty));", Constants.VersionNumber));

            //    field = process.RootTable.FieldList.FirstOrDefault(x => x.ColumnName.Equals(Constants.VersionDate));
            //    if (field != null && field.IncludeInList)
            //        list.Add(string.Format("\t\t\tif (reader.HasColumn(\"{0}\")) LoadProperty({0}Property, reader.GetDBValue(\"{0}\", DateTime.MinValue));", Constants.VersionDate));
            //}


            //            foreach (var field in process.RootTable.FieldList.Where(x => x.IsRuntimeAvailable && x.IncludeInSearchResults && x.ColumnType != ColumnTypes.MultiReference))
            //            {
            //                if (field.ColumnName == Constants.IdColumnName ||
            //                    field.ColumnName == Constants.CurrentStateColumnName ||
            //                    field.ColumnName == Constants.DerivedProcessColumnName ||
            //                    field.ColumnName == Constants.VersionNumber ||
            //                    field.ColumnName == Constants.VersionDate)
            //                    continue;

            //                string code = null;
            //                var type = GetCSharpType(process.RootTable, field, true, isInfoClass: true);
            //                var defaultValue = type.ToLowerInvariant().Equals("string") ? "string.Empty" : GetDefaultValue(field, true);
            //                var prop = string.Format(@"            
            //                LoadProperty({0}Property, reader.GetDBValue<{2}>(""{0}"", {1}));
            //", field.ColumnName, defaultValue, type);

            //                // condition '!string.IsNullOrEmpty(field.Section))' is needed to always allow the CR on process __State
            //                // if necessary, can be replaced by something like field.Name != "State"
            //                // all fields created by the user, should be in condition 'reader.HasColumn'
            //                if ((field.IsRef && !string.IsNullOrEmpty(field.Section)) || field.IsReverseRef)
            //                {
            //                    code = string.Format(@"
            //            if (reader.HasColumn(""{0}""))
            //            {{
            //    {1}
            //            }}", field.ColumnName, prop);
            //                }

            //                list.Add(code ?? prop);
            //            }

            /*foreach (var crf in process.RootTable.FieldList.Where(f => f.ColumnType == ColumnTypes.Reference && f.IncludeInSearchResults))
{
    var s = string.Format(@"
LoadProperty({0}IdProperty, reader.GetDBValue<int>(""{0}Id"", 0));", crf.ColumnName);

    if (!string.IsNullOrEmpty(crf.Section))
        list.Add(string.Format(@"
if (reader.HasColumn(""{0}Id""))
{{
{1}
}}", crf.ColumnName, s));
    else
        list.Add(s);
}*/

            #endregion





            /*foreach (var crf in process.RootTable.FieldList.Where(f => f.ColumnType == ColumnTypes.MultiReference && f.IncludeInSearchResults))
{
    var s = string.Format(@"
//.........这里部分代码省略.........
开发者ID:mparsin,项目名称:Elements,代码行数:101,代码来源:ServerAssemblyGenerator.cs


示例9: GetSyncClass

        /// <summary>
        /// Gets the synchronize class.
        /// </summary>
        /// <param name="syncProcess">The synchronize process.</param>
        /// <param name="process">The process.</param>
        /// <returns>System.String.</returns>
        private string GetSyncClass(SyncProcessDefinition syncProcess, IProcessDefinition process)
        {
            var sb = new StringBuilder();

            sb.AppendFormat(
                @"
    [Serializable]
    [ExportAsProcessSynchronizer({0}, {1})]
    public class {2} : IProcessSynchronizer
    {{
        {3}
        ",
                process.Name.ToLiteral(),
                syncProcess.Name.ToLiteral(),
                GetSynchronizerClassName(syncProcess),
                GetSyncProviderItemClass(syncProcess));

            sb.AppendFormat(
                @"
        private static readonly IDataProvider _dataProvider;

        private static readonly ISchedule[] _schedules;

        private static readonly SynchronizationMap _synchronizationMap;

        static {0}()
        {{
            {1}
            {2}
            {6}
        }}

        public string Name {{ get {{ return {3}; }} }}

        public string ProcessName {{ get {{ return {5}; }} }}

        public System.Guid Guid {{ get {{ return new System.Guid(""{4}""); }} }}

        public Cebos.Veyron.SharedTypes.ESyncAction Action {{ get {{ return Cebos.Veyron.SharedTypes.ESyncAction.{7}; }} }}

        public IDataProvider DataProvider
        {{
            get {{ return _dataProvider; }}
        }}

        public ISchedule[] Schedules
        {{
            get {{ return _schedules; }}
        }}

        public ISynchronizationMap SynchronizationMap
        {{
            get {{ return _synchronizationMap; }}
        }}
",
                GetSynchronizerClassName(syncProcess),
                GetSyncDataProvider(syncProcess),
                GetSyncSchedules(syncProcess),
                syncProcess.Name.ToLiteral(),
                syncProcess.Guid,
                process.Name.ToLiteral(),
                GetSynchronizationMap(process, syncProcess),
                syncProcess.Action);

            sb.AppendFormat(
                @"
        public _ProviderItem CreateDynamicItem(ProviderItem item)
        {{
            return new _ProviderItem(item);
        }}

        ISyncDynamicItem IProcessSynchronizer.CreateDynamicItem(ProviderItem item)
        {{
            return CreateDynamicItem(item);
        }}
            
        private readonly IValueCalculator _valueCalculator = new _ValueCalculator();

        public IValueCalculator ValueCalculator
        {{
            get {{ return _valueCalculator; }}
        }}
");

            var expressionScripts = !string.IsNullOrEmpty(syncProcess.MapDesigner)
                                        ? ExpressionService.PrepareScriptForMultipleDestinations(
                                            syncProcess.MapDesigner, null)
                                        : new Dictionary<string, string>();

            sb.AppendFormat(
                @"
        public class _ValueCalculator : ValueCalculatorBase
        {{
            public override bool TryGetValue(IDynamicObject providerItem, string mappingKey, out object result)
//.........这里部分代码省略.........
开发者ID:mparsin,项目名称:Elements,代码行数:101,代码来源:ServerAssemblyGenerator.cs


示例10: AddDeepCopyClass

        /// <summary>
        /// Adds the deep copy class.
        /// </summary>
        /// <param name="assemblyCode">The assembly code.</param>
        /// <param name="process">The process.</param>
        protected override void AddDeepCopyClass(StringBuilder assemblyCode, IProcessDefinition process)
        {
            var idsInput = string.Join(",", process.RootTable.FieldList.Where(x => x.DeepCopy && x.ReferenceProcess != null).Select(x => string.Format("IEnumerable<int> {0}ids", x.ColumnName)));
            var idsAss = string.Join(",", process.RootTable.FieldList.Where(x => x.DeepCopy && x.ReferenceProcess != null).Select(x => string.Format("{0}Ids = new MobileList<int>({0}ids)", x.ColumnName)));
            var idsChk = string.Join(Environment.NewLine + " && " + Environment.NewLine,
                                     process.RootTable.FieldList.Where(x => x.DeepCopy && x.ReferenceProcess != null)
                                            .Select(x => string.Format(@"{0}Ids.Select(id => DataPortal.Fetch<Dynamic{1}.{1}EditRetriever>(new DetailCriteria(id, true, true)
                                                                                      {{
                                                                                          ProcessViewGuid = null,
                                                                                          ProcessViewChangedFields = null
                                                                                      }}).{1}Edit).All(proc => proc.IsValid)", x.ColumnName, x.ReferenceProcess.SystemName)));

            assemblyCode.AppendFormat(@"
    [Serializable]
    public class CheckCopy : MefCommandBase<CheckCopy>
    {{
        public static bool ExecuteCheck({0})
        {{
            var cmd = new CheckCopy {{{1}}};
            return DataPortal.Execute(cmd).Result;
        }}
        ", idsInput, idsAss);

            foreach (var field in process.RootTable.FieldList.Where(x => x.DeepCopy && x.ReferenceProcess != null))
            {
                assemblyCode.AppendFormat(@"
        public static readonly PropertyInfo<MobileList<int>> {0}IdsProperty = RegisterProperty<MobileList<int>>(c => c.{0}Ids);
        public MobileList<int> {0}Ids
        {{
            get {{ return ReadProperty({0}IdsProperty); }}
            private set {{ LoadProperty({0}IdsProperty, value); }}
        }}
", field.ColumnName);
            }

            assemblyCode.AppendFormat(@"

        public static readonly PropertyInfo<bool> ResultProperty = RegisterProperty<bool>(c => c.Result);
        public bool Result
        {{
            get {{ return ReadProperty(ResultProperty); }}
            private set {{ LoadProperty(ResultProperty, value); }}
        }}

        protected override void DataPortal_Execute()
        {{
            Result = {0};
        }}
    }}
", idsChk);
        }
开发者ID:mparsin,项目名称:Elements,代码行数:56,代码来源:ServerAssemblyGenerator.cs


示例11: AddESyncClasses

 /// <summary>
 /// Adds the E sync classes.
 /// </summary>
 /// <param name="assemblyCode">The assembly code.</param>
 /// <param name="process">The process.</param>
 protected override void AddESyncClasses(StringBuilder assemblyCode, IProcessDefinition process)
 {
     foreach (var syncProcess in process.SyncProcesses)
         assemblyCode.AppendLine(GetSyncClass(syncProcess, process));
 }
开发者ID:mparsin,项目名称:Elements,代码行数:10,代码来源:ServerAssemblyGenerator.cs


示例12: LogSourceCode

 /// <summary>
 /// Logs the source code.
 /// </summary>
 /// <param name="sourceCode">The source code.</param>
 /// <param name="process">The process.</param>
 protected override void LogSourceCode(string sourceCode, IProcessDefinition process)
 {
     process.ServerCode = sourceCode;
 }
开发者ID:mparsin,项目名称:Elements,代码行数:9,代码来源:ServerAssemblyGenerator.cs


示例13: AddKpiClassFetchMethods

        /// <summary>
        /// Adds the KPI class fetch methods.
        /// </summary>
        /// <param name="assemblyCode">The assembly code.</param>
        /// <param name="process">The process.</param>
        protected override void AddKpiClassFetchMethods(StringBuilder assemblyCode, IProcessDefinition process)
        {
            assemblyCode.AppendFormat(@"
        private bool skip;

        private void RunFetcher(KpiAggregateCriteria criteria)
        {{
            StatusQueryCommand.SetStatus(criteria.Guid, ""Starting work..."");

            ApplicationContext.User = criteria.Identity;

            var kpi = KpiList.FirstOrDefault(x => x.Guid == criteria.KpiGuid);
            if (kpi == null)
            {{
                return;
            }}

            LoadProperty(IdProperty, kpi.Id);
            LoadProperty(NameProperty, kpi.Name);
            LoadProperty(GuidProperty, kpi.Guid);
            LoadProperty(FavorableDirectionProperty, kpi.FavorableDirection);
            LoadProperty(TargetValueProperty, kpi.TargetValue);
            LoadProperty(YellowValueProperty, kpi.YellowValue);
            LoadProperty(YellowIconURLProperty, kpi.YellowIconURL);
            LoadProperty(YellowIconIDProperty, kpi.YellowIconID);
            LoadProperty(GreenValueProperty, kpi.GreenValue);
            LoadProperty(GreenIconURLProperty, kpi.GreenIconURL);
            LoadProperty(GreenIconIDProperty, kpi.GreenIconID);
            LoadProperty(RedIconURLProperty, kpi.RedIconURL);
            LoadProperty(RedIconIDProperty, kpi.RedIconID);
            
            var metric = {0}MetricInfo.MetricList.FirstOrDefault(x => x.Guid == kpi.MetricGuid);
            if (metric == null) {{
                return;
            }}

            LoadItems(kpi, metric, criteria);
            
            if (!skip)
                StatusQueryCommand.SetStatus(criteria.Guid, ""Completed"", 0, -1, true, this);
        }}

        private void DataPortal_Fetch(KpiAggregateCriteria criteria)
        {{
            criteria.Identity = ApplicationContext.User;

            if (!criteria.RunInBackground)
            {{
                RunFetcher(criteria);
                return; 
            }}

            var bw = new BackgroundWorker();

            DoWorkEventHandler runFetcherAction = (o, e) => RunFetcher(criteria);
            RunWorkerCompletedEventHandler runWOrkerComplitedHandler = null;
            runWOrkerComplitedHandler = (s, e) =>
                {{
                    bw.DoWork -= runFetcherAction;
                    bw.RunWorkerCompleted -= runWOrkerComplitedHandler;
                    bw.Dispose();
                }};

            bw.DoWork += runFetcherAction;
            bw.RunWorkerCompleted += runWOrkerComplitedHandler;
            bw.RunWorkerAsync();
        }}

        private void LoadItems(IKpi kpi, IMetric metric, KpiAggregateCriteria criteria)
        {{
            var filter = kpi.FilterDefinition;

            var colList = new List<string>();

            if (!string.IsNullOrEmpty(metric.MetricFieldSystemName))
            {{
                colList.Add(metric.MetricFieldSystemName);
            }}

            if (!string.IsNullOrEmpty(metric.GroupFieldOneSystemName))
            {{
                colList.Add(metric.GroupFieldOneSystemName);
            }}

            if (!string.IsNullOrEmpty(metric.GroupFieldTwoSystemName))
            {{
                colList.Add(metric.GroupFieldTwoSystemName);
            }}

            if (!string.IsNullOrEmpty(metric.GroupFieldThreeSystemName))
            {{
                colList.Add(metric.GroupFieldThreeSystemName);
            }}

            if (!string.IsNullOrEmpty(metric.GroupFieldFourSystemName))
//.........这里部分代码省略.........
开发者ID:mparsin,项目名称:Elements,代码行数:101,代码来源:ServerAssemblyGenerator.cs


示例14: AddKpiClassFactoryMethods

        /// <summary>
        /// Adds the KPI class factory methods.
        /// </summary>
        /// <param name="assemblyCode">The assembly code.</param>
        /// <param name="process">The process.</param>
        protected override void AddKpiClassFactoryMethods(StringBuilder assemblyCode, IProcessDefinition process)
        {
            assemblyCode.AppendFormat(@"

        public static {0}KpiInfo Get{0}KpiInfo(Guid kpiGuid)
        {{
            return DataPortal.Fetch<{0}KpiInfo>(kpiGuid);
        }}

        public static {0}KpiInfo GetGadgetAggregateList(KpiAggregateCriteria criteria)
        {{
            return DataPortal.Fetch<{0}KpiInfo>(criteria);
        }}

", process.Name);
        }
开发者ID:mparsin,项目名称:Elements,代码行数:21,代码来源:ServerAssemblyGenerator.cs


示例15: AddExecuteDataTriggers

        /// <summary>
        /// Adds the execute data triggers.
        /// </summary>
        /// <param name="assemblyCode">The assembly code.</param>
        /// <param name="process">The process.</param>
        protected override void AddExecuteDataTriggers(StringBuilder assemblyCode, IProcessDefinition process)
        {
            assemblyCode.AppendFormat(
                @"
        private System.Collections.Generic.List<Cebos.Veyron.SharedTypes.DataTriggers.IDataTrigger> GetTriggersToExecute({0}Edit item, {0}Edit oldItem)
        {{
            var result = new System.Collections.Generic.List<Cebos.Veyron.SharedTypes.DataTriggers.IDataTrigger>();

            foreach (var triggerDefinition in {0}TriggersInfo.DataTriggers)
                if (triggerDefinition.CanExecute(item, oldItem))
                {{
                    var trigger = DataTriggerFactory.CreateDataTrigger({1}, triggerDefinition);
                    result.Add(trigger);
                }}

            return result;
        }}

        private void ExecuteTriggersBeforeUpdate(
            System.Collections.Generic.IEnumerable<Cebos.Veyron.SharedTypes.DataTriggers.IDataTrigger> triggers,
            {0}Edit item,
            {0}Edit oldItem)
        {{
            foreach (var trigger in triggers)
                trigger.BeforeItemUpdate(item, oldItem);
        }}

        private void ExecuteTriggersAfterUpdate(
            System.Collections.Generic.IEnumerable<Cebos.Veyron.SharedTypes.DataTriggers.IDataTrigger> triggers,
            {0}Edit item,
            {0}Edit oldItem)
        {{
            foreach (var trigger in triggers)
                trigger.AfterItemUpdate(item, oldItem);
        }}
", process.Name, process.Name.ToLiteral());
        }
开发者ID:mparsin,项目名称:Elements,代码行数:42,代码来源:ServerAssemblyGenerator.cs


示例16: GetTableField

        /// <summary>
        /// Gets the table field.
        /// </summary>
        /// <param name="process">The process.</param>
        /// <param name="fieldName">Name of the field.</param>
        /// <returns>TableFieldDefinition.</returns>
        private static TableFieldDefinition GetTableField(IProcessDefinition process, string fieldName)
        {
            TableFieldDefinition tableField = null;
            var currentProcess = process;

            while (currentProcess != null)
            {
                tableField = currentProcess.RootTable.FieldList.FirstOrDefault(f => f.ColumnName == fieldName);

                if (tableField != null)
                    break;

                currentProcess = currentProcess.BaseProcess;
            }

            return tableField;
        }
开发者ID:mparsin,项目名称:Elements,代码行数:23,代码来源:ServerAssemblyGenerator.cs


示例17: AddDataTriggersClasses

        /// <summary>
        /// Adds the data triggers classes.
        /// </summary>
        /// <param name="assemblyCode">The assembly code.</param>
        /// <param name="process">The process.</param>
        /// <exception cref="System.NotSupportedException"></exception>
        protected override void AddDataTriggersClasses(StringBuilder assemblyCode, IProcessDefinition process)
        {
            assemblyCode.AppendFormat(
                @"
        public class {0}TriggersInfo
        {{
            private static readonly Cebos.Veyron.SharedTypes.DataTriggerDefinition[] _dataTriggers;

            public static Cebos.Veyron.SharedTypes.DataTriggerDefinition[] DataTriggers {{ get {{ return _dataTriggers; }} }}

            static {0}TriggersInfo()
            {{
                System.Collections.Generic.List<Cebos.Veyron.SharedTypes.DataTriggerFieldMapping> fields;
                System.Collections.Generic.List<Cebos.Veyron.SharedTypes.DataTriggerFieldMapping> subfields;
                System.Collections.Generic.List<Cebos.Veyron.SharedTypes.DataTriggerListFieldMapping> listFields;
                Func<IDynamicObject, IDynamicObject, bool> ruleExpression;
                System.Collections.Generic.List<Cebos.Veyron.SharedTypes.IActionRule> rules;
                System.Collections.Generic.List<Cebos.Veyron.SharedTypes.DataTriggers.FieldMappingDataSourceDefinition> dataSources;
                System.Collections.Generic.List<Cebos.Veyron.SharedTypes.DataTriggers.StoredProcedureParameterDefinition> storedProcedureParameters;
                var dataTriggers = new System.Collections.Generic.List<Cebos.Veyron.SharedTypes.DataTriggerDefinition>();

",
                process.Name);

            var variableIndex = 0;

            foreach (var trigger in process.DataTriggers.OrderBy(t => t.Name))
            {
                switch (trigger.TriggerType)
                {
                    case DataTriggerTypes.Process:
                        GenerateProcessDataTrigger(assemblyCode, process, trigger, ref variableIndex);
                        break;

                    case DataTriggerTypes.StoredProcedure:
                        GenerateStoredProcedureDataTrigger(assemblyCode, process, trigger);
                        break;

                    default:
                        throw new NotSupportedException(string.Format("Trigger type \"{0}\" is not supported.", trigger.TriggerType));
                }
            }

            assemblyCode.AppendLine(@"
                _dataTriggers = dataTriggers.ToArray();
            }
        }
");
        }
开发者ID:mparsin,项目名称:Elements,代码行数:55,代码来源:ServerAssemblyGenerator.cs


示例18: GetSynchronizationMap

        /// <summary>
        /// Gets the synchronization map.
        /// </summary>
        /// <param name="process">The process.</param>
        /// <param name="syncProcess">The synchronize process.</param>
        /// <returns>System.String.</returns>
        private string GetSynchronizationMap(IProcessDefinition process, SyncProcessDefinition syncProcess)
        {
            var result = new StringBuilder();

            result.AppendFormat(
                @"
            _synchronizationMap = new SynchronizationMap();
");

            foreach (var destinationField in syncProcess.DestinationFields)
            {
                if (destinationField.SystemName == Constants.Version)
                {
                    result.Append(GetAddVersionFields(process, destinationField));
                    continue;
                }

                if (destinationField.SystemName == Constants.CurrentStateColumnName)
                {
                    result.Append(GetAddCurrentStateField(process, destinationField));
                    continue;
                }

                var tableField = GetTableField(process, destinationField.SystemName);

                if (tableField == null)
                    continue;

                if (tableField.IsRef)
                {
                    result.Append(GetAddCrossReferenceField(process, tableField, destinationField));
                    continue;
                }

                result.Append(GetAddGenericField(process, tableField, destinationField));
            }

            return result.ToString();
        }
开发者ID:mparsin,项目名称:Elements,代码行数:45,代码来源:ServerAssemblyGenerator.cs


示例19: GenerateStoredProcedureDataTrigger

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Interop.cef_string_t类代码示例发布时间:2022-05-24
下一篇:
C# Testing.BenchmarksContainer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap