Пример #1
0
        private void ModelUtilitiesForm_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                this.Close();
            }

            //HIDDEN - Turn off transform names
            if (e.KeyCode == Keys.Q && e.Control)
            {
                if (_model.TransformNames)
                {
                    if (MessageBox.Show("Rename all items to Pascal name?", "Rename", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        var uiKey = ProgressHelper.ProgressingStarted("Converting...", true, 60);
                        try
                        {
                            using (var transaction = _store.TransactionManager.BeginTransaction(Guid.NewGuid().ToString()))
                            {
                                _model.Entities.ForEach(x => x.Name = x.PascalName);
                                _model.Entities.ForEach(x => x.Fields.ForEach(y => y.Name = y.PascalName));

                                _model.Views.ForEach(x => x.Name = x.PascalName);
                                _model.Views.ForEach(x => x.Fields.ForEach(y => y.Name = y.PascalName));

                                _model.StoredProcedures.ForEach(x => x.Name = x.PascalName);
                                _model.StoredProcedures.ForEach(x => x.Fields.ForEach(y => y.Name     = y.PascalName));
                                _model.StoredProcedures.ForEach(x => x.Parameters.ForEach(y => y.Name = y.PascalName));

                                _model.Functions.ForEach(x => x.Name = x.PascalName);
                                _model.Functions.ForEach(x => x.Fields.ForEach(y => y.Name     = y.PascalName));
                                _model.Functions.ForEach(x => x.Parameters.ForEach(y => y.Name = y.PascalName));

                                _model.TransformNames         = false;
                                _model.CreatedByColumnName    = nHydrate.Generator.Common.Util.StringHelper.DatabaseNameToPascalCase(_model.CreatedByColumnName);
                                _model.CreatedDateColumnName  = nHydrate.Generator.Common.Util.StringHelper.DatabaseNameToPascalCase(_model.CreatedDateColumnName);
                                _model.ModifiedByColumnName   = nHydrate.Generator.Common.Util.StringHelper.DatabaseNameToPascalCase(_model.ModifiedByColumnName);
                                _model.ModifiedDateColumnName = nHydrate.Generator.Common.Util.StringHelper.DatabaseNameToPascalCase(_model.ModifiedDateColumnName);
                                _model.TimestampColumnName    = nHydrate.Generator.Common.Util.StringHelper.DatabaseNameToPascalCase(_model.TimestampColumnName);
                                transaction.Commit();
                            }
                            this.Close();
                        }
                        catch (Exception ex)
                        {
                            ProgressHelper.ProgressingComplete(uiKey);
                            throw;
                        }
                        finally
                        {
                            ProgressHelper.ProgressingComplete(uiKey);
                        }
                    }
                }
            }

            //HIDDEN
            else if (e.KeyCode == Keys.W && e.Control)
            {
                var F = new UserDefinedScriptOrderForm(_model, _store);
                F.ShowDialog();
            }
        }
Пример #2
0
        private void ModelUtilitiesForm_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                this.Close();
            }

            //HIDDEN - Turn off transform names
            if (e.KeyCode == Keys.Q && e.Control)
            {
                if (_model.TransformNames)
                {
                    if (MessageBox.Show("Rename all items to Pascal name?", "Rename", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        var uiKey = ProgressHelper.ProgressingStarted("Converting...", true, 60);
                        try
                        {
                            using (var transaction = _store.TransactionManager.BeginTransaction(Guid.NewGuid().ToString()))
                            {
                                _model.Entities.ForEach(x => x.Name = x.PascalName);
                                _model.Entities.ForEach(x => x.Fields.ForEach(y => y.Name = y.PascalName));

                                _model.Views.ForEach(x => x.Name = x.PascalName);
                                _model.Views.ForEach(x => x.Fields.ForEach(y => y.Name = y.PascalName));

                                _model.StoredProcedures.ForEach(x => x.Name = x.PascalName);
                                _model.StoredProcedures.ForEach(x => x.Fields.ForEach(y => y.Name = y.PascalName));
                                _model.StoredProcedures.ForEach(x => x.Parameters.ForEach(y => y.Name = y.PascalName));

                                _model.Functions.ForEach(x => x.Name = x.PascalName);
                                _model.Functions.ForEach(x => x.Fields.ForEach(y => y.Name = y.PascalName));
                                _model.Functions.ForEach(x => x.Parameters.ForEach(y => y.Name = y.PascalName));

                                _model.TransformNames = false;
                                _model.CreatedByColumnName = nHydrate.Generator.Common.Util.StringHelper.DatabaseNameToPascalCase(_model.CreatedByColumnName);
                                _model.CreatedDateColumnName = nHydrate.Generator.Common.Util.StringHelper.DatabaseNameToPascalCase(_model.CreatedDateColumnName);
                                _model.ModifiedByColumnName = nHydrate.Generator.Common.Util.StringHelper.DatabaseNameToPascalCase(_model.ModifiedByColumnName);
                                _model.ModifiedDateColumnName = nHydrate.Generator.Common.Util.StringHelper.DatabaseNameToPascalCase(_model.ModifiedDateColumnName);
                                _model.TimestampColumnName = nHydrate.Generator.Common.Util.StringHelper.DatabaseNameToPascalCase(_model.TimestampColumnName);
                                transaction.Commit();
                            }
                            this.Close();
                        }
                        catch (Exception ex)
                        {
                            ProgressHelper.ProgressingComplete(uiKey);
                            throw;
                        }
                        finally
                        {
                            ProgressHelper.ProgressingComplete(uiKey);
                        }
                    }

                }
            }

            //HIDDEN
            else if (e.KeyCode == Keys.W && e.Control)
            {
                var F = new UserDefinedScriptOrderForm(_model, _store);
                F.ShowDialog();
            }

        }