diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/AnnotationExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/AnnotationExt.cs index 93099383..62af913e 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/AnnotationExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/AnnotationExt.cs @@ -99,6 +99,7 @@ namespace VEPROMS.CSLA.Library // ItemInfo prevItem = item.MyPrevious; // item.OnBeforeDelete(); DataPortal.Delete(new DeleteCriteria(obj.AnnotationID, Volian.Base.Library.VlnSettings.UserID)); + AnnotationInfo.StaticOnInfoChanged(); // if (nextItem != null) // Adjust PreviousID for NextItem // { // ItemInfo.RefreshPrevious(nextItem.ItemID, item.PreviousID); diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/AuditExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/AuditExt.cs index 0f542d80..d857d8aa 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/AuditExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/AuditExt.cs @@ -72,6 +72,12 @@ namespace VEPROMS.CSLA.Library get { return _ItemID; } set { _ItemID = value; } } + internal string _Typename; + public string TypeName + { + get { return _Typename; } + set { _Typename = value; } + } public override string ToString() { string who = string.Empty; @@ -441,6 +447,77 @@ namespace VEPROMS.CSLA.Library } this.RaiseListChangedEvents = true; } + //byDTS + public static ContentAuditInfoList Get(int contentID, DateTime dts) + { + try + { + //if (_ContentAuditInfoList != null) + // return _ContentAuditInfoList; + ContentAuditInfoList tmp = DataPortal.Fetch(new ContentIDandDTSCriteria(contentID, dts)); + //ContentAuditInfo.AddList(tmp); + //tmp.AddEvents(); + //_ContentAuditInfoList = tmp; + return tmp; + } + catch (Exception ex) + { + throw new DbCslaException("Error on ContentAuditInfoList.Get", ex); + } + } + [Serializable()] + protected class ContentIDandDTSCriteria + { + private int _ContentID; + public int ContentID + { get { return _ContentID; } } + private DateTime _DTS; + public DateTime DTS + { + get { return _DTS; } + } + public ContentIDandDTSCriteria(int contentID, DateTime dts) + { + _ContentID = contentID; + _DTS = dts; + } + } + private void DataPortal_Fetch(ContentIDandDTSCriteria criteria) + { + this.RaiseListChangedEvents = false; + if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentAuditInfoList.DataPortal_Fetch", GetHashCode()); + try + { + using (SqlConnection cn = Database.VEPROMS_SqlConnection) + { + using (SqlCommand cm = cn.CreateCommand()) + { + cm.CommandType = CommandType.StoredProcedure; + cm.CommandText = "getContentAuditsByContentIDandDTS"; + cm.Parameters.AddWithValue("@ContentID", criteria.ContentID); + cm.Parameters.AddWithValue("@DTS", criteria.DTS); + using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader())) + { + IsReadOnly = false; + while (dr.Read()) + { + ContentAuditInfo cai = new ContentAuditInfo(dr); + cai.ActionWhat = dr.GetString("ActionWhat"); + this.Add(cai); + // this.Add(new ContentAuditInfo(dr)); + } + IsReadOnly = true; + } + } + } + } + catch (Exception ex) + { + if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentAuditInfoList.DataPortal_Fetch", ex); + throw new DbCslaException("ContentAuditInfoList.DataPortal_Fetch", ex); + } + this.RaiseListChangedEvents = true; + } //by delete status public static ContentAuditInfoList GetByDeleteStatus(int deleteStatus) { @@ -568,6 +645,7 @@ namespace VEPROMS.CSLA.Library cai.ActionWhen = dr.GetDateTime("ActionWhen"); cai.Path = dr.GetString("Path"); cai.ItemID = dr.GetInt32("ItemID"); + cai.TypeName = dr.GetString("TypeName"); this.Add(cai); } @@ -653,6 +731,7 @@ namespace VEPROMS.CSLA.Library cai.ActionWhen = dr.GetDateTime("ActionWhen"); cai.Path = dr.GetString("Path"); cai.ItemID = dr.GetInt32("ItemID"); + cai.TypeName = dr.GetString("TypeName"); this.Add(cai); } @@ -1373,8 +1452,25 @@ namespace VEPROMS.CSLA.Library tmp.RefreshContentTransitions(); using (Content ctmp = tmp.Get()) { - ContentInfo.Refresh(ctmp); + ROFstInfo myrofst = tmp.ContentItems[0].MyProcedure.MyDocVersion.DocVersionAssociations[0].MyROFst; + ROFSTLookup mylookup = myrofst.ROFSTLookup; + foreach(RoUsageInfo rou in tmp.ContentRoUsages) + { + ROFSTLookup.rochild rocc = mylookup.GetRoChild12(rou.ROID); + string myvalue = rocc.value; + int mytype = rocc.type; + ctmp.FixContentText(rou, myvalue, mytype, null); + } + Content cctmp = ctmp; + if (ctmp.IsDirty) + { + cctmp.DTS = DateTime.Now; + cctmp = ctmp.Save(); + } + ContentInfo.Refresh(cctmp); } + //FixContentText(RoUsageInfo rousg, string value, int rotype, ROFstInfo origROFstInfo + return tmp; } catch (Exception ex)