Пример #1
0
        public void SetConfig(IDMEEditor pDMEEditor, IDMLogger plogger, IUtil putil, string[] args, PassedArgs obj, IErrorsInfo per)
        {
            Passedarg = obj;

            Logger          = plogger;
            util            = putil;
            ErrorObject     = per;
            DMEEditor       = pDMEEditor;
            vds             = (DataViewDataSource)DMEEditor.GetDataSource(obj.DMView.DataViewDataSourceID);
            Visutil         = (IVisUtil)obj.Objects.Where(c => c.Name == "VISUTIL").FirstOrDefault().obj;
            branch          = (IBranch)obj.Objects.Where(c => c.Name == "Branch").FirstOrDefault().obj;
            EntityStructure = (EntityStructure)obj.Objects.Where(c => c.Name == "EntityStructure").FirstOrDefault().obj;
            if (obj.Objects.Where(c => c.Name == "ParentBranch").Any())
            {
                Parentbranch = (IBranch)obj.Objects.Where(c => c.Name == "ParentBranch").FirstOrDefault().obj;
                ParentEntity = vds.GetEntityStructure(Parentbranch.BranchText, true);
            }


            if (obj.CurrentEntity != null)
            {
                EntityName = obj.CurrentEntity;
            }
            else
            {
                EntityName = "";
            }
            this.entitiesBindingNavigatorSaveItem.Click += EntitiesBindingNavigatorSaveItem_Click;
            this.otherentitiesbindingSource.DataSource   = vds.Entities.Where(o => o.Id > 0 && o.Id != EntityStructure.Id);

            this.entitiesBindingSource.DataSource = EntityStructure;
            this.fieldsBindingSource.DataSource   = this.entitiesBindingSource;
            //this.otherentityfieldsbindingSource.ResetBindings(true);
            this.ParentEntitycomboBox.SelectedIndexChanged += ParentEntitycomboBox_SelectedIndexChanged;
        }
Пример #2
0
        //private void BlockColumnsDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        //{
        //    var senderGrid = (DataGridView)sender;

        //    if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
        //        e.RowIndex >= 0)
        //    {
        //        //if ((object)column == (object)color)
        //        //{
        //        //    colorDialog.Color = Color.Blue;
        //        //    colorDialog.ShowDialog();
        //        //}
        //    }

        //}

        //private void BlockColumnsDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        //{
        //    // Ignore clicks that are not in our
        //    if (e.ColumnIndex == blockColumnsDataGridView.Columns["MyButtonColumn"].Index && e.RowIndex >= 0)
        //    {
        //        Console.WriteLine("Button on row {0} clicked", e.RowIndex);
        //    }
        //}

        private void BlocksBindingSource_CurrentChanged(object sender, EventArgs e)
        {
            ReportBlock x = (ReportBlock)blocksBindingSource.Current;

            if (x.BlockColumns.Count() == 0)
            {
                if (!string.IsNullOrEmpty(this.viewIDComboBox.Text))
                {
                    ds = (DataViewDataSource)DMEEditor.GetDataSource(this.viewIDComboBox.Text);
                    EntityStructure           ent = ds.GetEntityStructure(this.entityIDComboBox.Text, true);
                    List <ReportBlockColumns> ls  = new List <ReportBlockColumns>();
                    if (ent != null)
                    {
                        int i = 0;
                        foreach (EntityField item in ent.Fields)
                        {
                            ReportBlockColumns c = new ReportBlockColumns();
                            c.ColumnName  = item.fieldname;
                            c.ColumnSeq   = i;
                            c.DisplayName = item.fieldname;
                            c.Show        = true;
                            i            += 1;

                            ls.Add(c);
                        }
                        x.BlockColumns = ls;
                    }
                }
            }
        }
Пример #3
0
        public void SetConfig(IDMEEditor pbl, IDMLogger plogger, IUtil putil, string[] args, PassedArgs e, IErrorsInfo per)
        {
            Passedarg   = e;
            Logger      = plogger;
            ErrorObject = per;
            DMEEditor   = pbl;
            Visutil     = (IVisUtil)e.Objects.Where(c => c.Name == "VISUTIL").FirstOrDefault().obj;

            branch        = (IBranch)e.Objects.Where(c => c.Name == "Branch").FirstOrDefault().obj;
            RootAppBranch = (IBranch)e.Objects.Where(c => c.Name == "RootAppBranch").FirstOrDefault().obj;

            dataViewDataSourceBindingSource.AddingNew += DataViewDataSourceBindingSource_AddingNew;

            entitiesBindingSource.AddingNew += EntitiesBindingSource_AddingNew;
            dataViewDataSourceBindingNavigatorSaveItem.Click += DataViewDataSourceBindingNavigatorSaveItem_Click;
            foreach (var item in Enum.GetValues(typeof(ViewType)))
            {
                this.ViewtypeComboBox.Items.Add(item);
            }

            ds = (DataViewDataSource)DMEEditor.GetDataSource(e.CurrentEntity);
            ds.LoadView();
            dataViewDataSourceBindingSource.DataSource = ds.DataView;
            this.viewNameTextBox.Enabled                 = false;
            this.dataSourcesBindingSource.DataSource     = DMEEditor.DataSources;
            this.dataConnectionsBindingSource.DataSource = DMEEditor.ConfigEditor.DataConnections;
            entitiesBindingSource.DataSource             = dataViewDataSourceBindingSource;
            this.entitiesDataGridView.DataError         += EntitiesDataGridView_DataError;
            this.ChangeDatasourceButton.Click           += ChangeDatasourceButton_Click;
        }
