Added table function to return a list of Content records that contain a specified string.

Added stored procedure to standardize text (standard steps)
Lazy Load font value.
Return the correct EditItem when a step is deleted.
Update the StepTabRibbon EditItem when the StepPanel EditItem is changed
Get MyItemInfo if it is not set.
Added missing logic to MyEditItem.
This commit is contained in:
Rich 2011-06-24 21:47:40 +00:00
parent 0a14f6f3fc
commit 37d067a74e
6 changed files with 116 additions and 24 deletions

View File

@ -4235,6 +4235,32 @@ IF (@@Error = 0) PRINT 'Procedure Creation: existsZTransition Succeeded'
ELSE PRINT 'Procedure Creation: existsZTransition Error on Creation' ELSE PRINT 'Procedure Creation: existsZTransition Error on Creation'
GO GO
/****** Object: StoredProcedure [FindText] ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[FindText]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
DROP FUNCTION [FindText];
GO
Create FUNCTION [dbo].[FindText](@LookFor varchar(255))
RETURNS @Results TABLE
(
ItemID int PRIMARY KEY,
ContentID int
)
WITH EXECUTE AS OWNER
BEGIN
insert into @Results
select itemid,ii.contentid
from items ii
join contents cc on ii.contentid = cc.contentid
where text like @LookFor
RETURN
END
GO
-- Display the status of Proc creation
IF (@@Error = 0) PRINT 'TableFunction Creation: FindText Succeeded'
ELSE PRINT 'TableFunction Creation: FindText Error on Creation'
GO
/****** Object: StoredProcedure [getAffectedDRoUsages] ******/ /****** Object: StoredProcedure [getAffectedDRoUsages] ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getAffectedDRoUsages]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getAffectedDRoUsages]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [getAffectedDRoUsages]; DROP PROCEDURE [getAffectedDRoUsages];
@ -10024,6 +10050,41 @@ IF (@@Error = 0) PRINT 'Procedure Creation: purgeData Succeeded'
ELSE PRINT 'Procedure Creation: purgeData Error on Creation' ELSE PRINT 'Procedure Creation: purgeData Error on Creation'
GO GO
/****** Object: StoredProcedure [Standardize] ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Standardize]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [Standardize];
GO
/*
Standardize '%engineering evaluation%'
Standardize '%preferred running order%'
Standardize '%provide normal spray%'
*/
CREATE PROCEDURE [dbo].[Standardize]
(
@LookFor varchar(255)
)
WITH EXECUTE AS OWNER
AS
BEGIN TRY -- Try Block
BEGIN TRANSACTION
DECLARE @ContentID INT
SET @Contentid = (select min(ContentID) FROM FindText(@LookFor))
UPDATE Items SET ContentID = @ContentID WHERE ItemID in(SELECT ItemID FROM FindText(@LookFor))
IF( @@TRANCOUNT > 0 ) COMMIT
END TRY
BEGIN CATCH -- Catch Block
IF( @@TRANCOUNT = 1 ) ROLLBACK -- Only rollback if top level
ELSE IF( @@TRANCOUNT > 1 ) COMMIT -- Otherwise commit. Top level will rollback
EXEC vlnErrorHandler
END CATCH
GO
-- Display the status of Proc creation
IF (@@Error = 0) PRINT 'Procedure Creation: Standardize Succeeded'
ELSE PRINT 'Procedure Creation: Standardize Error on Creation'
GO
/****** Object: StoredProcedure [updateAnnotation] ******/ /****** Object: StoredProcedure [updateAnnotation] ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[updateAnnotation]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[updateAnnotation]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [updateAnnotation]; DROP PROCEDURE [updateAnnotation];

View File

@ -4299,8 +4299,12 @@ namespace VEPROMS.CSLA.Library
{ {
get get
{ {
XmlNode xn = vlnFormatDocument.LookupSingleStepNode(base.XmlNode, "TabData[Font]"); if (_Font == null)
return (_Font == null ? _Font = new VE_Font(xn) : _Font); {
XmlNode xn = vlnFormatDocument.LookupSingleStepNode(base.XmlNode, "TabData[Font]");
_Font = new VE_Font(xn);
}
return _Font;
} }
} }

View File

@ -592,7 +592,7 @@ namespace Volian.Controls.Library
else if (MyPreviousEditItem != null) else if (MyPreviousEditItem != null)
{ {
MyPreviousEditItem.MyNextEditItem = null; MyPreviousEditItem.MyNextEditItem = null;
newFocus = MyPreviousEditItem; newFocus = MyPreviousEditItem.BottomMostEditItem;
MyPreviousEditItem = null; MyPreviousEditItem = null;
//Console.Write(",\"Previous\","); //Console.Write(",\"Previous\",");
} }
@ -749,7 +749,8 @@ namespace Volian.Controls.Library
public EditItem AddChildBefore(ItemInfo MyItemInfo, EditItem nextEditItem) public EditItem AddChildBefore(ItemInfo MyItemInfo, EditItem nextEditItem)
{ {
EditItem child = null; EditItem child = null;
if (MyItemInfo.MyContent.ContentGridCount != 0) //if (MyItemInfo.MyContent.ContentGridCount != 0)
if(MyItemInfo.MyContent.MyGrid != null)
child = new GridItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem); child = new GridItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem);
else else
child = new RTBItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem); child = new RTBItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem);
@ -1138,10 +1139,11 @@ namespace Volian.Controls.Library
private void EditItem_Move(object sender, EventArgs e) private void EditItem_Move(object sender, EventArgs e)
{ {
int watchThis = _WatchThis; int watchThis = _WatchThis;
//if (MyID == _lookForID || MyID == 2111) //if (MyID == 136)
//{ //{
// vlnStackTrace.ShowStack("{0} Move TO {1}", MyID, Top);
// //vlnStackTrace.ShowStack("{0} Move TO {1} - {2}, BottomMost {3}", MyID, Top, MyPath, BottomMostRTBItem.MyPath); // //vlnStackTrace.ShowStack("{0} Move TO {1} - {2}, BottomMost {3}", MyID, Top, MyPath, BottomMostRTBItem.MyPath);
// Console.WriteLine("{0} Move TO {1} - {2}, BottomMost {3}", MyID, Top, MyPath, BottomMostRTBItem.MyPath); // //Console.WriteLine("{0} Move TO {1} - {2}, BottomMost {3}", MyID, Top, MyPath, BottomMostRTBItem.MyPath);
//} //}
//if (MyID > _StartingID) //if (MyID > _StartingID)
// Console.WriteLine("{0}--------------- {1} Top = {2} Bottom {3}", WatchThisIndent, MyID, Top, Bottom); // Console.WriteLine("{0}--------------- {1} Top = {2} Bottom {3}", WatchThisIndent, MyID, Top, Bottom);
@ -1593,7 +1595,7 @@ namespace Volian.Controls.Library
EditItem parent = EditItem.UpOneEditItem; EditItem parent = EditItem.UpOneEditItem;
int right = FindRight(); int right = FindRight();
bool centeredTable = (MyItemInfo.IsTablePart && MyItemInfo.FormatStepData.Type.Contains("AER") == false && MyItemInfo.RNOLevel == 0); bool centeredTable = (MyItemInfo.IsTablePart && MyItemInfo.FormatStepData.Type.Contains("AER") == false && MyItemInfo.RNOLevel == 0);
while (parent != null && parent.MyItemInfo.IsSection == false) while (parent != null && parent.MyItemInfo.IsSection == false && parent._MyChildRelation != ChildRelation.Before)
{ {
if (parent._MyRNOEditItems != null) if (parent._MyRNOEditItems != null)
{ {

View File

@ -443,6 +443,7 @@ namespace Volian.Controls.Library
} }
} }
_SelectedEditItem = value; _SelectedEditItem = value;
MyStepTabPanel.MyStepTabRibbon.MyEditItem = value;// Update StepTabRibbon.MyEditItem to match
if (value != null) if (value != null)
{ {
_SelectedEditItem.RefreshDisplay(true); _SelectedEditItem.RefreshDisplay(true);

View File

@ -319,7 +319,14 @@ namespace Volian.Controls.Library
private ItemInfo _MyItemInfo; private ItemInfo _MyItemInfo;
public ItemInfo MyItemInfo public ItemInfo MyItemInfo
{ {
get { return _MyItemInfo; } get
{
if (_MyItemInfo == null && Parent is EditItem)
_MyItemInfo = (Parent as EditItem).MyItemInfo;
else if (_MyItemInfo == null && Parent.Parent is EditItem)
_MyItemInfo = (Parent.Parent as EditItem).MyItemInfo;
return _MyItemInfo;
}
set { _MyItemInfo = value; } set { _MyItemInfo = value; }
} }
private string _OrigRTF; private string _OrigRTF;
@ -2104,9 +2111,7 @@ namespace Volian.Controls.Library
public int SelectionStart public int SelectionStart
{ {
get { return _SelectionStart; } get { return _SelectionStart; }
set { set { _SelectionStart = value; }
_SelectionStart = value;
}
} }
int _SelectionLength; int _SelectionLength;
public int SelectionLength public int SelectionLength
@ -2116,8 +2121,6 @@ namespace Volian.Controls.Library
} }
public SelectionData(RichTextBox richTextBox) public SelectionData(RichTextBox richTextBox)
{ {
//Console.WriteLine("SelectionData SelectionStart {0}", richTextBox.SelectionStart);
//Volian.Base.Library.vlnStackTrace.ShowStack("SelectionData SelectionStart",this);//.ShowStackLocal("SelectionData SelectionStart", 3);
_SelectionStart = richTextBox.SelectionStart; _SelectionStart = richTextBox.SelectionStart;
_SelectionLength = richTextBox.SelectionLength; _SelectionLength = richTextBox.SelectionLength;
} }

View File

@ -30,6 +30,7 @@ namespace Volian.Controls.Library
get { return _MyEditItem; } get { return _MyEditItem; }
set set
{ {
if (_MyEditItem == value) return; // Don't do this if the value is not different
_MyEditItem = value; _MyEditItem = value;
if (value != null) if (value != null)
{ {
@ -37,9 +38,11 @@ namespace Volian.Controls.Library
if (value is GridItem) if (value is GridItem)
{ {
ToggleTableDesignButtons(true); ToggleTableDesignButtons(true);
MyFlexGrid_SelChange(this,new EventArgs()); MyFlexGrid_SelChange(this, new EventArgs());
} }
} }
else
MyStepRTB = null;
} }
} }
private DocVersionInfo _MyDVI; private DocVersionInfo _MyDVI;
@ -59,8 +62,14 @@ namespace Volian.Controls.Library
} }
} }
private ItemInfo MyItemInfo private ItemInfo MyItemInfo
{ get { return _MyStepRTB == null ? null : _MyStepRTB.MyItemInfo; } } {
get
{
if(_MyStepRTB != null && _MyStepRTB.MyItemInfo != null) return _MyStepRTB.MyItemInfo;
if(_MyEditItem != null && _MyEditItem.MyItemInfo != null) return _MyEditItem.MyItemInfo;
return null;
}
}
private DevComponents.DotNetBar.ButtonItem _DefaultContextMenu; private DevComponents.DotNetBar.ButtonItem _DefaultContextMenu;
public void ClearContextMenu() public void ClearContextMenu()
@ -183,11 +192,17 @@ namespace Volian.Controls.Library
// ex. Positon on a substep, press <shift><F6> <N> <S> <S>, to list the substep types // ex. Positon on a substep, press <shift><F6> <N> <S> <S>, to list the substep types
//_MyStepRTB.KeyUp -=new KeyEventHandler(_MyStepRTB_KeyUp); //_MyStepRTB.KeyUp -=new KeyEventHandler(_MyStepRTB_KeyUp);
//_MyStepRTB.MouseUp -= new MouseEventHandler(_MyStepRTB_MouseUp); //_MyStepRTB.MouseUp -= new MouseEventHandler(_MyStepRTB_MouseUp);
_MyStepRTB.SelectionChanged -= new EventHandler(_MyStepRTB_SelectionChanged); if (_MyEditItem != null)
_MyEditItem.Leave -= new EventHandler(_MyEditItem_Leave); {
_MyEditItem.Enter += new EventHandler(_MyEditItem_Enter); _MyEditItem.Leave -= new EventHandler(_MyEditItem_Leave);
_MyEditItem.Enter += new EventHandler(_MyEditItem_Enter);
}
//_MyStepRTB.Leave -= new EventHandler(_MyStepRTB_Leave); //_MyStepRTB.Leave -= new EventHandler(_MyStepRTB_Leave);
_MyStepRTB.LinkChanged -= new StepRTBLinkEvent(_MyStepRTB_LinkChanged); if (_MyStepRTB != null)
{
_MyStepRTB.SelectionChanged -= new EventHandler(_MyStepRTB_SelectionChanged);
_MyStepRTB.LinkChanged -= new StepRTBLinkEvent(_MyStepRTB_LinkChanged);
}
if (MyFlexGrid != null) if (MyFlexGrid != null)
{ {
MyFlexGrid.CopyOptionChanged -= new VlnFlexGridEvent(MyFlexGrid_CopyOptionChanged); MyFlexGrid.CopyOptionChanged -= new VlnFlexGridEvent(MyFlexGrid_CopyOptionChanged);
@ -200,11 +215,17 @@ namespace Volian.Controls.Library
// ex. Positon on a substep, press <shift><F6> <N> <S> <S>, to list the substep types // ex. Positon on a substep, press <shift><F6> <N> <S> <S>, to list the substep types
//_MyStepRTB.KeyUp -=new KeyEventHandler(_MyStepRTB_KeyUp); //_MyStepRTB.KeyUp -=new KeyEventHandler(_MyStepRTB_KeyUp);
//_MyStepRTB.MouseUp -= new MouseEventHandler(_MyStepRTB_MouseUp); //_MyStepRTB.MouseUp -= new MouseEventHandler(_MyStepRTB_MouseUp);
_MyStepRTB.SelectionChanged += new EventHandler(_MyStepRTB_SelectionChanged); if (_MyEditItem != null)
_MyEditItem.Leave += new EventHandler(_MyEditItem_Leave); {
_MyEditItem.Enter -= new EventHandler(_MyEditItem_Enter); _MyEditItem.Leave += new EventHandler(_MyEditItem_Leave);
_MyEditItem.Enter -= new EventHandler(_MyEditItem_Enter);
}
//_MyStepRTB.Leave -= new EventHandler(_MyStepRTB_Leave); //_MyStepRTB.Leave -= new EventHandler(_MyStepRTB_Leave);
_MyStepRTB.LinkChanged += new StepRTBLinkEvent(_MyStepRTB_LinkChanged); if (_MyStepRTB != null)
{
_MyStepRTB.LinkChanged += new StepRTBLinkEvent(_MyStepRTB_LinkChanged);
_MyStepRTB.SelectionChanged += new EventHandler(_MyStepRTB_SelectionChanged);
}
if (MyFlexGrid != null) if (MyFlexGrid != null)
{ {
MyFlexGrid.CopyOptionChanged += new VlnFlexGridEvent(MyFlexGrid_CopyOptionChanged); MyFlexGrid.CopyOptionChanged += new VlnFlexGridEvent(MyFlexGrid_CopyOptionChanged);