public RunTimeView(IEnterInterpreterHost pEnterClientInterface, Epi.View pView, int pParentRecordId, string pParentGlobalRecordId, IScope pScope = null)
        {
            // to do set the enter interpreter
            // application domain.
            Assembly a = Assembly.Load(pView.Project.EnterMakeviewIntepreter);
            // Get the type to use.
            Type myType = a.GetType(pView.Project.EnterMakeviewIntepreter + ".EpiInterpreterParser");


            // Create an instance.
            if (pScope == null)
            {
                this.mEpiInterpreter = (IEnterInterpreter)Activator.CreateInstance(myType, new object[] { pEnterClientInterface });
            }
            else
            {
                this.mEpiInterpreter = (IEnterInterpreter)Activator.CreateInstance(myType, new object[] { pEnterClientInterface, pScope });
            }
            this.mEpiInterpreter.Context.Scope.Name = pView.Name;
            this.mEpiInterpreter.Host = pEnterClientInterface;


            this.EnterClientInterface     = pEnterClientInterface;
            this.AfterStack               = new Stack <KeyValuePair <EventActionEnum, StackCommand> >();
            this.parentViewRecordId       = pParentRecordId;
            this.parentViewGlobalRecordId = pParentGlobalRecordId;
            this.RecordNumberMap          = new Dictionary <int, int>();
            this.mView = pView;
            this.mView.ForeignKeyField.CurrentRecordValueString = this.ParentGlobalRecordId;
        }
Exemple #2
0
        public RunTimeView(IEnterInterpreterHost pEnterClientInterface, Epi.View pView, int pParentRecordId, string pParentGlobalRecordId, IScope pScope = null)
        {
            // to do set the enter interpreter
            // application domain.
            Assembly a = Assembly.Load(pView.Project.EnterMakeviewIntepreter);
            // Get the type to use.
            Type myType = a.GetType(pView.Project.EnterMakeviewIntepreter + ".EpiInterpreterParser");

            // Create an instance.
            if (pScope == null)
            {
                this.mEpiInterpreter = (IEnterInterpreter)Activator.CreateInstance(myType, new object[] { pEnterClientInterface });
            }
            else
            {
                this.mEpiInterpreter = (IEnterInterpreter)Activator.CreateInstance(myType, new object[] { pEnterClientInterface, pScope });
            }
            this.mEpiInterpreter.Context.Scope.Name = pView.Name;
            this.mEpiInterpreter.Host = pEnterClientInterface;

            this.EnterClientInterface = pEnterClientInterface;
            this.AfterStack = new Stack<KeyValuePair<EventActionEnum, StackCommand>>();
            this.parentViewRecordId = pParentRecordId;
            this.parentViewGlobalRecordId = pParentGlobalRecordId;
            this.RecordNumberMap = new Dictionary<int, int>();
            this.mView = pView;
            this.mView.ForeignKeyField.CurrentRecordValueString = this.ParentGlobalRecordId;
        }
Exemple #3
0
        string _level; // View | Record | Page | Field

        #endregion Fields

        #region Constructors

        public StackCommand(IEnterInterpreter EnterInterpreter, string Level, string Event, string Identifier)
        {
            this.EnterInterpreter = EnterInterpreter;
            _level = Level;
            _event = Event;
            _identifier = Identifier;
            this.QueryString = string.Format("level={0}&event={1}&identifier={2}", Level.ToLower(), Event.ToLower(), Identifier.ToLower());
        }
 public StackCommand(IEnterInterpreter EnterInterpreter, string Level, string Event, string Identifier)
 {
     this.EnterInterpreter = EnterInterpreter;
     _level           = Level;
     _event           = Event;
     _identifier      = Identifier;
     this.QueryString = string.Format("level={0}&event={1}&identifier={2}", Level.ToLowerInvariant(), Event.ToLowerInvariant(), Identifier.ToLowerInvariant());
 }
