예제 #1
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;
        }
예제 #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;
        }
 public SocialNetworkGraph(Epi.View view, Epi.Data.IDbDriver db)
 {
     InitializeComponent();
     this.db              = db;
     this.view            = view;
     this.Loaded         += new RoutedEventHandler(SocialNetworkGraph_Loaded);
     grdMain.SizeChanged += new SizeChangedEventHandler(grdMain_SizeChanged);
 }
예제 #4
0
 public LayerList(ESRI.ArcGIS.Client.Map myMap, Epi.View view, Epi.Data.IDbDriver db, DashboardHelper dashboardHelper)
 {
     InitializeComponent();
     this.myMap = myMap;
     this.view = view;
     this.db = db;
     this.dashboardHelper = dashboardHelper;
 }
예제 #5
0
        public LayerList(ESRI.ArcGIS.Client.Map myMap, Epi.View view, Epi.Data.IDbDriver db, DashboardHelper dashboardHelper)
        {
            InitializeComponent();

            #region Translation
            tblockMapLayers.Text = DashboardSharedStrings.GADGET_MAP_LAYERS;
            #endregion
        }
 public SocialNetworkGraph(Epi.View view, Epi.Data.IDbDriver db)
 {
     InitializeComponent();
     this.db = db;
     this.view = view;
     this.Loaded += new RoutedEventHandler(SocialNetworkGraph_Loaded);
     grdMain.SizeChanged += new SizeChangedEventHandler(grdMain_SizeChanged);
 }
예제 #7
0
        public RepublishSurveyFields(string pOrganizationKey, Epi.View pView, string pTemplate)
        {
            InitializeComponent();

            this.OrganizationKey = pOrganizationKey;
            this.view            = pView;
            this.template        = pTemplate;
        }
예제 #8
0
        public void ClickFieldHandler(object sender, ClickFieldEventArg e)
        {
            Control currentControl = (Control)sender;

            if (e.Field is RelatedViewField)
            {
                this.EnterCheckCodeEngine.CheckCodeHandler(sender, new RunCheckCodeEventArgs(EventActionEnum.ClickField, ""));

                if (CheckRequiredFields(currentControl))
                {
                    RelatedViewField rvField   = (RelatedViewField)e.Field;
                    Epi.View         childView = rvField.GetProject().Metadata.GetChildView(rvField);

                    if (childView == null)
                    {
                        MsgBox.Show(SharedStrings.WARNING_CHILD_VIEW_NOT_SET, SharedStrings.ENTER);
                    }
                    else
                    {
                        childView.ReturnToParent = rvField.ShouldReturnToParent;
                        if (childView != null)
                        {
                            this.SetFieldData();
                            this.EnterCheckCodeEngine.SaveRecord();
                            childView.ForeignKeyField.CurrentRecordValueString = rvField.GetView().CurrentGlobalRecordId;
                            this.OpenViewHandler(this, new OpenViewEventArgs(childView));
                        }
                    }
                }
            }
            else if (e.Field is CommandButtonField)
            {
                ControlFactory   factory   = ControlFactory.Instance;
                Epi.Page         ThisPage  = this.EnterCheckCodeEngine.CurrentView.CurrentPage;
                Epi.Fields.Field ThisField = this.EnterCheckCodeEngine.CurrentView.CurrentField;

                this.EnterCheckCodeEngine.CheckCodeHandler(sender, new RunCheckCodeEventArgs(EventActionEnum.ClickField, ""));
            }
            else if (e.Field is ImageField)
            {
                SelectImage(e.Field as ImageField, sender as PictureBox);
            }
            else if (e.Field is CheckBoxField)
            {
                ControlFactory   factory   = ControlFactory.Instance;
                Epi.Page         ThisPage  = this.EnterCheckCodeEngine.CurrentView.CurrentPage;
                Epi.Fields.Field ThisField = this.EnterCheckCodeEngine.CurrentView.CurrentField;
                this.EnterCheckCodeEngine.CheckCodeHandler(sender, new RunCheckCodeEventArgs(EventActionEnum.ClickField, ""));
            }
            else if (e.Field is OptionField)
            {
                ControlFactory   factory   = ControlFactory.Instance;
                Epi.Page         ThisPage  = this.EnterCheckCodeEngine.CurrentView.CurrentPage;
                Epi.Fields.Field ThisField = this.EnterCheckCodeEngine.CurrentView.CurrentField;
                this.EnterCheckCodeEngine.CheckCodeHandler(sender, new RunCheckCodeEventArgs(EventActionEnum.ClickField, ""));
            }
        }
