コード例 #1
0
        public void OpenViewHandler(object sender, OpenViewEventArgs e)
        {
            if (this.mView.GetProject().CollectedData.TableExists(mView.TableName) == false)
            {
                this.mView.GetProject().CollectedData.CreateDataTableForView(mView, 1);
            }

            this.mView.MustRefreshFieldCollection = true;

            if (this.mView.IsRelatedView)
            {
                this.mView.ForeignKeyField.CurrentRecordValueString = this.ParentGlobalRecordId;
            }

            this.mCurrentPage = this.mView.Pages[0];

            // access fields to be sure available  in the checkcode
            Epi.Collections.FieldCollectionMaster Fields = this.mView.Fields;

            // push after_view onto stack
            this.AfterStack.Push(new KeyValuePair <EventActionEnum, StackCommand>(EventActionEnum.CloseView, new StackCommand(this.EpiInterpreter, "view", "after", "")));

            // execute before_view
            //this.RunCheckCodeCommands(this.mView.CheckCodeVariableDefinitions);

            // will run the variable definitions and setup compiled context
            foreach (Field field in this.View.Fields)
            {
                if (field is IDataField)
                {
                    EpiInfo.Plugin.IVariable definedVar = (EpiInfo.Plugin.IVariable)field;
                    this.mEpiInterpreter.Context.DefineVariable(definedVar);
                }
            }

            this.RunCheckCodeCommands(this.mView.CheckCode);

            this.ExecuteCheckCode("view", "before", "");
            this.recordCount = this.View.GetRecordCount();
        }
コード例 #2
0
        public void OpenViewHandler(object sender, OpenViewEventArgs e)
        {
            Epi.View view = mCurrentProject.Views.GetViewById(e.ViewId);
            if (this.mCurrentView.Count == 0)
            {
                this.mCurrentView.Push(new RunTimeView(e.EnterCheckCodeInterface, view));
            }
            else
            {
                if (
                        this.mCurrentProject.FilePath != view.GetProject().FilePath
                        || view.ParentView == null
                        || view.ParentView.Name != this.mCurrentView.Peek().View.Name
                    )
                {
                    while (this.mCurrentView.Count > 0)
                    {
                        this.mCurrentView.Pop().CloseView(this, new RunCheckCodeEventArgs(EventActionEnum.CloseView, ""));
                    }

                    this.mCurrentView.Push(new RunTimeView(e.EnterCheckCodeInterface, view));
                }
                else
                {
                    RunTimeView runTimeView = this.mCurrentView.Peek();
                    int CurrentRecordId = runTimeView.View.CurrentRecordId;
                    string CurrentGlobalRecordId = runTimeView.View.CurrentGlobalRecordId;

                    EpiInfo.Plugin.IScope scope = runTimeView.EpiInterpreter.Context.GetNewScope(runTimeView.View.Name, runTimeView.EpiInterpreter.Context.Scope);

                    foreach (Epi.Fields.Field field in runTimeView.View.Fields)
                    {
                        if (field is EpiInfo.Plugin.IVariable)
                        {
                            PluginVariable pluginVariable = new PluginVariable();
                            pluginVariable.VariableScope = EpiInfo.Plugin.VariableScope.Standard;
                            pluginVariable.Name = field.Name;
                            pluginVariable.DataType = ((EpiInfo.Plugin.IVariable)field).DataType;

                            if (field is Epi.Fields.CheckBoxField || field is Epi.Fields.YesNoField)
                            {
                                if (((Epi.Fields.IDataField)field).CurrentRecordValueString == "1")
                                {
                                    pluginVariable.Expression = "true";
                                }
                                else if (((Epi.Fields.IDataField)field).CurrentRecordValueString == "0")
                                {
                                    pluginVariable.Expression = "false";
                                }
                                else
                                {
                                    pluginVariable.Expression = null;
                                }
                            }
                            else
                            {
                                pluginVariable.Expression = ((Epi.Fields.IDataField)field).CurrentRecordValueString;
                            }

                            scope.Define(pluginVariable);
                        }
                    }

                    this.mCurrentView.Push(new RunTimeView(e.EnterCheckCodeInterface, view, CurrentRecordId, CurrentGlobalRecordId, scope));
                }
            }

            this.mCurrentView.Peek().OpenViewHandler(sender, e);
        }