Пример #4
0
        private IDMDataView AddViewFile()
        {
            IDMDataView DataView = null;

            try
            {
                string         viewname        = null;
                string         fullname        = null;
                OpenFileDialog openFileDialog1 = new OpenFileDialog();
                openFileDialog1.InitialDirectory = DMEEditor.ConfigEditor.Config.Folders.Where(i => i.FolderFilesType == FolderFileTypes.DataView).FirstOrDefault().FolderPath;
                openFileDialog1.Filter           = "json files (*.json)|*.txt|All files (*.*)|*.*";

                openFileDialog1.DefaultExt       = "json";
                openFileDialog1.FilterIndex      = 2;
                openFileDialog1.RestoreDirectory = true;
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    viewname = Path.GetFileName(openFileDialog1.FileName);
                    if ((viewname != null) && DMEEditor.ConfigEditor.DataConnectionExist(viewname + ".json") == false)
                    {
                        fullname = openFileDialog1.FileName;  //Path.Combine(Path.GetDirectoryName(openFileDialog1.FileName), Path.GetFileName(openFileDialog1.FileName));
                        ConnectionProperties f = new ConnectionProperties
                        {
                            FileName       = Path.GetFileName(fullname),
                            FilePath       = Path.GetDirectoryName(fullname),
                            Ext            = Path.GetExtension(fullname),
                            ConnectionName = Path.GetFileName(fullname)
                        };

                        f.Category      = DatasourceCategory.VIEWS;
                        f.DriverVersion = "1";
                        f.DriverName    = "DataViewReader";

                        DMEEditor.ConfigEditor.DataConnections.Add(f);
                        DMEEditor.ConfigEditor.SaveDataconnectionsValues();

                        DataViewDataSource ds = (DataViewDataSource)DMEEditor.GetDataSource(f.ConnectionName);

                        DataView = ds.DataView;
                    }
                    DMEEditor.AddLogMessage("Success", "Added View", DateTime.Now, 0, null, Errors.Ok);
                }
                else
                {
                    Visutil.controlEditor.MsgBox("DM Engine", "Please Try another name . DataSource Exist");
                }
            }
            catch (Exception ex)
            {
                string mes = "Could not Added View ";
                DMEEditor.AddLogMessage(ex.Message, mes, DateTime.Now, -1, mes, Errors.Failed);
            };
            return(DataView);
        }
Пример #5
0
        private IDMDataView CreateViewUsingTable(EntityStructure EntitySource)
        {
            IDMDataView DataView         = null;
            IDataSource DataSource       = null;
            IDataSource EntityDataSource = null;

            try
            {
                string viewname = null;
                string fullname = null;
                if (Visutil.controlEditor.InputBox("Create View", "Please Enter Name of View (Name Should not exist already in Views)", ref viewname) == System.Windows.Forms.DialogResult.OK)
                {
                    if ((viewname != null) && DMEEditor.ConfigEditor.DataConnectionExist(viewname + ".json") == false)
                    {
                        fullname = Path.Combine(DMEEditor.ConfigEditor.Config.Folders.Where(x => x.FolderFilesType == FolderFileTypes.DataView).FirstOrDefault().FolderPath, viewname + ".json");
                        ConnectionProperties f = new ConnectionProperties
                        {
                            FileName       = Path.GetFileName(fullname),
                            FilePath       = Path.GetDirectoryName(fullname),
                            Ext            = Path.GetExtension(fullname),
                            ConnectionName = Path.GetFileName(fullname)
                        };

                        f.Category      = DatasourceCategory.VIEWS;
                        f.DriverVersion = "1";
                        f.DriverName    = "DataViewReader";

                        DMEEditor.ConfigEditor.DataConnections.Add(f);
                        DataViewDataSource ds = (DataViewDataSource)DMEEditor.GetDataSource(f.ConnectionName);
                        EntityDataSource = DMEEditor.GetDataSource(EntitySource.DataSourceID);
                        if (EntitySource != null)
                        {
                            int x = ds.AddEntitytoDataView(EntityDataSource, EntitySource.EntityName, EntityDataSource.Dataconnection.ConnectionProp.SchemaName, null);
                        }
                        ds.WriteDataViewFile(fullname);
                        DataSource = DMEEditor.GetDataSource(f.ConnectionName);
                        DataView   = ds.DataView;
                        DataView.EntityDataSourceID = EntityDataSource.DatasourceName;
                    }
                    DMEEditor.AddLogMessage("Success", "Added View", DateTime.Now, 0, null, Errors.Ok);
                }
                else
                {
                    Visutil.controlEditor.MsgBox("DM Engine", "Please Try another name . DataSource Exist");
                }
            }
            catch (Exception ex)
            {
                string mes = "Could not Added View ";
                DMEEditor.AddLogMessage(ex.Message, mes, DateTime.Now, -1, mes, Errors.Failed);
            };
            return(DataView);
        }
