Esempio n. 1
0
        private bool RestoreObject(string ReleaseToServer, string DatabaseName, string ObjectName, string ObjectText)
        {
            string RetVal = string.Empty;

            using (DataStuff sn = new DataStuff())
            {
                string ConnectionStr = string.Empty;

                ConnectionStr = GetServerConnectionString(ReleaseToServer);

                ConnectionStr = ConnectionStr + ";Database=" + DatabaseName;

                if (IsNewObject)
                {
                    ObjectText = gs.ChangeAlterToCreate(ObjectText);
                }

                lStatus.Text = "Deploying object " + DatabaseName + " - " + ObjectName + " to " + ReleaseToServer + "...";

                RetVal = sn.CreateObjectS(ConnectionStr, ObjectText);

                if (RetVal != "")
                {
                    MessageBox.Show("Failed - " + RetVal, "Modify Procedure", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    lStatus.Text = "Error deploying object " + DatabaseName + " - " + ObjectName + " to " + ReleaseToServer + "...";

                    return(false);
                }
            }

            return(true);
        }
Esempio n. 2
0
        private void tsbCheckOut_Click(object sender, EventArgs e)
        {
            string RetVal = string.Empty;

            NewStatus = "Check out for edit";

            if (tComment.Text == "")
            {
                MessageBox.Show("Please enter a comment for this change.", "Change Status", MessageBoxButtons.OK, MessageBoxIcon.Error);
                NewStatus = OriginalStatus;
                tComment.Focus();
                return;
            }

            try
            {
                if (!BackupObject())
                {
                    MessageBox.Show("There was an error creating a backup for this object. Please ensure that your servers have been set up correctly.", "Change Status", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    NewStatus = OriginalStatus;
                    return;
                }

                NewObjectText = CurrentObjectText;

                NewObjectText = AddProcComment(NewObjectText);

                using (DataStuff sn = new DataStuff())
                {
                    ConnectionString = GetServerConnectionString(AliasName);

                    ConnectionString = ConnectionString + ";Database=" + DatabaseName;

                    RetVal = sn.CreateObjectS(ConnectionString, NewObjectText);

                    if (RetVal != "")
                    {
                        MessageBox.Show("Failed - " + RetVal, "Modify Procedure", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        NewStatus = OriginalStatus;
                    }
                    else
                    {
                        MessageBox.Show("Object successfully updated.", "Modify Procedure", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                }
            }

            catch
            {
            }
        }
Esempio n. 3
0
        private void tsbCheckIn_Click(object sender, System.EventArgs e)
        {
            string RetVal = string.Empty;

            //Just change the current object status by creating a backup of the current version with the new status...

            try
            {
                NewStatus = OriginalStatus;

                if (BackupObjectNewStatus())
                {
                    using (DataStuff sn = new DataStuff())
                    {
                        ConnectionString = GetServerConnectionString(AliasName);

                        ConnectionString = ConnectionString + ";Database=" + DatabaseName;

                        RetVal = sn.CreateObjectS(ConnectionString, CurrentObjectText);

                        if (RetVal != "")
                        {
                            MessageBox.Show("Failed - " + RetVal, "Modify Procedure", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            NewStatus = OriginalStatus;
                        }
                        else
                        {
                            tsbCheckIn.Enabled = false;
                            MessageBox.Show("The object was successfully updated.", "Check In", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            NewStatus = "Check In";
                            this.Close();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Unable to change the status of the current version.", "Check In", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            catch
            {
            }
        }
Esempio n. 4
0
        private bool RestorePrevious()
        {
            string RetVal      = string.Empty;
            string ProcComment = "--SVC: " + DateTime.Now.ToString() + " Restored version after undoing check out " + " - " + UserName;

            NewStatus = "Check-out Undo";

            NewObjectText = AddProcComment(tPreviousVersion.Text, ProcComment);

            try
            {
                using (DataStuff sn = new DataStuff())
                {
                    ConnectionString = GetServerConnectionString(AliasName);

                    ConnectionString = ConnectionString + ";Database=" + DatabaseName;

                    RetVal = sn.CreateObjectS(ConnectionString, NewObjectText);

                    if (RetVal != "")
                    {
                        MessageBox.Show("Failed - " + RetVal, "Modify Procedure", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        NewStatus = OriginalStatus;
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
            }

            catch
            {
                return(false);
            }
        }