Script changed to be able to run repeatedly
Add DROUsages to Concistency Check
This commit is contained in:
parent
3ba7971ece
commit
f9fa4fa3c1
@ -1,3 +1,12 @@
|
|||||||
|
ALTER TABLE [dbo].[Checks] DROP CONSTRAINT [FK_Checks_Revisions]
|
||||||
|
GO
|
||||||
|
ALTER TABLE [dbo].[Versions] DROP CONSTRAINT [FK_Versions_Stages]
|
||||||
|
GO
|
||||||
|
ALTER TABLE [dbo].[Versions] DROP CONSTRAINT [FK_Versions_Revisions]
|
||||||
|
GO
|
||||||
|
ALTER TABLE [dbo].[Checks] DROP CONSTRAINT [FK_Checks_Stages]
|
||||||
|
GO
|
||||||
|
|
||||||
/****** Object: Table [dbo].[Stages] Script Date: 10/21/2011 15:04:48 ******/
|
/****** Object: Table [dbo].[Stages] Script Date: 10/21/2011 15:04:48 ******/
|
||||||
SET ANSI_NULLS ON
|
SET ANSI_NULLS ON
|
||||||
GO
|
GO
|
||||||
@ -1527,6 +1536,38 @@ IF (@@Error = 0) PRINT 'Procedure Creation: getRoUsagesForProc Succeeded'
|
|||||||
ELSE PRINT 'Procedure Creation: getRoUsagesForProc Error on Creation'
|
ELSE PRINT 'Procedure Creation: getRoUsagesForProc Error on Creation'
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [getRoUsagesForProc] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getDROUsagesForProc]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getDROUsagesForProc];
|
||||||
|
GO
|
||||||
|
|
||||||
|
--[dbo].[getDROUsagesForProc] 2
|
||||||
|
CREATE PROCEDURE [dbo].[getDROUsagesForProc]
|
||||||
|
(
|
||||||
|
@ItemID int
|
||||||
|
)
|
||||||
|
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
[DROUsageID],
|
||||||
|
rr.[DocID],
|
||||||
|
[ROID],
|
||||||
|
[Config],
|
||||||
|
rr.[DTS],
|
||||||
|
rr.[UserID],
|
||||||
|
rr.[LastChanged],
|
||||||
|
[RODbID]
|
||||||
|
FROM [DROUsages] rr
|
||||||
|
INNER JOIN Entries ee on rr.docid = ee.docid
|
||||||
|
INNER JOIN vefn_ChildItems(@ItemID) cc on cc.contentid = ee.contentid
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getDROUsagesForProc Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getDROUsagesForProc Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
/****** Object: StoredProcedure [getStage] ******/
|
/****** Object: StoredProcedure [getStage] ******/
|
||||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getStage]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getStage]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
DROP PROCEDURE [getStage];
|
DROP PROCEDURE [getStage];
|
||||||
|
@ -666,6 +666,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
foreach (RoUsageInfo myRO in myList)
|
foreach (RoUsageInfo myRO in myList)
|
||||||
if (!myROIDs.Contains(myRO.ROID.ToUpper()))
|
if (!myROIDs.Contains(myRO.ROID.ToUpper()))
|
||||||
myROIDs.Add(myRO.ROID.ToUpper());
|
myROIDs.Add(myRO.ROID.ToUpper());
|
||||||
|
using (DROUsageInfoList myList = DROUsageInfoList.GetAllForProcedure(proc))
|
||||||
|
foreach (DROUsageInfo myRO in myList)
|
||||||
|
if (!myROIDs.Contains(myRO.ROID.ToUpper()))
|
||||||
|
myROIDs.Add(myRO.ROID.ToUpper());
|
||||||
//create checkro record for each roid
|
//create checkro record for each roid
|
||||||
//_MyTimer.ActiveProcess = "Get DocVersionInfo";
|
//_MyTimer.ActiveProcess = "Get DocVersionInfo";
|
||||||
DocVersionInfo dbi = proc.ActiveParent as DocVersionInfo;
|
DocVersionInfo dbi = proc.ActiveParent as DocVersionInfo;
|
||||||
@ -790,6 +794,68 @@ namespace VEPROMS.CSLA.Library
|
|||||||
this.RaiseListChangedEvents = true;
|
this.RaiseListChangedEvents = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public partial class DROUsageInfoList
|
||||||
|
{
|
||||||
|
[Serializable()]
|
||||||
|
private class AllForProcedureCriteria
|
||||||
|
{
|
||||||
|
public AllForProcedureCriteria(int itemID)
|
||||||
|
{
|
||||||
|
_ItemID = itemID;
|
||||||
|
}
|
||||||
|
private int _ItemID;
|
||||||
|
public int ItemID
|
||||||
|
{
|
||||||
|
get { return _ItemID; }
|
||||||
|
set { _ItemID = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static DROUsageInfoList GetAllForProcedure(ProcedureInfo proc)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DROUsageInfoList tmp = DataPortal.Fetch<DROUsageInfoList>(new AllForProcedureCriteria(proc.ItemID));
|
||||||
|
DROUsageInfo.AddList(tmp);
|
||||||
|
tmp.AddEvents();
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new DbCslaException("Error on DROUsageInfoList.GetAllForProcedure", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DataPortal_Fetch(AllForProcedureCriteria criteria)
|
||||||
|
{
|
||||||
|
this.RaiseListChangedEvents = false;
|
||||||
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DROUsageInfoList.DataPortal_FetchAllForProc", GetHashCode());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
|
{
|
||||||
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
|
{
|
||||||
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
|
cm.CommandText = "getDROUsagesForProc";
|
||||||
|
cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
|
||||||
|
|
||||||
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
|
{
|
||||||
|
IsReadOnly = false;
|
||||||
|
while (dr.Read())
|
||||||
|
this.Add(new DROUsageInfo(dr));
|
||||||
|
IsReadOnly = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DROUsageInfoList.DataPortal_FetchAllForProc", ex);
|
||||||
|
throw new DbCslaException("DROUsageInfoList.DataPortal_Fetch", ex);
|
||||||
|
}
|
||||||
|
this.RaiseListChangedEvents = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
public partial class TransitionInfo
|
public partial class TransitionInfo
|
||||||
{
|
{
|
||||||
internal string _ContentText;
|
internal string _ContentText;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user