Esempio n. 1
0
        private void btnSaveProject_Click(object sender, EventArgs e)
        {
            try
            {
                if (ActiveProject == null)
                {
                    ActiveProject = new Project
                    {
                        ConnectionStringSource      = ProjectSelectorHandler.GetSourceConnectionString(),
                        ConnectionStringDestination = ProjectSelectorHandler.GetDestinationConnectionString(),
                        ProjectName = String.Format(
                            "[{0}].[{1}] - [{2}].[{3}]",
                            ProjectSelectorHandler.GetSourceServerName(),
                            ProjectSelectorHandler.GetSourceDatabaseName(),
                            ProjectSelectorHandler.GetDestinationServerName(),
                            ProjectSelectorHandler.GetDestinationDatabaseName()
                            ),
                        Options = Options ?? ProjectSelectorHandler.GetDefaultProjectOptions(),
                        Type    = Project.ProjectType.SQLServer
                    };

                    var newProjectName = InputBox.ShowInputBox("Enter the project name.", ActiveProject.ProjectName.Trim(), false)?.Trim();

                    if (string.IsNullOrWhiteSpace(newProjectName))
                    {
                        return;
                    }

                    ActiveProject.ProjectName = newProjectName;
                }
                Project.Upsert(ActiveProject);
            }
            catch (Exception ex)
            {
                HandleException("Saving Project", ex);
            }
        }