Ejemplo n.º 1
0
        private string LoadHelpText(string DBName, string ObjName)
        {
            string ObjectText = string.Empty;

            string ConnString = GetServerConnectionString(cbServers.Text, UserID);

            try
            {
                using (DataStuff sn = new DataStuff())
                {
                    DataTable dt = sn.GetObjectHelpText(ConnString, DBName, ObjName);

                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow row in dt.Rows)
                        {
                            ObjectText = ObjectText + row[0].ToString();
                        }
                    }

                    return(ObjectText);
                }
            }

            catch
            {
                return("");
            }
        }
Ejemplo n.º 2
0
        private string LoadHelpText(string ConnectionString, string DatabaseName, string ObjectName)
        {
            string ObjectText = string.Empty;

            try
            {
                using (DataStuff sn = new DataStuff())
                {
                    DataTable dt = sn.GetObjectHelpText(ConnectionString, DatabaseName, ObjectName);

                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow row in dt.Rows)
                        {
                            ObjectText = ObjectText + row[0].ToString();
                        }
                    }
                }
            }

            catch
            {
                return("");
            }

            return(ObjectText);
        }
Ejemplo n.º 3
0
        private void LoadHelpText()
        {
            try
            {
                using (DataStuff sn = new DataStuff())
                {
                    DataTable dt = sn.GetObjectHelpText(ConnectionString, DatabaseName, ObjectName);

                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow row in dt.Rows)
                        {
                            ObjectText = ObjectText + row[0].ToString();
                        }
                    }

                    tObjectText.Text = ObjectText;
                }
            }

            catch
            {
            }
        }
Ejemplo n.º 4
0
        private bool BackupReleaseToServerObject(string ReleaseToServer, string DatabaseName, string ObjectName, string ProjectName)
        {
            string ObjectText        = string.Empty;
            string ObjectDescription = string.Empty;
            string ConnectionStr     = string.Empty;
            bool   Result            = false;

            ConnectionStr = GetServerConnectionString(ReleaseToServer);

            try
            {
                using (DataStuff sn = new DataStuff())
                {
                    DataTable dt = sn.GetDatabaseObjectText(ConnectionStr, DatabaseName, ObjectName);

                    if (dt.Rows.Count > 1)
                    {
                        foreach (DataRow row in dt.Rows)
                        {
                            ObjectText        = row["FullDefinition"].ToString();
                            ObjectDescription = row["ROUTINE_NAME"].ToString() + ": " + row["ROUTINE_TYPE"].ToString();
                        }
                    }
                }
            }

            catch
            {
                DialogResult result = MessageBox.Show("An error occurred getting the object text for server " + ReleaseToServer + ". Release anyway?", "Backup Object", MessageBoxButtons.YesNo, MessageBoxIcon.Error);

                if (result == DialogResult.No)
                {
                    return(false);
                }
                else
                {
                    IsNewObject = true;
                    return(true);
                }
            }

            if (ObjectText.Trim() == "")
            {
                try
                {
                    using (DataStuff sn = new DataStuff())
                    {
                        DataTable dt = sn.GetObjectHelpText(ConnectionStr, DatabaseName, ObjectName);

                        if (dt.Rows.Count > 0)
                        {
                            foreach (DataRow row in dt.Rows)
                            {
                                ObjectText = ObjectText + row[0].ToString();
                            }
                        }
                    }
                }

                catch
                {
                    DialogResult result = MessageBox.Show("An error occurred getting the object text for server " + ReleaseToServer + ". Release anyway?", "Backup Object", MessageBoxButtons.YesNo, MessageBoxIcon.Error);

                    if (result == DialogResult.No)
                    {
                        return(false);
                    }
                    else
                    {
                        IsNewObject = true;
                        return(true);
                    }
                }
            }

            try
            {
                if (ObjectText.Trim() == "")
                {
                    DialogResult result = MessageBox.Show("An error occurred getting the object text for server " + ReleaseToServer + ". Release anyway?", "Backup Object", MessageBoxButtons.YesNo, MessageBoxIcon.Error);

                    if (result == DialogResult.No)
                    {
                        return(false);
                    }
                    else
                    {
                        IsNewObject = true;
                        return(true);
                    }
                }

                string BackupComment;

                BackupComment = UserName + " - " + "Backup before restore from project backup";

                using (DataStuff sn = new DataStuff())
                {
                    Result = sn.BackupObject(ReleaseToServer, "Backup", UserName, ObjectName, DatabaseName, ObjectText, BackupComment, ProjectName, "", "", "N", "N");

                    if (!Result)
                    {
                        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);
                        return(false);
                    }

                    lStatus.Text = "Creating backup of " + ReleaseToServer + " - " + DatabaseName + ": " + ObjectName + "...";
                }
            }

            catch
            {
                MessageBox.Show("An error occurred while creating the backup record.", "Backup Object", MessageBoxButtons.OK, MessageBoxIcon.Error);
                lStatus.Text = "Error creating backup of " + ReleaseToServer + " - " + DatabaseName + ": " + ObjectName + ".";
                return(false);
            }

            return(true);
        }