Пример #6
0
 private void ViewIDComboBox_SelectedValueChanged(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.viewIDComboBox.Text))
     {
         ds = (DataViewDataSource)DMEEditor.GetDataSource(this.viewIDComboBox.Text);
         if (ds != null)
         {
             this.entityIDComboBox.Items.Clear();
             List <string> ls = ds.GetEntitesList().ToList();
             foreach (string item in ls)
             {
                 this.entityIDComboBox.Items.Add(item);
             }
         }
     }
 }
Пример #7
0
        public void SetConfig(IDMEEditor pbl, IDMLogger plogger, IUtil putil, string[] args, PassedArgs e, IErrorsInfo per)
        {
            Passedarg   = e;
            Logger      = plogger;
            ErrorObject = per;
            DMEEditor   = pbl;
            Visutil     = (IVisUtil)e.Objects.Where(c => c.Name == "VISUTIL").FirstOrDefault().obj;

            branch = (IBranch)e.Objects.Where(c => c.Name == "Branch").FirstOrDefault().obj;
            RootCompositeLayerBranch = (IBranch)e.Objects.Where(c => c.Name == "RootCompositeLayerBranch").FirstOrDefault().obj;

            if (branch.DataSourceName != null)
            {
                ds = (DataViewDataSource)DMEEditor.GetDataSource(branch.DataSourceName);
                ds.Openconnection();
            }

            dataViewDataSourceNameComboBox.Items.Clear();
            foreach (var item in DMEEditor.ConfigEditor.DataConnections.Where(x => x.Category == DatasourceCategory.VIEWS).ToList())
            {
                dataViewDataSourceNameComboBox.Items.Add(item.ConnectionName);
            }
            localDBDriverComboBox.Items.Clear();
            localDBDriverVersionComboBox.Items.Clear();
            foreach (var item in DMEEditor.ConfigEditor.DataDriversClasses.Where(x => x.CreateLocal == true && x.classHandler != null))
            {
                localDBDriverComboBox.Items.Add(item.classHandler);
                localDBDriverVersionComboBox.Items.Add(item.version);
            }


            localDBDriverComboBox.SelectedValueChanged += LocalDBDriverComboBox_SelectedValueChanged;
            this.FolderLocationbutton.Click            += FolderLocationbutton_Click;
            Createbutton.Click += Createbutton_Click;
            compositeQueryLayersBindingSource.DataSource = DMEEditor.ConfigEditor.CompositeQueryLayers;
            compositeQueryLayersBindingSource.AddingNew += CompositeQueryLayersBindingSource_AddingNew;
            compositeQueryLayersBindingSource.AddNew();
            this.layerNameTextBox.TextChanged += LayerNameTextBox_TextChanged;
            //    localDBDriverComboBox.SelectedIndex = 1;
        }
Пример #8
0
        private DataTable CopyReportDefinition(int blocknumber)
        {
            try

            {
                string QueryString = "select " + GetSelectedFields(blocknumber) + " from " + Definition.Blocks[blocknumber].EntityID;
                DataViewDataSource ds = (DataViewDataSource)DMEEditor.GetDataSource(Definition.Blocks[blocknumber].ViewID);

                DataTable PrintData = (DataTable)ds.GetEntity(Definition.Blocks[blocknumber].EntityID, null );
          //      PrintData.Wait();
                DMEEditor.AddLogMessage("Success", $"Copying Report Data", DateTime.Now, 0, null, Errors.Ok);
                return PrintData;
            }
            catch (Exception ex)
            {
                string errmsg = "Error in Copying Report Data";
                DMEEditor.AddLogMessage("Fail", $"{errmsg}:{ex.Message}", DateTime.Now, 0, null, Errors.Failed);
                return null;
            }


        }
