Added logic to keep this script from running in the system databases.

Added warning messages if changes exist to fmtxml or promsfixes.sql.
This commit is contained in:
Rich 2013-03-14 20:42:06 +00:00
parent be014b12b3
commit 49077fccb5
2 changed files with 59 additions and 1 deletions

View File

@ -1,3 +1,19 @@
if db_name() in('master','model','msdn','tempdb')
begin
DECLARE @ErrorMsg varchar(255)
SET @ErrorMsg = 'Don''t add these procedures and functions to ' + db_name()
PRINT '=========================================================================='
PRINT ''
PRINT @ErrorMsg
PRINT ''
PRINT 'You probably want to be in the VEPROMS database'
PRINT ''
PRINT '=========================================================================='
RAISERROR (@ErrorMsg, 20, -1) with log
RETURN
end
print 'Adding procedures and functions to ' + db_name()
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[PasteItemReplace]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [PasteItemReplace];
GO

View File

@ -460,11 +460,24 @@ namespace Sync
rtb.Font = fntNormal;
Font fntBold = new Font("Arial", 12, FontStyle.Bold);
Font fntItalic = new Font("Arial", 11, FontStyle.Italic);
Font fntBoldItalic = new Font("Arial", 14, FontStyle.Bold | FontStyle.Italic);
StringBuilder sb = new StringBuilder();
dgv.EndEdit();
if (HasFmtXML(_CheckedOut))
{
sb.Append("* This change includes format changes which must be loaded into the databases.\r\n\r\n");
AddText(rtb, fntBoldItalic, "*\tThis change includes format changes\r\n\twhich must be loaded into the databases.",Color.Orange);
AddText(rtb, fntNormal, "\r\n\r\n",Color.Black);
}
if (HasPromsFixes(_CheckedOut))
{
sb.Append("* This change includes changes to PROMSFixes.SQL which must be loaded into the databases.\r\n\r\n");
AddText(rtb, fntBoldItalic, "*\tThis change includes changes to PROMSFixes.SQL\r\n\twhich must be loaded into the databases.\r\n\r\n", Color.Red);
AddText(rtb, fntNormal, "\r\n\r\n", Color.Black);
}
sb.Append("Code Changes:\r\n\r\n");
AddText(rtb, fntBold, "Code Changes:");
AddText(rtb, fntNormal, "\r\n\r\n");
dgv.EndEdit();
int lenFolder = tbDevelopment.Text.Length;
string lastFolder = "";
foreach (FileCompare fc in _CheckedOut)
@ -529,12 +542,41 @@ namespace Sync
}
}
private bool HasPromsFixes(List<FileCompare> _CheckedOut)
{
foreach (FileCompare fc in _CheckedOut)
{
if (fc.ToProcess && fc.FileName.ToLower().Contains("promsfixes.sql"))
return true;
}
return false;
}
private bool HasFmtXML(List<FileCompare> _CheckedOut)
{
foreach (FileCompare fc in _CheckedOut)
{
if (fc.ToProcess && fc.FileName.ToLower().Contains("\\fmtxml\\"))
return true;
}
return false;
}
private static void AddText(RichTextBox rtb, Font font, string txt)
{
rtb.Select(rtb.TextLength, 0);
rtb.SelectionFont = font;
rtb.SelectedText = txt;
}
private static void AddText(RichTextBox rtb, Font font, string txt, Color myColor)
{
rtb.Select(rtb.TextLength, 0);
rtb.SelectionFont = font;
rtb.SelectionColor = myColor;
rtb.SelectedText = txt;
rtb.Select(rtb.TextLength, 0);
rtb.SelectionColor = Color.Black;
}
private void dgv_MouseDown(object sender, MouseEventArgs e)
{
dgv.ClearSelection();