コード例 #1
0
        private void DataConnectionsBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            ErrorObject.Flag = Errors.Ok;
            try

            {
                dataConnectionsBindingSource.EndEdit();

                ds = (List <ConnectionProperties>)dataConnectionsBindingSource.DataSource;
                DMEEditor.ConfigEditor.UpdateDataConnection(ds, DataSourceCategoryType);
                DMEEditor.ConfigEditor.SaveDataconnectionsValues();
                if (branch != null)
                {
                    branch.CreateChildNodes();
                }

                MessageBox.Show("Changes Saved Successfuly", "Beep");
            }
            catch (Exception ex)
            {
                ErrorObject.Flag = Errors.Failed;
                MessageBox.Show("Error Saving Database connection", "Beep");
                ErrorObject.Message = $"Error saving Data for Database connection:{ex.Message}";
                Logger.WriteLog($"Error saving Data for Database connection  :{ex.Message}");
            }
        }
コード例 #2
0
        private void SaveAppDefinitionbutton_Click(object sender, EventArgs e)
        {
            try

            {
                if (string.IsNullOrEmpty(this.ouputFolderTextBox.Text) || string.IsNullOrEmpty(this.appTitleTextBox.Text) || string.IsNullOrEmpty(this.dataViewDataSourceNameComboBox.Text) || string.IsNullOrEmpty(this.appNameTextBox.Text))
                {
                    DMEEditor.AddLogMessage("Fail", $"Please Check All required Fields entered", DateTime.Now, 0, null, Errors.Ok);
                    MessageBox.Show($"Please Check All required Fields entered");
                }
                else
                {
                    appsBindingSource.EndEdit();
                    DMEEditor.ConfigEditor.SaveAppValues();
                    RootAppBranch.CreateChildNodes();
                    DMEEditor.AddLogMessage("Success", $"Generated App:{appNameTextBox.Text}", DateTime.Now, 0, null, Errors.Ok);
                    MessageBox.Show($"Generated App:{appNameTextBox.Text}");
                    this.ParentForm.Close();
                }
            }
            catch (Exception ex)
            {
                string errmsg = "Error in Generating App";
                DMEEditor.AddLogMessage("Fail", $"{errmsg}:{ex.Message}", DateTime.Now, 0, null, Errors.Failed);
                MessageBox.Show($"{errmsg}:{ex.Message}");
            }
        }
コード例 #3
0
        private void MappingSchemaBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            try
            {
                fldMappingBindingSource.EndEdit();
                mappingSchemaBindingSource.EndEdit();
                mapsBindingSource.EndEdit();

                if (!string.IsNullOrWhiteSpace(schemaNameTextBox.Text))
                {
                    DMEEditor.ConfigEditor.SaveMappingSchemaValue();
                    branch.CreateChildNodes();
                }
                else
                {
                    MessageBox.Show("Please Complete all data fields before save");
                }
            }
            catch (Exception ex)
            {
                ErrorObject.Flag = Errors.Failed;
                ErrorObject.Ex   = ex;
                Logger.WriteLog($"Error in getting File Data ({ex.Message}) ");
            }
        }
コード例 #4
0
ファイル: uc_Report.cs プロジェクト: The-Tech-Idea/BeepDM
        private void Savebutton_Click(object sender, EventArgs e)
        {
            try

            {
                if (string.IsNullOrEmpty(this.nameTextBox.Text) || string.IsNullOrEmpty(this.titleTextBox.Text) || string.IsNullOrEmpty(this.subTitleTextBox.Text))
                {
                    DMEEditor.AddLogMessage("Fail", $"Please Check All required Fields entered", DateTime.Now, 0, null, Errors.Ok);
                    MessageBox.Show($"Please Check All required Fields entered");
                }
                else
                {
                    blockColumnsBindingSource.MoveFirst();
                    blocksBindingSource.MoveFirst();
                    reportsBindingSource.MoveFirst();
                    blockColumnsBindingSource.EndEdit();
                    this.blocksBindingSource.EndEdit();
                    this.reportsBindingSource.EndEdit();
                    DMEEditor.ConfigEditor.SaveReportDefinitionsValues();
                    RootBranch.CreateChildNodes();
                    MessageBox.Show($"Generated Report:{nameTextBox.Text}");
                    DMEEditor.AddLogMessage("Success", $"Generated Report", DateTime.Now, 0, null, Errors.Ok);
                    this.ParentForm.Close();
                }
            }
            catch (Exception ex)
            {
                string errmsg = "Error in Generating Report";
                DMEEditor.AddLogMessage("Fail", $"{errmsg}:{ex.Message}", DateTime.Now, 0, null, Errors.Failed);
            }
        }