Пример #9
0
        private void BlocksBindingSource_AddingNew(object sender, AddingNewEventArgs e)
        {
            ReportBlock x = new ReportBlock();

            e.NewObject = x;
            ReportTemplate t = (ReportTemplate)reportsBindingSource.Current;

            if (t.Blocks == null)
            {
                t.Blocks = new List <ReportBlock>();
            }
            if (!string.IsNullOrEmpty(this.viewIDComboBox.Text))
            {
                ds = (DataViewDataSource)DMEEditor.GetDataSource(this.viewIDComboBox.Text);
                EntityStructure           ent = ds.GetEntityStructure(this.entityIDComboBox.Text, true);
                List <ReportBlockColumns> ls  = new List <ReportBlockColumns>();
                if (ent != null)
                {
                    int i = 0;
                    foreach (EntityField item in ent.Fields)
                    {
                        ReportBlockColumns c = new ReportBlockColumns();
                        c.ColumnName  = item.fieldname;
                        c.ColumnSeq   = i;
                        c.DisplayName = item.fieldname;
                        c.Show        = true;
                        i            += 1;

                        ls.Add(c);
                    }
                }
                x.BlockColumns = ls;
            }


            t.Blocks.Add(x);
        }
        public void SetConfig(IDMEEditor pDMEEditor, IDMLogger plogger, IUtil putil, string[] args, PassedArgs obj, IErrorsInfo per)
        {
            Passedarg = obj;

            Logger      = plogger;
            util        = putil;
            ErrorObject = per;
            DMEEditor   = pDMEEditor;
            vds         = (DataViewDataSource)DMEEditor.GetDataSource(obj.DMView.DataViewDataSourceID);
            Visutil     = (IVisUtil)obj.Objects.Where(c => c.Name == "VISUTIL").FirstOrDefault().obj;

            branch = (IBranch)obj.Objects.Where(c => c.Name == "Branch").FirstOrDefault().obj;

            if (obj.Objects.Where(c => c.Name == "ParentBranch").Any())
            {
                Parentbranch = (IBranch)obj.Objects.Where(c => c.Name == "ParentBranch").FirstOrDefault().obj;
                ParentEntity = vds.GetEntityStructure(Parentbranch.BranchText, true);
            }

            foreach (ConnectionProperties c in DMEEditor.ConfigEditor.DataConnections)
            {
                var t = dataSourceIDComboBox.Items.Add(c.ConnectionName);
            }
            foreach (var item in Enum.GetValues(typeof(ViewType)))
            {
                viewtypeComboBox.Items.Add(item);
            }

            this.dataSourceIDComboBox.SelectedIndexChanged += ComboBox1_SelectedIndexChanged;
            this.ValidateQuerybutton.Click += ValidateQuerybutton_Click;
            //  this.ValidateFKbutton.Click += ValidateFKbutton_Click;
            this.SaveEntitybutton.Click += SaveEntitybutton_Click;
            // this.ValidateFieldsbutton.Click += ValidateFieldsbutton_Click;

            if (obj.CurrentEntity != null)
            {
                EntityName = obj.CurrentEntity;
            }
            else
            {
                EntityName = "";
            }

            if (Passedarg.EventType == "NEWENTITY" || Passedarg.EventType == "NEWECHILDNTITY")
            {
                EntityStructure              = new EntityStructure();
                EntityStructure.Created      = false;
                EntityStructure.Fields       = new System.Collections.Generic.List <EntityField>();
                EntityStructure.Id           = vds.Entities.Max(p => p.Id) + 1;
                EntityStructure.DataSourceID = vds.DatasourceName;
                if (vds.Category == DatasourceCategory.VIEWS)
                {
                    EntityStructure.ViewID       = vds.ViewID;
                    EntityStructure.Viewtype     = ViewType.Query;
                    EntityStructure.DatabaseType = DataSourceType.Json;
                }

                if (ParentEntity != null)
                {
                    EntityStructure.ParentId = ParentEntity.Id;
                }
                else
                {
                    EntityStructure.ParentId = -1;
                }
                EntityStructure.Drawn    = false;
                this.nameTextBox.Enabled = true;
            }
            else
            {
                this.nameTextBox.Enabled = false;
                EntityStructure          = (EntityStructure)obj.Objects.Where(c => c.Name == "EntityStructure").FirstOrDefault().obj;
            }

            this.dataHierarchyBindingSource.ResetBindings(true);
            this.fieldsBindingSource.ResetBindings(true);
            dataHierarchyBindingSource.DataSource = EntityStructure;
        }