Exemplo n.º 1
0
        public void ApplyNames(Forms.FormApply.ApplyOptions options = null)
        {
            if (options == null)
            {
                return;
            }

            //@"Confirms the application of names to classes and enums?
            //The current names will be overwritten"))

            if (options == null)
            {
                return;
            }

            if (Program.RunSafe(this, () =>
            {
                trv.Focus();
                tabObjects.Focus();

                ViewToData();
                var pars = file.Parameters;

                var crtl = this.ActiveControl;
                btnApplyNames.Focus();



                foreach (var table in pars.Tables)
                {
                    if (!options.OnlySelected || table.IsSelected)
                    {
                        ApplyName(options, table);
                    }
                }

                foreach (var table in pars.Views)
                {
                    if (!options.OnlySelected || table.IsSelected)
                    {
                        ApplyName(options, table);
                    }
                }

                DataToView();
                UpdateGrid();
                ViewToData();
                this.ActiveControl = crtl;
            }))
            {
                ;
            }
        }
Exemplo n.º 2
0
        public void ApplyNames(Forms.FormApply.ApplyOptions options = null)
        {
            if (options == null)
            {
                options = new Forms.FormApply.ApplyOptions {
                    BusinessClass = true, DataClass = true, Enum = true, Unnamed = true
                }
            }
            ;
            //@"Confirms the application of names to classes and enums?
            //The current names will be overwritten"))

            if (options == null)
            {
                return;
            }

            if (Program.RunSafe(this, () =>
            {
                trv.Focus();
                tabObjects.Focus();

                ViewToData();
                var pars = file.Parameters;

                var crtl = this.ActiveControl;
                btnApplyNames.Focus();

                foreach (var table in pars.Tables)
                {
                    if (!options.OnlySelected || table.IsSelected)
                    {
                        ApplyName(options, table);
                    }
                }

                foreach (var table in pars.Views)
                {
                    if (!options.OnlySelected || table.IsSelected)
                    {
                        ApplyName(options, table);
                    }
                }

                DataToView();
                UpdateGrid();
                ViewToData();
                this.ActiveControl = crtl;
            }))
            {
                ;
            }
        }

        void ApplyName(Speed.UI.Forms.FormApply.ApplyOptions options, GenTable table)
        {
            if (options.ApplyDataClass(table.DataClassName))
            {
                table.DataClassName = ctlDataPars.ApplyNames(table.SchemaName, table.TableName, true);
            }

            foreach (GenColumn col in table.Columns)
            {
                if (options.ApplyDataClass(col.PropertyName))
                {
                    col.PropertyName = ctlDataPars.ApplyNames(null, col.ColumnName, false);
                }
            }

            if (options.ApplyBusinessClass(table.BusinessClassName))
            {
                table.BusinessClassName = ctlBusPars.ApplyNames(table.SchemaName, table.TableName, true);
            }

            if (!string.IsNullOrEmpty(table.EnumColumnId) && !string.IsNullOrEmpty(table.EnumColumnName) && options.ApplyEnum(table.EnumName))
            {
                table.EnumName = ctlDataPars.ApplyNames(null, "EnumDb" + table.DataClassName, true);
            }

            table.SubDirectory = (file.Parameters.ArrangeDirectoriesBySchema && !string.IsNullOrEmpty(table.SchemaName))
                ? Database.GetName(table.SchemaName, file.Parameters.DataClass.NameCase)
                : null;
        }

        bool isNodeChecking;