コード例 #5
0
        private void CreateDBbutton_Click(object sender, EventArgs e)
        {
            try

            {
                if (!DMEEditor.ConfigEditor.DataConnectionExist(databaseTextBox.Text))
                {
                    ConnectionProperties cn = CreateConn();
                    IDataSource          ds = DMEEditor.CreateLocalDataSourceConnection(cn, databaseTextBox.Text, EmbeddedDatabaseTypecomboBox.Text);

                    if (ds != null)
                    {
                        ILocalDB dB = (ILocalDB)ds;
                        bool     ok = dB.CreateDB();
                        if (ok)
                        {
                            //ds.ConnectionStatus = ds.Dataconnection.OpenConnection();
                            DMEEditor.OpenDataSource(cn.ConnectionName);
                        }
                        DMEEditor.ConfigEditor.AddDataConnection(cn);
                        DMEEditor.ConfigEditor.SaveDataconnectionsValues();
                        if (Passedarg.ObjectType == "COMPOSITEDB")
                        {
                        }
                        branch.CreateChildNodes();
                        MessageBox.Show("Local/Embedded Database Created successfully", "Beep");
                    }
                    else
                    {
                        MessageBox.Show("Coudl not Create Local/Embedded Database ", "Beep");
                    }
                }
                else
                {
                    MessageBox.Show("Database Already Exist by this name please try another name ", "Beep");
                }
            }
            catch (Exception ex)
            {
                ErrorObject.Flag = Errors.Failed;
                string errmsg = "Error creating Database";
                MessageBox.Show(errmsg, "Beep");
                ErrorObject.Message = $"{errmsg}:{ex.Message}";
                Logger.WriteLog($" {errmsg} :{ex.Message}");
            }
        }
