Пример #1
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(registeredServersSource.SelectedServer) == true)
                {
                    throw new Exception("Enter a Source Server!");
                }

                ConnectSqlServer connection = new ConnectSqlServer();
                sourceserver = connection.Connect(registeredServersSource.SelectedServer);

                if (itemsToCopy.Count == 0)
                {
                    setupJobList();
                }

                SelectItemsToCopy form = new SelectItemsToCopy();
                form.ItemsToCopy = itemsToCopy;
                form.ShowDialog();
                itemsToCopy = form.ItemsToCopy;
            }

            catch (Exception ex)
            {
                showOutput.displayOutput(ex.Message, true);
            }
        }
Пример #2
0
        private void btnDisplay_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(registeredServersSource.SelectedServer) == true)
                {
                    throw new Exception("Enter a Server!");
                }

                ConnectSqlServer connection = new ConnectSqlServer();
                sourceserver = connection.Connect(registeredServersSource.SelectedServer);

                if (sourceserver.VersionMajor < 9)
                {
                    throw new Exception("SQL Server versions prior to 2005 are not supported!");
                }

                showProcesses(sourceserver);
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #3
0
        private void btnCopy_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(registeredServersSource.SelectedServer) == true || string.IsNullOrEmpty(registeredServersDestination.SelectedServer) == true)
                {
                    throw new Exception("Enter a Source and Destination Server!");
                }

                if (registeredServersSource.SelectedServer == registeredServersDestination.SelectedServer)
                {
                    throw new Exception("Source and destination cannot be the same!");
                }

                ConnectSqlServer connection = new ConnectSqlServer();
                sourceserver = connection.Connect(registeredServersSource.SelectedServer);
                Server destserver = connection.Connect(registeredServersDestination.SelectedServer);

                if (sourceserver.VersionMajor < 9 || destserver.VersionMajor < 9)
                {
                    throw new Exception("SQL Server versions prior to 2005 are not supported!");
                }

                if (sourceserver.VersionMajor > 10 && destserver.VersionMajor < 11)
                {
                    throw new Exception(string.Format("Migration FROM SQL Server version {0} to {1} not supported!", sourceserver.VersionMajor.ToString(), destserver.VersionMajor.ToString()));
                }

                DateTime started = DateTime.Now;
                showOutput.Clear();
                showOutput.displayOutput(string.Format("Migration started: {0}", DateTime.Now.ToShortTimeString()));
                switch (cboAction.SelectedItem.ToString())
                {
                case "Copy Accounts":
                    copyAccounts(destserver, chkDropDest.Checked);
                    break;

                case "Copy Profiles":
                    copyProfiles(destserver, chkDropDest.Checked);
                    break;

                default:
                    break;
                }
                showOutput.displayOutput(string.Format("Migration ended: {0}", DateTime.Now.ToShortTimeString()));
            }

            catch (Exception ex)
            {
                showOutput.displayOutput(ex.Message, true);
            }
        }
Пример #4
0
        public ActionResult StartJob(JobDetailsModel step)
        {
            ConnectSqlServer connection = new ConnectSqlServer();
            Server           server     = connection.Connect(step.ServerName);

            server.JobServer.GetJobByID(step.JobID).Start(step.StepName);
            server.ConnectionContext.Disconnect();

            LogActivity log = new LogActivity();

            log.Add(User.Identity.Name, step.ServerName, step.JobID, "Start Job");

            return(RedirectToAction("Index", "Schedule", new { dbServer = step.ServerName }));
        }
Пример #5
0
        public Show_DatabaseDetails()
        {
            InitializeComponent();

            ConnectSqlServer connection   = new ConnectSqlServer();
            Server           sourceserver = connection.Connect(MainForm.dbServer);

            db = sourceserver.Databases[MainForm.dbName];

            listPages.Items.Add("General");
            listPages.Items.Add("Files");
            listPages.Items.Add("Options");

            listPages.SelectedItem = "General";
        }
Пример #6
0
        private void btnCopy_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(registeredServersSource.SelectedServer) == true || string.IsNullOrEmpty(registeredServersDestination.SelectedServer) == true)
                {
                    throw new Exception("Enter a Source and Destination Server!");
                }

                if (registeredServersSource.SelectedServer == registeredServersDestination.SelectedServer)
                {
                    throw new Exception("Source and destination cannot be the same!");
                }

                ConnectSqlServer connection   = new ConnectSqlServer();
                Server           sourceserver = connection.Connect(registeredServersSource.SelectedServer);
                Server           destserver   = connection.Connect(registeredServersDestination.SelectedServer);

                if (sourceserver.VersionMajor < 9 || destserver.VersionMajor < 9)
                {
                    throw new Exception("SQL Server versions prior to 2005 are not supported!");
                }

                if (sourceserver.VersionMajor > 10 && destserver.VersionMajor < 11)
                {
                    throw new Exception(string.Format("Migration FROM SQL Server version {0} to {1} not supported!", sourceserver.VersionMajor.ToString(), destserver.VersionMajor.ToString()));
                }

                if (itemsToCopy.Count == 0)
                {
                    setupJobList();
                }
                ;

                DateTime started = DateTime.Now;
                showOutput.Clear();
                showOutput.displayOutput(string.Format("Migration started: {0}", DateTime.Now.ToShortTimeString()));
                copyOperators(destserver);
                showOutput.displayOutput(string.Format("Migration ended: {0}", DateTime.Now.ToShortTimeString()));
            }

            catch (Exception ex)
            {
                showOutput.displayOutput(ex.Message, true);
            }
        }
Пример #7
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(registeredServersSource.SelectedServer) == true)
                {
                    throw new Exception("Enter a Source Server!");
                }

                ConnectSqlServer connection = new ConnectSqlServer();
                sourceserver = connection.Connect(registeredServersSource.SelectedServer);

                if (itemsToCopy.Count == 0)
                {
                    switch (cboAction.SelectedItem.ToString())
                    {
                    case "Copy Accounts":
                        foreach (MailAccount account in sourceserver.Mail.Accounts)
                        {
                            itemsToCopy.Add(new ItemToCopy(account.Name, false));
                        }
                        break;

                    case "Copy Profiles":
                        foreach (MailProfile profile in sourceserver.Mail.Profiles)
                        {
                            itemsToCopy.Add(new ItemToCopy(profile.Name, false));
                        }
                        break;

                    default:
                        break;
                    }
                }

                SelectItemsToCopy form = new SelectItemsToCopy();
                form.ItemsToCopy = itemsToCopy;
                form.ShowDialog();
                itemsToCopy = form.ItemsToCopy;
            }

            catch (Exception ex)
            {
                showOutput.displayOutput(ex.Message, true);
            }
        }
Пример #8
0
        public ActionResult StartJob(string dbServer, Guid jobID)
        {
            JobDetailsModel       model      = new JobDetailsModel();
            PopulateDropDowns     dropdown   = new PopulateDropDowns();
            ConnectSqlServer      connection = new ConnectSqlServer();
            Server                server     = connection.Connect(dbServer);
            List <SelectListItem> stepList   = new List <SelectListItem>();

            stepList         = dropdown.getSteps(dbServer, jobID);
            ViewBag.StepList = stepList;

            var job = server.JobServer.GetJobByID(jobID);

            model.JobName    = job.Name;
            model.ServerName = dbServer;
            model.JobID      = jobID;
            model.StepName   = job.JobSteps[0].Name;

            return(View(model));
        }
Пример #9
0
        private void chooseServer_Click(object sender, EventArgs e)
        {
            ConnectSqlServer connectSqlServer = new ConnectSqlServer();

            connectSqlServer.Show();
        }