예제 #9
0
 public TransmissionChain(Epi.View view, Epi.Data.IDbDriver db, Canvas transmissionCanvas, Canvas transmissionDates, MainWindow mainWindow)
 {
     this.db   = db;
     this.view = view;
     this.transmissionCanvas = transmissionCanvas;
     this.transmissionDates  = transmissionDates;
     this.mainWindow         = mainWindow;
     this.IsEnterOpen        = false;
 }
예제 #10
0
 private void FillComboBox(Epi.View view)
 {
     cbxTime.Items.Clear();
     foreach (Epi.Fields.Field f in view.Fields)
     {
         if ((f is Epi.Fields.DateField) || (f is Epi.Fields.DateTimeField) || (f is Epi.Fields.TimeField))
         {
             cbxTime.Items.Add(f.Name);
         }
     }
 }
예제 #11
0
        public LayerAdder(ESRI.ArcGIS.Client.Map myMap, Epi.View view, Epi.Data.IDbDriver db, DashboardHelper dashboardHelper, LayerList layerList, MapControl mapControl)
        {
            InitializeComponent();

            this.myMap = myMap;
            this.view = view;
            this.db = db;
            this.dashboardHelper = dashboardHelper;
            this.layerList = layerList;
            this.mapControl = mapControl;

            AddItem();
        }
예제 #12
0
        public LayerAdder(ESRI.ArcGIS.Client.Map myMap, Epi.View view, Epi.Data.IDbDriver db, DashboardHelper dashboardHelper, LayerList layerList, MapControl mapControl)
        {
            InitializeComponent();

            this.myMap           = myMap;
            this.view            = view;
            this.db              = db;
            this.dashboardHelper = dashboardHelper;
            this.layerList       = layerList;
            this.mapControl      = mapControl;

            AddItem();
        }
예제 #13
0
        /// <summary>
        /// Copy a view
        /// </summary>
        /// <param name="other"></param>
        public void CopyTo(Epi.View other)
        {
            other.Name          = this.NameWithoutPrefix;
            other.IsRelatedView = this.IsRelatedView;

            /*
             * other.CheckCodeVariableDefinitions = this.CheckCodeVariableDefinitions;
             * other.CheckCodeBefore = this.CheckCodeBefore;
             * other.WebSurveyId = this.CheckCodeAfter;
             * other.RecordCheckCodeBefore = this.RecordCheckCodeBefore;
             * other.RecordCheckCodeAfter = this.RecordCheckCodeAfter;
             * other.IsRelatedView = this.IsRelatedView;*/
        }
예제 #14
0
        public LayerListItem(ESRI.ArcGIS.Client.Map myMap, Epi.View view, Epi.Data.IDbDriver db, DashboardHelper dashboardHelper, MapControl mapControl)
        {
            InitializeComponent();

            this.myMap = myMap;
            this.view = view;
            this.db = db;
            this.dashboardHelper = dashboardHelper;
            this.mapControl = mapControl;

            cbxLayerType.SelectionChanged += new SelectionChangedEventHandler(cbxLayerType_SelectionChanged);
            cbxLayerType.SelectedIndex = 0;
            lblLayerType.Foreground = new SolidColorBrush(FontColor);
        }
예제 #15
0
        public LayerListItem(ESRI.ArcGIS.Client.Map myMap, Epi.View view, Epi.Data.IDbDriver db, DashboardHelper dashboardHelper, MapControl mapControl)
        {
            InitializeComponent();

            this.myMap           = myMap;
            this.view            = view;
            this.db              = db;
            this.dashboardHelper = dashboardHelper;
            this.mapControl      = mapControl;

            cbxLayerType.SelectionChanged += new SelectionChangedEventHandler(cbxLayerType_SelectionChanged);
            cbxLayerType.SelectedIndex     = 0;
            lblLayerType.Foreground        = new SolidColorBrush(FontColor);
        }
예제 #16
0
        /*private void OpenView(object sender, RunCheckCodeEventArgs e)
         * {
         *
         * }*/
        public void CloseView(object sender, RunCheckCodeEventArgs e)
        {
            //execute after stack until current level = view
            while (this.AfterStack.Count > 0)
            {
                this.AfterStack.Pop().Value.Execute();
            }

            this.mCurrentField = null;
            this.mCurrentPage  = null;
            this.mView         = null;

            // then execute current level after_view
            //this.RunCheckCodeCommands(this.mView.CheckCodeAfter);
        }