Exemple #5
0
        public RunTimeView(IEnterInterpreterHost pEnterClientInterface, Epi.View pView)
        {
            // to do set the enter interpreter
            // application domain.
            Assembly a = Assembly.Load(pView.Project.EnterMakeviewIntepreter);
            // Get the type to use.
            Type myType = a.GetType(pView.Project.EnterMakeviewIntepreter + ".EpiInterpreterParser");

            // Create an instance.
            this.mEpiInterpreter = (IEnterInterpreter)Activator.CreateInstance(myType, new object[] { pEnterClientInterface });
            this.mEpiInterpreter.Host = pEnterClientInterface;

            //this.mEpiInterpreter = new EpiInterpreterParser(Epi.Resources.ResourceLoader.GetEnterCompiledGrammarTable(), pEnterClientInterface, Rule_Context.eRunMode.Enter);
            this.EnterClientInterface = pEnterClientInterface;
            this.AfterStack = new Stack<KeyValuePair<EventActionEnum, StackCommand>>();
            this.RecordNumberMap = new Dictionary<int, int>();
            this.mView = pView;
        }
        public RunTimeView(IEnterInterpreterHost pEnterClientInterface, Epi.View pView)
        {
            // to do set the enter interpreter
            // application domain.
            Assembly a = Assembly.Load(pView.Project.EnterMakeviewIntepreter);
            // Get the type to use.
            Type myType = a.GetType(pView.Project.EnterMakeviewIntepreter + ".EpiInterpreterParser");

            // Create an instance.
            this.mEpiInterpreter      = (IEnterInterpreter)Activator.CreateInstance(myType, new object[] { pEnterClientInterface });
            this.mEpiInterpreter.Host = pEnterClientInterface;

            //this.mEpiInterpreter = new EpiInterpreterParser(Epi.Resources.ResourceLoader.GetEnterCompiledGrammarTable(), pEnterClientInterface, Rule_Context.eRunMode.Enter);
            this.EnterClientInterface = pEnterClientInterface;
            this.AfterStack           = new Stack <KeyValuePair <EventActionEnum, StackCommand> >();
            this.RecordNumberMap      = new Dictionary <int, int>();
            this.mView = pView;
        }
 public bool Register(IEnterInterpreter enterInterpreter)
 {
     enterInterpreter.Host = this;
     return true;
 }
        private void RunWizardForNewProjectFromTemplate(string selectedTemplate = null)
        {
            selectedTemplate = selectedTemplate == null ? string.Empty : selectedTemplate;

            ProjectFromTemplateDialog dialog = new ProjectFromTemplateDialog(selectedTemplate);

            string projectName = string.Empty;
            string projectDescription = string.Empty;
            string projectLocation = string.Empty;
            string dataDBInfo = string.Empty;
            Data.DbDriverInfo dbDriverInfo = new Data.DbDriverInfo();
            string projectTemplatePath = string.Empty;

            try
            {
                dialog.ShowDialog();

                if (dialog.DialogResult == DialogResult.OK)
                {
                    CloseCurrentProject();
                    projectName = dialog.ProjectName;
                    projectLocation = dialog.ProjectLocation;
                    dataDBInfo = dialog.DataDBInfo;
                    dbDriverInfo = dialog.DriverInfo;
                    projectTemplatePath = dialog.ProjectTemplatePath;
                }
                else
                {
                    return;
                }
            }
            finally
            {
                dialog.Dispose();
                GC.Collect();
                Refresh();
            }

            canvas.HideUpdateStart(SharedStrings.CREATING_PROJECT);

            Project newProject = new Project();

            newProject = newProject.CreateProject(
                projectName,
                projectDescription,
                projectLocation,
                dataDBInfo,
                dbDriverInfo);

            if (newProject != null)
            {
                mediator.Project = newProject;
                if (this.Interpreter == null)
                {
                    Assembly assembly = Assembly.Load(newProject.EnterMakeviewIntepreter);
                    Type myType = assembly.GetType(newProject.EnterMakeviewIntepreter + ".EpiInterpreterParser");
                    this.Interpreter = (IEnterInterpreter)Activator.CreateInstance(myType, new object[] { this.mediator });
                    this.Interpreter.Host = this.mediator;
                }

                canvas.UpdateHidePanel(SharedStrings.LOADING_PROJECT);

                projectExplorer.LoadProject(newProject);

                Template template = new Template(this.mediator);
                template.CreateFromTemplate(projectTemplatePath);

                //EnableFeatures();
                OnProjectAccessed(newProject);

                // The code below is needed to catch a condition where the ParentView property of each View object is
                // not set during the creation of the template. Instead of re-writing this code in the template creation
                // process, we simply force the metadata to be refreshed (which assigns the ParentView property correctly).
                newProject.views = null;
                newProject.LoadViews();
            }

            canvas.HideUpdateEnd();
            EnableFeatures();
        }
        /// <summary>
        /// Runs the wizard for a new project
        /// </summary>
        private void RunWizardForNewProject()
        {
            ProjectCreationDialog dialog = new ProjectCreationDialog();
            dialog.ShowDialog();

            if (dialog.DialogResult == DialogResult.OK)
            {
                BeginBusy(SharedStrings.CREATING_PROJECT);
                Project project = dialog.Project;

                mediator.Project = project;
                if (this.Interpreter == null)
                {
                    Assembly assembly = Assembly.Load(project.EnterMakeviewIntepreter);
                    Type myType = assembly.GetType(project.EnterMakeviewIntepreter + ".EpiInterpreterParser");
                    this.Interpreter = (IEnterInterpreter)Activator.CreateInstance(myType, new object[] { this.mediator });
                    this.Interpreter.Host = this.mediator;
                }

                projectExplorer.LoadProject(project);
                projectExplorer.AddPageToCurrentView();
                EnableFeatures();
                OnProjectAccessed(project);
                dialog.Close();
                EndBusy();
            }
        }
        /// <summary>
        /// Obtains information for project to be opened
        /// and displays it in the treenode, explorer
        /// </summary>
        private void OpenProject(Project project)
        {
            Epi.Data.IDbDriver db = project.CollectedData.GetDbDriver();
            projectPermissions = db.GetPermissions();
            if (!CheckAndSetPermissions())
            {
                Epi.Windows.MsgBox.ShowInformation(SharedStrings.INADEQUATE_PERMISSIONS_ACCESS);
                return;
            }
            else if (this.openForViewingOnly)
            {
                Epi.Windows.MsgBox.ShowInformation(SharedStrings.INADEQUATE_PERMISSIONS_MODIFY );
                this.projectExplorer.OpenForViewingOnly = true;
            }
            else
            {
                this.projectExplorer.OpenForViewingOnly = false;
            }

            canvas.HideUpdateStart(SharedStrings.OPENING_PROJECT);
            canvas.OpenForViewingOnly = this.openForViewingOnly;

            mediator.Project = project;
            if (this.Interpreter == null)
            {
                Assembly a = Assembly.Load(project.EnterMakeviewIntepreter);
                Type myType = a.GetType(project.EnterMakeviewIntepreter + ".EpiInterpreterParser");
                this.Interpreter = (IEnterInterpreter)Activator.CreateInstance(myType, new object[] { this.mediator });
                this.Interpreter.Host = this.mediator;
            }

            EnableFeatures();

            try
            {
                bool containsData = false;

                foreach (View view in mediator.Project.Views)
                {
                    if (mediator.Project.CollectedData.TableExists(view.TableName))
                    {
                        containsData = true;
                    }
                }

                if (containsData == false)
                {
                    mediator.Project.Metadata.RemovePageOutlierFields();
                }

                projectExplorer.LoadProject(project);

                OnProjectAccessed(project);

                //try
                //{
                //    Configuration config = Configuration.GetNewInstance();
                //    if (config.Settings.Republish_IsRepbulishable == true)
                //    {
                //        if (!string.IsNullOrWhiteSpace(this.CurrentView.WebSurveyId))
                //        {
                //            mnuPublishToWeb.DropDownItems[0].Enabled = false;
                //            mnuPublishToWeb.DropDownItems[1].Enabled = true;
                //            mnuPublishToWeb.DropDownItems[2].Enabled = true;
                //            mnuPublishToWeb.DropDownItems[3].Enabled = true;
                //            mnuPublishToWeb.DropDownItems[4].Enabled = true;
                //        }
                //        else
                //        {
                //            mnuPublishToWeb.DropDownItems[0].Enabled = true;
                //            mnuPublishToWeb.DropDownItems[1].Enabled = false;
                //            mnuPublishToWeb.DropDownItems[2].Enabled = false;
                //            mnuPublishToWeb.DropDownItems[3].Enabled = false;
                //            mnuPublishToWeb.DropDownItems[4].Enabled = false;
                //        }
                //    }
                //    else
                //    {
                //        mnuPublishToWeb.DropDownItems[0].Enabled = true;
                //        mnuPublishToWeb.DropDownItems[1].Enabled = false;
                //        mnuPublishToWeb.DropDownItems[2].Enabled = false;
                //        mnuPublishToWeb.DropDownItems[3].Enabled = false;
                //        mnuPublishToWeb.DropDownItems[4].Enabled = false;
                //    }
                //}
                //catch (Exception ex)
                //{
                //    mnuPublishToWeb.DropDownItems[0].Enabled = true;
                //    mnuPublishToWeb.DropDownItems[1].Enabled = false;
                //    mnuPublishToWeb.DropDownItems[2].Enabled = false;
                //    mnuPublishToWeb.DropDownItems[3].Enabled = false;
                //    mnuPublishToWeb.DropDownItems[4].Enabled = false;
                //}

                this.SetPublishMenuItems(this.CurrentView);
                SetDataTableMenuItems();
                mediator.InitialData = new InitialCollectedData(project.CollectedData);
                canvas.HideUpdateEnd();
            }
            finally
            {
                canvas.WaitPanelForceHide();
            }

            if (this.openForViewingOnly)
            {
                canvas.EnablePagePanel(false);
            }
            else
            {
                canvas.EnablePagePanel(true);
            }
        }
Exemple #11
0
        string QueryString; // level= & event= & identifier View | record | page | field

        #endregion Fields

        #region Constructors

        public StackCommand(IEnterInterpreter pEnterInterpreter, string pLevel, string pEvent, string pIdentifier)
        {
            this.EnterInterpreter = pEnterInterpreter;
            this.QueryString = string.Format("level={0}&event={1}&identifier={2}", pLevel.ToLower(), pEvent.ToLower(), pIdentifier.ToLower());
        }