コード例 #6
0
        private void Createbutton_Click(object sender, EventArgs e)
        {
            try

            {
                if (string.IsNullOrEmpty(this.layerNameTextBox.Text) || string.IsNullOrEmpty(this.localDBDriverVersionComboBox.Text) || string.IsNullOrEmpty(this.layerNameTextBox.Text))
                {
                    MessageBox.Show("Error, Please Fill all missing Fields");
                    throw new InvalidOperationException("Error, Please Fill all missing Fields");
                }
                if (DMEEditor.ConfigEditor.DataConnectionExist(layerNameTextBox.Text))
                {
                    MessageBox.Show("Error, Already there is a Data connection the Same name");
                    throw new InvalidOperationException("Error, Already there is a Data connection the Same name");
                }

                ConnectionProperties    cn      = new ConnectionProperties();
                ConnectionDriversConfig package = DMEEditor.ConfigEditor.DataDriversClasses.Where(x => x.classHandler == localDBDriverComboBox.Text).OrderByDescending(o => o.version).FirstOrDefault();
                Layer                 = (CompositeLayer)compositeQueryLayersBindingSource.Current;
                cn.CompositeLayer     = true;
                cn.ConnectionName     = layerNameTextBox.Text;
                cn.CompositeLayerName = layerNameTextBox.Text;
                cn.ConnectionName     = layerNameTextBox.Text;
                cn.DatabaseType       = package.DatasourceType;
                cn.Category           = package.DatasourceCategory;
                if (!string.IsNullOrEmpty(FileNametextBox.Text) || !string.IsNullOrEmpty(FolderSavelocationlabel.Text))
                {
                    cn.FilePath = FolderSavelocationlabel.Text;
                    cn.FileName = FileNametextBox.Text;
                }
                else
                {
                    cn.FilePath = DMEEditor.ConfigEditor.Config.Folders.Where(x => x.FolderFilesType == FolderFileTypes.DataFiles).FirstOrDefault().FolderPath;
                    cn.FileName = layerNameTextBox.Text;
                }
                if (cn.FilePath.Contains(DMEEditor.ConfigEditor.ExePath))
                {
                    cn.FilePath.Replace(DMEEditor.ConfigEditor.ExePath, ".");
                }
                cn.DriverName                = package.PackageName;
                cn.DriverVersion             = package.version;
                cn.ID                        = DMEEditor.ConfigEditor.DataConnections.Max(p => p.ID) + 1;
                cn.Category                  = DatasourceCategory.RDBMS;
                Layer.DataSourceName         = this.layerNameTextBox.Text;
                Layer.DataViewDataSourceName = this.dataViewDataSourceNameComboBox.Text;
                Layer.Entities               = new List <EntityStructure>();
                compositeQueryLayersBindingSource.EndEdit();
                DMEEditor.ConfigEditor.RemoveDataSourceEntitiesValues(Layer.DataSourceName);
                ILocalDB db = (ILocalDB)DMEEditor.CreateLocalDataSourceConnection(cn, cn.ConnectionName, package.classHandler);
                db.CreateDB();

                DMEEditor.ConfigEditor.AddDataConnection(cn);
                DMEEditor.ConfigEditor.SaveDataconnectionsValues();
                //  DMEEditor.ConfigEditor.SaveCompositeLayersValues();
                //--------------------
                try
                {
                    //  waitForm = new WaitFormFunc();
                    //  waitForm.Show(this.ParentForm);
                    CompositeLayerDataSource compositeLayerDataSource = new CompositeLayerDataSource(cn.ConnectionName, DMEEditor.Logger, DMEEditor, cn.DatabaseType, DMEEditor.ErrorObject);
                    ConnectionDriversConfig  driversConfig            = DMEEditor.Utilfunction.LinkConnection2Drivers(cn);
                    compositeLayerDataSource.Dataconnection.ConnectionProp   = cn;
                    compositeLayerDataSource.Dataconnection.DataSourceDriver = driversConfig;
                    compositeLayerDataSource.LocalDB = db;
                    // compositeLayerDataSource.Dataconnection.OpenConnection();
                    DMEEditor.OpenDataSource(cn.ConnectionName);
                    compositeLayerDataSource.Openconnection();
                    //   Visutil.treeEditor.ShowWaiting();
                    //   Visutil.treeEditor.ChangeWaitingCaption($"Getting  Composed Layer Entities Total:{compositeLayerDataSource.Entities.Count}");
                    compositeLayerDataSource.GetAllEntitiesFromDataView();
                    //    Visutil.treeEditor.HideWaiting();
                    DMEEditor.ConfigEditor.SaveCompositeLayersValues();
                    RootCompositeLayerBranch.CreateChildNodes();
                    //   waitForm.Close();
                }
                catch (Exception ex1)
                {
                    string errmsg = $"Error Creating Composite Layer for view";
                    //   waitForm.Close();
                    DMEEditor.AddLogMessage("Fail", $"{errmsg}:{ex1.Message}", DateTime.Now, 0, null, Errors.Failed);
                }

                MessageBox.Show($"Creating Composite Layer for view {branch.BranchText}");
                DMEEditor.AddLogMessage("Success", $"Creating Composite Layer for view {branch.BranchText}", DateTime.Now, 0, null, Errors.Ok);
                this.ParentForm.Close();
            }
            catch (Exception ex)
            {
                string errmsg = $"Error Creating Composite Layer for view {branch.BranchText}";

                DMEEditor.AddLogMessage("Fail", $"{errmsg}:{ex.Message}", DateTime.Now, 0, null, Errors.Failed);
                MessageBox.Show(errmsg);
            }
        }