예제 #17
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;
        }
예제 #18
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;
        }
예제 #19
0
 public TimeConfigDialog(Epi.View view)
 {
     InitializeComponent();
     FillComboBox(view);
 }
예제 #20
0
 public void CopyFrom(Epi.View other)
 {
     throw new NotImplementedException();
 }
예제 #21
0
 public OpenViewEventArgs(Epi.View pView, string record)
 {
     this.mView        = pView;
     this.RecordNumber = record;
 }
예제 #22
0
 public OpenViewEventArgs(Epi.View pView)
 {
     this.mView        = pView;
     this.RecordNumber = string.Empty;
 }
예제 #23
0
        private async void CheckForDbConnectivityAsync()
        {
            if (IsShowingConnectionEditor == true || IsCheckingConnection == true) // don't check for connectivity while the editor is open or if we're already checking
            {
                return;
            }

            IsCheckingConnection = true;

            await Task.Factory.StartNew(delegate
            {
                Epi.Project project = null;

                try
                {
                    if (!System.IO.File.Exists(this.FileInfo.FullName))
                    {
                        IsConnected          = false;
                        IsCheckingConnection = false;
                        return;
                    }

                    project = new Epi.Project(this.FileInfo.FullName);
                    Epi.Data.IDbDriver db = project.CollectedData.GetDatabase();
                    if (db != null)
                    {
                        ConnectionString      = db.ConnectionString;
                        InputConnectionString = db.ConnectionString;

                        if (db is Epi.Data.Office.OleDbDatabase)
                        {
                            IsLocalStorage       = true;
                            IsServerBasedStorage = false;
                        }
                        else
                        {
                            IsLocalStorage       = false;
                            IsServerBasedStorage = true;
                        }
                    }
                    //if (project.CollectedData.GetDatabase() is Epi.Data.Office.OleDbDatabase)
                    //{
                    //    string dataSource = project.CollectedData.DataSource;
                    //    dataSource = dataSource.Replace("data source=", String.Empty);
                    //    bool fileExists = System.IO.File.Exists(dataSource);
                    //    if (!fileExists)
                    //    {
                    //        IsConnected = false;
                    //        return;
                    //    }
                    //}

                    Epi.View view = project.Views["CaseInformationForm"];
                    IsConnected   = true;
                }
                catch (Epi.GeneralException)
                {
                    IsConnected = false;
                }
                catch (System.Security.Cryptography.CryptographicException)
                {
                    // keys don't match
                    IsConnected = false;
                }
                catch (Exception)
                {
                    IsConnected = false;
                }
                finally
                {
                    if (project != null)
                    {
                        project.Dispose();
                    }

                    IsCheckingConnection = false;
                }
            });
        }
예제 #24
0
 public OpenViewEventArgs(Epi.View pView)
 {
     this.mView = pView;
     this.RecordNumber = string.Empty;
 }
예제 #25
0
        /*private void OpenView(object sender, RunCheckCodeEventArgs e)
        {

        }*/
        public void CloseView(object sender, RunCheckCodeEventArgs e)
        {
            //execute after stack until current level = view
            while (this.AfterStack.Count > 0)
            {
                    this.AfterStack.Pop().Value.Execute();
            }

            this.mCurrentField = null;
            this.mCurrentPage = null;
            this.mView = null;

            // then execute current level after_view
            //this.RunCheckCodeCommands(this.mView.CheckCodeAfter);
        }
예제 #26
0
        void IAnalysisCheckCode.ShowGridTable(List <DataRow> table, List <string> identifierList, Epi.View epiView)
        {
            Epi.Windows.Analysis.Forms.OutputEventArg args = new OutputEventArg();

            args.Table          = table;
            args.IdentifierList = identifierList;

            if (epiView != null)
            {
                args.EpiView = epiView;
            }

            args.OutputEventType = OutputEventArg.OutputEventArgEnum.ShowGridTable;
            queue.Enqueue(args);
            OnChanged();
        }
예제 #27
0
 public OpenViewEventArgs(Epi.View pView, string record)
 {
     this.mView = pView;
     this.RecordNumber = record;
 }
예제 #28
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);
        }