Exemplo n.º 1
0
        int GetLastItemID(ListInfo list)
        {
            var items = GetListXml(list).SelectNodes("//Item").OfType <XmlElement>();

            return(items.Any() ? items.Max(item =>
                                           ValueUtility.GetInt(item.GetAttribute("ID"))) : 0);
        }
Exemplo n.º 2
0
        protected override int GetFolderChildCount(XmlElement source)
        {
            var value = source.GetAttribute("ows_ItemChildCount");

            return(string.IsNullOrEmpty(value) ? 0 :
                   ValueUtility.GetInt(ValueUtility.GetLookupValue(value)));
        }
Exemplo n.º 3
0
        protected override int GetFileSize(XmlElement source)
        {
            var value = source.GetAttribute("ows_FileSizeDisplay");
            int result;

            if (!string.IsNullOrEmpty(value) && ValueUtility.TryGetInt(value, out result))
            {
                return(result);
            }
            value = source.GetAttribute("ows_File_x0020_Size");
            return(string.IsNullOrEmpty(value) ? 0 :
                   ValueUtility.GetInt(ValueUtility.GetLookupValue(value)));
        }
Exemplo n.º 4
0
        string GetNextVersionNumber(XmlElement target)
        {
            // File can contain only versions - Version elements - no need for XPath here.
            // If the last version is deleted its number is "recycled" later for a new version.
            // The XPath computed is max(Version/@Number).
            var last = target.ChildNodes.OfType <XmlElement>().LastOrDefault();

            if (last == null)
            {
                return("1");
            }
            var next = ValueUtility.GetInt(last.GetAttribute("Number")) + 1;

            return(next.ToStringI());
        }
Exemplo n.º 5
0
 public void TestGetInt()
 {
     Assert.AreEqual(12, ValueUtility.GetInt("12"));
     try {
         ValueUtility.GetInt("");
         Assert.Fail();
     } catch {}
     try {
         ValueUtility.GetInt("1.2");
         Assert.Fail();
     } catch {}
     try {
         ValueUtility.GetInt("A");
         Assert.Fail();
     } catch {}
 }
Exemplo n.º 6
0
 protected override int GetItemID(XmlElement source)
 {
     return(ValueUtility.GetInt(source.GetAttribute("ID")));
 }
Exemplo n.º 7
0
        protected override int GetListItemCount(XmlElement source)
        {
            var value = source.GetAttribute("ItemCount");

            return(string.IsNullOrEmpty(value) ? 0 : ValueUtility.GetInt(value));
        }