コード例 #3
0
ファイル: RunTimeView.cs プロジェクト: NALSS/epiinfo-82474
        public void OpenViewHandler(object sender, OpenViewEventArgs e)
        {
            if (this.mView.GetProject().CollectedData.TableExists(mView.TableName) == false)
            {
                this.mView.GetProject().CollectedData.CreateDataTableForView(mView, 1);
            }

            this.mView.MustRefreshFieldCollection = true;

            if (this.mView.IsRelatedView)
            {
                this.mView.ForeignKeyField.CurrentRecordValueString = this.ParentGlobalRecordId;
            }

            this.mCurrentPage = this.mView.Pages[0];

            // access fields to be sure available  in the checkcode
            Epi.Collections.FieldCollectionMaster Fields =  this.mView.Fields;

            // push after_view onto stack
            this.AfterStack.Push(new KeyValuePair<EventActionEnum, StackCommand>(EventActionEnum.CloseView, new StackCommand(this.EpiInterpreter, "view","after","")));

            // execute before_view
            //this.RunCheckCodeCommands(this.mView.CheckCodeVariableDefinitions);

            // will run the variable definitions and setup compiled context
            foreach (Field field in this.View.Fields)
            {
                if (field is IDataField)
                {
                    EpiInfo.Plugin.IVariable definedVar = (EpiInfo.Plugin.IVariable)field;
                    this.mEpiInterpreter.Context.DefineVariable(definedVar);
                }
            }

            this.RunCheckCodeCommands(this.mView.CheckCode);

            this.ExecuteCheckCode("view","before","");
            this.recordCount = this.View.GetRecordCount();
        }
コード例 #4
0
        public void OpenViewHandler(object sender, OpenViewEventArgs e)
        {
            Epi.View view = mCurrentProject.Views.GetViewById(e.ViewId);
            if (this.mCurrentView.Count == 0)
            {
                this.mCurrentView.Push(new RunTimeView(e.EnterCheckCodeInterface, view));
            }
            else
            {
                if (
                    this.mCurrentProject.FilePath != view.GetProject().FilePath ||
                    view.ParentView == null ||
                    view.ParentView.Name != this.mCurrentView.Peek().View.Name
                    )
                {
                    while (this.mCurrentView.Count > 0)
                    {
                        this.mCurrentView.Pop().CloseView(this, new RunCheckCodeEventArgs(EventActionEnum.CloseView, ""));
                    }

                    this.mCurrentView.Push(new RunTimeView(e.EnterCheckCodeInterface, view));
                }
                else
                {
                    RunTimeView runTimeView           = this.mCurrentView.Peek();
                    int         CurrentRecordId       = runTimeView.View.CurrentRecordId;
                    string      CurrentGlobalRecordId = runTimeView.View.CurrentGlobalRecordId;

                    EpiInfo.Plugin.IScope scope = runTimeView.EpiInterpreter.Context.GetNewScope(runTimeView.View.Name, runTimeView.EpiInterpreter.Context.Scope);

                    foreach (Epi.Fields.Field field in runTimeView.View.Fields)
                    {
                        if (field is EpiInfo.Plugin.IVariable)
                        {
                            PluginVariable pluginVariable = new PluginVariable();
                            pluginVariable.VariableScope = EpiInfo.Plugin.VariableScope.Standard;
                            pluginVariable.Name          = field.Name;
                            pluginVariable.DataType      = ((EpiInfo.Plugin.IVariable)field).DataType;

                            if (field is Epi.Fields.CheckBoxField || field is Epi.Fields.YesNoField)
                            {
                                if (((Epi.Fields.IDataField)field).CurrentRecordValueString == "1")
                                {
                                    pluginVariable.Expression = "true";
                                }
                                else if (((Epi.Fields.IDataField)field).CurrentRecordValueString == "0")
                                {
                                    pluginVariable.Expression = "false";
                                }
                                else
                                {
                                    pluginVariable.Expression = null;
                                }
                            }
                            else
                            {
                                pluginVariable.Expression = ((Epi.Fields.IDataField)field).CurrentRecordValueString;
                            }

                            scope.Define(pluginVariable);
                        }
                    }

                    this.mCurrentView.Push(new RunTimeView(e.EnterCheckCodeInterface, view, CurrentRecordId, CurrentGlobalRecordId, scope));
                }
            }

            this.mCurrentView.Peek().OpenViewHandler(sender, e);
        }