support pasting of procedure into a docversion
This commit is contained in:
parent
2d04077df0
commit
7e12ec0e09
@ -522,6 +522,28 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
//public bool HasStandardSteps()
|
||||
//{ return false; }
|
||||
#region PasteChild
|
||||
public ItemInfo PasteChild(int copyStartID) // pastes into an 'empty' docversion
|
||||
{
|
||||
ItemInfo cpItem = ItemInfo.Get(copyStartID);
|
||||
try
|
||||
{
|
||||
DocVersionInfo dvi = DataPortal.Fetch<DocVersionInfo>(new VersionPastingPartCriteria(VersionID, copyStartID, DateTime.Now, Volian.Base.Library.VlnSettings.UserID));
|
||||
ItemInfo tmp = dvi.Procedures[0] as ItemInfo;
|
||||
if (tmp != null)
|
||||
{
|
||||
tmp.UpdateTransitionText();
|
||||
tmp.UpdatePastedStepTransitionText();
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("Details were written to the Error Log.", "Paste Failed", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region UserSettings
|
||||
/// <summary>
|
||||
/// These settings are set on the user interface side.
|
||||
@ -568,6 +590,53 @@ namespace VEPROMS.CSLA.Library
|
||||
return MyItem;
|
||||
}
|
||||
#endregion
|
||||
#region DataPortal
|
||||
private void DataPortal_Fetch(VersionPastingPartCriteria criteria)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersionInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
ApplicationContext.LocalContext["cn"] = cn;
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.Parameters.AddWithValue("@VersionID", criteria.VersionID);
|
||||
cm.Parameters.AddWithValue("@StartItemID", criteria.StartItemID);
|
||||
cm.Parameters.AddWithValue("@DTS", criteria.DTS); //ABC
|
||||
cm.Parameters.AddWithValue("@UserID", criteria.UserID); //ABC
|
||||
SqlParameter param_ContentID = new SqlParameter("@ThisVersionID", SqlDbType.Int);
|
||||
param_ContentID.Direction = ParameterDirection.Output;
|
||||
cm.Parameters.Add(param_ContentID);
|
||||
cm.CommandText = "PasteDocVersionChild";
|
||||
cm.CommandTimeout = Database.DefaultTimeout;
|
||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||
{
|
||||
if (!dr.Read())
|
||||
{
|
||||
_ErrorMessage = "No Record Found";
|
||||
return;
|
||||
}
|
||||
ReadData(dr);
|
||||
}
|
||||
}
|
||||
// removing of item only needed for local data portal
|
||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||
ApplicationContext.LocalContext.Remove("cn");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (!ex.Message.Contains("This document version has been deleted") && !ex.Message.Contains("This current step has been deleted in another session"))
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersion.DataPortal_Fetch", ex);
|
||||
}
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("DocVersion.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Extension
|
||||
partial class DocVersionInfoExtension : extensionBase
|
||||
{
|
||||
@ -580,6 +649,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
public ROFstInfo GetROFst(int rodbid)
|
||||
{
|
||||
if (DocVersionAssociations == null) return null;
|
||||
foreach (AssociationInfo dva in DocVersionAssociations)
|
||||
{
|
||||
if (dva.MyROFst.RODbID == rodbid)
|
||||
@ -657,6 +727,47 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
#region VersionPastingPartCriteria
|
||||
[Serializable()]
|
||||
public class VersionPastingPartCriteria
|
||||
{
|
||||
#region Properties
|
||||
private int _VersionID;
|
||||
public int VersionID
|
||||
{
|
||||
get { return _VersionID; }
|
||||
set { _VersionID = value; }
|
||||
}
|
||||
private int _StartItemID;
|
||||
public int StartItemID
|
||||
{
|
||||
get { return _StartItemID; }
|
||||
set { _StartItemID = value; }
|
||||
}
|
||||
private DateTime _DTS;
|
||||
public DateTime DTS
|
||||
{
|
||||
get { return _DTS; }
|
||||
set { _DTS = value; }
|
||||
}
|
||||
private string _UserID;
|
||||
public string UserID
|
||||
{
|
||||
get { return _UserID; }
|
||||
set { _UserID = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Constructor
|
||||
public VersionPastingPartCriteria(int versionID, int startItemID, DateTime dts, string userID)
|
||||
{
|
||||
_VersionID = versionID;
|
||||
_StartItemID = startItemID;
|
||||
_DTS = dts;
|
||||
_UserID = userID;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
public enum VersionTypeEnum : int
|
||||
{
|
||||
WorkingDraft = 0, Temporary = 1, Revision = 128, Approved = 129
|
||||
|
Loading…
x
Reference in New Issue
Block a user