Esempio n. 1
0
 /// <summary>
 /// Returns the latest version.
 /// </summary>
 /// <param name="groupId"></param>
 /// <returns></returns>
 public override VersionItem GetVersionByGroupId(string groupId)
 {
     using (var transaction = new TransactionScope(_configuration))
     {
         var vDTS = new VersionItemDataStore(transaction);
         return(vDTS.FindVersionByGroupId(groupId));
     }
 }
Esempio n. 2
0
        public string GetNextVersionNumber(VersionType versionType, string itemId)
        {
            string versionNumber = string.Empty;

            //find the version item with the id
            // pass in the versionnumber

            using (var transaction = new TransactionScope(_configuration))
            {
                var vDTS = new VersionItemDataStore(transaction);

                //VersionItem item = vDTS.FindAll().First<VersionItem>(x => x.ItemId.Equals(ItemId));
                VersionItem item          = vDTS.FindGroupIdByItemId(itemId);
                VersionItem latestVersion = vDTS.FindVersionByGroupId(item.GroupId);
                return(GenerateVersionNumber(versionType, latestVersion.VersionNumber));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Returns list of all the latest drafts
        /// </summary>
        /// <returns></returns>
        public override List <VersionItem> GetAllLatestDrafts()
        {
            using (var transaction = new TransactionScope(_configuration))
            {
                var vDTS = new VersionItemDataStore(transaction);
                IList <VersionItem> allVersions = vDTS.FindAll();
                List <VersionItem>  A           = new List <VersionItem>(); //get only unique group ids
                List <VersionItem>  B           = new List <VersionItem>(); //get all group IDs
                List <VersionItem>  C           = new List <VersionItem>(); // the list with latest versions only

                //iterate through all version items.
                //put unique groupIds in one list
                //use that list to iterate through the versionItems again and retrieve the latest of all version for the particular groupID
                foreach (VersionItem item in allVersions)
                {
                    if (B.Count > 0 && B.Exists(x => x.GroupId.Equals(item.GroupId)) == true)
                    {
                        B.Add(item);
                    }
                    else
                    {
                        A.Add(item);
                        B.Add(item);
                    }
                    //get groupID
                    //add to list
                }

                foreach (VersionItem itemA in A)
                {
                    C.Add(vDTS.FindVersionByGroupId(itemA.GroupId));
                }
                //return the list which has the version items with only latest draft.
                return(C);
            }
        }